Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_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)
 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

typedef array Gs::buffer

Definition at line 56 of file GsLib.hpp.

typedef int Gs::comm_ext

Definition at line 61 of file GsLib.hpp.

typedef int Gs::comm_req

Definition at line 62 of file GsLib.hpp.

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

typedef void Gs::fin_fun(void *data)

Definition at line 107 of file GsLib.hpp.

Enumeration Type Documentation

enum Gs::gs_dom
Enumerator
gs_double 
gs_float 
gs_int 
gs_long 
gs_dom_n 

Definition at line 51 of file GsLib.hpp.

Enumerator
gs_auto 
gs_pairwise 
gs_crystal_router 
gs_all_reduce 

Definition at line 124 of file GsLib.hpp.

Enumerator
mode_plain 
mode_vec 
mode_many 
mode_dry_run 

Definition at line 53 of file GsLib.hpp.

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

Definition at line 52 of file GsLib.hpp.

Function Documentation

static void Gs::Finalise ( gs_data *  pGsh)
inlinestatic

Deallocates the GSLib mapping data.

Definition at line 205 of file GsLib.hpp.

References nektar_gs_free().

Referenced by Nektar::MultiRegions::AssemblyMapCG::AssemblyMapCG(), Nektar::MultiRegions::AssemblyMapCG::CreateGraph(), Nektar::LibUtilities::SessionReader::PartitionMesh(), and Nektar::MultiRegions::AssemblyMapCG::~AssemblyMapCG().

206  {
207 #ifdef NEKTAR_USE_MPI
208  int finalized;
209  MPI_Finalized(&finalized);
210  if (pGsh && !finalized)
211  {
212  nektar_gs_free(pGsh);
213  }
214 #endif
215  }
void nektar_gs_free(gs_data *gsh)
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 223 of file GsLib.hpp.

References gs_double, Gs::array::n, nektar_gs(), and Gs::array::ptr.

Referenced by Nektar::MultiRegions::AssemblyMapCG::AssemblyMapCG(), Nektar::MultiRegions::PreconditionerBlock::BlockPreconditionerCG(), Nektar::MultiRegions::PreconditionerBlock::BlockPreconditionerHDG(), Nektar::MultiRegions::AssemblyMapCG::CreateGraph(), Nektar::MultiRegions::AssemblyMap::UniversalAssembleBnd(), Nektar::MultiRegions::AssemblyMapDG::UniversalTraceAssemble(), Nektar::MultiRegions::PreconditionerLowEnergy::v_BuildPreconditioner(), Nektar::MultiRegions::AssemblyMapCG::v_LocalToGlobal(), Nektar::MultiRegions::AssemblyMapDG::v_UniversalAssemble(), and Nektar::MultiRegions::AssemblyMapCG::v_UniversalAssemble().

226  {
227 #ifdef NEKTAR_USE_MPI
228  if (!pGsh)
229  {
230  return;
231  }
232  if (pBuffer.num_elements() == 0)
233  {
234  nektar_gs(pU.get(), gs_double, pOp, false, pGsh, 0);
235  }
236  else
237  {
238  array buf;
239  buf.ptr = &pBuffer[0];
240  buf.n = pBuffer.num_elements();
241  nektar_gs(pU.get(), gs_double, pOp, false, pGsh, &buf);
242  }
243 #endif
244  }
void nektar_gs(void *u, gs_dom dom, gs_op op, unsigned transpose, gs_data *gsh, buffer *buf)
static gs_data* Gs::Init ( const Nektar::Array< OneD, long >  pId,
const LibUtilities::CommSharedPtr pComm 
)
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 150 of file GsLib.hpp.

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::AssemblyMapDG::SetUpUniversalTraceMap(), Nektar::MultiRegions::PreconditionerLowEnergy::v_BuildPreconditioner(), and Nektar::MultiRegions::AssemblyMapCG::v_LinearSpaceMap().

152  {
153 #ifdef NEKTAR_USE_MPI
154  if (pComm->GetSize() == 1)
155  {
156  return 0;
157  }
158  LibUtilities::CommMpiSharedPtr vCommMpi = boost::dynamic_pointer_cast<LibUtilities::CommMpi> (pComm);
159  ASSERTL1(vCommMpi, "Failed to cast MPI Comm object.");
160  comm vComm;
161  MPI_Comm_dup(vCommMpi->GetComm(), &vComm.c);
162  vComm.id = vCommMpi->GetRank();
163  vComm.np = vCommMpi->GetSize();
164  gs_data* result = nektar_gs_setup(pId.get(),pId.num_elements(),
165  &vComm, 0, gs_auto, 1);
166  MPI_Comm_free(&vComm.c);
167  return result;
168 #else
169  return 0;
170 #endif
171  }
gs_data * nektar_gs_setup(const long *id, unsigned int n, const struct comm *comm, int unique, gs_method method, int verbose)
boost::shared_ptr< CommMpi > CommMpiSharedPtr
Pointer to a Communicator object.
Definition: CommMpi.h:55
A global linear system.
Definition: CommMpi.h:61
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Gs::nektar_gs ( void *  u,
gs_dom  dom,
gs_op  op,
unsigned  transpose,
gs_data *  gsh,
buffer *  buf 
)

Referenced by Gather().

void Gs::nektar_gs_free ( gs_data *  gsh)

Referenced by Finalise().

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().

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

Referenced by 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 183 of file GsLib.hpp.

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(), Nektar::MultiRegions::AssemblyMapDG::SetUpUniversalTraceMap(), and Nektar::MultiRegions::AssemblyMapCG::v_LinearSpaceMap().

185  {
186 #ifdef NEKTAR_USE_MPI
187  if (pComm->GetSize() == 1)
188  {
189  return;
190  }
191  LibUtilities::CommMpiSharedPtr vCommMpi = boost::dynamic_pointer_cast<LibUtilities::CommMpi> (pComm);
192  ASSERTL1(vCommMpi, "Failed to cast MPI Comm object.");
193  comm vComm;
194  vComm.c = vCommMpi->GetComm();
195  vComm.id = vCommMpi->GetRank();
196  vComm.np = vCommMpi->GetSize();
197  nektar_gs_unique(pId.get(), pId.num_elements(), &vComm);
198 #endif
199  }
void nektar_gs_unique(const long *id, unsigned int n, const struct comm *comm)
boost::shared_ptr< CommMpi > CommMpiSharedPtr
Pointer to a Communicator object.
Definition: CommMpi.h:55
A global linear system.
Definition: CommMpi.h:61
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191