Efficient Derivative Computations in Neutron Scattering via Interface Contraction.




For the solution of a minimization problem, a neutron scattering simulation needs accurate and efficient derivatives of an objective function in the form of a Fortran 77 program with about 3,500 lines of code. We use the Adifor system implementing the technology of automatic differentiation to transform the given computer code into another program capable of evaluating the objective function and its derivatives. Compared to numerical differentiation, the derivatives obtained from applying automatic differentiation in this black-box fashion are free from truncation error and, in this application, their computation requires less time. To increase the efficiency of automatic differentiation further, a technique called interface contraction is used. The idea of interface contraction is to exploit the local structure of a given code by temporarily reducing the number of derivatives propagated through the code. By reporting performance results, we show the significance of interface contraction in the neutron scattering application. We also demonstrate the simplicity of the approach and argue that interface contraction should be incorporated into future automatic differentiation tools.