Xmipp  v3.23.11-Nereus
mpi_performance_test.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Carlos Oscar Sanchez Sorzano coss@cnb.csic.es (2002)
4  *
5  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA
21  *
22  * All comments concerning this program package may be sent to the
23  * e-mail address 'xmipp@cnb.csic.es'
24  ***************************************************************************/
25 
26 // Translated from MATLAB code by Yoel Shkolnisky
27 
28 #include <mpi.h>
29 #include "mpi_performance_test.h"
30 #include <data/mask.h>
32 
33 
34 // Empty constructor =======================================================
36 {
37  node=new MpiNode(argc,argv);
38  if (!node->isMaster())
39  verbose=0;
40 }
41 
42 // MPI destructor
44 {
45  delete node;
46 }
47 
48 // Read arguments ==========================================================
50 {
51  fnIn = getParam("-i");
52 }
53 
54 // Show ====================================================================
56 {
57  if (!verbose)
58  return;
59  std::cout
60  << "Input: " << fnIn << std::endl
61  ;
62 }
63 
64 // usage ===================================================================
66 {
67  addUsageLine("Makes a rotational invariant representation of the image collection");
68  addParamsLine(" -i <selfile> : Selfile with experimental images");
69  addExampleLine("mpirun -np 4 `which xmipp_mpi_image_rotational_pca` -i images.stk --oroot images_eigen --thr 4");
70 }
71 
72 // Produce side info =====================================================
74 {
75  TimeStamp t0;
76  annotate_time(&t0);
77  MetaDataVec MDin(fnIn);
78  print_elapsed_time(t0,false);
79 }
80 
81 // Run ====================================================================
83 {
84  show();
85  if (system("hostname")==-1)
86  REPORT_ERROR(ERR_UNCLASSIFIED,"Cannot open shell");
88 }
Just to locate unclassified errors.
Definition: xmipp_error.h:192
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
void readParams()
Read argument from command line.
const char * getParam(const char *param, int arg=0)
void produceSideInfo()
Produce side info.
void addExampleLine(const char *example, bool verbatim=true)
void print_elapsed_time(ProcessorTimeStamp &time, bool _IN_SECS)
int verbose
Verbosity level.
ProgPerformanceTest(int argc, char **argv)
Empty constructor.
bool isMaster() const
Definition: xmipp_mpi.cpp:166
~ProgPerformanceTest()
Destructor.
void addUsageLine(const char *line, bool verbatim=false)
void annotate_time(TimeStamp *time)
size_t TimeStamp
Definition: xmipp_funcs.h:823
void addParamsLine(const String &line)