33 this->
read(argc, argv);
52 void ProgMPIRecFourierAccel::defineParams()
55 addParamsLine(
" [--mpi_job_size <size=100>] : Number of images sent to a cpu in a single job ");
58 addParamsLine(
" : posible value that may not be the best option");
62 void ProgMPIRecFourierAccel::readParams()
69 void ProgMPIRecFourierAccel::preRun()
98 std::cerr <<
"SF.ImgNo() mpi_job_size " 102 std::cerr <<
"numberOfJobs: " <<
numberOfJobs << std::endl <<std::endl;
109 void ProgMPIRecFourierAccel::run()
112 struct timeval start_time, end_time;
113 MPI_Group orig_group, new_group;
115 long int total_usecs;
116 double total_time_processing=0., total_time_communicating=0.;
124 if(
node->isMaster() )
126 std::cerr <<
"\nReducing the number of MPI workers from " <<
141 MPI_Comm_group(MPI_COMM_WORLD, &orig_group);
142 MPI_Group_incl(orig_group,
nProcs, ranks, &new_group);
143 MPI_Comm_create(MPI_COMM_WORLD, new_group, &new_comm);
145 if (
node->isMaster())
147 gettimeofday(&start_time,
nullptr);
148 std::cerr<<
"Computing volume"<<std::endl;
156 std::cerr <<
"master-recv i=" <<
i << std::endl;
157 std::cerr <<
"numberOfJobs: " << numberOfJobs << std::endl <<std::endl;
169 std::cerr <<
"master-send i=" <<
i << std::endl;
185 for (
size_t i = 1 ;
i <=
nProcs ;
i ++ )
197 gettimeofday(&end_time,
nullptr);
198 total_usecs = (end_time.tv_sec-start_time.tv_sec) * 1000000 + (end_time.tv_usec-start_time.tv_usec);
199 total_time_processing += ((double)total_usecs/(
double)1000000);
201 gettimeofday(&start_time,
nullptr);
203 for (
size_t i = 1 ;
i <=
nProcs ;
i ++ )
213 gettimeofday(&end_time,
nullptr);
214 total_usecs = (end_time.tv_sec-start_time.tv_sec) * 1000000 + (end_time.tv_usec-start_time.tv_usec);
215 total_time_communicating += ((double)total_usecs/(
double)1000000);
219 std::cout <<
"\n\nProcessing time: " << total_time_processing <<
" secs." << std::endl;
220 std::cout <<
"Transfers time: " << total_time_communicating <<
" secs." << std::endl;
221 std::cout <<
"Execution completed successfully"<< std::endl;
224 else if(
node->active ) {
231 std::cerr <<
"slave-send TAG_FREEWORKER rank=" <<
node->rank << std::endl;
236 MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &
status);
247 std::cerr <<
"Wr" <<
node->rank <<
" " <<
"TAG_STOP" << std::endl;
251 if (
node->rank == 1) {
254 MPI_SUM, 0, new_comm);
257 MPI_SUM, 0, new_comm);
261 MPI_SUM, 0, new_comm);
264 MPI_SUM, 0, new_comm);
269 if (
node->rank == 1 )
271 gettimeofday(&end_time,
nullptr);
288 min_i = jobNumber*mpi_job_size;
289 max_i = min_i + mpi_job_size - 1;
296 std::cerr <<
"3) Received unknown TAG I quit" << std::endl;
303 if (
node->active && !
node->isMaster() )
void init_progress_bar(long total)
std::complex< float > *** tempVolume
virtual void read(int argc, const char **argv, bool reportErrors=true)
void cleanLoadingThread()
constexpr int TAG_TRANSFER
#define REPORT_ERROR(nerr, ErrormMsg)
void mirrorAndCropTempSpaces()
int argc
Original command line arguments.
void read(int argc, char **argv)
void finishComputations(const FileName &out_name)
Incorrect argument received.
void progress_bar(long rlen)
std::shared_ptr< MpiNode > node
#define TAG_WORKFORWORKER
void processImages(int firstImageIndex, int lastImageIndex)
int verbose
Verbosity level.
void createLoadingThread()
void setNode(const std::shared_ptr< MpiNode > &node)
constexpr int TAG_SETVERBOSE
int getIntParam(const char *param, int arg=0)
void read(int argc, char **argv)
void addParamsLine(const String &line)