Dear Mat Colgrove
About one month ago, the code including global pointer to fixed size array with “attach” directive was tested and it seemed good with HPC-SDK 22.5 (pgc++). However, recently, the code has been tested again but this time with HPC-SDK 21.3 (pgc++), and a strange compiler message was found. In specific, the following message was repeated 6 times in the end of compiling.
invalid subroutine type ref
!9 = !DISubroutineType(types: !10)
!10 = !{!11}
!11 = !{i32 24}
What is this? The test code with “attach” directive is as follows;
using namespace std;
#define DIM 3
static double (*Position)[DIM];
#pragma acc declare create(Position)
const int N=10;
const int W=3;
static void allocatePosition( void ){
Position=(double (*)[DIM])malloc(sizeof(double [DIM])*N);
#pragma acc enter data create(Position[0:N][0:DIM]) attach(Position)
}
static void calculatePosition( void ){
#pragma acc kernels
#pragma acc loop independent
for(int iP=0;iP<N;++iP){
Position[iP][0]=iP/W;
Position[iP][1]=iP%W;
Position[iP][2]=0;
}
}
static void outputPosition( void ){
#pragma acc update host(Position[0:N][0:DIM])
for(int iP=0;iP<N;++iP){
printf("%d: %e %e %e\n",iP,Position[iP][0],Position[iP][1],Position[iP][2]);
}
}
int main(int argc, char *argv[]){
allocatePosition();
calculatePosition();
outputPosition();
#pragma acc exit data delete(Position[0:N][0:DIM]) detach(Position)
return 0;
}
In upgrading my main code:
HPC-SDK/22.x has another problem: Shared memory is not correctly used in kernels block, but I recently found that it is not emerged in HPC-SDK/21.3. So, firstly, I’m considering to update my code for HPC-SDK/21.3.
regards,
Masahiro Kondo