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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.