mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
fix my incorrect MPI code
This commit is contained in:
parent
abfe5ebf99
commit
8344431ea0
1 changed files with 7 additions and 9 deletions
|
|
@ -20,21 +20,19 @@ extern "C" bool openmc_master()
|
|||
vector<int64_t> calculate_parallel_index_vector(int64_t size)
|
||||
{
|
||||
vector<int64_t> result;
|
||||
result.reserve(n_procs + 1);
|
||||
result.resize(n_procs + 1);
|
||||
result[0] = 0;
|
||||
|
||||
#ifdef OPENMC_MPI
|
||||
result.resize(n_procs);
|
||||
result[0] = 0;
|
||||
vector<int64_t> bank_size(n_procs + 1);
|
||||
|
||||
// Populate the result with cumulative sum of the number of
|
||||
// surface source banks per process
|
||||
MPI_Scan(&size, bank_size.data(), 1, MPI_INT64_T, MPI_SUM, intracomm);
|
||||
MPI_Allgather(bank_size.data() + 1, 1, MPI_INT64_T, result.data(), 1,
|
||||
MPI_INT64_T, intracomm);
|
||||
int64_t scan_total;
|
||||
MPI_Scan(&size, &scan_total, 1, MPI_INT64_T, MPI_SUM, intracomm);
|
||||
MPI_Allgather(
|
||||
&scan_total, 1, MPI_INT64_T, result.data() + 1, 1, MPI_INT64_T, intracomm);
|
||||
#else
|
||||
result.push_back(0);
|
||||
result.push_back(size);
|
||||
result[1] = size;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue