fixed installation, will test now

This commit is contained in:
Martin Diehl 2014-01-24 12:30:27 +00:00
parent c9c6588f7c
commit d66b41c686
10 changed files with 271 additions and 117 deletions

View File

@ -2,13 +2,12 @@
# usage: source DAMASK_env.sh
if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == 'linux' ]
then LOCATION=$(readlink -f "`dirname $BASH_SOURCE`")
then DAMASK_ROOT=$(readlink -f "`dirname $BASH_SOURCE`")
else
STAT=$(stat "`dirname $BASH_SOURCE`")
LOCATION=${STAT##* }
DAMASK_ROOT=${STAT##* }
fi
export DAMASK_ROOT=${LOCATION}
source $DAMASK_ROOT/installation/options
if [ "x$DAMASK_NUM_THREADS" != "x" ]
then export DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS
fi
@ -27,6 +26,9 @@ fi
if [ "x$F90" != "x" ]
then export F90=$F90
fi
if [ "x$DAMASK_BIN" == "x" ]
then DAMASK_BIN=$DAMASK_ROOT/bin
fi
# disable output in case of scp
if [ ! -z "$PS1" ]; then
@ -36,7 +38,7 @@ if [ ! -z "$PS1" ]; then
echo http://damask.mpie.de
echo
echo Preparing environment ...
echo "DAMASK_ROOT=$DAMASK_ROOT"
echo "DAMASK installation in $DAMASK_ROOT"
echo "DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS"
echo "F90=$F90"
echo "prepending to LD_LIBRARY_PATH: $LD_NEW"
@ -45,7 +47,5 @@ ulimit -s unlimited
ulimit -c 0
ulimit -v unlimited
ulimit -m unlimited
export DAMASK_BIN=$DAMASK_ROOT/bin
export PATH=$PATH:$DAMASK_BIN
export PYTHONPATH=$PYTHONPATH:$DAMASK_ROOT/lib
export LD_LIBRARY_PATH=$LD_NEW:$LD_LIBRARY_PATH

View File

@ -35,11 +35,18 @@ SHELL = /bin/sh
# SUFFIX = arbitrary suffix (after file to compile)
# STANDARD_CHECK = checking for Fortran 2008, compiler dependend
########################################################################################
include ../installation/options
ifeq ($(wildcard "${HOME}/.damask/damask.conf"),)
include ${HOME}/.damask/damask.conf
else
include /etc/damask.conf
endif
COMPILERNAME ?= $(F90)
INCLUDE_DIRS +=-I$(DAMASK_ROOT)/lib
INCLUDE_DIRS :=-I../lib
LIBRARIES :=-lfftw3
LIB_DIRS :=-L$(FFTWROOT)/lib
ifeq "$(FASTBUILD)" "YES"
OPENMP := OFF
@ -75,7 +82,22 @@ ifeq "$(PORTABLE)" "FALSE"
PORTABLE_SWITCH =-msse3
endif
# 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
LIBRARIES +=-lfftw3_threads -lpthread
else
IMKL_ARCH =_sequential
endif
ifneq "x$(IMKLROOT)" "x"
LIB_DIRS :=-L$(IMKLROOT)/lib/intel64
INCLUDE_DIRS +=-I$(IMKLROOT)/include
LIBRARIES +=-lmkl_intel_lp64 -lmkl_core -lmkl$(ACML_ARCH) -lm -lpthread -liomp5
else
ifneq "x$(ACMLROOT)" "x"
LIB_DIRS +=-L$(ACMLROOT)/$(F90)64$(ACML_ARCH)/lib
LIBRARIES +=-lacml$(ACML_ARCH)
@ -85,26 +107,10 @@ LIB_DIRS +=-L$(LAPACKROOT)/lib64 -L$(LAPACKROOT)/lib
LIBRARIES +=-llapack
endif
endif
COMPILE_OPTIONS_ifort :=
ifeq "$(F90)" "ifort"
ifneq "x$(IMKLROOT)" "x"
COMPILE_OPTIONS_ifort +=-I$(IMKLROOT)/include -mkl=sequential
LIBRARIES :=-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm
LIB_DIRS :=-L$(IMKLROOT)/lib/intel64
endif
endif
# settings for multicore support
ifeq "$(OPENMP)" "ON"
OPENMP_FLAG_ifort =-openmp -openmp-report0 -parallel
OPENMP_FLAG_gfortran =-fopenmp
ACML_ARCH =_mp
LIBRARIES +=-lfftw3_threads -lpthread
endif
LIBRARIES +=-lfftw3
LIB_DIRS +=-L$(FFTWROOT)/lib
#hdf5
ifeq "$(HDF5)" "ON"
@ -139,7 +145,7 @@ OPTIMIZATION_AGGRESSIVE_ifort :=-O3 $(PORTABLE_SWITCH) -no-prec-div -fp-model
OPTIMIZATION_AGGRESSIVE_gfortran :=-O3 $(PORTABLE_SWITCH) -ffast-math -funroll-loops -ftree-vectorize
COMPILE_OPTIONS_ifort +=-fpp\
COMPILE_OPTIONS_ifort :=-fpp\
-ftz\
-assume byterecl
ifneq "$(FASTBUILD)" "YES"
@ -465,11 +471,13 @@ endif
$(PREFIX) $(COMPILERNAME) $(COMPILE) -c $< $(SUFFIX)
.PHONY: tidy
tidy:
@rm -rf *.o
@rm -rf *.mod
.PHONY: clean
clean:
@rm -rf *.o
@rm -rf *.mod
@rm -rf *.exe

228
configure vendored
View File

@ -1,5 +1,5 @@
#!/usr/bin/env python
import os,re,sys,string,subprocess
import os,re,sys,string,subprocess,shutil
from optparse import OptionParser, Option
@ -28,67 +28,225 @@ class extendableOption(Option):
########################################################
parser = OptionParser(option_class=extendableOption, usage='%prog options', description = """
Sets up the pre and post processing tools of DAMASK
Configures the compilation and installation of DAMASK
""" + string.replace('$Id$','\n','\\n')
)
compilers = ['ifort','gfortran']
blastypes = ['LAPACK','ACML','IMKL']
parser.add_option('--with-fc', dest='compiler', type='string',
help='F90 compiler [%default]')
parser.add_option('--with-marc-dir', dest='marcdir', type='string',
help='root directory of MSC.Marc [%default]')
parser.add_option('--with-fftw-dir', dest='fftwdir', type='string',
help='root directory of FFTW [%default]')
parser.add_option('--with-blas-lapack-dir', dest='blasdir', type='string',
help='root directory of LAPACK [%default]')
parser.add_option('--with-blas-type', dest='blastype', type='string',
help='type of BLAS/LAPACK library [%default]')
parser.add_option('--with-spectral-options', dest='spectraloptions', type='string', action='extend',
help='options for spectral solver %default')
#--- determine default compiler ----------------------------------------------------------------------
compiler = os.getenv('F90')
if compiler == None: compiler ={True:'ifort',False:'gfortran'}[\
subprocess.call(['which', 'ifort'],\
stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0]
parser.set_defaults(compiler = compiler)
parser.set_defaults(blastype = 'LAPACK')
parser.set_defaults(fftwdir = '/usr/local')
parser.set_defaults(blasdir = '/usr')
parser.set_defaults(marcdir = '/msc')
#--- default option values --------------------------------------------------------------------------
defaults={'F90':compiler,\
'FFTW_ROOT':'/usr/local',\
'MARC_ROOT':'/msc',\
'HDF5_ROOT':'/usr/local',\
'DAMASK_NUM_THREADS':4,\
'blasType':'LAPACK',\
'blasRoot':{'LAPACK':'/usr',\
'ACML' :'/opt/acml5.3.1',\
'IMKL' :{True:'/opt/intel/composerxe/mkl',False:os.getenv('MKLROOT')}\
[os.getenv('MKLROOT')==None]},\
'spectralOptions':{}}
#--- if local config file exists, read, otherwise assume global config file ------------------------
if os.path.isfile(os.path.join(os.getenv('HOME'),'.damask/damask.conf')):
configFile = os.path.join(os.getenv('HOME'),'.damask/damask.conf')
else:
configFile = '/etc/damask.conf'
#--- set default values according to read in values ------------------------------------------------
try:
with open(configFile,'r') as f:
print('\n-----\n reading default values from %s\n-----'%configFile)
for line in f:
items = re.split('[= ]',line)
if (not line.strip() or items[0].startswith('#')):
pass
elif items[0] == 'F90':
defaults['F90']=items[1].rstrip()
elif items[0] == 'FFTW_ROOT':
defaults['FFTW_ROOT']=items[1].rstrip()
elif items[0] == 'MARC_ROOT':
defaults['MARC_ROOT']=items[1].rstrip()
elif items[0] == 'HDF5_ROOT':
defaults['HDF5_ROOT']=items[1].rstrip()
elif items[0] == 'DAMASK_NUM_THREADS':
defaults['DAMASK_NUM_THREADS']=int(items[1])
elif items[0] in [name+'_ROOT' for name in defaults['blasRoot']]:
defaults['blasType']=items[0][:-5]
defaults['blasRoot'][items[0][:-5]] =items[1].rstrip()
else:
defaults['spectralOptions'][items[0]]=items[1].rstrip()
except IOError:
pass
parser.add_option('--with-fc', dest='compiler', type='string', metavar='string', \
help='F90 compiler [%default]')
parser.add_option('--with-fftw-dir', dest='fftwRoot', type='string', metavar='string', \
help='root directory of FFTW [%default]')
parser.add_option('--with-marc-dir', dest='marcRoot', type='string', metavar='string', \
help='root directory of MSC.Marc [%default]')
parser.add_option('--with-HDF5-dir', dest='hdf5Root', type='string', metavar='string', \
help='root directory of HDF5 [%default]')
parser.add_option('--with-OMP-threads', dest='threads', type='int', metavar='int',\
help='number of openMP threads [%default]')
parser.add_option('--with-blas-type', dest='blasType', type='string', metavar='string', \
help='type of BLAS/LAPACK library [%default]')
parser.add_option('--with-blas-dir', dest='blasRoot', type='string', metavar='string', \
help='root directory of BLAS/LAPACK library [%default]')
parser.add_option('--with-spectral-options', dest='spectraloptions', type='string', action='extend', metavar='<string LIST>', \
help='options for compilation of spectral solver')
parser.set_defaults(compiler = defaults['F90'])
parser.set_defaults(fftwRoot = defaults['FFTW_ROOT'])
parser.set_defaults(marcRoot = defaults['MARC_ROOT'])
parser.set_defaults(hdf5Root = defaults['HDF5_ROOT'])
parser.set_defaults(threads = defaults['DAMASK_NUM_THREADS'])
parser.set_defaults(blasType = defaults['blasType'])
#--- set default for blasRoot depending on current option (or default) for blasType --------------------
blasType = defaults['blasType'].upper()
for i, arg in enumerate(sys.argv):
if arg.startswith('--with-blas-type'):
if arg.endswith('--with-blas-type'):
blasType = sys.argv[i+1].upper()
else:
blasType = sys.argv[i][17:].upper()
if blasType not in ['LAPACK','ACML','IMKL']:
blasType='LAPACK'
parser.set_defaults(blasRoot = [defaults['blasRoot'][blasType]][0])
parser.set_defaults(spectraloptions = [])
(options,filenames) = parser.parse_args()
options.blastype = options.blastype.upper()
#--- consistency checks --------------------------------------------------------------------------------
options.compiler=options.compiler.lower()
options.blasType=options.blasType.upper()
options.fftwRoot=options.fftwRoot.rstrip('/')
options.marcRoot=options.marcRoot.rstrip('/')
options.hdf5Root=options.hdf5Root.rstrip('/')
options.blasRoot=options.blasRoot.rstrip('/')
if options.blastype not in blastypes: print('Unknown BLAS type selected')
if options.compiler not in compilers: print('Unknown compiler type selected')
if options.compiler not in ['ifort','gfortran']:
print('Error: Unknown compiler option: %s'%options.compiler)
sys.exit(1)
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.a','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 not os.path.isdir(options.marcRoot):
print('MSC.Marc Warning: Root directory %s not found!'%options.marcRoot)
if options.blasType == 'LAPACK':
if os.path.isdir(os.path.join(options.blasRoot,'lib64')):
blasLocation = os.path.join(options.blasRoot,'lib64')
else:
blasLocation=os.path.join(options.blasRoot,'lib')
for lib in ['liblapack.a','liblapack.a']:
if not os.path.isfile(os.path.join(blasLocation,lib)):
print('LAPACK Warning: %s not found in %s!'%(lib,blasLocation))
elif options.blasType == 'ACML':
blasLocationSerial=os.path.join(options.blasRoot,'%s64/lib'%options.compiler)
for lib in ['libacml.a','libacml.a']:
if not os.path.isfile(os.path.join(blasLocationSerial,lib)):
print('ACML Warning: %s not found in %s!'%(lib,blasLocationSerial))
blasLocationParallel=os.path.join(options.blasRoot,'%s64_mp/lib'%options.compiler)
for lib in ['libacml_mp.a','libacml_mp.a']:
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_lp64.so','libmkl_intel_lp64.a']:
if not os.path.isfile(os.path.join(blasLocation,lib)):
print('IMKL Warning: %s not found in %s!'%(lib,blasLocation))
else:
print('Error: Unknown BLAS/LAPACK library: %s'%options.blasType)
sys.exit(1)
#--- try to read config file (to keep comments and order) ----------------------------------------------
output = []
with open('installation/options','r') as f:
try:
with open(configFile,'r') as f:
for line in f:
items = re.split('[= ]',line)
if items[0] == 'F90': line = '%s=%s\n'%(items[0],options.compiler)
if items[0] == 'FFTW_ROOT': line = '%s=%s\n'%(items[0],options.fftwdir.rstrip('/'))
if items[0] == 'MSC_ROOT': line = '%s=%s\n'%(items[0],options.marcdir.rstrip('/'))
for blastype in blastypes:
if options.blastype == blastype and items[0] == '%s_ROOT'%blastype:
line = '%s=%s\n'%(items[0],options.blasdir.rstrip('/'))
if (not line.strip() or items[0].startswith('#')):
pass
if items[0] == 'F90':
line = '%s=%s\n'%(items[0],options.compiler)
options.compiler =''
if items[0] == 'FFTW_ROOT':
line = '%s=%s\n'%(items[0],options.fftwRoot)
options.fftwRoot =''
if items[0] == 'MARC_ROOT':
line = '%s=%s\n'%(items[0],options.marcRoot)
options.marcRoot =''
if items[0] == 'HDF5_ROOT':
line = '%s=%s\n'%(items[0],options.hdf5Root)
options.hdf5Root =''
if items[0] == 'DAMASK_NUM_THREADS':
line = '%s=%s\n'%(items[0],options.threads)
options.threads =''
for blasType in defaults['blasRoot'].keys():
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: line = '#'+line
for spectralOption in options.spectraloptions:
[key,value] = re.split('[= ]',spectralOption)[0:2]
if key == items[0]:
line = '%s=%s\n'%(items[0],value)
options.spectraloptions.remove(spectralOption)
output.append(line)
except IOError:
pass
#--- write remaining options --------------------------------------------------------------------------
for opt, value in options.__dict__.items():
if opt == 'compiler' and value !='':
output.append('F90=%s\n'%value)
if opt == 'fftwRoot' and value !='':
output.append('FFTW_ROOT=%s\n'%value)
if opt == 'marcRoot' and value !='':
output.append('MARC_ROOT=%s\n'%value)
if opt == 'hdf5Root' and value !='':
output.append('HDF5_ROOT=%s\n'%value)
if opt == 'threads' and value !='':
output.append('DAMASK_NUM_THREADS=%s\n'%value)
if opt == 'blasType' and value !='':
output.append('%s_ROOT=%s\n'%(blasType,options.blasRoot))
for spectralOption in options.spectraloptions:
output.append(spectralOption+'\n')
with open('installation/options','w') as f:
#--- decide where do save the data ----------------------------------------------------------------------
root=os.access('/etc/', os.W_OK)
if root:
configFileNew = '/etc/damask.conf'
else:
configFileNew = os.path.join(os.getenv('HOME'),'.damask/damask.conf')
if not os.path.isdir(os.path.join(os.getenv('HOME'),'.damask')):
os.mkdir(os.path.join(os.getenv('HOME'),'.damask'))
print('\n-----\n writing values to %s\n-----'%configFileNew)
with open(configFileNew,'w') as f:
for line in output:
f.write(line)

View File

@ -32,7 +32,7 @@ compileCommand = {
# 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 -I%s/include -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -liomp5 -lm'%(options['IMKL_ROOT'],options['IMKL_ROOT'])
lib_lapack = '-L%s/lib/intel64 -I%s/include -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm -liomp5'%(options['IMKL_ROOT'],options['IMKL_ROOT'])
elif options['ACML_ROOT'] != '':
lib_lapack = '-L%s/%s64/lib -lacml'%(options['ACML_ROOT'],options['F90'])
elif options['LAPACK_ROOT'] != '':

View File

@ -4,7 +4,11 @@ DEFAULT_VERSION='2013.1'
WORKINGDIR="$( cd "$( dirname "$0" )" && pwd )"
source $WORKINGDIR/../options
if [ -f $HOME/.damask/damask.conf ] then
source $HOME/.damask/damask.conf
else
source /etc/damask.conf
fi
while [ ! -d "$WORKINGDIR/$VERSION" ] || [ -z "$VERSION" ]
do

View File

@ -1,18 +0,0 @@
# $Id: pathinfo 2176 2013-02-19 13:35:38Z MPIE\p.eisenlohr $
# possible options are
# IMKL_ROOT base installation directory of Intel Math Kernel Library
# ACML_ROOT base installation directory of AMD Core Math Library
# LAPAC_KROOT base installation directory of (system) LAPACK Library
# MSC_ROOT base installation directory of MSC.Marc/Mentat
# FFTW_ROOT base installation directory of Fastest Fourier Transform in the West library
# Do NOT add any trailing /lib/ to the end
# of the base installation path---this will be done automatically
FFTW_ROOT=
LAPACK_ROOT=
ACML_ROOT=
IMKL_ROOT=
MSC_ROOT=
F90=
DAMASK_NUM_THREADS=2

View File

@ -10,14 +10,21 @@ bin_link = { \
MarcReleases =[2011,2012,2013,2013.1]
damaskEnv = damask.Environment('../../') # script location relative to root
baseDir = damaskEnv.relPath('code/')
baseDir = damask.Environment('../../').relPath('code/')
root=os.access('/usr/local/bin', os.W_OK)
if root:
binDir = '/usr/local/bin'
else:
binDir = os.path.join(os.getenv('HOME'),'bin')
if not os.path.isdir(binDir):
os.mkdir(binDir)
for dir in bin_link:
for file in bin_link[dir]:
src = os.path.abspath(os.path.join(baseDir,dir,file))
if os.path.exists(src):
sym_link = os.path.abspath(os.path.join(damaskEnv.binDir(),\
sym_link = os.path.abspath(os.path.join(binDir,\
{True: dir,
False:os.path.splitext(file)[0]}[file == '']))
if os.path.lexists(sym_link): os.remove(sym_link)

View File

@ -5,7 +5,7 @@ import os
from damask import Environment
damaskEnv = Environment()
baseDir = damaskEnv.relPath('processing/')
baseDir = damaskEnv.relPath('installation/')
codeDir = damaskEnv.relPath('code/')
#define ToDo list
@ -82,13 +82,21 @@ bin_link = { \
],
}
root=os.access('/usr/local/bin', os.W_OK)
if root:
binDir = '/usr/local/bin'
else:
binDir = os.path.join(os.getenv('HOME'),'bin')
if not os.path.isdir(binDir):
os.mkdir(binDir)
for dir in bin_link:
for file in bin_link[dir]:
src = os.path.abspath(os.path.join(baseDir,dir,file))
if (file == ''):
sym_link = os.path.abspath(os.path.join(damaskEnv.binDir(),dir))
sym_link = os.path.abspath(os.path.join(binDir,dir))
else:
sym_link = os.path.abspath(os.path.join(damaskEnv.binDir(),os.path.splitext(file)[0]))
sym_link = os.path.abspath(os.path.join(binDir,os.path.splitext(file)[0]))
print sym_link,'-->',src
if os.path.lexists(sym_link):
os.remove(sym_link)

View File

@ -17,21 +17,8 @@ class Environment():
return os.path.join(self.rootDir(),relative)
def rootDir(self):
damask_root = os.getenv('DAMASK_ROOT')
if damask_root == '' or damask_root == None: # env not set
if sys.argv[0] == '': # no caller path
cwd = os.getcwd()
else:
cwd = sys.argv[0] if os.path.isdir(sys.argv[0]) else os.path.dirname(sys.argv[0])
return os.path.normpath(os.path.join(os.path.realpath(__file__),'../../../'))
damask_root = os.path.normpath(os.path.join(os.path.realpath(cwd),self.rootRelation))
return damask_root
def binDir(self):
damask_bin = os.getenv('DAMASK_BIN')
if damask_bin == '' or damask_bin == None: damask_bin = self.relPath('bin/')
return damask_bin
def get_options(self):
with open(self.relPath('installation/options')) as file: