Open xiao-wang007 opened 1 month ago
The first error is
/usr/local/include/cppad/core/numeric_limits.hpp:248:58: error: no member named 'max_digits10' in 'CppAD::numeric_limits<cg::CG>'
static const int max_digits10 = numeric_limits::max_digits10;
Also see the heading API warning on https://cppad.readthedocs.io/latest/base_require.html#api-warning
It looks to me like you need to update the following files (in CppAD CodeGen) cppadcg.git/include/cppad/cg/base_double.hpp cppadcg.git/include/cppad/cg/base_float.hpp
I suggest using the CPPAD_NUMERIC_LIMITS algorithm; see https://cppad.readthedocs.io/latest/base_limits.html#cppad-numeric-limits This should already be defined in the base_double.hpp and base_float.hpp includes.
You will then need to run all the CppAD CodeGen tests to see if there are any other problems using the newer version of CppAD. If they pass, and your old code above works, you could make a pull request the CppAD CodeGen project.
One other thing, just so you know about it, there is some code generation built into CppAD and inspired by CppAD CodeGen; see https://cppad.readthedocs.io/latest/jit_get_started.cpp.html#jit-get-started-cpp-title
Thanks for the quick response! It is a lot for me to take in as I have very limited experience with cppad. Will try what you suggested and get back to you.
Cheers!
Hi
By updating these two headers:
cppadcg.git/include/cppad/cg/base_double.hpp
cppadcg.git/include/cppad/cg/base_float.hpp
do you mean to put the CPPAD_NUMERIC_LIMITS algorithm into both header files instead of what is already there for this part?
# define CPPAD_NUMERIC_LIMITS(Other, Base) \ template <> class numeric_limits<Base>\ {\ public:\ static Base min(void) \ { return static_cast<Base>( std::numeric_limits<Other>::min() ); }\ static Base max(void) \ { return static_cast<Base>( std::numeric_limits<Other>::max() ); }\ static Base epsilon(void) \ { return static_cast<Base>( std::numeric_limits<Other>::epsilon() ); }\ static Base quiet_NaN(void) \ { return static_cast<Base>( std::numeric_limits<Other>::quiet_NaN() ); }\ static Base infinity(void) \ { return static_cast<Base>( std::numeric_limits<Other>::infinity() ); }\ static const int digits10 = std::numeric_limits<Other>::digits10;\ static const int max_digits10 = std::numeric_limits<Other>::max_digits10;\ };
Should I also add this to the base_float.hpp
namespace CppAD { CPPAD_NUMERIC_LIMITS(float, float) }
. And the same for base_double.hpp?
I tried the above and run the codegen test. Still the same error. In addition, I got these warnings when using cmake, does this matter?
-- package dl found CMake Warning at cmake/FindLLVM.cmake:85 (MESSAGE): Could NOT find llvm-config Call Stack (most recent call first): CMakeLists.txt:52 (FIND_PACKAGE)
CMake Warning at cmake/FindClang.cmake:25 (MESSAGE): No LLVM and Clang support requires LLVM Call Stack (most recent call first): CMakeLists.txt:53 (FIND_PACKAGE)
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) -- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) -- Found LATEX: /Library/TeX/texbin/latex -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Could NOT find Valgrind (missing: Valgrind_EXECUTABLE) CMake Warning at test/CMakeLists.txt:217 (MESSAGE): Valgrind not found
Thanks!
I think CPPAD_NUMERIC_LIMITS is defined when CppAD CodeGen's base_double.hpp is included and all you need to do is
namespace CppAD {
CPPAD_NUMERIC_LIMITS( double, cg::CG
to define all the numeric limits for cg::CG
Yes! It proceeded, but there is a new error:
In file included from /usr/local/include/cppad/cg/cppadcg.hpp:157:
In file included from /usr/local/include/cppad/cppad.hpp:49:
In file included from /usr/local/include/cppad/core/user_ad.hpp:53:
/usr/local/include/cppad/core/adctor.hpp:190:11: error: no matching conversion for functional-style cast from 'const CppADCodeGenTraits
Thanks for the patience!
Are you able to run the CppADCodeGen test using an old version of CppAD and no changes to CppADCodeGen ? See Testing on https://github.com/joaoleal/CppADCodeGen
Hello @xiao-wang007, @bradbell,
The following CppADCodgeGen PR should have fix this issue.
@xiao-wang007 If the new version of CppADCodeGen (see message above) fixes your problem, please close this issue
Hi
I was trying some old codes from github, which depends on cppad and cppadcg. But when I build it, it got stopped with these errors. Is this because of the version? Cheers
In file included from /Users/xiao/0_codes/to-ihc-2/dynamics.cpp:8: In file included from /Users/xiao/0_codes/to-ihc-2/dynamics.h:8: In file included from /Users/xiao/0_codes/to-ihc-2/common.h:11: In file included from /Users/xiao/0_codes/to-ihc-2/hopper/declarations.h:4: In file included from /Users/xiao/0_codes/to-ihc-2/hopper/rbd_types.h:12: In file included from /Users/xiao/0_codes/to-ihc-2/hopper/../scalar_traits.h:9: In file included from /usr/local/include/cppad/cg.hpp:18: In file included from /usr/local/include/cppad/cg/cppadcg.hpp:81: In file included from /usr/local/include/cppad/base_require.hpp:159: /usr/local/include/cppad/core/numeric_limits.hpp:248:58: error: no member named 'max_digits10' in 'CppAD::numeric_limits<cg::CG>'
static const int max_digits10 = numeric_limits ::max_digits10;