csc466, create a directory named intro-mpi intro-mpi
1
2
3
cd
mkdir intro-mpi
cd intro-mpi
intro-mpi, create a file named first.c with the following contentsfirst.c:
1
2
3
4
mpicc -o first first.c
mpirun -np 1 ./first
mpirun -np 2 ./first
mpirun -np 4 ./first
MPI_Init: indicates that all processes are now working in message-passing mode.MPI_Finalize: indicates that all processes are now working in sequential mode (only one process active) and there are no more message-passing activities.MPI_COMM_WORLD: Global communicatorMPI_Comm_rank: return the rank of the calling processMPI_Comm_size: return the total number of processes that are part of the specified communicator.MPI_Get_processor_name: return the name of the processor (core) running the process.MPI defines communicator groups for point-to-point and collective communications:
MPI_COMM_WORLD) contains all processes.N processes, ranks go from 0 to N−1.intro-mpi, create a file named hello.c with the following contentshello.c:
1
2
3
4
mpicc -o hello hello.c
mpirun -np 1 ./hello
mpirun -np 2 ./hello
mpirun -np 4 ./hello
intro-mpi, create a file named evenodd.c with the following contentsevenodd.c:
1
2
3
4
mpicc -o evenodd evenodd.c
mpirun -np 1 ./evenodd
mpirun -np 2 ./evenodd
mpirun -np 4 ./evenodd
intro-mpi, create a file named rank_size.c with the following contentsrank_size.c:
1
2
3
4
mpicc -o rank_size rank_size.c
mpirun -np 1 ./rank_size
mpirun -np 2 ./rank_size
mpirun -np 4 ./rank_size