你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Rename ModelBuildRun to Model
这个提交包含在:
@@ -34,7 +34,7 @@ import gprMax.config as config
|
||||
from gprMax.config import ModelConfig
|
||||
|
||||
from ._version import __version__, codename
|
||||
from .model_build_run import ModelBuildRun
|
||||
from .model import Model
|
||||
from .solvers import create_G, create_solver
|
||||
from .utilities.host_info import print_cuda_info, print_host_info, print_opencl_info
|
||||
from .utilities.utilities import get_terminal_width, logo, timer
|
||||
@@ -139,9 +139,9 @@ class Context:
|
||||
|
||||
return scene
|
||||
|
||||
def _create_model(self) -> ModelBuildRun:
|
||||
def _create_model(self) -> Model:
|
||||
grid = create_G()
|
||||
return ModelBuildRun(grid)
|
||||
return Model(grid)
|
||||
|
||||
def print_logo_copyright(self) -> None:
|
||||
"""Prints gprMax logo, version, and copyright/licencing information."""
|
||||
|
@@ -37,10 +37,8 @@ from .cython.yee_cell_build import build_electric_components, build_magnetic_com
|
||||
from .fields_outputs import write_hdf5_outputfile
|
||||
from .geometry_outputs import save_geometry_views
|
||||
from .grid.fdtd_grid import dispersion_analysis
|
||||
from .hash_cmds_file import parse_hash_commands
|
||||
from .materials import process_materials
|
||||
from .pml import CFS, build_pml, print_pml_info
|
||||
from .scene import Scene
|
||||
from .snapshots import save_snapshots
|
||||
from .utilities.host_info import mem_check_build_all, mem_check_run_all, set_omp_threads
|
||||
from .utilities.utilities import get_terminal_width
|
||||
@@ -48,7 +46,7 @@ from .utilities.utilities import get_terminal_width
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ModelBuildRun:
|
||||
class Model:
|
||||
"""Builds and runs (solves) a model."""
|
||||
|
||||
def __init__(self, G):
|
@@ -51,7 +51,7 @@ class TaskfarmExecutor(object):
|
||||
`gprMax` models in parallel is given below.
|
||||
>>> from mpi4py import MPI
|
||||
>>> from gprMax.taskfarm import TaskfarmExecutor
|
||||
>>> from gprMax.model_build_run import run_model
|
||||
>>> from gprMax.model import run_model
|
||||
>>> # choose an MPI.Intracomm for communication (MPI.COMM_WORLD by default)
|
||||
>>> comm = MPI.COMM_WORLD
|
||||
>>> # choose a target function
|
||||
@@ -269,7 +269,9 @@ class TaskfarmExecutor(object):
|
||||
for i, worker in enumerate(self.workers):
|
||||
if self.comm.Iprobe(source=worker, tag=Tags.DONE):
|
||||
job_idx, result = self.comm.recv(source=worker, tag=Tags.DONE)
|
||||
logger.debug(f"({self.comm.name}) - Received finished job {job_idx} from worker {worker:d}.")
|
||||
logger.debug(
|
||||
f"({self.comm.name}) - Received finished job {job_idx} from worker {worker:d}."
|
||||
)
|
||||
results[job_idx] = result
|
||||
self.busy[i] = False
|
||||
elif self.comm.Iprobe(source=worker, tag=Tags.READY):
|
||||
@@ -277,7 +279,9 @@ class TaskfarmExecutor(object):
|
||||
self.comm.recv(source=worker, tag=Tags.READY)
|
||||
self.busy[i] = True
|
||||
job_idx = num_jobs - len(my_jobs)
|
||||
logger.debug(f"({self.comm.name}) - Sending job {job_idx} to worker {worker:d}.")
|
||||
logger.debug(
|
||||
f"({self.comm.name}) - Sending job {job_idx} to worker {worker:d}."
|
||||
)
|
||||
self.comm.send((job_idx, my_jobs.pop(0)), dest=worker, tag=Tags.START)
|
||||
elif self.comm.Iprobe(source=worker, tag=Tags.EXIT):
|
||||
logger.debug(f"({self.comm.name}) - Worker on rank {worker:d} has terminated.")
|
||||
|
@@ -7,7 +7,7 @@ from pytest import MonkeyPatch
|
||||
from gprMax import config, gprMax
|
||||
from gprMax.grid.fdtd_grid import FDTDGrid
|
||||
from gprMax.materials import create_built_in_materials
|
||||
from gprMax.model_build_run import GridBuilder
|
||||
from gprMax.model import GridBuilder
|
||||
from gprMax.pml import CFS
|
||||
from gprMax.updates.cpu_updates import CPUUpdates
|
||||
|
||||
@@ -43,7 +43,7 @@ def config_mock(monkeypatch: MonkeyPatch):
|
||||
return config.SimulationConfig(args)
|
||||
|
||||
def _mock_model_config() -> config.ModelConfig:
|
||||
model_config = config.ModelConfig()
|
||||
model_config = config.ModelConfig(1)
|
||||
model_config.ompthreads = 1
|
||||
return model_config
|
||||
|
||||
|
在新工单中引用
屏蔽一个用户