Hi PGI,
I’m trying to use openACC to run a basic Pi estimation code but it will not compile. I’m using a slightly modified version of the code from a pervious forum post:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <curand.h>
//#include "common.h" //Linux header??
// Iterate over pairs of (x,y) from [0,1] x [0,1]
// Increment pointer only if (x,y) is inside a circle with R = 0.5
long pi(float *dx, float *dy, long n)
{
long i, s = 0;
#pragma acc data deviceptr(dx, dy)
#pragma acc kernels
for (i = 0; i < n; i++) {
float x = dx[i] - 0.5;
float y = dy[i] - 0.5;
s += (x*x + y*y < 0.25);
}
return s;
}
int main(int argc, char **argv) {
float *dx, *dy; // device arrays
long s; // counter of successful tries
long n; // number of tries
if (argc < 2) {
fprintf(stderr, "Usage: %s N\n", argv[0]);
return EXIT_FAILURE;
}
if ((n = atol(argv[1])) <= 0) {
fprintf(stderr, "N must be positive\n");
return EXIT_FAILURE;
}
// Allocate memory for device arrays to be filled with random values
cudaMalloc((void *)&dx, n * sizeof(float));
cudaMalloc((void *)&dy, n * sizeof(float));
// Initialize CURAND generator, seed it and generate data
curandGenerator_t g;
curandCreateGenerator(&g, CURAND_RNG_PSEUDO_DEFAULT);
curandSetPseudoRandomGeneratorSeed(g, 0); //TEST SEED ZERO REPLACE WITH time(NULL) when ready.
curandGenerateUniform(g, dx, n);
curandGenerateUniform(g, dy, n);
// Perform computations
s = pi(dx, dy, n);
// Free memory
cudaFree(dx);
cudaFree(dy);
// Print out the result
printf("%lf\n", (double) s / n * 4.0);
return EXIT_SUCCESS;
}
I’m compiling this on a ASUS laptop using on windows 7 (64bit). Nvidia card is a Geforce GT520M. I’m also using PGI accelerator v12.8 (2wk trail version).
When I try to compile this at the command prompt, I recieve the following error.
PGI$ pgcc -acc -ta=nvidia -Minfo=all openACC_Pi_Estimation_Answer_MOD.c -I "C:\
Program Files\PGI\win64\2012\cuda\4.2\include" -L "C:\Program Files\PGI\win64\2
012\cuda\4.2\lib64"
NOTE: your trial license will expire in 13 days, 22.9 hours.
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 105)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier char2 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.h
: 105)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 110)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier uchar2 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.
h: 110)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 125)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier char4 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.h
: 125)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 130)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier uchar4 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.
h: 130)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 145)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier short2 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.
h: 145)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 150)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier ushort2 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types
.h: 150)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 165)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier short4 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.
h: 165)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 166)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier ushort4 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types
.h: 166)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 178)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier int2 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.h:
178)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 179)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier uint2 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.h
: 179)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 191)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier int4 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.h:
191)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 196)
PGC-S-0036-Syntax error: Recovery attempted by inserting keyword struct before i
dentifier uint4 (C:\Program Files\PGI\win64\2012\cuda\4.2\include\vector_types.h
: 196)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword struct (C:\Progr
am Files\PGI\win64\2012\cuda\4.2\include\vector_types.h: 212)
PGC-F-0008-Error limit exceeded (C:\Program Files\PGI\win64\2012\cuda\4.2\includ
e\vector_types.h)
PGC/x86-64 Windows 12.8-0: compilation aborted
PGI$
I haven’t seen this error before. I’ve compiled other openACC programs without an issue on this computer. It’s only a problem when utilising curand.h.
Would you happen to have any ideas as to the cause?
Thank you and kind regards,
Paul