2018-08-20 14:40:32 -05:00
|
|
|
#ifndef OPENMC_MESSAGE_PASSING_H
|
|
|
|
|
#define OPENMC_MESSAGE_PASSING_H
|
2018-04-20 07:02:59 -05:00
|
|
|
|
2023-03-31 13:46:42 -04:00
|
|
|
#include <cstdint>
|
|
|
|
|
|
2018-04-20 14:55:06 -05:00
|
|
|
#ifdef OPENMC_MPI
|
2018-10-10 07:50:30 -05:00
|
|
|
#include <mpi.h>
|
2018-04-20 14:55:06 -05:00
|
|
|
#endif
|
2018-04-20 13:53:53 -05:00
|
|
|
|
2023-03-31 13:46:42 -04:00
|
|
|
#include "openmc/vector.h"
|
|
|
|
|
|
2018-04-20 07:02:59 -05:00
|
|
|
namespace openmc {
|
|
|
|
|
namespace mpi {
|
|
|
|
|
|
|
|
|
|
extern int rank;
|
|
|
|
|
extern int n_procs;
|
2018-08-30 06:44:37 -05:00
|
|
|
extern bool master;
|
2018-04-20 07:02:59 -05:00
|
|
|
|
|
|
|
|
#ifdef OPENMC_MPI
|
2021-05-08 18:50:24 -04:00
|
|
|
extern MPI_Datatype source_site;
|
2025-11-13 21:35:33 +01:00
|
|
|
extern MPI_Datatype collision_track_site;
|
2018-04-20 07:02:59 -05:00
|
|
|
extern MPI_Comm intracomm;
|
|
|
|
|
#endif
|
|
|
|
|
|
2026-01-14 01:25:33 +02:00
|
|
|
//==============================================================================
|
|
|
|
|
// Template struct used to map types to MPI datatypes
|
|
|
|
|
// By having a single static data member, the template can
|
|
|
|
|
// be specialized for each type we know of. The specializations appear in the
|
|
|
|
|
// .cpp file since they are definitions.
|
|
|
|
|
//==============================================================================
|
|
|
|
|
#ifdef OPENMC_MPI
|
|
|
|
|
template<typename T>
|
|
|
|
|
struct MPITypeMap {
|
|
|
|
|
static const MPI_Datatype mpi_type;
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-03-31 13:46:42 -04:00
|
|
|
// Calculates global indices of the bank particles
|
|
|
|
|
// across all ranks using a parallel scan. This is used to write
|
|
|
|
|
// the surface source file in parallel runs. It will probably
|
|
|
|
|
// be used in the future for other types of bank like particles
|
|
|
|
|
// in flight used to kick off transient simulations.
|
|
|
|
|
//
|
|
|
|
|
// More abstractly, this just takes a number from each MPI rank,
|
|
|
|
|
// and returns a vector which is the exclusive parallel scan across
|
|
|
|
|
// all of those numbers, having a length of the number of MPI ranks
|
|
|
|
|
// plus one.
|
2023-04-15 22:34:45 -04:00
|
|
|
vector<int64_t> calculate_parallel_index_vector(int64_t size);
|
2023-03-31 13:46:42 -04:00
|
|
|
|
2018-04-20 07:02:59 -05:00
|
|
|
} // namespace mpi
|
|
|
|
|
} // namespace openmc
|
|
|
|
|
|
2018-08-20 14:40:32 -05:00
|
|
|
#endif // OPENMC_MESSAGE_PASSING_H
|