Hi,
I’m porting part of a code with OpenMP 4.5 to OpenACC. Data is initialized and allocated on the device (doesn’t re-allocate each time the loop executes) and updated values will be updated to device. But modifying some existing macros to achieve loop-level parallelism is causing issues:
Example of OpenMP version:
const int *_th_plo = loVect(); \
const int *_th_plen = length(); \
T* _th_p = dptr; \
const int _ns = (ns); \
const int _nc = (nc); \
_Pragma("omp target update to(_th_p[_ns*_th_plen[2]:(_ns+_nc)*_th_plen[2]])") \
_Pragma("omp target teams distribute parallel for collapse(3)") \
for(int _n = _ns; _n < _ns+_nc; ++_n) { \
for(int _k = 0; _k < _b_len[2]; ++_k) { \
for(int _j = 0; _j < _b_len[1]; ++_j) { \
int nR = _n; nR += 0; \
OpenACC version:
_Pragma("acc update device(_th_p[_ns*_th_plen[2]:(_ns+_nc)*_th_plen[2]])") \
_Pragma("acc parallel loop collapse(3)") \
I get the following error:
“…/…/Src/C_BaseLib/BaseFab.H”, line 1460: error: expected a “]”
ForAllThisBNN(T,bx,ns,num)
^
detected during:
instantiation of “void BaseFab::performSetVal(T, const Box &,
int, int) [with T=int]” at line 1074
instantiation of “void BaseFab::setVal(T) [with T=int]” at line
334 of “…/…/Src/C_BaseLib/FabArray.cpp”
And will only compile with:
_Pragma("acc update device(_th_p[_ns:(_ns+_nc])") \
_Pragma("acc parallel loop collapse(3)") \
But since it hasn’t updated correctly, causes illegal address error:
call to cuStreamSynchronize returned error 700: Illegal address during kernel execution
call to cuMemFreeHost returned error 700: Illegal address during kernel execution
Thanks,
Zahra