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

gfortran and mkl

may_ka
Beginner
948 Views

Hi all,

I would like to link to mkl while compiling with gfortran-6.3. The makefile is this

SRC :=
FORTRAN  = gfortran
kernel=$(shell uname -r)
OPTS = -O3 -fno-range-check
MKLROOT=/opt/intel/compilers_and_libraries/linux/mkl
OPT= ${MKLROOT}/include/intel64/lp64 -I${MKLROOT}/include
MKL= ${MKLROOT}/lib/intel64/libmkl_blas95_lp64.a \
	     ${MKLROOT}/lib/intel64/libmkl_lapack95_lp64.a -Wl,--start-group \
	     ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a \
	     ${MKLROOT}/lib/intel64/libmkl_core.a \
	     ${MKLROOT}/lib/intel64/libmkl_sequential.a -Wl,--end-group -lpthread -lm -ldl

ARCH     = ar
ARCHFLAGS= cr
RANLIB   = ranlib
LibName=Lib_Tools_$(FORTRAN)_$(kernel)_1.0.a

.SUFFIXES:
.SUFFIXES: .f90

include ../Moduls_MKL.mk

vpath %.f90 ../../src/

OBJS = $(subst .f90,.o,$(SRC))
%.o: %.f90
	$(FORTRAN) $(OPTS) -c $< -o $@ -I $(OPT)

all: $(OBJS) $(LibName)

$(LibName): $(OBJS)
	$(ARCH) $(ARCHFLAGS) $@ $?
	$(RANLIB) $@

clean:
	-rm *.smod
	-rm *.mod
	-rm $(LibName)

Everything seems to work nicely as files containing

  include "mkl_vsl.f90"
Module ModMKLInterface
  use mkl_vsl
  use mkl_vsl_type
  include "mkl_vml.f90"
  include 'mkl_spblas.fi'
End Module ModMKLInterface

or

include "mkl_dss.f90"
Module Mod_Mkl_DSS_Solver
  use MKL_DSS
  Implicit none
  Type Mkl_DSS_Solver
    Private
    TYPE(MKL_DSS_HANDLE) :: handle

are compiled without complaints. However, once the process get's to this:

Module ModMatrixOperations
  use lapack95
  use blas95
  use Data_Kind
  use mkl_servic

I get the following error: "Fatal Error: Reading module ‘lapack95’ at line 1 column 2: Unexpected EOF."

Anybody knows what the problem is??

The mkl was installed a part of the parallel-studio-xe-2017-update1

Thanks a lot.

0 Kudos
2 Replies
may_ka
Beginner
948 Views

Could help myself. Had just to run the makefiles for the interfaces with gfortran as compiler.

Cheers

0 Kudos
Zhen_Z_Intel
Employee
948 Views

Dear customer,

You could refer to modify the makefile in ${MKLROOT}/interface/<lapack95|blas95> Here's the makefile for generating .mod & .a file with different compiler. In this makefile, it generate .o for each source f90, then generate .a lib according to those .o files;then generate .mod file from objects & lapack95.f90 in $MKLROOT/include. After generating the mod & a file, please compile your source file with the new .mod & .a file.

Best regards,
Fiona

 

0 Kudos
Reply