#ifdef USE_MPI
int pid;
MPI_Comm_rank(MPI_COMM_WORLD, &pid);
-
- if ((pid != 0) && !(cFactory->MPIEnabled(commandName))) {
-cout << pid << " is waiting " << commandName << endl;
- char buf[4];
- MPI_Bcast(buf, 4, MPI_CHAR, 0, MPI_COMM_WORLD); //make everyone wait - just in case
- }
cout << pid << " is here " << commandName << endl;
if ((cFactory->MPIEnabled(commandName)) || (pid == 0)) {
mout->executing = false;
#ifdef USE_MPI
- if (!(cFactory->MPIEnabled(commandName))) {
- char buf[4];
- strcpy(buf, "done");
-
- MPI_Bcast(buf, 4, MPI_CHAR, 0, MPI_COMM_WORLD); //make everyone wait - just in case
- cout << pid << " is broadcasting " << endl;
- }
}
#endif
}else {
/***********************************************************************/
string Engine::getCommand() {
try {
+ #ifdef USE_MPI
+ MPI_Barrier(MPI_COMM_WORLD);
+ #endif
+
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
#ifdef USE_READLINE
char* nextCommand = NULL;
//CommandFactory cFactory;
int quitCommandCalled = 0;
-
+ int count = 0;
while(quitCommandCalled == 0){
- if (inputBatchFile.eof()) { input = "quit()"; }
- else { input = getline(inputBatchFile); }
+ input = getNextCommand(inputBatchFile);
+ count++;
if (input[0] != '#') {
int pid;
MPI_Comm_rank(MPI_COMM_WORLD, &pid);
- if ((pid != 0) && !(cFactory->MPIEnabled(commandName))) {
-cout << pid << " is waiting " << commandName << endl;
- char buf[4];
- MPI_Bcast(buf, 4, MPI_CHAR, 0, MPI_COMM_WORLD); //make everyone wait - just in case
- }
-
-cout << pid << " is here " << commandName << endl;
+cout << pid << " is here " << commandName << '\t' << count << endl;
if ((cFactory->MPIEnabled(commandName)) || (pid == 0)) {
#endif
//executes valid command
mout->executing = false;
#ifdef USE_MPI
- if (!(cFactory->MPIEnabled(commandName))) {
- char buf[4];
- strcpy(buf, "done");
-
- MPI_Bcast(buf, 4, MPI_CHAR, 0, MPI_COMM_WORLD); //make everyone wait - just in case
- cout << pid << " is broadcasting " << endl;
- }
}
#endif
}else {
exit(1);
}
}
-
+/***********************************************************************/
+string BatchEngine::getNextCommand(ifstream& inputBatchFile) {
+ try {
+
+ #ifdef USE_MPI
+ int err = MPI_Barrier(MPI_COMM_WORLD);
+//cout << "barrier = " << err << '\t' << MPI_SUCCESS << endl;
+ #endif
+
+ string nextcommand = "";
+
+ if (inputBatchFile.eof()) { nextcommand = "quit()"; }
+ else { nextcommand = getline(inputBatchFile); }
+
+ return nextcommand;
+ }
+ catch(exception& e) {
+ mout->errorOut(e, "BatchEngine", "getNextCommand");
+ exit(1);
+ }
+}
/***********************************************************************/
/***********************************************************************/
#ifdef USE_MPI
int pid, numProcesses;
MPI_Status status;
- //MPI_Request request;
MPI_Comm_rank(MPI_COMM_WORLD, &pid);
MPI_Comm_size(MPI_COMM_WORLD, &numProcesses);
-
- if ((pid != 0) && (!(cFactory->MPIEnabled(commandName)))) {
-cout << pid << " is waiting " << commandName << endl;
- char buf[12];
-
- MPI_Recv(buf, 12, MPI_CHAR, 0, 2001, MPI_COMM_WORLD, &status); //make everyone wait - just in case
- //MPI_Wait(&request, &status);
- cout << pid << " received " << buf << endl;
- }
-
cout << pid << " is here " << commandName << endl;
if ((cFactory->MPIEnabled(commandName)) || (pid == 0)) {
#ifdef USE_MPI
cout << pid << " is done in execute" << endl;
- if ((pid == 0) && (!(cFactory->MPIEnabled(commandName)))) {
- char buf[12];
- strcpy(buf, "command done");
-
- for(int i = 1; i < numProcesses; i++) {
- MPI_Send(buf, 12, MPI_CHAR, i, 2001, MPI_COMM_WORLD); //make everyone wait - just in case
- //MPI_Wait(&request, &status);
- cout << pid << " sent " << buf << endl;
- }
- cout << pid << " is sending " << endl;
- }
}
#endif
}else {
try {
#ifdef USE_MPI
- int ierr = MPI_Barrier(MPI_COMM_WORLD);
-cout << "barrier = " << ierr << endl;
+ MPI_Barrier(MPI_COMM_WORLD);
#endif
string nextcommand = "";
out << endl;
+ int totalChildrenInTree = 0;
+
+ map<string,int>::iterator it;
+ for(it=tree[0].children.begin();it!=tree[0].children.end();it++){
+ if (tree[it->second].total != 0) { totalChildrenInTree++; }
+ }
+
//print root
- out << tree[0].level << "\t" << tree[0].rank << "\t" << tree[0].name << "\t" << tree[0].children.size() << "\t" << tree[0].total << "\t";
+ out << tree[0].level << "\t" << tree[0].rank << "\t" << tree[0].name << "\t" << totalChildrenInTree << "\t" << tree[0].total << "\t";
map<string, int>::iterator itGroup;
if (groupmap != NULL) {
for(it=tree[i].children.begin();it!=tree[i].children.end();it++){
if (tree[it->second].total != 0) {
- out << tree[it->second].level << "\t" << tree[it->second].rank << "\t" << tree[it->second].name << "\t" << tree[it->second].children.size() << "\t" << tree[it->second].total << "\t";
+
+ int totalChildrenInTree = 0;
+
+ map<string,int>::iterator it2;
+ for(it2=tree[it->second].children.begin();it2!=tree[it->second].children.end();it2++){
+ if (tree[it2->second].total != 0) { totalChildrenInTree++; }
+ }
+
+ out << tree[it->second].level << "\t" << tree[it->second].rank << "\t" << tree[it->second].name << "\t" << totalChildrenInTree << "\t" << tree[it->second].total << "\t";
map<string, int>::iterator itGroup;
if (groupmap != NULL) {