Ignore:
Timestamp:
Sep 30, 2010, 2:47:17 PM (14 years ago)
Author:
garnier
Message:

tag geant4.9.4 beta 1 + modifs locales

Location:
trunk/examples/extended/parallel/MPI/mpi_interface/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/extended/parallel/MPI/mpi_interface/src/G4MPIbatch.cc

    r807 r1337  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MPIbatch.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
    27 // $Name: $
     26// $Id: G4MPIbatch.cc,v 1.2 2010/05/18 06:06:21 kmura Exp $
     27// $Name: geant4-09-04-beta-01 $
    2828//
    2929// ====================================================================
     
    3434#include "G4MPIbatch.hh"
    3535#include "G4MPImanager.hh"
     36#include "G4UImanager.hh"
    3637#include "G4UIcommandStatus.hh"
     38#include <vector>
     39
     40////////////////////////////////////////////////////////////////////////
     41static void Tokenize(const G4String& str, std::vector<G4String>& tokens)
     42////////////////////////////////////////////////////////////////////////
     43{
     44  const char* delimiter= " ";
     45
     46  str_size pos0= str.find_first_not_of(delimiter);
     47  str_size pos = str.find_first_of(delimiter, pos0);
     48
     49  while (pos != G4String::npos || pos0 != G4String::npos) {
     50    if (str[pos0] == '\"') {
     51      pos = str.find_first_of("\"", pos0+1);
     52      if(pos != G4String::npos) pos++;
     53    }
     54    if (str[pos0] == '\'') {
     55      pos = str.find_first_of("\'", pos0+1);
     56      if(pos != G4String::npos) pos++;
     57    }
     58
     59    tokens.push_back(str.substr(pos0, pos-pos0));
     60    pos0 = str.find_first_not_of(delimiter, pos);
     61    pos = str.find_first_of(delimiter, pos0);
     62  }
     63}
    3764
    3865// ====================================================================
     
    7299//////////////////////////////////
    73100{
    74   enum { BUFSIZE= 256 };
    75   char linebuf[BUFSIZE];
    76  
     101  enum { BUFSIZE= 4096 };
     102  static char linebuf[BUFSIZE];
     103
     104  G4String cmdtotal= "";
     105  G4bool qcontinued= false;
    77106  while(batchStream.good()) {
    78107    batchStream.getline(linebuf, BUFSIZE);
    79    
     108
    80109    G4String cmdline(linebuf);
    81     cmdline= cmdline.strip(G4String::both);
    82     cmdline= cmdline.strip(G4String::both, '\011'); // remove TAB
    83     cmdline= TruncateCommand(cmdline);
    84    
    85     str_size ic= cmdline.find_first_of('#');
    86     if(ic != G4String::npos) {
    87       cmdline= cmdline(0, ic);
    88     }
    89    
    90     if(batchStream.eof()) {
    91       if(cmdline.size()==0) {
    92         return "exit";
    93       } else {
    94         return cmdline;
    95       }
     110
     111    // TAB-> ' ' conversion
     112    str_size nb=0;
     113    while ((nb= cmdline.find('\t',nb)) != G4String::npos) {
     114      cmdline.replace(nb, 1, " ");
    96115    }
    97116
    98     if(cmdline.size()==0) continue; // skip null line
    99     return cmdline;   
    100   } 
     117    // strip
     118    cmdline= cmdline.strip(G4String::both);
    101119
    102   return "exit"; // dummy
     120    // skip null line if single line
     121    if(!qcontinued && cmdline.size()==0) continue;
     122
     123    // '#' is treated as echoing something
     124    if(cmdline[(size_t)0]=='#') return cmdline;
     125
     126    // tokenize...
     127    std::vector<G4String> tokens;
     128    Tokenize(cmdline, tokens);
     129    qcontinued= false;
     130    for (G4int i=0; i< G4int(tokens.size()); i++) {
     131      // string after '#" is ignored
     132      if(tokens[i][(size_t)0] == '#' ) break;
     133      // '\' or '_' is treated as continued line.
     134      if(tokens[i] == '\\' || tokens[i] == '_' ) {
     135        qcontinued= true;
     136        // check nothing after line continuation character
     137        if( i != G4int(tokens.size())-1) {
     138          G4Exception("unexpected character after "
     139                      "line continuation character");
     140        }
     141        break; // stop parsing
     142      }
     143      cmdtotal+= tokens[i];
     144      cmdtotal+= " ";
     145    }
     146
     147    if(qcontinued) continue; // read the next line
     148
     149    if(cmdtotal.size() != 0) break;
     150    if(batchStream.eof()) break;
     151  }
     152
     153  // strip again
     154  cmdtotal= cmdtotal.strip(G4String::both);
     155
     156  // bypass some commands
     157  cmdtotal= BypassCommand(cmdtotal);
     158
     159  // finally,
     160  if(batchStream.eof() && cmdtotal.size()==0) {
     161    return "exit";
     162  }
     163
     164  return cmdtotal;
    103165}
    104166
     
    110172  G4String newCommand="", scommand; // newCommand is always "" in slaves
    111173
    112   if(isMaster) newCommand= ReadCommand();
    113   // broadcast a new G4 command
    114   scommand= g4MPI-> BcastCommand(newCommand);
    115   if(scommand == "exit" ) return 0;
    116  
    117   while(1){
    118     G4int rc= ExecCommand(scommand);
    119     if(rc != fCommandSucceeded) break;
    120    
    121     if(isMaster) newCommand= ReadCommand();
    122     scommand= g4MPI-> BcastCommand(newCommand);
    123     if(scommand == "exit" ) {
    124       if(isBatchMode) {
    125         if(g4MPI-> CheckThreadStatus()) {
    126           g4MPI-> JoinBeamOnThread();
    127           break;
    128         }
    129       } else {
    130         break;
     174  while(1) {
     175    if (isMaster) newCommand = ReadCommand();
     176    // broadcast a new G4 command
     177    scommand = g4MPI-> BcastCommand(newCommand);
     178    if(scommand == "exit") return 0;
     179
     180    // just echo something
     181    if( scommand[(size_t)0] == '#') {
     182      if(G4UImanager::GetUIpointer()-> GetVerboseLevel()==2) {
     183        G4cout << scommand << G4endl;
    131184      }
     185      continue;
     186    }
     187
     188    G4int rc = ExecCommand(scommand);
     189    if (rc != fCommandSucceeded) {
     190      G4cerr << G4endl << "***** Batch is interupted!! *****" << G4endl;
     191      break;
    132192    }
    133193  }
    134  
     194
    135195  return 0;
    136196}
  • trunk/examples/extended/parallel/MPI/mpi_interface/src/G4MPImanager.cc

    r807 r1337  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MPImanager.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
    27 // $Name: $
     26// $Id: G4MPImanager.cc,v 1.2 2010/05/18 06:06:21 kmura Exp $
     27// $Name: geant4-09-04-beta-01 $
    2828//
    2929// ====================================================================
     
    6868////////////////////////////
    6969G4MPImanager::G4MPImanager()
    70   : verbose(0), 
     70  : verbose(0),
    7171    qfcout(false),
    7272    qinitmacro(false),
     
    7575    masterWeight(1.)
    7676////////////////////////////
    77 { 
     77{
    7878  //MPI::Init();
    7979  MPI::Init_thread(MPI::THREAD_SERIALIZED);
     
    8686  : verbose(0), qfcout(false),
    8787    qinitmacro(false), qbatchmode(false),
    88     threadID(0), 
     88    threadID(0),
    8989    masterWeight(1.)
    9090/////////////////////////////////////////////////
     
    140140  isMaster= (rank == RANK_MASTER);
    141141  isSlave= (rank != RANK_MASTER);
    142  
     142
    143143  // initialize MPI communicator
    144144  COMM_G4COMMAND= MPI::COMM_WORLD.Dup();
     
    231231    char str[1024];
    232232    sprintf(str, prefix.c_str(), rank);
    233     G4String fname(str);   
     233    G4String fname(str);
    234234    fscout.open(fname.c_str(), std::ios::out);
    235235  }
     
    265265  G4int runid, eventid, neventTBP;
    266266
    267   if (run) { // running...
     267  G4StateManager* stateManager= G4StateManager::GetStateManager();
     268  G4ApplicationState g4state= stateManager-> GetCurrentState();
     269
     270  if (run) {
    268271    runid= run-> GetRunID();
    269272    neventTBP= run -> GetNumberOfEventToBeProcessed();
    270273    eventid= run-> GetNumberOfEvent();
     274    if(g4state == G4State_GeomClosed || g4state == G4State_EventProc) {
     275      status-> StopTimer();
     276    }
    271277  } else {
    272278    runid= 0;
     
    274280    neventTBP= 0;
    275281  }
    276 
    277   G4StateManager* stateManager= G4StateManager::GetStateManager();
    278   G4ApplicationState g4state= stateManager-> GetCurrentState();
    279282
    280283  status-> SetStatus(rank, runid, neventTBP, eventid, g4state);
     
    308311      nev+= status-> GetEventID();
    309312      nevtp+= status-> GetNEventToBeProcessed();
    310       //mpistate= status-> GetG4State();
    311313      cputime+= status-> GetCPUTime();
    312314    }
     
    322324           << G4endl
    323325           << "* #ranks= " << size
    324            << "   event= " << nev << "/" << nevtp 
    325            << " state= " << strStatus 
     326           << "   event= " << nev << "/" << nevtp
     327           << " state= " << strStatus
    326328           << " time= " << cputime << "s"
    327329           << G4endl;
    328330  } else {
    329331    status-> Pack(buff);
    330     COMM_G4COMMAND.Send(buff, G4MPIstatus::NSIZE, MPI::INT, 
     332    COMM_G4COMMAND.Send(buff, G4MPIstatus::NSIZE, MPI::INT,
    331333                        RANK_MASTER, TAG_G4STATUS);
    332334  }
     
    352354  if(isMaster) {
    353355    // print master
    354     G4cout << "* rank= " << rank 
    355            << " seed= " << CLHEP::HepRandom::getTheSeed()     
     356    G4cout << "* rank= " << rank
     357           << " seed= " << CLHEP::HepRandom::getTheSeed()
    356358           << G4endl;
    357359    // receive from each slave
    358360    for (G4int islave=1; islave< size; islave++) {
    359361      COMM_G4COMMAND.Recv(&buff, 1, MPI::LONG, islave, TAG_G4SEED);
    360       G4cout << "* rank= " << islave 
     362      G4cout << "* rank= " << islave
    361363             << " seed= " << buff
    362364             << G4endl;
     
    391393    // get slave status
    392394    for (G4int islave=1; islave< size; islave++) {
    393       COMM_G4COMMAND.Recv(&buff, 1, MPI::UNSIGNED, islave, TAG_G4STATUS);
     395      MPI::Request request= COMM_G4COMMAND.Irecv(&buff, 1, MPI::UNSIGNED,
     396                                                 islave, TAG_G4STATUS);
     397      MPI::Status status;
     398      while(! request.Test(status)) {
     399        Wait(100);
     400      }
    394401      qstatus |= buff;
    395402    }
     
    452459    static G4String cmdstr;
    453460    cmdstr= command;
    454     G4int rc= pthread_create(&threadID, 0, 
     461    G4int rc= pthread_create(&threadID, 0,
    455462                             (Func_t)thread_ExecuteThreadCommand,
    456463                             (void*)&cmdstr);
     
    487494
    488495  // waiting message exhausts CPU in LAM!
    489   //COMM_G4COMMAND.Bcast(sbuff, BUFF_SIZE, MPI::CHAR, RANK_MASTER);
     496  //COMM_G4COMMAND.Bcast(sbuff, ssize, MPI::CHAR, RANK_MASTER);
    490497
    491498  // another implementation
     
    514521/////////////////////////////////////////////////////////////////////////
    515522{
     523  G4bool currentmode= qbatchmode;
     524  qbatchmode= true;
    516525  G4MPIbatch* batchSession= new G4MPIbatch(fname, qbatch);
    517526  batchSession-> SessionStart();
    518527  delete batchSession;
     528  qbatchmode= currentmode;
    519529}
    520530
     
    552562}
    553563
     564///////////////////////////////
     565void G4MPImanager::WaitBeamOn()
     566///////////////////////////////
     567{
     568  G4int buff= 0;
     569  if (qbatchmode) {  // valid only in batch mode
     570    if(isMaster) {
     571      // receive from each slave
     572      for (G4int islave=1; islave< size; islave++) {
     573        MPI::Request request= COMM_G4COMMAND.Irecv(&buff, 1, MPI::INT,
     574                                                   islave, TAG_G4STATUS);
     575        MPI::Status status;
     576        while(! request.Test(status)) {
     577           Wait(1000);
     578        }
     579      }
     580    } else {
     581      buff= 1;
     582      COMM_G4COMMAND.Send(&buff, 1, MPI::INT, RANK_MASTER, TAG_G4STATUS);
     583    }
     584  }
     585}
    554586
    555587/////////////////////////////////////////////////
  • trunk/examples/extended/parallel/MPI/mpi_interface/src/G4MPImessenger.cc

    r807 r1337  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MPImessenger.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
    27 // $Name: $
     26// $Id: G4MPImessenger.cc,v 1.2 2010/05/18 06:06:21 kmura Exp $
     27// $Name: geant4-09-04-beta-01 $
    2828//
    2929// ====================================================================
     
    7272  execute= new G4UIcmdWithAString("/mpi/execute", this);
    7373  execute-> SetGuidance("Execute a macro file. (=/control/execute)");
    74   execute-> SetParameterName("fileName", false, false); 
     74  execute-> SetParameterName("fileName", false, false);
    7575
    7676  // /mpi/beamOn
     
    8888
    8989  // /mpi/.beamOn
    90   dotbeamOn= new G4UIcmdWithAnInteger("/mpi/.beamOn", this);
    91   dotbeamOn-> SetGuidance("Start a parallel run w/o thread. (=/run/beamOn)");
    92   dotbeamOn-> SetParameterName("numberOfEvent", true, false);
    93   dotbeamOn-> SetDefaultValue(1);
    94   dotbeamOn-> SetRange("numberOfEvent>=0");
     90  dotbeamOn= new G4UIcommand("/mpi/.beamOn", this);
     91  dotbeamOn-> SetGuidance("Start a parallel run w/o thread.");
     92
     93  p1= new G4UIparameter("numberOfEvent", 'i', true);
     94  p1-> SetDefaultValue(1);
     95  p1-> SetParameterRange("numberOfEvent>=0");
     96  dotbeamOn-> SetParameter(p1);
     97
     98  p2= new G4UIparameter("divide", 'b', true);
     99  p2-> SetDefaultValue(true);
     100  dotbeamOn-> SetParameter(p2);
    95101
    96102  // /mpi/weightForMaster
     
    99105  masterWeight-> SetParameterName("weight", false, false);
    100106  masterWeight-> SetRange("weight>=0. && weight<=1.");
     107
     108  // /mpi/wait
     109  waitall= new G4UIcmdWithoutParameter("/mpi/wait", this);
     110  waitall-> SetGuidance( "Wait until beamOn-s on all nodes are done. "
     111                         "(batch mode only)");
    101112
    102113  // /mpi/showSeeds
     
    132143  delete dotbeamOn;
    133144  delete masterWeight;
     145  delete waitall;
    134146  delete showSeeds;
    135147  delete setMasterSeed;
    136148  delete setSeed;
    137  
     149
    138150  delete dir;
    139151}
     
    162174
    163175  } else if (command == dotbeamOn){ // /mpi/.beamOn
    164     G4int nevent= dotbeamOn-> GetNewIntValue(newValue);
    165     g4MPI-> BeamOn(nevent);
     176    std::istringstream is(newValue);
     177    G4int nevent;
     178    G4bool qdivide;
     179    is >> nevent >> qdivide;
     180    g4MPI-> BeamOn(nevent, qdivide);
    166181
    167182  } else if (command == masterWeight){ // /mpi/masterWeight
    168183    G4double weight= masterWeight-> GetNewDoubleValue(newValue);
    169184    g4MPI-> SetMasterWeight(weight);
    170    
     185
     186  } else if (command == waitall) {
     187    g4MPI-> WaitBeamOn();
     188
    171189  } else if (command == showSeeds){ // /mpi/showSeeds
    172190    g4MPI-> ShowSeeds();
    173  
     191
    174192  } else if (command == setMasterSeed){ // /mpi/setMasterSeed
    175193    std::istringstream is(newValue);
     
    178196    g4MPI-> GetSeedGenerator()-> SetMasterSeed(seed);
    179197    g4MPI-> DistributeSeeds();
    180    
     198
    181199  } else if (command == setSeed){ // /mpi/setSeed
    182200    std::istringstream is(newValue);
  • trunk/examples/extended/parallel/MPI/mpi_interface/src/G4MPIrandomSeedGenerator.cc

    r807 r1337  
    2525//
    2626// $Id: G4MPIrandomSeedGenerator.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
    27 // $Name: $
     27// $Name: geant4-09-04-beta-01 $
    2828//
    2929// ====================================================================
  • trunk/examples/extended/parallel/MPI/mpi_interface/src/G4MPIsession.cc

    r807 r1337  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MPIsession.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
    27 // $Name: $
     26// $Id: G4MPIsession.cc,v 1.2 2010/05/18 06:06:21 kmura Exp $
     27// $Name: geant4-09-04-beta-01 $
    2828//
    2929// ====================================================================
     
    125125  } else if(nC == "pwd") { // show current directory
    126126    G4cout << "Current Command Directory : "
    127            << GetCurrentWorkingDirectory() << G4endl;
     127     << GetCurrentWorkingDirectory() << G4endl;
    128128    newCommand= nullString;
    129129
     
    195195    g4MPI-> ExecuteMacroFile(g4MPI->GetMacroFileName(), true);
    196196    return 0;
    197   } 
    198  
     197  }
     198
    199199  // interactive session
    200200  G4String newCommand="", scommand; // newCommand is always "" in slaves
    201  
    202   if(isMaster) newCommand= GetCommand();
    203   // broadcast a new G4 command
    204   scommand= g4MPI-> BcastCommand(newCommand);
    205   if(scommand == "exit" ) return 0;
    206  
    207   while(1){
     201
     202  while(1) {
     203    if(isMaster) newCommand = GetCommand();
     204    // broadcast a new G4 command
     205    scommand = g4MPI-> BcastCommand(newCommand);
     206    if(scommand == "exit") {
     207      G4bool qexit = TryForcedTerminate();
     208      if(qexit) break;
     209      else scommand = "";
     210    }
    208211    ExecCommand(scommand);
    209 
    210     // get next ...
    211     if(isMaster) newCommand= GetCommand();
    212     scommand= g4MPI-> BcastCommand(newCommand);
    213     if(scommand == "exit" ) {
    214       G4bool qexit= TryForcedTerminate();
    215       if(qexit) break;
    216       else scommand="";
    217     }
    218212  }
    219213
     
    254248    xmessage= g4MPI->BcastCommand("");
    255249  }
    256  
     250
    257251  if(xmessage == "kill me") {
    258252    G4RunManager* runManager= G4RunManager::GetRunManager();
  • trunk/examples/extended/parallel/MPI/mpi_interface/src/G4MPIstatus.cc

    r807 r1337  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MPIstatus.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
    27 // $Name: $
     26// $Id: G4MPIstatus.cc,v 1.2 2010/05/18 06:06:21 kmura Exp $
     27// $Name: geant4-09-04-beta-01 $
    2828//
    2929// ====================================================================
     
    4343//////////////////////////
    4444G4MPIstatus::G4MPIstatus()
    45   : rank(0), runID(0), 
     45  : rank(0), runID(0),
    4646    nEventToBeProcessed(0),
    4747    eventID(0),
     
    5151{
    5252  timer= new G4Timer;
    53   timer-> Start();
    5453}
    5554
     
    6463
    6564/////////////////////////////////////////////////////
    66 void G4MPIstatus::SetStatus(G4int arank, G4int runid, 
     65void G4MPIstatus::SetStatus(G4int arank, G4int runid,
    6766                            G4int noe, G4int evtid,
    6867                            G4ApplicationState state)
     
    7473  eventID= evtid;
    7574  g4state= state;
    76 
    77   timer-> Stop();
    78   cputime= timer-> GetUserElapsed();
     75  if (timer-> IsValid()) cputime= timer-> GetUserElapsed();
     76  else cputime = 0.;
    7977}
    8078
     
    8381void G4MPIstatus::Pack(G4int* data) const
    8482/////////////////////////////////////////
    85 { 
     83{
    8684  data[0]= rank;
    8785  data[1]= runID;
     
    115113{
    116114  // * rank= 001 run= 10002 event= 00001 / 100000 state= Idle"
    117   G4cout << "* rank= " << rank 
    118          << " run= " << runID 
     115  G4cout << "* rank= " << rank
     116         << " run= " << runID
    119117         << " event= " << eventID << " / " << nEventToBeProcessed
    120118         << " state= " << GetStateString(g4state)
  • trunk/examples/extended/parallel/MPI/mpi_interface/src/G4UImpish.cc

    r807 r1337  
    2525//
    2626// $Id: G4UImpish.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
    27 // $Name: $
     27// $Name: geant4-09-04-beta-01 $
    2828//
    2929// ====================================================================
  • trunk/examples/extended/parallel/MPI/mpi_interface/src/G4VMPIseedGenerator.cc

    r807 r1337  
    2525//
    2626// $Id: G4VMPIseedGenerator.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
    27 // $Name: $
     27// $Name: geant4-09-04-beta-01 $
    2828// ====================================================================
    2929//   G4VMPIseedGenerator.cc
  • trunk/examples/extended/parallel/MPI/mpi_interface/src/G4VMPIsession.cc

    r807 r1337  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VMPIsession.cc,v 1.1 2007/11/16 14:05:41 kmura Exp $
    27 // $Name: $
     26// $Id: G4VMPIsession.cc,v 1.2 2010/05/18 06:06:21 kmura Exp $
     27// $Name: geant4-09-04-beta-01 $
    2828//
    2929// ====================================================================
     
    9494
    9595///////////////////////////////////////////////////
    96 G4int G4VMPIsession::ExecCommand(G4String aCommand)
     96G4int G4VMPIsession::ExecCommand(G4String acommand)
    9797///////////////////////////////////////////////////
    9898{
    99   if(aCommand.length()<2) return fCommandSucceeded;
     99  if(acommand.length()<2) return fCommandSucceeded;
    100100
    101101  G4UImanager* UI= G4UImanager::GetUIpointer();
    102102  G4int returnVal= 0;
    103103
    104   G4String command= BypassCommand(aCommand);
    105  
     104  G4String command= BypassCommand(acommand);
     105
    106106  // "/mpi/beamOn is threaded out.
    107107  if(command(0,11) == "/mpi/beamOn") {
    108     g4MPI-> ExecuteBeamOnThread(aCommand);
     108    g4MPI-> ExecuteBeamOnThread(command);
    109109    returnVal= fCommandSucceeded;
    110110  } else if(command(0,12) == "/mpi/.beamOn") { // care for beamOn
     
    183183  str_size idx;
    184184  while( (idx= acommand.find("//")) != G4String::npos)  {
    185     G4String command1= acommand(0,idx+1); 
     185    G4String command1= acommand(0,idx+1);
    186186    G4String command2= acommand(idx+2, acommand.size()-idx-2);
    187187    acommand= command1 + command2;
     
    199199{
    200200  // bypass some commands
    201   // /run/beamon -> /mpi/.beamOn
    202   // /control/execute -> /mpi/execute
     201  // * /mpi/beamOn
     202  //    -> /mpi/.beamOn (batch session)
     203  //
     204  // * /run/beamOn
     205  //    -> /mpi/.beamOn (batch session)
     206  //    -> /mpi/beamOn  (interactive session)
     207  //
     208  // * /control/execute -> /mpi/execute
    203209
    204210  G4String acommand= command;
    205211
     212  // /mpi/beamOn
     213  if(acommand(0,11) == "/mpi/beamOn") {
     214    if(g4MPI-> IsBatchMode()) {
     215      acommand= "/mpi/.beamOn";
     216      if(command.length() > 11) {
     217        acommand +=command.substr(11);
     218      }
     219    }
     220  }
     221
     222  // /run/beamOn
    206223  if(acommand(0,11) == "/run/beamOn") {
    207     if(g4MPI-> GetVerbose()>0 && isMaster) {
    208       G4cout << "/run/beamOn is overridden by /mpi/.beamOn"
    209              << G4endl;
    210     }
    211 
    212     acommand= "/mpi/.beamOn ";
    213 
    214224    G4String strarg= "";
    215225    G4bool qget= false;
     
    222232        continue;
    223233      }
    224 
    225234      if(qget) {
    226235        strarg+= command[idx];
     
    228237      }
    229238    }
    230     acommand += strarg;
    231   } 
    232 
     239
     240    if(g4MPI-> IsBatchMode()) { // batch session
     241      acommand= "/mpi/.beamOn ";
     242      if(command.length() > 11) acommand += strarg;
     243    } else { // interactive session
     244      if(g4MPI-> GetVerbose()>0 && isMaster) {
     245        G4cout << "/run/beamOn is overridden by /mpi/.beamOn" << G4endl;
     246      }
     247      acommand= "/mpi/beamOn ";
     248      if(command.length() > 11) acommand += strarg;
     249    }
     250  }
     251
     252  // /control/execute
    233253  if(acommand(0,16) == "/control/execute") {
    234254    if(g4MPI-> GetVerbose()>0 && isMaster) {
    235       G4cout << "/control/execute is overridden by /mpi/execute" 
     255      G4cout << "/control/execute is overridden by /mpi/execute"
    236256             << G4endl;
    237257    }
    238    
    239258    acommand.replace(0, 16, "/mpi/execute    ");
    240259  }
Note: See TracChangeset for help on using the changeset viewer.