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
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
ifeq "$(OPENMP)" "ON"
OPENMP_FLAG_ifort =-openmp -openmp-report0 -parallel
OPENMP_FLAG_gfortran =-fopenmp
ACML_ARCH =_mp
IMKL_ARCH =_intel_thread
IMKL_ARCH =$(IMKL_COMPILER2_$(F90))_thread
LIBRARIES +=-lfftw3_threads -lpthread
else
IMKL_ARCH =_sequential
IMKL_ARCH =$(IMKL_COMPILER2_$(F90))_sequential
endif
ifneq "x$(IMKL_ROOT)" "x"
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
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
ifneq "x$(ACML_ROOT)" "x"
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)
else
ifneq "x$(LAPACK_ROOT)" "x"
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
endif
endif
@ -116,7 +122,7 @@ endif
ifeq "$(HDF5)" "ON"
LIBRARIES +=-lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5
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
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:
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)):
print('FFTW Warning: %s not found in %s!'%(lib,os.path.join(options.fftwRoot,'lib')))
if os.path.isdir(os.path.join(options.fftwRoot,'lib64')):
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):
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)):
print('ACML Warning: %s not found in %s!'%(lib,blasLocationParallel))
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')
for lib in ['libmkl_core.so','libmkl_core.a',\
'libmkl_sequential.so','libmkl_sequential.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)):
print('IMKL Warning: %s not found in %s!'%(lib,blasLocation))
else:
@ -182,7 +188,7 @@ else:
sys.exit(1)
#--- try to read config file (to keep comments and order) ----------------------------------------------
#--- read config file if present to keep comments and order ---------------------------------------
output = []
try:
with open(configFile,'r') as f:
@ -210,6 +216,9 @@ try:
if items[0] == '%s_ROOT'%blasType and items[0] == '%s_ROOT'%options.blasType:
line = '%s=%s\n'%(items[0],options.blasRoot)
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
for spectralOption in options.spectraloptions:
[key,value] = re.split('[= ]',spectralOption)[0:2]
@ -250,4 +259,5 @@ else:
print('\n-----\n writing values to %s\n-----'%configFileNew)
with open(configFileNew,'w') as f:
for line in output:
print(line.rstrip('\n'))
f.write(line)

View File

@ -45,18 +45,23 @@ compiler = {
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 ----------------
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
if options['IMKL_ROOT'] != '' and options['F90'] != 'gfortran':
lib_lapack = '-L%s/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm -liomp5'%options['IMKL_ROOT']
LDFLAGS +=' -Wl,-rpath=%s/lib/intel64'%(options['IMKL_ROOT'])
if options['IMKL_ROOT']:
if options['F90'] == 'gfortran':
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'] != '':
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'] != '':
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

View File

@ -29,12 +29,18 @@ fortCmd = "ifort"
# -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
# -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 " +
"-I%I -I../lib -free -O1 -fpp -openmp " +
"-ftz -diag-disable 5268 " +
"-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.
cae_no_parts_input_file=ON