PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

how to compile a c++ program written in VS2012?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
sizheng



Joined: 22 May 2012
Posts: 8

PostPosted: Wed Jul 25, 2012 8:19 am    Post subject: how to compile a c++ program written in VS2012? Reply with quote

as the title asked, how to do it?

when i compile, two types of errors occor:

1) error: support for"new[]" and "delete[]" is disabled

2) catastrophic: #error directive: "ABM instruction set not enabled"

i read the docs, but still don't know what option to use when compiling
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5815
Location: The Portland Group Inc.

PostPosted: Wed Jul 25, 2012 9:35 am    Post subject: Reply with quote

Hi sizheng,

Quote:
1) error: support for"new[]" and "delete[]" is disabled
Can you please post full the compile line where this error occurs as well as the message in context? Also, can you post an example that reproduces the problem?
Quote:
2) catastrophic: #error directive: "ABM instruction set not enabled"
This error is coming from a header file, most likely the GNU specific "abmintrin.h" file. Your code should have a define path where GNU specific header files are not included. If not, it will need to be ported.

- Mat
Back to top
View user's profile
sizheng



Joined: 22 May 2012
Posts: 8

PostPosted: Wed Jul 25, 2012 10:14 am    Post subject: Reply with quote

well, the whole message:

"d:/PGI/Microsoft Open Tools 10/include/crtdbg.h", line 1060: error: support for "new[]" and "delete[]" is disabled
void __CRTDECL operator delete[](void *);

there are other 2 same errors at line 1064 and line 1065

and then:

"d:\PGI/win64/12.5/include/intrin.h", line 25: catastrophic: #error directive: "ABM instruction set not enabled"

so should i add the path of GNU specific header files to PATH variable? or anything else to do?

mkcolg wrote:
Hi sizheng,

Quote:
1) error: support for"new[]" and "delete[]" is disabled
Can you please post full the compile line where this error occurs as well as the message in context? Also, can you post an example that reproduces the problem?
Quote:
2) catastrophic: #error directive: "ABM instruction set not enabled"
This error is coming from a header file, most likely the GNU specific "abmintrin.h" file. Your code should have a define path where GNU specific header files are not included. If not, it will need to be ported.

- Mat
Back to top
View user's profile
sizheng



Joined: 22 May 2012
Posts: 8

PostPosted: Wed Jul 25, 2012 10:15 am    Post subject: Reply with quote

here is my code:

Code:

// SPFA.cpp : 定义控制台应用程序的入口点。
//

//#include "stdafx.h"
#include <tchar.h>
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <numeric>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <ppl.h>
#include <time.h>

using namespace std;
using namespace Concurrency;

map<long,vector<long>> AdjacencyList;
vector<long> lP;
vector<int> nDiameter;
//long* lP;
//int* nDiameter;

void SPFA_Of(pair<long,vector<long>> node)
{
   long lNodeID=node.first;
   vector<int> D(AdjacencyList.size());
   vector<bool> visited(AdjacencyList.size());
   vector<long> waitingNodes(AdjacencyList.size());

   int Diameter=0;
   int p = 0;
   waitingNodes[p++] = lNodeID;  //源节点入队
   visited[lNodeID] = true;

   for (int i = 0; i < AdjacencyList.size() && waitingNodes[i] >= 0; i++)
   {
      long w = waitingNodes[i];
      waitingNodes[i] = -1;
      for(int j=0;j<AdjacencyList[w].size();j++)
      {
         if (!visited[AdjacencyList[w][j]])
         {
            waitingNodes[p++] = AdjacencyList[w][j];
            visited[AdjacencyList[w][j]] = true;
            D[AdjacencyList[w][j]] = D[w] + 1;
            if(Diameter<D[AdjacencyList[w][j]])   Diameter=D[AdjacencyList[w][j]];
         }
      }
   }
   
   nDiameter[lNodeID] = Diameter;
   lP[lNodeID]=parallel_reduce(D.begin(),D.end(),0);
   cout<<lNodeID<<endl;
}

int _tmain(int argc, _TCHAR* argv[])
{
   long lNodeStartFrom=0;
   bool blnDirected=false;
   string strFileName="G:\\20090814-20120106筛选演化\\已编号\\20090910\\UserRelationBy_2009-09-10_directed_arcs.tmp";
   //string strFileName="";
   long lEdgeCount=0;

   for(int i=1;i<argc;i+=2)
   {
      if(strcmp(argv[i],"-f")==0 || argv[i]=="-F"){strFileName=argv[i+1];}
      if(strcmp(argv[i],"-n")==0 || argv[i]=="-N"){lNodeStartFrom=stoll(argv[i+1]);}
      if(strcmp(argv[i],"-d")==0 || argv[i]=="-D")
      {
         if(strcmp(argv[i+1],"Y")==0 || strcmp(argv[i+1],"y")==0) blnDirected=true;
         else blnDirected=false;
      }
   }

   clock_t start,finish;
   char strLine[50]={0};
   fstream fs(strFileName,ios::in);
   start=clock();
   while(fs.getline(strLine,sizeof(strLine)))
   {
      if(strLine[0]=='*' || strLine[0]=='#') continue;
      string x,y;
      stringstream nodes(strLine);
      nodes>>x;
      nodes>>y;

      long a,b;
      a=stoll(x)-lNodeStartFrom;
      b=stoll(y)-lNodeStartFrom;

      map<long,vector<long>>::const_iterator nodeFinder=AdjacencyList.find(a);
      if (nodeFinder==AdjacencyList.end())
      {
         vector<long> neighbors;
         AdjacencyList.insert(pair<long,vector<long>>(a, neighbors));
      }
      vector<long>::const_iterator edgeFinder=find(AdjacencyList[a].begin(),AdjacencyList[a].end(),b);
      if (edgeFinder==AdjacencyList[a].end()) //边不存在
      {
         AdjacencyList[a].push_back(b);
         lEdgeCount++;
      }
      nodeFinder=AdjacencyList.find(b);
      if (nodeFinder==AdjacencyList.end())
      {
         vector<long> neighbors;
         AdjacencyList.insert(pair<long,vector<long>>(b, neighbors));
      }
      if (!blnDirected) //无向图,反向加边
      {
         edgeFinder=find(AdjacencyList[b].begin(),AdjacencyList[b].end(),a);
         if (edgeFinder==AdjacencyList[b].end()) AdjacencyList[b].push_back(a);
      }

      if ((lEdgeCount & 65535) == 0)
         cout<<lEdgeCount<<" edges loaded."<<endl;
   }
   finish=clock();

   fs.close();

   cout<<finish-start<<" ms by loading data. "<<lEdgeCount<<" edges loaded."<<endl;

   lP=vector<long>(AdjacencyList.size());
   nDiameter=vector<int>(AdjacencyList.size());

   long lDivideBy = AdjacencyList.size() * (AdjacencyList.size() - 1);

   start=clock();
   parallel_for_each(AdjacencyList.begin(),AdjacencyList.end(), [](pair<long,vector<long>> p){SPFA_Of(p);});
   finish=clock();

   long buffer=parallel_reduce(lP.begin(),lP.end(),0);
   cout<<"Calculation Completed. Edges: "<<lEdgeCount<<", Nodes: "<<AdjacencyList.size()<<endl;
   if (blnDirected)
      cout<<"ASP: "<< (4 * buffer) / (double)lDivideBy<<endl;
   else
      cout<<"ASP: "<< buffer / (double)lDivideBy<<endl;
   cout<<"Diameter: "<<*max_element(nDiameter.begin(),nDiameter.end())<<endl;
   cout<<"Time: "<<finish-start<<" ms."<<endl;

   /*cout<<"Input any character to finish."<<endl;
   int z;
   cin>>z;*/

   return 0;
}
[/code]
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5815
Location: The Portland Group Inc.

PostPosted: Wed Jul 25, 2012 11:31 am    Post subject: Reply with quote

Hi sizheng,

Thank you for the code example. The problem appears to be in the MS crtdbg header file that is include with the PGI installation. I've sent a report to our engineers (TPR#18838) for further investigation.

Best Regards,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group