15template <
typename BUF,
class F>
20 bool enforce_periodicity_only,
22 IntVect const& sumboundary_src_nghost,
29 AMREX_ASSERT(!enforce_periodicity_only || !override_sync);
31 bool sumboundary = sumboundary_src_nghost.
allGE(0);
34 if (enforce_periodicity_only) {
36 }
else if (override_sync) {
38 }
else if (sumboundary) {
41 work_to_do = nghost.
max() > 0;
47 if (enforce_periodicity_only || override_sync || sumboundary) {
53 if (!work_to_do) {
return; }
55 const FB& TheFB =
getFB(nghost, period, cross, enforce_periodicity_only, override_sync, sumboundary_src_nghost);
63 if (N_locs == 0) {
return; }
67#if defined(__CUDACC__) && defined(AMREX_USE_CUDA)
70 FB_local_copy_cuda_graph_1(TheFB, scomp, ncomp);
114 const int N_locs = TheFB.
m_LocTags->size();
115 const int N_rcvs = TheFB.
m_RcvTags->size();
116 const int N_snds = TheFB.
m_SndTags->size();
118 if (N_locs == 0 && N_rcvs == 0 && N_snds == 0) {
123#ifdef AMREX_FB_UNPACK_ON_ARRIVAL
138 fbd = std::make_unique<FBData<FAB>>();
143 fbd->deterministic = deterministic;
151 fbd->recv_data,
fbd->recv_size,
fbd->recv_from,
fbd->recv_reqs,
153 fbd->recv_stat.resize(N_rcvs);
159 char*& the_send_data =
fbd->the_send_data;
168 PrepareSendBuffers<BUF>(*TheFB.
m_SndTags, the_send_data, send_data, send_size, send_rank,
169 send_reqs, send_cctc, ncomp);
174#if defined(__CUDACC__) && defined(AMREX_USE_CUDA)
176 FB_pack_send_buffer_cuda_graph(TheFB, scomp, ncomp, send_data, send_size, send_cctc);
191 PostSnds(send_data, send_size, send_rank, send_reqs, SeqNum);
204#if defined(__CUDACC__) && defined(AMREX_USE_CUDA)
206 FB_local_copy_cuda_graph_n(TheFB, scomp, ncomp);
250template <
typename BUF,
class F>
260 if (!
fbd) {
return; }
262#ifdef AMREX_FB_UNPACK_ON_ARRIVAL
269 const FB* TheFB =
fbd->fb;
271 const auto N_rcvs =
static_cast<int>(TheFB->
m_RcvTags->size());
275 for (
int k = 0; k < N_rcvs; k++)
277 if (
fbd->recv_size[k] > 0)
279 auto const& cctc = TheFB->
m_RcvTags->at(
fbd->recv_from[k]);
280 recv_cctc[k] = &cctc;
284 int actual_n_rcvs = N_rcvs - std::ranges::count(
fbd->recv_data,
nullptr);
286 if (actual_n_rcvs > 0) {
289 if (!CheckRcvStats(
fbd->recv_stat,
fbd->recv_size,
fbd->tag))
291 amrex::Abort(
"FillBoundary_finish failed with wrong message size");
302#if defined(__CUDACC__) && defined(AMREX_USE_CUDA)
305 FB_unpack_recv_buffer_cuda_graph(*TheFB,
fbd->scomp,
fbd->ncomp,
306 fbd->recv_data,
fbd->recv_size,
307 recv_cctc, is_thread_safe);
312 bool deterministic =
fbd->deterministic;
314 recv_cctc, op, is_thread_safe, TheFB->
m_id, deterministic);
321 recv_cctc, op, is_thread_safe);
324 if (
fbd->the_recv_data)
331 fbd->the_recv_data =
nullptr;
335 const auto N_snds =
static_cast<int>(TheFB->
m_SndTags->size());
340 fbd->the_send_data =
nullptr;
364 false, deterministic);
403 BL_PROFILE(
"FabArray::ParallelCopyToGhost()");
443 bool to_ghost_cells_only,
446 ParallelCopy_nowait(src,scomp,dcomp,ncomp,snghost,dnghost,
IntVect(0),period,op,a_cpc,
447 to_ghost_cells_only, deterministic);
462 bool to_ghost_cells_only,
466 BL_PROFILE(
"FabArray::ParallelCopy_nowait()");
482 (this->
size() == 1) && (src.
size() == 1) &&
483 !period.
isAnyPeriodic() && !to_ghost_cells_only && (offset == 0))
486 auto const& da = this->
array(0, dcomp);
495 da(i,j,k,n) = sa(i,j,k,n);
506#pragma omp parallel for collapse(3)
508 for (
int n = 0; n < ncomp; ++n) {
509 for (
int k = lo.z; k <= hi.z; ++k) {
510 for (
int j = lo.y; j <= hi.y; ++j) {
512 for (
int i = lo.x; i <= hi.x; ++i) {
513 da(i,j,k,n) = sa(i,j,k,n);
521 da(i,j,k,n) += sa(i,j,k,n);
532#pragma omp parallel for collapse(3)
534 for (
int n = 0; n < ncomp; ++n) {
535 for (
int k = lo.z; k <= hi.z; ++k) {
536 for (
int j = lo.y; j <= hi.y; ++j) {
538 for (
int i = lo.x; i <= hi.x; ++i) {
539 da(i,j,k,n) += sa(i,j,k,n);
551 !period.
isAnyPeriodic() && !to_ghost_cells_only && (offset == 0))
562 Add(*
this, src, scomp, dcomp, ncomp,
IntVect(0));
568 const CPC& thecpc = (a_cpc) ? *a_cpc :
getCPC(dnghost, src, snghost, period,
569 to_ghost_cells_only,offset);
578 if (N_locs == 0) {
return; }
605 const int N_snds = thecpc.
m_SndTags->size();
606 const int N_rcvs = thecpc.
m_RcvTags->size();
607 const int N_locs = thecpc.
m_LocTags->size();
609 if (N_locs == 0 && N_rcvs == 0 && N_snds == 0) {
620 int NCompLeft = ncomp;
621 int SC = scomp, DC = dcomp, NC;
623 for (
int ipass = 0; ipass < ncomp; )
625 pcd = std::make_unique<PCData<FAB>>();
634 const bool last_iter = (NCompLeft == NC);
643 pcd->the_recv_data =
nullptr;
645 pcd->actual_n_rcvs = 0;
648 pcd->recv_data,
pcd->recv_size,
pcd->recv_from,
pcd->recv_reqs, NC,
pcd->tag);
649 pcd->actual_n_rcvs = N_rcvs - std::ranges::count(
pcd->recv_size, 0);
662 src.PrepareSendBuffers(*thecpc.
m_SndTags,
pcd->the_send_data, send_data, send_size,
663 send_rank,
pcd->send_reqs, send_cctc, NC);
728 BL_PROFILE(
"FabArray::ParallelCopy_finish()");
731 if (!
pcd) {
return; }
733 const CPC* thecpc =
pcd->cpc;
735 const auto N_snds =
static_cast<int>(thecpc->
m_SndTags->size());
736 const auto N_rcvs =
static_cast<int>(thecpc->
m_RcvTags->size());
741 for (
int k = 0; k < N_rcvs; ++k)
743 if (
pcd->recv_size[k] > 0)
745 auto const& cctc = thecpc->
m_RcvTags->at(
pcd->recv_from[k]);
746 recv_cctc[k] = &cctc;
750 if (
pcd->actual_n_rcvs > 0) {
754 if (!CheckRcvStats(stats,
pcd->recv_size,
pcd->tag))
756 amrex::Abort(
"ParallelCopy failed with wrong message size");
767 recv_cctc,
pcd->op, is_thread_safe, thecpc->
m_id,
774 recv_cctc,
pcd->op, is_thread_safe);
777 if (
pcd->the_recv_data)
784 pcd->the_recv_data =
nullptr;
794 pcd->the_send_data =
nullptr;
808 BL_ASSERT(dcomp + ncomp <= dest.nComp());
820 destmf.ParallelCopy(*
this, scomp, 0, ncomp, nghost, 0);
823 using T =
typename FAB::value_type;
825 Long count = dest.numPts()*ncomp;
826 T*
const p0 = dest.dataPtr(dcomp);
850template <
typename BUF>
860 char* pointer =
nullptr;
861 PrepareSendBuffers<BUF>(SndTags, pointer, send_data, send_size, send_rank, send_reqs, send_cctc, ncomp);
866template <
typename BUF>
868FabArray<FAB>::PrepareSendBuffers (
const MapOfCopyComTagContainers& SndTags,
869 char*& the_send_data,
870 Vector<char*>& send_data,
871 Vector<std::size_t>& send_size,
872 Vector<int>& send_rank,
873 Vector<MPI_Request>& send_reqs,
874 Vector<const CopyComTagsContainer*>& send_cctc,
882 const auto N_snds = SndTags.size();
883 if (N_snds == 0) {
return; }
884 send_data.reserve(N_snds);
885 send_size.reserve(N_snds);
886 send_rank.reserve(N_snds);
887 send_reqs.reserve(N_snds);
888 send_cctc.reserve(N_snds);
891 std::size_t total_volume = 0;
892 for (
auto const& kv : SndTags)
894 auto const& cctc = kv.second;
896 std::size_t nbytes = 0;
897 for (
auto const& cct : kv.second)
899 nbytes += cct.sbox.numPts() * ncomp *
sizeof(BUF);
902 std::size_t acd = ParallelDescriptor::sizeof_selected_comm_data_type(nbytes);
909 offset.push_back(total_volume);
910 total_volume += nbytes;
912 send_data.push_back(
nullptr);
913 send_size.push_back(nbytes);
914 send_rank.push_back(kv.first);
916 send_cctc.push_back(&cctc);
919 if (total_volume > 0)
922 for (
int i = 0, N =
static_cast<int>(send_size.size()); i < N; ++i) {
923 send_data[i] = the_send_data + offset[i];
926 the_send_data =
nullptr;
940 const auto N_snds =
static_cast<int>(send_reqs.size());
941 for (
int j = 0; j < N_snds; ++j)
943 if (send_size[j] > 0) {
946 (send_data[j], send_size[j], rank, SeqNum, comm).
req();
952template <
typename BUF>
961 char* pointer =
nullptr;
962 PostRcvs(RcvTags, pointer, recv_data, recv_size, recv_from, recv_reqs, ncomp, SeqNum);
967template <
typename BUF>
970 char*& the_recv_data,
984 std::size_t TotalRcvsVolume = 0;
985 for (
const auto& kv : RcvTags)
987 std::size_t nbytes = 0;
988 for (
auto const& cct : kv.second)
990 nbytes += cct.dbox.numPts() * ncomp *
sizeof(BUF);
993 std::size_t acd = ParallelDescriptor::sizeof_selected_comm_data_type(nbytes);
1000 offset.push_back(TotalRcvsVolume);
1001 TotalRcvsVolume += nbytes;
1003 recv_data.push_back(
nullptr);
1004 recv_size.push_back(nbytes);
1005 recv_from.push_back(kv.first);
1009 const auto nrecv =
static_cast<int>(recv_from.size());
1013 if (TotalRcvsVolume == 0)
1015 the_recv_data =
nullptr;
1021 for (
int i = 0; i < nrecv; ++i)
1023 recv_data[i] = the_recv_data + offset[i];
1024 if (recv_size[i] > 0)
1028 (recv_data[i], recv_size[i], rank, SeqNum, comm).
req();
1044 "FabArray::Redistribute: must have the same BoxArray");
1048 Copy(*
this, src, scomp, dcomp, ncomp, nghost);
1066#if defined(AMREX_USE_MPI) && !defined(AMREX_DEBUG)
1076template <
class TagT>
1079 const int N = tags.
size();
1080 if (N == 0) {
return; }
1086 const int ncomp = tag.dfab.nComp();
1087 for (
int n = 0; n < ncomp; ++n) {
1088 tag.dfab(i,j,k,n) = tag.sfab(i+tag.offset.x,j+tag.offset.y,k+tag.offset.z,n);
1095#pragma omp parallel for
1097 for (
int itag = 0; itag < N; ++itag) {
1098 auto const& tag = tags[itag];
1099 const int ncomp = tag.dfab.nComp();
1102 tag.dfab(i,j,k,n) = tag.sfab(i+tag.offset.x,j+tag.offset.y,k+tag.offset.z,n);
1123template <FabArrayType MF>
1131 const int N = mf.
size();
1132 for (
int i = 0; i < N; ++i) {
1133 mf[i]->FillBoundary_nowait(scomp[i], ncomp[i], nghost[i], period[i],
1134 cross.empty() ? 0 : cross[i]);
1146template <FabArrayType MF>
1155 ncomp.reserve(mf.
size());
1156 nghost.reserve(mf.
size());
1157 for (
auto const&
x : mf) {
1158 ncomp.push_back(
x->nComp());
1159 nghost.push_back(
x->nGrowVect());
1169template <FabArrayType MF>
1174 const int N = mf.
size();
1175 for (
int i = 0; i < N; ++i) {
1176 mf[i]->FillBoundary_finish();
1192template <FabArrayType MF>
1198 BL_PROFILE(
"FillBoundaryAndSync_nowait(Vector)");
1199 const int N = mf.
size();
1200 for (
int i = 0; i < N; ++i) {
1201 mf[i]->FillBoundaryAndSync_nowait(scomp[i], ncomp[i], nghost[i], period[i]);
1211template <FabArrayType MF>
1220 ncomp.reserve(mf.
size());
1221 nghost.reserve(mf.
size());
1222 for (
auto const&
x : mf) {
1223 ncomp.push_back(
x->nComp());
1224 nghost.push_back(
x->nGrowVect());
1234template <FabArrayType MF>
1238 BL_PROFILE(
"FillBoundaryAndSync_finish(Vector)");
1239 const int N = mf.
size();
1240 for (
int i = 0; i < N; ++i) {
1241 mf[i]->FillBoundaryAndSync_finish();
1260template <FabArrayType MF>
1268 const int N = mf.
size();
1269 for (
int i = 0; i < N; ++i) {
1270 mf[i]->FillBoundary_nowait(scomp[i], ncomp[i], nghost[i], period[i],
1271 cross.empty() ? 0 : cross[i]);
1273 for (
int i = 0; i < N; ++i) {
1274 mf[i]->FillBoundary_finish();
1278 using FAB =
typename MF::FABType::value_type;
1279 using T =
typename FAB::value_type;
1281 const int nmfs = mf.
size();
1286 for (
int imf = 0; imf < nmfs; ++imf) {
1287 if (nghost[imf].
max() > 0) {
1288 auto const& TheFB = mf[imf]->getFB(nghost[imf], period[imf],
1289 cross.empty() ? 0 : cross[imf]);
1293 N_rcvs += TheFB.m_RcvTags->size();
1294 N_snds += TheFB.m_SndTags->size();
1296 cmds.push_back(
nullptr);
1302 local_tags.reserve(N_locs);
1303 static_assert(amrex::IsStoreAtomic<T>::value,
"FillBoundary(Vector): storing T is not atomic");
1304 for (
int imf = 0; imf < nmfs; ++imf) {
1306 auto const& tags = *(cmds[imf]->m_LocTags);
1307 for (
auto const& tag : tags) {
1308 local_tags.push_back(TagT{.dfab = (*mf[imf])[tag.dstIndex].array(scomp[imf],ncomp[imf]),
1309 .dindex = tag.dstIndex,
1310 .sfab = (*mf[imf])[tag.srcIndex].const_array(scomp[imf],ncomp[imf]),
1312 .offset = (tag.sbox.smallEnd()-tag.dbox.smallEnd()).dim3()});
1318 detail::fbv_copy(local_tags);
1333 if (N_locs == 0 && N_rcvs == 0 && N_snds == 0) {
return; }
1335 char* the_recv_data =
nullptr;
1336 Vector<int> recv_from;
1337 Vector<std::size_t> recv_size;
1338 Vector<MPI_Request> recv_reqs;
1339 Vector<MPI_Status> recv_stat;
1340 Vector<TagT> recv_tags;
1344 for (
int imf = 0; imf < nmfs; ++imf) {
1346 auto const& tags = *(cmds[imf]->m_RcvTags);
1347 for (
const auto& kv : tags) {
1348 recv_from.push_back(kv.first);
1353 const int nrecv = recv_from.size();
1356 recv_stat.resize(nrecv);
1358 recv_tags.reserve(N_rcvs);
1362 recv_size.reserve(nrecv);
1363 offset.reserve(nrecv);
1364 std::size_t TotalRcvsVolume = 0;
1365 for (
int i = 0; i < nrecv; ++i) {
1366 std::size_t nbytes = 0;
1367 for (
int imf = 0; imf < nmfs; ++imf) {
1369 auto const& tags = *(cmds[imf]->m_RcvTags);
1370 auto it = tags.find(recv_from[i]);
1371 if (it != tags.end()) {
1372 for (
auto const& cct : it->second) {
1373 auto& dfab = (*mf[imf])[cct.dstIndex];
1374 recv_offset[i].push_back(nbytes);
1375 recv_tags.push_back(TagT{
1376 .dfab = dfab.array(scomp[imf],ncomp[imf]),
1377 .dindex = cct.dstIndex,
1380 .offset =
Dim3{.x = 0, .y = 0, .z = 0}
1382 nbytes += dfab.nBytes(cct.dbox,ncomp[imf]);
1388 std::size_t acd = ParallelDescriptor::sizeof_selected_comm_data_type(nbytes);
1394 offset.push_back(TotalRcvsVolume);
1395 TotalRcvsVolume += nbytes;
1397 recv_size.push_back(nbytes);
1403 for (
int i = 0; i < nrecv; ++i) {
1404 char*
p = the_recv_data + offset[i];
1407 (
p, recv_size[i], rank, SeqNum, comm).
req();
1408 for (
int j = 0, nj = recv_offset[i].size(); j < nj; ++j) {
1409 recv_tags[k++].sfab.p = (T
const*)(
p + recv_offset[i][j]);
1414 char* the_send_data =
nullptr;
1420 for (
int imf = 0; imf < nmfs; ++imf) {
1422 auto const& tags = *(cmds[imf]->m_SndTags);
1423 for (
auto const& kv : tags) {
1424 send_rank.push_back(kv.first);
1429 const int nsend = send_rank.size();
1431 send_data.resize(nsend,
nullptr);
1435 send_tags.reserve(N_snds);
1439 send_size.reserve(nsend);
1440 offset.reserve(nsend);
1441 std::size_t TotalSndsVolume = 0;
1442 for (
int i = 0; i < nsend; ++i) {
1443 std::size_t nbytes = 0;
1444 for (
int imf = 0; imf < nmfs; ++imf) {
1446 auto const& tags = *(cmds[imf]->m_SndTags);
1447 auto it = tags.find(send_rank[i]);
1448 if (it != tags.end()) {
1449 for (
auto const& cct : it->second) {
1450 auto const& sfab = (*mf[imf])[cct.srcIndex];
1451 send_offset[i].push_back(nbytes);
1452 send_tags.push_back(TagT{
1454 .dindex = cct.dstIndex,
1455 .sfab = sfab.const_array(scomp[imf],ncomp[imf]),
1457 .offset =
Dim3{.x = 0, .y = 0, .z = 0}
1459 nbytes += sfab.nBytes(cct.sbox,ncomp[imf]);
1465 std::size_t acd = ParallelDescriptor::sizeof_selected_comm_data_type(nbytes);
1471 offset.push_back(TotalSndsVolume);
1472 TotalSndsVolume += nbytes;
1474 send_size.push_back(nbytes);
1479 for (
int i = 0; i < nsend; ++i) {
1480 send_data[i] = the_send_data + offset[i];
1481 for (
int j = 0, nj = send_offset[i].size(); j < nj; ++j) {
1482 send_tags[k++].dfab.p = (T*)(send_data[i] + send_offset[i][j]);
1486 detail::fbv_copy(send_tags);
1492#if !defined(AMREX_DEBUG)
1498 detail::fbv_copy(local_tags);
1502#if !defined(AMREX_DEBUG)
1510 if (!FabArrayBase::CheckRcvStats(recv_stat, recv_size, SeqNum)) {
1511 amrex::Abort(
"FillBoundary(vector) failed with wrong message size");
1515 detail::fbv_copy(recv_tags);
1543template <FabArrayType MF>
1550 const int N = mf.
size();
1551 for (
int i = 0; i < N; ++i) {
1552 mf[i]->FillBoundaryAndSync_nowait(scomp[i], ncomp[i], nghost[i], period[i]);
1554 for (
int i = 0; i < N; ++i) {
1555 mf[i]->FillBoundaryAndSync_finish();
1560template <FabArrayType MF>
1569template <FabArrayType MF>
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:593
#define BL_PROFILE_SYNC_STOP()
Definition AMReX_BLProfiler.H:709
#define BL_PROFILE_SYNC_START_TIMED(fname)
Definition AMReX_BLProfiler.H:708
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX, MSG)
Definition AMReX_BLassert.H:49
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_ASSERT_WITH_MESSAGE(EX, MSG)
Definition AMReX_BLassert.H:37
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_PRAGMA_SIMD
Definition AMReX_Extension.H:84
Internal Fab copy tags and GPU helpers used by FabArray transfers.
GPU FillBoundary and SumBoundary with GPU-aware MPI. Messages are unpacked as they arrive when at lea...
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
#define AMREX_LOOP_4D(bx, ncomp, i, j, k, n, block)
while parser_exe_t p
Definition AMReX_Parser_Exe_Body.H:33
virtual void free(void *pt)=0
Free a previously allocated block pointed to by pt.
virtual void * alloc(std::size_t sz)=0
Allocate sz bytes from this arena.
Reference-counted collection of Boxes.
Definition AMReX_BoxArray.H:681
IndexType ixType() const noexcept
Return index type of this BoxArray.
Definition AMReX_BoxArray.H:1269
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:55
IntVect nGrowVect() const noexcept
Definition AMReX_FabArrayBase.H:85
const FB & getFB(const IntVect &nghost, const Periodicity &period, bool cross=false, bool enforce_periodicity_only=false, bool override_sync=false, IntVect const &sumboundary_src_nghost=IntVect(-1)) const
Retrieve (and cache) the FillBoundary metadata for the requested halo.
Definition AMReX_FabArrayBase.cpp:1308
bool is_cell_centered() const noexcept
This tests on whether the FabArray is cell-centered.
Definition AMReX_FabArrayBase.cpp:2789
IndexType ixType() const noexcept
Return index type.
Definition AMReX_FabArrayBase.H:91
int size() const noexcept
Return the number of FABs in the FabArray.
Definition AMReX_FabArrayBase.H:115
const CPC & getCPC(const IntVect &dstng, const FabArrayBase &src, const IntVect &srcng, const Periodicity &period, bool to_ghost_cells_only=false, const IntVect &offset=IntVect(0)) const
Retrieve (and cache) the ParallelCopy metadata between two FabArrays.
Definition AMReX_FabArrayBase.cpp:583
const DistributionMapping & DistributionMap() const noexcept
Return constant reference to associated DistributionMapping.
Definition AMReX_FabArrayBase.H:135
bool empty() const noexcept
Definition AMReX_FabArrayBase.H:94
CpOp
parallel copy or add
Definition AMReX_FabArrayBase.H:432
@ ADD
Definition AMReX_FabArrayBase.H:432
@ COPY
Definition AMReX_FabArrayBase.H:432
IntVect n_filled
Definition AMReX_FabArrayBase.H:542
Box box(int K) const noexcept
Return the Kth Box in the BoxArray. That is, the valid region of the Kth grid.
Definition AMReX_FabArrayBase.H:106
DistributionMapping distributionMap
Definition AMReX_FabArrayBase.H:536
static int MaxComp
The maximum number of components to copy() at a time.
Definition AMReX_FabArrayBase.H:309
BoxArray boxarray
Definition AMReX_FabArrayBase.H:535
const BoxArray & boxArray() const noexcept
Return a constant reference to the BoxArray that defines the valid region associated with this FabArr...
Definition AMReX_FabArrayBase.H:100
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:383
void ParallelCopyToGhost_finish()
Finish the current ParallelCopyToGhost_nowait() operation.
Definition AMReX_FabArrayCommI.H:426
void FillBoundary_finish()
Definition AMReX_FabArrayCommI.H:253
void ParallelCopy(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Definition AMReX_FabArray.H:999
void FBEP_nowait(int scomp, int ncomp, const IntVect &nghost, const Periodicity &period, bool cross, bool enforce_periodicity_only=false, bool override_sync=false, IntVect const &sumboundary_src_nghost=IntVect(-1), bool deterministic=false)
Definition AMReX_FabArrayCommI.H:18
void Redistribute(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &nghost)
Copy from src to this. this and src have the same BoxArray, but different DistributionMapping.
Definition AMReX_FabArrayCommI.H:1037
void ParallelCopyToGhost(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic())
Copy source data to destination ghost cells only.
Definition AMReX_FabArrayCommI.H:395
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, std::uint64_t id, bool deterministic)
Unpack received messages into dst on the GPU.
void ParallelCopy_finish()
Finish the current nowait ParallelCopy or ParallelAdd operation.
Definition AMReX_FabArrayCommI.H:723
std::unique_ptr< PCData< FAB > > pcd
Definition AMReX_FabArray.H:1967
void PC_local_cpu(const CPC &thecpc, FabArray< FAB > const &src, int scomp, int dcomp, int ncomp, CpOp op)
Definition AMReX_PCI.H:8
std::unique_ptr< FBData< FAB > > fbd
Definition AMReX_FabArray.H:1966
void ParallelAdd(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic())
This function copies data from src to this FabArray. Each FAB in fa is intersected with all FABs in t...
Definition AMReX_FabArray.H:996
void FB_local_add_cpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:467
void FB_on_arrival_nowait(const FB &TheFB, int scomp, int ncomp, int SeqNum, bool sumboundary)
void ParallelCopyToGhost_nowait(const FabArray< FAB > &src, int scomp, int dcomp, int ncomp, const IntVect &snghost, const IntVect &dnghost, const Periodicity &period=Periodicity::NonPeriodic())
Start an asynchronous version of ParallelCopyToGhost().
Definition AMReX_FabArrayCommI.H:412
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)
void FB_local_add_gpu(const FB &TheFB, int scomp, int ncomp, bool deterministic)
Definition AMReX_FBI.H:630
void FB_local_copy_gpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:558
void FB_on_arrival_finish()
void clear()
Releases FAB memory in the FabArray.
Definition AMReX_FabArray.H:2283
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, std::uint64_t id)
FabArray() noexcept
Constructs an empty FabArray<FAB>.
Definition AMReX_FabArray.H:2386
void FillBoundary_test()
Definition AMReX_FabArrayCommI.H:1064
void copyTo(FAB &dest, int nghost=0) const
Copy the values contained in the intersection of the valid + nghost region of this FabArray with the ...
Definition AMReX_FabArray.H:3059
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi) const noexcept
Read-only Array4 view for the FAB referenced by iterator mfi.
Definition AMReX_FabArray.H:649
void FB_local_copy_cpu(const FB &TheFB, int scomp, int ncomp)
Definition AMReX_FBI.H:396
void PC_local_gpu(const CPC &thecpc, FabArray< FAB > const &src, int scomp, int dcomp, int ncomp, CpOp op, bool deterministic)
Definition AMReX_PCI.H:98
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)
void ParallelCopy_nowait(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic(), CpOp op=FabArrayBase::COPY)
Start an asynchronous ParallelCopy that copies every component.
Definition AMReX_FabArray.H:1031
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi) const noexcept
Synonym for array(const MFIter&) that highlights read-only semantics.
Definition AMReX_FabArray.H:677
__host__ __device__ bool cellCentered() const noexcept
True if the IndexTypeND is CELL based in all directions.
Definition AMReX_IndexType.H:102
__host__ __device__ constexpr bool allGE(const IntVectND< dim > &rhs) const noexcept
Returns true if this is greater than or equal to argument for all components. NOTE: This is NOT a str...
Definition AMReX_IntVect.H:549
__host__ static __device__ constexpr IntVectND< dim > TheZeroVector() noexcept
Definition AMReX_IntVect.H:778
__host__ __device__ constexpr int max() const noexcept
maximum (no absolute values) value
Definition AMReX_IntVect.H:320
MPI_Request req() const
Definition AMReX_ParallelDescriptor.H:74
This provides length of period for periodic domains. 0 means it is not periodic in that direction....
Definition AMReX_Periodicity.H:17
static const Periodicity & NonPeriodic() noexcept
Definition AMReX_Periodicity.cpp:52
bool isAnyPeriodic() const noexcept
Definition AMReX_Periodicity.H:22
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:29
Long size() const noexcept
Definition AMReX_Vector.H:54
Checks if a type is derived from amrex::BaseFab.
Definition AMReX_Concepts.H:13
amrex_long Long
Definition AMReX_INT.H:30
__host__ __device__ Dim3 ubound(Array4< T > const &a) noexcept
Return the inclusive upper bounds of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1377
__host__ __device__ Dim3 lbound(Array4< T > const &a) noexcept
Return the inclusive lower bounds of an Array4 in Dim3 form.
Definition AMReX_Array4.H:1363
__host__ __device__ BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Return a copy of b grown uniformly by i cells in every direction.
Definition AMReX_Box.H:1328
Arena * The_Comms_Arena()
Definition AMReX_Arena.cpp:899
Arena * The_Pinned_Arena()
Definition AMReX_Arena.cpp:879
std::size_t aligned_size(std::size_t align_requirement, std::size_t size) noexcept
Return the smallest multiple of align_requirement that is >= size.
Definition AMReX_Arena.H:39
int MyProc() noexcept
Definition AMReX_ParallelDescriptor.H:128
void Bcast(Gpu::DeviceVector< T > &v, int root, MPI_Comm comm)
Definition AMReX_GpuParallelReduce.H:105
int NProcs() noexcept
Definition AMReX_ParallelDescriptor.H:255
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:54
void freeAsync(Arena *arena, void *mem) noexcept
Definition AMReX_GpuDevice.H:364
bool inGraphRegion()
Definition AMReX_GpuControl.H:117
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:329
void dtoh_memcpy_async(void *p_h, const void *p_d, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:454
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:88
bool inNoSyncRegion() noexcept
Definition AMReX_GpuControl.H:148
void htod_memcpy_async(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:440
MPI_Comm CommunicatorSub() noexcept
sub-communicator for current frame
Definition AMReX_ParallelContext.H:70
int global_to_local_rank(int rank) noexcept
Definition AMReX_ParallelContext.H:101
int NProcsSub() noexcept
number of ranks in current frame
Definition AMReX_ParallelContext.H:74
void Test(MPI_Request &, int &, MPI_Status &)
Definition AMReX_ParallelDescriptor.cpp:1224
Message Asend(const T *, size_t n, int pid, int tag)
Definition AMReX_ParallelDescriptor.H:1163
bool UseGpuAwareMpi()
Definition AMReX_ParallelDescriptor.H:113
void Waitall(Vector< MPI_Request > &, Vector< MPI_Status > &)
Definition AMReX_ParallelDescriptor.cpp:1312
int SeqNum() noexcept
Returns sequential message sequence numbers, usually used as tags for send/recv.
Definition AMReX_ParallelDescriptor.H:678
Message Arecv(T *, size_t n, int pid, int tag)
Definition AMReX_ParallelDescriptor.H:1205
int MPI_Comm
Definition AMReX_ccse-mpi.H:51
static constexpr int MPI_REQUEST_NULL
Definition AMReX_ccse-mpi.H:57
Definition AMReX_Amr.cpp:50
@ make_alias
Definition AMReX_MakeType.H:7
__host__ __device__ void ignore_unused(const Ts &...)
No-op helper that marks variables as intentionally unused.
Definition AMReX.H:273
void FillBoundary_finish(Vector< MF * > const &mf)
Wait for outstanding FillBoundary_nowait operations launched with the vector helper to complete.
Definition AMReX_FabArrayCommI.H:1171
void Copy(FabArray< DFAB > &dst, FabArray< SFAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:219
void Add(FabArray< FAB > &dst, FabArray< FAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:278
__host__ __device__ Array4< T > makeArray4(T *p, Box const &bx, int ncomp) noexcept
Definition AMReX_BaseFab.H:137
std::unique_ptr< char, TheFaArenaDeleter > TheFaArenaPointer
Definition AMReX_FabArray.H:118
BoxArray const & boxArray(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.boxArray().
Definition AMReX_FabArrayBase.cpp:3038
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.DistributionMap().
Definition AMReX_FabArrayBase.cpp:3043
void FillBoundary_nowait(Vector< MF * > const &mf, Vector< int > const &scomp, Vector< int > const &ncomp, Vector< IntVect > const &nghost, Vector< Periodicity > const &period, Vector< int > const &cross={})
Launch FillBoundary_nowait across a vector of FabArrays.
Definition AMReX_FabArrayCommI.H:1125
void FillBoundaryAndSync_nowait(Vector< MF * > const &mf, Vector< int > const &scomp, Vector< int > const &ncomp, Vector< IntVect > const &nghost, Vector< Periodicity > const &period)
Launch FillBoundaryAndSync_nowait across a vector of FabArrays.
Definition AMReX_FabArrayCommI.H:1194
void ParallelCopy_finish(FabArray< FAB > &dest, CommHandler handler, const FabArrayBase::CommMetaData &cmd, const DataPacking &data_packing)
Definition AMReX_NonLocalBC.H:914
void FillBoundaryAndSync(Vector< MF * > const &mf, Vector< int > const &scomp, Vector< int > const &ncomp, Vector< IntVect > const &nghost, Vector< Periodicity > const &period)
Perform FillBoundaryAndSync on a batch of FabArrays (e.g., MultiFabs).
Definition AMReX_FabArrayCommI.H:1545
void ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:202
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:35
void ParallelCopy(MF &dst, MF const &src, int scomp, int dcomp, int ncomp, IntVect const &ng_src=IntVect(0), IntVect const &ng_dst=IntVect(0), Periodicity const &period=Periodicity::NonPeriodic())
dst = src w/ MPI communication
Definition AMReX_FabArrayUtility.H:2264
@ x
Definition AMReX_Orientation.H:14
IntVect nGrowVect(FabArrayBase const &fa)
Convenience wrapper that forwards to fa.nGrowVect().
Definition AMReX_FabArrayBase.cpp:3033
CommHandler ParallelCopy_nowait(NoLocalCopy, FabArray< FAB > &dest, const FabArray< FAB > &src, const FabArrayBase::CommMetaData &cmd, const DataPacking &data_packing)
Definition AMReX_NonLocalBC.H:822
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:239
void RemoveDuplicates(Vector< T > &vec)
Definition AMReX_Vector.H:210
void FillBoundaryAndSync_finish(Vector< MF * > const &mf)
Wait for outstanding FillBoundaryAndSync_nowait operations launched with the vector helper to complet...
Definition AMReX_FabArrayCommI.H:1236
void FillBoundary(Vector< MF * > const &mf, Vector< int > const &scomp, Vector< int > const &ncomp, Vector< IntVect > const &nghost, Vector< Periodicity > const &period, Vector< int > const &cross={})
Perform FillBoundary on a batch of FabArrays (e.g., MultiFabs).
Definition AMReX_FabArrayCommI.H:1262
Definition AMReX_TagParallelFor.H:26
A simple struct holding 3 int values for a 3D index.
Definition AMReX_Dim3.H:24
parallel copy or add
Definition AMReX_FabArrayBase.H:651
std::uint64_t m_id
Definition AMReX_FabArrayBase.H:666
FillBoundary.
Definition AMReX_FabArrayBase.H:588
std::uint64_t m_id
Definition AMReX_FabArrayBase.H:594
IntVect m_sb_snghost
Definition AMReX_FabArrayBase.H:598
Definition AMReX_TypeTraits.H:51
Definition AMReX_TypeTraits.H:61
Definition AMReX_TypeTraits.H:277
FabArray memory allocation information.
Definition AMReX_FabArray.H:73