]> git.donarmstrong.com Git - mothur.git/blobdiff - screenseqscommand.cpp
added cluster.split command
[mothur.git] / screenseqscommand.cpp
index f67dba7223eded3e55cc104841657ee229bc0db8..878a06bfb3dd91262eccce5197c54e5324e46452 100644 (file)
@@ -217,8 +217,10 @@ int ScreenSeqsCommand::execute(){
                                MPIPos = setFilePosFasta(fastafile, numFastaSeqs); //fills MPIPos, returns numSeqs
                                
                                //send file positions to all processes
-                               MPI_Bcast(&numFastaSeqs, 1, MPI_INT, 0, MPI_COMM_WORLD);  //send numSeqs
-                               MPI_Bcast(&MPIPos[0], (numFastaSeqs+1), MPI_LONG, 0, MPI_COMM_WORLD); //send file pos   
+                               for(int i = 1; i < processors; i++) { 
+                                       MPI_Send(&numFastaSeqs, 1, MPI_INT, i, tag, MPI_COMM_WORLD);
+                                       MPI_Send(&MPIPos[0], (numFastaSeqs+1), MPI_LONG, i, tag, MPI_COMM_WORLD);
+                               }
                                
                                //figure out how many sequences you have to align
                                numSeqsPerProcessor = numFastaSeqs / processors;
@@ -249,10 +251,10 @@ int ScreenSeqsCommand::execute(){
                                        }*/
                                }
                        }else{ //you are a child process
-                               MPI_Bcast(&numFastaSeqs, 1, MPI_INT, 0, MPI_COMM_WORLD); //get numSeqs
+                               MPI_Recv(&numFastaSeqs, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
                                MPIPos.resize(numFastaSeqs+1);
-                               MPI_Bcast(&MPIPos[0], (numFastaSeqs+1), MPI_LONG, 0, MPI_COMM_WORLD); //get file positions
-                               
+                               MPI_Recv(&MPIPos[0], (numFastaSeqs+1), MPI_LONG, 0, tag, MPI_COMM_WORLD, &status);
+
                                //figure out how many sequences you have to align
                                numSeqsPerProcessor = numFastaSeqs / processors;
                                int startIndex =  pid * numSeqsPerProcessor;
@@ -285,6 +287,7 @@ int ScreenSeqsCommand::execute(){
                        MPI_File_close(&outMPIGood);
                        MPI_File_close(&outMPIBad);
                        MPI_File_close(&outMPIBadAccnos);
+                       MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
                                        
 #else