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

Classes

struct  array
 
struct  comm
 
struct  pw_comm_data
 
struct  pw_data
 
struct  cr_stage
 
struct  cr_data
 
struct  allreduce_data
 
struct  gs_remote
 
struct  gs_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 61 of file GsLib.hpp.

◆ comm_ext

typedef int Gs::comm_ext

Definition at line 66 of file GsLib.hpp.

◆ comm_req

typedef int Gs::comm_req

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

◆ fin_fun

typedef void Gs::fin_fun(void *data)

Definition at line 118 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.

gs_dom
Definition: GsLib.hpp:52
@ gs_dom_n
Definition: GsLib.hpp:52
@ gs_int
Definition: GsLib.hpp:52
@ gs_double
Definition: GsLib.hpp:52
@ gs_long
Definition: GsLib.hpp:52
@ gs_float
Definition: GsLib.hpp:52

◆ gs_method

Enumerator
gs_auto 
gs_pairwise 
gs_crystal_router 
gs_all_reduce 

Definition at line 137 of file GsLib.hpp.

137  {
138  gs_auto,
139  gs_pairwise,
142 } gs_method;
gs_method
Definition: GsLib.hpp:137
@ gs_all_reduce
Definition: GsLib.hpp:141
@ gs_pairwise
Definition: GsLib.hpp:139
@ gs_crystal_router
Definition: GsLib.hpp:140
@ gs_auto
Definition: GsLib.hpp:138

◆ gs_mode

Enumerator
mode_plain 
mode_vec 
mode_many 
mode_dry_run 

Definition at line 54 of file GsLib.hpp.

gs_mode
Definition: GsLib.hpp:54
@ mode_vec
Definition: GsLib.hpp:54
@ mode_plain
Definition: GsLib.hpp:54
@ mode_dry_run
Definition: GsLib.hpp:54
@ mode_many
Definition: GsLib.hpp:54

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

gs_op
Definition: GsLib.hpp:53
@ gs_amax
Definition: GsLib.hpp:53
@ gs_add
Definition: GsLib.hpp:53
@ gs_max
Definition: GsLib.hpp:53
@ gs_bpr
Definition: GsLib.hpp:53
@ gs_min
Definition: GsLib.hpp:53
@ gs_op_n
Definition: GsLib.hpp:53
@ gs_mul
Definition: GsLib.hpp:53

Function Documentation

◆ Finalise()

static void Gs::Finalise ( gs_data pGsh)
inlinestatic

Deallocates the GSLib mapping data.

Definition at line 226 of file GsLib.hpp.

227 {
228 #ifdef NEKTAR_USE_MPI
229  int finalized;
230  MPI_Finalized(&finalized);
231  if (pGsh && !finalized)
232  {
233  nektar_gs_free(pGsh);
234  }
235 #else
236  boost::ignore_unused(pGsh);
237 #endif
238 }
void nektar_gs_free(gs_data *gsh)

References nektar_gs_free().

Referenced by Nektar::MultiRegions::AssemblyMapCG::AssemblyMapCG(), Nektar::MultiRegions::AssemblyMapCG::CreateGraph(), 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 245 of file GsLib.hpp.

248 {
249 #ifdef NEKTAR_USE_MPI
250  if (!pGsh)
251  {
252  return;
253  }
254  if (pBuffer.size() == 0)
255  {
256  nektar_gs(pU.get(), gs_double, pOp, false, pGsh, 0);
257  }
258  else
259  {
260  array buf;
261  buf.ptr = &pBuffer[0];
262  buf.n = pBuffer.size();
263  nektar_gs(pU.get(), gs_double, pOp, false, pGsh, &buf);
264  }
265 #else
266  boost::ignore_unused(pU, pOp, pGsh, pBuffer);
267 #endif
268 }
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::MultiRegions::AssemblyMap::LocalBndToGlobal(), 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 167 of file GsLib.hpp.

170 {
171 #ifdef NEKTAR_USE_MPI
172  if (pComm->IsSerial())
173  {
174  return 0;
175  }
177  std::dynamic_pointer_cast<LibUtilities::CommMpi>(pComm);
178  ASSERTL1(vCommMpi, "Failed to cast MPI Comm object.");
179  comm vComm;
180  MPI_Comm_dup(vCommMpi->GetComm(), &vComm.c);
181  vComm.id = vCommMpi->GetRank();
182  vComm.np = vCommMpi->GetSize();
183  gs_data *result = nektar_gs_setup(pId.get(), pId.size(), &vComm, 0,
184  gs_auto, (int)verbose);
185  MPI_Comm_free(&vComm.c);
186  return result;
187 #else
188  boost::ignore_unused(pId, pComm, verbose);
189  return 0;
190 #endif
191 }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:250
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:55

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

204 {
205 #ifdef NEKTAR_USE_MPI
206  if (pComm->IsSerial())
207  {
208  return;
209  }
211  std::dynamic_pointer_cast<LibUtilities::CommMpi>(pComm);
212  ASSERTL1(vCommMpi, "Failed to cast MPI Comm object.");
213  comm vComm;
214  vComm.c = vCommMpi->GetComm();
215  vComm.id = vCommMpi->GetRank();
216  vComm.np = vCommMpi->GetSize();
217  nektar_gs_unique(pId.get(), pId.size(), &vComm);
218 #else
219  boost::ignore_unused(pId, pComm);
220 #endif
221 }
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().