error F0004 : Unable to open MODULE file

Hi there,

I am using PGI Fortran compiler 12.1 on windows 7, I have a code that compile perfectly with PGI, I want to move some of the subroutines to GPU, unfortunately, when I created a module called GReynVar_mod, I have the following error when I compile:

Error 1 Unable to open MODULE file greynvar_mod.mod D:\Cuda Dev\Quick_cuda\reynolds.f90 354

in file reynolds.f90, line 354:

use GReynVar_mod

by the way, the original code have few modules that have no problems to compile before I created the module.

please advice.

Dolf

Hi Dolf,

The error simply means that the dependent module file can’t be found. Some possible reasons why are:

  • The file that file that contains the module hasn’t been compiled yet.

If you are using PVF, then this message is not unusual especially if it’s the first time the project is compiled. PVF will make multiple compilation passes building up a dependency list. If your dependencies change, then you may need to first clean the project before rebuilding.

If you are using makefiles, you need to add the GReynVar_mod.obj to reynolds.f90 dependencies.

If you are building by hand, you need to compile the GReynVar_mod file before compiling reynolds.f90

  • You built the GReynVar_mod module in a different directory.

The default is to look in the same directory as the source for any dependent files. If the module file is in a different directory, you can tell the compiler search this directory by using the “-I” or "-module " flags.

\

  • Mat

I am using PVF on windows 7, that’s why its strange to me to have this unfamiliar error.

what do you think??

Dolf

new update:
I moved my module to the file common.f90 (where all the other modules located), now I have 56 similar errors, such us:

Error 1 Host MODULE data cannot be used in a DEVICE or GLOBAL subprogram - iqpo D:\Cuda Dev\Quick_cuda\common.f90 463

output shows:
D:\Cuda Dev\Quick_cuda\common.f90(463) : error S0520 : Host MODULE data cannot be used in a DEVICE or GLOBAL subprogram - iqpo

  1. why I have to move the module related to GPU to common.f90?
    is there something I missed?

  2. why some of the variables like iqpo cannot be used in a global module?

  1. why I have to move the module related to GPU to common.f90?
    is there something I missed?

I don’t know for sure how your project is organized, but if your module’s source file is not part of your project, then the rest of your program wont be able to find the generated module file.

  1. why some of the variables like iqpo cannot be used in a global module?

These errors mean that you are trying to use a variable who’s data storage resides in host memory within code that is running on the GPU. The GPU can not directly access host memory.

  • Mat

Hi Mat,

so, I did copy all the variables from host memory to a designated device memory, passed them to the GPU subroutine, and there is no errors from that kind anymore, but, when I try to compile, it compiles but, at the end it gives me the following error and exit:

D:\Cuda Dev\Quick_cuda\common.f90(602) : error F0000 : Internal compiler error. Device compiler exited with error status code 0
PGF90/x86-64 Windows 12.3-0: compilation aborted
by the way, line 602 is the end of the do loop I used to control the threads being executed.
here is the beginning of the subroutine:

i = (blockidx%x - 1) * blockDim%x + threadidx%x
j = (blockidx%y - 1) * blockDim%y + threadidx%y

main: do while ((i >= 2 .AND. i <= nx) .AND. (j >= 2 .AND. j <= ny-1))

enddo main <=======line 602 of common.f90
why its doing that?? this is the first time I encounter this issue.
did I miss used anything?

thanks,
Dolf

Hi Dolf,

Are there any messages above the this one? This is just a generic error stating that the backend NVIDIA tools failed for some reason. There should additional messages above this as to why it failed.

Thanks,
MAt

------ Rebuild All started: Project: Quick_cuda, Configuration: Debug x64 ------
Deleting intermediate and output files for project ‘Quick_cuda’, configuration ‘Debug’
Compiling Project …
common.f90
C:\Users\THOLFA~1\AppData\Local\Temp\pgcudafor2afGjcpz3qs2xg.gpu(129): error: identifier “_fklookuptable_0” is undefined

C:\Users\THOLFA~1\AppData\Local\Temp\pgcudafor2afGjcpz3qs2xg.gpu(151): error: identifier “_q4_globals_0” is undefined

2 errors detected in the compilation of “C:\Users\THOLFA~1\AppData\Local\Temp\pgnvd2aEy8bAr4LSv_3.nv0”.
D:\Cuda Dev\Quick_cuda\common.f90(467) : error F0000 : Internal compiler error. Device compiler exited with error status code 0
PGF90/x86-64 Windows 12.3-0: compilation aborted
common.f90
C:\Users\THOLFA~1\AppData\Local\Temp\pgcudafor2aemCbmzPQB28s.gpu(129): error: identifier “_fklookuptable_0” is undefined

C:\Users\THOLFA~1\AppData\Local\Temp\pgcudafor2aemCbmzPQB28s.gpu(151): error: identifier “_q4_globals_0” is undefined

2 errors detected in the compilation of “C:\Users\THOLFA~1\AppData\Local\Temp\pgnvd2aFS7Dr7o11e6.nv0”.
D:\Cuda Dev\Quick_cuda\common.f90(467) : error F0000 : Internal compiler error. Device compiler exited with error status code 0
PGF90/x86-64 Windows 12.3-0: compilation aborted
flow.f90
force.f90
geometry.f90
grid.f90
Humidity.f90
init.f90
inverse.f90
misc.f90
mult.f90
OlderReynoldsRoutines.f90
openout.f90
OptionalParams.f90
output.f90
Quick4.f90
reynolds.f90
D:\Cuda Dev\Quick_cuda\reynolds.f90(380) : warning W0119 : Redundant specification for qn1
D:\Cuda Dev\Quick_cuda\reynolds.f90(380) : warning W0119 : Redundant specification for qn2
D:\Cuda Dev\Quick_cuda\reynolds.f90(566) : warning W0115 : Assignment to DO variable i in loop
D:\Cuda Dev\Quick_cuda\reynolds.f90(589) : warning W0115 : Assignment to DO variable i in loop
0 inform, 4 warnings, 0 severes, 0 fatal for getreynoldsvariables
ReynoldsDirected.f90
string.f90
UserDefGeom.f90
util.f90
Quick_cuda build failed.
Build log was saved at “file://D:\Cuda Dev\Quick_cuda\x64\Debug\BuildLog.htm”

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========



line 129 of pgcudafor2afGjcpz3qs2xg.gpu

_k_1 = (((loc))+((_fklookuptable_0->mm44)))*(8);

line 151:

_k_1 = ((((i))+(((j))((_q4_globals_0->mm10104))))+((_q4_globals_0->mm10044)))(8);

any ideas??

Dolf

Looks like the compiler is generating bad GPU code. Can you send a reproducing example to PGI Customer Support (trs@pgroup.com) so we can determine what’s wrong?

Thanks,
Mat

Hi Mat,

what is reproducing example mean? like a portion of the code contains the module and the GPU subroutine that I want to compile?

thanks,
Dolf

Hi Dolf,

We need enough of the source code that we can reproduce the error here. If you want, you can send us the all source files but some users prefer to send only a minimal amount of source.

  • Mat

Hi Dolf,

The problem is that you are using several host arrays (see below) from within device code. This is illegal since only device arrays may be accessed within device code. The compiler should be giving you a syntax error but isn’t for some reason. I’ve add TPR#18741 asking our engineers to investigate. To fix your code, you need to allocate device arrays and then copy the host values to the device.

  • Mat