[mpich-discuss] URGENT.. Passing Array..
Anuj Patel
indyaah at gmail.com
Thu Dec 3 00:51:56 CST 2009
Hi thanks for reply.
Actually i am trying to paralleling simple HAAR WAVELET.
In that i need to take summation and subtraction of two row/column out of
an very large array(which represents an image) and is in N*N form with very
large dimensions.
so what i want to do is pass two row/column to each worker process.
so in that part i am confused how to do that.
because i studied matrix multiplication but it just passes one row and a
complete array to each worker.
i hope i mad it bit clear. and i am attaching serial algo here.
Thanks.
Anuj Patel
On Wed, Dec 2, 2009 at 8:50 PM, Dave Goodell <goodell at mcs.anl.gov> wrote:
> On Dec 2, 2009, at 2:07 AM, Anuj Patel wrote:
>
> can anyone tell me how to pass two row and column at a time.?
>>
>
> Can you elaborate a little bit? Are you trying to pass two rows and two
> columns of an array as an argument to a function? Is it in C or Fortran?
>
> Or do you mean how to send an MPI message containing the data from two rows
> and two columns of an array?
>
> -Dave
>
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20091203/958ede22/attachment.htm>
-------------- next part --------------
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#define N 4
int main()
{
int img[N][N],t1[N][N],t2[N][N],res[N][N],i,j,k,l,m,n,o,p;
//unsigned int seed=16;
for (i=0;i<N;i++)
for (j=0;j<N;j++)
{
img[i][j] = rand()%16;
if(img[i][j] < 10)
img[i][j]+=8;
}
for(i=0,k=0;k<N;i+=2,k++)
for(j=0;j<N;j++)
{
if(i<N)
{
t1[k][j] = (img[i][j]+img[i+1][j])*0.5;
}
else
{
t1[k][j] = (img[i%N][j]-img[(i+1)%N][j])*0.5;
}
}
for(i=0;i<N;i++)
for(j=0,k=0;j<N*2;j+=2,k++)
{
if(j<N)
{
t2[i][k] = (t1[i][j]+t1[i][j+1])*0.5;
}
else
{
t2[i][k] = (t1[i][j%N]-t1[i][(j+1)%N])*0.5;
}
}
for (i=0;i<N;i++)
{
for (j=0;j<N;j++)
{
printf("%d\t",t2[i][j]);
}
printf("\n");
}
return 0;
}
More information about the mpich-discuss
mailing list