When I write a attributes(global) function. Whether I can print variables defined in the subroutine function on the screen?
Yes, CUDA Fortran and Fortran using OpenACC can print from device code. The caveats being that it’s only unformatted (i.e. “print *”) and since the output is buffered, the order in which text is printed is not guaranteed.
OK, thanks for your reply!
I try print *, value to print the variable, but it didn’t display. Should I add some parameters in my command while compiling?
pgf90 -Mcuda=cuda9.2,cc60,rdc -DDOUBLE -Mlarge_arrays -c fast -Mvect=simd -O4 -Munroll -Mconcur Global_Variable.f90
pgf90 -Mcuda=cuda9.2,cc60 -DDOUBLE -Mlarge_arrays -Mvect=simd -O4 -Munroll -Mconcur Global_Variable.obj ThreeD_CTC_Sub_Main.f90
Should I add some parameters in my command while compiling?
Nope, it should just work.
Are you executing this section of code? Are you capturing stdout to a different file?