-
Notifications
You must be signed in to change notification settings - Fork 55
/
espsite.py.example.suncatstdin
54 lines (45 loc) · 2.33 KB
/
espsite.py.example.suncatstdin
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
# cluster-dependent definitions
# espresso.py will make use of all "self" variables in config class
import os
class config:
def __init__(self):
self.scratch = '/scratch'
if not os.path.exists(self.scratch):
self.scratch = '/tmp'
self.submitdir = os.getenv('LS_SUBCWD')
self.batch = self.submitdir!=None
#check for batch
if self.batch:
procs = os.getenv('LSB_HOSTS').split()
self.procs = procs
self.jobid = os.getenv('LSB_BATCH_JID')
nprocs = len(procs)
self.nprocs = nprocs
d = {}
for x in procs:
d[x] = 1
nodes = list(d.keys())
nnodes = len(nodes)
fin,fout = os.popen4('mpirun --version')
mpiversion=fout.readlines()[0]
mpiversion=mpiversion.split()[3]
rsh_agent='orte_rsh_agent'
if mpiversion[:3]=='1.4':
rsh_agent='plm_rsh_agent'
self.perHostMpiExec = 'mpiexec --mca '+rsh_agent+' /afs/slac.stanford.edu/package/lsf/bin.slac/gmmpirun_lsgrun.sh -host '+','.join(nodes)+' -np '+str(nnodes)
self.perProcMpiExec = 'pam -g /afs/slac/g/suncat/bin/suncat-tsmpirun -x LD_LIBRARY_PATH -wdir %s %s'
self.perSpecProcMpiExec = 'mpiexec --mca '+rsh_agent+' /afs/slac.stanford.edu/package/lsf/bin.slac/gmmpirun_lsgrun.sh -machinefile %s -np %d -wdir %s %s'
# hack for suncat to make sure RHEL5 nfs disks are automounted
# must be done before changing directories, otherwise mpirun
# appears to do "getpwd" and sends the "/a" form of the name
# to the slave nodes - cpo
siteInit=self.perHostMpiExec + ' ls '+self.submitdir+'>/dev/null'
os.system(siteInit)
def do_perProcMpiExec(self, workdir, program):
return os.popen2(self.perProcMpiExec % (workdir, program))
def do_perProcMpiExec_outputonly(self, workdir, program):
return os.popen(self.perProcMpiExec % (workdir, program), 'r')
def runonly_perProcMpiExec(self, workdir, program):
os.system(self.perProcMpiExec % (workdir, program))
def do_perSpecProcMpiExec(self, machinefile, nproc, workdir, program):
return os.popen3(self.perSpecProcMpiExec % (machinefile, nproc, workdir, program))