Intel Fortran with external libraries

Hi,
I am using OpenBlas (libopenblas.a) with gfortran (MSYS2). How can I use the same library in the Visual Studio+Intel Fortran combination? In other words, is there a way to include external libraries to VS+Intel Fortran?

Thanks

No, Gfortran and Intel Fortran libraries are not interchangeable. In fact, you do not even need the OpenBlas libraries if you have Intel Fortran and Intel MKL installed. Instead of the OpenBlas library, use the MKL library. When you create a new Fortran project in Visual Studio, select the option to use MKL.

3 Likes

Hello @hbayraktaroglu and @mecej4! Welcome to Discourse.

@mecej4, your replies at the Intel Fortran forum have helped me a lot in the past.

For users of Linux or mac OS I would add that the Intel Fortran compiler also has an MKL compiler flag: –mkl[=<lib>] where <lib> is either sequential, parallel or cluster. I find this useful for small projects.

For code that has to work with multiple compilers (and using a build system) it is better to use pkg-config or the MKL Link Line Advisor (edited: see post below from @mecej4).

1 Like

On Windows, the command line option /Qmkl corresponds to the -mkl option for Linux and OSX, but I suspected that the OP is building inside Visual Studio.

For more complicated situations, Intel provides a nice tool, the MKL Link Line Advisor.

1 Like

I wish the MKL Link Line Advisor gets updated for NVIDIA HPC SDK, which has now effectively replaced PGI compilers.

1 Like