]> git.donarmstrong.com Git - mothur.git/commitdiff
changed the daughterLevels in classifiers summary file to reflect the classifications...
authorwestcott <westcott>
Tue, 1 Jun 2010 15:44:15 +0000 (15:44 +0000)
committerwestcott <westcott>
Tue, 1 Jun 2010 15:44:15 +0000 (15:44 +0000)
engine.cpp
engine.hpp
makefile
phylosummary.cpp

index acd417cd8477516f2a670f6a34257964d6c442c3..2ed819f9661fe728526c5e9ba59ba661f58027e9 100644 (file)
@@ -71,12 +71,6 @@ bool InteractEngine::getInput(){
                                        #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)) {
@@ -88,13 +82,6 @@ cout << pid << " is here " << commandName << endl;
                                        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 {         
@@ -112,6 +99,10 @@ cout << pid << " is here " << commandName << endl;
 /***********************************************************************/
 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;
@@ -187,11 +178,11 @@ bool BatchEngine::getInput(){
                
                //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] != '#') {
                                
@@ -214,13 +205,7 @@ bool BatchEngine::getInput(){
                                                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
@@ -230,13 +215,6 @@ cout << pid << " is here " << commandName << endl;
                                        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 {         
@@ -256,7 +234,27 @@ cout << pid << " is here " << commandName << endl;
                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);
+       }
+}
 
 /***********************************************************************/
 /***********************************************************************/
@@ -318,20 +316,9 @@ bool ScriptEngine::getInput(){
                                        #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)) {
@@ -345,17 +332,6 @@ cout << pid << " is here " << commandName  << endl;
                                                                        
                                        #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 {         
@@ -378,8 +354,7 @@ string ScriptEngine::getNextCommand(string& commandString) {
        try {
                
                #ifdef USE_MPI
-               int ierr = MPI_Barrier(MPI_COMM_WORLD);
-cout << "barrier = " << ierr << endl;
+                       MPI_Barrier(MPI_COMM_WORLD);
                #endif
                
                string nextcommand = "";
index 0020a7f8d9d83a24b5b24c60fb0f86263edd5e44..0e7721a1ba1a51566eaab52b909604a50d5a70eb 100644 (file)
@@ -49,6 +49,7 @@ public:
 private:
        GlobalData* globaldata;
        ifstream inputBatchFile;
+       string getNextCommand(ifstream&);
 
 };
 
index f50b5548b982f34189f6ef20fa8bf8ae7979fc78..0c5adac54141a6864ab5cf2a1565f58e92aeab38 100644 (file)
--- a/makefile
+++ b/makefile
@@ -26,7 +26,7 @@ ifeq  ($(strip $(USEREADLINE)),yes)
       -L../readline-6.0\r
 endif\r
 \r
-USEMPI ?= no\r
+USEMPI ?= yes\r
 \r
 ifeq  ($(strip $(USEMPI)),yes)\r
        CC = mpic++\r
index 5612d7bbf3eded6f86bcdce40c45048ee8edcb25..84b0861e38cc450b50b481e7efdaaa76e0831e4e 100644 (file)
@@ -179,8 +179,15 @@ void PhyloSummary::print(ofstream& out){
                
                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) {
@@ -208,7 +215,15 @@ void PhyloSummary::print(int i, ofstream& out){
                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) {