3 #include <AMReX_Config.H>
32 bool send_ba =
false);
34 template <
typename FAB>
37 template <
typename FAB>
45 std::map<int,FabArrayBase::CopyComTagsContainer>
m_SndTags;
46 std::map<int,FabArrayBase::CopyComTagsContainer>
m_RcvTags;
52 template <
typename FAB>
55 const auto N_snds =
static_cast<int>(
m_SndTags.size());
57 if (N_snds == 0) {
return; }
68 std::size_t total_volume = 0;
70 auto const& cctc = kv.second;
72 std::size_t nbytes = 0;
73 for (
auto const& cct : cctc) {
74 nbytes += cct.sbox.numPts() * ncomp *
sizeof(
typename FAB::value_type);
77 std::size_t acd = ParallelDescriptor::sizeof_selected_comm_data_type(nbytes);
84 offset.push_back(total_volume);
85 total_volume += nbytes;
87 send_data.push_back(
nullptr);
88 send_size.push_back(nbytes);
89 send_rank.push_back(kv.first);
91 send_cctc.push_back(&cctc);
95 char* the_send_data = send_buffer.
data();
96 for (
int i = 0; i < N_snds; ++i) {
97 send_data[i] = the_send_data +
offset[i];
111 for (
int i = 0; i < N_snds; ++i) {
119 template <
typename FAB>
122 const auto N_rcvs =
static_cast<int>(
m_RcvTags.size());
124 if (N_rcvs == 0) {
return; }
134 std::size_t TotalRcvsVolume = 0;
136 std::size_t nbytes = 0;
137 for (
auto const& cct : kv.second) {
138 nbytes += cct.dbox.numPts() * ncomp *
sizeof(
typename FAB::value_type);
141 std::size_t acd = ParallelDescriptor::sizeof_selected_comm_data_type(nbytes);
146 acd), TotalRcvsVolume);
148 offset.push_back(TotalRcvsVolume);
149 TotalRcvsVolume += nbytes;
151 recv_data.push_back(
nullptr);
152 recv_size.push_back(nbytes);
153 recv_from.push_back(kv.first);
158 char* the_recv_data = recv_buffer.
data();
161 for (
int i = 0; i < N_rcvs; ++i) {
162 recv_data[i] = the_recv_data +
offset[i];
168 for (
int i = 0; i < N_rcvs; ++i) {
169 recv_cctc[i] = &(
m_RcvTags.at(recv_from[i]));
Array4< int const > offset
Definition: AMReX_HypreMLABecLap.cpp:1089
int MPI_Comm
Definition: AMReX_ccse-mpi.H:47
static constexpr int MPI_COMM_WORLD
Definition: AMReX_ccse-mpi.H:54
static constexpr int MPI_REQUEST_NULL
Definition: AMReX_ccse-mpi.H:53
virtual bool isManaged() const
Definition: AMReX_Arena.cpp:79
virtual bool isDevice() const
Definition: AMReX_Arena.cpp:91
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:550
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
@ COPY
Definition: AMReX_FabArrayBase.H:393
An Array of FortranArrayBox(FAB)-like Objects.
Definition: AMReX_FabArray.H:344
static void pack_send_buffer_gpu(FabArray< FAB > const &src, int scomp, int ncomp, Vector< char * > const &send_data, Vector< std::size_t > const &send_size, Vector< const CopyComTagsContainer * > const &send_cctc)
static void unpack_recv_buffer_cpu(FabArray< FAB > &dst, int dcomp, int ncomp, Vector< char * > const &recv_data, Vector< std::size_t > const &recv_size, Vector< const CopyComTagsContainer * > const &recv_cctc, CpOp op, bool is_thread_safe)
static void unpack_recv_buffer_gpu(FabArray< FAB > &dst, int dcomp, int ncomp, Vector< char * > const &recv_data, Vector< std::size_t > const &recv_size, Vector< const CopyComTagsContainer * > const &recv_cctc, CpOp op, bool is_thread_safe)
Arena * arena() const noexcept
Definition: AMReX_FabArray.H:445
static void pack_send_buffer_cpu(FabArray< FAB > const &src, int scomp, int ncomp, Vector< char * > const &send_data, Vector< std::size_t > const &send_size, Vector< const CopyComTagsContainer * > const &send_cctc)
Program ID.
Definition: AMReX_MPMD.H:27
bool m_is_thread_safe
Definition: AMReX_MPMD.H:47
Copier(bool)
Definition: AMReX_MPMD.cpp:279
DistributionMapping m_dm
Definition: AMReX_MPMD.H:49
DistributionMapping const & DistributionMap() const
Definition: AMReX_MPMD.cpp:370
void recv(FabArray< FAB > &mf, int icomp, int ncomp) const
Definition: AMReX_MPMD.H:120
BoxArray m_ba
Definition: AMReX_MPMD.H:48
BoxArray const & boxArray() const
Definition: AMReX_MPMD.cpp:365
std::map< int, FabArrayBase::CopyComTagsContainer > m_SndTags
Definition: AMReX_MPMD.H:45
std::map< int, FabArrayBase::CopyComTagsContainer > m_RcvTags
Definition: AMReX_MPMD.H:46
void send(FabArray< FAB > const &mf, int icomp, int ncomp) const
Definition: AMReX_MPMD.H:53
Definition: AMReX_PODVector.H:246
T * data() noexcept
Definition: AMReX_PODVector.H:593
MPI_Request req() const
Definition: AMReX_ParallelDescriptor.H:74
bool inLaunchRegion() noexcept
Definition: AMReX_GpuControl.H:86
Definition: AMReX_MPMD.cpp:12
void Initialize_without_split(int argc, char *argv[])
Definition: AMReX_MPMD.cpp:44
bool Initialized()
Definition: AMReX_MPMD.cpp:115
int NProcs()
Process ID in MPI_COMM_WORLD.
Definition: AMReX_MPMD.cpp:122
void Finalize()
Definition: AMReX_MPMD.cpp:105
int MyProc()
Definition: AMReX_MPMD.cpp:117
int MyProgId()
Get the appnum (color) required for MPI_Comm_split.
Definition: AMReX_MPMD.cpp:137
int AppNum()
Number of processes in MPI_COMM_WORLD.
Definition: AMReX_MPMD.cpp:132
MPI_Comm Initialize(int argc, char *argv[])
Definition: AMReX_MPMD.cpp:97
Message Asend(const T *, size_t n, int pid, int tag)
Definition: AMReX_ParallelDescriptor.H:1088
void Waitall(Vector< MPI_Request > &, Vector< MPI_Status > &)
Definition: AMReX_ParallelDescriptor.cpp:1295
Message Arecv(T *, size_t n, int pid, int tag)
Definition: AMReX_ParallelDescriptor.H:1130
@ max
Definition: AMReX_ParallelReduce.H:17
std::size_t aligned_size(std::size_t align_requirement, std::size_t size) noexcept
Given a minimum required size of size bytes, this returns the next largest arena size that will align...
Definition: AMReX_Arena.H:30