Commit 59ff95a7 authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

nersc env

parent c0f3d362
...@@ -253,7 +253,7 @@ echo $PYTHONPATH ...@@ -253,7 +253,7 @@ echo $PYTHONPATH
def launch_nersc (pipe, n, ppn=1, port=50000, authkey='secret', job_name="job_", log_level=logging.WARNING, job_header=""" def launch_nersc (pipe, n, ppn=1, port=50000, authkey='secret', job_name="job_", log_level=logging.WARNING, job_header="""
#PBS -q regular #PBS -q regular
#PBS -l nodes=%d:ppn=%d #PBS -l nodes=%d:ppn=%d
""", carver=False): """, carver=False, python_mpi=False):
""" Launch a bunch of distant workers through a PBS batch system using aprun. """ Launch a bunch of distant workers through a PBS batch system using aprun.
""" """
...@@ -277,7 +277,7 @@ pipeletd -n -l %d -p %d -a $HOST << 'EOF' & ...@@ -277,7 +277,7 @@ pipeletd -n -l %d -p %d -a $HOST << 'EOF' &
%s %s
EOF EOF
sleep 5 sleep 5
aprun -n %d -N %d -S %d python-mpi $PIPELETPATH/launchers.py -p %d -s %s -l %s -H $HOST aprun -n %d -N %d -S %d %s $PIPELETPATH/launchers.py -p %d -s %s -l %s -H $HOST
""" """
server_file_carver=job_header+""" server_file_carver=job_header+"""
export CRAY_ROOTFS=DSL export CRAY_ROOTFS=DSL
...@@ -286,7 +286,7 @@ pipeletd -n -l %d -p %d -a $HOSTNAME << 'EOF' & ...@@ -286,7 +286,7 @@ pipeletd -n -l %d -p %d -a $HOSTNAME << 'EOF' &
%s %s
EOF EOF
sleep 5 sleep 5
mpirun -np %d python $PIPELETPATH/launchers.py -p %d -s %s -l %s -H $HOSTNAME mpirun -np %d %s $PIPELETPATH/launchers.py -p %d -s %s -l %s -H $HOSTNAME
""" """
...@@ -294,6 +294,10 @@ mpirun -np %d python $PIPELETPATH/launchers.py -p %d -s %s -l %s -H $HOSTNAME ...@@ -294,6 +294,10 @@ mpirun -np %d python $PIPELETPATH/launchers.py -p %d -s %s -l %s -H $HOSTNAME
if (n%ppn>0): if (n%ppn>0):
nnode=nnode+1 nnode=nnode+1
pyrun = "python"
if python_mpi:
pyrun = "python-mpi"
import cPickle as pickle import cPickle as pickle
pipedesc = pickle.dumps(pipe) pipedesc = pickle.dumps(pipe)
jobfile = get_log_file (pipe, '.job') jobfile = get_log_file (pipe, '.job')
...@@ -303,10 +307,10 @@ mpirun -np %d python $PIPELETPATH/launchers.py -p %d -s %s -l %s -H $HOSTNAME ...@@ -303,10 +307,10 @@ mpirun -np %d python $PIPELETPATH/launchers.py -p %d -s %s -l %s -H $HOSTNAME
if carver: if carver:
server_file = server_file_carver server_file = server_file_carver
with closing(file(jobfile,'w')) as f: with closing(file(jobfile,'w')) as f:
f.write(server_file%(nnode, ppn, log_level, port, pipedesc, n, port, authkey, logfile)) f.write(server_file%(nnode, ppn, log_level, port, pipedesc, n, pyrun, port, authkey, logfile))
else: else:
with closing(file(jobfile,'w')) as f: with closing(file(jobfile,'w')) as f:
f.write(server_file%(n, log_level, port, pipedesc, nnode, 24/ppn, 24/ppn/2, port, authkey, logfile)) f.write(server_file%(n, log_level, port, pipedesc, nnode, 24/ppn, 24/ppn/2, pyrun, port, authkey, logfile))
subprocess.Popen(['qsub','-o' ,logfile, '-e', errfile,jobfile]).communicate()[0] subprocess.Popen(['qsub','-o' ,logfile, '-e', errfile,jobfile]).communicate()[0]
......
...@@ -75,7 +75,7 @@ class Pipeline: ...@@ -75,7 +75,7 @@ class Pipeline:
def __init__(self, seg_list, code_dir='./', def __init__(self, seg_list, code_dir='./',
prefix='./', sqlfile=None, prefix='./', sqlfile=None,
matplotlib=False, matplotlib_interactive=False, matplotlib=False, matplotlib_interactive=False,
env=Environment, permissive=False): env=Environment, permissive=False, abspath=False):
""" Initialize a pipeline. """ Initialize a pipeline.
seg_list : either a list of string (the list of segment for a seg_list : either a list of string (the list of segment for a
...@@ -110,7 +110,10 @@ class Pipeline: ...@@ -110,7 +110,10 @@ class Pipeline:
## string, indicates where to save the pipeline products. ## string, indicates where to save the pipeline products.
os.umask(002) os.umask(002)
self._prefix = path.realpath(prefix) if abspath:
self._prefix = path.abspath(prefix)
else:
self._prefix = path.realpath(prefix)
if not os.path.exists(prefix): if not os.path.exists(prefix):
os.mkdir(prefix) os.mkdir(prefix)
logdir = os.path.join(prefix, "log") logdir = os.path.join(prefix, "log")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment