Hi Guys,
I am trying to do design a coarse grain algorithm in MPI for carrying out multiple pattern searches. For which I have created a function that does the main pattern searches as shown in the algorithm below called hostMatch. The code below, reads in the data and sends it to processes. But the results I get are never right, by what I mean is it either returns too many pattern searches or too less. Its intermitting :(
FILE *out;
char fileName[1000];
#ifdef DOS
sprintf (fileName, "result_%d.txt",rank);
#else
sprintf (fileName, "result_%d.txt",rank);
#endif
out = fopen( fileName, "w+");
if (out == NULL)
return 0;
while ( readTextData(textNumber) ) {
if (readPatternData(rank)) {
patternNumber = rank;
hostMatch(out, textNumber, patternNumber, control, appearances );
}
textNumber++;
}
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
fclose(out);
Here is the process file I created which shows how each processor handles the data:
---------------------------
Process 0: Pattern 0 Text 0
Process 0: Pattern 0 Text 1
Process 0: Pattern 0 Text 2
Process 0: Pattern 0 Text 3
Process 0: Pattern 0 Text 4
---------------------------
Process 1: Pattern 0 Text 0
Process 1: Pattern 1 Text 1
Process 1: Pattern 1 Text 2
Process 1: Pattern 1 Text 3
Process 1: Pattern 1 Text 4
---------------------------
Process 2: Pattern 0 Text 0
Process 2: Pattern 2 Text 1
Process 2: Pattern 2 Text 2
Process 2: Pattern 2 Text 3
Process 2: Pattern 2 Text 4
---------------------------
Process 3: Pattern 0 Text 0
Process 3: Pattern 3 Text 1
Process 3: Pattern 3 Text 2
Process 3: Pattern 3 Text 3
Process 3: Pattern 3 Text 4
---------------------------
Process 4: Pattern 0 Text 0
Process 4: Pattern 4 Text 1
Process 4: Pattern 4 Text 2
Process 4: Pattern 4 Text 3
Process 4: Pattern 4 Text 4
---------------------------
Process 5: Pattern 0 Text 0
Process 5: Pattern 5 Text 1
Process 5: Pattern 5 Text 2
Process 5: Pattern 5 Text 3
Process 5: Pattern 5 Text 4
Any suggestions?