PhysicsofFluids / AFiD_GPU_opensource

Version of the AFiD code ported to GPU accelerators
MIT License
41 stars 18 forks source link

issue in "decomp_info_init" subroutine of "decomp_2d.F90" file #1

Closed ardastan closed 5 years ago

ardastan commented 5 years ago

Hi, It seems that the decomp_info_init subroutine in decomp_2d.F90 file has some problems, particularly at the block #ifdef USE_CUDAstarting at line 716. The calls to c_f_pointer leads to a compilation error in pgi-18.10 with the error:

PGF90-S-0550-Allocatable device array is not in c_f_pointer with -Mallocatable=03 - work1_r_d. (decomp_2d.F90: 733)
PGF90-S-0550-Allocatable device array is not in c_f_pointer with -Mallocatable=03 - work2_r_d. (decomp_2d.F90: 735)

By using pgi-16.5, however, the code is compiled successfully, but it fails to run when it reaches line 733 - the first call to c_f_pointer.

Moreover, the definitions of cptr1 and cptr2 are not consistent.

Would you please take a look at these?

Many thanks. Ali

romerojosh commented 5 years ago

Hi @ardastan, Can you try compiling using PGI 18.10 but with the flag -Mallocatable=95? This should fix the issue.

ardastan commented 5 years ago

Hi @romerojosh Thanks for your reply. The problem was resolved with -Mallocatable=95 and it can be compiled and run now. Just out of my curiosity as a CUDA newbie, what does -Mallocatable flag do? Cheers, Ali

maxcuda commented 5 years ago

PGI changed the allocator behavior to follow Fortran2003 semantic and there are some issues. The flag -Mallocatable=95 tells the compiler to follow Fortran95 semantic.