Community
cancel
Showing results for 
Search instead for 
Did you mean: 
peng__hanbing
Beginner
290 Views

error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MKL_DFTI]

Dear there,

recently I would like to run some example codes of Intel@ MKL to learn the usage of it. I use the Microsoft Visual Studio Community 2019+Intel Parallel Studio XE 2019 as my develop environment. The first example I tried is the "basic_dp_complex_dft_1d.f90" uncompressed and copied from the directory ".../examples_core_f/dftf/source". After setting the link to MKL via operations: Project Property Pages->Fortran->Libraries->Use Intel Math Kernel Library-> Parallel (/Qmkl:parallel), the Build was failed with serval error messages reported. Among those errors, the first one "error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MKL_DFTI]" seems to be the root cause of others. Module file mkl_dfti.f90 needed by the source file could not be found.

According to the MKL documentation, it is enough to link with the application via turning on the Use Intel Math Kernel Library switch. But in this case, it seems does not work. I also tried to add the directory where the module file mkl_dfti.f90 exists to the include path via operations: Project Property Pages->Fortran->General->Additional Include Directories, but it failed as well.

Finally I tried to add the file mkl_dfti.f90 directly to the project, via operations: right click on the project->Add->Existing Item->navigate to the directory and choose it. The Build process was successfully finished.

I can't understand the reason and think the last way which makes it is very inconvenient(You have to know the positions of every module files that needed). Could you give me some explanation about this or recommend some other better ways to use the MKL?

Thanks a lot~

 

0 Kudos
5 Replies
mecej4
Black Belt
290 Views

When a module file (e.g., MKL_DFTI.mod) is reported as missing, it is not necessarily because the corresponding source file (mkl_dfti.f90) is missing or could not be found. For some modules, only the source file is provided, and it is upto the user to compile the file and place the resulting module files in their proper locations.

Perform the following operation once per MKL release, for each target CPU option. Compile the source file mkl_dfti.f90. If you are targeting IA32, place the resulting .mod file in ...\mkl\include\ia32. Similarly for LP64 and ILP64 targets. Once you have done this, you are ready to build programs in which this module is USEd.

Since mkl_dfti.f90 is the source of a separate module, do not include this file within any other program unit source. You can add mkl_dfti.f90 to every project which needs it, and get things to work, but this causes repetitious compiling and is unnecessary.

If you are going to be using BLAS95/Lapack95 interfaces, it will be helpful to use https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor .

peng__hanbing
Beginner
290 Views

mecej4 wrote:

When a module file (e.g., MKL_DFTI.mod) is reported as missing, it is not necessarily because the corresponding source file (mkl_dfti.f90) is missing or could not be found. For some modules, only the source file is provided, and it is upto the user to compile the file and place the resulting module files in their proper locations.

Perform the following operation once per MKL release, for each target CPU option. Compile the source file mkl_dfti.f90. If you are targeting IA32, place the resulting .mod file in ...\mkl\include\ia32. Similarly for LP64 and ILP64 targets. Once you have done this, you are ready to build programs in which this module is USEd.

Since mkl_dfti.f90 is the source of a separate module, do not include this file within any other program unit source. You can add mkl_dfti.f90 to every project which needs it, and get things to work, but this causes repetitious compiling and is unnecessary.

If you are going to be using BLAS95/Lapack95 interfaces, it will be helpful to use https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor .

Thanks for your reply. 

So, according to your view, every time a module file like MKL_DFTI.mod is needed, I should compile its source file and place it at the right directory. Is there any documentation about this operation? like how to compile those module source files? with what command and compile options?

Then, "Since mkl_dfti.f90 is the source of a separate module, do not include this file within any other program unit source.", could you explain this sentence in a another way? I am afraid that I didn't get it completely.

Finally, do you think the best way to use a module like MKL_DFTI.mod in a program is what you just said at the beginning(i.e. compile the source file and place it appropriately) ? 

mecej4
Black Belt
290 Views

peng, hanbing wrote:

So, according to your view, every time a module file like MKL_DFTI.mod is needed, I should compile its source file and place it at the right directory. Is there any documentation about this operation? like how to compile those module source files? with what command and compile options?

No. You do this the first time the module is needed by one of your programs and the compiler says it does not find the module.

peng, hanbing wrote:

Then, "Since mkl_dfti.f90 is the source of a separate module, do not include this file within any other program unit source.", could you explain this sentence in a another way? I am afraid that I didn't get it completely.

The source file mkl_dfti.f90 starts with MODULE and ends with END MODULE. Such a file should not be named in an INCLUDE statement that is located inside a program unit such as a program, subroutine, function, block data or another module. If you follow my advice, you should never find yourself in this situation at all, so don't worry about it.

peng, hanbing wrote:

Finally, do you think the best way to use a module like MKL_DFTI.mod in a program is what you just said at the beginning(i.e. compile the source file and place it appropriately) ?

Yes. To generate the module file, do the following:

1. Open an Intel Fortran command window from the Windows Start menu.

2. Change to a working directory. Copy the source file mkl_dfti.f90 to this directory.

3. Compile it using the command ifort /c mkl_dfti.f90. 

4. Copy the module file to the proper location. If the command window is for IFort-32-bit-targets, copy to ..\mkl\include\ia32. If for 64-bit targets, and your default integer is 4-bytes, copy to ..\mkl\include\intel64\Lp64. If for 64-bit targets and default 8-byte integers, use the option /integer-size:8 and copy the module file to ..\mkl\include\intel64\Ilp64.

peng__hanbing
Beginner
290 Views

mecej4 wrote:

Quote:

peng, hanbing wrote:

 

So, according to your view, every time a module file like MKL_DFTI.mod is needed, I should compile its source file and place it at the right directory. Is there any documentation about this operation? like how to compile those module source files? with what command and compile options?

 

No. You do this the first time the module is needed by one of your programs and the compiler says it does not find the module.

Quote:

peng, hanbing wrote:

 

Then, "Since mkl_dfti.f90 is the source of a separate module, do not include this file within any other program unit source.", could you explain this sentence in a another way? I am afraid that I didn't get it completely.

 

The source file mkl_dfti.f90 starts with MODULE and ends with END MODULE. Such a file should not be named in an INCLUDE statement that is located inside a program unit such as a program, subroutine, function, block data or another module. If you follow my advice, you should never find yourself in this situation at all, so don't worry about it.

Quote:

peng, hanbing wrote:

 

Finally, do you think the best way to use a module like MKL_DFTI.mod in a program is what you just said at the beginning(i.e. compile the source file and place it appropriately) ?

 

Yes. To generate the module file, do the following:

1. Open an Intel Fortran command window from the Windows Start menu.

2. Change to a working directory. Copy the source file mkl_dfti.f90 to this directory.

3. Compile it using the command ifort /c mkl_dfti.f90. 

4. Copy the module file to the proper location. If the command window is for IFort-32-bit-targets, copy to ..\mkl\include\ia32. If for 64-bit targets, and your default integer is 4-bytes, copy to ..\mkl\include\intel64\Lp64. If for 64-bit targets and default 8-byte integers, use the option /integer-size:8 and copy the module file to ..\mkl\include\intel64\Ilp64.

Thank you so much for your detailed reply! It helps a lot.

Solution for the problem related to the module MKL_DFTI is clear now. Does it also apply to the similar problems related to other modules?

I have not  tried any other examples yet, but it seems that the module source file mkl_dfti.f90 would not be the only one that should be pre-compiled when using MKL (other components of MKL, e.g. LAPACK, VM, ...).

mecej4
Black Belt
290 Views

Correct. When you see a USE ... statement in one of the example files and the compiler says that it does not find the module file with the module named in that statement, you need to find a source file in which the source code for that module is located, and compile that source file.

Sometimes, a single source file may contain the sources for more than one module, and the name of the source file may not contain the module name, so a little bit of searching may be necessary, but this is not hard to do.