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 81 of file GsLib.hpp.

◆ comm_ext

typedef int Gs::comm_ext

Definition at line 86 of file GsLib.hpp.

◆ comm_req

typedef int Gs::comm_req

Definition at line 87 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 135 of file GsLib.hpp.

◆ fin_fun

typedef void Gs::fin_fun(void *data)

Definition at line 138 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 50 of file GsLib.hpp.

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

◆ gs_method

Enumerator
gs_auto 
gs_pairwise 
gs_crystal_router 
gs_all_reduce 

Definition at line 157 of file GsLib.hpp.

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

◆ gs_mode

Enumerator
mode_plain 
mode_vec 
mode_many 
mode_dry_run 

Definition at line 68 of file GsLib.hpp.

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

◆ 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 58 of file GsLib.hpp.

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

Function Documentation

◆ Finalise()

static void Gs::Finalise ( gs_data pGsh)
inlinestatic

Deallocates the GSLib mapping data.

Definition at line 248 of file GsLib.hpp.

249{
250#ifdef NEKTAR_USE_MPI
251 int finalized;
252 MPI_Finalized(&finalized);
253 if (pGsh && !finalized)
254 {
255 nektar_gs_free(pGsh);
256 }
257#endif
258}
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 265 of file GsLib.hpp.

270{
271#ifdef NEKTAR_USE_MPI
272 if (!pGsh)
273 {
274 return;
275 }
276 if (pBuffer.size() == 0)
277 {
278 nektar_gs(pU.get(), gs_double, pOp, false, pGsh, nullptr);
279 }
280 else
281 {
282 array buf;
283 buf.ptr = &pBuffer[0];
284 buf.n = pBuffer.size();
285 nektar_gs(pU.get(), gs_double, pOp, false, pGsh, &buf);
286 }
287#endif
288}
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 190 of file GsLib.hpp.

194{
195#ifdef NEKTAR_USE_MPI
196 if (pComm->IsSerial())
197 {
198 return nullptr;
199 }
201 std::dynamic_pointer_cast<LibUtilities::CommMpi>(pComm);
202 ASSERTL1(vCommMpi, "Failed to cast MPI Comm object.");
203 comm vComm;
204 MPI_Comm_dup(vCommMpi->GetComm(), &vComm.c);
205 vComm.id = vCommMpi->GetRank();
206 vComm.np = vCommMpi->GetSize();
207 gs_data *result = nektar_gs_setup(pId.get(), pId.size(), &vComm, 0, gs_auto,
208 (int)verbose);
209 MPI_Comm_free(&vComm.c);
210 return result;
211#else
212 return 0;
213#endif
214}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
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:56

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 225 of file GsLib.hpp.

228{
229#ifdef NEKTAR_USE_MPI
230 if (pComm->IsSerial())
231 {
232 return;
233 }
235 std::dynamic_pointer_cast<LibUtilities::CommMpi>(pComm);
236 ASSERTL1(vCommMpi, "Failed to cast MPI Comm object.");
237 comm vComm;
238 vComm.c = vCommMpi->GetComm();
239 vComm.id = vCommMpi->GetRank();
240 vComm.np = vCommMpi->GetSize();
241 nektar_gs_unique(pId.get(), pId.size(), &vComm);
242#endif
243}
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().