0

I want to use gfortran to compile some code that uses mlk_vsl.f90 from the Intel MKL library on a Mac.

I'm doing the following:
gfortran -o filename filename.f90 -I/${MKLROOT}/include

and I get this error:

"Can't open module file 'mkl_vsl_type.mod" for reading at (1): No such file or directory"

I know that I have to create the .mod file, but I am not sure how.

2
  • Do you have the MKL sources, containing the interfaces, from which to create the .mod files? Commented Sep 20, 2017 at 20:32
  • What does mkl_vsl.f90 contain? Does it contain the mkl_vsl_type module? Note that the exact linking instructions for MKL are on the Intel website. You can select several options and the site will give you the right command. Commented Sep 20, 2017 at 20:42

1 Answer 1

1

You're on the right track for compiling (if add -c). A few suggestions:

  1. Try adding -fno-range-check, which is required to get gfortran to compile the mkl_vsl modules correctly (.mod files created automatically when you compile your main program)
  2. Not knowing what is set for MKLROOT, you may have an extra backslash; try
    -I${MKLROOT}/include

However, for linking you probably need additional libraries. The easiest way to see how to link is to look at one of the examples in your MKLROOT dir mkl/examples/vslf/source which has source files that use mkl_vsl. In mkl/examples/vslf there is a makefile you can run to generate executables and print the link lines. Use make help for more info. For example, to compile vslssort.f with gfortran and static linking: make libintel64 compiler=gnu function=vslssort. Just note two caveats: The link line uses libmkl_intel_thread.a instead of libmkl_gnu_thread.a, and it uses the -J flag to put the created .mod files in a different directory which MUST be created before linking.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.