Good day. I can not understand how to set the number of processes. If I run the program in the first way: mpiexec -l -n 5 ./test , then it will run 5 processes.
But I need to start the program through passing the arguments: ./test 5 - and in this case 1 process will work. What for this should I change? If you simply specify the procs_count parameter during internalization, it does not work.
#include <stdio.h> #include "mpi.h" int main(int argc, char* argv[]) { int procs_rank, procs_count; MPI_Init(&argc, &argv); // ΠΈΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΡ MPI-Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠΈ MPI_Comm_size(MPI_COMM_WORLD, &procs_count); // ΠΎΠΏΡΠ΅Π΄Π΅Π»ΡΠ΅ΠΌ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΠΏΡΠΎΡΠ΅ΡΡΠΎΠ² MPI_Comm_rank(MPI_COMM_WORLD, &procs_rank); // ΡΠ·Π½Π°Π΅ΠΌ ΡΠ°Π½Π³ ΠΏΡΠΎΡΠ΅ΡΡΠ° printf ("\n Hello, World from process %3d of %3d\n", procs_rank, procs_count); MPI_Finalize(); // Π·Π°ΠΊΡΡΠ²Π°Π΅ΠΌ MPI-Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΡ return 0; }