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
Post a Comment