Skip to content

Commit

Permalink
remove particle tracker temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
ilhamv committed Aug 18, 2024
1 parent 6a9e56c commit 58de22b
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 91 deletions.
12 changes: 1 addition & 11 deletions mcdc/input_.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,8 +1068,6 @@ def setting(**kw):
Name of the output file MC/DC should save data in (default "output.h5").
save_input_deck : bool
Whether to save the input deck information to the output file (default False).
particle_tracker : bool
Whether to track paths of all individual particles histories, memory issues abound (default False).
k_eff : str
Whether to run a k-eigenvalue problem.
source_file : str
Expand Down Expand Up @@ -1100,7 +1098,6 @@ def setting(**kw):
"progress_bar",
"output_name",
"save_input_deck",
"particle_tracker",
"k_eff",
"source_file",
"IC_file",
Expand All @@ -1119,7 +1116,6 @@ def setting(**kw):
progress_bar = kw.get("progress_bar")
output = kw.get("output_name")
save_input_deck = kw.get("save_input_deck")
particle_tracker = kw.get("particle_tracker")
k_eff = kw.get("k_eff")
source_file = kw.get("source_file")
IC_file = kw.get("IC_file")
Expand Down Expand Up @@ -1170,12 +1166,6 @@ def setting(**kw):
if caching is not None:
card["caching"] = caching

# Particle tracker
if particle_tracker is not None:
card["track_particle"] = particle_tracker
if particle_tracker and mpi4py.MPI.COMM_WORLD.Get_size() > 1:
print_error("Particle tracker currently only runs on a single MPI rank")

# Save input deck?
if save_input_deck is not None:
card["save_input_deck"] = save_input_deck
Expand Down Expand Up @@ -1223,7 +1213,7 @@ def eigenmode(
gyration_radius : float, optional
Specify a gyration radius (default None).
save_particle : bool
Whether particle track outputs in a tally mesh (default False).
Whether final particle bank outputs (default False).
Returns
-------
Expand Down
8 changes: 0 additions & 8 deletions mcdc/iqmc/iqmc_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,9 @@ def iqmc_simulation(mcdc):
def iqmc_loop_particle(P, prog):
mcdc = adapt.device(prog)

# Particle tracker
if mcdc["setting"]["track_particle"]:
kernel.track_particle(P, mcdc)

while P["alive"]:
iqmc_step_particle(P, prog)

# Particle tracker
if mcdc["setting"]["track_particle"]:
kernel.track_particle(P, mcdc)


@njit(cache=caching)
def iqmc_step_particle(P, prog):
Expand Down
36 changes: 0 additions & 36 deletions mcdc/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,6 @@ def copy_recordlike(P_new, P):
P_new["w"] = P["w"]
P_new["rng_seed"] = P["rng_seed"]
P_new["iqmc"]["w"] = P["iqmc"]["w"]
copy_track_data(P_new, P)


@njit
Expand Down Expand Up @@ -1684,7 +1683,6 @@ def copy_particle(P_new, P):
P_new["event"] = P["event"]
P_new["rng_seed"] = P["rng_seed"]
P_new["iqmc"]["w"] = P["iqmc"]["w"]
copy_track_data(P_new, P)


@njit
Expand Down Expand Up @@ -3490,40 +3488,6 @@ def weight_roulette(P, mcdc):
P["alive"] = False


# ==============================================================================
# Particle tracker
# ==============================================================================


@toggle("particle_tracker")
def track_particle(P, mcdc):
idx = adapt.global_add(mcdc["particle_track_N"], 0, 1)
mcdc["particle_track"][idx, 0] = P["track_hid"]
mcdc["particle_track"][idx, 1] = P["track_pid"]
mcdc["particle_track"][idx, 2] = P["g"] + 1
mcdc["particle_track"][idx, 3] = P["t"]
mcdc["particle_track"][idx, 4] = P["x"]
mcdc["particle_track"][idx, 5] = P["y"]
mcdc["particle_track"][idx, 6] = P["z"]
mcdc["particle_track"][idx, 7] = P["w"]


@toggle("particle_tracker")
def copy_track_data(P_new, P):
P_new["track_hid"] = P["track_hid"]
P_new["track_pid"] = P["track_pid"]


@toggle("particle_tracker")
def allocate_hid(P, mcdc):
P["track_hid"] = adapt.global_add(mcdc["particle_track_history_ID"], 0, 1)


@toggle("particle_tracker")
def allocate_pid(P, mcdc):
P["track_pid"] = adapt.global_add(mcdc["particle_track_particle_ID"], 0, 1)


# =============================================================================
# Continuous Energy Physics
# =============================================================================
Expand Down
20 changes: 0 additions & 20 deletions mcdc/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ def generate_source_particle(work_start, idx_work, seed, prog):
else:
P = mcdc["bank_source"]["particles"][idx_work]

# Particle tracker
if mcdc["setting"]["track_particle"]:
kernel.allocate_hid(P, mcdc)

# Check if it is beyond current census index
idx_census = mcdc["idx_census"]
if P["t"] > mcdc["setting"]["census_time"][idx_census]:
Expand Down Expand Up @@ -228,10 +224,6 @@ def prep_particle(P, prog):
if mcdc["technique"]["weight_window"]:
kernel.weight_window(P, prog)

# Particle tracker
if mcdc["setting"]["track_particle"]:
kernel.allocate_pid(P, mcdc)


@njit(cache=caching)
def exhaust_active_bank(prog):
Expand Down Expand Up @@ -293,10 +285,6 @@ def source_dd_resolution(prog):
if mcdc["technique"]["weight_window"]:
kernel.weight_window(P, mcdc)

# Particle tracker
if mcdc["setting"]["track_particle"]:
mcdc["particle_track_particle_ID"] += 1

# Particle loop
loop_particle(P, mcdc)

Expand Down Expand Up @@ -447,17 +435,9 @@ def gpu_loop_source(seed, mcdc):
def loop_particle(P, prog):
mcdc = adapt.device(prog)

# Particle tracker
if mcdc["setting"]["track_particle"]:
kernel.track_particle(P, mcdc)

while P["alive"]:
step_particle(P, prog)

# Particle tracker
if mcdc["setting"]["track_particle"]:
kernel.track_particle(P, mcdc)


@njit(cache=caching)
def step_particle(P, prog):
Expand Down
7 changes: 0 additions & 7 deletions mcdc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ def prepare():

adapt.set_toggle("iQMC", input_deck.technique["iQMC"])
adapt.set_toggle("domain_decomp", input_deck.technique["domain_decomposition"])
adapt.set_toggle("particle_tracker", mcdc["setting"]["track_particle"])
adapt.eval_toggle()
adapt.target_for(target)
if target == "gpu":
Expand Down Expand Up @@ -1126,12 +1125,6 @@ def generate_hdf5(mcdc):
"iqmc/outter_final_residual", data=T["iqmc"]["res_outter"]
)

# Particle tracker
if mcdc["setting"]["track_particle"]:
with h5py.File(mcdc["setting"]["output"] + "_ptrack.h5", "w") as f:
N_track = mcdc["particle_track_N"][0]
f.create_dataset("tracks", data=mcdc["particle_track"][:N_track])

# IC generator
if mcdc["technique"]["IC_generator"]:
Nn = mcdc["technique"]["IC_bank_neutron"]["size"]
Expand Down
9 changes: 0 additions & 9 deletions mcdc/type_.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,11 +1219,6 @@ def make_type_global(input_deck):
bank_source = particle_bank(0)
bank_precursor = precursor_bank(0)

# Particle tracker
N_track = 0
if input_deck.setting["track_particle"]:
N_track = N_work * 1000

# iQMC bank adjustment
if input_deck.technique["iQMC"]:
bank_source = particle_bank(N_work)
Expand Down Expand Up @@ -1301,10 +1296,6 @@ def make_type_global(input_deck):
("runtime_simulation", float64),
("runtime_output", float64),
("runtime_bank_management", float64),
("particle_track", float64, (N_track, 8)),
("particle_track_N", int64, (1,)),
("particle_track_history_ID", int64, (1,)),
("particle_track_particle_ID", int64, (1,)),
("precursor_strength", float64),
("mpi_work_iter", int64, (1,)),
("gpu_state", uintp),
Expand Down

0 comments on commit 58de22b

Please sign in to comment.