Nektar++
Classes | Typedefs | Enumerations | Functions
Gs Namespace Reference

Classes

struct  allreduce_data
 
struct  array
 
struct  comm
 
struct  cr_data
 
struct  cr_stage
 
struct  gs_data
 
struct  gs_remote
 
struct  pw_comm_data
 
struct  pw_data
 

Typedefs

typedef array buffer
 
typedef int comm_ext
 
typedef int comm_req
 
typedef void exec_fun(void *data, gs_mode mode, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, const void *execdata, const struct comm *comm, char *buf)
 
typedef void fin_fun(void *data)
 

Enumerations

enum  gs_dom {
  gs_double , gs_float , gs_int , gs_long ,
  gs_dom_n
}
 
enum  gs_op {
  gs_add , gs_mul , gs_min , gs_max ,
  gs_amax , gs_bpr , gs_op_n
}
 
enum  gs_mode { mode_plain , mode_vec , mode_many , mode_dry_run }
 
enum  gs_method { gs_auto , gs_pairwise , gs_crystal_router , gs_all_reduce }
 

Functions

void nektar_gs (void *u, gs_dom dom, gs_op op, unsigned transpose, gs_data *gsh, buffer *buf)
 
gs_datanektar_gs_setup (const long *id, unsigned int n, const struct comm *comm, int unique, gs_method method, int verbose)
 
void nektar_gs_free (gs_data *gsh)
 
void nektar_gs_unique (const long *id, unsigned int n, const struct comm *comm)
 
static gs_dataInit (const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm, bool verbose=true)
 Initialise Gather-Scatter map. More...
 
static void Unique (const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm)
 Updates pId to negate all-but-one references to each universal ID. More...
 
static void Finalise (gs_data *pGsh)
 Deallocates the GSLib mapping data. More...
 
static void Gather (Nektar::Array< OneD, NekDouble > pU, gs_op pOp, gs_data *pGsh, Nektar::Array< OneD, NekDouble > pBuffer=NullNekDouble1DArray)
 Performs a gather-scatter operation of the provided values. More...
 

Typedef Documentation

◆ buffer

typedef array Gs::buffer

Definition at line 83 of file GsLib.hpp.

◆ comm_ext

typedef int Gs::comm_ext

Definition at line 88 of file GsLib.hpp.

◆ comm_req

typedef int Gs::comm_req

Definition at line 89 of file GsLib.hpp.

◆ exec_fun

typedef void Gs::exec_fun(void *data, gs_mode mode, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, const void *execdata, const struct comm *comm, char *buf)

Definition at line 137 of file GsLib.hpp.

◆ fin_fun

typedef void Gs::fin_fun(void *data)

Definition at line 140 of file GsLib.hpp.

Enumeration Type Documentation

◆ gs_dom

enum Gs::gs_dom
Enumerator
gs_double 
gs_float 
gs_int 
gs_long 
gs_dom_n 

Definition at line 52 of file GsLib.hpp.

53{
56 gs_int,
57 gs_long,
59} gs_dom;
gs_dom
Definition: GsLib.hpp:53
@ gs_dom_n
Definition: GsLib.hpp:58
@ gs_int
Definition: GsLib.hpp:56
@ gs_double
Definition: GsLib.hpp:54
@ gs_long
Definition: GsLib.hpp:57
@ gs_float
Definition: GsLib.hpp:55

◆ gs_method

Enumerator
gs_auto 
gs_pairwise 
gs_crystal_router 
gs_all_reduce 

Definition at line 159 of file GsLib.hpp.

160{
161 gs_auto,
165} gs_method;
gs_method
Definition: GsLib.hpp:160
@ gs_all_reduce
Definition: GsLib.hpp:164
@ gs_pairwise
Definition: GsLib.hpp:162
@ gs_crystal_router
Definition: GsLib.hpp:163
@ gs_auto
Definition: GsLib.hpp:161

◆ gs_mode

Enumerator
mode_plain 
mode_vec 
mode_many 
mode_dry_run 

Definition at line 70 of file GsLib.hpp.

71{
76} gs_mode;
gs_mode
Definition: GsLib.hpp:71
@ mode_vec
Definition: GsLib.hpp:73
@ mode_plain
Definition: GsLib.hpp:72
@ mode_dry_run
Definition: GsLib.hpp:75
@ mode_many
Definition: GsLib.hpp:74

◆ gs_op

enum Gs::gs_op
Enumerator
gs_add 
gs_mul 
gs_min 
gs_max 
gs_amax 
gs_bpr 
gs_op_n 

Definition at line 60 of file GsLib.hpp.

61{
62 gs_add,
63 gs_mul,
64 gs_min,
65 gs_max,
66 gs_amax,
67 gs_bpr,
69} gs_op;
gs_op
Definition: GsLib.hpp:61
@ gs_amax
Definition: GsLib.hpp:66
@ gs_add
Definition: GsLib.hpp:62
@ gs_max
Definition: GsLib.hpp:65
@ gs_bpr
Definition: GsLib.hpp:67
@ gs_min
Definition: GsLib.hpp:64
@ gs_op_n
Definition: GsLib.hpp:68
@ gs_mul
Definition: GsLib.hpp:63

Function Documentation

◆ Finalise()

static void Gs::Finalise ( gs_data pGsh)
inlinestatic

Deallocates the GSLib mapping data.

Definition at line 251 of file GsLib.hpp.

252{
253#ifdef NEKTAR_USE_MPI
254 int finalized;
255 MPI_Finalized(&finalized);
256 if (pGsh && !finalized)
257 {
258 nektar_gs_free(pGsh);
259 }
260#else
261 boost::ignore_unused(pGsh);
262#endif
263}
void nektar_gs_free(gs_data *gsh)

References nektar_gs_free().

Referenced by Nektar::MultiRegions::AssemblyMapCG::AssemblyMapCG(), Nektar::MultiRegions::AssemblyMapCG::CreateGraph(), export_SessionReader(), and Nektar::MultiRegions::AssemblyMapCG::~AssemblyMapCG().

◆ Gather()

static void Gs::Gather ( Nektar::Array< OneD, NekDouble pU,
gs_op  pOp,
gs_data pGsh,
Nektar::Array< OneD, NekDouble pBuffer = NullNekDouble1DArray 
)
inlinestatic

Performs a gather-scatter operation of the provided values.

The

Definition at line 270 of file GsLib.hpp.

273{
274#ifdef NEKTAR_USE_MPI
275 if (!pGsh)
276 {
277 return;
278 }
279 if (pBuffer.size() == 0)
280 {
281 nektar_gs(pU.get(), gs_double, pOp, false, pGsh, 0);
282 }
283 else
284 {
285 array buf;
286 buf.ptr = &pBuffer[0];
287 buf.n = pBuffer.size();
288 nektar_gs(pU.get(), gs_double, pOp, false, pGsh, &buf);
289 }
290#else
291 boost::ignore_unused(pU, pOp, pGsh, pBuffer);
292#endif
293}
void nektar_gs(void *u, gs_dom dom, gs_op op, unsigned transpose, gs_data *gsh, buffer *buf)

References gs_double, and nektar_gs().

Referenced by Nektar::MultiRegions::AssemblyMapCG::AssemblyMapCG(), Nektar::MultiRegions::PreconditionerBlock::BlockPreconditionerCG(), Nektar::MultiRegions::PreconditionerBlock::BlockPreconditionerHDG(), Nektar::MultiRegions::AssemblyMapCG::CreateGraph(), Nektar::PulseWaveSystem::EnforceInterfaceConditions(), Nektar::MultiRegions::AssemblyMap::LocalBndToGlobal(), Nektar::PulseWaveSystem::SetUpDomainInterfaces(), Nektar::MultiRegions::AssemblyMap::UniversalAbsMaxBnd(), Nektar::MultiRegions::AssemblyMap::UniversalAssembleBnd(), Nektar::MultiRegions::PreconditionerLowEnergy::v_BuildPreconditioner(), Nektar::MultiRegions::AssemblyMapCG::v_LocalToGlobal(), Nektar::MultiRegions::AssemblyMapCG::v_UniversalAssemble(), and Nektar::MultiRegions::AssemblyMapDG::v_UniversalAssemble().

◆ Init()

static gs_data * Gs::Init ( const Nektar::Array< OneD, long >  pId,
const LibUtilities::CommSharedPtr pComm,
bool  verbose = true 
)
inlinestatic

Initialise Gather-Scatter map.

On each process an array of IDs for each global degree of freedom is supplied which corresponds to a unique numbering of universal degrees of freedom. This is used to initialise the GSLib mapping between process- boundary degrees of freedom on different processes.

Parameters
pIdArray of integers providing universal IDs for each global DOF on the process.
pCommCommunication object used for inter-process communication.
Returns
GSLib data structure containing mapping information.

Definition at line 192 of file GsLib.hpp.

195{
196#ifdef NEKTAR_USE_MPI
197 if (pComm->IsSerial())
198 {
199 return 0;
200 }
202 std::dynamic_pointer_cast<LibUtilities::CommMpi>(pComm);
203 ASSERTL1(vCommMpi, "Failed to cast MPI Comm object.");
204 comm vComm;
205 MPI_Comm_dup(vCommMpi->GetComm(), &vComm.c);
206 vComm.id = vCommMpi->GetRank();
207 vComm.np = vCommMpi->GetSize();
208 gs_data *result = nektar_gs_setup(pId.get(), pId.size(), &vComm, 0, gs_auto,
209 (int)verbose);
210 MPI_Comm_free(&vComm.c);
211 return result;
212#else
213 boost::ignore_unused(pId, pComm, verbose);
214 return 0;
215#endif
216}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:249
gs_data * nektar_gs_setup(const long *id, unsigned int n, const struct comm *comm, int unique, gs_method method, int verbose)
std::shared_ptr< CommMpi > CommMpiSharedPtr
Pointer to a Communicator object.
Definition: CommMpi.h:58

References ASSERTL1, Gs::comm::c, gs_auto, Gs::comm::id, nektar_gs_setup(), and Gs::comm::np.

Referenced by Nektar::MultiRegions::AssemblyMapCG::AssemblyMapCG(), Nektar::MultiRegions::PreconditionerBlock::BlockPreconditionerCG(), Nektar::MultiRegions::PreconditionerBlock::BlockPreconditionerHDG(), Nektar::CoupledAssemblyMap::CoupledAssemblyMap(), Nektar::MultiRegions::AssemblyMapCG::CreateGraph(), Nektar::PulseWaveSystem::SetUpDomainInterfaces(), Nektar::MultiRegions::AssemblyMapCG::SetUpUniversalC0ContMap(), Nektar::MultiRegions::AssemblyMapDG::SetUpUniversalDGMap(), Nektar::MultiRegions::PreconditionerLowEnergy::v_BuildPreconditioner(), and Nektar::MultiRegions::AssemblyMapCG::v_LinearSpaceMap().

◆ nektar_gs()

void Gs::nektar_gs ( void *  u,
gs_dom  dom,
gs_op  op,
unsigned  transpose,
gs_data gsh,
buffer buf 
)

Referenced by Gather().

◆ nektar_gs_free()

void Gs::nektar_gs_free ( gs_data gsh)

Referenced by Finalise().

◆ nektar_gs_setup()

gs_data * Gs::nektar_gs_setup ( const long *  id,
unsigned int  n,
const struct comm comm,
int  unique,
gs_method  method,
int  verbose 
)

Referenced by Init().

◆ nektar_gs_unique()

void Gs::nektar_gs_unique ( const long *  id,
unsigned int  n,
const struct comm comm 
)

Referenced by Unique().

◆ Unique()

static void Gs::Unique ( const Nektar::Array< OneD, long >  pId,
const LibUtilities::CommSharedPtr pComm 
)
inlinestatic

Updates pId to negate all-but-one references to each universal ID.

The array of universal IDs corresponding to the process-local DOF are updated such that the ID of only one instance of each universal ID remains positive. This allows the consistent formulation of universally -distributed dot products, for which the contributions of each DOF must be included only once.

Definition at line 227 of file GsLib.hpp.

229{
230#ifdef NEKTAR_USE_MPI
231 if (pComm->IsSerial())
232 {
233 return;
234 }
236 std::dynamic_pointer_cast<LibUtilities::CommMpi>(pComm);
237 ASSERTL1(vCommMpi, "Failed to cast MPI Comm object.");
238 comm vComm;
239 vComm.c = vCommMpi->GetComm();
240 vComm.id = vCommMpi->GetRank();
241 vComm.np = vCommMpi->GetSize();
242 nektar_gs_unique(pId.get(), pId.size(), &vComm);
243#else
244 boost::ignore_unused(pId, pComm);
245#endif
246}
void nektar_gs_unique(const long *id, unsigned int n, const struct comm *comm)

References ASSERTL1, Gs::comm::c, Gs::comm::id, nektar_gs_unique(), and Gs::comm::np.

Referenced by Nektar::CoupledAssemblyMap::CoupledAssemblyMap(), Nektar::MultiRegions::AssemblyMapCG::SetUpUniversalC0ContMap(), Nektar::MultiRegions::AssemblyMapDG::SetUpUniversalDGMap(), and Nektar::MultiRegions::AssemblyMapCG::v_LinearSpaceMap().