Skip to content

Commit

Permalink
Fix bugs with output files.
Browse files Browse the repository at this point in the history
  • Loading branch information
aeberspaecher committed Feb 27, 2012
1 parent cd36911 commit ca83d3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions pbsjob.py
Expand Up @@ -80,7 +80,7 @@
except:
suffix = ".jobscript"
print("No suffix for jobscript given, using suffix %s instead."%suffix)

# catch the case of workdir being an empty line (may happen with text
# editors that automatically append a new line at the end of each file)
if(workdir == ""):
Expand All @@ -99,9 +99,13 @@
if(not options.stdoutFile):
stdoutFile = args[0]+".stdout"
print("No file for stdout given, will use %s instead."%stdoutFile)
else:
stdoutFile = options.stdoutFile
if(not options.stderrFile):
stderrFile = args[0]+".stderr"
print("No file for stderr given, will use %s instead."%stderrFile)
else:
stderrFile = options.stderrFile

if(not options.name):
jobName = args[0]
Expand Down Expand Up @@ -129,7 +133,7 @@
if(errcode != 0):
print("Something went wrong copying the program to be executed! Aborting!")
sys.exit(1)

# now generate a jobscript:
# We assume OpenMPI in recent versions - in these versions, it is unnecessary
# to specify the hostnames and number of processes
Expand All @@ -141,7 +145,7 @@
#PBS -o %s
#PBS -e %s
### Number of nodes, PPN, shared
#PBS -l nodes=%s:%s%s
#PBS -l nodes=%s:ppn=%s%s
#PBS -l walltime=%s:00:00
. $HOME/.bashrc
Expand All @@ -151,9 +155,10 @@
echo "Host"
hostname
mpirun %s
mpirun -hostfile $PBS_NODEFILE -n (echo $PBS_NODEFILE | wc -l) %s
"""\
%(jobName, stdoutFile, stderrFile, options.nodes, options.ppn, sharedString, options.walltime, args[0])
%(jobName, stdoutFile, stderrFile, options.nodes, options.ppn,
sharedString, options.walltime, args[0])

# write jobscript to a temporary file:
jobFile = tempfile.NamedTemporaryFile(suffix=suffix, dir="")
Expand All @@ -177,4 +182,3 @@
else:
print("Job submitted, using %s CPUs in total."%(options.nodes*options.ppn))


2 changes: 1 addition & 1 deletion test.py 100644 → 100755
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/home/eberspae/local/bin/python
#-*- coding:utf-8 -*-

from mpi4py import MPI
Expand Down

0 comments on commit ca83d3d

Please sign in to comment.