Commits

jfinkels committed 9d0a3b7

MultipleAlignment.c: iterate over loop forward instead of backward in order to fix bug when compiling with OpenMP enabled. SCons now builds Matt with OpenMP support enabled by default.

Comments (0)

Files changed (2)

MultipleAlignment.c

 			#pragma omp parallel for default(shared) schedule(dynamic, 1)
 #endif
 			/* Run all the new alignments and add ma to the list of alignments I've kept. */
-			for (i=numAlignments; i > 0; i--) {
-        unsigned int ii = i - 1;
+			/*for (i=numAlignments; i > 0; i--) {*/
+      for (i = 0; i < numAlignments; ++i) {
 				double bestScore = 0;
 				int best1=0, best2=0;
 
 				/* Need private (thread) variables. */
 				unsigned int j, k;
-				for (j=0; j<alignments[ii]->numChains; j++) {
+				for (j=0; j<alignments[i]->numChains; j++) {
 					for (k=0; k<ma->numChains; k++) {
-						double score = pairScores[ma->chains[k]->id * numChains + alignments[ii]->chains[j]->id];
+						double score = pairScores[ma->chains[k]->id * numChains + alignments[i]->chains[j]->id];
 						if (score > bestScore) {
 							bestScore = score;
 							best1 = j;
 					}
 				}
 
-				alignedAlignments[numAlignedAlignments+ii] = AlignAlignments(alignments[ii], ma, best1, best2, 0);
+				alignedAlignments[numAlignedAlignments + i] = AlignAlignments(alignments[i], ma, best1, best2, 0);
 				if (displayStatus) {
 #ifdef _OPENMP
 #pragma omp critical
 warnings = ['-Wall', '-Wextra', '-pedantic']
 optimizations = ['-O3']
-otherflags = []#['-fopenmp']
+otherflags = ['-fopenmp']
+#otherflags = []
 libs = ['m', 'gomp']
 
 env = Environment(CCFLAGS = warnings + optimizations + otherflags, LIBS = libs)