Derivative Code Compiler


dcc is a source-to-source compiler that generates first and higher tangent and adjoint code for numerical programs written in a subset of C/C++.

For tests you can download a prior version of dcc from the book's website The Art of Differentiating Computer Programs. Based on the prior version 0.9 of dcc, the version on the current site is the recent version where the usability and the input language has been extended. Please note that the command line syntax is completely different to the one from version 0.9, as you can see in the following example.



Let us consider the following code.

void f(int n, int m, double* x, double* y)
#pragma ad indep x
#pragma ad dep y
	int i=0;
	int j=1;
	for(i=0;i<m;i++) {
		y[i]= -2.3e-7*x[i-1]+0.314159265359e1*x[i]+1.41e-23*x[i+1];

To generate the tangent-linear code assuming that the code is given in the file f.c is done by:

dcc -t f.c

To provide the adjoint code the compiler expects the option -a:

dcc -a f.c

The reapplication of dcc to its own output is used to provide second order derivative code. For example to get the forward-over-reverse code type:

dcc -a f.c
gcc -E -P -I. -C a1_f.c > a1_f_preprocessed.c
dcc -t -d 2 a1_f_preprocessed.c

The call to the preprocessor (gcc -E -P -I. -C) is necessary because dcc generates some C macros and include statements that have to be processed before the reapplication can be done.

 The generated files are:

Download (restricted to RWTH network)

A static binary version of dcc version 1.0 can be downloaded for Windows 32bit or as a version for Linux 64 bit (compiled for the RWTH Cluster environment).



  • Michael Förster, Uwe Naumann. Toward Adjoint OpenMP. Department Of Computer Science Technical Reports. Abstract Bibtex Paper
  • Michel Schanen, Michael Förster, Boris Gendler, and Uwe Naumann. Compiler-based Differentiation of Numerical Simulation Codes. In ICCGI 2011, The Sixth International Multi-Conference on Computing in the Global Information Technology , pages 105–110. IARIA, 2011.
  • M. Schanen, U. Naumann, and M. Förster. Second-order adjoint algorithmic differentiation by source transformation of MPI code. In Recent Advances in the Message Passing Interface, Lecture Notes in Computer Science, pages 257–264. Springer, 2010.


by email: info@stce.rwth-aachen.de