Skip to content

Commit 814f21a

Browse files
authored
Merge pull request #2442 from su2code/feature_tape_debug_mode
Tape recording debug mode
2 parents 3b3f73e + a426000 commit 814f21a

File tree

25 files changed

+670
-109
lines changed

25 files changed

+670
-109
lines changed

.github/workflows/regression.yml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
config_set: [BaseMPI, ReverseMPI, ForwardMPI, BaseNoMPI, ReverseNoMPI, ForwardNoMPI, BaseOMP, ReverseOMP, ForwardOMP]
26+
config_set: [BaseMPI, ReverseMPI, ForwardMPI, BaseNoMPI, ReverseNoMPI, ForwardNoMPI, ReverseTagNoMPI, BaseOMP, ReverseOMP, ForwardOMP]
2727
include:
2828
- config_set: BaseMPI
2929
flags: '-Denable-pywrapper=true -Denable-coolprop=true -Denable-mpp=true -Dinstall-mpp=true -Denable-mlpcpp=true -Denable-tests=true --warnlevel=2'
@@ -37,6 +37,8 @@ jobs:
3737
flags: '-Denable-autodiff=true -Denable-normal=false -Dwith-mpi=disabled -Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror'
3838
- config_set: ForwardNoMPI
3939
flags: '-Denable-directdiff=true -Denable-normal=false -Dwith-mpi=disabled -Denable-tests=true --warnlevel=3 --werror'
40+
- config_set: ReverseTagNoMPI
41+
flags: '-Denable-autodiff=true -Denable-normal=false -Dwith-mpi=disabled -Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror -Dcodi-tape=Tag'
4042
- config_set: BaseOMP
4143
flags: '-Dwith-omp=true -Denable-mixedprec=true -Denable-pywrapper=true -Denable-tecio=false --warnlevel=3 --werror'
4244
- config_set: ReverseOMP
@@ -215,6 +217,55 @@ jobs:
215217
with:
216218
entrypoint: /bin/rm
217219
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
220+
discadj_tape_tests:
221+
if: inputs.runner != 'ARM64'
222+
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
223+
name: Tape Tests
224+
needs: build
225+
strategy:
226+
fail-fast: false
227+
matrix:
228+
testscript: ['serial_regression_AD.py']
229+
include:
230+
- testscript: 'serial_regression_AD.py'
231+
tag: TagNoMPI
232+
steps:
233+
- name: Pre Cleanup
234+
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
235+
with:
236+
entrypoint: /bin/rm
237+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
238+
- name: Download All artifacts
239+
uses: actions/download-artifact@v4
240+
- name: Uncompress and Move Binaries
241+
run: |
242+
BIN_FOLDER="$PWD/install/bin"
243+
mkdir -p $BIN_FOLDER
244+
ls -lah $BIN_FOLDER
245+
for type in Base Reverse Forward; do
246+
TYPE_FOLDER="${type}${{matrix.tag}}"
247+
echo "Processing '$TYPE_FOLDER' ..."
248+
if [ -d $TYPE_FOLDER ]; then
249+
pushd $TYPE_FOLDER
250+
ls -lah
251+
tar -zxvf install_bin.tgz
252+
ls -lah install/bin/
253+
cp -r install/* $BIN_FOLDER/../
254+
popd;
255+
fi
256+
done
257+
chmod a+x $BIN_FOLDER/*
258+
ls -lahR $BIN_FOLDER
259+
- name: Run Tests in Container
260+
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
261+
with:
262+
# -t <Tutorials-branch> -c <Testcases-branch>
263+
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} -a "--tapetests"
264+
- name: Cleanup
265+
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
266+
with:
267+
entrypoint: /bin/rm
268+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
218269
thread_sanitizer_tests:
219270
if: inputs.runner != 'ARM64'
220271
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}

Common/include/CConfig.hpp

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,10 @@ class CConfig {
597597
//bool ContactResistance = false; /*!< \brief Apply contact resistance for conjugate heat transfer. */
598598
unsigned short nID_DV; /*!< \brief ID for the region of FEM when computed using direct differentiation. */
599599

600-
bool AD_Mode; /*!< \brief Algorithmic Differentiation support. */
601-
bool AD_Preaccumulation; /*!< \brief Enable or disable preaccumulation in the AD mode. */
600+
bool AD_Mode; /*!< \brief Algorithmic Differentiation support. */
601+
bool AD_Preaccumulation; /*!< \brief Enable or disable preaccumulation in the AD mode. */
602+
CHECK_TAPE_TYPE AD_CheckTapeType; /*!< \brief Type of tape that is checked in a tape debug run. */
603+
CHECK_TAPE_VARIABLES AD_CheckTapeVariables; /*!< \brief Type of variables that are checked in a tape debug run. */
602604
STRUCT_COMPRESS Kind_Material_Compress; /*!< \brief Determines if the material is compressible or incompressible (structural analysis). */
603605
STRUCT_MODEL Kind_Material; /*!< \brief Determines the material model to be used (structural analysis). */
604606
STRUCT_DEFORMATION Kind_Struct_Solver; /*!< \brief Determines the geometric condition (small or large deformations) for structural analysis. */
@@ -822,6 +824,7 @@ class CConfig {
822824
SurfSens_FileName, /*!< \brief Output file for the sensitivity on the surface (discrete adjoint). */
823825
VolSens_FileName, /*!< \brief Output file for the sensitivity in the volume (discrete adjoint). */
824826
ObjFunc_Hess_FileName; /*!< \brief Hessian approximation obtained by the Sobolev smoothing solver. */
827+
bool Multizone_Adapt_FileName; /*!< \brief Append zone number to solution and restart file names. */
825828

826829
bool
827830
Wrt_Performance, /*!< \brief Write the performance summary at the end of a calculation. */
@@ -1055,7 +1058,8 @@ class CConfig {
10551058
long ParMETIS_pointWgt; /*!< \brief Load balancing weight given to points. */
10561059
long ParMETIS_edgeWgt; /*!< \brief Load balancing weight given to edges. */
10571060
unsigned short DirectDiff; /*!< \brief Direct Differentation mode. */
1058-
bool DiscreteAdjoint; /*!< \brief AD-based discrete adjoint mode. */
1061+
bool DiscreteAdjoint, /*!< \brief AD-based discrete adjoint mode. */
1062+
DiscreteAdjointDebug; /*!< \brief Discrete adjoint debug mode using tags. */
10591063
su2double Const_DES; /*!< \brief Detached Eddy Simulation Constant. */
10601064
WINDOW_FUNCTION Kind_WindowFct; /*!< \brief Type of window (weight) function for objective functional. */
10611065
unsigned short Kind_HybridRANSLES; /*!< \brief Kind of Hybrid RANS/LES. */
@@ -1897,6 +1901,12 @@ class CConfig {
18971901
*/
18981902
su2double GetPressure_FreeStreamND(void) const { return Pressure_FreeStreamND; }
18991903

1904+
/*!
1905+
* \brief Get a reference to the non-dimensionalized freestream pressure (used for AD tracking).
1906+
* \return Reference to non-dimensionalized freestream pressure.
1907+
*/
1908+
su2double& GetPressure_FreeStreamND(void) { return Pressure_FreeStreamND; }
1909+
19001910
/*!
19011911
* \brief Get the value of the thermodynamic pressure.
19021912
* \return Thermodynamic pressure.
@@ -1922,6 +1932,12 @@ class CConfig {
19221932
*/
19231933
su2double GetTemperature_FreeStreamND(void) const { return Temperature_FreeStreamND; }
19241934

1935+
/*!
1936+
* \brief Get a reference to the non-dimensionalized freestream temperature (used for AD tracking).
1937+
* \return Reference to non-dimensionalized freestream temperature.
1938+
*/
1939+
su2double& GetTemperature_FreeStreamND(void) { return Temperature_FreeStreamND; }
1940+
19251941
/*!
19261942
* \brief Get the value of the non-dimensionalized vibrational-electronic freestream temperature.
19271943
* \return Non-dimensionalized vibrational-electronic freestream temperature.
@@ -5384,19 +5400,25 @@ class CConfig {
53845400
bool GetWrt_Volume_Overwrite(void) const { return Wrt_Volume_Overwrite; }
53855401

53865402
/*!
5387-
* \brief Provides the number of varaibles.
5403+
* \brief Get whether filenames are appended the zone number automatically (multiphysics solver).
5404+
* \return Flag for appending zone numbers to restart and solution filenames. If Flag=true, zone numer is appended.
5405+
*/
5406+
bool GetMultizone_AdaptFilename(void) const { return Multizone_Adapt_FileName; }
5407+
5408+
/*!
5409+
* \brief Provides the number of variables.
53885410
* \return Number of variables.
53895411
*/
53905412
unsigned short GetnVar(void);
53915413

53925414
/*!
5393-
* \brief Provides the number of varaibles.
5415+
* \brief Provides the number of variables.
53945416
* \return Number of variables.
53955417
*/
53965418
unsigned short GetnZone(void) const { return nZone; }
53975419

53985420
/*!
5399-
* \brief Provides the number of varaibles.
5421+
* \brief Provides the number of variables.
54005422
* \return Number of variables.
54015423
*/
54025424
unsigned short GetiZone(void) const { return iZone; }
@@ -8779,6 +8801,12 @@ class CConfig {
87798801
*/
87808802
bool GetDiscrete_Adjoint(void) const { return DiscreteAdjoint; }
87818803

8804+
/*!
8805+
* \brief Get the indicator whether a debug run for the discrete adjoint solver will be started.
8806+
* \return the discrete adjoint debug indicator.
8807+
*/
8808+
bool GetDiscrete_Adjoint_Debug(void) const { return DiscreteAdjointDebug; }
8809+
87828810
/*!
87838811
* \brief Get the number of subiterations while a ramp is applied.
87848812
* \return Number of FSI subiters.
@@ -9216,6 +9244,16 @@ class CConfig {
92169244
*/
92179245
su2double GetConst_DES(void) const { return Const_DES; }
92189246

9247+
/*!
9248+
* \brief Get the type of tape that will be checked in a tape debug run.
9249+
*/
9250+
CHECK_TAPE_TYPE GetAD_CheckTapeType(void) const { return AD_CheckTapeType; }
9251+
9252+
/*!
9253+
* \brief Get the type of variables that will be checked for in a tape debug run.
9254+
*/
9255+
CHECK_TAPE_VARIABLES GetAD_CheckTapeVariables(void) const { return AD_CheckTapeVariables; }
9256+
92199257
/*!
92209258
* \brief Get if AD preaccumulation should be performed.
92219259
*/
@@ -9605,6 +9643,11 @@ class CConfig {
96059643
*/
96069644
unsigned short GetnVolumeOutputFiles() const { return nVolumeOutputFiles; }
96079645

9646+
/*!
9647+
* \brief GetnVolumeOutputFrequencies
9648+
*/
9649+
unsigned short GetnVolumeOutputFrequencies() const { return nVolumeOutputFrequencies; }
9650+
96089651
/*!
96099652
* \brief GetVolumeOutputFrequency
96109653
* \param[in] iFile: index of file number for which the writing frequency needs to be returned.

0 commit comments

Comments
 (0)