Skip to content

Commit 48ee558

Browse files
authored
Merge pull request #1009 from su2code/hybrid_parallel_mpi
Hybrid parallel MPI
2 parents e5d45cb + 0bb4b62 commit 48ee558

58 files changed

Lines changed: 1337 additions & 2182 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/include/CConfig.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6339,17 +6339,17 @@ class CConfig {
63396339
/*!
63406340
* \brief Center of rotation for a rotational periodic boundary.
63416341
*/
6342-
su2double *GetPeriodicRotCenter(string val_marker);
6342+
const su2double *GetPeriodicRotCenter(string val_marker) const;
63436343

63446344
/*!
63456345
* \brief Angles of rotation for a rotational periodic boundary.
63466346
*/
6347-
su2double *GetPeriodicRotAngles(string val_marker);
6347+
const su2double *GetPeriodicRotAngles(string val_marker) const;
63486348

63496349
/*!
63506350
* \brief Translation vector for a rotational periodic boundary.
63516351
*/
6352-
su2double *GetPeriodicTranslation(string val_marker);
6352+
const su2double *GetPeriodicTranslation(string val_marker) const;
63536353

63546354
/*!
63556355
* \brief Get the rotationally periodic donor marker for boundary <i>val_marker</i>.

Common/include/basic_types/ad_structure.hpp

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,18 @@ namespace AD{
249249
*/
250250
inline void Push_TapePosition() {}
251251

252+
/*!
253+
* \brief Start a passive region, i.e. stop recording.
254+
* \return True is tape was active.
255+
*/
256+
inline bool BeginPassive() { return false; }
257+
258+
/*!
259+
* \brief End a passive region, i.e. start recording if we were recording before.
260+
* \param[in] wasActive - Whether we were recording before entering the passive region.
261+
*/
262+
inline void EndPassive(bool wasActive) {}
263+
252264
#else
253265
using CheckpointHandler = codi::DataStore;
254266

@@ -488,27 +500,19 @@ namespace AD{
488500

489501
FORCEINLINE void EndExtFunc() { delete FuncHelper; }
490502

491-
#endif // CODI_REVERSE_TYPE
503+
FORCEINLINE bool BeginPassive() {
504+
if(AD::globalTape.isActive()) {
505+
StopRecording();
506+
return true;
507+
}
508+
return false;
509+
}
492510

493-
} // namespace AD
511+
FORCEINLINE void EndPassive(bool wasActive) { if(wasActive) StartRecording(); }
494512

495-
/*--- Macro to begin and end sections with a passive tape ---*/
513+
#endif // CODI_REVERSE_TYPE
496514

497-
#ifdef CODI_REVERSE_TYPE
498-
#define AD_BEGIN_PASSIVE \
499-
if(AD::globalTape.isActive()) {\
500-
AD::globalTape.setPassive();\
501-
AD::Status = true; \
502-
}
503-
#define AD_END_PASSIVE \
504-
if(AD::Status) { \
505-
AD::globalTape.setActive(); \
506-
AD::Status = false; \
507-
}
508-
#else
509-
#define AD_BEGIN_PASSIVE
510-
#define AD_END_PASSIVE
511-
#endif
515+
} // namespace AD
512516

513517

514518
/*--- If we compile under OSX we have to overload some of the operators for

Common/include/fem/fem_geometry_structure.hpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ struct CBoundaryFEM {
442442
*/
443443
class CMeshFEM: public CGeometry {
444444
protected:
445-
unsigned long nVolElemTot; /*!< \brief Total number of local volume elements, including halos. */
446-
unsigned long nVolElemOwned; /*!< \brief Number of owned local volume elements. */
445+
unsigned long nVolElemTot{0}; /*!< \brief Total number of local volume elements, including halos. */
446+
unsigned long nVolElemOwned{0}; /*!< \brief Number of owned local volume elements. */
447447

448448
vector<unsigned long> nVolElemOwnedPerTimeLevel; /*!< \brief Number of owned local volume elements
449449
per time level. Cumulative storage. */
@@ -489,13 +489,13 @@ class CMeshFEM: public CGeometry {
489489
vector<CFEMStandardBoundaryFace> standardBoundaryFacesGrid; /*!< \brief Vector that contains the standard boundary
490490
faces used for the geometry of the DG solver. */
491491

492-
CBlasStructure *blasFunctions; /*!< \brief Pointer to the object to carry out the BLAS functionalities. */
492+
CBlasStructure *blasFunctions{nullptr}; /*!< \brief Pointer to the object to carry out the BLAS functionalities. */
493493

494494
public:
495495
/*!
496496
* \brief Constructor of the class.
497497
*/
498-
CMeshFEM(void) : CGeometry() { blasFunctions = nullptr; }
498+
CMeshFEM(void) : CGeometry() { }
499499

500500
/*!
501501
* \overload
@@ -1250,9 +1250,4 @@ class CDummyMeshFEM_DG : public CMeshFEM_DG {
12501250
*/
12511251
CDummyMeshFEM_DG(CConfig *config);
12521252

1253-
/*!
1254-
* \brief Destructor of the class.
1255-
*/
1256-
~CDummyMeshFEM_DG() override;
1257-
12581253
};

Common/include/geometry/CDummyGeometry.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,5 @@ class CDummyGeometry final : public CGeometry{
4545
*/
4646
CDummyGeometry(CConfig *config);
4747

48-
/*!
49-
* \brief Destructor of the class.
50-
*/
51-
~CDummyGeometry() override;
52-
5348
};
5449

Common/include/geometry/CGeometry.hpp

Lines changed: 154 additions & 134 deletions
Large diffs are not rendered by default.

Common/include/geometry/CMultiGridGeometry.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ class CMultiGridGeometry final : public CGeometry {
5454
*/
5555
CMultiGridGeometry(CGeometry **geometry, CConfig *config_container, unsigned short iMesh);
5656

57-
/*!
58-
* \brief Destructor of the class.
59-
*/
60-
~CMultiGridGeometry(void) override;
61-
6257
/*!
6358
* \brief Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed.
6459
* \param[in] CVPoint - Control volume to be agglomerated.

Common/include/geometry/CPhysicalGeometry.hpp

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -39,71 +39,71 @@
3939
class CPhysicalGeometry final : public CGeometry {
4040

4141
unordered_map<unsigned long, unsigned long>
42-
Global_to_Local_Point; /*!< \brief Global-local indexation for the points. */
43-
long *Local_to_Global_Point; /*!< \brief Local-global indexation for the points. */
44-
unsigned short *Local_to_Global_Marker; /*!< \brief Local to Global marker. */
45-
unsigned short *Global_to_Local_Marker; /*!< \brief Global to Local marker. */
46-
unsigned long *adj_counter; /*!< \brief Adjacency counter. */
47-
unsigned long **adjacent_elem; /*!< \brief Adjacency element list. */
48-
su2activematrix Sensitivity; /*!< \brief Matrix holding the sensitivities at each point. */
42+
Global_to_Local_Point; /*!< \brief Global-local indexation for the points. */
43+
long *Local_to_Global_Point{nullptr}; /*!< \brief Local-global indexation for the points. */
44+
unsigned short *Local_to_Global_Marker{nullptr}; /*!< \brief Local to Global marker. */
45+
unsigned short *Global_to_Local_Marker{nullptr}; /*!< \brief Global to Local marker. */
46+
unsigned long *adj_counter{nullptr}; /*!< \brief Adjacency counter. */
47+
unsigned long **adjacent_elem{nullptr}; /*!< \brief Adjacency element list. */
48+
su2activematrix Sensitivity; /*!< \brief Matrix holding the sensitivities at each point. */
4949

5050
vector<vector<unsigned long> > Neighbors;
5151
unordered_map<unsigned long, unsigned long> Color_List;
5252
vector<string> Marker_Tags;
53-
unsigned long nLocal_Point,
54-
nLocal_PointDomain,
55-
nLocal_PointGhost,
56-
nLocal_PointPeriodic,
57-
nLocal_Elem,
58-
nLocal_Bound_Elem,
59-
nGlobal_Elem,
60-
nGlobal_Bound_Elem,
61-
nLocal_Line,
62-
nLocal_BoundTria,
63-
nLocal_BoundQuad,
64-
nLinear_Line,
65-
nLinear_BoundTria,
66-
nLinear_BoundQuad,
67-
nLocal_Tria,
68-
nLocal_Quad,
69-
nLocal_Tetr,
70-
nLocal_Hexa,
71-
nLocal_Pris,
72-
nLocal_Pyra;
73-
unsigned long nMarker_Global;
74-
su2double *Local_Coords;
75-
unsigned long *Local_Points;
76-
unsigned long *Local_Colors;
77-
unsigned long *Conn_Line;
78-
unsigned long *Conn_BoundTria;
79-
unsigned long *Conn_BoundQuad;
80-
unsigned long *Conn_Line_Linear;
81-
unsigned long *Conn_BoundTria_Linear;
82-
unsigned long *Conn_BoundQuad_Linear;
83-
unsigned long *Conn_Tria;
84-
unsigned long *Conn_Quad;
85-
unsigned long *Conn_Tetr;
86-
unsigned long *Conn_Hexa;
87-
unsigned long *Conn_Pris;
88-
unsigned long *Conn_Pyra;
89-
unsigned long *ID_Line;
90-
unsigned long *ID_BoundTria;
91-
unsigned long *ID_BoundQuad;
92-
unsigned long *ID_Line_Linear;
93-
unsigned long *ID_BoundTria_Linear;
94-
unsigned long *ID_BoundQuad_Linear;
95-
unsigned long *ID_Tria;
96-
unsigned long *ID_Quad;
97-
unsigned long *ID_Tetr;
98-
unsigned long *ID_Hexa;
99-
unsigned long *ID_Pris;
100-
unsigned long *ID_Pyra;
101-
unsigned long *Elem_ID_Line;
102-
unsigned long *Elem_ID_BoundTria;
103-
unsigned long *Elem_ID_BoundQuad;
104-
unsigned long *Elem_ID_Line_Linear;
105-
unsigned long *Elem_ID_BoundTria_Linear;
106-
unsigned long *Elem_ID_BoundQuad_Linear;
53+
unsigned long nLocal_Point{0},
54+
nLocal_PointDomain{0},
55+
nLocal_PointGhost{0},
56+
nLocal_PointPeriodic{0},
57+
nLocal_Elem{0},
58+
nLocal_Bound_Elem{0},
59+
nGlobal_Elem{0},
60+
nGlobal_Bound_Elem{0},
61+
nLocal_Line{0},
62+
nLocal_BoundTria{0},
63+
nLocal_BoundQuad{0},
64+
nLinear_Line{0},
65+
nLinear_BoundTria{0},
66+
nLinear_BoundQuad{0},
67+
nLocal_Tria{0},
68+
nLocal_Quad{0},
69+
nLocal_Tetr{0},
70+
nLocal_Hexa{0},
71+
nLocal_Pris{0},
72+
nLocal_Pyra{0};
73+
unsigned long nMarker_Global{0};
74+
su2double *Local_Coords{nullptr};
75+
unsigned long *Local_Points{nullptr};
76+
unsigned long *Local_Colors{nullptr};
77+
unsigned long *Conn_Line{nullptr};
78+
unsigned long *Conn_BoundTria{nullptr};
79+
unsigned long *Conn_BoundQuad{nullptr};
80+
unsigned long *Conn_Line_Linear{nullptr};
81+
unsigned long *Conn_BoundTria_Linear{nullptr};
82+
unsigned long *Conn_BoundQuad_Linear{nullptr};
83+
unsigned long *Conn_Tria{nullptr};
84+
unsigned long *Conn_Quad{nullptr};
85+
unsigned long *Conn_Tetr{nullptr};
86+
unsigned long *Conn_Hexa{nullptr};
87+
unsigned long *Conn_Pris{nullptr};
88+
unsigned long *Conn_Pyra{nullptr};
89+
unsigned long *ID_Line{nullptr};
90+
unsigned long *ID_BoundTria{nullptr};
91+
unsigned long *ID_BoundQuad{nullptr};
92+
unsigned long *ID_Line_Linear{nullptr};
93+
unsigned long *ID_BoundTria_Linear{nullptr};
94+
unsigned long *ID_BoundQuad_Linear{nullptr};
95+
unsigned long *ID_Tria{nullptr};
96+
unsigned long *ID_Quad{nullptr};
97+
unsigned long *ID_Tetr{nullptr};
98+
unsigned long *ID_Hexa{nullptr};
99+
unsigned long *ID_Pris{nullptr};
100+
unsigned long *ID_Pyra{nullptr};
101+
unsigned long *Elem_ID_Line{nullptr};
102+
unsigned long *Elem_ID_BoundTria{nullptr};
103+
unsigned long *Elem_ID_BoundQuad{nullptr};
104+
unsigned long *Elem_ID_Line_Linear{nullptr};
105+
unsigned long *Elem_ID_BoundTria_Linear{nullptr};
106+
unsigned long *Elem_ID_BoundQuad_Linear{nullptr};
107107

108108
public:
109109
/*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/

Common/include/linear_algebra/CMatrixVectorProduct.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class CSysMatrixVectorProduct final : public CMatrixVectorProduct<ScalarType> {
7070
private:
7171
const CSysMatrix<ScalarType>& matrix; /*!< \brief pointer to matrix that defines the product. */
7272
CGeometry* geometry; /*!< \brief geometry associated with the matrix. */
73-
CConfig* config; /*!< \brief config of the problem. */
73+
const CConfig *config; /*!< \brief config of the problem. */
7474

7575
public:
7676
/*!
@@ -80,7 +80,7 @@ class CSysMatrixVectorProduct final : public CMatrixVectorProduct<ScalarType> {
8080
* \param[in] config_ref - config of the problem
8181
*/
8282
inline CSysMatrixVectorProduct(const CSysMatrix<ScalarType> & matrix_ref,
83-
CGeometry *geometry_ref, CConfig *config_ref) :
83+
CGeometry *geometry_ref, const CConfig *config_ref) :
8484
matrix(matrix_ref),
8585
geometry(geometry_ref),
8686
config(config_ref) {}
@@ -110,7 +110,7 @@ class CSysMatrixVectorProductTransposed final : public CMatrixVectorProduct<Scal
110110
private:
111111
const CSysMatrix<ScalarType>& matrix; /*!< \brief pointer to matrix that defines the product. */
112112
CGeometry* geometry; /*!< \brief geometry associated with the matrix. */
113-
CConfig* config; /*!< \brief config of the problem. */
113+
const CConfig *config; /*!< \brief config of the problem. */
114114

115115
public:
116116
/*!
@@ -120,7 +120,7 @@ class CSysMatrixVectorProductTransposed final : public CMatrixVectorProduct<Scal
120120
* \param[in] config_ref - config of the problem
121121
*/
122122
inline CSysMatrixVectorProductTransposed(const CSysMatrix<ScalarType> & matrix_ref,
123-
CGeometry *geometry_ref, CConfig *config_ref) :
123+
CGeometry *geometry_ref, const CConfig *config_ref) :
124124
matrix(matrix_ref),
125125
geometry(geometry_ref),
126126
config(config_ref) {}

Common/include/linear_algebra/CPastixWrapper.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class CPastixWrapper
114114
/*!
115115
* \brief Initialize the matrix format that PaStiX requires.
116116
*/
117-
void Initialize(CGeometry *geometry, CConfig *config);
117+
void Initialize(CGeometry *geometry, const CConfig *config);
118118

119119
public:
120120
/*!
@@ -169,7 +169,7 @@ class CPastixWrapper
169169
* \param[in] kind_fact - Type of factorization.
170170
* \param[in] transposed - Flag to use the transposed matrix during application of the preconditioner.
171171
*/
172-
void Factorize(CGeometry *geometry, CConfig *config, unsigned short kind_fact, bool transposed);
172+
void Factorize(CGeometry *geometry, const CConfig *config, unsigned short kind_fact, bool transposed);
173173

174174
/*!
175175
* \brief Runs the "solve" task for any rhs/sol with operator []

0 commit comments

Comments
 (0)