0

I have a MPI program under Intel C++ with its Intel MPI library.

According to the user input, the master process will broadcast data to other worker processes.

In worker processes, I use a do-while loop to keep receiving data from master

int master_rank =0
int mycmd;
if(my_rank==master_rank )
{
  //wait for user input
  //accept input command
  MPI_Bcast(&mycmd, 1, MPI_INT, master_rank, MPI_COMM_WORLD);  ​
  //do some work
}
else
{
  MPI_Bcast(&mycmd, 1, MPI_INT, master_rank, MPI_COMM_WORLD);
  switch (mycmd)
  {
    case  1:
       // do some work
       break;
    case 2:
       // do some work
       break;
    default:
       std::cout << "myrank:" << my_rank << "Unknown command:" << mycmd << std::endl;
       break;

  }
} 

However, I found that even during waiting for user input, the all worker processes always make CPU usage up to nearly 100% .

This make my computer too hot..

I googled the web, and found openMPI provide an option mpi_yield_when_idle Probe seems to consume the CPU

mpirun -np N --mca mpi_yield_when_idle 1 ./a.out But in intel MPI, I can not find a similar option

I changed MPI_Bcast to MPI_IBcast , it seems no any improvement at all.

Any idea to solve it?

Thank you all.

Jilong Yin
  • 278
  • 1
  • 3
  • 15
  • Try googling `I_MPI_WAIT_MODE`, `I_MPI_THREAD_YIELD` and `I_MPI_SPIN_COUNT`. one of these might help you here. An other option is to start one MPI task and then `MPI_Comm_spawn()` the slaves. – Gilles Gouaillardet Jun 09 '21 at 07:03
  • Thank you so much. I will try and report the result. – Jilong Yin Jun 09 '21 at 09:39
  • By now either I_MPI_WAIT_MODE or I_MPI_THREAD_YIELD doesn't give any improvement. I am not familiar with the usage of MPI_Comm_spawn(). I will continue to study it . – Jilong Yin Jun 09 '21 at 10:08

1 Answers1

0

By the following setting, the above issue has been solved.

I_MPI_WAIT_MODE=0
I_MPI_THREAD_YIELD=3
I_MPI_THREAD_SLEEP=10
Jilong Yin
  • 278
  • 1
  • 3
  • 15