added "core" package capability to processing

(renamed former f2py modules)

reverted pathinfo...
This commit is contained in:
Philip Eisenlohr 2011-12-22 10:36:59 +00:00
parent 429af90ccb
commit 35bd460e39
5 changed files with 47 additions and 25 deletions

View File

@ -17,7 +17,7 @@
! along with DAMASK. If not, see <http://www.gnu.org/licenses/>.
!
!##############################################################
!* $Id: prec.f90 1033 2011-10-20 16:46:11Z MPIE\m.diehl $
!* $Id$
!##############################################################
MODULE prec

View File

@ -1,4 +1,4 @@
! $Id: postprocessingMath.pyf 979 2011-08-25 18:18:38Z MPIE\m.diehl $
! $Id$
! -*- f90 -*-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Note: the context of this file is case sensitive.
@ -11,8 +11,8 @@
! - if the dimension of an array depend on a array that is itself an input, use the C-Syntax: (1) becomes [0] etc.
! - be sure that the precision defined for math.f90 is integer, real*8, and complex*16
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
python module DAMASK ! in
interface ! in :DAMASK
python module core ! in
interface ! in :core
module math ! in :math:math.f90
subroutine volume_compare(res,geomdim,defgrad,nodes,volume_mismatch) ! in :math:math.f90
@ -156,5 +156,5 @@ python module DAMASK ! in
end subroutine math_equivStrain33_field
end module math
end interface
end python module DAMASK
end python module core

View File

@ -240,6 +240,11 @@ prec.o: prec.f90
endif
tidy:
rm -rf *.o
rm -rf *.mod
rm -rf *.a
clean:
rm -rf *.o
rm -rf *.mod

View File

@ -1,6 +1,6 @@
# possible options are MSC, FFTW, IKML, ACML, LAPACK
ACML /opt/acml4.4.0
#ACML /opt/acml4.4.0
LAPACK /usr
FFTW ./fftw
MSC /msc

View File

@ -36,25 +36,37 @@ Sets up the pre and post processing tools of DAMASK
""" + string.replace('$Id: addDivergence.py 1129 2011-12-01 12:01:13Z MPIE\m.diehl $','\n','\\n')
)
parser.add_option('--F90', dest='compiler', type='string', \
help='name of F90 compiler [%default]')
compilers = ['intel','ifort','intel32','gfortran','gnu95']
parser.add_option('--F90', dest='compiler', type='string', \
help='name of F90 compiler')
parser.set_defaults(compiler = 'ifort')
(options,filenames) = parser.parse_args()
#translating name of compiler for use with f2py and setting subdirname of acml
if options.compiler == 'gfortran':
f2py_compiler='gnu95 --f90flags="-fno-range-check"'
else:
f2py_compiler='intelem'
if options.compiler not in compilers:
parser.error('compiler has to be one out of --F90 %s'%(', '.join(compilers)))
acml_subdir='%s64/lib'%options.compiler
f2py_compiler = {
'gfortran': 'gnu95 --f90flags="-fno-range-check"',
'gnu95': 'gnu95 --f90flags="-fno-range-check"',
'intel32': 'intel',
'intel': 'intelem',
'ifort': 'intelem',
}[options.compiler]
damaskEnv = damask.Environment()
baseDir = damaskEnv.relPath('processing/')
codeDir = damaskEnv.relPath('code/')
if 'ikml' in damaskEnv.pathInfo and damaskEnv.pathInfo['ikml'] != '':
lib_lapack = '' # TODO!!
elif 'acml' in damaskEnv.pathInfo and damaskEnv.pathInfo['acml'] != '':
lib_lapack = '-L%s -lacml'%(os.path.join(damaskEnv.pathInfo['acml'],'%s64')) # can we use linker flag?
# lib_lapack = os.path.join(damaskEnv.pathInfo['acml'],'%s64/lib/libacml.a'%options.compiler) # why linking against static lib?
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
#define ToDo list
bin_link = { \
'pre' : [
@ -101,21 +113,21 @@ compile = { \
execute = { \
'postMath' : [
'rm %s'%(os.path.join(damaskEnv.relPath('lib/'),'DAMASK.so')),
'make tidy',
'rm %s'%(os.path.join(damaskEnv.relPath('lib/damask'),'core.so')),
# The following command is used to compile math.f90 and make the functions defined in DAMASK_math.pyf
# available for python in the module DAMASK_math.so
# It uses the fortran wrapper f2py that is included in the numpy package to construct the
# module postprocessingMath.so out of the fortran code postprocessingMath.f90
# for the generation of the pyf file:
#f2py -m DAMASK -h DAMASK.pyf --overwrite-signature ../../code/math.f90 \
'f2py %s '%(os.path.join(codeDir,'DAMASK.pyf')) +\
'f2py %s'%(os.path.join(codeDir,'damask.core.pyf')) +\
' -c --fcompiler=%s'%(f2py_compiler) +\
'%s ' %(os.path.join(codeDir,'DAMASK2Python_helper.f90'))+\
' %s'%(os.path.join(codeDir,'core_modules.f90'))+\
' %s'%(os.path.join(codeDir,'math.f90'))+\
'%s '
%(os.path.join(damaskEnv.pathInfo['fftw'],'lib/libfftw3.a'))+\
'%s' %(os.path.join(damaskEnv.pathInfo['acml'],acml_subdir,'libacml.a')),
'mv %s %s' %(os.path.join(codeDir,'DAMASK.so'),damaskEnv.relPath('lib/')),
' -L%s -lfftw3'%(damaskEnv.pathInfo['fftw'])+\
' %s'%lib_lapack,
'mv %s %s' %(os.path.join(codeDir,'core.so'),damaskEnv.relPath('lib/damask')),
]
}
@ -135,9 +147,14 @@ for dir in compile:
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)
os.chdir(damaskEnv.relPath('processing/setup/'))
except:
print 'failed..!'
pass
os.chdir(damaskEnv.relPath('processing/setup/'))
modules = glob.glob('*.mod')
for module in modules:
print 'removing', module