changed linker command slightly to ensure dynamic linking and link now agains non-parallel (but threadsafe) versions of LAPACK

(compile_CoreModule.py, Makefile, abaqus_v6.env, mod_MarcMentat)

openmp is not working for Abaqus exp, probably because the ifort 14 is not supported.
Test is now using a version without openmp
This commit is contained in:
Martin Diehl 2014-04-29 16:43:59 +00:00
parent 01416b7ab6
commit 6bce04df48
8 changed files with 127 additions and 44 deletions

View File

@ -25,6 +25,12 @@ if [ "x$PROCESSING" == "x" ]; then
export PROCESSING='Not found!'
fi
# according to http://software.intel.com/en-us/forums/topic/501500
# this seems to make sense for the stack size
freeMem=`free -k | grep Mem: | awk '{print $4;}'`
heap=`expr $freeMem / 2`
stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2`
# disable output in case of scp
if [ ! -z "$PS1" ]; then
echo
@ -33,23 +39,28 @@ if [ ! -z "$PS1" ]; then
echo http://damask.mpie.de
echo
echo Using environment with ...
echo "DAMASK $DAMASK_ROOT"
([[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER")
([[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING")
echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS"
echo "Compiler F90=$F90"
([[ "x$IMKL_ROOT" != "x" ]] && echo "IMKL $IMKL_ROOT") || \
([[ "x$ACML_ROOT" != "x" ]] && echo "ACML $ACML_ROOT") || \
([[ "x$LAPACK_ROOT" != "x" ]] && echo "LAPACK $LAPACK_ROOT")
echo "MSC.Marc/Mentat $MSC_ROOT"
echo "FFTW $FFTW_ROOT"
echo "HDF5 $HDF5_ROOT (for future use)"
echo "DAMASK $DAMASK_ROOT"
([[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER")
([[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING")
echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS"
echo "Compiler F90=$F90"
([[ "x$IMKL_ROOT" != "x" ]] && echo "IMKL $IMKL_ROOT") || \
([[ "x$ACML_ROOT" != "x" ]] && echo "ACML $ACML_ROOT") || \
([[ "x$LAPACK_ROOT" != "x" ]] && echo "LAPACK $LAPACK_ROOT")
([[ "x$PETSC_DIR" != "x" ]] && echo "PETSc location $PETSC_DIR")
([[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH")
echo "MSC.Marc/Mentat $MSC_ROOT"
echo "FFTW $FFTW_ROOT"
echo "HDF5 $HDF5_ROOT (for future use)"
echo
echo "heap size/kB $heap"
echo "stack size/kB $stack"
fi
# http://superuser.com/questions/220059/what-parameters-has-ulimit
ulimit -s unlimited 2>/dev/null # maximum stack size (kB)
ulimit -h unlimited 2>/dev/null # maximum heap size (kB)
ulimit -c 0 2>/dev/null # core file size (512-byte blocks)
# http://superuser.com/questions/220059/what-parameters-has-ulimit
ulimit -s $stack 2>/dev/null # maximum stack size (kB)
ulimit -h $heap 2>/dev/null # maximum heap size (kB)
ulimit -c 2000 2>/dev/null # core file size (512-byte blocks)
ulimit -v unlimited 2>/dev/null # maximum virtual memory size
ulimit -m unlimited 2>/dev/null # maximum physical memory size

View File

@ -196,12 +196,13 @@ subroutine vumat(nBlock, nDir, nshr, nStateV, nFieldV, nProps, lAnneal, &
integer(pInt) :: computationMode, n, i, cp_en
!$ integer :: defaultNumThreadsInt !< default value set by Abaqus
!$ include "omp_lib.h"
! temp is intent(in)
enerInternNew = 0.0_pReal
enerInelasNew = 0.0_pReal
!$ defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc
!$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution set by DAMASK_NUM_THREADS
enerInternNew = 0.0_pReal
enerInelasNew = 0.0_pReal
computationMode = CPFEM_CALCRESULTS ! always calculate
do n = 1,nblock(1) ! loop over vector of IPs
temp = tempOld(n)

View File

@ -76,30 +76,28 @@ 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 =$(IMKL_COMPILER2_$(F90))_thread
LIBRARIES +=-lfftw3_threads -lpthread
else
IMKL_ARCH =sequential
ifeq "$(F90)" "ifort"
LIBRARIES +=-liomp5
endif
endif
ifndef PETSC_DIR #petsc provides linking options agains selected blas/lapack already
ifneq "x$(IMKL_ROOT)" "x"
LIB_DIRS +=-L$(IMKL_ROOT)/lib/intel64
RUN_PATH :=$(RUN_PATH),-rpath,$(IMKL_ROOT)/lib/intel64
INCLUDE_DIRS +=-I$(IMKL_ROOT)/include
LIBRARIES +=-lmkl_$(IMKL_COMPILER_$(F90))_lp64 -lmkl_core -lmkl_$(IMKL_ARCH) -lpthread -lm
LIBRARIES +=-lmkl_$(IMKL_COMPILER_$(F90))_lp64 -lmkl_core -lmkl_sequential -lm
else
ifneq "x$(ACML_ROOT)" "x"
LIB_DIRS +=-L$(ACML_ROOT)/$(F90)64$(ACML_ARCH)/lib
RUN_PATH :=$(RUN_PATH),-rpath,$(ACML_ROOT)/$(F90)64$(ACML_ARCH)/lib
LIBRARIES +=-lacml$(ACML_ARCH)
LIB_DIRS +=-L$(ACML_ROOT)/$(F90)64/lib
RUN_PATH :=$(RUN_PATH),-rpath,$(ACML_ROOT)/$(F90)64/lib
LIBRARIES +=-lacml
else
ifneq "x$(LAPACK_ROOT)" "x"
LIB_DIRS +=-L$(LAPACK_ROOT)/lib64 -L$(LAPACK_ROOT)/lib
@ -108,6 +106,7 @@ LIBRARIES +=-llapack
endif
endif
endif
endif
#hdf5
ifeq "$(HDF5)" "ON"
@ -144,7 +143,9 @@ OPTIMIZATION_AGGRESSIVE_gfortran :=-O3 $(PORTABLE_SWITCH) -ffast-math -funroll-l
COMPILE_OPTIONS_ifort :=-fpp\
-ftz\
-assume byterecl
-assume byterecl\
-shared-intel
ifneq "$(FASTBUILD)" "YES"
COMPILE_OPTIONS_ifort +=-diag-enable sc3\
-diag-disable 5268\
@ -161,6 +162,7 @@ endif
#-fpp: preprocessor
#-ftz: flush unterflow to zero, automatically set if O<0,1,2,3> >0
#-assume byterecl record length is given in bytes (also set by -standard-semantics)
#-shared-intel: Link against shared Intel libraries instead of static ones
#-fimplicit-none: assume "implicit-none" even if not present in source
#-diag-disable: disables warnings, where
# warning ID 5268: the text exceeds right hand column allowed on the line (we have only comments there)
@ -217,7 +219,8 @@ DEBUG_OPTIONS_ifort :=-g\
#-check: checks at runtime, where
# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?)
# stack:
COMPILE_OPTIONS_gfortran :=-xf95-cpp-input
COMPILE_OPTIONS_gfortran :=-shared -Wl,-undefined,dynamic_lookup\
-xf95-cpp-input
ifneq "$(FASTBUILD)" "YES"
COMPILE_OPTIONS_gfortran +=-ffree-line-length-132\
-fimplicit-none\
@ -233,6 +236,8 @@ COMPILE_OPTIONS_gfortran +=-ffree-line-length-132\
endif
###################################################################################################
#COMPILE SWITCHES
#-shared
#-Wl,-undefined,dynamic_lookup:ensure to link against dynamic libraries
#-xf95-cpp-input: preprocessor
#-ffree-line-length-132: restrict line length to the standard 132 characters
#-fno-range-check: disables checking if result can be represented by variable. Needs to be set to enable DAMASK_NaN
@ -359,11 +364,10 @@ PETSC_FILES = DAMASK_spectral_solverAL.o \
COMPILED_FILES += $(PETSC_FILES)
endif
DAMASK_spectral.exe: DAMASK_spectral_driver.o
$(PREFIX) $(COMPILERNAME) $(OPENMP_FLAG_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) $(STANDARD_CHECK_$(F90)) \
$(PREFIX) $(COMPILERNAME) $(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \
-o DAMASK_spectral.exe DAMASK_spectral_driver.o \
$(COMPILED_FILES) $(LIBRARIES) $(RUN_PATH) $(LIB_DIRS) $(SUFFIX)
$(COMPILED_FILES) $(LIB_DIRS) $(LIBRARIES) $(RUN_PATH) $(SUFFIX)
DAMASK_spectral_driver.o: DAMASK_spectral_driver.f90 DAMASK_spectral_solverBasic.o $(PETSC_FILES)
$(PREFIX) $(COMPILERNAME) $(COMPILE_MAXOPTI) -c DAMASK_spectral_driver.f90 $(SUFFIX)

View File

@ -48,7 +48,8 @@ compileOptions = ' -DSpectral -DFLOAT=8 -DINT=4 -I%s/lib'%damaskEnv.rootDir()
LDFLAGS = '-Wl,-rpath,%s/lib,-rpath,%s/lib64'%(options['FFTW_ROOT'],options['FFTW_ROOT'])
if options['F90'] == 'gfortran':
LDFLAGS += ' -shared -Wl,-undefined,dynamic_lookup' # solved error: Undefined symbols for architecture x86_64: "_PyArg_ParseTupleAndKeywords" as found on https://lists.macosforge.org/pipermail/macports-dev/2013-May/022735.html
else:
LDFLAGS += ' -shared-intel'
# see http://cens.ioc.ee/pipermail/f2py-users/2003-December/000621.html
if options['IMKL_ROOT']:
@ -56,7 +57,7 @@ if 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'\
lib_lapack = '-L%s/lib/intel64 -lmkl_%s_lp64 -lmkl_core -lmkl_sequential -lm'\
%(options['IMKL_ROOT'],arch)
LDFLAGS +=',-rpath,%s/lib/intel64'%(options['IMKL_ROOT'])
elif options['ACML_ROOT'] != '':

View File

@ -33,7 +33,7 @@ fortCmd = "ifort"
# -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 -shared-intel " +
"-I%I -I../lib -free -O1 -fpp -openmp " +
"-ftz -diag-disable 5268 " +
"-implicitnone -assume byterecl " +

View File

@ -0,0 +1,66 @@
#
# DAMASK Abaqus Environment File
#
# $Id$
# ------------------------------------
# originally taken from Abaqus ver. 6.11.1
#
#
# Linux (Opteron/EM64T) Settings:
#
# Compile and Link command for user subroutines.
# Compile_cpp and link_exe for Abaqus make utility.
#
import os, re, glob, driverUtils
# Use the version in $PATH
fortCmd = "ifort"
# -free to use free-format FORTRAN 90 syntax
# -O <0-3> optimization level
# -fpp use FORTRAN preprocessor on source code
# -openmp build with openMP support
# -w90 -w95 suppress messages about use of non-standard Fortran (previous version of abaqus_v6.env only)
# -WB turn a compile-time bounts check into a warning (previous version of abaqus_v6.env only)
# -mP2OPT_hpo_vec_divbyzero=F inofficial compiler switch, proposed by abaqus but highly dubios (previous version of abaqus_v6.env only)
# -ftz flush underflow to zero
# -diag-disable 5268 disable warnings about line length > 132 (only comments there anyway)
# -implicitnone assume no implicit types (e.g. i for integer)
# -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 -shared-intel " +
"-I%I -I../lib -free -O1 -fpp " +
"-ftz -diag-disable 5268 " +
"-implicitnone -assume byterecl " +
"-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
# Both the Abaqus/Explicit packager and analysis are run in double precision.
double_precision=BOTH
# The user will not be asked whether old job files of the same name should be deleted.
ask_delete=OFF
# You can compile DAMASK into a library to be used with abaqus
# it saves you from compiling the subroutine for each job
# in this case you do not have to specify a usersubroutine file
# however if you still do, the compiled version will override that in the library
# Procedure:
# 1. create a library directory, e.g. abqlib, in your prefered location
# 2. build the library replacing your_prefered_location/abqlib with the correct path to the directory created in 1.:
# abaqus make -l DAMASK_abaqus_std.f -dir your_prefered_location/abqlib
# abaqus make -l DAMASK_abaqus_exp.f -dir your_prefered_location/abqlib
# 3. uncomment the next line after replacing your_prefered_location/abqlib with the correct path to the directory created in 1.
# usub_lib_dir='your_prefered_location/abqlib'
# Remove the temporary names from the namespace
del fortCmd

View File

@ -410,7 +410,7 @@ then
PROFILE="-prof-gen=srcpos"
fi
FORT_OPT="-c -assume byterecl -safe_cray_ptr -mp1 -WB"
FORT_OPT="-c -assume byterecl -safe_cray_ptr -mp1 -WB -shared-intel"
if test "$MTHREAD" = "OPENMP"
then
FORT_OPT=" $FORT_OPT -openmp"
@ -436,21 +436,21 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \
DFORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTLOWMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \
DFORTLOWMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -shared-intel -O0 $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-openmp -openmp_report2 -openmp-threadprivate=compat\
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTRAN="$FCOMP $FORT_OPT $PROFILE -O1 $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTRANMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \
DFORTRANMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -shared-intel -O1 $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-openmp -openmp_report2 -openmp-threadprivate=compat\
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTHIGH="$FCOMP $FORT_OPT $PROFILE -fno-alias -O2 $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTHIGHMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias -O2 $I8FFLAGS -I$MARC_SOURCE/common \
DFORTHIGHMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias -shared-intel -O2 $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-openmp -openmp_report2 -openmp-threadprivate=compat\
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
@ -470,21 +470,21 @@ then
DFORTLOW="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTLOWMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
DFORTLOWMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -shared-intel $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-openmp -openmp_report2 -openmp-threadprivate=compat\
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTRAN="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTRANMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
DFORTRANMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -shared-intel $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-openmp -openmp_report2 -openmp-threadprivate=compat\
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTHIGH="$FCOMP $FORT_OPT $PROFILE -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"
DFORTHIGHMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \
DFORTHIGHMP="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias -shared-intel $I8FFLAGS -I$MARC_SOURCE/common \
-fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 \
-openmp -openmp_report2 -openmp-threadprivate=compat\
-I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS"

View File

@ -60,10 +60,10 @@ BLASDIR=${BLASDIR%/} # remove trailing slash
case $BLASTYPE in
IMKL | imkl)
BLAS=" -I$BLASDIR/include -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -Wl,-rpath,$BLASDIR/lib/intel64 -L$BLASDIR/lib/intel64" #I'm not too shure about the include (does that work for linker?)
BLAS=" -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lm -Wl,-rpath,$BLASDIR/lib/intel64 -L$BLASDIR/lib/intel64"
;;
ACML | acml)
BLAS=" -lacml -Wl,-rpath,$BLASDIR/ifort64_mp/lib -L$BLASDIR/ifort64_mp/lib"
BLAS=" -lacml -Wl,-rpath,$BLASDIR/ifort64/lib -L$BLASDIR/ifort64/lib"
;;
LAPACK | lapack)
BLAS=" -llapack -Wl,-rpath,$BLASDIR/lib,-rpath,$BLASDIR/lib64 -L$BLASDIR/lib64 -L$BLASDIR/lib"