some small changes on the installation scripts, IMKL now works with gfortran, more verbosity and more sanity checks

This commit is contained in:
Martin Diehl 2014-01-29 12:20:56 +00:00
parent edd7d1ec8b
commit f82e5ec26e
4 changed files with 49 additions and 22 deletions

View File

@ -82,31 +82,37 @@ ifeq "$(PORTABLE)" "FALSE"
PORTABLE_SWITCH =-msse3 PORTABLE_SWITCH =-msse3
endif endif
# names for linking IMKL
IMKL_COMPILER_ifort :=intel
IMKL_COMPILER_gfortran :=gf
IMKL_COMPILER2_ifort :=intel
IMKL_COMPILER2_gfortran :=gnu
# settings for multicore support # settings for multicore support
ifeq "$(OPENMP)" "ON" ifeq "$(OPENMP)" "ON"
OPENMP_FLAG_ifort =-openmp -openmp-report0 -parallel OPENMP_FLAG_ifort =-openmp -openmp-report0 -parallel
OPENMP_FLAG_gfortran =-fopenmp OPENMP_FLAG_gfortran =-fopenmp
ACML_ARCH =_mp ACML_ARCH =_mp
IMKL_ARCH =_intel_thread IMKL_ARCH =$(IMKL_COMPILER2_$(F90))_thread
LIBRARIES +=-lfftw3_threads -lpthread LIBRARIES +=-lfftw3_threads -lpthread
else else
IMKL_ARCH =_sequential IMKL_ARCH =$(IMKL_COMPILER2_$(F90))_sequential
endif endif
ifneq "x$(IMKL_ROOT)" "x" ifneq "x$(IMKL_ROOT)" "x"
LIB_DIRS :=-L$(IMKL_ROOT)/lib/intel64 LIB_DIRS :=-L$(IMKL_ROOT)/lib/intel64
RUN_PATH +=$(RUNPATH) -Wl,-rpath=$(IMKL_ROOT)/lib/intel64 RUN_PATH +=$(RUNPATH),-rpath=$(IMKL_ROOT)/lib/intel64
INCLUDE_DIRS +=-I$(IMKL_ROOT)/include INCLUDE_DIRS +=-I$(IMKL_ROOT)/include
LIBRARIES +=-lmkl_intel_lp64 -lmkl_core -lmkl$(IMKL_ARCH) -lm -lpthread -liomp5 LIBRARIES +=-lmkl_$(IMKL_COMPILER_$(F90))_lp64 -lmkl_core -lmkl_$(IMKL_ARCH) -lm -lpthread -liomp5
else else
ifneq "x$(ACML_ROOT)" "x" ifneq "x$(ACML_ROOT)" "x"
LIB_DIRS +=-L$(ACML_ROOT)/$(F90)64$(ACML_ARCH)/lib LIB_DIRS +=-L$(ACML_ROOT)/$(F90)64$(ACML_ARCH)/lib
RUN_PATH +=$(RUNPATH) -Wl,-rpath=$(ACML_ROOT)/$(F90)64$(ACML_ARCH)/lib RUN_PATH +=$(RUNPATH),-rpath=$(ACML_ROOT)/$(F90)64$(ACML_ARCH)/lib
LIBRARIES +=-lacml$(ACML_ARCH) LIBRARIES +=-lacml$(ACML_ARCH)
else else
ifneq "x$(LAPACK_ROOT)" "x" ifneq "x$(LAPACK_ROOT)" "x"
LIB_DIRS +=-L$(LAPACK_ROOT)/lib64 -L$(LAPACK_ROOT)/lib LIB_DIRS +=-L$(LAPACK_ROOT)/lib64 -L$(LAPACK_ROOT)/lib
RUN_PATH +=$(RUN_PATH) -Wl,-rpath=$(LAPACK_ROOT)/lib64 -Wl,-rpath=$(LAPACK_ROOT)/lib RUN_PATH +=$(RUN_PATH),-rpath=$(LAPACK_ROOT)/lib64,-rpath=$(LAPACK_ROOT)/lib
LIBRARIES +=-llapack LIBRARIES +=-llapack
endif endif
endif endif
@ -116,7 +122,7 @@ endif
ifeq "$(HDF5)" "ON" ifeq "$(HDF5)" "ON"
LIBRARIES +=-lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 LIBRARIES +=-lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5
LIB_DIRS +=-L$(HDF5_ROOT)/lib LIB_DIRS +=-L$(HDF5_ROOT)/lib
RUN_PATH +=$(RUNPATH) -Wl,-rpath=$(HDF5_ROOT)/lib RUN_PATH +=$(RUNPATH),-rpath=$(HDF5_ROOT)/lib
INCLUDE_DIRS +=-I$(HDF5_ROOT)/include -DHDF INCLUDE_DIRS +=-I$(HDF5_ROOT)/include -DHDF
endif endif

26
configure vendored
View File

@ -142,9 +142,16 @@ if options.compiler not in ['ifort','gfortran']:
if not subprocess.call(['which', options.compiler],stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0: if not subprocess.call(['which', options.compiler],stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0:
print('Compiler Warning: executable %s not found!'%options.compiler) print('Compiler Warning: executable %s not found!'%options.compiler)
for lib in ['libfftw3.so','libfftw3.a']:
if not os.path.isfile(os.path.join(options.fftwRoot,'lib/%s'%lib)): if os.path.isdir(os.path.join(options.fftwRoot,'lib64')):
print('FFTW Warning: %s not found in %s!'%(lib,os.path.join(options.fftwRoot,'lib'))) fftwLocation = os.path.join(options.fftwRoot,'lib64')
else:
fftwLocation = os.path.join(options.fftwRoot,'lib')
for lib in ['libfftw3.so','libfftw3.a',\
'libfftw3_threads.so','libfftw3_threads.a']:
if not os.path.isfile(os.path.join(fftwLocation,lib)):
print('FFTW Warning: %s not found in %s!'%(lib,os.path.join(fftwLocation,lib)))
if not os.path.isdir(options.mscRoot): if not os.path.isdir(options.mscRoot):
print('MSC.Marc/Mentat Warning: Root directory %s not found!'%options.mscRoot) print('MSC.Marc/Mentat Warning: Root directory %s not found!'%options.mscRoot)
@ -167,14 +174,13 @@ elif options.blasType == 'ACML':
if not os.path.isfile(os.path.join(blasLocationParallel,lib)): if not os.path.isfile(os.path.join(blasLocationParallel,lib)):
print('ACML Warning: %s not found in %s!'%(lib,blasLocationParallel)) print('ACML Warning: %s not found in %s!'%(lib,blasLocationParallel))
elif options.blasType == 'IMKL': elif options.blasType == 'IMKL':
if options.compiler == 'gfortran':
print('Error: IMKL does not support gfortran')
sys.exit(1)
blasLocation=os.path.join(options.blasRoot,'lib/intel64') blasLocation=os.path.join(options.blasRoot,'lib/intel64')
for lib in ['libmkl_core.so','libmkl_core.a',\ for lib in ['libmkl_core.so','libmkl_core.a',\
'libmkl_sequential.so','libmkl_sequential.a',\ 'libmkl_sequential.so','libmkl_sequential.a',\
'libmkl_intel_thread.so','libmkl_intel_thread.a',\ 'libmkl_intel_thread.so','libmkl_intel_thread.a',\
'libmkl_intel_lp64.so','libmkl_intel_lp64.a']: 'libmkl_intel_lp64.so','libmkl_intel_lp64.a,'\
'libmkl_gnu_thread.so','libmkl_gnu_thread.a',\
'libmkl_gf_lp64.so','libmkl_gf_lp64.a']:
if not os.path.isfile(os.path.join(blasLocation,lib)): if not os.path.isfile(os.path.join(blasLocation,lib)):
print('IMKL Warning: %s not found in %s!'%(lib,blasLocation)) print('IMKL Warning: %s not found in %s!'%(lib,blasLocation))
else: else:
@ -182,7 +188,7 @@ else:
sys.exit(1) sys.exit(1)
#--- try to read config file (to keep comments and order) ---------------------------------------------- #--- read config file if present to keep comments and order ---------------------------------------
output = [] output = []
try: try:
with open(configFile,'r') as f: with open(configFile,'r') as f:
@ -210,6 +216,9 @@ try:
if items[0] == '%s_ROOT'%blasType and items[0] == '%s_ROOT'%options.blasType: if items[0] == '%s_ROOT'%blasType and items[0] == '%s_ROOT'%options.blasType:
line = '%s=%s\n'%(items[0],options.blasRoot) line = '%s=%s\n'%(items[0],options.blasRoot)
options.blasType='' options.blasType=''
elif items[0] == '#%s_ROOT'%blasType and items[0] == '#%s_ROOT'%options.blasType:
line = '%s=%s\n'%(items[0][1:],options.blasRoot)
options.blasType=''
elif items[0] == '%s_ROOT'%blasType: line = '#'+line elif items[0] == '%s_ROOT'%blasType: line = '#'+line
for spectralOption in options.spectraloptions: for spectralOption in options.spectraloptions:
[key,value] = re.split('[= ]',spectralOption)[0:2] [key,value] = re.split('[= ]',spectralOption)[0:2]
@ -250,4 +259,5 @@ else:
print('\n-----\n writing values to %s\n-----'%configFileNew) print('\n-----\n writing values to %s\n-----'%configFileNew)
with open(configFileNew,'w') as f: with open(configFileNew,'w') as f:
for line in output: for line in output:
print(line.rstrip('\n'))
f.write(line) f.write(line)

View File

@ -45,18 +45,23 @@ compiler = {
compileOptions =' -DSpectral -DFLOAT=8 -DINT=4 -I%s/lib'%damaskEnv.rootDir() compileOptions =' -DSpectral -DFLOAT=8 -DINT=4 -I%s/lib'%damaskEnv.rootDir()
#--- this saves the path of libraries to core.so, hence it is known during runtime ---------------- #--- this saves the path of libraries to core.so, hence it is known during runtime ----------------
LDFLAGS ='-shared -Wl,-rpath=%s/lib'%(options['FFTW_ROOT']) LDFLAGS ='-shared -Wl,-rpath=%s/lib,-rpath=%s/lib64'%(options['FFTW_ROOT'],options['FFTW_ROOT'])
# see http://cens.ioc.ee/pipermail/f2py-users/2003-December/000621.html # see http://cens.ioc.ee/pipermail/f2py-users/2003-December/000621.html
if options['IMKL_ROOT'] != '' and options['F90'] != 'gfortran': if options['IMKL_ROOT']:
lib_lapack = '-L%s/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm -liomp5'%options['IMKL_ROOT'] if options['F90'] == 'gfortran':
LDFLAGS +=' -Wl,-rpath=%s/lib/intel64'%(options['IMKL_ROOT']) arch = 'gf'
elif options['F90'] == 'ifort':
arch = 'intel'
lib_lapack = '-L%s/lib/intel64 -lmkl_%s_lp64 -lmkl_core -lmkl_sequential -lpthread -lm -liomp5'\
%(options['IMKL_ROOT'],arch)
LDFLAGS +=',-rpath=%s/lib/intel64'%(options['IMKL_ROOT'])
elif options['ACML_ROOT'] != '': elif options['ACML_ROOT'] != '':
lib_lapack = '-L%s/%s64/lib -lacml'%(options['ACML_ROOT'],options['F90']) lib_lapack = '-L%s/%s64/lib -lacml'%(options['ACML_ROOT'],options['F90'])
LDFLAGS +=' -Wl,-rpath=%s/%s64/lib'%(options['ACML_ROOT'],options['F90']) LDFLAGS +=',-rpath=%s/%s64/lib'%(options['ACML_ROOT'],options['F90'])
elif options['LAPACK_ROOT'] != '': elif options['LAPACK_ROOT'] != '':
lib_lapack = '-L%s/lib -L%s/lib64 -llapack'%(options['LAPACK_ROOT'],options['LAPACK_ROOT']) lib_lapack = '-L%s/lib -L%s/lib64 -llapack'%(options['LAPACK_ROOT'],options['LAPACK_ROOT'])
LDFLAGS +=' -Wl,-rpath=%s/lib -Wl,-rpath=%s/lib64'%(options['LAPACK_ROOT'],options['LAPACK_ROOT']) LDFLAGS +=',-rpath=%s/lib,-rpath=%s/lib64'%(options['LAPACK_ROOT'],options['LAPACK_ROOT'])
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# f2py does not (yet) support setting of special flags for the linker, hence they must be set via # f2py does not (yet) support setting of special flags for the linker, hence they must be set via

View File

@ -29,12 +29,18 @@ fortCmd = "ifort"
# -assume byterecl count record length in bytes # -assume byterecl count record length in bytes
# -real-size 64 -DFLOAT=8 assume size of real to be 8 bytes, matches our definition of pReal # -real-size 64 -DFLOAT=8 assume size of real to be 8 bytes, matches our definition of pReal
# -integer-size 32 -DINT=4 assume size of integer to be 4 bytes, matches our definition of pInt # -integer-size 32 -DINT=4 assume size of integer to be 4 bytes, matches our definition of pInt
# -L/usr/lib64 -L/usr/lib search path for lapack libraries
# -Wl,-rpath=/usr/lib64,-rpath=/usr/lib run path for lapack libraries
# -llapack link against lapack
compile_fortran = (fortCmd + " -c -fPIC -auto " + compile_fortran = (fortCmd + " -c -fPIC -auto " +
"-I%I -I../lib -free -O1 -fpp -openmp " + "-I%I -I../lib -free -O1 -fpp -openmp " +
"-ftz -diag-disable 5268 " + "-ftz -diag-disable 5268 " +
"-implicitnone -assume byterecl " + "-implicitnone -assume byterecl " +
"-real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4") "-real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4" +
"-L/usr/lib64 -L/usr/lib" +
"-Wl,-rpath=/usr/lib64,-rpath=/usr/lib" +
"-llapack")
# Abaqus/CAE will generate an input file without parts and assemblies. # Abaqus/CAE will generate an input file without parts and assemblies.
cae_no_parts_input_file=ON cae_no_parts_input_file=ON