LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Rayne (lancer6238_at_[hidden])
Date: 2007-09-23 06:10:22


Hi all,
I'm currently writing a DNA sequence alignment
program. I'm trying to divide the long sequence into
parts and send them to other processors so the parts
can be compared against a sequence of interest.

Say I have divided an 8000 bp long sequence into 3
parts, so P1 and P2 gets 2666 bp each, and P3 gets
2668 bp. The sequence of interest is 2000 bp long, so
I have to create tables of cells in order to calculate
the scores. I have dynamically created (because I'll
be
comparing different sequences with different lengths
later) a 2000- by-2666 matrix in P1 and P2, and a
2000-by 2668 matrix in P3. Each cell in the tables is
a structure:

typedef struct
{
   int previ;
   int prevj;
   int prevrank;
   double value;

}TABLE;

After calculating the score, I now need to send the 3
tables to P0 so I can do the traceback and print the
output (the local alignments). The 3 tables are
combined in this way:
Say the table in P1, P2 and P3 are

### ooo @@@@
### ooo @@@@
### ooo @@@@

respectively. I now need to combine them into 1 table
in P0:
###ooo@@@@
###ooo@@@@
###ooo@@@@

What I have now is

(At the end of the calculation of scores for P1-P3, I
send their tables back to P0 row by row. size[0] is
the size of the sequence of interest, i.e. 2000,
length is 2666 in P1 and P2, and 2668 in P3. "stable"
is a derived type that allows me to send the structure
"cell")

for (row = 1 ; row <= size[0] ; row++)
   MPI_Send(&(cell[row][1]), length, stable, 0, rank,
MPI_COMM_WORLD);

In P0, I receive the tables from P1-P2, then P3,
row-by-row. mlength has the value 2666, p is the
number of processors used in total, i.e. 4.

for (source = 1 ; source < (p-1) ; source++)
   for (r = 1 ; r <= size[0] ; r++)
       MPI_Recv(&(cell[r][1])+(source-1)*mlength,
mlength, stable,
source, source, MPI_COMM_WORLD, &status);

for (r = 1 ; r <= size[0] ; r++)
   MPI_Recv(&(cell[r][1]) + (p-2)*mlength,
size[k]-(p-2)*mlength,
stable, p-1, p-1, MPI_COMM_WORLD, &status);

My code worked for p = 3, but I keep getting
segmentation fault when receiving rows from P2 when I
increase p to 4 (in this case) or 5. I was thinking of
sending the tables as a matrix instead of row-by-row,
but I don't know how to do so.

Please help.

Thank you.

Regards,
Rayne

       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/