Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <mpi.h>
- int main(int argc, char** argv)
- {
- MPI_Init(&argc, &argv);
- int size, rank;
- MPI_Comm_size(MPI_COMM_WORLD, &size);
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- //printf("%d, %d ", size, rank);
- int a = 1, b = 666;
- MPI_Status status;
- if(rank == 0)
- {
- MPI_Send(&a, 1, MPI_INT, 1, 123, MPI_COMM_WORLD);
- }
- if(rank == 1)
- {
- MPI_Recv(&b, 1, MPI_INT, 0, 123, MPI_COMM_WORLD, &status);
- printf("%d ", b);
- }
- MPI_Finalize();
- }
- /////////////////////////mpicc main.c; mpirun - n2 a.put// gedit .bashrc
- // export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64/openmpi/lib"
- // ssh имя компа
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement