I have a code in MinRepEx.zip (22.4 KB).
The main goal of this code is to fill in the int array PKA_Tls[0:100]. This array is defined in body/T3AllocateData.h on line 61. And it is filled in tpt/include/T3ElasticEMIonIonImpl.h on line 117 using atomic operations.
The output to the file is done in main.cpp on lines 39-45.
The code works properly on CPU and the correct output file lies in the project directory and is named pka_tpt3.dat. The 3d column in it consists of non-zero values. But on GPU somewhy all the 3d column are zero values.
My PC consists of Intel KNL and GPU Titan V.
The problem is with the “PKA_Tls” array. Since it’s a global array accessed directly from an OpenACC routine, it needs to be placed in a “declare” directive. Below are my diffs of your source with the corrections:
Thank You for the answer. I don`t undertand the following. The similar global array particles works properly without acc declare copyin clause. And for PKA_Tls this clause is necessary. Why?
The code is passing particles as an argument to the GetFS routines. PKA_BINDS_NUMBER and PKA_T1s are being directly accessing the global variables so therefor should be included in a declare directive.