Skip to content

Commit

Permalink
Merge pull request #448 from desihub/extract_mpi
Browse files Browse the repository at this point in the history
enable optional MPI parallelism for desi_extract_spectra script
  • Loading branch information
sbailey committed Oct 25, 2017
2 parents bad2ad6 + cd5db83 commit 1bede4d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion py/desispec/scripts/extract.py
Expand Up @@ -50,6 +50,7 @@ def parse(options=None):
parser.add_argument("--nwavestep", type=int, required=False, default=50,
help="number of wavelength steps per divide-and-conquer extraction step")
parser.add_argument("-v", "--verbose", action="store_true", help="print more stuff")
parser.add_argument("--mpi", action="store_true", help="Use MPI for parallelism")

args = None
if options is None:
Expand All @@ -67,6 +68,11 @@ def _trim(filepath, maxchar=40):

def main(args):

if args.mpi:
from mpi4py import MPI
comm = MPI.COMM_WORLD
return main_mpi(args, comm)

psf_file = args.psf
input_file = args.input
specmin = args.specmin
Expand Down Expand Up @@ -227,7 +233,7 @@ def main_mpi(args, comm=None):
else:
wstart = np.ceil(psf.wmin_all)
wstop = np.floor(psf.wmax_all)
dw = 0.5
dw = 0.7

wave = np.arange(wstart, wstop+dw/2.0, dw)
nwave = len(wave)
Expand Down

0 comments on commit 1bede4d

Please sign in to comment.