-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuildhpc.py
More file actions
80 lines (65 loc) · 2.4 KB
/
buildhpc.py
File metadata and controls
80 lines (65 loc) · 2.4 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
import sys
import getpass
import os
'''
Usage: python buildhpc.py option1=arg1 option2=arg2
Options:
email=<you@mail>
account=<allocation>
Both of these are optional if your job submission system doesn't require them.
'''
if __name__=="__main__":
USER = getpass.getuser()
EMAIL = ""
ACCOUNT = ""
SCRATCH = "/mnt/node_scratch/"+USER
GCCMOD = "gcc/4.9.1"
PYTHONMOD = "python/2.7.9"
INTELMOD = "intel/intel-17"
MPIMOD = "openmpi/2.0.1-intel-17"
for k in sys.argv[:]:
if k.split('=')[0]=="email":
EMAIL=k.split('=')[1]
if k.split('=')[0]=="account":
ACCOUNT=k.split('=')[1]
if k.split('=')[0]=="gcc":
GCCMOD = "gcc/"+k.split('=')[1]
if k.split('=')[0]=="python":
PYTHONMOD = "python/"+k.split('=')[1]
if k.split('=')[0]=="intel":
INTELMOD = "intel/"+k.split('=')[1]
if k.split('=')[0]=="openmpi":
MPIMOD = "openmpi/"+k.split('=')[1]
if k=="automod":
modules = os.environ['LOADEDMODULES'].split(os.pathsep)
for m in modules:
if m.split('/')[0]=="gcc":
GCCMOD = m
elif m.split('/')[0]=='python':
PYTHONMOD = m
elif m.split('/')[0]=="intel":
INTELMOD = m
elif m.split('/')[0]=="openmpi":
MPIMOD = m
if k.split('=')[0]=="scratch":
SCRATCH = k.split('=')[1]+"/"+USER
identitypy = (" \n"+
'USER = "'+USER+'" \n'+
" \n"+
'EMAIL = "'+EMAIL+'" \n'+
" \n"+
'ACCOUNT = "'+ACCOUNT+'" \n'+
" \n"+
'SCRATCH = "'+SCRATCH+'" \n'+
" \n"+
'GCCMOD = "'+GCCMOD+'" \n'+
" \n"+
'PYTHONMOD = "'+PYTHONMOD+'" \n'+
" \n"+
'INTELMOD = "'+INTELMOD+'" \n'+
" \n"+
'MPIMOD = "'+MPIMOD+'" \n'+
" \n")
with open("identity.py","w") as pyfile:
pyfile.write(identitypy)
os.system("cd sbdart_earth/clean/ && make && cd ../../sbdart_locked/clean/ && make && cd ../../")