@@ -80,8 +80,62 @@ def run(self,qwinps,qwouts,jobname=None):
80
80
"#PBS -o %s \n " % jobout + \
81
81
self .prefix + "\n " + \
82
82
"cd ${PBS_O_WORKDIR}\n " + \
83
- "cp %s INPUT\n " % (qwinp ) + \
84
- "mpirun -np %i %s %s \n " % (np_tot ,self .exe ,qwinp ) + \
83
+ "mpirun -np %i %s %s > %s \n " % (np_tot ,self .exe ,qwinp ,qwinp + '.out' ) + \
84
+ self .postfix
85
+ qsubfile = qwinp + ".qsub"
86
+ with open (qsubfile ,'w' ) as f :
87
+ f .write (qsub )
88
+ result = sub .check_output ("qsub %s" % (qsubfile ),shell = True )
89
+ self .queueid .append (result .decode ().split ()[0 ].split ('.' )[0 ])
90
+ print ("Submitted as %s" % self .queueid )
91
+
92
+ ####################################################
93
+
94
+ class QWalkRunnerTaub :
95
+ _name_ = 'QWalkRunnerPBS'
96
+ def __init__ (self ,exe = '~/bin/qwalk' ,
97
+ queue = 'batch' ,
98
+ walltime = '12:00:00' ,
99
+ jobname = os .getcwd ().split ('/' )[- 1 ]+ '_qwalk' ,
100
+ prefix = "" ,#for example, load modules
101
+ postfix = "" ,#for any clean-up.
102
+ np = 1 ,nn = 1
103
+ ):
104
+ self .exe = exe
105
+ self .np = np
106
+ self .nn = nn
107
+ self .jobname = jobname
108
+ self .queue = queue
109
+ self .walltime = walltime
110
+ self .prefix = prefix
111
+ self .postfix = postfix
112
+ self .queueid = []
113
+
114
+ #-------------------------------------
115
+ def check_status (self ):
116
+ return submitter .check_PBS_stati (self .queueid )
117
+ #-------------------------------------
118
+
119
+ def run (self ,qwinps ,qwouts ,jobname = None ):
120
+ if jobname is None :
121
+ jobname = self .jobname
122
+ #Just supporting one run for the moment
123
+ qwinp = qwinps [0 ]
124
+ qwout = qwouts [0 ]
125
+ for qwinp ,qwout in zip (qwinps ,qwouts ):
126
+ jobout = qwinp + ".jobout"
127
+ np_tot = self .np * self .nn
128
+
129
+ qsub = "#PBS -q %s \n " % self .queue + \
130
+ "#PBS -l nodes=%i:ppn=%i\n " % (self .nn ,self .np ) + \
131
+ "#PBS -l walltime=%s\n " % self .walltime + \
132
+ "#PBS -j oe \n " + \
133
+ "#PBS -N %s \n " % jobname + \
134
+ "#PBS -o %s \n " % jobout + \
135
+ self .prefix + "\n " + \
136
+ "cd ${PBS_O_WORKDIR}\n " + \
137
+ "module load openmpi/1.4-gcc+ifort" + \
138
+ "mpirun -np %i %s %s > %s \n " % (np_tot ,self .exe ,qwinp ,qwinp + '.out' ) + \
85
139
self .postfix
86
140
qsubfile = qwinp + ".qsub"
87
141
with open (qsubfile ,'w' ) as f :
0 commit comments