mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Change name of work -> work_per_rank
This commit is contained in:
parent
c049557c85
commit
492d984525
6 changed files with 19 additions and 18 deletions
|
|
@ -37,7 +37,7 @@ extern "C" int restart_batch; //!< batch at which a restart job resumed
|
|||
extern "C" bool satisfy_triggers; //!< have tally triggers been satisfied?
|
||||
extern "C" int total_gen; //!< total number of generations simulated
|
||||
extern double total_weight; //!< Total source weight in a batch
|
||||
extern "C" int64_t work; //!< number of particles per process
|
||||
extern int64_t work_per_rank; //!< number of particles per MPI rank
|
||||
|
||||
extern std::vector<double> k_generation;
|
||||
extern std::vector<int64_t> work_index;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ void synchronize_bank()
|
|||
|
||||
// Allocate temporary source bank
|
||||
int64_t index_temp = 0;
|
||||
std::vector<Particle::Bank> temp_sites(3*simulation::work);
|
||||
std::vector<Particle::Bank> temp_sites(3*simulation::work_per_rank);
|
||||
|
||||
for (const auto& site : simulation::fission_bank) {
|
||||
// If there are less than n_particles particles banked, automatically add
|
||||
|
|
@ -597,7 +597,7 @@ void ufs_count_sites()
|
|||
|
||||
// Since the total starting weight is not equal to n_particles, we need to
|
||||
// renormalize the weight of the source sites
|
||||
for (int i = 0; i < simulation::work; ++i) {
|
||||
for (int i = 0; i < simulation::work_per_rank; ++i) {
|
||||
simulation::source_bank[i].wgt *= settings::n_particles / total;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -594,7 +594,8 @@ Particle::mark_as_lost(const char* message)
|
|||
simulation::n_lost_particles += 1;
|
||||
|
||||
// Count the total number of simulated particles (on this processor)
|
||||
auto n = simulation::current_batch * settings::gen_per_batch * simulation::work;
|
||||
auto n = simulation::current_batch * settings::gen_per_batch *
|
||||
simulation::work_per_rank;
|
||||
|
||||
// Abort the simulation if the maximum number of lost particles has been
|
||||
// reached
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ int openmc_next_batch(int* status)
|
|||
// LOOP OVER PARTICLES
|
||||
|
||||
#pragma omp parallel for schedule(runtime)
|
||||
for (int64_t i_work = 1; i_work <= simulation::work; ++i_work) {
|
||||
for (int64_t i_work = 1; i_work <= simulation::work_per_rank; ++i_work) {
|
||||
simulation::current_work = i_work;
|
||||
|
||||
// grab source particle from bank
|
||||
|
|
@ -245,7 +245,7 @@ int restart_batch;
|
|||
bool satisfy_triggers {false};
|
||||
int total_gen {0};
|
||||
double total_weight;
|
||||
int64_t work;
|
||||
int64_t work_per_rank;
|
||||
|
||||
std::vector<double> k_generation;
|
||||
std::vector<int64_t> work_index;
|
||||
|
|
@ -262,7 +262,7 @@ bool trace; //!< flag to show debug information
|
|||
void allocate_banks()
|
||||
{
|
||||
// Allocate source bank
|
||||
simulation::source_bank.resize(simulation::work);
|
||||
simulation::source_bank.resize(simulation::work_per_rank);
|
||||
|
||||
if (settings::run_mode == RUN_MODE_EIGENVALUE) {
|
||||
#ifdef _OPENMP
|
||||
|
|
@ -274,15 +274,15 @@ void allocate_banks()
|
|||
#pragma omp parallel
|
||||
{
|
||||
if (omp_get_thread_num() == 0) {
|
||||
simulation::fission_bank.reserve(3*simulation::work);
|
||||
simulation::fission_bank.reserve(3*simulation::work_per_rank);
|
||||
} else {
|
||||
int n_threads = omp_get_num_threads();
|
||||
simulation::fission_bank.reserve(3*simulation::work / n_threads);
|
||||
simulation::fission_bank.reserve(3*simulation::work_per_rank / n_threads);
|
||||
}
|
||||
}
|
||||
simulation::master_fission_bank.reserve(3*simulation::work);
|
||||
simulation::master_fission_bank.reserve(3*simulation::work_per_rank);
|
||||
#else
|
||||
simulation::fission_bank.reserve(3*simulation::work);
|
||||
simulation::fission_bank.reserve(3*simulation::work_per_rank);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -507,7 +507,7 @@ void calculate_work()
|
|||
int64_t work_i = i < remainder ? min_work + 1 : min_work;
|
||||
|
||||
// Set number of particles
|
||||
if (mpi::rank == i) simulation::work = work_i;
|
||||
if (mpi::rank == i) simulation::work_per_rank = work_i;
|
||||
|
||||
// Set index into source bank for rank i
|
||||
i_bank += work_i;
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ void initialize_source()
|
|||
|
||||
} else {
|
||||
// Generation source sites from specified distribution in user input
|
||||
for (int64_t i = 0; i < simulation::work; ++i) {
|
||||
for (int64_t i = 0; i < simulation::work_per_rank; ++i) {
|
||||
// initialize random number seed
|
||||
int64_t id = simulation::total_gen*settings::n_particles +
|
||||
simulation::work_index[mpi::rank] + i + 1;
|
||||
|
|
@ -330,7 +330,7 @@ void free_memory_source()
|
|||
void fill_source_bank_fixedsource()
|
||||
{
|
||||
if (settings::path_source.empty()) {
|
||||
for (int64_t i = 0; i < simulation::work; ++i) {
|
||||
for (int64_t i = 0; i < simulation::work_per_rank; ++i) {
|
||||
// initialize random number seed
|
||||
int64_t id = (simulation::total_gen + overall_generation()) *
|
||||
settings::n_particles + simulation::work_index[mpi::rank] + i + 1;
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ write_source_bank(hid_t group_id)
|
|||
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
// Create another data space but for each proc individually
|
||||
hsize_t count[] {static_cast<hsize_t>(simulation::work)};
|
||||
hsize_t count[] {static_cast<hsize_t>(simulation::work_per_rank)};
|
||||
hid_t memspace = H5Screate_simple(1, count, nullptr);
|
||||
|
||||
// Select hyperslab for this dataspace
|
||||
|
|
@ -569,7 +569,7 @@ write_source_bank(hid_t group_id)
|
|||
// Save source bank sites since the souce_bank array is overwritten below
|
||||
#ifdef OPENMC_MPI
|
||||
std::vector<Particle::Bank> temp_source {simulation::source_bank.begin(),
|
||||
simulation::source_bank.begin() + simulation::work};
|
||||
simulation::source_bank.begin() + simulation::work_per_rank};
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < mpi::n_procs; ++i) {
|
||||
|
|
@ -607,7 +607,7 @@ write_source_bank(hid_t group_id)
|
|||
#endif
|
||||
} else {
|
||||
#ifdef OPENMC_MPI
|
||||
MPI_Send(simulation::source_bank.data(), simulation::work, mpi::bank,
|
||||
MPI_Send(simulation::source_bank.data(), simulation::work_per_rank, mpi::bank,
|
||||
0, mpi::rank, mpi::intracomm);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -625,7 +625,7 @@ void read_source_bank(hid_t group_id)
|
|||
hid_t dset = H5Dopen(group_id, "source_bank", H5P_DEFAULT);
|
||||
|
||||
// Create another data space but for each proc individually
|
||||
hsize_t dims[] {static_cast<hsize_t>(simulation::work)};
|
||||
hsize_t dims[] {static_cast<hsize_t>(simulation::work_per_rank)};
|
||||
hid_t memspace = H5Screate_simple(1, dims, nullptr);
|
||||
|
||||
// Make sure source bank is big enough
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue