+ #ifdef USE_MPI
+
+ int pid, num, num2;
+ vector<long> positions;
+ vector<long> positions2;
+
+ MPI_Status status;
+ MPI_File inMPI;
+ MPI_File inMPI2;
+ MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
+
+ char inFileName[1024];
+ strcpy(inFileName, inNumName.c_str());
+
+ char inFileName2[1024];
+ strcpy(inFileName2, inName.c_str());
+
+ MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI); //comm, filename, mode, info, filepointer
+ MPI_File_open(MPI_COMM_WORLD, inFileName2, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI2); //comm, filename, mode, info, filepointer
+
+ if (pid == 0) {
+ positions = setFilePosEachLine(inNumName, num);
+
+ //send file positions to all processes
+ MPI_Bcast(&num, 1, MPI_INT, 0, MPI_COMM_WORLD); //send numSeqs
+ MPI_Bcast(&positions[0], (num+1), MPI_LONG, 0, MPI_COMM_WORLD); //send file pos
+
+ positions2 = setFilePosEachLine(inName, num2);
+
+ //send file positions to all processes
+ MPI_Bcast(&num2, 1, MPI_INT, 0, MPI_COMM_WORLD); //send numSeqs
+ MPI_Bcast(&positions2[0], (num2+1), MPI_LONG, 0, MPI_COMM_WORLD); //send file pos
+
+ }else{
+ MPI_Bcast(&num, 1, MPI_INT, 0, MPI_COMM_WORLD); //get numSeqs
+ positions.resize(num);
+ MPI_Bcast(&positions[0], (num+1), MPI_LONG, 0, MPI_COMM_WORLD); //get file positions
+
+ MPI_Bcast(&num2, 1, MPI_INT, 0, MPI_COMM_WORLD); //get numSeqs
+ positions2.resize(num2);
+ MPI_Bcast(&positions2[0], (num2+1), MPI_LONG, 0, MPI_COMM_WORLD); //get file positions
+
+ }