OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
DiscConfig.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  * This program was prepared by PSI.
7  * All rights in the program are reserved by PSI.
8  * Neither PSI nor the author(s)
9  * makes any warranty, express or implied, or assumes any liability or
10  * responsibility for the use of this software
11  *
12  * Visit www.amas.web.psi for more details
13  *
14  ***************************************************************************/
15 
16 // -*- C++ -*-
17 /***************************************************************************
18  *
19  * The IPPL Framework
20  *
21  *
22  * Visit http://people.web.psi.ch/adelmann/ for more details
23  *
24  ***************************************************************************/
25 
26 // include files
27 #include "Utility/DiscConfig.h"
28 #include "Utility/IpplInfo.h"
29 #include "Utility/PAssert.h"
30 #include "Message/Communicate.h"
31 #include "Message/Message.h"
32 
33 
34 #include <algorithm>
35 using namespace std;
36 #include <cstring>
37 #include <unistd.h>
38 #include <cstdio>
39 
40 // debugging macros
41 #ifdef IPPL_PRINTDEBUG
42 #define CDCDBG(x) x
43 #else
44 #define CDCDBG(x)
45 #endif
46 
48 // a simple routine to take an input string and a list of token separators,
49 // and return the number of tokens plus fill in a new array of strings
50 // with the words. We had a nicer way to do this with a vector of strings,
51 // but a #*#^@($ bug in KCC requires this workaround.
52 int DiscConfig::dc_tokenize_string(const char *s, const char *tok,
53  string *&slist) {
54  // first determine how many words there are
55  int num = 0;
56  char *tempstring = new char[strlen(s) + 1];
57  strcpy(tempstring, s);
58  slist = 0;
59  char* tokenp = strtok(tempstring, tok);
60  while (tokenp) {
61  num++;
62  tokenp = strtok(0, tok);
63  }
64 
65  // create an array of strings, and find the words and copy them into strings
66  // but only if we have any words at all
67  if (num > 0) {
68  slist = new string[num];
69  num = 0;
70  strcpy(tempstring, s);
71  tokenp = strtok(tempstring, tok);
72  while (tokenp) {
73  slist[num++] = tokenp;
74  tokenp = strtok(0, tok);
75  }
76  }
77 
78  delete [] tempstring;
79  return num;
80 }
81 
82 
84 // Constructor: read in and parse the given config file. We must know
85 // whether the configuration file is being used to read or write data,
86 // and the base filename for the input/output file.
87 DiscConfig::DiscConfig(const char *config, const char *BaseFile,
88  bool WritingFile)
89  : NumSMPs(0), FileSMPs(0), MySMP(0), ConfigOK(false) {
90 
91  if (config != 0)
92  ConfigFile = config;
93 
94  if (BaseFile == 0) {
95  ERRORMSG("Null base filename in DiscConfig constructor." << endl);
96  Ippl::abort("Exiting due to DiscConfig error.");
97  ConfigOK = false;
98  } else {
99  ConfigOK = parse_config(BaseFile, WritingFile);
100  }
101 }
102 
103 
105 // Destructor
107 
108  // delete the SMP structures
109  vector<SMPData *>::iterator smpiter = SMPList.begin();
110  vector<SMPData *>::iterator smpend = SMPList.end();
111  while (smpiter != smpend) {
112  if ((*smpiter)->BaseFileNum > 0)
113  delete [] (*smpiter)->BaseFileName;
114  delete (*smpiter++);
115  }
116 
117  // delete the node structures
118  vector<NodeData *>::iterator nodeiter = NodeList.begin();
119  vector<NodeData *>::iterator nodeend = NodeList.end();
120  while (nodeiter != nodeend)
121  delete (*nodeiter++);
122 }
123 
124 
126 // compute how many physical nodes there are on the same SMP as the given
127 // pnode. This returns the total number of nodes which are writing data
128 // to this SMP.
129 unsigned int DiscConfig::pNodesPerSMP(unsigned int node) const {
130  unsigned int nodesmp = NodeList[node]->SMPIndex;
131  if (getNumFiles(nodesmp) == 0)
132  return 0;
133 
134  unsigned int numnodes = SMPList[nodesmp]->NodeList.size();
135  //unsigned int extrasmps = SMPList[nodesmp]->InformSMPList.size();
136  //for (unsigned int i=0; i < extrasmps; ++i)
137  // numnodes += SMPList[SMPList[nodesmp]->InformSMPList[i]]->NodeList.size();
138  return numnodes;
139 }
140 
141 
143 // take a string with configuration filename wildcards, and substitute
144 // in the specific values.
145 // The first argument is the original string with wildcards (listed below),
146 // and the second is the machine name to use when substituting in the
147 // machine name.
148 //
149 // Possible wildcards (can be upper or lower case, must start with $ and
150 // have the name enclosed in () ):
151 // $(*) ... use the machine name given in the second argument
152 // $(n) ... our node number
153 // $(env var name) ... environment variable, if not one of the above names
154 //
155 // Return a new string with the changes in place.
156 string DiscConfig::replace_wildcards(const string& s,
157  const string& machine) {
158 
159  // the return string
160  string retval;
161 
162  // make sure we have non-null input
163  if (s.length() == 0 || machine.length() == 0)
164  return retval;
165 
166  // copy of input string
167  string scpy(s);
168  char *sptrbase = (char*) scpy.c_str();
169 
170  // skip leading "./" if necessary
171  if (s.length() > 2 && s[0] == '.' && s[1] == '/')
172  sptrbase += 2;
173 
174  // start moving along the string until we get to a $
175  char *sptr = sptrbase;
176  while (*sptr != '\0') {
177  if (*sptr != '$') {
178  ++sptr;
179  } else {
180  // append previous text to return value
181  if (sptr != sptrbase) {
182  *sptr = '\0';
183  retval += sptrbase;
184  sptrbase = sptr + 1;
185  }
186  // find name of wildcard, enclosed by ()'s
187  ++sptr;
188  char *tok1 = sptr;
189  char *tok2 = sptr;
190  while (*tok1 != '(' && *tok1 != '\0') ++tok1;
191  while (*tok2 != ')' && *tok2 != '\0') ++tok2;
192  if (*tok1 == '\0' || *tok2 == '\0' || *tok2 <= *tok1) {
193  ERRORMSG("Unbalanced parenthesis in DiscConfig config file in line ");
194  ERRORMSG(s.c_str() << endl);
195  Ippl::abort("Exiting due to DiscConfig error.");
196  break;
197  }
198  // make string object with the wildcard name, and look for name.
199  // replace token with new name
200  *tok2 = '\0';
201  string token(tok1 + 1);
202  if (token == "*") {
203  token = machine;
204  } else if (token == "node" || token == "n" || token == "N") {
205  char buf[32];
206  sprintf(buf, "%d", Ippl::myNode());
207  token = buf;
208  } else {
209  // look for an env var with this name
210  char *env = getenv(token.c_str());
211  if (env != 0) {
212  token = env;
213  } else {
214  ERRORMSG("Unknown wildcard name '" << token.c_str()<<"' in line ");
215  ERRORMSG(s.c_str() << endl);
216  Ippl::abort("Exiting due to DiscConfig error.");
217  break;
218  }
219  }
220 
221  // add this token to the return string, and move on past wildcard
222  retval += token;
223  sptr = sptrbase = tok2 + 1;
224  }
225  }
226 
227  // append the final word to the return string
228  if (sptr != sptrbase)
229  retval += sptrbase;
230 
231  // done with substitution; return the string
232  return retval;
233 }
234 
235 
237 // take the information about the directory and hostname for a given
238 // SMP, and add it to the list of directories for that SMP. Make sure
239 // the directory is not repeated. If it is, issue a warning and continue.
241  const string& s,
242  const string& machine,
243  bool WritingFile) {
244 
245  // create a new smpd if necessary, and add it to the list
246  if (smpd == 0) {
247  smpd = new SMPData;
248  smpd->Box0Node = Ippl::getNodes();
249  smpd->HostName = machine;
250  smpd->BaseFileNum = 0;
251  smpd->BaseFileName = 0;
252  SMPMap.insert(vmap<string,SMPData *>::value_type(machine, smpd));
253  }
254 
255  // if necessary, try to add a new directory. Buf if no directory
256  // was specified, we're done
257  if (s.length() == 0)
258  return;
259 
260  // create a string with the wildcards replaced, etc.
261  string basename = replace_wildcards(s, machine);
262 
263  // check to make sure it does already occur in the list of BaseFileName's
264  for (unsigned int sptr=0; sptr < smpd->BaseFileNum; ++sptr) {
265  if (strcmp(basename.c_str(), (smpd->BaseFileName[sptr]).c_str()) == 0) {
266  WARNMSG("DiscConfig: Duplicate configuration file entry '" << basename);
267  WARNMSG("' for host " << machine << " ... second one ignored." << endl);
268  return;
269  }
270  }
271 
272  // check to make sure we're not trying to write to more than one output
273  // file on an SMP (multipple read files are OK, but we can only write
274  // to one file, since we cannot determine how to partition items among
275  // the files)
276  if (WritingFile && smpd->BaseFileNum > 0) {
277  WARNMSG("DiscConfig: Cannot write to more than one file per");
278  WARNMSG(" SMP. Only the first file listed for host '");
279  WARNMSG(smpd->HostName << "', " << smpd->BaseFileName[0]);
280  WARNMSG(", will be used." << endl);
281  return;
282  }
283 
284  // if we're here, the entry is not duplicated, so add the name. We'll
285  // need to add the name, then regenerate our tokenized list
286  smpd->BaseFileNameStringList += " ";
287  smpd->BaseFileNameStringList += basename;
288  if (smpd->BaseFileNum > 0)
289  delete [] smpd->BaseFileName;
291  " ", smpd->BaseFileName);
292 }
293 
294 
296 // read in from configuration file - an ascii file of token pairs.
297 // On each line, the first token is the hostname and the second
298 // token is the directory where the file is to be placed on this
299 // host.
300 // This will construct the vector with SMP data and set how many SMP's
301 // we expect to find. If this does not match later, an error will be
302 // reported then.
303 bool DiscConfig::parse_config(const char *BaseFile, bool WritingFile) {
304 
305  const int bufferSize = 1024;
306  char bufferstore[bufferSize];
307  char *buffer;
308  FILE *inC;
309  string WildCard;
310  string ConfigItems;
311  string NodeNameItems;
312 
313  CDCDBG(string dbgmsgname("DC:parse_config:"));
314  CDCDBG(dbgmsgname += ConfigFile);
315  CDCDBG(Inform dbgmsg(dbgmsgname.c_str(), INFORM_ALL_NODES));
316 
317  // create a tag for use in sending info to/from other nodes
319 
320  // save the number of nodes and which node we're on
321  NumSMPs = 0;
322  FileSMPs = 0;
323  MySMP = 0;
324 
325  CDCDBG(dbgmsg << "Parsing config file info on node " << Ippl::myNode());
326  CDCDBG(dbgmsg << " of " << Ippl::getNodes() << " nodes." << endl);
327 
328  // initialize the list of node information
329  for (int i=0; i < Ippl::getNodes(); ++i)
330  NodeList.push_back(new NodeData);
331 
332  // obtain the hostname and processor ID to send out
333  char name[1024];
334  if (gethostname(name, 1023) != 0) {
335  WARNMSG("DiscConfig: Could not get hostname. Using localhost." << endl);
336  strcpy(name, "localhost");
337  }
338  NodeNameItems = name;
339 
340  CDCDBG(dbgmsg << " My hostname is " << NodeNameItems << endl);
341 
342  // all other nodes send their hostname to node 0; node 0 gets the names,
343  // reads the config file, then broadcasts all the necessary info to all
344  // other nodes
345  if (Ippl::myNode() != 0) {
346  // other nodes send their node name to node 0
347  Message *msg = new Message;
348  ::putMessage(*msg,NodeNameItems);
349  Ippl::Comm->send(msg, 0, tag);
350 
351  // receive back the config file and node name info
352  int node = 0;
353  msg = Ippl::Comm->receive_block(node, tag);
354  PAssert(msg);
355  PAssert_EQ(node, 0);
356  ::getMessage(*msg,ConfigItems);
357  ::getMessage(*msg,NodeNameItems);
358  delete msg;
359  } else {
360  // only node 0 reads config file - others get a broadcast message
361  // open the configuration file
362  if ((inC = fopen(ConfigFile.c_str(), "r")) != 0) {
363  // read in each line, and append it to end of broadcast string
364  while (fgets(bufferstore, bufferSize, inC) != 0) {
365  CDCDBG(dbgmsg << "Read config line '" << bufferstore << "'." << endl);
366  // skip leading spaces, and any comment lines starting with '#'
367  buffer = bufferstore;
368  while (*buffer == ' ' || *buffer == '\t' || *buffer == '\n')
369  ++buffer;
370  if (*buffer == '#' || *buffer == '\0')
371  continue;
372  ConfigItems += buffer;
373  ConfigItems += "\n";
374  }
375  fclose(inC);
376  }
377 
378  // see if there was an error, or no config file was specified ...
379  // if so, use default
380  if (ConfigItems.length() == 0) {
381  CDCDBG(dbgmsg << "Using default DiscConfig configuration '* .'" << endl);
382  ConfigItems = "* .";
383  ConfigItems += "\n";
384  }
385 
386  // collect node names from everyone else, and then retransmit the collected
387  // list. The first name should be the node 0 name.
388  NodeNameItems += " 0";
389  int unreceived = Ippl::getNodes() - 1;
390  while (unreceived-- > 0) {
391  // get the hostname from the remote node, and append to a list
392  int node = COMM_ANY_NODE;
393  Message *msg = Ippl::Comm->receive_block(node, tag);
394  PAssert(msg);
395  string nodename;
396  ::getMessage(*msg,nodename);
397  sprintf(name, " %s %d", nodename.c_str(), node);
398  NodeNameItems += name;
399  delete msg;
400  }
401 
402  // broadcast string to all other nodes
403  if (Ippl::getNodes() > 1) {
404  Message *msg = new Message;
405  ::putMessage(*msg,ConfigItems);
406  ::putMessage(*msg,NodeNameItems);
407  CDCDBG(dbgmsg << " Broadcasting config info " << ConfigItems << endl);
408  CDCDBG(dbgmsg << " Broadcasting node names " << NodeNameItems << endl);
409  Ippl::Comm->broadcast_others(msg, tag);
410  }
411  }
412 
413  // from the configuration string, break it up into single lines and parse.
414  // This sets up the SMP information list.
415  CDCDBG(dbgmsg << " My ConfigItems = " << ConfigItems << endl);
416  string *conflines;
417  int conflinenum = dc_tokenize_string(ConfigItems.c_str(), "\n", conflines);
418  CDCDBG(dbgmsg << " Parsed config line list into " << conflinenum);
419  CDCDBG(dbgmsg << " words." << endl);
420  for (int is=0; is < conflinenum; ++is) {
421  CDCDBG(dbgmsg << " Examining confline " << is << " = '");
422  CDCDBG(dbgmsg << conflines[is] << "'." << endl);
423 
424  // tokenize string, and store values
425  string *tokens;
426  int ntok = dc_tokenize_string(conflines[is].c_str(), " \t,\n", tokens);
427  CDCDBG(dbgmsg << " Parsed config line " << is << " into " << ntok);
428  CDCDBG(dbgmsg << " words:");
429  for (int ntok2=0; ntok2 < ntok; ++ntok2) {
430  CDCDBG(dbgmsg << " '" << tokens[ntok2] << "'");
431  }
432  CDCDBG(dbgmsg << endl);
433  if (ntok != 2) {
434  ERRORMSG("Wrong number of parameters in DiscConfig config file ");
435  ERRORMSG("'" << ConfigFile << "' (" << ntok << " != 2)" << endl);
436  Ippl::abort("Exiting due to DiscConfig error.");
437  } else {
438  CDCDBG(dbgmsg << "Looking at tokens '" << tokens[0].c_str());
439  CDCDBG(dbgmsg << "' '" << tokens[1].c_str() << "'." << endl);
440  // append / to directory name if necessary, and also the base filename
441  if (tokens[1].c_str()[tokens[1].length() - 1] != '/')
442  tokens[1] += "/";
443  tokens[1] += BaseFile;
444  if (tokens[0] == "*") {
445  // save the wildcard string
446  CDCDBG(dbgmsg << " ... Wildcard token." << endl);
447  WildCard = tokens[1];
448  } else {
449  // line was good ... store the values found there. If a line is
450  // repeated, we just replace the value.
451  CDCDBG(dbgmsg << " ... SMP info token." << endl);
452  SMPData *smpd = 0;
453  vmap<string,SMPData *>::iterator smpiter = SMPMap.find(tokens[0]);
454  if (smpiter != SMPMap.end())
455  smpd = (*smpiter).second;
456  add_SMP_directory(smpd, tokens[1], tokens[0], WritingFile);
457  }
458  }
459 
460  // delete the tokens
461  if (tokens != 0)
462  delete [] tokens;
463  }
464 
465  // delete the conf lines
466  if (conflines != 0)
467  delete [] conflines;
468 
469  // make sure we found SOMETHING ...
470  if (SMPMap.size() < 1 && WildCard.length() == 0) {
471  ERRORMSG("No hostname/directory pairs found in DiscConfig config file ");
472  ERRORMSG("'" << ConfigFile << "' " << endl);
473  Ippl::abort("Exiting due to DiscConfig error.");
474  return false;
475  }
476 
477  // set up the node information list
478  CDCDBG(dbgmsg << " My NodeNameItems = " << NodeNameItems << endl);
479  string *nodenames;
480 #ifdef IPPL_PRINTDEBUG
481  int nodenamenum = dc_tokenize_string(NodeNameItems.c_str(), " ", nodenames);
482  CDCDBG(dbgmsg << " Parsed node name list into " << nodenamenum);
483  CDCDBG(dbgmsg << " words." << endl);
484 #else
485  dc_tokenize_string(NodeNameItems.c_str(), " ", nodenames);
486 #endif
487  for (int in=0; in < Ippl::getNodes(); ++in) {
488  // get node number and node name from list of node information
489  CDCDBG(dbgmsg << " converting to node from nodestring '");
490  CDCDBG(dbgmsg << nodenames[2*in + 1] << "'" << endl);
491  CDCDBG(dbgmsg << " converting to node from nodename '");
492  CDCDBG(dbgmsg << nodenames[2*in] << "'" << endl);
493  int node = atoi(nodenames[2*in + 1].c_str());
494  string machine = nodenames[2*in];
495 
496  // find the host name in our list of SMP's
497  SMPData *smpdata = 0;
498  vmap<string,SMPData *>::iterator smpiter = SMPMap.find(machine);
499  if (smpiter != SMPMap.end()) {
500  // this SMP has already been set up earlier
501  CDCDBG(dbgmsg << " SMP " << machine << " found in SMPMap." << endl);
502  smpdata = (*smpiter).second;
503  } else {
504  // we must make a new info structure for this SMP, since it was
505  // not mentioned in the configuration file. The routine
506  // sets the value of smpdata to a newly allocated pointer
507  CDCDBG(dbgmsg << " SMP " << machine << " not found in SMPMap." << endl);
508  add_SMP_directory(smpdata, WildCard, machine, WritingFile);
509  }
510 
511  // fill in the SMP info and node info
512  NodeList[node]->HostName = machine;
513  smpdata->NodeList.push_back(node);
514  }
515 
516  // delete the node names
517  if (nodenames != 0)
518  delete [] nodenames;
519 
520  // go through the SMP list, assign them numbers, and sort the node data
521  int firstSMPWithFiles = (-1);
522  CDCDBG(dbgmsg << "Assigning numbers to " << SMPMap.size()<<" SMP's"<< endl);
524  for (smpa = SMPMap.begin() ; smpa != SMPMap.end(); ++smpa) {
525  // add this SMP info to our SMPList array (for fast access)
526  SMPData *smpdata = (*smpa).second;
527  smpdata->SMPIndex = NumSMPs++;
528  SMPList.push_back(smpdata);
529 
530  // find out if this SMP is the first one we find with files. There
531  // must be at least one, since by this point we know the config
532  // file was not empty, or we used a wildcard.
533  if (firstSMPWithFiles < 0 && smpdata->BaseFileNum > 0)
534  firstSMPWithFiles = smpdata->SMPIndex;
535 
536  // sort the list of nodes so that all nodes have them in the same order
537  // (this is needed in find_processors). But if an SMP has 0 nodes,
538  // it is an error since the configuration file lists an SMP on which
539  // we are not running.
540  if (smpdata->NodeList.size() > 0) {
541  sort(smpdata->NodeList.begin(), smpdata->NodeList.end());
542  smpdata->Box0Node = smpdata->NodeList[0];
543  } else {
544  ERRORMSG("DiscConfig: The SMP '" << smpdata->HostName);
545  ERRORMSG("' was listed in the config file\n");
546  ERRORMSG("'" << ConfigFile << "' but you are not running on that SMP.");
547  ERRORMSG(endl);
548  Ippl::abort("Exiting due to DiscConfig error.");
549  }
550 
551  // tell the proper nodes which SMP they're on
552  vector<int>::iterator nodea = smpdata->NodeList.begin();
553  for ( ; nodea != smpdata->NodeList.end(); ++nodea)
554  NodeList[*nodea]->SMPIndex = smpdata->SMPIndex;
555 
556 
557  // increment how many file sets we're dealing with
558  FileSMPs += smpdata->BaseFileNum;
559  }
560 
561  // determine our parent SMP
562  MySMP = NodeList[Ippl::myNode()]->SMPIndex;
563 
564  // determine Box0 nodes, and whether we need to make sure to send
565  // layout and other info to other SMP's
566  for (smpa = SMPMap.begin() ; smpa != SMPMap.end(); ++smpa) {
567  SMPData *smpdata = (*smpa).second;
568  if (smpdata->BaseFileNum == 0) {
569  // we'll need to send data to another SMP's Node 0
570  smpdata->Box0Node = SMPList[firstSMPWithFiles]->Box0Node;
571  SMPList[firstSMPWithFiles]->InformSMPList.push_back(smpdata->SMPIndex);
572  }
573  }
574 
575  // print out summary
576  CDCDBG(printDebug(dbgmsg));
577  CDCDBG(dbgmsg << endl);
578 
579  return true;
580 }
581 
582 
584 // print out debugging information for this DiscConfig
586  msg << "ConfigFile = " << getConfigFile() << endl;
587  msg << "Num Filesets = " << fileSMPs() << endl;
588  msg << "NumSMPs = " << numSMPs() << endl;
589  msg << "MySMP = " << mySMP() << " (" << getSMPHost(mySMP()) << ")" << endl;
590  msg << "MyBox0 = " << getSMPBox0() << endl;
591  msg << "MyNode = " << Ippl::myNode() << endl;
592 
593  // print out summary of SMP info
594  msg << "DiscConfig SMP Summary:" << endl;
595  for (unsigned int smp=0; smp < numSMPs(); ++smp) {
596  msg << " SMP host=" << getSMPHost(smp);
597  msg << ", numnodes=" << getNumSMPNodes(smp);
598  msg << ", box0=" << getSMPBox0(smp) << endl;
599  msg << " FileList =";
600  for (unsigned int fl=0; fl < getNumFiles(smp); ++fl)
601  msg << " " << getFilename(smp, fl);
602  msg << endl;
603  msg << " OtherSMPList =";
604  for (unsigned int sl=0; sl < getNumOtherSMP(smp); ++sl)
605  msg << " " << getOtherSMP(smp, sl);
606  msg << endl;
607  msg << " NodeList =";
608  for (unsigned int nl=0; nl < getNumSMPNodes(smp); ++nl)
609  msg << " " << getSMPNode(smp,nl);
610  msg << endl;
611  }
612 
613  // print out summary of node info
614  msg << "DiscConfig Node Summary:" << endl;
615  for (unsigned int n=0; n < getNumNodes(); ++n) {
616  msg << " Node " << n << " on SMP " << getNodeSMPIndex(n);
617  msg << " (" << getNodeHost(n) << ")" << endl;
618  }
619 }
620 
621 
622 /***************************************************************************
623  * $RCSfile: DiscConfig.cpp,v $ $Author: adelmann $
624  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
625  * IPPL_VERSION_ID: $Id: DiscConfig.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
626  ***************************************************************************/
static int getNodes()
Definition: IpplInfo.cpp:773
const std::string & getConfigFile() const
Definition: DiscConfig.h:76
static void abort(const char *=0, int exitcode=(-1))
Definition: IpplInfo.cpp:696
#define INFORM_ALL_NODES
Definition: Inform.h:38
bool ConfigOK
Definition: DiscConfig.h:215
#define CDCDBG(x)
Definition: DiscConfig.cpp:44
unsigned int FileSMPs
Definition: DiscConfig.h:210
#define ERRORMSG(msg)
Definition: IpplInfo.h:399
std::string replace_wildcards(const std::string &s, const std::string &machine)
Definition: DiscConfig.cpp:156
static int dc_tokenize_string(const char *s, const char *tok, std::string *&)
Definition: DiscConfig.cpp:52
const std::string & getSMPHost() const
Definition: DiscConfig.h:95
const int COMM_ANY_NODE
Definition: Communicate.h:40
static int myNode()
Definition: IpplInfo.cpp:794
unsigned int getNumSMPNodes() const
Definition: DiscConfig.h:101
unsigned int fileSMPs() const
Definition: DiscConfig.h:81
int next_tag(int t, int s=1000)
Definition: TagMaker.h:43
unsigned int getNumOtherSMP() const
Definition: DiscConfig.h:133
#define DF_TAG_CYCLE
Definition: Tags.h:74
DiscConfig(const char *, const char *, bool)
Definition: DiscConfig.cpp:87
unsigned int SMPIndex
Definition: DiscConfig.h:194
void add_SMP_directory(SMPData *&, const std::string &s, const std::string &m, bool)
Definition: DiscConfig.cpp:240
void printDebug(Inform &)
Definition: DiscConfig.cpp:585
#define PAssert_EQ(a, b)
Definition: PAssert.h:119
unsigned int pNodesPerSMP(unsigned int node) const
Definition: DiscConfig.cpp:129
std::vector< NodeData * > NodeList
Definition: DiscConfig.h:222
virtual int broadcast_others(Message *, int, bool delmsg=true)
unsigned int numSMPs() const
Definition: DiscConfig.h:80
#define WARNMSG(msg)
Definition: IpplInfo.h:398
unsigned int mySMP() const
Definition: DiscConfig.h:82
unsigned int getOtherSMP(unsigned int sn) const
Definition: DiscConfig.h:139
unsigned int getSMPNode(unsigned int n) const
Definition: DiscConfig.h:107
std::pair< Key, T > value_type
Definition: vmap.h:71
std::string ConfigFile
Definition: DiscConfig.h:205
std::string HostName
Definition: DiscConfig.h:188
std::vector< SMPData * > SMPList
Definition: DiscConfig.h:221
unsigned int Box0Node
Definition: DiscConfig.h:193
#define DF_MAKE_HOST_MAP_TAG
Definition: Tags.h:68
std::string * BaseFileName
Definition: DiscConfig.h:189
unsigned int NumSMPs
Definition: DiscConfig.h:209
const std::string name
void getMessage(Message &m, T &t)
Definition: Message.h:580
unsigned int getNumNodes() const
Definition: DiscConfig.h:154
const std::string & getNodeHost(unsigned int n) const
Definition: DiscConfig.h:162
const std::string & getFilename(unsigned int fn) const
Definition: DiscConfig.h:125
#define PAssert(c)
Definition: PAssert.h:117
std::string::iterator iterator
Definition: MSLang.h:16
unsigned int BaseFileNum
Definition: DiscConfig.h:195
void putMessage(Message &m, const T &t)
Definition: Message.h:557
unsigned int getSMPBox0() const
Definition: DiscConfig.h:113
vmap< std::string, SMPData * > SMPMap
Definition: DiscConfig.h:220
rep_type::iterator iterator
Definition: vmap.h:116
Message * receive_block(int &node, int &tag)
Definition: Inform.h:41
unsigned int getNodeSMPIndex(unsigned int n) const
Definition: DiscConfig.h:157
static Communicate * Comm
Definition: IpplInfo.h:93
bool send(Message *, int node, int tag, bool delmsg=true)
unsigned int getNumFiles() const
Definition: DiscConfig.h:119
std::vector< int > NodeList
Definition: DiscConfig.h:191
std::string BaseFileNameStringList
Definition: DiscConfig.h:190
bool parse_config(const char *, bool)
Definition: DiscConfig.cpp:303
unsigned int MySMP
Definition: DiscConfig.h:211
Inform & endl(Inform &inf)
Definition: Inform.cpp:42