30 this->
read(argc, argv);
49 void ProgMPIRecFourierGPU::defineParams()
52 addParamsLine(
" [--mpi_job_size <size=1000>] : Number of images sent to a node in a single job.");
53 addParamsLine(
" : Should be rather big to saturate GPU on the node and hide MPI overhead");
54 addParamsLine(
" : if -1, maximum possible value will be used (all images/no_of_nodes)");
55 addParamsLine(
" -gpusPerNode <num> : Number of GPUs present at each node");
56 addParamsLine(
" -threadsPerGPU <num> : Number of CPU threads per each GPU. Should be at least 4");
60 void ProgMPIRecFourierGPU::readParams()
69 void ProgMPIRecFourierGPU::preRun()
98 std::cerr <<
"SF.ImgNo() mpi_job_size " 102 std::cerr <<
"numberOfJobs: " <<
numberOfJobs << std::endl <<std::endl;
109 void ProgMPIRecFourierGPU::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 ) {
230 std::cerr <<
"slave-send TAG_FREEWORKER rank=" <<
node->rank << std::endl;
235 MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &
status);
248 std::cerr <<
"Wr" <<
node->rank <<
" " <<
"TAG_STOP" << std::endl;
252 if (
node->rank == 1) {
255 MPI_SUM, 0, new_comm);
258 MPI_SUM, 0, new_comm);
262 MPI_SUM, 0, new_comm);
265 MPI_SUM, 0, new_comm);
270 if (
node->rank == 1 )
272 gettimeofday(&end_time,
nullptr);
289 min_i = jobNumber*mpi_job_size;
290 max_i = min_i + mpi_job_size - 1;
302 std::cerr <<
"3) Received unknown TAG I quit" << std::endl;
void init_progress_bar(long total)
virtual void read(int argc, const char **argv, bool reportErrors=true)
constexpr int TAG_TRANSFER
#define REPORT_ERROR(nerr, ErrormMsg)
void finishComputations(const FileName &out_name)
int argc
Original command line arguments.
void processImages(int firstImageIndex, int lastImageIndex)
Incorrect argument received.
void progress_bar(long rlen)
std::shared_ptr< MpiNode > node
#define TAG_WORKFORWORKER
void read(int argc, char **argv)
int verbose
Verbosity level.
void mirrorAndCropTempSpaces()
std::complex< float > *** tempVolume
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)