Replace -mpi in cli with -taskfarm

这个提交包含在:
nmannall
2024-02-01 17:29:40 +00:00
父节点 3b942de2be
当前提交 9e26c107ac
共有 3 个文件被更改,包括 12 次插入12 次删除

查看文件

@@ -51,7 +51,7 @@ model_num = 0
def get_model_config(): def get_model_config():
"""Return ModelConfig instace for specific model.""" """Return ModelConfig instace for specific model."""
if sim_config.args.mpi: if sim_config.args.taskfarm:
return model_configs return model_configs
else: else:
return model_configs[model_num] return model_configs[model_num]
@@ -205,8 +205,8 @@ class SimulationConfig:
self.args = args self.args = args
if self.args.mpi and self.args.geometry_fixed: if self.args.taskfarm and self.args.geometry_fixed:
logger.exception("The geometry fixed option cannot be used with MPI.") logger.exception("The geometry fixed option cannot be used with MPI taskfarm.")
raise ValueError raise ValueError
if self.args.gpu and self.args.opencl: if self.args.gpu and self.args.opencl:

查看文件

@@ -30,7 +30,7 @@ args_defaults = {
"outputfile": None, "outputfile": None,
"n": 1, "n": 1,
"i": None, "i": None,
"mpi": False, "taskfarm": False,
"gpu": None, "gpu": None,
"opencl": None, "opencl": None,
"subgrid": False, "subgrid": False,
@@ -54,7 +54,7 @@ help_msg = {
"typically be used to restart a series of models from a specific " "typically be used to restart a series of models from a specific "
"model number, with the n argument, e.g. to restart from A-scan 45 " "model number, with the n argument, e.g. to restart from A-scan 45 "
"when creating a B-scan with 60 traces.", "when creating a B-scan with 60 traces.",
"mpi": "(bool, opt): Flag to use Message Passing Interface (MPI) task farm. " "taskfarm": "(bool, opt): Flag to use Message Passing Interface (MPI) task farm. "
"This option is most usefully combined with n to allow individual " "This option is most usefully combined with n to allow individual "
"models to be farmed out using a MPI task farm, e.g. to create a " "models to be farmed out using a MPI task farm, e.g. to create a "
"B-scan with 60 traces and use MPI to farm out each trace. For " "B-scan with 60 traces and use MPI to farm out each trace. For "
@@ -83,7 +83,7 @@ def run(
outputfile=args_defaults["outputfile"], outputfile=args_defaults["outputfile"],
n=args_defaults["n"], n=args_defaults["n"],
i=args_defaults["i"], i=args_defaults["i"],
mpi=args_defaults["mpi"], taskfarm=args_defaults["taskfarm"],
gpu=args_defaults["gpu"], gpu=args_defaults["gpu"],
opencl=args_defaults["opencl"], opencl=args_defaults["opencl"],
subgrid=args_defaults["subgrid"], subgrid=args_defaults["subgrid"],
@@ -109,7 +109,7 @@ def run(
It would typically be used to restart a series of models from a It would typically be used to restart a series of models from a
specific model number, with the n argument, e.g. to restart from specific model number, with the n argument, e.g. to restart from
A-scan 45 when creating a B-scan with 60 traces. A-scan 45 when creating a B-scan with 60 traces.
mpi: optional boolean flag to use Message Passing Interface (MPI) task taskfarm: optional boolean flag to use Message Passing Interface (MPI) task
farm. This option is most usefully combined with n to allow farm. This option is most usefully combined with n to allow
individual models to be farmed out using a MPI task farm, individual models to be farmed out using a MPI task farm,
e.g. to create a B-scan with 60 traces and use MPI to farm out e.g. to create a B-scan with 60 traces and use MPI to farm out
@@ -143,7 +143,7 @@ def run(
"outputfile": outputfile, "outputfile": outputfile,
"n": n, "n": n,
"i": i, "i": i,
"mpi": mpi, "taskfarm": taskfarm,
"gpu": gpu, "gpu": gpu,
"opencl": opencl, "opencl": opencl,
"subgrid": subgrid, "subgrid": subgrid,
@@ -168,7 +168,7 @@ def cli():
parser.add_argument("-outputfile", "-o", help=help_msg["outputfile"]) parser.add_argument("-outputfile", "-o", help=help_msg["outputfile"])
parser.add_argument("-n", default=args_defaults["n"], type=int, help=help_msg["n"]) parser.add_argument("-n", default=args_defaults["n"], type=int, help=help_msg["n"])
parser.add_argument("-i", type=int, help=help_msg["i"]) parser.add_argument("-i", type=int, help=help_msg["i"])
parser.add_argument("-mpi", action="store_true", default=args_defaults["mpi"], help=help_msg["mpi"]) parser.add_argument("-taskfarm", action="store_true", default=args_defaults["taskfarm"], help=help_msg["taskfarm"])
parser.add_argument("-gpu", type=int, action="append", nargs="*", help=help_msg["gpu"]) parser.add_argument("-gpu", type=int, action="append", nargs="*", help=help_msg["gpu"])
parser.add_argument("-opencl", type=int, action="append", nargs="*", help=help_msg["opencl"]) parser.add_argument("-opencl", type=int, action="append", nargs="*", help=help_msg["opencl"])
parser.add_argument( parser.add_argument(
@@ -210,8 +210,8 @@ def run_main(args):
logging_config(level=args.log_level, log_file=args.log_file) logging_config(level=args.log_level, log_file=args.log_file)
config.sim_config = config.SimulationConfig(args) config.sim_config = config.SimulationConfig(args)
# MPI running with (OpenMP/CUDA/OpenCL) # MPI taskfarm running with (OpenMP/CUDA/OpenCL)
if config.sim_config.args.mpi: if config.sim_config.args.taskfarm:
context = TaskfarmContext() context = TaskfarmContext()
# Standard running (OpenMP/CUDA/OpenCL) # Standard running (OpenMP/CUDA/OpenCL)
else: else:

查看文件

@@ -28,7 +28,7 @@ class TaskfarmTest(GprMaxRegressionTest):
def set_filenames(self): def set_filenames(self):
self.input_file = f"{self.model}.in" self.input_file = f"{self.model}.in"
self.output_file = f"{self.model}_merged.h5" self.output_file = f"{self.model}_merged.h5"
self.executable_opts = [self.input_file, "-n", "64", "-mpi"] self.executable_opts = [self.input_file, "-n", "64", "-taskfarm"]
self.postrun_cmds = [ self.postrun_cmds = [
f"python -m toolboxes.Utilities.outputfiles_merge {self.model}", f"python -m toolboxes.Utilities.outputfiles_merge {self.model}",
f"python -m toolboxes.Plotting.plot_Bscan -save {self.output_file} Ez", f"python -m toolboxes.Plotting.plot_Bscan -save {self.output_file} Ez",