rjhogan / Adept-2

Combined array and automatic differentiation library in C++
http://www.met.reading.ac.uk/clouds/adept/
Apache License 2.0
163 stars 29 forks source link

Benchmark tests fail to compile with CppAD #14

Open Sanithovski opened 5 years ago

Sanithovski commented 5 years ago

Hi. I was trying to compile the Adept-2 library. I have CppAD installed so the process also tries to generate the benchmark tests for CppAD. However, when I was trying to do make check the benchmark tests failed to compile.

In file included from differentiator.h:39:0,
                 from autodiff_benchmark.cpp:17:
advection_schemes.h: In instantiation of ‘void lax_wendroff_vector(int, Real, const aReal*, aReal*) [with aReal = CppAD::AD<double>; Real = double]’:
differentiator.h:107:26:   required from ‘void Differentiator::func(TestAlgorithm, const std::vector<T>&, std::vector<T>&) [with ActiveRealType = CppAD::AD<double>]’
differentiator.h:520:35:   required from here
advection_schemes.h:80:33: error: cannot convert ‘const CppAD::AD<double>’ to ‘double’ in assignment
   for (int i=0; i<NX; i++) Q(i) = q_init[i]; // Initialize q
                            ~~~~~^~~~~~~~~
advection_schemes.h: In instantiation of ‘void toon_vector(int, Real, const aReal*, aReal*) [with aReal = CppAD::AD<double>; Real = double]’:
differentiator.h:110:18:   required from ‘void Differentiator::func(TestAlgorithm, const std::vector<T>&, std::vector<T>&) [with ActiveRealType = CppAD::AD<double>]’
differentiator.h:520:35:   required from here
advection_schemes.h:102:33: error: cannot convert ‘const CppAD::AD<double>’ to ‘double’ in assignment
   for (int i=0; i<NX; i++) Q(i) = q_init[i]; // Initialize q
                            ~~~~~^~~~~~~~~
Makefile:456: recipe for target 'autodiff_benchmark-autodiff_benchmark.o' failed
make[2]: *** [autodiff_benchmark-autodiff_benchmark.o] Error 1
make[2]: Leaving directory '/home/sanithovski/ids/Adept-2/benchmark'
Makefile:572: recipe for target 'check-am' failed
make[1]: *** [check-am] Error 2

I am using Ubuntu 18.04.2 with gcc 6.5.0, but I tried with gcc 8.3.0 and got the same error. I suspect there is a change in the related functions from newer versions of CppAD.

Thanks.

rjhogan commented 5 years ago

I don't test that the benchmarks against CppAD, ADOLC etc work every version, so it is possible that CppAD hasn't changed but the benchmarks have somehow been broken. I'll look into it. I expect the benchmarks in Adept 1.1 still work.