Open tripathi-aka opened 4 weeks ago
Hi @tripathi-aka,
I'm not sure exactly what you do, but the installation looks correct. You should be able to compile the following code:
#include <iomanip>
#include <adolc/adolc.h>
// Define namespaces
using namespace std;
// Define the function to be differentiated: f(x) = e^x
adouble my_function(adouble x)
{
adouble f = exp(x);
return f;
};
int main()
{
// ----------------------------------------------------------------------- //
// Initialize problem variables
// ----------------------------------------------------------------------- //
// Initialize passive variables
int m = 1, n = 1;
auto xp = new double[n];
xp[0] = 1.; // Independent vector
auto yp = new double[m];
yp[0] = 0.; // Dependent vector
// Initialize active variables
auto x = new adouble[n];
auto y = new adouble[m];
// ----------------------------------------------------------------------- //
// Active section for automatic differentiation
// ----------------------------------------------------------------------- //
// Set the tag for the Automatic Differentiation trace
int tag = 0;
// Start tracing floating point operations
trace_on(tag); // Start of the active section
// Assign independent variables
x[0] <<= xp[0];
// Evaluate the body of the differentiated code
y[0] = my_function(x[0]);
// Assign dependent variables
y[0] >>= yp[0];
trace_off(); // End of the active section
// ----------------------------------------------------------------------- //
// Compute the first derivative (forward mode)
// ----------------------------------------------------------------------- //
// Declare the tangent vector
auto x1 = new double[n];
x1[0] = 1;
// Declare the vector of first derivatives
auto y1 = new double[m];
// Define a flag to prepare for a reverse automatic differentiation or not
int keep = 0;
// Compute the derivatives of f(x)
fos_forward(tag, m, n, keep, xp, x1, yp, y1);
cout << "Derivative computation in forward mode" << endl;
cout << setw(20) << "AD derivative" << setw(25) << "Analytic derivative" << endl;
cout.precision(8);
cout.setf(ios::fixed);
cout << setw(20) << y1[0] << setw(25) << my_function(xp[0]).value() << endl;
cout << endl;
return 0;
}
If the file is stored in test.cpp
you can run
g++ -std=c++11 -o test test.cpp -I./ADOL-C/include/ -Wl,-rpath,./ADOL-C/lib/ -L./ADOL-C/lib -ladolc
(where the paths are set to your locations.)
Your output is generated by calling ./test
.
If something is unclear, don't hesitate to ask.
Best, Tim
Thank you so much for your response and suggestions. I have attached my test.cpp file and tried to compile it by following your suggested format but i am getting the following error . I have no idea what is missing. Could you please help me how can i get a successful compilation and execution using ADOL-C libraries. Please guide me if i am using the wrong directory for rpath location and also tell me if i am doing something wrong. @.:~$ g++ -std=c++11 -o test test.cpp -I/ADOL-C/include/ -Wl, rpath-home/akanksha/adolc_base,./ADOL-C/LIB/ -L./ADOL-C/lib -ladolc /usr/bin/ld: cannot find : No such file or directory collect2: error: ld returned 1 exit status @.:~$
On Fri, Oct 25, 2024, 2:33 PM TimSiebert1 @.***> wrote:
Hi @tripathi-aka https://github.com/tripathi-aka,
I'm not sure exactly what you do, but the installation looks correct. You should be able to compile the following code:
include
include <adolc/adolc.h>
// Define namespaces using namespace std;
// Define the function to be differentiated: f(x) = e^x adouble my_function(adouble x) { adouble f = exp(x); return f; };
int main() {
// ----------------------------------------------------------------------- // // Initialize problem variables // ----------------------------------------------------------------------- // // Initialize passive variables int m = 1, n = 1; auto xp = new double[n]; xp[0] = 1.; // Independent vector auto yp = new double[m]; yp[0] = 0.; // Dependent vector // Initialize active variables auto x = new adouble[n]; auto y = new adouble[m]; // ----------------------------------------------------------------------- // // Active section for automatic differentiation // ----------------------------------------------------------------------- // // Set the tag for the Automatic Differentiation trace int tag = 0; // Start tracing floating point operations trace_on(tag); // Start of the active section // Assign independent variables x[0] <<= xp[0]; // Evaluate the body of the differentiated code y[0] = my_function(x[0]); // Assign dependent variables y[0] >>= yp[0]; trace_off(); // End of the active section // ----------------------------------------------------------------------- // // Compute the first derivative (forward mode) // ----------------------------------------------------------------------- // // Declare the tangent vector auto x1 = new double[n]; x1[0] = 1; // Declare the vector of first derivatives auto y1 = new double[m]; // Define a flag to prepare for a reverse automatic differentiation or not int keep = 0; // Compute the derivatives of f(x) fos_forward(tag, m, n, keep, xp, x1, yp, y1); cout << "Derivative computation in forward mode" << endl; cout << setw(20) << "AD derivative" << setw(25) << "Analytic derivative" << endl; cout.precision(8); cout.setf(ios::fixed); cout << setw(20) << y1[0] << setw(25) << my_function(xp[0]).value() << endl; cout << endl; return 0;
}
If the file is stored in test.cpp you can run g++ -std=c++11 -o test test.cpp -I./ADOL-C/include/ -Wl,-rpath,./ADOL-C/lib/ -L./ADOL-C/lib -ladolc (where the paths are set to your locations.) Your output is generated by calling ./test.
If something is unclear, don't hesitate to ask.
Best, Tim
— Reply to this email directly, view it on GitHub https://github.com/coin-or/ADOL-C/issues/60#issuecomment-2437268704, or unsubscribe https://github.com/notifications/unsubscribe-auth/BL4NHJXHMGUTYKUFO36M4SLZ5ICNBAVCNFSM6AAAAABPPIZ25CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZXGI3DQNZQGQ . You are receiving this because you were mentioned.Message ID: @.***>
Hi,
there is a typo in the command and the paths you provide might also be wrong.
Looking again into your installation, you should have a file /home/akanksha/adolc_base/include
and somewhere (maybe in ADOL-C) a lib64
file with a libadolc
object. Right?
Then you should be able to call
g++ -std=c++11 -o test test.cpp -I/home/akanksha/adolc_base/include -Wl,-rpath,/PATH/TO/lib64/ -L/PATH/TO/lib64 -ladolc
In this command you have to replace /PATH/TO/lib64
with the corresponding path.
Yes, there is the file /home/akanksha/adolc_base/include and lib64 with three files libadolc.so, libadol.so.2, libadolc.so.2 but there is no file named libadolc object . Thanks, I'll check it out and let you know.
On Fri, Oct 25, 2024 at 7:54 PM TimSiebert1 @.***> wrote:
Hi,
there is a typo in the command and the paths you provide might also be wrong. Looking again into your installation, you should have a file /home/akanksha/adolc_base/include and somewhere (maybe in ADOL-C) a lib64 file with a libadolc object. Right?
Then you should be able to call g++ -std=c++11 -o test test.cpp -I/home/akanksha/adolc_base/include -Wl,-rpath,/PATH/TO/lib64/ -L/PATH/TO/lib64 -ladolc
In this command you have to replace /PATH/TO/lib64 with the corresponding path.
— Reply to this email directly, view it on GitHub https://github.com/coin-or/ADOL-C/issues/60#issuecomment-2437957440, or unsubscribe https://github.com/notifications/unsubscribe-auth/BL4NHJVNVTYGJOY2Q54IC3DZ5JIATAVCNFSM6AAAAABPPIZ25CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZXHE2TONBUGA . You are receiving this because you were mentioned.Message ID: @.***>
Great. With „object“ I meant the compiled library libadolc.so
. The suffix „.so“ stands for „shared object“.
Ok, thanks for the clarification.
On Fri, Oct 25, 2024, 10:29 PM TimSiebert1 @.***> wrote:
Great. With „object“ I meant the compiled library libadolc.so. The suffix „.so“ stands for „shared object“.
— Reply to this email directly, view it on GitHub https://github.com/coin-or/ADOL-C/issues/60#issuecomment-2438341910, or unsubscribe https://github.com/notifications/unsubscribe-auth/BL4NHJWX2UWDKZ2PUG7O54TZ5J2F3AVCNFSM6AAAAABPPIZ25CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZYGM2DCOJRGA . You are receiving this because you were mentioned.Message ID: @.***>
Hi, I am trying to install and use ADOL -C with my Linux based system Ubuntu for computing the higher order derivative. I have installed ADOL-C 2.7.2 usiing local installation . But, when i am trying to compile and execute the program i am getting the 'object file' like '.o' but not getting any output anywhwere. I am not sure my installation is appropriate or not. I am not getting what is missing? Could you please guide me how can i proceed further for getting the output . I am a new learner and no idea about ADOL -C. here, i have given the steps which i have used for compiling and linking the source code. akanksha@akanksha-Inspiron-3501:~/mode/ADOL-C-2.7.2$ ./configure --enable-addexa checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make supports nested variables... (cached) yes checking whether to enable maintainer-specific portions of Makefiles... no checking whether to build ADOL-C with adjoinable MPI (AMPI) support... no checking whether to build ADOL-C with MeDiPack (MPI) support... no checking for g++... g++ checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for style of include used by make... GNU checking dependency style of g++... gcc3 checking whether g++ supports C++11 features by default... yes checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking whether gcc and cc understand -c and -o together... yes checking for gcc option to accept ISO C99... none needed checking how to run the C preprocessor... gcc -E checking whether ln -s works... yes checking whether make sets $(MAKE)... (cached) yes checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking the maximum length of command line arguments... 1572864 checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop checking for /usr/bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc object... ok checking for sysroot... no checking for a working dd... /usr/bin/dd checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 checking for mt... mt checking if mt is a manifest tool... no checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC -DPIC checking if gcc PIC flag -fPIC -DPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... /usr/bin/ld -m elf_x86_64 checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC -DPIC checking if g++ PIC flag -fPIC -DPIC works... yes checking if g++ static flag -static works... yes checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking size of void *... 8 checking for __builtin_expect... yes checking for ANSI C header files... (cached) yes checking whether time.h and sys/time.h may both be included... yes checking for stdbool.h that conforms to C99... yes checking for _Bool... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking for stdlib.h... (cached) yes checking stdio.h usability... yes checking stdio.h presence... yes checking for stdio.h... yes checking for string.h... (cached) yes checking for unistd.h... (cached) yes checking sys/timeb.h usability... yes checking sys/timeb.h presence... yes checking for sys/timeb.h... yes checking for an ANSI C-conforming const... yes checking for inline... inline checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for library containing pow... -lm checking for floor... yes checking for fmax... yes checking for fmin... yes checking for ftime... yes checking for pow... yes checking for sqrt... yes checking for cbrt... yes checking for strchr... yes checking for strtol... yes checking for trunc... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible realloc... yes checking whether to use calloc or malloc for memory allocation... calloc checking whether to enable atrig/erf functions... no checking whether to use 32-bit or 64-bit locations... 32-bit checking whether to use single or double precision... double checking whether to enable advanced branching operations... no checking whether to enable reference counting for tapeless numbers... no checking whether to enable activity tracking... no checking whether to use ADOL-C debug mode... no checking whether to use ADOL-C hard debug mode... no checking whether the default adouble constructor should initialize the value to 0... yes checking whether the adouble variables have a late initialize option for functions like malloc/realloc... no checking whether errno is thread save... no checking which flag to use to enable OpenMP... none checking for boostlib >= 1.54... configure: We could not detect the boost libraries (version 1.54 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation. checking whether to build sparse drivers... no checking ColPack/ColPackHeaders.h usability... yes checking ColPack/ColPackHeaders.h presence... yes checking for ColPack/ColPackHeaders.h... yes checking for libColPack in ... yes will build sparse drivers as linking with -lColPack succeeded checking whether to build documented examples... no checking whether to build additional examples... yes checking whether to build parallel example... no checking which CFLAGS to use... -O2 checking which CXXFLAGS to use... -O2 checking whether tape_doc should compute values as it prints the tape contents... yes checking for a Python interpreter with version >= 2.7... python3 checking for python3... /usr/bin/python3 checking for python3 version... 3.1 checking for python3 platform... linux checking for python3 script directory... ${prefix}/local/lib/python3.10/dist-packages checking for python3 extension module directory... ${exec_prefix}/local/lib/python3.10/dist-packages checking for swig... no checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating ADOL-C/Makefile config.status: creating ADOL-C/include/Makefile config.status: creating ADOL-C/include/adolc/Makefile config.status: creating ADOL-C/include/adolc/internal/adolc_settings.h config.status: creating ADOL-C/include/adolc/drivers/Makefile config.status: creating ADOL-C/include/adolc/internal/Makefile config.status: creating ADOL-C/include/adolc/lie/Makefile config.status: creating ADOL-C/include/adolc/sparse/Makefile config.status: creating ADOL-C/include/adolc/tapedoc/Makefile config.status: creating ADOL-C/src/Makefile config.status: creating ADOL-C/src/drivers/Makefile config.status: creating ADOL-C/src/lie/Makefile config.status: creating ADOL-C/src/sparse/Makefile config.status: creating ADOL-C/src/tapedoc/Makefile config.status: creating ADOL-C/doc/version.tex config.status: creating ADOL-C/examples/Makefile config.status: creating ADOL-C/examples/additional_examples/Makefile config.status: creating ADOL-C/examples/additional_examples/cuda/Makefile config.status: creating ADOL-C/examples/additional_examples/clock/Makefile config.status: creating ADOL-C/examples/additional_examples/checkpointing/Makefile config.status: creating ADOL-C/examples/additional_examples/ext_diff_func/Makefile config.status: creating ADOL-C/examples/additional_examples/fixpoint_exam/Makefile config.status: creating ADOL-C/examples/additional_examples/hessmat/Makefile config.status: creating ADOL-C/examples/additional_examples/lie/Makefile config.status: creating ADOL-C/examples/additional_examples/lufact/Makefile config.status: creating ADOL-C/examples/additional_examples/openmp_exam/Makefile config.status: creating ADOL-C/examples/additional_examples/scal/Makefile config.status: creating ADOL-C/examples/additional_examples/speelpenning/Makefile config.status: creating ADOL-C/examples/additional_examples/taylor/Makefile config.status: creating ADOL-C/examples/additional_examples/detexam/Makefile config.status: creating ADOL-C/examples/additional_examples/helm/Makefile config.status: creating ADOL-C/examples/additional_examples/lighthouse/Makefile config.status: creating ADOL-C/examples/additional_examples/ode/Makefile config.status: creating ADOL-C/examples/additional_examples/sparse/Makefile config.status: creating ADOL-C/examples/additional_examples/tapesave/Makefile config.status: creating ADOL-C/examples/additional_examples/pow/Makefile config.status: creating ADOL-C/examples/additional_examples/timing/Makefile config.status: creating ADOL-C/examples/additional_examples/param/Makefile config.status: creating ADOL-C/test/Makefile config.status: creating ADOL-C/swig/Makefile config.status: creating MSVisualStudio/v14/sparse/config.h config.status: creating MSVisualStudio/v14/nosparse/config.h config.status: creating MSVisualStudio/v14/x64/sparse/config.h config.status: creating MSVisualStudio/v14/x64/nosparse/config.h config.status: creating adolc.spec config.status: creating adolclib.pc config.status: creating ADOL-C/src/config.h config.status: ADOL-C/src/config.h is unchanged config.status: executing depfiles commands config.status: executing libtool commands configure: Applying patches to libtool for GNU compiler
Configuration:
C compiler: gcc C++ compiler: g++ Linker: /usr/bin/ld -m elf_x86_64 Source code location: /home/akanksha/mode/ADOL-C-2.7.2 Install path: /home/akanksha/adolc_base
CFLAGS: -O2 CXXFLAGS: -O2
Use Boost pool allocator: no Use ADOL-C debug mode: no Use ADOL-C hard debug mode: no Zero value in adouble default ctor: yes Use ADOL-C activity tracking: no Use ADOL-C late init mode: no
Build sparse drivers: yes Build with adjoinable MPI support: no Build with MediPack support: no Build with ColPack: yes Build with python swig module: no ./configure: line 22400: xyes: command not found (due to python/swig missing)
Build documented examples: no Build additional examples: yes tape_doc routine computes values: yes
See ADOL-C/src/config.h for further configuration information.
To successfully compile and run programs using the ADOL-C shared library do the following things: compiling:
ask your system administrator for adding ${exec_prefix}/lib64 to the global file containing library search paths (/etc/ld.so.conf)
(or use the static library by replacing "-L${exec_prefix}/lib64 -ladolc" with "${exec_prefix}/lib64/libadolc.a" when linking)
See README for instructions on how to change to a nonlocal installation!
akanksha@akanksha-Inspiron-3501:~/mode/ADOL-C-2.7.2$ ./configure --enable-addexa checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make supports nested variables... (cached) yes checking whether to enable maintainer-specific portions of Makefiles... no checking whether to build ADOL-C with adjoinable MPI (AMPI) support... no checking whether to build ADOL-C with MeDiPack (MPI) support... no checking for g++... g++ checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for style of include used by make... GNU checking dependency style of g++... gcc3 checking whether g++ supports C++11 features by default... yes checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking whether gcc and cc understand -c and -o together... yes checking for gcc option to accept ISO C99... none needed checking how to run the C preprocessor... gcc -E checking whether ln -s works... yes checking whether make sets $(MAKE)... (cached) yes checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking the maximum length of command line arguments... 1572864 checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop checking for /usr/bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc object... ok checking for sysroot... no checking for a working dd... /usr/bin/dd checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 checking for mt... mt checking if mt is a manifest tool... no checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC -DPIC checking if gcc PIC flag -fPIC -DPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... /usr/bin/ld -m elf_x86_64 checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC -DPIC checking if g++ PIC flag -fPIC -DPIC works... yes checking if g++ static flag -static works... yes checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking size of void *... 8 checking for __builtin_expect... yes checking for ANSI C header files... (cached) yes checking whether time.h and sys/time.h may both be included... yes checking for stdbool.h that conforms to C99... yes checking for _Bool... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking for stdlib.h... (cached) yes checking stdio.h usability... yes checking stdio.h presence... yes checking for stdio.h... yes checking for string.h... (cached) yes checking for unistd.h... (cached) yes checking sys/timeb.h usability... yes checking sys/timeb.h presence... yes checking for sys/timeb.h... yes checking for an ANSI C-conforming const... yes checking for inline... inline checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for library containing pow... -lm checking for floor... yes checking for fmax... yes checking for fmin... yes checking for ftime... yes checking for pow... yes checking for sqrt... yes checking for cbrt... yes checking for strchr... yes checking for strtol... yes checking for trunc... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible realloc... yes checking whether to use calloc or malloc for memory allocation... calloc checking whether to enable atrig/erf functions... no checking whether to use 32-bit or 64-bit locations... 32-bit checking whether to use single or double precision... double checking whether to enable advanced branching operations... no checking whether to enable reference counting for tapeless numbers... no checking whether to enable activity tracking... no checking whether to use ADOL-C debug mode... no checking whether to use ADOL-C hard debug mode... no checking whether the default adouble constructor should initialize the value to 0... yes checking whether the adouble variables have a late initialize option for functions like malloc/realloc... no checking whether errno is thread save... no checking which flag to use to enable OpenMP... none checking for boostlib >= 1.54... configure: We could not detect the boost libraries (version 1.54 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation. checking whether to build sparse drivers... no checking ColPack/ColPackHeaders.h usability... yes checking ColPack/ColPackHeaders.h presence... yes checking for ColPack/ColPackHeaders.h... yes checking for libColPack in ... yes will build sparse drivers as linking with -lColPack succeeded checking whether to build documented examples... no checking whether to build additional examples... yes checking whether to build parallel example... no checking which CFLAGS to use... -O2 checking which CXXFLAGS to use... -O2 checking whether tape_doc should compute values as it prints the tape contents... yes checking for a Python interpreter with version >= 2.7... python3 checking for python3... /usr/bin/python3 checking for python3 version... 3.1 checking for python3 platform... linux checking for python3 script directory... ${prefix}/local/lib/python3.10/dist-packages checking for python3 extension module directory... ${exec_prefix}/local/lib/python3.10/dist-packages checking for swig... no checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating ADOL-C/Makefile config.status: creating ADOL-C/include/Makefile config.status: creating ADOL-C/include/adolc/Makefile config.status: creating ADOL-C/include/adolc/internal/adolc_settings.h config.status: creating ADOL-C/include/adolc/drivers/Makefile config.status: creating ADOL-C/include/adolc/internal/Makefile config.status: creating ADOL-C/include/adolc/lie/Makefile config.status: creating ADOL-C/include/adolc/sparse/Makefile config.status: creating ADOL-C/include/adolc/tapedoc/Makefile config.status: creating ADOL-C/src/Makefile config.status: creating ADOL-C/src/drivers/Makefile config.status: creating ADOL-C/src/lie/Makefile config.status: creating ADOL-C/src/sparse/Makefile config.status: creating ADOL-C/src/tapedoc/Makefile config.status: creating ADOL-C/doc/version.tex config.status: creating ADOL-C/examples/Makefile config.status: creating ADOL-C/examples/additional_examples/Makefile config.status: creating ADOL-C/examples/additional_examples/cuda/Makefile config.status: creating ADOL-C/examples/additional_examples/clock/Makefile config.status: creating ADOL-C/examples/additional_examples/checkpointing/Makefile config.status: creating ADOL-C/examples/additional_examples/ext_diff_func/Makefile config.status: creating ADOL-C/examples/additional_examples/fixpoint_exam/Makefile config.status: creating ADOL-C/examples/additional_examples/hessmat/Makefile config.status: creating ADOL-C/examples/additional_examples/lie/Makefile config.status: creating ADOL-C/examples/additional_examples/lufact/Makefile config.status: creating ADOL-C/examples/additional_examples/openmp_exam/Makefile config.status: creating ADOL-C/examples/additional_examples/scal/Makefile config.status: creating ADOL-C/examples/additional_examples/speelpenning/Makefile config.status: creating ADOL-C/examples/additional_examples/taylor/Makefile config.status: creating ADOL-C/examples/additional_examples/detexam/Makefile config.status: creating ADOL-C/examples/additional_examples/helm/Makefile config.status: creating ADOL-C/examples/additional_examples/lighthouse/Makefile config.status: creating ADOL-C/examples/additional_examples/ode/Makefile config.status: creating ADOL-C/examples/additional_examples/sparse/Makefile config.status: creating ADOL-C/examples/additional_examples/tapesave/Makefile config.status: creating ADOL-C/examples/additional_examples/pow/Makefile config.status: creating ADOL-C/examples/additional_examples/timing/Makefile config.status: creating ADOL-C/examples/additional_examples/param/Makefile config.status: creating ADOL-C/test/Makefile config.status: creating ADOL-C/swig/Makefile config.status: creating MSVisualStudio/v14/sparse/config.h config.status: creating MSVisualStudio/v14/nosparse/config.h config.status: creating MSVisualStudio/v14/x64/sparse/config.h config.status: creating MSVisualStudio/v14/x64/nosparse/config.h config.status: creating adolc.spec config.status: creating adolclib.pc config.status: creating ADOL-C/src/config.h config.status: ADOL-C/src/config.h is unchanged config.status: executing depfiles commands config.status: executing libtool commands configure: Applying patches to libtool for GNU compiler
Configuration:
C compiler: gcc C++ compiler: g++ Linker: /usr/bin/ld -m elf_x86_64 Source code location: /home/akanksha/mode/ADOL-C-2.7.2 Install path: /home/akanksha/adolc_base
CFLAGS: -O2 CXXFLAGS: -O2
Use Boost pool allocator: no Use ADOL-C debug mode: no Use ADOL-C hard debug mode: no Zero value in adouble default ctor: yes Use ADOL-C activity tracking: no Use ADOL-C late init mode: no
Build sparse drivers: yes Build with adjoinable MPI support: no Build with MediPack support: no Build with ColPack: yes Build with python swig module: no ./configure: line 22400: xyes: command not found (due to python/swig missing)
Build documented examples: no Build additional examples: yes tape_doc routine computes values: yes
See ADOL-C/src/config.h for further configuration information.
To successfully compile and run programs using the ADOL-C shared library do the following things: compiling:
ask your system administrator for adding ${exec_prefix}/lib64 to the global file containing library search paths (/etc/ld.so.conf)
(or use the static library by replacing "-L${exec_prefix}/lib64 -ladolc" with "${exec_prefix}/lib64/libadolc.a" when linking)
See README for instructions on how to change to a nonlocal installation!
akanksha@akanksha-Inspiron-3501:~/mode/ADOL-C-2.7.2$ ./configure --enable-addexa checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make supports nested variables... (cached) yes checking whether to enable maintainer-specific portions of Makefiles... no checking whether to build ADOL-C with adjoinable MPI (AMPI) support... no checking whether to build ADOL-C with MeDiPack (MPI) support... no checking for g++... g++ checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for style of include used by make... GNU checking dependency style of g++... gcc3 checking whether g++ supports C++11 features by default... yes checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking whether gcc and cc understand -c and -o together... yes checking for gcc option to accept ISO C99... none needed checking how to run the C preprocessor... gcc -E checking whether ln -s works... yes checking whether make sets $(MAKE)... (cached) yes checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking the maximum length of command line arguments... 1572864 checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop checking for /usr/bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc object... ok checking for sysroot... no checking for a working dd... /usr/bin/dd checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 checking for mt... mt checking if mt is a manifest tool... no checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC -DPIC checking if gcc PIC flag -fPIC -DPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for shl_load... no checking for shl_load in -ldld... no checking for dlopen... yes checking whether a program can dlopen itself... yes checking whether a statically linked program can dlopen itself... no checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... /usr/bin/ld -m elf_x86_64 checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC -DPIC checking if g++ PIC flag -fPIC -DPIC works... yes checking if g++ static flag -static works... yes checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking size of void *... 8 checking for __builtin_expect... yes checking for ANSI C header files... (cached) yes checking whether time.h and sys/time.h may both be included... yes checking for stdbool.h that conforms to C99... yes checking for _Bool... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking for stdlib.h... (cached) yes checking stdio.h usability... yes checking stdio.h presence... yes checking for stdio.h... yes checking for string.h... (cached) yes checking for unistd.h... (cached) yes checking sys/timeb.h usability... yes checking sys/timeb.h presence... yes checking for sys/timeb.h... yes checking for an ANSI C-conforming const... yes checking for inline... inline checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for library containing pow... -lm checking for floor... yes checking for fmax... yes checking for fmin... yes checking for ftime... yes checking for pow... yes checking for sqrt... yes checking for cbrt... yes checking for strchr... yes checking for strtol... yes checking for trunc... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible realloc... yes checking whether to use calloc or malloc for memory allocation... calloc checking whether to enable atrig/erf functions... no checking whether to use 32-bit or 64-bit locations... 32-bit checking whether to use single or double precision... double checking whether to enable advanced branching operations... no checking whether to enable reference counting for tapeless numbers... no checking whether to enable activity tracking... no checking whether to use ADOL-C debug mode... no checking whether to use ADOL-C hard debug mode... no checking whether the default adouble constructor should initialize the value to 0... yes checking whether the adouble variables have a late initialize option for functions like malloc/realloc... no checking whether errno is thread save... no checking which flag to use to enable OpenMP... none checking for boostlib >= 1.54... configure: We could not detect the boost libraries (version 1.54 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation. checking whether to build sparse drivers... no checking ColPack/ColPackHeaders.h usability... yes checking ColPack/ColPackHeaders.h presence... yes checking for ColPack/ColPackHeaders.h... yes checking for libColPack in ... yes will build sparse drivers as linking with -lColPack succeeded checking whether to build documented examples... no checking whether to build additional examples... yes checking whether to build parallel example... no checking which CFLAGS to use... -O2 checking which CXXFLAGS to use... -O2 checking whether tape_doc should compute values as it prints the tape contents... yes checking for a Python interpreter with version >= 2.7... python3 checking for python3... /usr/bin/python3 checking for python3 version... 3.1 checking for python3 platform... linux checking for python3 script directory... ${prefix}/local/lib/python3.10/dist-packages checking for python3 extension module directory... ${exec_prefix}/local/lib/python3.10/dist-packages checking for swig... no checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating ADOL-C/Makefile config.status: creating ADOL-C/include/Makefile config.status: creating ADOL-C/include/adolc/Makefile config.status: creating ADOL-C/include/adolc/internal/adolc_settings.h config.status: creating ADOL-C/include/adolc/drivers/Makefile config.status: creating ADOL-C/include/adolc/internal/Makefile config.status: creating ADOL-C/include/adolc/lie/Makefile config.status: creating ADOL-C/include/adolc/sparse/Makefile config.status: creating ADOL-C/include/adolc/tapedoc/Makefile config.status: creating ADOL-C/src/Makefile config.status: creating ADOL-C/src/drivers/Makefile config.status: creating ADOL-C/src/lie/Makefile config.status: creating ADOL-C/src/sparse/Makefile config.status: creating ADOL-C/src/tapedoc/Makefile config.status: creating ADOL-C/doc/version.tex config.status: creating ADOL-C/examples/Makefile config.status: creating ADOL-C/examples/additional_examples/Makefile config.status: creating ADOL-C/examples/additional_examples/cuda/Makefile config.status: creating ADOL-C/examples/additional_examples/clock/Makefile config.status: creating ADOL-C/examples/additional_examples/checkpointing/Makefile config.status: creating ADOL-C/examples/additional_examples/ext_diff_func/Makefile config.status: creating ADOL-C/examples/additional_examples/fixpoint_exam/Makefile config.status: creating ADOL-C/examples/additional_examples/hessmat/Makefile config.status: creating ADOL-C/examples/additional_examples/lie/Makefile config.status: creating ADOL-C/examples/additional_examples/lufact/Makefile config.status: creating ADOL-C/examples/additional_examples/openmp_exam/Makefile config.status: creating ADOL-C/examples/additional_examples/scal/Makefile config.status: creating ADOL-C/examples/additional_examples/speelpenning/Makefile config.status: creating ADOL-C/examples/additional_examples/taylor/Makefile config.status: creating ADOL-C/examples/additional_examples/detexam/Makefile config.status: creating ADOL-C/examples/additional_examples/helm/Makefile config.status: creating ADOL-C/examples/additional_examples/lighthouse/Makefile config.status: creating ADOL-C/examples/additional_examples/ode/Makefile config.status: creating ADOL-C/examples/additional_examples/sparse/Makefile config.status: creating ADOL-C/examples/additional_examples/tapesave/Makefile config.status: creating ADOL-C/examples/additional_examples/pow/Makefile config.status: creating ADOL-C/examples/additional_examples/timing/Makefile config.status: creating ADOL-C/examples/additional_examples/param/Makefile config.status: creating ADOL-C/test/Makefile config.status: creating ADOL-C/swig/Makefile config.status: creating MSVisualStudio/v14/sparse/config.h config.status: creating MSVisualStudio/v14/nosparse/config.h config.status: creating MSVisualStudio/v14/x64/sparse/config.h config.status: creating MSVisualStudio/v14/x64/nosparse/config.h config.status: creating adolc.spec config.status: creating adolclib.pc config.status: creating ADOL-C/src/config.h config.status: ADOL-C/src/config.h is unchanged config.status: executing depfiles commands config.status: executing libtool commands configure: Applying patches to libtool for GNU compiler
Configuration:
C compiler: gcc C++ compiler: g++ Linker: /usr/bin/ld -m elf_x86_64 Source code location: /home/akanksha/mode/ADOL-C-2.7.2 Install path: /home/akanksha/adolc_base
CFLAGS: -O2 CXXFLAGS: -O2
Use Boost pool allocator: no Use ADOL-C debug mode: no Use ADOL-C hard debug mode: no Zero value in adouble default ctor: yes Use ADOL-C activity tracking: no Use ADOL-C late init mode: no
Build sparse drivers: yes Build with adjoinable MPI support: no Build with MediPack support: no Build with ColPack: yes Build with python swig module: no ./configure: line 22400: xyes: command not found (due to python/swig missing)
Build documented examples: no Build additional examples: yes tape_doc routine computes values: yes
See ADOL-C/src/config.h for further configuration information.
To successfully compile and run programs using the ADOL-C shared library do the following things: compiling:
ask your system administrator for adding ${exec_prefix}/lib64 to the global file containing library search paths (/etc/ld.so.conf)
(or use the static library by replacing "-L${exec_prefix}/lib64 -ladolc" with "${exec_prefix}/lib64/libadolc.a" when linking)
See README for instructions on how to change to a nonlocal installation!
Inspiron-3501:~$ g++ -I/home/akanksha/adolc_base/include -c abcddirectd.cpp Inspiron-3501:~$ g++ -o abcddirectd abcddirectd.o -Wl,--rpath -Wl,/home/akanksha/adolc_base/lib-L/home/akanksha/adolc_base/lib -ladolc Inspiron-3501:~$
Below is my code which i have used // Include libraries
include
include
include
include <adolc/adolc.h>
// Define namespaces using namespace std;
// Define the function to be differentiated: f(x) = e^x adouble my_function(adouble x) { adouble f = exp(x); return f; };
int main() {
} I am getting the abcddirectd.o file with the help of above command but not getting output . What's the issue please guide me