90 DKSOPAL *IpplInfo::DKS =
new DKSOPAL(
"Cuda",
"-gpu");
93 #ifdef IPPL_DKS_OPENCL
94 DKSOPAL *IpplInfo::DKS =
new DKSOPAL(
"OpenCL",
"-gpu");
98 DKSOPAL *IpplInfo::DKS =
new DKSOPAL(
"OpenMP",
"-mic");
136 #ifdef IPPL_COMM_ALARMS
141 unsigned int IpplInfo::CommTimeoutSeconds = 0;
148 o <<
"------------------------------------------\n";
149 o <<
"IPPL Framework Application Summary:\n";
156 o <<
" Communication method: " << IpplInfo::Comm->
name() <<
"\n";
158 o <<
" Deferring guard cell fills? ";
160 o <<
" Turning off Field compression? ";
162 o <<
" Offsetting storage? ";
164 o <<
" Using extra compression checks in expressions? ";
166 o <<
" Use per-SMP parallel IO? ";
168 o <<
" Computing message CRC checksums? ";
170 o <<
" Retransmit messages on error (only if checkums on)? ";
177 #ifdef IPPL_COMM_ALARMS
178 if (IpplInfo::getCommTimeout() > 0) {
179 o <<
" Allowed message receive timeout length (in seconds): ";
180 o << IpplInfo::getCommTimeout() <<
"\n";
184 o <<
" Elapsed wall-clock time (in seconds): ";
186 o <<
" Elapsed CPU-clock time (in seconds) : ";
188 o <<
"------------------------------------------\n";
201 int connectoption = (-1);
204 bool printsummary =
false;
209 bool stripargs = (removeargs !=
KEEP);
234 std::string commtype;
235 bool startcomm =
false;
236 bool comminit =
true;
244 commtype = std::string(
"mpi");
247 for (i=1; i < argc; ++i) {
248 if ( ( strcmp(argv[i],
"--processes") == 0 ) ||
249 ( strcmp(argv[i],
"-procs") == 0 ) ) {
252 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) > 0 )
253 nprocs = atoi(argv[++i]);
256 "Please specify a positive number of processes", 0);
257 }
else if ( ( strcmp(argv[i],
"--commlib") == 0 ) ||
258 ( strcmp(argv[i],
"-comm") == 0 ) ) {
260 if ( (i + 1) < argc && argv[i+1][0] !=
'-' ) {
261 commtype = argv[++i];
269 }
else if ( strcmp(argv[i],
"--nocomminit") == 0 ) {
279 if (startcomm && nprocs != 0 && nprocs != 1) {
284 nprocs, comminit, mpicomm);
288 param_error(
"--commlib",
"Could not initialize this ",
289 "communication library.", commtype.c_str());
291 param_error(
"--commlib",
"This communication library is not ",
292 "available.", commtype.c_str());
321 retargv =
new char*[argc];
322 retargv[0] = argv[0];
326 for (i=1; i < argc; ++i)
327 retargv[retargc++] = argv[i];
332 for (i=1; i < argc; ++i) {
333 if ( ( strcmp(argv[i],
"--processes") == 0 ) ||
334 ( strcmp(argv[i],
"-procs") == 0 ) ) {
336 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) > 0 )
339 }
else if ( ( strcmp(argv[i],
"--nocomminit") == 0 ) ) {
342 }
else if ( ( strcmp(argv[i],
"--summary") == 0 ) ) {
347 }
else if ( ( strcmp(argv[i],
"--ipplversion") == 0 ) ) {
350 std::string header(
"Compile-time options: ");
351 while (options.length() > 58) {
352 std::string line = options.substr(0, 58);
353 size_t n = line.find_last_of(
' ');
354 INFOMSG(header << line.substr(0, n) <<
"\n");
356 header = std::string(22,
' ');
357 options = options.substr(n + 1);
362 }
else if ( ( strcmp(argv[i],
"--checksums") == 0 ) ||
363 ( strcmp(argv[i],
"--checksum") == 0 ) ) {
366 }
else if ( ( strcmp(argv[i],
"--retransmit") == 0 ) ) {
369 }
else if ( ( strcmp(argv[i],
"--ipplversionall") == 0 ) ||
370 ( strcmp(argv[i],
"-vall") == 0 ) ) {
373 std::string header(
"Compile-time options: ");
374 while (options.length() > 58) {
375 std::string line = options.substr(0, 58);
376 size_t n = line.find_last_of(
' ');
377 INFOMSG(header << line.substr(0, n) <<
"\n");
379 header = std::string(22,
' ');
380 options = options.substr(n + 1);
385 }
else if ( ( strcmp(argv[i],
"--time") == 0 ) ||
386 ( strcmp(argv[i],
"-time") == 0 ) ||
387 ( strcmp(argv[i],
"--statistics") == 0 ) ||
388 ( strcmp(argv[i],
"-stats") == 0 ) ) {
393 }
else if ( ( strcmp(argv[i],
"--info") == 0 ) ) {
395 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 )
399 "Please specify an output level from 0 to 5", 0);
401 }
else if ( ( strcmp(argv[i],
"--use-dks") == 0 ) ) {
405 DKS->getDeviceCount(ndev);
408 INFOMSG(
"DKS enabled OPAL will use GPU where possible");
412 INFOMSG(
"No GPU device detected! --use-dks flag will have no effect");
418 INFOMSG(
"OPAL compiled without DKS, " << argv[i] <<
" flag has no effect");
422 }
else if ( ( strcmp(argv[i],
"--warn") == 0 ) ) {
424 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 )
428 "Please specify an output level from 0 to 5", 0);
430 }
else if ( ( strcmp(argv[i],
"--error") == 0 ) ) {
432 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 )
436 "Please specify an output level from 0 to 5", 0);
438 }
else if ( ( strcmp(argv[i],
"--debug") == 0 ) ) {
440 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 )
444 "Please specify an output level from 0 to 5", 0);
446 }
else if ( ( strcmp(argv[i],
"--connect") == 0 ) ) {
448 if ( (i + 1) < argc && argv[i+1][0] !=
'-' )
454 }
else if ( ( strcmp(argv[i],
"--connectnodes") == 0 ) ) {
456 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) > 0 )
460 "Please specify a number of nodes for connections > 0",
463 }
else if ( ( strcmp(argv[i],
"--commlib") == 0 ) ||
464 ( strcmp(argv[i],
"-comm") == 0 ) ) {
466 if ( (i + 1) < argc && argv[i+1][0] !=
'-' )
469 }
else if ( strcmp(argv[i],
"--profile") == 0 ) {
471 if ( (i + 1) < argc && argv[i+1][0] !=
'-' )
474 }
else if ( ( strcmp(argv[i],
"--persmppario") == 0 ) ) {
478 }
else if ( ( strcmp(argv[i],
"--nopersmppario") == 0 ) ) {
482 }
else if ( ( strcmp(argv[i],
"--chunksize") == 0 ) ) {
485 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 ) {
487 char units =
static_cast<char>(toupper(argv[i][strlen(argv[i])-1]));
490 else if (units ==
'M')
492 else if (units ==
'G')
496 "Please specify a timeout value (in seconds)", 0);
498 #ifdef IPPL_COMM_ALARMS
499 }
else if ( ( strcmp(argv[i],
"--msgtimeout") == 0 ) ) {
501 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 )
502 CommTimeoutSeconds = atoi(argv[++i]);
505 "Please specify a timeout value (in seconds)", 0);
508 }
else if ( ( strcmp(argv[i],
"--defergcfill") == 0 ) ) {
512 }
else if ( ( strcmp(argv[i],
"--offsetstorage") == 0 ) ) {
516 }
else if ( ( strcmp(argv[i],
"--extracompcheck") == 0 ) ) {
520 }
else if ( ( strcmp(argv[i],
"--nofieldcompression") == 0 ) ) {
524 }
else if ( ( strcmp(argv[i],
"--directio") == 0 ) ) {
530 "Direct-IO is not available in this build of IPPL", 0);
532 }
else if ( ( strcmp(argv[i],
"--maxfftnodes") == 0 ) ) {
534 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) > 0 )
538 "Please specify a maximum number of FFT nodes > 0", 0);
540 }
else if ( ( strcmp(argv[i],
"--ipplhelp") == 0 ) ||
541 ( strcmp(argv[i],
"-h") == 0 ) ||
542 ( strcmp(argv[i],
"-?") == 0 ) ) {
545 INFOMSG(
" --ipplversion : Print a brief version summary.\n");
546 INFOMSG(
" --ipplversionall : Print a detailed version summary.\n");
547 INFOMSG(
" --ipplhelp : Display this command-line summary.\n");
555 retargv[retargc++] = argv[i];
562 if ( connectoption >= 0 ) {
565 param_error(argv[connectoption - 1],
"Could not initialize this ",
566 "connection.", argv[connectoption]);
568 param_error(argv[connectoption - 1],
"This connection method is not ",
569 "available.", argv[connectoption]);
571 param_error(argv[connectoption - 1],
"Please use one of: ",
717 throw std::runtime_error(
"Error form IpplInfo::abort");
744 throw std::runtime_error(
"Error form IpplInfo::abortAllNodes");
851 INFOMSG(
"Usage: " << argv[0] <<
" [<option> <option> ...]\n");
852 INFOMSG(
" The possible values for <option> are:\n");
853 INFOMSG(
" --summary : Print IPPL lib summary at start.\n");
854 INFOMSG(
" --processes <n> : Number of parallel nodes to use.\n");
855 INFOMSG(
" --commlib <x> : Selects a parallel comm. library.\n");
858 INFOMSG(
" --nocomminit : IPPL does not do communication\n");
859 INFOMSG(
" initialization, assume already done.\n");
860 INFOMSG(
" --connect <x> : Select external connection method.\n");
863 INFOMSG(
" --time : Show total time used in execution.\n");
864 INFOMSG(
" --notime : Do not show timing info (default).\n");
865 INFOMSG(
" --info <n> : Set info message level. 0 = off.\n");
866 INFOMSG(
" --warn <n> : Set warning message level. 0 = off.\n");
867 INFOMSG(
" --error <n> : Set error message level. 0 = off.\n");
868 INFOMSG(
" --debug <n> : Set debug message level. 0 = off.\n");
877 INFOMSG(
" --defergcfill : Turn on deferred guard cell fills.\n");
878 INFOMSG(
" --nofieldcompression: Turn off compression in the Field classes.\n");
879 INFOMSG(
" --offsetstorage : Turn on random LField storage offsets.\n");
880 INFOMSG(
" --extracompcheck : Turn on extra compression checks in evaluator.\n");
881 #ifdef IPPL_COMM_ALARMS
882 INFOMSG(
" --msgtimeout <n> : Set receive timeout time, in secs.\n");
884 INFOMSG(
" --checksums : Turn on CRC checksums for messages.\n");
885 INFOMSG(
" --retransmit : Resent messages if a CRC error occurs.\n");
886 INFOMSG(
" --maxfftnodes <n> : Limit the nodes that work on FFT's.\n");
887 INFOMSG(
" --chunksize <n> : Set I/O chunk size. Can end w/K,M,G.\n");
888 INFOMSG(
" --persmppario : Enable on-SMP parallel IO option.\n");
889 INFOMSG(
" --nopersmppario : Disable on-SMP parallel IO option (default).\n");
891 INFOMSG(
" --directio : Use Direct-IO if possible.\n");
980 const char *msg2,
const char *bad) {
1016 if (gethostname(name, 1023) != 0) {
1017 ERRORMSG(
"Could not get hostname ... using localhost." <<
endl);
1018 strcpy(name,
"localhost");
1020 std::string NodeName(name,strlen(name));
1036 PInsist(msg != 0 && node == 0,
1037 "SPMDList map not received from master in IpplInfo::find_smp_nodes!!");
1050 while (unreceived-- > 0) {
1055 "Hostname not received by master in IpplInfo::find_smp_nodes!!");
1056 std::string nodename;
1062 smpiter = smpMap.
find(nodename);
1063 if (smpiter == smpMap.
end())
1071 for (
int smpindx = 0; (
unsigned int) smpindx < smpMap.
size(); ++smpindx) {
1136 #ifdef IPPL_COMM_ALARMS
1137 obj.CommTimeoutSeconds = CommTimeoutSeconds;
1219 #ifdef IPPL_COMM_ALARMS
1220 CommTimeoutSeconds = obj.CommTimeoutSeconds;
1224 #ifdef IPPL_RUNTIME_ERRCHECK
1227 void __C_runtime_error (
int trap_code,
char *
name,
int line_no, ... ) {
1228 switch ( trap_code ) {
1231 fprintf ( stderr,
"error: Subscript range violation" );
1236 fprintf ( stderr,
"error: Trap %d ", trap_code );
1240 fprintf ( stderr,
" in '%s'", name);
1241 if ( line_no != -1 )
1242 fprintf ( stderr,
" (line %d)", line_no );
static int getProcesses(int, int)
static bool extraCompressChecks
std::ostream & operator<<(std::ostream &os, const Attribute &attr)
std::pair< iterator, bool > insert(const value_type &x)
const char * ippl_compile_options
static void abort(const char *=0, int exitcode=(-1))
static void param_error(const char *, const char *, const char *)
static bool PerSMPParallelIO
static void deleteGlobals()
static bool setDefaultMethod(int)
const char * ippl_compile_machine
int getContexts(const int n) const
const char * ippl_compile_line
void AdvanceSeed(int adv=0)
IpplInfo & operator=(const IpplInfo &)
RandomNumberGen IpplRandom
static void setDefaultNodes(int)
void getMessage_iter(Message &m, OutputIterator o)
#define IPPL_MAKE_HOST_MAP_TAG
int next_tag(int t, int s=1000)
static std::stack< StaticIpplInfo > stashedStaticMembers
static bool supported(int)
static bool deferGuardCellFills
static bool offsetStorage
static Communicate * create(int, int &, char **&, int=(-1), bool=true, MPI_Comm mpicomm=MPI_COMM_WORLD)
static bool noFieldCompression
static bool CommInitialized
const char * ippl_compile_arch
static const char * version()
static const char * compileUser()
static void printVersion(bool=false)
static bool useChecksums()
static const char * getAllMethodNames()
static void instantiateGlobals()
constexpr double c
The velocity of light in m/s.
static const char * compileArch()
virtual int broadcast_others(Message *, int, bool delmsg=true)
static const char * compileLine()
static void abortAllNodes(const char *=0, bool thisnode=true)
Inform & setOutputLevel(const int)
static const char * getAllLibraryNames()
std::pair< Key, T > value_type
const char * ippl_compile_user
static bool supported(int)
static void printHelp(char **argv)
int getProcesses(const int n, const int c) const
static const char * compileOptions()
const char * ippl_compile_date
static const char * compileMachine()
static void find_smp_nodes()
void getMessage(Message &m, T &t)
static void printStatistics(Inform &)
Inform & level3(Inform &inf)
void putMessage(Message &m, const T &t)
const char * ippl_version_name
static bool NeedDeleteComm
static int getSMPNodes(int)
rep_type::iterator iterator
Message * receive_block(int &node, int &tag)
virtual const char * name() const
static Communicate * Comm
iterator find(const key_type &x)
bool send(Message *, int node, int tag, bool delmsg=true)
static void exitAllNodes(const char *=0, bool thisnode=true)
static const char * compileDate()
Inform & endl(Inform &inf)
static MPI_Comm communicator_m
static int getContexts(int)
static bool known(const char *nm)
static bool perSMPParallelIO()