Skip to content

Commit 6686171

Browse files
committed
updating branch
2 parents 79c9e52 + ebd1bae commit 6686171

File tree

9 files changed

+59
-71
lines changed

9 files changed

+59
-71
lines changed

Common/include/CConfig.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,6 @@ class CConfig {
11451145
su2double Theta_Interior_Penalty_DGFEM; /*!< \brief Factor for the symmetrizing terms in the DG discretization of the viscous fluxes. */
11461146
unsigned short byteAlignmentMatMul; /*!< \brief Number of bytes in the vectorization direction for the matrix multiplication. Multipe of 64. */
11471147
unsigned short sizeMatMulPadding; /*!< \brief The matrix size in the vectorization direction padded to a multiple of 8. Computed from byteAlignmentMatMul. */
1148-
unsigned short gpuSizeMatMulPadding;
11491148
bool Compute_Entropy; /*!< \brief Whether or not to compute the entropy in the fluid model. */
11501149
bool Use_Lumped_MassMatrix_DGFEM; /*!< \brief Whether or not to use the lumped mass matrix for DGFEM. */
11511150
bool Jacobian_Spatial_Discretization_Only; /*!< \brief Flag to know if only the exact Jacobian of the spatial discretization must be computed. */
@@ -9070,8 +9069,6 @@ class CConfig {
90709069
*/
90719070
unsigned short GetSizeMatMulPadding(void) const { return sizeMatMulPadding; }
90729071

9073-
unsigned short GetGPUSizeMatMulPadding(void) const { return gpuSizeMatMulPadding; }
9074-
90759072
/*!
90769073
* \brief Function to make available whether or not the entropy must be computed.
90779074
* \return The boolean whether or not the entropy must be computed.

Common/include/linear_algebra/CMatrixVectorProduct.hpp

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,6 @@
5858
* execution - CPU or GPU.
5959
*/
6060

61-
/*!
62-
* \class CExecutionPath
63-
* \brief Dummy super class that holds the correct member functions in its child classes
64-
*/
65-
template <class ScalarType>
66-
class CExecutionPath {
67-
public:
68-
virtual void mat_vec_prod(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v, CGeometry* geometry,
69-
const CConfig* config, const CSysMatrix<ScalarType>& matrix) = 0;
70-
};
71-
7261
template <class ScalarType>
7362
class CMatrixVectorProduct {
7463
public:
@@ -89,7 +78,6 @@ class CSysMatrixVectorProduct final : public CMatrixVectorProduct<ScalarType> {
8978
const CSysMatrix<ScalarType>& matrix; /*!< \brief pointer to matrix that defines the product. */
9079
CGeometry* geometry; /*!< \brief geometry associated with the matrix. */
9180
const CConfig* config; /*!< \brief config of the problem. */
92-
CExecutionPath<ScalarType>* exec; /*!< \brief interface that decides which path of execution to choose from. */
9381

9482
public:
9583
/*!
@@ -100,9 +88,7 @@ class CSysMatrixVectorProduct final : public CMatrixVectorProduct<ScalarType> {
10088
*/
10189
inline CSysMatrixVectorProduct(const CSysMatrix<ScalarType>& matrix_ref, CGeometry* geometry_ref,
10290
const CConfig* config_ref)
103-
: matrix(matrix_ref), geometry(geometry_ref), config(config_ref) {
104-
105-
}
91+
: matrix(matrix_ref), geometry(geometry_ref), config(config_ref) {}
10692

10793
/*!
10894
* \note This class cannot be default constructed as that would leave us with invalid pointers.
@@ -115,16 +101,14 @@ class CSysMatrixVectorProduct final : public CMatrixVectorProduct<ScalarType> {
115101
* \param[out] v - CSysVector that is the result of the product
116102
*/
117103
inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override {
118-
#ifdef HAVE_CUDA
119-
if(config->GetCUDA())
120-
{
104+
#ifdef HAVE_CUDA
105+
if (config->GetCUDA()) {
121106
matrix.GPUMatrixVectorProduct(u, v, geometry, config);
107+
} else {
108+
matrix.MatrixVectorProduct(u, v, geometry, config);
122109
}
123-
else {
110+
#else
124111
matrix.MatrixVectorProduct(u, v, geometry, config);
125-
}
126-
#else
127-
matrix.MatrixVectorProduct(u, v, geometry, config)
128-
#endif
112+
#endif
129113
}
130114
};

Common/include/template_nvblas.conf

Lines changed: 0 additions & 7 deletions
This file was deleted.

Common/src/CConfig.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2432,7 +2432,6 @@ void CConfig::SetConfig_Options() {
24322432
/* DESCRIPTION: Number of aligned bytes for the matrix multiplications. Multiple of 64. (128 by default) */
24332433
addUnsignedShortOption("ALIGNED_BYTES_MATMUL", byteAlignmentMatMul, 128);
24342434

2435-
addUnsignedShortOption("GPU Matrix Multiplication Size", gpuSizeMatMulPadding, 65472);
24362435
/*!\par CONFIG_CATEGORY: FEA solver \ingroup Config*/
24372436
/*--- Options related to the FEA solver ---*/
24382437

Common/src/linear_algebra/meson.build

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ common_src += files(['CSysSolve_b.cpp',
22
'CSysSolve.cpp',
33
'CSysVector.cpp',
44
'CSysMatrix.cpp',
5-
'CSysMatrixGPU.cu',
6-
'CSysVectorGPU.cu',
75
'CPastixWrapper.cpp',
86
'blas_structure.cpp'])
7+
8+
if get_option('enable-cuda')
9+
common_src += files(['CSysMatrixGPU.cu', 'CSysVectorGPU.cu',])
10+
endif

SU2_CFD/src/fluid/CFluidFlamelet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include <memory>
2929
#include <string>
30-
#include "../include/fluid/CFluidFlamelet.hpp"
30+
#include "../../include/fluid/CFluidFlamelet.hpp"
3131
#include "../../../Common/include/containers/CLookUpTable.hpp"
3232
#if defined(HAVE_MLPCPP)
3333
#include "../../../subprojects/MLPCpp/include/CLookUp_ANN.hpp"

SU2_CFD/src/solvers/CFEM_DG_NSSolver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,8 +1671,8 @@ void CFEM_DG_NSSolver::ADER_DG_AliasedPredictorResidual_3D(CConfig
16711671
/* Determine the offset between the r-derivatives and s-derivatives of the
16721672
fluxes in the integration points and the offset between the r-derivatives
16731673
and s-derivatives of the solution in the DOFs. */
1674-
const unsigned int offDerivSol = NPad*nDOFs;
1675-
const unsigned int offDerivFluxes = NPad*nInt;
1674+
const unsigned short offDerivSol = NPad*nDOFs;
1675+
const unsigned short offDerivFluxes = NPad*nInt;
16761676

16771677
/* Store the number of metric points per integration point/DOF for readability. */
16781678
const unsigned short nMetricPerPoint = 10; /* nDim*nDim + 1. */
@@ -3869,7 +3869,7 @@ void CFEM_DG_NSSolver::ResidualFaces(CConfig *config,
38693869
/*--- Subtract half of the viscous fluxes from the inviscid fluxes. The
38703870
factor 0.5 comes from the fact that the average of the viscous fluxes
38713871
of side 0 and side 1 must be taken in the DG-FEM formulation. ---*/
3872-
for(unsigned int j=0; j<(NPad*nInt); ++j) fluxes[j] -= 0.5*viscFluxes[j];
3872+
for(unsigned short j=0; j<(NPad*nInt); ++j) fluxes[j] -= 0.5*viscFluxes[j];
38733873

38743874
/*---------------------------*/
38753875
/*--- Side 1 of the face. ---*/

SU2_CFD/src/solvers/CSolver.cpp

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3619,38 +3619,42 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
36193619
columnValue << setprecision(15);
36203620
columnValue << std::scientific;
36213621

3622-
su2double p_total, t_total;
3623-
const su2double* flow_dir = nullptr;
3622+
// Set the variables to store the flow variables. For a subsonic inlet the total conditions
3623+
// are stored in p_value and t_value and the flow direction in flow_dir_or_vel, while for a
3624+
// supersonic inlet the static conditions are stored in p_value and t_value and the flow
3625+
// velocity in flow_dir_or_vel.
3626+
su2double p_value, t_value;
3627+
const su2double* flow_dir_or_vel = nullptr;
36243628

36253629
if (KIND_MARKER == INLET_FLOW) {
3626-
p_total = config->GetInletPtotal(Marker_Tag);
3627-
t_total = config->GetInletTtotal(Marker_Tag);
3628-
flow_dir = config->GetInletFlowDir(Marker_Tag);
3630+
p_value = config->GetInletPtotal(Marker_Tag);
3631+
t_value = config->GetInletTtotal(Marker_Tag);
3632+
flow_dir_or_vel = config->GetInletFlowDir(Marker_Tag);
36293633
} else if (KIND_MARKER == SUPERSONIC_INLET) {
3630-
p_total = config->GetInlet_Pressure(Marker_Tag);
3631-
t_total = config->GetInlet_Temperature(Marker_Tag);
3632-
flow_dir = config->GetInlet_Velocity(Marker_Tag);
3634+
p_value = config->GetInlet_Pressure(Marker_Tag);
3635+
t_value = config->GetInlet_Temperature(Marker_Tag);
3636+
flow_dir_or_vel = config->GetInlet_Velocity(Marker_Tag);
36333637
} else {
36343638
SU2_MPI::Error("Unsupported type of inlet.", CURRENT_FUNCTION);
36353639
}
3636-
columnValue << t_total << "\t" << p_total <<"\t";
3640+
columnValue << t_value << "\t" << p_value << "\t";
36373641
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
3638-
columnValue << flow_dir[iDim] <<"\t";
3642+
columnValue << flow_dir_or_vel[iDim] << "\t";
36393643
}
36403644

3641-
columnName << "# COORD-X " << setw(24) << "COORD-Y " << setw(24);
3642-
if(nDim==3) columnName << "COORD-Z " << setw(24);
3645+
columnName << left << setw(24) << "# COORD-X" << left << setw(24) << "COORD-Y";
3646+
if (nDim == 3) columnName << left << setw(24) << "COORD-Z";
36433647

36443648
if (KIND_MARKER == SUPERSONIC_INLET) {
3645-
columnName << "TEMPERATURE" << setw(24) << "PRESSURE " << setw(24);
3649+
columnName << left << setw(24) << "TEMPERATURE" << left << setw(24) << "PRESSURE";
36463650
} else if (config->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE) {
36473651
switch (config->GetKind_Inlet()) {
36483652
/*--- compressible conditions ---*/
36493653
case INLET_TYPE::TOTAL_CONDITIONS:
3650-
columnName << "TEMPERATURE" << setw(24) << "PRESSURE " << setw(24);
3654+
columnName << left << setw(24) << "TOTAL_TEMPERATURE" << left << setw(24) << "TOTAL_PRESSURE";
36513655
break;
36523656
case INLET_TYPE::MASS_FLOW:
3653-
columnName << "DENSITY " << setw(24) << "VELOCITY " << setw(24);
3657+
columnName << left << setw(24) << "DENSITY" << left << setw(24) << "VELOCITY";
36543658
break;
36553659
default:
36563660
SU2_MPI::Error("Unsupported INLET_TYPE.", CURRENT_FUNCTION);
@@ -3660,30 +3664,36 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
36603664
switch (config->GetKind_Inc_Inlet(Marker_Tag)) {
36613665
/*--- incompressible conditions ---*/
36623666
case INLET_TYPE::VELOCITY_INLET:
3663-
columnName << "TEMPERATURE" << setw(24) << "VELOCITY " << setw(24);
3667+
columnName << left << setw(24) << "TEMPERATURE " << left << setw(24) << "VELOCITY";
36643668
break;
36653669
case INLET_TYPE::PRESSURE_INLET:
3666-
columnName << "TEMPERATURE" << setw(24) << "PRESSURE " << setw(24);
3670+
columnName << left << setw(24) << "TEMPERATURE" << left << setw(24) << "PRESSURE";
36673671
break;
36683672
default:
36693673
SU2_MPI::Error("Unsupported INC_INLET_TYPE.", CURRENT_FUNCTION);
36703674
break;
36713675
}
36723676
}
36733677

3674-
columnName << "NORMAL-X " << setw(24) << "NORMAL-Y " << setw(24);
3675-
if(nDim==3) columnName << "NORMAL-Z " << setw(24);
3678+
if (KIND_MARKER == SUPERSONIC_INLET) {
3679+
columnName << left << setw(24) << "VELOCITY-X" << left << setw(24) << "VELOCITY-Y";
3680+
if (nDim == 3) columnName << left << setw(24) << "VELOCITY-Z";
3681+
} else {
3682+
columnName << left << setw(24) << "NORMAL-X" << left << setw(24) << "NORMAL-Y";
3683+
if (nDim == 3) columnName << left << setw(24) << "NORMAL-Z";
3684+
}
36763685

36773686
switch (TurbModelFamily(config->GetKind_Turb_Model())) {
3678-
case TURB_FAMILY::NONE: break;
3687+
case TURB_FAMILY::NONE:
3688+
break;
36793689
case TURB_FAMILY::SA:
36803690
/*--- 1-equation turbulence model: SA ---*/
3681-
columnName << "NU_TILDE " << setw(24);
3691+
columnName << left << setw(24) << "NU_TILDE";
36823692
columnValue << config->GetNuFactor_FreeStream() * config->GetViscosity_FreeStream() / config->GetDensity_FreeStream() <<"\t";
36833693
break;
36843694
case TURB_FAMILY::KW:
36853695
/*--- 2-equation turbulence model (SST) ---*/
3686-
columnName << "TKE " << setw(24) << "DISSIPATION" << setw(24);
3696+
columnName << left << setw(24) << "TKE" << left << setw(24) << "DISSIPATION";
36873697
columnValue << config->GetTke_FreeStream() << "\t" << config->GetOmega_FreeStream() <<"\t";
36883698
break;
36893699
}
@@ -3692,22 +3702,22 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
36923702
case SPECIES_MODEL::NONE: break;
36933703
case SPECIES_MODEL::SPECIES_TRANSPORT:
36943704
for (unsigned short iVar = 0; iVar < nVar_Species; iVar++) {
3695-
columnName << "SPECIES_" + std::to_string(iVar) + " " << setw(24);
3705+
columnName << left << setw(24) << "SPECIES_" + std::to_string(iVar);
36963706
columnValue << config->GetInlet_SpeciesVal(Marker_Tag)[iVar] << "\t";
36973707
}
36983708
break;
36993709
case SPECIES_MODEL::FLAMELET: {
37003710
const auto& flamelet_config_options = config->GetFlameletParsedOptions();
37013711
/*--- 2-equation flamelet model ---*/
3702-
columnName << "PROGRESSVAR" << setw(24) << "ENTHALPYTOT" << setw(24);
3703-
columnValue << config->GetInlet_SpeciesVal(Marker_Tag)[0] << "\t" << config->GetInlet_SpeciesVal(Marker_Tag)[1]<<"\t";
3712+
columnName << left << setw(24) << "PROGRESSVAR" << left << setw(24) << "ENTHALPYTOT";
3713+
columnValue << config->GetInlet_SpeciesVal(Marker_Tag)[0] << "\t" << config->GetInlet_SpeciesVal(Marker_Tag)[1] <<"\t";
37043714
/*--- auxiliary species transport equations ---*/
37053715
for (unsigned short iReactant = 0; iReactant < flamelet_config_options.n_user_scalars; iReactant++) {
3706-
columnName << flamelet_config_options.user_scalar_names[iReactant] << setw(24);
3716+
columnName << left << setw(24) << flamelet_config_options.user_scalar_names[iReactant];
37073717
columnValue << config->GetInlet_SpeciesVal(Marker_Tag)[flamelet_config_options.n_control_vars + iReactant] << "\t";
37083718
}
3709-
}
37103719
break;
3720+
}
37113721
}
37123722

37133723
columnNames.push_back(columnName.str());

meson.build

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
project('SU2', 'c', 'cpp', 'cuda',
2+
project('SU2', 'c', 'cpp',
33
version: '8.2.0 "Harrier"',
44
meson_version: '>=0.61.1',
55
license: 'LGPL2',
@@ -16,8 +16,10 @@ endif
1616
pymod = import('python')
1717
python = pymod.find_installation()
1818

19-
add_global_arguments(['-arch=sm_86'], language : 'cuda')
20-
19+
if get_option('enable-cuda')
20+
add_languages('cuda')
21+
add_global_arguments('-arch=sm_86', language : 'cuda')
22+
endif
2123

2224
su2_cpp_args = []
2325
su2_deps = [declare_dependency(include_directories: 'externals/CLI11')]
@@ -200,9 +202,10 @@ if get_option('enable-pastix')
200202
su2_deps += pastix_dep
201203
endif
202204

205+
# CUDA dependencies
203206
if get_option('enable-cuda')
204207
su2_cpp_args += '-DHAVE_CUDA'
205-
gpu_dep = dependency('cuda', version : '>=10', modules : ['cudart', 'nvblas'])
208+
gpu_dep = dependency('cuda', version : '>=10', modules : ['cudart'])
206209
su2_deps += gpu_dep
207210
endif
208211

0 commit comments

Comments
 (0)