This lesson is about...
# Are you using a special reservation for a workshop?
# If so, set it here:
nersc_reservation = "toast3"
# Load common tools for all lessons
import sys
sys.path.insert(0, "..")
from lesson_tools import (
check_nersc,
fake_focalplane
)
nersc_host, nersc_repo, nersc_resv = check_nersc(reservation=nersc_reservation)
# Capture C++ output in the jupyter cells
%reload_ext wurlitzer
The NERSC login nodes do not support MPI, so all of the previous examples are running serially. To run in parallel, we can submit a batch job version of the above examples:
%%writefile realdata.py
import toast
from toast.mpi import MPI
import subprocess as sp
command = "python realdata.py"
runstr = None
if nersc_host is not None:
runstr = "srun -N 1 -C haswell -n 32 -c 2 --cpu_bind=cores -t 00:03:00"
if nersc_resv is not None:
runstr = "{} --reservation {}".format(runstr, nersc_resv)
else:
# Just use mpirun
runstr = "mpirun -np 4"
runcom = "{} {}".format(runstr, command)
print(runcom, flush=True)
sp.check_call(runcom, stderr=sp.STDOUT, shell=True)