]> git.donarmstrong.com Git - mothur.git/blobdiff - bellerophon.cpp
changed int to pid_t type in fork(). roughed in get.mimarkscommand.
[mothur.git] / bellerophon.cpp
index 207fa51583b0835810ffaf1e52db88e95252346b..59c70a0a6b45697c2dab20849587d27e55a05537 100644 (file)
@@ -246,7 +246,7 @@ int Bellerophon::getChimeras() {
                numSeqsPerProcessor = iters / processors;
                
                //each process hits this only once
-               unsigned long int startPos = pid * numSeqsPerProcessor;
+               unsigned long long startPos = pid * numSeqsPerProcessor;
                if(pid == processors - 1){
                                numSeqsPerProcessor = iters - pid * numSeqsPerProcessor;
                }
@@ -274,7 +274,7 @@ int Bellerophon::getChimeras() {
                                        MPI_Recv(&length, 1, MPI_INT, j, 2001, MPI_COMM_WORLD, &status);
                                        
                                        char* buf = new char[length];
-                                       MPI_Recv(&buf, length, MPI_CHAR, j, 2001, MPI_COMM_WORLD, &status);
+                                       MPI_Recv(&buf[0], length, MPI_CHAR, j, 2001, MPI_COMM_WORLD, &status);
                                        
                                        string temp = buf;
                                        if (temp.length() > length) { temp = temp.substr(0, length); }
@@ -293,7 +293,7 @@ int Bellerophon::getChimeras() {
                        //played with this a bit, but it may be better to try user-defined datatypes with set string lengths??
                        vector<string> MPIBestSend = getBestWindow(lines[0]);
                        pref.clear();
-                       
+                               
                        //send your result to parent
                        for (int i = 0; i < numSeqs; i++) {
                                
@@ -314,7 +314,7 @@ int Bellerophon::getChimeras() {
        #else
        
                //divide breakpoints between processors
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        if(processors == 1){ 
                                lines.push_back(linePair(0, iters));    
                                
@@ -326,7 +326,7 @@ int Bellerophon::getChimeras() {
                                int numSeqsPerProcessor = iters / processors;
                                
                                for (int i = 0; i < processors; i++) {
-                                       unsigned long int startPos = i * numSeqsPerProcessor;
+                                       unsigned long long startPos = i * numSeqsPerProcessor;
                                        if(i == processors - 1){
                                                numSeqsPerProcessor = iters - i * numSeqsPerProcessor;
                                        }
@@ -356,21 +356,21 @@ int Bellerophon::getChimeras() {
 
 int Bellerophon::createProcesses(vector<int> mid) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 0;
                int exitCommand = 1;
                vector<int> processIDS;
                                
                //loop through and create all the processes you want
                while (process != processors) {
-                       int pid = fork();
+                       pid_t pid = fork();
                        
                        if (pid > 0) {
                                processIDS.push_back(pid);  //create map from line number to pid so you can append files in correct order later
                                process++;
                        }else if (pid == 0){
                                exitCommand = driverChimeras(mid, lines[process]);
-                               string tempOut = outputDir + toString(getpid()) + ".temp";
+                               string tempOut = outputDir + toString(m->mothurGetpid(process)) + ".temp";
                                writePrefs(tempOut, lines[process]);
                                exit(0);
                        }else {