mirror of
https://github.com/NGSolve/netgen.git
synced 2025-02-26 14:05:40 +05:00
AllReduce for Arrays
This commit is contained in:
parent
d2348a7651
commit
2b9d4596ae
@ -254,6 +254,15 @@ namespace ngcore
|
||||
return global_d;
|
||||
}
|
||||
|
||||
template <typename T, typename T2 = decltype(GetMPIType<T>())>
|
||||
void AllReduce (FlatArray<T> d, const MPI_Op & op) const
|
||||
{
|
||||
static Timer t("MPI - AllReduce Array"); RegionTimer reg(t);
|
||||
if (size == 1) return d;
|
||||
|
||||
MPI_Allreduce (MPI_IN_PLACE, d.Data(), d.Size(), GetMPIType<T>(), op, comm);
|
||||
}
|
||||
|
||||
template <typename T, typename T2 = decltype(GetMPIType<T>())>
|
||||
void Bcast (T & s, int root = 0) const {
|
||||
if (size == 1) return ;
|
||||
@ -396,6 +405,9 @@ namespace ngcore
|
||||
template <typename T>
|
||||
T AllReduce (T d, const MPI_Op & op) const { return d; }
|
||||
|
||||
template <typename T>
|
||||
void AllReduce (FlatArray<T> d, const MPI_Op & op) const { ; }
|
||||
|
||||
template <typename T>
|
||||
void Bcast (T & s, int root = 0) const { ; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user