Considerations for Real Data

This lesson is about...

In [1]:
# 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
Running on NERSC machine 'cori'
  with access to repos: mp107, desi, m1759, cosmo
Using default repo mp107
Reservation 'toast3' valid from 2019-10-16T09:00:00 to 2019-10-16T17:00:00
Current time is 2019-10-16T05:43:04.725451
Reservation 'toast3' not currently valid

Running in Parallel

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:

In [2]:
%%writefile realdata.py

import toast
from toast.mpi import MPI
Writing realdata.py
In [3]:
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)
srun -N 1 -C haswell -n 32 -c 2 --cpu_bind=cores -t 00:03:00 python realdata.py
Launched in background. Redirecting stdin to /dev/null
srun: job 25182304 queued and waiting for resources
srun: job 25182304 has been allocated resources
slurmstepd: error: _is_a_lwp: open() /proc/38677/status failed: No such file or directory
Out[3]:
0