|
|
Use MPI inside a for loop
Hello all,
I need to make below code MPI'ed.
Inside the "for" loop, there are 2 calls to function "solve" which is
very heavy. So I wanted to make use of MPI. What I wanted to do is:
1. Loop through 1 -> M
a. Solve w1 = solve(s1[m]) with process 1
b. Solve w2 = solve(s2[m]) with process 2
c. Send w1 to process 2
d. Send w2 to process 1
e. Calculte new s1[m+1], s2[m+1]
How can I do this? I know very basic of MPI, I know usage of
MPI_Send,MPI_Recv ... but dont know how to use them in this case.
Any help is appreciated!
/*************************************/
double s1[M], s2[M];
double w1, w2;
s1[0] = 1;
s2[0] = 2;
for( m = 0; m < M; m++)
{
/* do this with process 1 */
w1 = solve(s1[m]);
/* ...
then send s1[m] to process 2
*/
/* do this with process 2 */
w2 = solve(s2[m]);
/*
then send s2[m] to process 1
*/
/ * Gather s1[m], s2[m] from Process 1, 2 */
/* Calculate new s1[m+1], s2[m+1]
s1[m+1] = f1(w1, w2);
s2[m+1] = f2(w1, w2);
}
....
double solve(x)
{
//solve an equation and get x
}
double f1(double s1, double s2)
{
}
double f2(double s1, double s2)
{
}
/***************************************************/
|
|
0
|
|
|
|
Reply
|
vuhung16mpi
|
1/16/2004 11:14:44 AM |
|
|
0 Replies
418 Views
(page loaded in 0.024 seconds)
Similiar Articles: Use MPI inside a for loop - comp.parallel.mpiHello all, I need to make below code MPI'ed. Inside the "for" loop, there are 2 calls to function "solve" which is very heavy. So I wanted to make us... Help with synchronization in a while loop (MPI_Bcast & MPI_Reduce ...How does MPI_Bcast work? - comp.parallel.mpi Use MPI inside a for loop - comp.parallel.mpi Help with synchronization in a while loop (MPI_Bcast & MPI_Reduce ... calculating PI with a parallel algorithm - comp.parallel.mpi ...Portable parallel programming with the message-passing interface_ 2nd edition, by Gropp ... it means that I have to have a LAN or something to ... Use MPI inside a for loop ... Using a MPI_RECV and MPI_REDUCE - comp.parallel.mpiUse MPI inside a for loop - comp.parallel.mpi I know very basic of MPI, I know usage of MPI_Send,MPI_Recv ... but dont know how to use them in ... Parallel matrix transpose with MPI (mpich2). - comp.parallel.mpi ...Use MPI inside a for loop - comp.parallel.mpi Hello all, I need to make below code MPI'ed. Inside the "for" loop, there ... Parallel matrix transpose with MPI (mpich2 ... For loops in BASIC - comp.sys.apple2.programmerFor loops in BASIC - comp.sys.apple2.programmer Use MPI inside a for loop - comp.parallel.mpi For loops in BASIC - comp.sys.apple2.programmer So I can use one loop in ... calculate mean using for loop. . . . - comp.soft-sys.matlab ...calculating PI with a parallel algorithm - comp.parallel.mpi ... If yes, it means that I have to have a LAN or something to ... Use MPI inside a for loop - comp.parallel ... is there any parallel fortran code for matrix diagonalization ...Use MPI inside a for loop - comp.parallel.mpi... make below code MPI'ed. Inside the "for" loop, there ... loop - comp.parallel.mpi Hello all, I need to make below ... Double "for" loop problem.. - comp.soft-sys.matlabUse MPI inside a for loop - comp.parallel.mpi /*****/ double s1[M], s2[M]; double w1, w2; s1[0] = 1; s2[0] = 2; for( m = 0; m ... Experts Exchange - Your Technology ... How does MPI_Bcast work? - comp.parallel.mpiHelp with synchronization in a while loop (MPI_Bcast & MPI_Reduce ... How does MPI_Bcast work? - comp.parallel.mpi Use MPI inside a for loop - comp.parallel.mpi Help with ... Use MPI inside a for loop - comp.parallel.mpi | Computer GroupHello all, I need to make below code MPI'ed. Inside the "for" loop, there are 2 calls to function "solve" which is very heavy. So I wanted to make us... Parallelize for-loop by MPI? - C BoardParallelize for-loop by MPI? This is a discussion on Parallelize for-loop by MPI? within the C Programming forums, part of the General Programming Boards category; I ... 7/23/2012 5:34:09 PM
|
|
|
|
|
|
|
|
|