Skip to content

Commit b080669

Browse files
authored
Merge branch 'develop' into Dependabot-GitHub-Actions
2 parents cf1afee + eed1e67 commit b080669

86 files changed

Lines changed: 761 additions & 819 deletions

File tree

Some content is hidden

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

.github/workflows/release-management.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
key: ${{ matrix.os_bin }}-${{ github.sha }}
3636
restore-keys: ${{ matrix.os_bin }}
3737
- name: Build
38-
uses: docker://su2code/build-su2-cross:latest
38+
uses: docker://ghcr.io/su2code/su2/build-su2-cross:220716-1459
3939
with:
4040
args: -b ${{ github.sha }} -f "${{matrix.flags}}"
4141
- name: Create Archive

Common/include/basic_types/ad_structure.hpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -559,21 +559,13 @@ namespace AD{
559559
FORCEINLINE bool PausePreaccumulation() {
560560
const auto current = PreaccEnabled;
561561
if (!current) return false;
562-
SU2_OMP_BARRIER
563-
SU2_OMP_MASTER
564-
PreaccEnabled = false;
565-
END_SU2_OMP_MASTER
566-
SU2_OMP_BARRIER
562+
SU2_OMP_SAFE_GLOBAL_ACCESS(PreaccEnabled = false;)
567563
return true;
568564
}
569565

570566
FORCEINLINE void ResumePreaccumulation(bool wasActive) {
571567
if (!wasActive) return;
572-
SU2_OMP_BARRIER
573-
SU2_OMP_MASTER
574-
PreaccEnabled = true;
575-
END_SU2_OMP_MASTER
576-
SU2_OMP_BARRIER
568+
SU2_OMP_SAFE_GLOBAL_ACCESS(PreaccEnabled = true;)
577569
}
578570

579571
FORCEINLINE void StartNoSharedReading() {

Common/include/geometry/dual_grid/CEdge.hpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class CEdge {
4343
using NodeArray = C2DContainer<Index, Index, StorageType::ColumnMajor, 64, DynamicSize, 2>;
4444
NodeArray Nodes; /*!< \brief Vector to store the node indices of the edge. */
4545
su2activematrix Normal; /*!< \brief Normal (area) of the edge. */
46+
const Index nEdge, nEdgeSIMD;
4647

4748
friend class CPhysicalGeometry;
4849

@@ -70,13 +71,27 @@ class CEdge {
7071
inline unsigned long GetNode(unsigned long iEdge, unsigned long iNode) const { return Nodes(iEdge,iNode); }
7172

7273
/*!
73-
* \brief SIMD version of GetNode, iNode returned for multiple contiguous iEdges
74+
* \brief SIMD version of GetNode, iNode returned for contiguous iEdges.
7475
*/
7576
template<class T, size_t N>
7677
FORCEINLINE simd::Array<T,N> GetNode(simd::Array<T,N> iEdge, unsigned long iNode) const {
7778
return simd::Array<T,N>(&Nodes(iEdge[0],iNode));
7879
}
7980

81+
/*!
82+
* \brief Sets the tail of "Nodes" to repeat one of the last edges.
83+
* \note This is needed when using the SIMD version of GetNode and
84+
* the number of edges is not a multiple of the simd width.
85+
*/
86+
void SetPaddingNodes() {
87+
for (auto iEdge = nEdge; iEdge < nEdgeSIMD; ++iEdge) {
88+
/*--- Pad nodes by repeating the first edge in the last SIMD group. ---*/
89+
const auto iEdge0 = nEdgeSIMD - simd::preferredLen<su2double>();
90+
Nodes(iEdge, LEFT) = Nodes(iEdge0, LEFT);
91+
Nodes(iEdge, RIGHT) = Nodes(iEdge0, RIGHT);
92+
}
93+
}
94+
8095
/*!
8196
* \brief Set the node indices of an edge.
8297
* \param[in] iEdge - Edge index.

Common/include/linear_algebra/CSysSolve.hpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,11 @@ class CSysSolve {
219219
void HandleTemporariesIn(const CSysVector<OtherType>& LinSysRes, CSysVector<OtherType>& LinSysSol) {
220220

221221
/*--- Set the pointers. ---*/
222-
SU2_OMP_MASTER {
222+
BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS {
223223
LinSysRes_ptr = &LinSysRes;
224224
LinSysSol_ptr = &LinSysSol;
225225
}
226-
END_SU2_OMP_MASTER
227-
SU2_OMP_BARRIER
226+
END_SU2_OMP_SAFE_GLOBAL_ACCESS
228227
}
229228

230229
/*!
@@ -241,12 +240,11 @@ class CSysSolve {
241240
LinSysSol_tmp.PassiveCopy(LinSysSol);
242241

243242
/*--- Set the pointers. ---*/
244-
SU2_OMP_MASTER {
243+
BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS {
245244
LinSysRes_ptr = &LinSysRes_tmp;
246245
LinSysSol_ptr = &LinSysSol_tmp;
247246
}
248-
END_SU2_OMP_MASTER
249-
SU2_OMP_BARRIER
247+
END_SU2_OMP_SAFE_GLOBAL_ACCESS
250248
}
251249

252250
/*!
@@ -258,13 +256,11 @@ class CSysSolve {
258256
void HandleTemporariesOut(CSysVector<OtherType>& LinSysSol) {
259257

260258
/*--- Reset the pointers. ---*/
261-
SU2_OMP_BARRIER
262-
SU2_OMP_MASTER {
259+
BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS {
263260
LinSysRes_ptr = nullptr;
264261
LinSysSol_ptr = nullptr;
265262
}
266-
END_SU2_OMP_MASTER
267-
SU2_OMP_BARRIER
263+
END_SU2_OMP_SAFE_GLOBAL_ACCESS
268264
}
269265

270266
/*!
@@ -279,13 +275,11 @@ class CSysSolve {
279275
LinSysSol.PassiveCopy(LinSysSol_tmp);
280276

281277
/*--- Reset the pointers. ---*/
282-
SU2_OMP_BARRIER
283-
SU2_OMP_MASTER {
278+
BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS {
284279
LinSysRes_ptr = nullptr;
285280
LinSysSol_ptr = nullptr;
286281
}
287-
END_SU2_OMP_MASTER
288-
SU2_OMP_BARRIER
282+
END_SU2_OMP_SAFE_GLOBAL_ACCESS
289283
}
290284

291285
public:

Common/include/linear_algebra/CSysSolve_b.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
#ifdef CODI_REVERSE_TYPE
3333
template<class ScalarType>
3434
struct CSysSolve_b {
35-
static void Solve_b(const codi::RealReverse::Real* x, codi::RealReverse::Real* x_b, size_t m,
36-
const codi::RealReverse::Real* y, const codi::RealReverse::Real* y_b, size_t n,
35+
static void Solve_b(const su2double::Real* x, su2double::Real* x_b, size_t m,
36+
const su2double::Real* y, const su2double::Real* y_b, size_t n,
3737
codi::DataStore* d);
3838
};
3939
#endif

Common/include/linear_algebra/CSysVector.hpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ class CSysVector : public VecExpr::CVecExpr<CSysVector<ScalarType>, ScalarType>
186186
/*--- check if self-assignment, otherwise perform deep copy ---*/
187187
if ((const void*)this == (const void*)&other) return;
188188

189-
SU2_OMP_MASTER
190-
Initialize(other.GetNBlk(), other.GetNBlkDomain(), other.GetNVar(), nullptr, true, false);
191-
END_SU2_OMP_MASTER
192-
SU2_OMP_BARRIER
189+
SU2_OMP_SAFE_GLOBAL_ACCESS(Initialize(other.GetNBlk(), other.GetNBlkDomain(), other.GetNVar(), nullptr, true, false);)
193190

194191
CSYSVEC_PARFOR
195192
for (auto i = 0ul; i < nElm; i++) vec_val[i] = SU2_TYPE::GetValue(other[i]);
@@ -297,11 +294,7 @@ class CSysVector : public VecExpr::CVecExpr<CSysVector<ScalarType>, ScalarType>
297294
ScalarType dot(const VecExpr::CVecExpr<T, ScalarType>& expr) const {
298295
static ScalarType dotRes;
299296
/*--- All threads get the same "view" of the vectors and shared variable. ---*/
300-
SU2_OMP_BARRIER
301-
SU2_OMP_MASTER
302-
dotRes = 0.0;
303-
END_SU2_OMP_MASTER
304-
SU2_OMP_BARRIER
297+
SU2_OMP_SAFE_GLOBAL_ACCESS(dotRes = 0.0;)
305298

306299
/*--- Local dot product for each thread. ---*/
307300
ScalarType sum = 0.0;
@@ -317,16 +310,16 @@ class CSysVector : public VecExpr::CVecExpr<CSysVector<ScalarType>, ScalarType>
317310

318311
#ifdef HAVE_MPI
319312
/*--- Reduce across all mpi ranks, only master thread communicates. ---*/
320-
SU2_OMP_BARRIER
321-
SU2_OMP_MASTER {
313+
BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS {
322314
sum = dotRes;
323315
const auto mpi_type = (sizeof(ScalarType) < sizeof(double)) ? MPI_FLOAT : MPI_DOUBLE;
324316
SelectMPIWrapper<ScalarType>::W::Allreduce(&sum, &dotRes, 1, mpi_type, MPI_SUM, SU2_MPI::GetComm());
325317
}
326-
END_SU2_OMP_MASTER
327-
#endif
318+
END_SU2_OMP_SAFE_GLOBAL_ACCESS
319+
#else
328320
/*--- Make view of result consistent across threads. ---*/
329321
SU2_OMP_BARRIER
322+
#endif
330323

331324
return dotRes;
332325
}

Common/include/option_structure.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,13 @@ MakePair("ONESPECIES", ONESPECIES)
613613
* \brief types of coefficient transport model
614614
*/
615615
enum class TRANSCOEFFMODEL {
616+
SUTHERLAND,
616617
WILKE,
617618
GUPTAYOS,
618619
CHAPMANN_ENSKOG
619620
};
620621
static const MapType<std::string, TRANSCOEFFMODEL> TransCoeffModel_Map = {
622+
MakePair("SUTHERLAND", TRANSCOEFFMODEL::SUTHERLAND)
621623
MakePair("WILKE", TRANSCOEFFMODEL::WILKE)
622624
MakePair("GUPTA-YOS", TRANSCOEFFMODEL::GUPTAYOS)
623625
MakePair("CHAPMANN-ENSKOG", TRANSCOEFFMODEL::CHAPMANN_ENSKOG)

Common/include/parallelization/omp_structure.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,25 @@ void omp_finalize();
185185

186186
#endif
187187

188+
/* The SU2_OMP_SAFE_GLOBAL_ACCESS constructs are used to safeguard code that should only be executed by the master
189+
* thread, with all threads and memory views synchronized both beforehand and afterwards.
190+
*/
191+
192+
#define BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS \
193+
SU2_OMP_BARRIER \
194+
SU2_OMP_MASTER
195+
196+
#define END_SU2_OMP_SAFE_GLOBAL_ACCESS \
197+
END_SU2_OMP_MASTER \
198+
SU2_OMP_BARRIER
199+
200+
#define SU2_OMP_SAFE_GLOBAL_ACCESS(...) \
201+
BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS \
202+
{ \
203+
__VA_ARGS__ \
204+
} \
205+
END_SU2_OMP_SAFE_GLOBAL_ACCESS
206+
188207
/*--- Convenience functions (e.g. to compute chunk sizes). ---*/
189208

190209
/*!

Common/include/parallelization/vectorization.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ constexpr size_t PREFERRED_SIZE = 8;
5656
*/
5757
template<class T>
5858
constexpr size_t preferredLen() { return PREFERRED_SIZE / sizeof(T); }
59+
5960
template<>
6061
constexpr size_t preferredLen<su2double>() { return PREFERRED_SIZE / sizeof(passivedouble); }
6162

Common/src/CConfig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3792,8 +3792,8 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
37923792
SU2_MPI::Error("Only STANDARD_AIR fluid model can be used with US Measurement System", CURRENT_FUNCTION);
37933793
}
37943794

3795-
if (Kind_FluidModel == SU2_NONEQ && Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE ) {
3796-
SU2_MPI::Error("Only WILKE transport model is stable for the NEMO solver using SU2TClib. Use Mutation++ instead.", CURRENT_FUNCTION);
3795+
if (Kind_FluidModel == SU2_NONEQ && (Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE && Kind_TransCoeffModel != TRANSCOEFFMODEL::SUTHERLAND) ) {
3796+
SU2_MPI::Error("Only WILKE and SUTHERLAND transport models are stable for the NEMO solver using SU2TClib. Use Mutation++ instead.", CURRENT_FUNCTION);
37973797
}
37983798

37993799
if (Kind_FluidModel == MUTATIONPP && (Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE && Kind_TransCoeffModel != TRANSCOEFFMODEL::CHAPMANN_ENSKOG)) {

0 commit comments

Comments
 (0)