Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26730 Discussions

Compiling a module which uses the mkl_dss module


I am using Windows 7 64-bit with Intel Parallel Studio XE 2013. I have a .FOR file that contains the following line called within a module:

use mkl_dss

which obviously comes from the Math Kernel Library.

I tried compiling at as shown below:

D:\TEMP\TRUNK-IFORT>ifort -free -fpp -D__INTEL_COMPILER -c Solver.FOR /Qmkl=parallel

Which results in:

Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Inte
l(R) 64, Version Build 20121008
Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.

fpp: warning: macro redefined: __INTEL_COMPILER
Solver.FOR(25): error #7002: Error in opening the compiled module file.  Check I
NCLUDE paths.   [MKL_DSS]
      use mkl_dss

I've tried several things such as running the mklvars.bat file but none of them worked. What might be the root cause of this? How can I get the MKL library to be recognized by my module?

0 Kudos
3 Replies
Black Belt

There is a source file named mkl_dss.f90 in the MKL includes directory. Compile that for the platform(s) of your choice and, at your option, place the mkl_dss*.mod files that are then produced in the ia32 or intel64\lp64 or intel64\ilp64 directories, as appropriate. You can also place them in another working directory, if you so choose.

You can achieve the same effect by adding

     include 'mkl_dss.f90'

in one of your source files outside any subprogram code, but this will cause the .mod files to be regenerated every time that you recompile your source files. This repetitious regeneration is unnecessary, and may cause a slight delay in the compilations.

Most MKL projects do not use the DSS routines. That is why /Qmkl, etc., will not make a difference if you do not make the module files available to the compiler.


Hi mecej4. I followed your first piece of advice, namely to compile the mkl_dss.f90 source file first and then compile the module that depends on it. Compiling mkl_dss.f90 generates 1 .obj file and 2 .mod files. They are mkl_dss.obj, mkl_dss_private.mod and mkl_dss.mod. The module that depends on mkl_dss.f90 compiles fine with no errors. Unfortunately when I try to compile the main program I get a number of unresolved references for some interface items in mkl_dss.f90:

Solver.obj : error LNK2019: unresolved external symbol DSS_CREATE referenced in
Solver.obj : error LNK2019: unresolved external symbol DSS_DEFINE_STRUCTURE refe
Solver.obj : error LNK2019: unresolved external symbol DSS_REORDER referenced in
Solver.obj : error LNK2019: unresolved external symbol DSS_FACTOR_REAL_D_ refere
nced in function 
Solver.obj : error LNK2019: unresolved external symbol DSS_SOLVE_REAL_D referenc
ed in function 
Solver.obj : error LNK2019: unresolved external symbol DSS_DELETE referenced in
MAIN.exe : fatal error LNK1120: 6 unresolved externals

Something is obviously missing here but I'm not sure what. Is there an additional module mkl_dss.f90 depends on which I'm not aware of ?


Black Belt

The DSS routines are contained in the MKL libraries. In the link step, you must specify that the MKL libraries should be used. For simple cases, you can use the /Qmkl option of the compiler; for more complex projects, please see the MKL Link Line Advisor (see ) and configure the command line accordingly.