Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AThar2
Beginner
135 Views

Compilation with MKL_VSL gives compiler error

Hello

 

This is probably quite simple. When I am using MKL modules like MKL_VSL within my own module I get a compiler error saying Error in opening the compiled module file. Check INCLUDE path

 

However, I do have -I$(MKLROOT)/include when I am compiling my code. Am I missing something? I read somewhere that I might need an "include mkl_vsl.fi". However, If I put this into my own Fortran module I get other clashes, as I am now trying to include a module within a module

 

 

Thanks

 

best

Ali

0 Kudos
3 Replies
Pavel_D_Intel1
Employee
135 Views

Hi Ali,
Glad to see your interest to the Intel MKL VSL.

To use Intel MKL VSL functionality you need to add ‘mkl_vsl.f90’ include file to your Fortran module.

You were right -I$(MKLROOT)/include is a right compiler option to link Intel MKL.
Please note: here you can find Intel MKL link adviser - https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor. It can help you in terms of Intel MKL linking.

Hope it addresses your question. If not – please provide a full compilation line and small reproducer for your problem (if it is possible).
Feel free to ask more.

Best regards,
Pavel.

AThar2
Beginner
135 Views

Hello Pavel,

I found the problem, and I wonder whether this is not a minor bug from Intel's side.

 

The problem was if I had the following:

 

include 'mkl_vsl.f90'

module mod_


(..)
(..)

end module_ 

 

Now if I did have the use mod_ from a different file, the compiler will error me telling that the mod_ is not compiled, check the include path.

However, I did compile my module mod_1 !. So what I realized was that the compiler simply skipped everything below the include mkl_vsl.f90.

 

The reason is simply that I had in my compiler option the following

 

-stand f08 -diag-file

 

That creates loads of warnings when having mkl_vsl.f90 included, and I think the compiler because of that gives up after it has finished including the mkl_vsl file.

 

 

Example

 

      include 'mkl_vsl.f90'
      module rnd_test

         use MKL_VSL
         use MKL_VSL_TYPE
   !      use mpi

      implicit none
      real(kind=8) t1,t2  ! buffer for random numbers
      real(kind=8) s        ! average
      real(kind=8) a, sigma,a1,a2 ! parameters of normal distribution
      real(kind=8), allocatable :: r(:),r1(:) ! buffer for random numbers

      TYPE (VSL_STREAM_STATE)::stream

      integer errcode
      integer i,j, n11, nloop, nn
      integer brng,method,seed,n, ierr, size, rank
      integer(kind=8) :: nskip, nmax

      end module

 

At a different file have:

 

      program ttest
      use rnd_test
      print*, errcode
      end program

 

Compile with

 

ifort -c modfile.f prog_file.f -stand f08 -diag-file -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl  -DMKL_ILP64 -I${MKLROOT}/include

 

and link

 

ifort modfile.o prog_file.o

 

 

If you remove the following
 

 -stand f08 -diag-file

 

Then, we will not see any problems

 

Thanks

 

best

Ali

 

Pavel_D_Intel1
Employee
135 Views

Hi Ali,

Thank you for your very detailed code samples.

Intel MKL doesn’t provide strict support for F08 (or other) standard.  Thus, compiling with “-stand f08” flag can bring the warning messages you have found.
Also note that those warnings are just messages related to the non-standard Fortran language usage, and the generated code works fine.

Please, let me know if it addresses your questions.

Best regards,
Pavel.

Reply