more modifications, only configure needs modifications
This commit is contained in:
parent
80da1c529e
commit
aab0208c65
|
@ -1,34 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
import os
|
|
||||||
import damask
|
|
||||||
|
|
||||||
bin_link = { \
|
|
||||||
'.' : [
|
|
||||||
'DAMASK_spectral.exe',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
MarcReleases =[2011,2012,2013,2013.1]
|
|
||||||
|
|
||||||
damaskEnv = damask.Environment('../../') # script location relative to root
|
|
||||||
baseDir = damaskEnv.relPath('code/')
|
|
||||||
|
|
||||||
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(),\
|
|
||||||
{True: dir,
|
|
||||||
False:os.path.splitext(file)[0]}[file == '']))
|
|
||||||
if os.path.lexists(sym_link): os.remove(sym_link)
|
|
||||||
os.symlink(src,sym_link)
|
|
||||||
print sym_link,'-->',src
|
|
||||||
|
|
||||||
|
|
||||||
for version in MarcReleases:
|
|
||||||
src = os.path.abspath(os.path.join(baseDir,'DAMASK_marc.f90'))
|
|
||||||
if os.path.exists(src):
|
|
||||||
sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc'+str(version)+'.f90'))
|
|
||||||
if os.path.lexists(sym_link): os.remove(sym_link)
|
|
||||||
os.symlink(src,sym_link)
|
|
||||||
print sym_link,'-->',src
|
|
|
@ -59,7 +59,6 @@ elif lapackroot != '':
|
||||||
|
|
||||||
execute = { \
|
execute = { \
|
||||||
'coreModule' : [
|
'coreModule' : [
|
||||||
'make tidy',
|
|
||||||
# The following command is used to compile the fortran files and make the functions defined
|
# The following command is used to compile the fortran files and make the functions defined
|
||||||
# in damask.core.pyf available for python in the module core.so
|
# in damask.core.pyf available for python in the module core.so
|
||||||
# It uses the fortran wrapper f2py that is included in the numpy package to construct the
|
# It uses the fortran wrapper f2py that is included in the numpy package to construct the
|
||||||
|
|
|
@ -4,6 +4,8 @@ DEFAULT_VERSION='2013.1'
|
||||||
|
|
||||||
WORKINGDIR=`dirname $0`
|
WORKINGDIR=`dirname $0`
|
||||||
|
|
||||||
|
source ../options
|
||||||
|
|
||||||
while [ ! -d "$WORKINGDIR/$VERSION" ] || [ -z "$VERSION" ]
|
while [ ! -d "$WORKINGDIR/$VERSION" ] || [ -z "$VERSION" ]
|
||||||
do
|
do
|
||||||
echo "Input version of MARC/MENTAT installation: [${DEFAULT_VERSION}]"
|
echo "Input version of MARC/MENTAT installation: [${DEFAULT_VERSION}]"
|
||||||
|
@ -14,9 +16,8 @@ do
|
||||||
done
|
done
|
||||||
echo "MSC version: $VERSION"
|
echo "MSC version: $VERSION"
|
||||||
|
|
||||||
INSTALLDIR=''
|
if [ "x$MSCROOT" != "x" ]
|
||||||
if [ -f $WORKINGDIR/../../lib/pathinfo ]; then
|
then INSTALLDIR=$MSCROOT
|
||||||
INSTALLDIR=`grep -vE "^[[:space:]]*#|^$" $WORKINGDIR/../../lib/pathinfo | grep -i msc | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! -d "$INSTALLDIR" ] || [ -z "$INSTALLDIR" ]
|
while [ ! -d "$INSTALLDIR" ] || [ -z "$INSTALLDIR" ]
|
||||||
|
@ -30,20 +31,17 @@ echo "MSC installation path: $INSTALLDIR"
|
||||||
|
|
||||||
BLASDIR=''
|
BLASDIR=''
|
||||||
BLASTYPE=''
|
BLASTYPE=''
|
||||||
if [ -f $WORKINGDIR/../../lib/pathinfo ]; then
|
if [ "x$LAPACKROOT" != "x" ]
|
||||||
IMKLDIR=`grep -vE "^[[:space:]]*#|^$" $WORKINGDIR/../../lib/pathinfo | grep -i imkl | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
|
BLASDIR=$LAPACKROOT
|
||||||
ACMLDIR=`grep -vE "^[[:space:]]*#|^$" $WORKINGDIR/../../lib/pathinfo | grep -i acml | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
|
|
||||||
LAPACKDIR=`grep -vE "^[[:space:]]*#|^$" $WORKINGDIR/../../lib/pathinfo | grep -i lapack | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
|
|
||||||
if [ -d "$IMKLDIR" ]; then
|
|
||||||
BLASDIR=$IMKLDIR
|
|
||||||
BLASTYPE='IMKL'
|
|
||||||
elif [ -d "$ACMLDIR" ]; then
|
|
||||||
BLASDIR=$ACMLDIR
|
|
||||||
BLASTYPE='ACML'
|
|
||||||
elif [ -d "$LAPACKDIR" ]; then
|
|
||||||
BLASDIR=$LAPACKDIR
|
|
||||||
BLASTYPE='LAPACK'
|
BLASTYPE='LAPACK'
|
||||||
fi
|
fi
|
||||||
|
if [ "x$ACMLROOT" != "x" ]
|
||||||
|
BLASDIR=$ACMLROOT
|
||||||
|
BLASTYPE='ACML'
|
||||||
|
fi
|
||||||
|
if [ "x$IMKLROOT" != "x" ]
|
||||||
|
BLASDIR=$IMKLROOT
|
||||||
|
BLASTYPE='IMKL'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! -d "$BLASDIR" ] || [ -z "$BLASDIR" ]
|
while [ ! -d "$BLASDIR" ] || [ -z "$BLASDIR" ]
|
||||||
|
|
|
@ -13,3 +13,4 @@ LAPACKROOT=/usr
|
||||||
ACMLROOT=
|
ACMLROOT=
|
||||||
IMKLROOT=
|
IMKLROOT=
|
||||||
F90=gfortran
|
F90=gfortran
|
||||||
|
MSCROOT=/msc
|
||||||
|
|
|
@ -1,166 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import os,sys,string,re,platform
|
|
||||||
from optparse import OptionParser
|
|
||||||
|
|
||||||
validShell = {\
|
|
||||||
'bash': 'DAMASK_env.sh' ,
|
|
||||||
'csh': 'DAMASK_env.csh',
|
|
||||||
'windows': 'DAMASK_env.bat',
|
|
||||||
}
|
|
||||||
|
|
||||||
env_order = ['DAMASK_ROOT','DAMASK_BIN','PATH','PYTHONPATH','LD_LIBRARY_PATH']
|
|
||||||
environment = { 'DAMASK_ROOT':
|
|
||||||
[{'delete':'',
|
|
||||||
'substitute':'[DamaskRoot]',
|
|
||||||
'append': False,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'DAMASK_BIN':
|
|
||||||
[{'delete':'',
|
|
||||||
'substitute':'[os.path.join(DamaskRoot,"bin")]',
|
|
||||||
'append': False,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'PATH':
|
|
||||||
[{'delete':'"${DAMASK_BIN}"',
|
|
||||||
'substitute':'["${DAMASK_BIN}"]',
|
|
||||||
'append': True,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'PYTHONPATH':
|
|
||||||
[{'delete':'"${DAMASK_ROOT}/lib"',
|
|
||||||
'substitute':'["${DAMASK_ROOT}/lib"]',
|
|
||||||
'append': True,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'LD_LIBRARY_PATH':
|
|
||||||
[{'activate': 'pathInfo["acml"]',
|
|
||||||
'delete': '"acml"', # what keywords trigger item deletion from existing path
|
|
||||||
'substitute':'[os.path.join(pathInfo["acml"],"ifort64_mp/lib"),\
|
|
||||||
os.path.join(pathInfo["acml"],"ifort64/lib"),\
|
|
||||||
os.path.join(pathInfo["acml"],"gfortran64_mp/lib"),\
|
|
||||||
os.path.join(pathInfo["acml"],"gfortran64/lib")]', # what to substitute for deleted path items
|
|
||||||
'append': True, # whether new entries append to existing ${env}
|
|
||||||
},
|
|
||||||
{'activate': 'pathInfo["lapack"]',
|
|
||||||
'delete': '[os.path.join(pathInfo["lapack"],"lib"),\
|
|
||||||
os.path.join(pathInfo["lapack"],"lib64")]', # deleted current (same) entry
|
|
||||||
'substitute':'[os.path.join(pathInfo["lapack"],"lib"),\
|
|
||||||
os.path.join(pathInfo["lapack"],"lib64")]', # what to substitute for deleted path
|
|
||||||
'append': True, # whether new entries append to existing ${env}
|
|
||||||
},
|
|
||||||
{'activate': 'pathInfo["fftw"]',
|
|
||||||
'delete': '[os.path.join(pathInfo["fftw"],"lib")]', # deleted current (same) entry
|
|
||||||
'substitute':'[os.path.join(pathInfo["fftw"],"lib")]', # what to substitute for deleted path items
|
|
||||||
'append': True, # whether new entries append to existing ${env}
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
parser = OptionParser(usage="%prog [options]", description = """
|
|
||||||
Sets up your shell resource to be compatible with DAMASK.
|
|
||||||
""" + string.replace('$Id: setup_shellrc.py 2126 2013-02-01 13:22:40Z MPIE\m.diehl $','\n','\\n')
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_option("-s","--shell", type="string",
|
|
||||||
dest = "shell", \
|
|
||||||
help = "type of shell, e.g. "+', '.join(validShell.keys())+" [%default]")
|
|
||||||
|
|
||||||
parser.set_defaults(shell = 'windows' if platform.system() == 'Windows' else 'bash')
|
|
||||||
(options, args) = parser.parse_args()
|
|
||||||
|
|
||||||
pathInfo = {}
|
|
||||||
|
|
||||||
DamaskRoot = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),'../'))
|
|
||||||
try: # check for user-defined pathinfo
|
|
||||||
file = open(os.path.join(DamaskRoot,'lib/pathinfo'))
|
|
||||||
content = map(lambda string: string.strip(),file.readlines())
|
|
||||||
file.close()
|
|
||||||
for line in content:
|
|
||||||
if not (line.startswith('#') or line == ''):
|
|
||||||
items = line.split() + ['','']
|
|
||||||
pathInfo[items[0].lower()] = {False: os.path.normpath(os.path.join(DamaskRoot,'lib/',items[1])),
|
|
||||||
True: items[1]}[items[1] == '']
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
theShell = options.shell.lower()
|
|
||||||
if theShell not in validShell:
|
|
||||||
print('invalid shell %s, assuming bash', theShell)
|
|
||||||
theShell='bash'
|
|
||||||
|
|
||||||
theSourceFile = validShell[theShell]
|
|
||||||
thePath = os.path.join(DamaskRoot,theSourceFile)
|
|
||||||
if os.path.exists(thePath):
|
|
||||||
print('parsing existing %s'%thePath)
|
|
||||||
|
|
||||||
currentSourceFile = open(thePath)
|
|
||||||
content = map(string.strip,currentSourceFile.readlines())
|
|
||||||
currentSourceFile.close()
|
|
||||||
|
|
||||||
match = {}
|
|
||||||
for var in env_order: match[var] = False
|
|
||||||
|
|
||||||
output = []
|
|
||||||
|
|
||||||
for line in content:
|
|
||||||
for var in env_order:
|
|
||||||
m = re.search(\
|
|
||||||
{\
|
|
||||||
'bash': r'^(.*? %s=)([^;]*)(.*)$'%var,
|
|
||||||
'csh': r'^(\s*setenv\s+%s\s+)([^;]*)(.*)$'%var,
|
|
||||||
'windows': r'^(\s*SET\s+%s\s+)([^;]*)(.*)$'%var #case insesitiv search + second % sign
|
|
||||||
}[theShell],line)
|
|
||||||
if m:
|
|
||||||
n = re.search(r'(%s)'%var, line)
|
|
||||||
o = re.search(r'(#)', line)
|
|
||||||
if o:
|
|
||||||
if o.start() < n.start():
|
|
||||||
print 'skipped potential comment line, please check!'
|
|
||||||
continue
|
|
||||||
match[var] = True
|
|
||||||
items = m.group(2).split(':')
|
|
||||||
for piece in environment[var]:
|
|
||||||
try:
|
|
||||||
if 'activate' not in piece or eval(piece['activate']) != '':
|
|
||||||
if piece['append']:
|
|
||||||
if 'delete' in piece:
|
|
||||||
killer = eval(piece['delete'])
|
|
||||||
if type(killer) == str:
|
|
||||||
items = [path for path in items if killer not in path]
|
|
||||||
if type(killer) == list:
|
|
||||||
items = [path for path in items if path not in killer]
|
|
||||||
items += eval(piece['substitute'])
|
|
||||||
else:
|
|
||||||
items = eval(piece['substitute'])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
line = m.group(1)+':'.join(items)+m.group(3)
|
|
||||||
|
|
||||||
output.append(line)
|
|
||||||
|
|
||||||
for var in env_order:
|
|
||||||
if not match[var]:
|
|
||||||
items = ['${%s}'%var]
|
|
||||||
for piece in environment[var]:
|
|
||||||
try:
|
|
||||||
if 'activate' not in piece or eval(piece['activate']) != '':
|
|
||||||
if piece['append']:
|
|
||||||
items += eval(piece['substitute'])
|
|
||||||
else:
|
|
||||||
items = eval(piece['substitute'])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
output.append({\
|
|
||||||
'bash': 'export %s=%s'%(var,':'.join(items)),
|
|
||||||
'csh': 'setenv %s %s'%(var,':'.join(items)),
|
|
||||||
'windows': 'SET %s %s'%(var,':'.join(items)),
|
|
||||||
}[theShell])
|
|
||||||
|
|
||||||
print('writing to %s'%thePath)
|
|
||||||
newSourceFile = open(thePath,'w')
|
|
||||||
newSourceFile.write('\n'.join(output)+'\n')
|
|
||||||
newSourceFile.close()
|
|
||||||
|
|
||||||
|
|
|
@ -1,168 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import os,sys,string,re
|
|
||||||
from optparse import OptionParser
|
|
||||||
|
|
||||||
validShellRC = {\
|
|
||||||
'bash':['.bashrc','.bash_profile','.bash_login','.profile','new'],
|
|
||||||
'csh': ['.cshrc','new'],
|
|
||||||
}
|
|
||||||
|
|
||||||
env_order = ['DAMASK_ROOT','DAMASK_BIN','PATH','PYTHONPATH','LD_LIBRARY_PATH']
|
|
||||||
environment = { 'DAMASK_ROOT':
|
|
||||||
[{'delete':'',
|
|
||||||
'substitute':'[DamaskRoot]',
|
|
||||||
'append': False,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'DAMASK_BIN':
|
|
||||||
[{'delete':'',
|
|
||||||
'substitute':'[os.path.join(DamaskRoot,"bin")]',
|
|
||||||
'append': False,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'PATH':
|
|
||||||
[{'delete':'"${DAMASK_BIN}"',
|
|
||||||
'substitute':'["${DAMASK_BIN}"]',
|
|
||||||
'append': True,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'PYTHONPATH':
|
|
||||||
[{'delete':'"${DAMASK_ROOT}/lib"',
|
|
||||||
'substitute':'["${DAMASK_ROOT}/lib"]',
|
|
||||||
'append': True,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'LD_LIBRARY_PATH':
|
|
||||||
[{'activate': 'pathInfo["acml"]',
|
|
||||||
'delete': '"acml"', # what keywords trigger item deletion from existing path
|
|
||||||
'substitute':'[os.path.join(pathInfo["acml"],"ifort64_mp/lib"),\
|
|
||||||
os.path.join(pathInfo["acml"],"ifort64/lib"),\
|
|
||||||
os.path.join(pathInfo["acml"],"gfortran64_mp/lib"),\
|
|
||||||
os.path.join(pathInfo["acml"],"gfortran64/lib")]', # what to substitute for deleted path items
|
|
||||||
'append': True, # whether new entries append to existing ${env}
|
|
||||||
},
|
|
||||||
{'activate': 'pathInfo["lapack"]',
|
|
||||||
'delete': '[os.path.join(pathInfo["lapack"],"lib"),\
|
|
||||||
os.path.join(pathInfo["lapack"],"lib64")]', # deleted current (same) entry
|
|
||||||
'substitute':'[os.path.join(pathInfo["lapack"],"lib"),\
|
|
||||||
os.path.join(pathInfo["lapack"],"lib64")]', # what to substitute for deleted path
|
|
||||||
'append': True, # whether new entries append to existing ${env}
|
|
||||||
},
|
|
||||||
{'activate': 'pathInfo["fftw"]',
|
|
||||||
'delete': '[os.path.join(pathInfo["fftw"],"lib")]', # deleted current (same) entry
|
|
||||||
'substitute':'[os.path.join(pathInfo["fftw"],"lib")]', # what to substitute for deleted path items
|
|
||||||
'append': True, # whether new entries append to existing ${env}
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
parser = OptionParser(usage="%prog [options]", description = """
|
|
||||||
Sets up your shell resource to be compatible with DAMASK.
|
|
||||||
""" + string.replace('$Id$','\n','\\n')
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_option("-s","--shell", type="string",
|
|
||||||
dest = "shell", \
|
|
||||||
help = "type of shell, e.g. "+', '.join(validShellRC.keys())+" [%default]")
|
|
||||||
|
|
||||||
parser.set_defaults(shell = 'bash')
|
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
|
||||||
|
|
||||||
pathInfo = {}
|
|
||||||
hitSomething = False
|
|
||||||
|
|
||||||
DamaskRoot = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),'../'))
|
|
||||||
try: # check for user-defined pathinfo
|
|
||||||
file = open(os.path.join(DamaskRoot,'lib/pathinfo'))
|
|
||||||
content = map(lambda string: string.strip(),file.readlines())
|
|
||||||
file.close()
|
|
||||||
for line in content:
|
|
||||||
if not (line.startswith('#') or line == ''):
|
|
||||||
items = line.split() + ['','']
|
|
||||||
pathInfo[items[0].lower()] = {False: os.path.normpath(os.path.join(DamaskRoot,'lib/',items[1])),
|
|
||||||
True: items[1]}[items[1] == '']
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
theShell = options.shell.lower()
|
|
||||||
theHome = os.getenv('USERPROFILE') or os.getenv('HOME')
|
|
||||||
|
|
||||||
for theRC in validShellRC[theShell]:
|
|
||||||
if theRC == 'new' and not hitSomething:
|
|
||||||
theRC = validShellRC[theShell][0]
|
|
||||||
print 'Could not find a file to store bash information, creating "%s" in home directory'%theRC
|
|
||||||
open(os.path.join(theHome,theRC), 'w').close()
|
|
||||||
thePath = os.path.join(theHome,theRC)
|
|
||||||
if os.path.exists(thePath):
|
|
||||||
print thePath
|
|
||||||
hitSomething = True
|
|
||||||
rc = open(os.path.join(theHome,theRC))
|
|
||||||
content = map(string.strip,rc.readlines())
|
|
||||||
rc.close()
|
|
||||||
|
|
||||||
match = {}
|
|
||||||
for var in env_order: match[var] = False
|
|
||||||
|
|
||||||
output = []
|
|
||||||
|
|
||||||
for line in content:
|
|
||||||
for var in env_order:
|
|
||||||
m = re.search(\
|
|
||||||
{\
|
|
||||||
'bash': r'^(.*? %s=)([^;]*)(.*)$'%var,
|
|
||||||
'csh': r'^(\s*setenv\s+%s\s+)([^;]*)(.*)$'%var
|
|
||||||
}[theShell],line)
|
|
||||||
if m:
|
|
||||||
n = re.search(r'(%s)'%var, line)
|
|
||||||
o = re.search(r'(#)', line)
|
|
||||||
if o:
|
|
||||||
if o.start() < n.start():
|
|
||||||
print 'skipped potential comment line, please check!'
|
|
||||||
continue
|
|
||||||
match[var] = True
|
|
||||||
items = m.group(2).split(':')
|
|
||||||
for piece in environment[var]:
|
|
||||||
try:
|
|
||||||
if 'activate' not in piece or eval(piece['activate']) != '':
|
|
||||||
if piece['append']:
|
|
||||||
if 'delete' in piece:
|
|
||||||
killer = eval(piece['delete'])
|
|
||||||
if type(killer) == str:
|
|
||||||
items = [path for path in items if killer not in path]
|
|
||||||
if type(killer) == list:
|
|
||||||
items = [path for path in items if path not in killer]
|
|
||||||
items += eval(piece['substitute'])
|
|
||||||
else:
|
|
||||||
items = eval(piece['substitute'])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
line = m.group(1)+':'.join(items)+m.group(3)
|
|
||||||
|
|
||||||
output.append(line)
|
|
||||||
|
|
||||||
for var in env_order:
|
|
||||||
if not match[var]:
|
|
||||||
items = ['${%s}'%var]
|
|
||||||
for piece in environment[var]:
|
|
||||||
try:
|
|
||||||
if 'activate' not in piece or eval(piece['activate']) != '':
|
|
||||||
if piece['append']:
|
|
||||||
items += eval(piece['substitute'])
|
|
||||||
else:
|
|
||||||
items = eval(piece['substitute'])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
output.append({\
|
|
||||||
'bash':'export %s=%s'%(var,':'.join(items)),
|
|
||||||
'csh': 'setenv %s %s'%(var,':'.join(items)),
|
|
||||||
}[theShell])
|
|
||||||
|
|
||||||
rc = open(os.path.join(theHome,theRC),'w')
|
|
||||||
rc.write('\n'.join(output)+'\n')
|
|
||||||
rc.close()
|
|
||||||
|
|
||||||
|
|
||||||
if not hitSomething: print 'none of %s found..!'%(', '.join(validShellRC[theShell]))
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
# of the base installation path---this will be done automatically
|
# of the base installation path---this will be done automatically
|
||||||
# Out of IMKL, ACML, LAPACK the first defined value is used to access BLAS functionality
|
# Out of IMKL, ACML, LAPACK the first defined value is used to access BLAS functionality
|
||||||
|
|
||||||
#IMKL /opt/intel/composerxe/mkl
|
IMKL
|
||||||
#ACML /opt/acml4.4.0
|
ACML /opt/acml5.3.0
|
||||||
LAPACK /usr
|
LAPACK /usr
|
||||||
FFTW /usr/local
|
FFTW /usr/local
|
||||||
MSC /msc
|
#MSC /msc
|
||||||
|
|
|
@ -1,131 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# Makes postprocessing routines acessible from everywhere.
|
|
||||||
|
|
||||||
import os,sys,glob,string,subprocess
|
|
||||||
from damask import Environment
|
|
||||||
from optparse import OptionParser, Option
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
class extendableOption(Option):
|
|
||||||
# -----------------------------
|
|
||||||
# used for definition of new option parser action 'extend', which enables to take multiple option arguments
|
|
||||||
# taken from online tutorial http://docs.python.org/library/optparse.html
|
|
||||||
|
|
||||||
ACTIONS = Option.ACTIONS + ("extend",)
|
|
||||||
STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
|
|
||||||
TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
|
|
||||||
ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)
|
|
||||||
|
|
||||||
def take_action(self, action, dest, opt, value, values, parser):
|
|
||||||
if action == "extend":
|
|
||||||
lvalue = value.split(",")
|
|
||||||
values.ensure_value(dest, []).extend(lvalue)
|
|
||||||
else:
|
|
||||||
Option.take_action(self, action, dest, opt, value, values, parser)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########################################################
|
|
||||||
# MAIN
|
|
||||||
########################################################
|
|
||||||
|
|
||||||
parser = OptionParser(option_class=extendableOption, usage='%prog options', description = """
|
|
||||||
Sets up the pre and post processing tools of DAMASK
|
|
||||||
|
|
||||||
""" + string.replace('$Id$','\n','\\n')
|
|
||||||
)
|
|
||||||
|
|
||||||
compilers = ['intel','ifort','intel32','gfortran','gnu95']
|
|
||||||
|
|
||||||
parser.add_option('--F90', '--f90', dest='compiler', type='string', \
|
|
||||||
help='name of F90 [%default]')
|
|
||||||
parser.set_defaults(compiler = {True:'ifort',False:'gfortran'}[\
|
|
||||||
subprocess.call(['which', 'ifort'],\
|
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0])
|
|
||||||
(options,filenames) = parser.parse_args()
|
|
||||||
|
|
||||||
if options.compiler not in compilers:
|
|
||||||
parser.error('compiler switch "--F90" has to be one out of: %s'%(', '.join(compilers)))
|
|
||||||
|
|
||||||
f2py_compiler = {
|
|
||||||
'gfortran': 'gnu95 --f90flags="-fPIC -fno-range-check -xf95-cpp-input -std=f2008 -fall-intrinsics -DSpectral -fdefault-real-8 -fdefault-double-8 -DFLOAT=8 -DINT=4 -I${DAMASK_ROOT}/lib"',
|
|
||||||
'gnu95': 'gnu95 --f90flags="-fPIC -fno-range-check -xf95-cpp-input -std=f2008 -fall-intrinsics -DSpectral -fdefault-real-8 -fdefault-double-8 -DFLOAT=8 -DINT=4 -I${DAMASK_ROOT}/lib"',
|
|
||||||
'intel32': 'intel --f90flags="-fPIC -fpp -stand f08 -diag-disable 5268 -assume byterecl -DSpectral -real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4 -I${DAMASK_ROOT}/lib"',
|
|
||||||
'intel': 'intelem --f90flags="-fPIC -fpp -stand f08 -diag-disable 5268 -assume byterecl -DSpectral -real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4 -I${DAMASK_ROOT}/lib"',
|
|
||||||
'ifort': 'intelem --f90flags="-fPIC -fpp -stand f08 -diag-disable 5268 -assume byterecl -DSpectral -real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4 -I${DAMASK_ROOT}/lib"',
|
|
||||||
}[options.compiler]
|
|
||||||
compiler = {
|
|
||||||
'gfortran': 'gfortran',
|
|
||||||
'gnu95': 'gfortran',
|
|
||||||
'intel32': 'ifort',
|
|
||||||
'intel': 'ifort',
|
|
||||||
'ifort': 'ifort',
|
|
||||||
}[options.compiler]
|
|
||||||
|
|
||||||
damaskEnv = Environment()
|
|
||||||
baseDir = damaskEnv.relPath('processing/')
|
|
||||||
codeDir = damaskEnv.relPath('code/')
|
|
||||||
|
|
||||||
if 'imkl' in damaskEnv.pathInfo and damaskEnv.pathInfo['imkl'] != '' and options.compiler != 'gfortran':
|
|
||||||
lib_lapack = '-L%s/lib/intel64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -liomp5 -lpthread -lm'%(os.path.join(damaskEnv.pathInfo['imkl']))
|
|
||||||
elif 'acml' in damaskEnv.pathInfo and damaskEnv.pathInfo['acml'] != '':
|
|
||||||
lib_lapack = '-L%s/%s64/lib -lacml'%(os.path.join(damaskEnv.pathInfo['acml']),compiler)
|
|
||||||
elif 'lapack' in damaskEnv.pathInfo and damaskEnv.pathInfo['lapack'] != '':
|
|
||||||
lib_lapack = '-L%s -llapack'%(damaskEnv.pathInfo['lapack']) # see http://cens.ioc.ee/pipermail/f2py-users/2003-December/000621.html
|
|
||||||
|
|
||||||
execute = { \
|
|
||||||
'coreModule' : [
|
|
||||||
'make tidy',
|
|
||||||
# The following command is used to compile the fortran files and make the functions defined
|
|
||||||
# in damask.core.pyf available for python in the module core.so
|
|
||||||
# It uses the fortran wrapper f2py that is included in the numpy package to construct the
|
|
||||||
# module core.so out of the fortran code in the f90 files
|
|
||||||
# For the generation of the pyf file use the following lines:
|
|
||||||
###########################################################################
|
|
||||||
#'f2py -h damask.core.pyf' +\
|
|
||||||
#' --overwrite-signature --no-lower prec.f90 DAMASK_spectral_interface.f90 math.f90 mesh.f90',
|
|
||||||
###########################################################################
|
|
||||||
'rm `readlink -f %s`' %(os.path.join(damaskEnv.relPath('lib/damask'),'core.so')),
|
|
||||||
'f2py damask.core.pyf' +\
|
|
||||||
' --build-dir ./' +\
|
|
||||||
' -c --no-lower --fcompiler=%s'%(f2py_compiler) +\
|
|
||||||
' %s'%'prec.f90'+\
|
|
||||||
' %s'%'DAMASK_spectral_interface.f90'+\
|
|
||||||
' %s'%'IO.f90'+\
|
|
||||||
' %s'%'libs.f90'+\
|
|
||||||
' %s'%'numerics.f90'+\
|
|
||||||
' %s'%'debug.f90'+\
|
|
||||||
' %s'%'math.f90'+\
|
|
||||||
' %s'%'FEsolving.f90'+\
|
|
||||||
' %s'%'mesh.f90'+\
|
|
||||||
' %s'%'core_quit.f90'+\
|
|
||||||
' -L%s/lib -lfftw3'%(damaskEnv.pathInfo['fftw'])+\
|
|
||||||
' %s'%lib_lapack,
|
|
||||||
'mv %s `readlink -f %s`' %(os.path.join(codeDir,'core.so'),os.path.join(damaskEnv.relPath('lib/damask'),'core.so')),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
os.chdir(codeDir) # needed for compilation with gfortran and f2py
|
|
||||||
for tasks in execute:
|
|
||||||
for cmd in execute[tasks]:
|
|
||||||
try:
|
|
||||||
print 'executing...:',cmd
|
|
||||||
os.system(cmd)
|
|
||||||
except:
|
|
||||||
print 'failed..!'
|
|
||||||
pass
|
|
||||||
|
|
||||||
modules = glob.glob('*.mod')
|
|
||||||
for module in modules:
|
|
||||||
print 'removing', module
|
|
||||||
os.remove(module)
|
|
||||||
|
|
||||||
#check if compilation of core module was successful
|
|
||||||
try:
|
|
||||||
with open(damaskEnv.relPath('lib/damask/core.so')) as f: pass
|
|
||||||
except IOError as e:
|
|
||||||
print '*********\n* core.so not found, compilation of core modules was not successful\n*********'
|
|
||||||
sys.exit()
|
|
||||||
f.close
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
${DAMASK_ROOT}/processing/setup/symLink_Processing.py
|
|
||||||
${DAMASK_ROOT}/processing/setup/compile_CoreModule.py $@
|
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# Makes postprocessing routines acessible from everywhere.
|
|
||||||
import os
|
|
||||||
from damask import Environment
|
|
||||||
|
|
||||||
damaskEnv = Environment()
|
|
||||||
baseDir = damaskEnv.relPath('processing/')
|
|
||||||
codeDir = damaskEnv.relPath('code/')
|
|
||||||
|
|
||||||
#define ToDo list
|
|
||||||
bin_link = { \
|
|
||||||
'pre' : [
|
|
||||||
'marc_addUserOutput.py',
|
|
||||||
'mentat_pbcOnBoxMesh.py',
|
|
||||||
'mentat_spectralBox.py',
|
|
||||||
'OIMang_hex2cub.py',
|
|
||||||
'patchFromReconstructedBoundaries.py',
|
|
||||||
'randomSeeding.py',
|
|
||||||
'seed_check.py',
|
|
||||||
'geom_fromAng.py',
|
|
||||||
'geom_fromVPSC.py',
|
|
||||||
'geom_fromEuclideanDistance.py',
|
|
||||||
'geom_fromMinimalSurface.py',
|
|
||||||
'geom_fromVoronoiTessellation.py',
|
|
||||||
'geom_fromOsteonGeometry.py',
|
|
||||||
'geom_canvas.py',
|
|
||||||
'geom_check.py',
|
|
||||||
'geom_rescale.py',
|
|
||||||
'geom_pack.py',
|
|
||||||
'geom_unpack.py',
|
|
||||||
'geom_translate.py',
|
|
||||||
'geom_vicinityOffset.py',
|
|
||||||
'geom_grainGrowth.py',
|
|
||||||
'geom_poke.py',
|
|
||||||
],
|
|
||||||
'post' : [
|
|
||||||
'3Dvisualize.py',
|
|
||||||
'permuteData.py',
|
|
||||||
'addCalculation.py',
|
|
||||||
'addCauchy.py',
|
|
||||||
'addCompatibilityMismatch.py',
|
|
||||||
'addCurl.py',
|
|
||||||
'addDeformedConfiguration.py',
|
|
||||||
'addDeterminant.py',
|
|
||||||
'addDeviator.py',
|
|
||||||
'addDivergence.py',
|
|
||||||
'addEhkl.py',
|
|
||||||
'addEuclideanDistance.py',
|
|
||||||
'addGrainID.py',
|
|
||||||
'addMises.py',
|
|
||||||
'addNorm.py',
|
|
||||||
'addOrientations.py',
|
|
||||||
'addIPFcolor.py',
|
|
||||||
'addPK2.py',
|
|
||||||
'addSchmidfactors.py',
|
|
||||||
'addSpectralDecomposition.py',
|
|
||||||
'addStrainTensors.py',
|
|
||||||
'averageDown.py',
|
|
||||||
'binXY.py',
|
|
||||||
'blowUp.py',
|
|
||||||
'stddevDown.py',
|
|
||||||
'deleteColumn.py',
|
|
||||||
'deleteInfo.py',
|
|
||||||
'filterTable.py',
|
|
||||||
'sortTable.py',
|
|
||||||
'marc_deformedGeometry.py',
|
|
||||||
'marc_extractData.py',
|
|
||||||
'mentat_colorMap.py',
|
|
||||||
'nodesFromCentroids.py',
|
|
||||||
'perceptualUniformColorMap.py',
|
|
||||||
'postResults.py',
|
|
||||||
'showTable.py',
|
|
||||||
'tagLabel.py',
|
|
||||||
'vtk2ang.py',
|
|
||||||
'vtk_addData.py',
|
|
||||||
'vtk_pointcloud.py',
|
|
||||||
'vtk_addPointcloudData.py',
|
|
||||||
'vtk_voxelcloud.py',
|
|
||||||
'vtk_addVoxelcloudData.py',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
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))
|
|
||||||
else:
|
|
||||||
sym_link = os.path.abspath(os.path.join(damaskEnv.binDir(),os.path.splitext(file)[0]))
|
|
||||||
print sym_link,'-->',src
|
|
||||||
if os.path.lexists(sym_link):
|
|
||||||
os.remove(sym_link)
|
|
||||||
os.symlink(src,sym_link)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue