I have a simple code example:
#include <iostream>
#include <accelmath.h>
#include <openacc.h>
class Example {
public:
Example()
{
S=0;
arr = new int[N];
for(int i=0; i<N; ++i) arr[i]=i;
#pragma acc enter data copyin(this[0:1], arr[0:N])
}
~Example(){delete [] arr;}
long int count()
{
S=0;
//#pragma acc update device(S)
#pragma acc parallel loop gang vector present(arr[0:N]) reduction(+:S)
for(int i=0; i<N; ++i) S += arr[i];
return S;
}
void print()
{
#pragma acc update self(arr[0:N])
for(int i=0; i<N; ++i) std::cout<<arr[i]<<" ";
std::cout<<std::endl;
}
private:
static const int N = 1000;
int * arr;
long int S;
};
int main(int argc, char **argv)
{
Example ex;
std::cout<<ex.count()<<std::endl;
return 0;
}
I fails at runtime with an error:
Failing in Thread:1
call to cuStreamSynchronize returned error 700: Illegal address during kernel execution
Failing in Thread:1
call to cuMemFreeHost returned error 700: Illegal address during kernel execution
How to get it to work?
Could You be so kind to answer some extra questions?
I have been away from my workplace for several months because of COVID-19 quarantine.
Now I had to ask a question on some source code using OpenAcc and saw: PGI forums have moved!
I am a user of PGI user forum for 2 years already, and some 2 years ago M. Colgrove wrote me on the old PGI user forum that I could send some not small size pieces of source code to PGI customer service: trs@pgroup.com asking them to forward it to him, and he will have a look at it.
But now the e-mail address is invalid. Is there any other address or way to seldom send some pieces of C++ code using OpenAcc, which are not convenient to be posted here, with a question to expert.
The old forum looked much more convenient and easier to use. The list of topics was much easier to look through.
There is also a question: how to use pgc++ PGI compiler now? It is written on the PGI official site that: PGI Compilers & Tools have evolved into the NVIDIA HPC SDK.
How to use the compiler now?
NVIDIA HPC SDK docs say:
OpenACC directives are enabled by adding the -acc flag to the compiler command line.
So, use nvc++ with -acc compiler flag, isn’t it? But are the compiler options the same as were in pgc++ (-ta=tesla:cc70, -mcmodel=medium, -Minfo=accel, -Minline and some others)?
Excuse me for so many questions, but there are so many changes which I did not keep track of.