Skip to content

Commit

Permalink
CoDiPack tape choice via build options.
Browse files Browse the repository at this point in the history
  • Loading branch information
jblueh committed Jun 11, 2021
1 parent bb27a0b commit 183c3ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
20 changes: 5 additions & 15 deletions Common/include/code_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,15 @@ using su2conditional_t = typename su2conditional<B,T,F>::type;
#include "codi.hpp"
#include "codi/tools/dataStore.hpp"

#ifndef CODI_INDEX_TAPE
#define CODI_INDEX_TAPE 0
#endif
#ifndef CODI_PRIMAL_TAPE
#define CODI_PRIMAL_TAPE 0
#endif
#ifndef CODI_PRIMAL_INDEX_TAPE
#define CODI_PRIMAL_INDEX_TAPE 0
#endif

#if defined(HAVE_OMP)
using su2double = codi::RealReverseIndexParallel;
#else
#if CODI_INDEX_TAPE
#if defined(CODI_INDEX_TAPE)
using su2double = codi::RealReverseIndex;
#elif CODI_PRIMAL_TAPE
using su2double = codi::RealReversePrimal;
#elif CODI_PRIMAL_INDEX_TAPE
using su2double = codi::RealReversePrimalIndex;
//#elif defined(CODI_PRIMAL_TAPE)
//using su2double = codi::RealReversePrimal;
//#elif defined(CODI_PRIMAL_INDEX_TAPE)
//using su2double = codi::RealReversePrimalIndex;
#else
using su2double = codi::RealReverse;
#endif
Expand Down
14 changes: 12 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,18 @@ endif

if get_option('enable-autodiff') or get_option('enable-directdiff')
codi_dep = [declare_dependency(include_directories: 'externals/codi/include')]
codi_rev_args = '-DCODI_REVERSE_TYPE'
codi_for_args = '-DCODI_FORWARD_TYPE'
codi_rev_args = ['-DCODI_REVERSE_TYPE']
codi_for_args = ['-DCODI_FORWARD_TYPE']
endif

if get_option('enable-autodiff')
if get_option('codi-tape') == 'JacobianIndex'
codi_rev_args += '-DCODI_INDEX_TAPE'
#elif get_option('codi-tape') == 'PrimalLinear'
# codi_rev_args += '-DCODI_PRIMAL_TAPE'
#elif get_option('codi-tape') == 'PrimalIndex'
# codi_rev_args += '-DCODI_PRIMAL_INDEX_TAPE'
endif
endif

# add cgns library
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ option('enable-mixedprec', type : 'boolean', value : false, description: 'use si
option('extra-deps', type : 'string', value : '', description: 'comma-separated list of extra (custom) dependencies to add for compilation')
option('enable-mpp', type : 'boolean', value : false, description: 'enable Mutation++ support')
option('opdi-backend', type : 'combo', choices : ['auto', 'macro', 'ompt'], value : 'auto', description: 'OpDiLib backend choice')
option('codi-tape', type : 'combo', choices : ['JacobianLinear', 'JacobianIndex'], value : 'JacobianLinear', description: 'CoDiPack tape choice')

0 comments on commit 183c3ca

Please sign in to comment.