Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92953389
exchange_send_recv.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Nov 25, 02:50
Size
583 B
Mime Type
text/x-c
Expires
Wed, Nov 27, 02:50 (2 d)
Engine
blob
Format
Raw Data
Handle
22543963
Attached To
R11821 phys-743-lecture
exchange_send_recv.c
View Options
#include <mpi.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char * argv[]) {
int myrank;
int buf1[100];
int buf2[100];
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
if (myrank == 0) {
MPI_Sendrecv(buf1, 100, MPI_INT, 1, 0, buf2, 100, MPI_INT, 1, 0,
MPI_COMM_WORLD, MPI_STATUS_IGNORE);
} else if (myrank == 1) {
MPI_Sendrecv(buf1, 100, MPI_INT, 0, 0, buf2, 100, MPI_INT, 0, 0,
MPI_COMM_WORLD, MPI_STATUS_IGNORE);
}
memcpy(buf1, buf2, 100 * sizeof(int));
MPI_Finalize();
return 0;
}
Event Timeline
Log In to Comment