Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.1 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Scilab Help >> Scilab MPI > MPI_Recv

MPI_Recv

Recv data from a node

Calling Sequence

value = MPI_Recv(rank,tag)

Arguments

rank

The rank. TODO

tag

The tag. TODO

res

The value received from MPI_Send.

Description

Receive a variable from a specified node. The value is usually sent by the function MPI_Send.

Technical implementation

For more information on the implementation of Scilab/MPI, please see Technical details about the implementation

Examples

MPI_Init();
rnk =    MPI_Comm_rank();
sizeNodes =    MPI_Comm_size();

SLV = rnk;                // handy shortcuts, master is rank 0
Master = ~ SLV;            // slaves are all other
tag=0;
if Master
// The master node
for slaveId = 1:sizeNodes-1
// Send data to the slaves
value = rand(100,100) + rand(100,100) * %i;
MPI_Send(value, slaveId);
end

for slaveId = 1:sizeNodes-1
valueBack=MPI_Recv(slaveId, tag);
// Check that the slaves gaves us what we expected
assert_checkequal(valueBack,value + 1);
end
else
// The slaves
rankSource=0;
// Receive the information from the master
value=MPI_Recv(rankSource);
// Increment all the values by one
value=value+1;
// Send back to the master
MPI_Send(value,0);

end

MPI_Finalize();

See Also

  • MPI_Send — Send data from a node to an other
Report an issue
<< MPI_Isend Scilab MPI MPI_Send >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 02 13:47:02 CEST 2014