Skip to content

Commit c52a694

Browse files
committed
more intel fixes
1 parent 869907b commit c52a694

8 files changed

Lines changed: 114 additions & 106 deletions

File tree

Common/include/basic_types/datatype_structure.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#define FORCEINLINE inline
4141
#endif
4242

43-
#if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
43+
#if defined(__GNUC__) || defined(__clang__)
4444
#define NEVERINLINE inline __attribute__((noinline))
4545
#else
4646
#define NEVERINLINE inline

Common/include/containers/C2DContainer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ class C2DContainer :
584584
static_assert(Size, "This method requires a static output type.");
585585
assert(Size <= cols()-start);
586586
StaticContainer ret;
587-
SU2_OMP_SIMD
587+
SU2_OMP_SIMD_IF_NOT_AD
588588
for (size_t i=0; i<Size; ++i)
589589
ret.data()[i] = m_data[IsRowMajor? row*cols()+i+start : row+(i+start)*rows()];
590590
return ret;
@@ -601,7 +601,7 @@ class C2DContainer :
601601
assert(Size <= cols()-start);
602602
StaticContainer ret;
603603
for (size_t k=0; k<N; ++k) {
604-
SU2_OMP_SIMD
604+
SU2_OMP_SIMD_IF_NOT_AD
605605
for (size_t i=0; i<Size; ++i)
606606
ret.data()[i][k] = m_data[IsRowMajor? row[k]*cols()+i+start : row[k]+(i+start)*rows()];
607607
}

Common/include/linear_algebra/CSysVector.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class CSysVector : public VecExpr::CVecExpr<CSysVector<ScalarType>, ScalarType>
9090
FORCEINLINE static void UnpackBlock(const VecTypeSIMD& in, simd::Array<F, N> mask, ScalarType out[][nVar]) {
9191
static_assert(VecTypeSIMD::StaticSize, "This method requires static size vectors.");
9292
for (size_t i = 0; i < nVar; ++i) {
93-
SU2_OMP_SIMD
93+
SU2_OMP_SIMD_IF_NOT_AD
9494
for (size_t k = 0; k < N; ++k) out[k][i] = mask[k] * in[i][k];
9595
}
9696
}
@@ -413,7 +413,7 @@ class CSysVector : public VecExpr::CVecExpr<CSysVector<ScalarType>, ScalarType>
413413
/*--- Update one by one skipping if mask is 0. ---*/
414414
for (size_t k = 0; k < N; ++k) {
415415
if (mask[k] == 0) continue;
416-
SU2_OMP_SIMD
416+
SU2_OMP_SIMD_IF_NOT_AD
417417
for (size_t i = 0; i < nVar; ++i) vec_val[iPoint[k] * nVar + i] = vec[k][i];
418418
}
419419
}
@@ -434,7 +434,7 @@ class CSysVector : public VecExpr::CVecExpr<CSysVector<ScalarType>, ScalarType>
434434
/*--- Update one by one skipping if mask is 0. ---*/
435435
for (size_t k = 0; k < N; ++k) {
436436
if (mask[k] == 0) continue;
437-
SU2_OMP_SIMD
437+
SU2_OMP_SIMD_IF_NOT_AD
438438
for (size_t i = 0; i < nVar; ++i) {
439439
vec_val[iPoint[k] * nVar + i] += vec[k][i];
440440
vec_val[jPoint[k] * nVar + i] -= vec[k][i];

Common/include/mpi_structure.inl

Lines changed: 2 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -32,73 +32,6 @@
3232

3333
#ifdef HAVE_MPI
3434

35-
NEVERINLINE void CBaseMPIWrapper::Error(std::string ErrorMsg, std::string FunctionName){
36-
37-
/* Set MinRankError to Rank, as the error message is called on this rank. */
38-
MinRankError = Rank;
39-
int flag = 0;
40-
41-
#if MPI_VERSION >= 3
42-
/* Find out whether the error call is collective via MPI_Ibarrier. */
43-
Request barrierRequest;
44-
MPI_Ibarrier(currentComm, &barrierRequest);
45-
46-
/* Try to complete the non-blocking barrier call for a second. */
47-
double startTime = SU2_MPI::Wtime();
48-
while( true ) {
49-
50-
MPI_Test(&barrierRequest, &flag, MPI_STATUS_IGNORE);
51-
if( flag ) break;
52-
53-
double currentTime = SU2_MPI::Wtime();
54-
if(currentTime > startTime + 1.0) break;
55-
}
56-
#else
57-
/* MPI_Ibarrier function is not supported. Simply wait for one
58-
second to give other ranks the opportunity to reach this point. */
59-
#ifdef _MSC_VER
60-
_sleep(1);
61-
#else
62-
sleep(1);
63-
#endif
64-
#endif
65-
66-
if( flag ) {
67-
/* The barrier is completed and hence the error call is collective.
68-
Set MinRankError to 0. */
69-
MinRankError = 0;
70-
}
71-
else {
72-
/* The error call is not collective and the minimum rank must be
73-
determined by one sided communication. Loop over the lower numbered
74-
ranks to check if they participate in the error message. */
75-
for(int i=0; i<Rank; ++i) {
76-
77-
int MinRankErrorOther;
78-
MPI_Win_lock(MPI_LOCK_SHARED, i, 0, winMinRankError);
79-
MPI_Get(&MinRankErrorOther, 1, MPI_INT, i, 0, 1, MPI_INT, winMinRankError);
80-
MPI_Win_unlock(i, winMinRankError);
81-
82-
if(MinRankErrorOther < MinRankError) {
83-
MinRankError = MinRankErrorOther;
84-
break;
85-
}
86-
}
87-
}
88-
89-
/* Check if this rank must write the error message and do so. */
90-
if (Rank == MinRankError){
91-
std::cout << std::endl << std::endl;
92-
std::cout << "Error in \"" << FunctionName << "\": " << std::endl;
93-
std::cout << "-------------------------------------------------------------------------" << std::endl;
94-
std::cout << ErrorMsg << std::endl;
95-
std::cout << "------------------------------ Error Exit -------------------------------" << std::endl;
96-
std::cout << std::endl << std::endl;
97-
}
98-
Abort(currentComm, EXIT_FAILURE);
99-
}
100-
101-
10235
inline int CBaseMPIWrapper::GetRank(){
10336
return Rank;
10437
}
@@ -515,20 +448,9 @@ inline void CMediMPIWrapper::Waitany(int nrequests, Request *request,
515448
int *index, Status *status) {
516449
AMPI_Waitany(nrequests, request, index, status);
517450
}
518-
#endif
519-
#else // HAVE_MPI
451+
#endif // CODI
520452

521-
NEVERINLINE void CBaseMPIWrapper::Error(std::string ErrorMsg, std::string FunctionName){
522-
if (Rank == 0){
523-
std::cout << std::endl << std::endl;
524-
std::cout << "Error in \"" << FunctionName << "\": " << std::endl;
525-
std::cout << "-------------------------------------------------------------------------" << std::endl;
526-
std::cout << ErrorMsg << std::endl;
527-
std::cout << "------------------------------ Error Exit -------------------------------" << std::endl;
528-
std::cout << std::endl << std::endl;
529-
}
530-
Abort(currentComm, 0);
531-
}
453+
#else // HAVE_MPI
532454

533455
inline int CBaseMPIWrapper::GetRank(){
534456
return Rank;

Common/include/omp_structure.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ inline void omp_destroy_lock(omp_lock_t*){}
117117
#define SU2_OMP_SIMD
118118
#endif
119119

120+
#if defined(CODI_FORWARD_TYPE) || defined(CODI_REVERSE_TYPE)
121+
#define SU2_OMP_SIMD_IF_NOT_AD
122+
#else
123+
#define SU2_OMP_SIMD_IF_NOT_AD SU2_OMP_SIMD
124+
#endif
125+
120126
/*--- Convenience macros (do not use excessive nesting). ---*/
121127

122128
#define SU2_OMP_MASTER SU2_OMP(master)

Common/src/CConfig.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,7 @@ void CConfig::SetConfig_Options() {
18141814
addBoolOption("USE_ACCURATE_FLUX_JACOBIANS", Use_Accurate_Jacobians, false);
18151815
/*!\brief CENTRAL_JACOBIAN_FIX_FACTOR \n DESCRIPTION: Improve the numerical properties (diagonal dominance) of the global Jacobian matrix, 3 to 4 is "optimum" (central schemes) \ingroup Config*/
18161816
addDoubleOption("CENTRAL_JACOBIAN_FIX_FACTOR", Cent_Jac_Fix_Factor, 4.0);
1817-
1817+
18181818
/*!\brief CONV_NUM_METHOD_ADJFLOW
18191819
* \n DESCRIPTION: Convective numerical method for the adjoint solver.
18201820
* \n OPTIONS: See \link Upwind_Map \endlink , \link Centered_Map \endlink. Note: not all methods are guaranteed to be implemented for the adjoint solver. \ingroup Config */
@@ -4659,7 +4659,7 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
46594659
nRough_Wall = nWall;
46604660
Roughness_Height = new su2double [nWall];
46614661
Kind_Wall = new unsigned short [nWall];
4662-
for (unsigned short iMarker = 0; iMarker < nMarker_HeatFlux; iMarker++) {
4662+
for (iMarker = 0; iMarker < nMarker_HeatFlux; iMarker++) {
46634663
Roughness_Height[iMarker] = 0.0;
46644664
Kind_Wall[iMarker] = SMOOTH;
46654665
}
@@ -5009,7 +5009,7 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
50095009
if (edgeColorGroupSize==0) edgeColorGroupSize = 1<<30;
50105010

50115011
/*--- Specifying a deforming surface requires a mesh deformation solver. ---*/
5012-
if (GetSurface_Movement(DEFORMING)) Deform_Mesh = true;
5012+
if (GetSurface_Movement(DEFORMING)) Deform_Mesh = true;
50135013

50145014
}
50155015

@@ -5042,7 +5042,7 @@ void CConfig::SetMarkers(unsigned short val_software) {
50425042
nMarker_CfgFile = nMarker_Euler + nMarker_FarField + nMarker_SymWall +
50435043
nMarker_PerBound + nMarker_NearFieldBound + nMarker_Fluid_InterfaceBound +
50445044
nMarker_CHTInterface + nMarker_Inlet + nMarker_Riemann + nMarker_Smoluchowski_Maxwell +
5045-
nMarker_Giles + nMarker_Outlet + nMarker_Isothermal +
5045+
nMarker_Giles + nMarker_Outlet + nMarker_Isothermal +
50465046
nMarker_HeatFlux +
50475047
nMarker_EngineInflow + nMarker_EngineExhaust + nMarker_Internal +
50485048
nMarker_Supersonic_Inlet + nMarker_Supersonic_Outlet + nMarker_Displacement + nMarker_Load +
@@ -5317,7 +5317,7 @@ void CConfig::SetMarkers(unsigned short val_software) {
53175317
Marker_CfgFile_KindBC[iMarker_CfgFile] = ISOTHERMAL;
53185318
iMarker_CfgFile++;
53195319
}
5320-
5320+
53215321
for (iMarker_Smoluchowski_Maxwell = 0; iMarker_Smoluchowski_Maxwell < nMarker_Smoluchowski_Maxwell; iMarker_Smoluchowski_Maxwell++) {
53225322
Marker_CfgFile_TagBound[iMarker_CfgFile] = Marker_Smoluchowski_Maxwell[iMarker_Smoluchowski_Maxwell];
53235323
Marker_CfgFile_KindBC[iMarker_CfgFile] = SMOLUCHOWSKI_MAXWELL;
@@ -5581,14 +5581,14 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) {
55815581
break;
55825582
case NEMO_EULER:
55835583
if (Kind_Regime == COMPRESSIBLE) cout << "Compressible two-temperature thermochemical non-equilibrium Euler equations." << endl;
5584-
if(Kind_FluidModel == USER_DEFINED_NONEQ){
5584+
if(Kind_FluidModel == USER_DEFINED_NONEQ){
55855585
if ((GasModel != "N2") && (GasModel != "AIR-5"))
55865586
SU2_MPI::Error("The GAS_MODEL given as input is not valid. Choose one of the options: N2, AIR-5.", CURRENT_FUNCTION);
55875587
}
55885588
break;
5589-
case NEMO_NAVIER_STOKES:
5589+
case NEMO_NAVIER_STOKES:
55905590
if (Kind_Regime == COMPRESSIBLE) cout << "Compressible two-temperature thermochemical non-equilibrium Navier-Stokes equations." << endl;
5591-
if(Kind_FluidModel == USER_DEFINED_NONEQ){
5591+
if(Kind_FluidModel == USER_DEFINED_NONEQ){
55925592
if ((GasModel != "N2") && (GasModel != "AIR-5"))
55935593
SU2_MPI::Error("The GAS_MODEL given as input is not valid. Choose one of the options: N2, AIR-5.", CURRENT_FUNCTION);
55945594
}
@@ -6384,7 +6384,7 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) {
63846384

63856385
if ((Kind_Solver == EULER) || (Kind_Solver == NAVIER_STOKES) || (Kind_Solver == RANS) ||
63866386
(Kind_Solver == INC_EULER) || (Kind_Solver == INC_NAVIER_STOKES) || (Kind_Solver == INC_RANS) ||
6387-
(Kind_Solver == NEMO_EULER) || (Kind_Solver == NEMO_NAVIER_STOKES) ||
6387+
(Kind_Solver == NEMO_EULER) || (Kind_Solver == NEMO_NAVIER_STOKES) ||
63886388
(Kind_Solver == DISC_ADJ_INC_EULER) || (Kind_Solver == DISC_ADJ_INC_NAVIER_STOKES) || (Kind_Solver == DISC_ADJ_INC_RANS) ||
63896389
(Kind_Solver == DISC_ADJ_EULER) || (Kind_Solver == DISC_ADJ_NAVIER_STOKES) || (Kind_Solver == DISC_ADJ_RANS) ||
63906390
(Kind_Solver == DISC_ADJ_FEM_EULER) || (Kind_Solver == DISC_ADJ_FEM_NS) || (Kind_Solver == DISC_ADJ_FEM_RANS)) {
@@ -9790,7 +9790,7 @@ void CConfig::SetMultizone(CConfig *driver_config, CConfig **config_container){
97909790
switch (config_container[iZone]->GetKind_Solver()) {
97919791
case EULER: case NAVIER_STOKES: case RANS:
97929792
case INC_EULER: case INC_NAVIER_STOKES: case INC_RANS:
9793-
case NEMO_EULER: case NEMO_NAVIER_STOKES:
9793+
case NEMO_EULER: case NEMO_NAVIER_STOKES:
97949794
fluid_zone = true;
97959795
break;
97969796
case FEM_ELASTICITY:

Common/src/mpi_structure.cpp

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* SU2 Project Website: https://su2code.github.io
88
*
9-
* The SU2 Project is maintained by the SU2 Foundation
9+
* The SU2 Project is maintained by the SU2 Foundation
1010
* (http://su2foundation.org)
1111
*
1212
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
@@ -35,6 +35,85 @@ CBaseMPIWrapper::Comm CBaseMPIWrapper::currentComm = MPI_COMM_WORLD;
3535
int CBaseMPIWrapper::MinRankError;
3636
bool CBaseMPIWrapper::winMinRankErrorInUse = false;
3737
CBaseMPIWrapper::Win CBaseMPIWrapper::winMinRankError;
38+
39+
void CBaseMPIWrapper::Error(std::string ErrorMsg, std::string FunctionName){
40+
41+
/* Set MinRankError to Rank, as the error message is called on this rank. */
42+
MinRankError = Rank;
43+
int flag = 0;
44+
45+
#if MPI_VERSION >= 3
46+
/* Find out whether the error call is collective via MPI_Ibarrier. */
47+
Request barrierRequest;
48+
MPI_Ibarrier(currentComm, &barrierRequest);
49+
50+
/* Try to complete the non-blocking barrier call for a second. */
51+
double startTime = SU2_MPI::Wtime();
52+
while( true ) {
53+
54+
MPI_Test(&barrierRequest, &flag, MPI_STATUS_IGNORE);
55+
if( flag ) break;
56+
57+
double currentTime = SU2_MPI::Wtime();
58+
if(currentTime > startTime + 1.0) break;
59+
}
60+
#else
61+
/* MPI_Ibarrier function is not supported. Simply wait for one
62+
second to give other ranks the opportunity to reach this point. */
63+
#ifdef _MSC_VER
64+
_sleep(1);
65+
#else
66+
sleep(1);
67+
#endif
68+
#endif
69+
70+
if( flag ) {
71+
/* The barrier is completed and hence the error call is collective.
72+
Set MinRankError to 0. */
73+
MinRankError = 0;
74+
}
75+
else {
76+
/* The error call is not collective and the minimum rank must be
77+
determined by one sided communication. Loop over the lower numbered
78+
ranks to check if they participate in the error message. */
79+
for(int i=0; i<Rank; ++i) {
80+
81+
int MinRankErrorOther;
82+
MPI_Win_lock(MPI_LOCK_SHARED, i, 0, winMinRankError);
83+
MPI_Get(&MinRankErrorOther, 1, MPI_INT, i, 0, 1, MPI_INT, winMinRankError);
84+
MPI_Win_unlock(i, winMinRankError);
85+
86+
if(MinRankErrorOther < MinRankError) {
87+
MinRankError = MinRankErrorOther;
88+
break;
89+
}
90+
}
91+
}
92+
93+
/* Check if this rank must write the error message and do so. */
94+
if (Rank == MinRankError){
95+
std::cout << std::endl << std::endl;
96+
std::cout << "Error in \"" << FunctionName << "\": " << std::endl;
97+
std::cout << "-------------------------------------------------------------------------" << std::endl;
98+
std::cout << ErrorMsg << std::endl;
99+
std::cout << "------------------------------ Error Exit -------------------------------" << std::endl;
100+
std::cout << std::endl << std::endl;
101+
}
102+
Abort(currentComm, EXIT_FAILURE);
103+
}
104+
#else // HAVE_MPI
105+
106+
void CBaseMPIWrapper::Error(std::string ErrorMsg, std::string FunctionName){
107+
if (Rank == 0){
108+
std::cout << std::endl << std::endl;
109+
std::cout << "Error in \"" << FunctionName << "\": " << std::endl;
110+
std::cout << "-------------------------------------------------------------------------" << std::endl;
111+
std::cout << ErrorMsg << std::endl;
112+
std::cout << "------------------------------ Error Exit -------------------------------" << std::endl;
113+
std::cout << std::endl << std::endl;
114+
}
115+
Abort(currentComm, 0);
116+
}
38117
#endif
39118

40119
#ifdef HAVE_MPI
@@ -43,4 +122,4 @@ MediTypes* mediTypes;
43122
#include <medi/medi.cpp>
44123
#endif // defined CODI_REVERSE_TYPE || defined CODI_FORWARD_TYPE
45124

46-
#endif// HAVE_MPI
125+
#endif // HAVE_MPI

meson.build

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ python = pymod.find_installation()
1212
su2_cpp_args = []
1313
su2_deps = [declare_dependency(include_directories: 'externals/CLI11')]
1414

15-
if build_machine.system() == 'windows'
16-
default_warning_flags = []
17-
else
18-
default_warning_flags = ['-Wno-unused-parameter',
19-
'-Wno-empty-body',
20-
'-Wno-format-security',
21-
'-Wno-deprecated-declarations',
22-
'-Wno-non-virtual-dtor']
15+
default_warning_flags = []
16+
if build_machine.system() != 'windows'
17+
if meson.get_compiler('cpp').get_id() != 'intel'
18+
default_warning_flags += ['-Wno-empty-body']
19+
endif
20+
default_warning_flags += ['-Wno-unused-parameter',
21+
'-Wno-format-security',
22+
'-Wno-deprecated-declarations',
23+
'-Wno-non-virtual-dtor']
2324
endif
2425

2526
# meson script path

0 commit comments

Comments
 (0)