38#include "IpplVersions.h"
120 o <<
"------------------------------------------\n";
121 o <<
"IPPL Framework Application Summary:\n";
130 o <<
" Deferring guard cell fills? ";
132 o <<
" Turning off Field compression? ";
134 o <<
" Offsetting storage? ";
136 o <<
" Using extra compression checks in expressions? ";
138 o <<
" Use per-SMP parallel IO? ";
140 o <<
" Computing message CRC checksums? ";
142 o <<
" Retransmit messages on error (only if checkums on)? ";
145 o <<
" Elapsed wall-clock time (in seconds): ";
147 o <<
" Elapsed CPU-clock time (in seconds) : ";
149 o <<
"------------------------------------------\n";
162 int connectoption = (-1);
165 bool printsummary =
false;
170 bool stripargs = (removeargs !=
KEEP);
195 std::string commtype;
196 bool startcomm =
false;
197 bool comminit =
true;
205 commtype = std::string(
"mpi");
208 for (i=1; i < argc; ++i) {
209 if ( ( strcmp(argv[i],
"--processes") == 0 ) ||
210 ( strcmp(argv[i],
"-procs") == 0 ) ) {
213 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) > 0 )
214 nprocs = atoi(argv[++i]);
217 "Please specify a positive number of processes", 0);
218 }
else if ( ( strcmp(argv[i],
"--commlib") == 0 ) ||
219 ( strcmp(argv[i],
"-comm") == 0 ) ) {
221 if ( (i + 1) < argc && argv[i+1][0] !=
'-' ) {
222 commtype = argv[++i];
230 }
else if ( strcmp(argv[i],
"--nocomminit") == 0 ) {
240 if (startcomm && nprocs != 0 && nprocs != 1) {
245 nprocs, comminit, mpicomm);
249 param_error(
"--commlib",
"Could not initialize this ",
250 "communication library.", commtype.c_str());
252 param_error(
"--commlib",
"This communication library is not ",
253 "available.", commtype.c_str());
282 retargv =
new char*[argc];
283 retargv[0] = argv[0];
287 for (i=1; i < argc; ++i)
288 retargv[retargc++] = argv[i];
293 for (i=1; i < argc; ++i) {
294 if ( ( strcmp(argv[i],
"--processes") == 0 ) ||
295 ( strcmp(argv[i],
"-procs") == 0 ) ) {
297 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) > 0 )
300 }
else if ( ( strcmp(argv[i],
"--nocomminit") == 0 ) ) {
303 }
else if ( ( strcmp(argv[i],
"--summary") == 0 ) ) {
308 }
else if ( ( strcmp(argv[i],
"--ipplversion") == 0 ) ) {
311 std::string header(
"Compile-time options: ");
312 while (options.length() > 58) {
313 std::string line = options.substr(0, 58);
314 size_t n = line.find_last_of(
' ');
315 INFOMSG(header << line.substr(0, n) <<
"\n");
317 header = std::string(22,
' ');
318 options = options.substr(n + 1);
323 }
else if ( ( strcmp(argv[i],
"--checksums") == 0 ) ||
324 ( strcmp(argv[i],
"--checksum") == 0 ) ) {
327 }
else if ( ( strcmp(argv[i],
"--retransmit") == 0 ) ) {
330 }
else if ( ( strcmp(argv[i],
"--ipplversionall") == 0 ) ||
331 ( strcmp(argv[i],
"-vall") == 0 ) ) {
334 std::string header(
"Compile-time options: ");
335 while (options.length() > 58) {
336 std::string line = options.substr(0, 58);
337 size_t n = line.find_last_of(
' ');
338 INFOMSG(header << line.substr(0, n) <<
"\n");
340 header = std::string(22,
' ');
341 options = options.substr(n + 1);
346 }
else if ( ( strcmp(argv[i],
"--time") == 0 ) ||
347 ( strcmp(argv[i],
"-time") == 0 ) ||
348 ( strcmp(argv[i],
"--statistics") == 0 ) ||
349 ( strcmp(argv[i],
"-stats") == 0 ) ) {
354 }
else if ( ( strcmp(argv[i],
"--info") == 0 ) ) {
356 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 )
360 "Please specify an output level from 0 to 5", 0);
362 }
else if ( ( strcmp(argv[i],
"--warn") == 0 ) ) {
364 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 )
368 "Please specify an output level from 0 to 5", 0);
370 }
else if ( ( strcmp(argv[i],
"--error") == 0 ) ) {
372 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 )
376 "Please specify an output level from 0 to 5", 0);
378 }
else if ( ( strcmp(argv[i],
"--debug") == 0 ) ) {
380 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 )
384 "Please specify an output level from 0 to 5", 0);
386 }
else if ( ( strcmp(argv[i],
"--connect") == 0 ) ) {
388 if ( (i + 1) < argc && argv[i+1][0] !=
'-' )
394 }
else if ( ( strcmp(argv[i],
"--connectnodes") == 0 ) ) {
396 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) > 0 )
400 "Please specify a number of nodes for connections > 0",
403 }
else if ( ( strcmp(argv[i],
"--commlib") == 0 ) ||
404 ( strcmp(argv[i],
"-comm") == 0 ) ) {
406 if ( (i + 1) < argc && argv[i+1][0] !=
'-' )
409 }
else if ( strcmp(argv[i],
"--profile") == 0 ) {
411 if ( (i + 1) < argc && argv[i+1][0] !=
'-' )
414 }
else if ( ( strcmp(argv[i],
"--persmppario") == 0 ) ) {
418 }
else if ( ( strcmp(argv[i],
"--nopersmppario") == 0 ) ) {
422 }
else if ( ( strcmp(argv[i],
"--chunksize") == 0 ) ) {
425 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) >= 0 ) {
427 char units =
static_cast<char>(toupper(argv[i][strlen(argv[i])-1]));
430 else if (units ==
'M')
432 else if (units ==
'G')
436 "Please specify a timeout value (in seconds)", 0);
438 }
else if ( ( strcmp(argv[i],
"--defergcfill") == 0 ) ) {
442 }
else if ( ( strcmp(argv[i],
"--offsetstorage") == 0 ) ) {
446 }
else if ( ( strcmp(argv[i],
"--extracompcheck") == 0 ) ) {
450 }
else if ( ( strcmp(argv[i],
"--nofieldcompression") == 0 ) ) {
454 }
else if ( ( strcmp(argv[i],
"--directio") == 0 ) ) {
457 "Direct-IO is not available in this build of IPPL", 0);
458 }
else if ( ( strcmp(argv[i],
"--maxfftnodes") == 0 ) ) {
460 if ( (i + 1) < argc && argv[i+1][0] !=
'-' && atoi(argv[i+1]) > 0 )
464 "Please specify a maximum number of FFT nodes > 0", 0);
466 }
else if ( ( strcmp(argv[i],
"--ipplhelp") == 0 ) ||
467 ( strcmp(argv[i],
"-h") == 0 ) ||
468 ( strcmp(argv[i],
"-?") == 0 ) ) {
470 INFOMSG(
"Usage: " << argv[0] <<
" [<option> <option> ...]\n");
471 INFOMSG(
" The possible values for <option> are:\n");
473 INFOMSG(
" --ipplversion : Print a brief version summary.\n");
474 INFOMSG(
" --ipplversionall : Print a detailed version summary.\n");
475 INFOMSG(
" --ipplhelp : Display this command-line summary.\n");
482 retargv[retargc++] = argv[i];
489 if ( connectoption >= 0 ) {
492 param_error(argv[connectoption - 1],
"Could not initialize this ",
493 "connection.", argv[connectoption]);
495 param_error(argv[connectoption - 1],
"This connection method is not ",
496 "available.", argv[connectoption]);
498 param_error(argv[connectoption - 1],
"Please use one of: ",
629 int nframes = backtrace(frames, 64);
631 <<
", backtrace (" << nframes <<
" frames):" <<
endl);
632 backtrace_symbols_fd(frames, nframes, STDERR_FILENO);
656 throw std::runtime_error(
"Error form IpplInfo::abort");
683 throw std::runtime_error(
"Error form IpplInfo::abortAllNodes");
697 return Comm->getContexts(n);
704 return Comm->getProcesses(n, c);
764 INFOMSG(
" --summary : Print IPPL lib summary at start.\n");
765 INFOMSG(
" --processes <n> : Number of parallel nodes to use.\n");
766 INFOMSG(
" --commlib <x> : Selects a parallel comm. library.\n");
769 INFOMSG(
" --nocomminit : IPPL does not do communication\n");
770 INFOMSG(
" initialization, assume already done.\n");
771 INFOMSG(
" --connect <x> : Select external connection method.\n");
774 INFOMSG(
" --time : Show total time used in execution.\n");
775 INFOMSG(
" --notime : Do not show timing info (default).\n");
776 INFOMSG(
" --info <n> : Set info message level. 0 = off.\n");
777 INFOMSG(
" --warn <n> : Set warning message level. 0 = off.\n");
778 INFOMSG(
" --error <n> : Set error message level. 0 = off.\n");
779 INFOMSG(
" --debug <n> : Set debug message level. 0 = off.\n");
788 INFOMSG(
" --defergcfill : Turn on deferred guard cell fills.\n");
789 INFOMSG(
" --nofieldcompression : Turn off compression in the Field classes.\n");
790 INFOMSG(
" --offsetstorage : Turn on random LField storage offsets.\n");
791 INFOMSG(
" --extracompcheck : Turn on extra compression checks in evaluator.\n");
792 INFOMSG(
" --checksums : Turn on CRC checksums for messages.\n");
793 INFOMSG(
" --retransmit : Resent messages if a CRC error occurs.\n");
794 INFOMSG(
" --maxfftnodes <n> : Limit the nodes that work on FFT's.\n");
795 INFOMSG(
" --chunksize <n> : Set I/O chunk size. Can end w/K,M,G.\n");
796 INFOMSG(
" --persmppario : Enable on-SMP parallel IO option.\n");
797 INFOMSG(
" --nopersmppario : Disable on-SMP parallel IO option (default).\n");
815 return ippl_version_name;
824 return ippl_compile_arch;
832 return ippl_compile_date;
840 return ippl_compile_line;
848 return ippl_compile_machine;
856 return ippl_compile_options;
864 return ippl_compile_user;
885 const char *msg2,
const char *bad) {
921 if (gethostname(
name, 1023) != 0) {
922 ERRORMSG(
"Could not get hostname ... using localhost." <<
endl);
923 strcpy(
name,
"localhost");
925 std::string NodeName(
name,strlen(
name));
936 Comm->send(msg, 0, tag);
940 msg =
Comm->receive_block(node, tag);
942 "SPMDList map not received from master in IpplInfo::find_smp_nodes!!");
955 while (unreceived-- > 0) {
960 "Hostname not received by master in IpplInfo::find_smp_nodes!!");
961 std::string nodename;
967 smpiter = smpMap.
find(nodename);
968 if (smpiter == smpMap.
end())
976 for (
int smpindx = 0; (
unsigned int) smpindx < smpMap.
size(); ++smpindx) {
989 Comm->broadcast_others(msg, tag);
#define IPPL_MAKE_HOST_MAP_TAG
void putMessage(Message &m, const T &t)
void getMessage_iter(Message &m, OutputIterator o)
void getMessage(Message &m, T &t)
std::ostream & operator<<(std::ostream &o, const IpplInfo &)
Inform & endl(Inform &inf)
RandomNumberGen IpplRandom
static void setDefaultNodes(int)
static bool supported(int)
static const char * getAllMethodNames()
static bool setDefaultMethod(int)
static const char * getAllLibraryNames()
static bool supported(int)
static Communicate * create(int, int &, char **&, int=(-1), bool=true, MPI_Comm mpicomm=MPI_COMM_WORLD)
static bool known(const char *nm)
virtual const char * name() const
Inform & setOutputLevel(const int)
static bool NeedDeleteComm
static void deleteGlobals()
static bool noFieldCompression
static void printStatistics(Inform &)
static void instantiateGlobals()
static bool extraCompressChecks
static void printVersion(void)
static MPI_Comm communicator_m
static bool offsetStorage
static bool perSMPParallelIO()
static const char * compileMachine()
static bool PerSMPParallelIO
static void param_error(const char *, const char *, const char *)
static void abort(const char *=0)
static int getProcesses(int, int)
static int getContexts(int)
static int getSMPNodes(int)
static const char * compileLine()
static const char * compileArch()
static void find_smp_nodes()
static bool useChecksums()
static bool CommInitialized
static const char * version()
static void abortAllNodes(const char *=0)
static std::stack< StaticIpplInfo > stashedStaticMembers
static const char * compileUser()
static bool deferGuardCellFills
static Communicate * Comm
static const char * compileDate()
IpplInfo & operator=(const IpplInfo &)
static const char * compileOptions()
void AdvanceSeed(int adv=0)
rep_type::iterator iterator
iterator find(const key_type &x)
std::pair< Key, T > value_type
std::pair< iterator, bool > insert(const value_type &x)