Xmipp
v3.23.11-Nereus
xmipp
libraries
parallel
mpi_ml_align2d.h
Go to the documentation of this file.
1
/***************************************************************************
2
* Authors: J.M. de la Rosa Trevin (jmdelarosa@cnb.csic.es)
3
*
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
#ifndef MPI_ML_ALIGN2D_H_
27
#define MPI_ML_ALIGN2D_H_
28
29
#include "
parallel/xmipp_mpi.h
"
30
#include "
reconstruction/ml_align2d.h
"
31
#include "
reconstruction/mlf_align2d.h
"
32
33
37
40
template
<
typename
T>
41
class
MpiML2DBase
42
{
43
protected
:
44
MpiNode
*
node
;
45
bool
created_node
;
46
//Reference to the program to be parallelized
47
T*
program
;
48
49
public
:
51
void
readMpi
(
int
argc,
char
**argv) {
52
if
(node ==
nullptr
)
53
{
54
node =
new
MpiNode
(argc, argv);
55
created_node =
true
;
56
}
57
//The following makes the asumption that 'this' also
58
//inherits from an XmippProgram
59
if
(!node->
isMaster
())
60
program->verbose = 0;
61
// Read subsequently to avoid problems in restart procedure
62
for
(
size_t
proc = 0; proc < node->
size
; ++proc)
63
{
64
if
(proc == node->
rank
)
65
program->read(argc, (
const
char
**)argv);
66
node->
barrierWait
();
67
}
68
//Send "master" seed to slaves for same randomization
69
MPI_Bcast(&program->seed, 1, MPI_INT, 0, MPI_COMM_WORLD);
70
}
72
MpiML2DBase
(T *
prm
);
74
MpiML2DBase
(T *prm,
MpiNode
* node);
75
76
MpiML2DBase
(
const
MpiML2DBase
&)=
delete
;
77
MpiML2DBase
(
const
MpiML2DBase
&&)=
delete
;
78
80
~MpiML2DBase
() {
81
if
(created_node)
82
delete
node
;
83
}
84
85
MpiML2DBase
&
operator =
(
const
MpiML2DBase
&)=
delete
;
86
MpiML2DBase
&
operator =
(
const
MpiML2DBase
&&)=
delete
;
87
89
void
sendDocfile
(
const
MultidimArray<double>
&data);
90
}
91
;
//end of class MpiML
92
94
class
MpiProgML2D
:
public
ProgML2D
,
public
MpiML2DBase
<MpiProgML2D>
95
{
96
97
public
:
99
MpiProgML2D
();
101
MpiProgML2D
(
MpiNode
*
node
);
103
void
setNumberOfLocalImages();
107
void
produceSideInfo2();
109
void
writeOutputFiles(
const
ModelML2D
&model,
OutputType
outputType =
OUT_FINAL
);
111
void
expectation();
113
void
endIteration();
114
//Just for debugging
115
void
printModel(
const
String
&msg,
const
ModelML2D
& model);
116
//Redefine usage, only master should print
117
virtual
void
usage(
int
verb = 0)
const
;
118
119
}
120
;
//end of class MpiProgML2D
121
122
124
class
MpiProgMLF2D
:
public
ProgMLF2D
,
public
MpiML2DBase
<MpiProgMLF2D>
125
{
126
public
:
128
MpiProgMLF2D
();
130
MpiProgMLF2D
(
MpiNode
*
node
);
134
void
produceSideInfo();
135
void
produceSideInfo2();
137
void
writeOutputFiles(
const
ModelML2D
&model,
OutputType
outputType =
OUT_FINAL
);
139
void
expectation();
141
void
endIteration();
142
}
143
;
//end of class MpiProgMLF2D
144
146
#endif
/* MPI_ML_ALIGN2D_H_ */
MpiNode::size
size_t size
Definition:
xmipp_mpi.h:52
MpiML2DBase
Definition:
mpi_ml_align2d.h:41
MultidimArray< double >
ProgML2D
Definition:
ml_align2d.h:59
MpiML2DBase::sendDocfile
void sendDocfile(const MultidimArray< double > &data)
Definition:
mpi_ml_align2d.cpp:49
MpiML2DBase::program
T * program
Definition:
mpi_ml_align2d.h:47
MpiProgML2D
Definition:
mpi_ml_align2d.h:94
MpiML2DBase::node
MpiNode * node
Definition:
mpi_ml_align2d.h:44
OutputType
OutputType
Definition:
ml2d.h:76
MpiNode::barrierWait
void barrierWait()
Definition:
xmipp_mpi.cpp:171
MpiML2DBase::created_node
bool created_node
Definition:
mpi_ml_align2d.h:45
ProgMLF2D
Definition:
mlf_align2d.h:70
xmipp_mpi.h
MpiProgMLF2D
Definition:
mpi_ml_align2d.h:124
MpiML2DBase::readMpi
void readMpi(int argc, char **argv)
Definition:
mpi_ml_align2d.h:51
for
for(j=1;j<=i__1;++j)
Definition:
numerical_recipes.cpp:2310
MpiNode::rank
size_t rank
Definition:
xmipp_mpi.h:52
mlf_align2d.h
ml_align2d.h
MpiML2DBase::operator=
MpiML2DBase & operator=(const MpiML2DBase &)=delete
MpiML2DBase::MpiML2DBase
MpiML2DBase(T *prm)
Definition:
mpi_ml_align2d.cpp:34
String
std::string String
Definition:
xmipp_strings.h:34
MpiML2DBase::~MpiML2DBase
~MpiML2DBase()
Definition:
mpi_ml_align2d.h:80
ModelML2D
Definition:
ml2d.h:79
MpiNode::isMaster
bool isMaster() const
Definition:
xmipp_mpi.cpp:166
prm
ProgClassifyCL2D * prm
Definition:
mpi_classify_CL2D.cpp:35
OUT_FINAL
Definition:
ml2d.h:76
MpiNode
Definition:
xmipp_mpi.h:47
Generated by
1.8.13