|
|
Hi,
I'm quite new to parallel programming and I'm working with PelicanHPC and MPITB for octave.
I have a cluster with three nodes and I'm trying to send two different matrices to my compute-nodes.
Node 1 should recieve matrix A, node 2 should recieve matrix B. How can I do this?
I tried the following:
%send_test.m
%MPI_Send(buf, dest, tag, comm);
%MPI_Recv(buf, src, tag, comm);
nodes=2;
LAM_Init(nodes);
global TAG1 TAG2 NEWORLD;
[info, size] = MPI_Comm_size(NEWORLD);
[info, rank] = MPI_Comm_rank(NEWORLD);
A = ones(500,500);
B = ones(1000,1000);
MPI_Send(A, 1, TAG1, NEWORLD);
MPI_Send(B, 2, TAG2, NEWORLD);
cmd = '[info, rank] = MPI_Comm_rank(NEWORLD); if (rank == 1); MPI_Recv(A, 0, TAG1, NEWORLD); A = A * 2; MPI_Send(A, 0, TAG1, NEWORLD); endif; if (rank == 2); MPI_Recv(B, 0, TAG2, NEWORLD); B = B * 2; MPI_Send(B, 0, TAG2, NEWORLD); endif;';
NumCmds_Send({'cmd'},{cmd});
A = zeros(500,500);
MPI_Recv(A, 1, TAG1, NEWORLD);
B = zeros(1000,1000);
MPI_Recv(B, 2, TAG2, NEWORLD);
LAM_Finalize;
But it doesn't work. What am I doing wrong?
Thanks in advance!
|