Problem with compilation with multi-threading + mkl + fftw3 (and gnu compiler)

Daniele Fontanari danielef... at gmail.com
Tue Nov 1 19:39:32 CET 2016


Small update:

Looking at old threads I tried to modify the arch file (be careful, last 
line begin with a tab, not several spaces):

## Begin test.ssmp ##
MKLROOT = /opt/intel/compilers_and_libraries_2016.0.109/linux/mkl
MKLLIB = $(MKLROOT)/lib/intel64
FFTW3ROOT = $(HOME)/cp2k_build/src/fftw3_vanilla/fftw-3.3.5/installazione

CC = gcc
CPP =
FC = mpif90
LD = mpif90
AR = ar -r
ALLFLAGS = -D__MKL -D__FFTW3 -O2 -I$(MKLROOT)/include -I$(FFTW3ROOT)/include
FCFLAGS = $(ALLFLAGS) -ffree-form -fopenmp
FCFLAGS2 = $(ALLFLAGS) -ffree-form
CFLAGS = $(ALLFLAGS) -fopenmp
LDFLAGS = -L$(FFTW3ROOT)/lib -fopenmp
LIBS = -Wl,--start-group $(MKLLIB)/libmkl_gf_lp64.a 
$(MKLLIB)/libmkl_sequential.a $(MKLLIB)/libmkl_core.a -Wl,--end-group 
-lpthread -lm -ldl -lstdc++ -lfftw3

fftw3_lib.o: pw/fft/fftw3_lib.F
                 $(FC) -c $(FCFLAGS2) 
$<dfontanari at orval02:~/cp2k/cp2k/makefiles$ 
## End test.ssmp ##

and regtest is working. Am I losing a lot of performance with this 
workaround (fftw3 not multithreaded)? Moreover It was suggested to use 
libmkl_sequential.a instead of libmkl_gnu_thread.a care to comment on this?

However I'd appreciate is someone can point out possible reasons for my 
previous error

Thanks!

Daniele


Il giorno martedì 1 novembre 2016 18:31:18 UTC+1, Daniele Fontanari ha 
scritto:
>
> Hello everyone
>
> I have now a cp2k version which is running smoothly if I compile the *opt 
> versions, however I have problems (in term of runtime failures) with the 
> *smp version.
>
> I can access the linear algebra routines through a MKL library, which 
> provide also a wrapper for FFTW3 (but I DON'T have access to the intel 
> compilers, I use the GNU ones)
> The runtime error for the smp version is the following:
>
> STOP Intel's FFTW3 interface to MKL is not thread-safe prior to MKL 
> 11.1.0!  Please rebuild CP2K, linking against FFTW 3 from www.fftw.org or 
> a newer version of MKL. Now exiting...
>
> This is quite strange since my version of MKL should be newer than 11.1.0 
> (I am not the sysadmin, the intel folder is referred as "2016.0.109", a 
> quick search suggests that the 11.3 version should be installed, but I'd 
> like to know a way to check this for sure)
>
> However if I try to install the "vanilla" version of fftw3 and try to 
> install with the configure option "--enable-openmp" and thus linking the 
> libraries "libfftw3.a" and "libfftw3_omp.a" I get the same error.
> the arch file I am using is the following:
> (the fftw libraries are in $(FFTW3ROOT)/lib )
>
>
> ## Begin test.ssmp ##
> MKLROOT    = /opt/intel/compilers_and_libraries_2016.0.109/linux/mkl
> MKLLIB     = $(MKLROOT)/lib/intel64
> FFTW3ROOT  = $(HOME)/cp2k_build/src/fftw3_vanilla/fftw-3.3.5/installazione
>
> CC         = gcc
> CPP        =
> FC         = mpif90
> LD         = mpif90
> AR         = ar -r
> ALLFLAGS   = -D__MKL -D__FFTW3 -O2 -fopenmp -I$(MKLROOT)/include 
> -I$(FFTW3ROOT)/include
> FCFLAGS    = $(ALLFLAGS) -ffree-form
> CFLAGS     = $(ALLFLAGS)
> LDFLAGS    = -L$(FFTW3ROOT)/lib -fopenmp
> LIBS       = -Wl,--start-group $(MKLLIB)/libmkl_gf_lp64.a 
> $(MKLLIB)/libmkl_gnu_thread.a $(MKLLIB)/libmkl_core.a -Wl,--end-group 
> -lpthread -lm -ldl -lstdc++ -lfftw3 -lfftw3_omp
> ## End test.ssmp ##
>
>
> Just recently I noticed that the installation wiki on the website might be 
> saying that if I compile with GNU+MKL I cannot have openmp? Is this the 
> case?
>
> Thanks
>
> Daniele
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20161101/100d4ab0/attachment.html>


More information about the CP2K-user mailing list