Assignments for parallel processing using OpenMPI.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
openmpi-assignments/testt.c

28 lines
492 B

#include <mpi.h>
#include <stdio.h>
int main(int argc, char **argv) {
int rank, size, root_process;
MPI_Status status;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if( rank == 0 ) {
printf("I am the first process\n");
}
else if( rank == 1 ) {
printf("I am the second process\n");
}
else if( rank == 2 ) {
printf("I am the third process\n");
}
else {
printf("I am a remaning process\n");
}
MPI_Finalize();
}