Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6981 Discussions

How to compile a .f90 without placing mkl95_lapack.mod in $PWD

theochem
Beginner
721 Views
Hi, everyone!

The test.f90 below contains an Intel MKL fortran 95 subroutine.

program test
use mkl95_lapack, only: sterf
......
call sterf(d,e)
end


I can compile test.f90 by entering:

ifort test.f90 -L$(LD_LIBRARY_PATH) -lmkl_lapack95 -lguide -lpthread -lmkl -o test.exe

But mkl95_lapack.mod MUST be placed in the current working directory.

How can I compile test.f90 without copying mkl95_lapack.mod into $PWD?

Thanks in advance!

BTW: I have mkl95_lapack.mod installed in

/opt/intel/mkl/10.0.1.014/interfaces/lapack95/obj/mkl95_lapack.mod
/opt/intel/mkl/10.0.1.014/lib/em64t/mkl95_lapack.mod





0 Kudos
2 Replies
Vladimir_Koldakov__I
New Contributor III
721 Views

Hello,


Try:
ifort -I/opt/intel/mkl/10.0.1.014/interfaces/lapack95/obj test.f90 -L$(LD_LIBRARY_PATH) -lmkl_lapack95 -lguide -lpthread -lmkl -o test.exe

As described in the Intel Compiler documentation:
Some programs require modules located in multiple directories. You can use the -I (Linux* and Mac OS*) or /I compiler (Windows*) option when you compile the program to specify the location of the .mod files that should be included in the program.

You can use the -module path (Linux and Mac OS) or /module:path (Windows) option to specify the directory in which to create the module files. If you don't use this option, module files are created in the current directory.

Directories are searched for .mod files in this order:
- Directory of the source file that contains the USE statement
- Directories specified by the -module path (Linux and Mac OS) or /module:path (Windows) option
- Current working directory
- Directories specified by the -Idir (Linux and Mac OS) or /include (Windows) option
- Directories specified with the FPATH (Linux and Mac OS) or INCLUDE (Windows) environment variable
- Standard system directories

Thanks,
Vladimir


0 Kudos
theochem
Beginner
721 Views

Hello,


Try:
ifort -I/opt/intel/mkl/10.0.1.014/interfaces/lapack95/obj test.f90 -L$(LD_LIBRARY_PATH) -lmkl_lapack95 -lguide -lpthread -lmkl -o test.exe

As described in the Intel Compiler documentation:
Some programs require modules located in multiple directories. You can use the -I (Linux* and Mac OS*) or /I compiler (Windows*) option when you compile the program to specify the location of the .mod files that should be included in the program.

You can use the -module path (Linux and Mac OS) or /module:path (Windows) option to specify the directory in which to create the module files. If you don't use this option, module files are created in the current directory.

Directories are searched for .mod files in this order:
- Directory of the source file that contains the USE statement
- Directories specified by the -module path (Linux and Mac OS) or /module:path (Windows) option
- Current working directory
- Directories specified by the -Idir (Linux and Mac OS) or /include (Windows) option
- Directories specified with the FPATH (Linux and Mac OS) or INCLUDE (Windows) environment variable
- Standard system directories

Thanks,
Vladimir


Thank you Vladimir!

I am reading Chapter 5 of Intel MKL User's Guide. It explains most of the stuff and quite helpful!


0 Kudos
Reply