mpi - My sleep problems and sleep -


i have code supposed wait input data file, distribute data on cluster, wait processing finish, remove input file , sleep until new input file provided application. problem call "usleep" of few milliseconds makes program go sleep 10-20 seconds. see mpirun using high amount of cpu time during sleep. know usleep requested time isn't says is, think there more it. wrong code (this being first code in mpi).

here relevant code:

mpi_init(&argc, &argv); mpi_comm_rank(mpi_comm_world, &myid); mpi_comm_size(mpi_comm_world, &numprocs);  bool newfile;  while (listeningmode) {   while (!newfile) {      inputfile.open(inputfname.c_str(),ios::binary);      if (inputfile.is_open()) {        newfile = true;      } else {        usleep(1000);      }   }   mpi_barrier(mpi_comm_world);   // distribute data , processing here ....  // , @ end     if(myid == rootprocess)      remove(inputfname.c_str());    newfile = false;    mpi_barrier(mpi_comm_world);  }   // while !newfile }    // while listeningmode 


Comments

Popular posts from this blog

javascript - Trigger mouseenter when an animated element touches mouse -

json - Zend error Connection -

java - Using Spring @Transactional with a combination of readOnly and write, when does this entity get committed? -