forked from llnl/UEDGE
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
156 lines (133 loc) · 5.6 KB
/
setup.py
File metadata and controls
156 lines (133 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/env python
# To use:
# python setup.py install
#
import sys,os,os.path,string,site
from Forthon.compilers import FCompiler
import getopt
try:
os.environ['PATH'] += os.pathsep + site.USER_BASE + '/bin'
import distutils
from distutils.core import setup, Extension
from distutils.dist import Distribution
from distutils.command.build import build
from subprocess import call
import numpy
except:
raise SystemExit, "Distutils problem"
optlist,args = getopt.getopt(sys.argv[1:],'gt:F:',['parallel','petsc'])
machine = sys.platform
debug = 0
fcomp = None
parallel = 0
petsc = 0
for o in optlist:
if o[0] == '-g': debug = 1
elif o[0] == '-t': machine = o[1]
elif o[0] == '-F': fcomp = o[1]
elif o[0] == '--parallel': parallel = 1
elif o[0] == '--petsc': petsc = 1
if petsc == 1 and os.getenv('PETSC_DIR') == None:
raise SystemExit, "PETSc requested but PETSC_DIR not set"
if os.getenv('PETSC_DIR') != None:
petsc = 1
if petsc == 1 and os.getenv('PETSC_ARCH') == None:
raise SystemExit, "PETSc requested but PETSC_ARCH not set"
sys.argv = ['setup2.py']+args
fcompiler = FCompiler(machine=machine,
debug=debug,
fcompname=fcomp)
print fcompiler
class uedgeBuild(build):
def run(self):
print 'buildit'
if petsc == 0:
call(['make','-f','Makefile.Forthon'])
else:
call(['make','-f','Makefile.PETSc'])
build.run(self)
#dummydist = Distribution()
#dummybuild = build(dummydist)
#dummybuild.finalize_options()
#builddir = dummybuild.build_temp
builddir = 'build'
uedgepkgs = ['aph','api','bbb','com','flx','grd','svr','wdf']
def makeobjects(pkg):
return [pkg+'_p.o',pkg+'pymodule.o']
uedgeobjects = []
for pkg in uedgepkgs:
uedgeobjects = uedgeobjects + makeobjects(pkg)
# add here any extra dot o files other than pkg.o, pkg_p.o
uedgeobjects = uedgeobjects + ['aphrates.o','aphread.o',
'apifcn.o','apip93.o','apisorc.o',
'fimp.o','fmombal.o','inelrates.o',
'sputt.o','boundary.o','convert.o',
'geometry.o','griddubl.o','oderhs.o',
'odesetup.o','odesolve.o','potencur.o',
'ext_neutrals.o',
'turbulence.o','blasext.o','brent.o',
'comutil.o','misc.o','mnbrak.o',
'flxcomp.o','flxdriv.o','flxread.o',
'flxwrit.o','grdcomp.o','grddriv.o',
'grdinit.o','grdread.o','grdwrit.o',
'daspk.o','nksol.o','svrut1.o','svrut2.o',
'svrut3.o','svrut4.o','vodpk.o','uoa.o',
'dsum.o','dummy_py.o','error.o','getmsg.o',
'dmath.o','ssum.o','daux1.o','wdf.o']
if petsc:
uedgeobjects = uedgeobjects +['petsc-uedge.o','petscMod.o']
if parallel:
# add extra dot o's needed if we're parallel
uedgeobjects = uedgeobjects + []
uedgeobjects = map(lambda p:os.path.join(builddir,p),uedgeobjects)
if os.getenv('PACT_DIR') != None:
library_dirs = fcompiler.libdirs + [
os.path.join(os.getenv('PACT_DIR'),'lib')]
libraries = ['pdb','pml','score','blas','m'] + fcompiler.libs
else:
library_dirs = fcompiler.libdirs
libraries = fcompiler.libs
if petsc:
#PETSC_DIR = '/homes/mccomic/petsc-uedge'
#PETSC_ARCH = 'linux-uedge'
PETSC_DIR=os.getenv('PETSC_DIR')
PETSC_ARCH=os.getenv('PETSC_ARCH')
library_dirs = fcompiler.libdirs + [os.path.join(PETSC_DIR,PETSC_ARCH,'lib')]
libraries = ['petscts','petscsnes','petscksp','petscdm','petscmat',
'petscvec','petsc','HYPRE','mpich','lapack','blas','X11',
'pthread','rt','stdc++','m'] + fcompiler.libs
libraries = ['petsc'] + fcompiler.libs
if parallel:
library_dirs = fcompiler.libdirs + ['/usr/lpp/ppe.poe/lib']
libraries = fcompiler.libs + ['mpi']
#uedgeobjects = uedgeobjects + ['/usr/local/mpi/ifc_farg.o']
setup (name = "uedge",
version = '7.0.7.6',
author = 'Tom Rognlien',
author_email = "trognlien@llnl.gov",
maintainer = 'Bill Meyer',
maintainer_email = 'meyer8@llnl.gov',
description = "2D Fluid simulation of plasma and neutrals in magnetic fusion devices",
platforms = "Unix, Windows (cygwin), Mac OSX",
packages= ['uedge'],
package_dir = {'uedge':'pyscripts'},
#include_package_data=True,
scripts = ['pyscripts/pdb2hdf5','pyscripts/bas2py'],
ext_modules = [Extension('uedgeC',
['uedgeC_Forthon.c',
os.path.join(builddir,'Forthon.c'),
'com/handlers.c','com/vector.c'],
include_dirs=[builddir,numpy.get_include()],
library_dirs=library_dirs,
libraries=libraries,
define_macros=[("WITH_NUMERIC","0"),
("FORTHON_PKGNAME", '\"uedgeC\"')],
extra_objects=uedgeobjects,
extra_link_args=['-g']+
fcompiler.extra_link_args,
extra_compile_args=fcompiler.extra_compile_args
)],
cmdclass = { 'build':uedgeBuild },
install_requires=['forthon','mppl']
## note that include_dirs may have to be expanded in the line above
)