Software Archive
Read-only legacy content
17061 Discussions

Errors about g++_CilkPlus

Xia_Z_
Beginner
388 Views

Hi, everyone, I installed CilkPlus gcc on my fedora as the following http://cilkplus.org/build-gcc-cilkplus, after I installed it

I compile BlackScholes-ArrayNotations.cpp BlackScholes-CilkPlus.cpp BlackScholes-Main.cpp BlackScholes-Serial.cpp using commands

"/home/kain/Software/cilk/gcc-cilk/bin/g++ -ldl -fcilkplus -lcilkrts BlackScholes-ArrayNotations.cpp BlackScholes-CilkPlus.cpp BlackScholes-Main.cpp BlackScholes-Serial.cpp -o cilk"

But some compile errors happened 

BlackScholes-ArrayNotations.cpp:25:13: error: expected constructor, destructor, or type conversion before ‘(’ token
__declspec(vector) static double N(const double& z) {

below is the definition of this function 

25 __declspec(vector) static double N(const double& z) {
26
27     if(z > 6.0) { return 1.0; }; //guards against overflow
28     if(z < -6.0) { return 0.0; };
29     double b1 = 0.31938153;
30     double b2 = -0.356563782;
31     double b3 = 1.781477937;
32     double b4 = -1.821255978;
33     double b5 = 1.330274429;
34     double p = 0.2316419;
35     double c2 = 0.3989423;
36     double a = fabs(z);
37     double t = 1.0/(1.0 + a*p);
38     double b = c2*exp((-z)*(z/2.0));
39     double n = ((((b5*t+b4)*t+b3)*t+b2)*t+b1)*t;
40     n = 1.0 - b*n;
41     if(z < 0.0 )
42     n = 1.0 - n;
43     return n;
44 }

I guess "__declspec(vector)"  could only be identified by Visual Studio , but how can I use it in Linux?

Thank you for your help!! 

0 Kudos
2 Replies
Balaji_I_Intel
Employee
388 Views

Hello Xia,

     Please try using __attribute__ ((vector))

 

Thanks,

 

Balaji V. Iyer.

0 Kudos
Xia_Z_
Beginner
388 Views

Balaji Iyer (Intel) wrote:

Hello Xia,

     Please try using __attribute__ ((vector))

 

Thanks,

 

Balaji V. Iyer.

I got it, in gcc, you need not to specify vecotr, and use it as normal,  a[:] = Function_array(), it can be compied in my environment

0 Kudos
Reply