Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Nektar::LibUtilities::GatherScatterConfig Struct Reference

A gather-scatter method and discovery transport, as chosen on the command line. More...

#include <GatherScatter.h>

Public Member Functions

std::string Describe () const
 

Static Public Member Functions

static GatherScatterConfig FromSession (const SessionReaderSharedPtr &session)
 Read --gather-scatter and --gather-scatter-discovery from session. Anything not given keeps its default (gslib), as does everything for a null session.
 

Public Attributes

GatherScatterMethod method = GatherScatterMethod::eGslib
 
GatherScatterDiscovery discovery = GatherScatterDiscovery::eCrystalRouter
 

Detailed Description

A gather-scatter method and discovery transport, as chosen on the command line.

Definition at line 89 of file GatherScatter.h.

Member Function Documentation

◆ Describe()

std::string Nektar::LibUtilities::GatherScatterConfig::Describe ( ) const
Returns
A one-line description, e.g. for verbose output.

Definition at line 123 of file GatherScatter.cpp.

124{
126 {
127 return "gslib";
128 }
129
130 const std::string backend =
132 : method == GatherScatterMethod::eNeighbour ? "neighbour-collective"
133 : "crystal-router";
134 const std::string transport =
136 : "alltoallv";
137 return "SharedIdPlan (" + backend + " exchange, " + transport +
138 " discovery)";
139}
@ eNeighbour
SharedIdPlan over ExchangeBackend::eNeighbourCollective.
@ eGslib
gslib's gs_setup / gs_gather / gs_unique (the default)
@ ePairwise
SharedIdPlan over ExchangeBackend::ePairwise.
@ eCrystalRouter
CrystalRouterTransport: no O(P) arrays (the default)

References discovery, Nektar::LibUtilities::eCrystalRouter, Nektar::LibUtilities::eGslib, Nektar::LibUtilities::eNeighbour, Nektar::LibUtilities::ePairwise, and method.

◆ FromSession()

GatherScatterConfig Nektar::LibUtilities::GatherScatterConfig::FromSession ( const SessionReaderSharedPtr &  session)
static

Read --gather-scatter and --gather-scatter-discovery from session. Anything not given keeps its default (gslib), as does everything for a null session.

Definition at line 61 of file GatherScatter.cpp.

63{
64 GatherScatterConfig config;
65 if (!session)
66 {
67 return config;
68 }
69
70 if (session->DefinesCmdLineArgument(cmdMethod))
71 {
72 const std::string m =
73 session->GetCmdLineArgument<std::string>(cmdMethod);
74 if (m == "gslib")
75 {
76 config.method = GatherScatterMethod::eGslib;
77 }
78 else if (m == "pairwise")
79 {
80 config.method = GatherScatterMethod::ePairwise;
81 }
82 else if (m == "neighbour")
83 {
84 config.method = GatherScatterMethod::eNeighbour;
85 }
86 else if (m == "crystal")
87 {
88 config.method = GatherScatterMethod::eCrystal;
89 }
90 else
91 {
93 "--gather-scatter must be one of gslib, pairwise, "
94 "neighbour or crystal; got '" +
95 m + "'.");
96 }
97 }
98
99 if (session->DefinesCmdLineArgument(cmdDiscovery))
100 {
101 const std::string d =
102 session->GetCmdLineArgument<std::string>(cmdDiscovery);
103 if (d == "crystal")
104 {
106 }
107 else if (d == "a2a")
108 {
109 config.discovery = GatherScatterDiscovery::eAlltoallv;
110 }
111 else
112 {
113 NEKERROR(
115 "--gather-scatter-discovery must be crystal or a2a; got '" + d +
116 "'.");
117 }
118 }
119
120 return config;
121}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
LibUtilities::SessionReaderSharedPtr session
@ eCrystal
SharedIdPlan replaying through a CrystalRouterTransport.
std::vector< double > d(NPUPPER *NPUPPER)

References discovery, Nektar::LibUtilities::eAlltoallv, Nektar::LibUtilities::eCrystal, Nektar::LibUtilities::eCrystalRouter, Nektar::ErrorUtil::efatal, Nektar::LibUtilities::eGslib, Nektar::LibUtilities::eNeighbour, Nektar::LibUtilities::ePairwise, method, NEKERROR, and session.

Member Data Documentation

◆ discovery

GatherScatterDiscovery Nektar::LibUtilities::GatherScatterConfig::discovery = GatherScatterDiscovery::eCrystalRouter

Definition at line 92 of file GatherScatter.h.

Referenced by Describe(), and FromSession().

◆ method

GatherScatterMethod Nektar::LibUtilities::GatherScatterConfig::method = GatherScatterMethod::eGslib