Skip to content

Commit

Permalink
Added the ability to pass additional command line args to redrock.
Browse files Browse the repository at this point in the history
Anything that is not a specific argument to wrap_rrdesi will be passed
through so that templates, archetypes, etc can be handled.

Also fixed typo in name wrap_rresi -> wrap_rrdesi (!)
  • Loading branch information
craigwarner-ufastro committed Mar 18, 2024
1 parent 68ea51d commit 652838e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion bin/wrap_rresi → bin/wrap_rrdesi
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,29 @@ parser.add_argument("--cpu-per-task", type=int, default=32,
required=False, help="Maximum number of CPUs to use on each input file")
parser.add_argument("--gpuonly", action="store_true",
required=False, help="Use ONLY GPUs")
args = parser.parse_args()
#Gather args and any unrecognized args are to be passed to redrock
args, args_to_pass = parser.parse_known_args()
inputdir = None
outdir = args.output
if args.input_dir is not None:
inputdir = args.input_dir
cpu_per_task = args.cpu_per_task
overwrite = args.overwrite

##Find args to pass to redrock
#args_to_pass = sys.argv[1:]
#args_with_val = ['-i', '-o', '--input-dir', '--input', '--output', '--cpu-per-task']
#args_without_val = ['--gpu', '--overwrite', '--gpuonly']
#for a in args_with_val:
# if args_to_pass.count(a) > 0:
# x = args_to_pass.index(a)
# args_to_pass.pop(x)
# if x < len(a):
# args_to_pass.pop(x)
#for a in args_without_val:
# if args_to_pass.count(a) > 0:
# args_to_pass.remove(a)

#- global communicator across all nodes
comm = MPI.COMM_WORLD
comm_rank = comm.rank
Expand Down Expand Up @@ -129,6 +144,8 @@ if myhost < ncomm:
print ("Error: "+str(outfile)+" exists. Skipping.")
continue
opts = ['-i', infile, '-o', outfile]
if args_to_pass is not None:
opts.extend(args_to_pass)
if use_gpu:
opts.append('--gpu')
desi.rrdesi(opts, comm=subcomm)

0 comments on commit 652838e

Please sign in to comment.