23 research outputs found

    Reverse-Mode Automatic Differentiation of Compiled Programs

    Full text link
    Tools for algorithmic differentiation (AD) provide accurate derivatives of computer-implemented functions for use in, e. g., optimization and machine learning (ML). However, they often require the source code of the function to be available in a restricted set of programming languages. As a step towards making AD accessible for code bases with cross-language or closed-source components, we recently presented the forward-mode AD tool Derivgrind. It inserts forward-mode AD logic into the machine code of a compiled program using the Valgrind dynamic binary instrumentation framework. This work extends Derivgrind, adding the capability to record the real-arithmetic evaluation tree, and thus enabling operator overloading style reverse-mode AD for compiled programs. We maintain the high level of correctness reported for Derivgrind's forward mode, failing the same few testcases in an extensive test suite for the same well-understood reasons. Runtime-wise, the recording slows down the execution of a compiled 64-bit benchmark program by a factor of about 180.Comment: 17 pages, 5 figures, 1 listin

    Index handling and assign optimization for Algorithmic Differentiation reuse index managers

    Full text link
    For operator overloading Algorithmic Differentiation tools, the identification of primal variables and adjoint variables is usually done via indices. Two common schemes exist for their management and distribution. The linear approach is easy to implement and supports memory optimization with respect to copy statements. On the other hand, the reuse approach requires more implementation effort but results in much smaller adjoint vectors, which are more suitable for the vector mode of Algorithmic Differentiation. In this paper, we present both approaches, how to implement them, and discuss their advantages, disadvantages and properties of the resulting Algorithmic Differentiation type. In addition, a new management scheme is presented which supports copy optimizations and the reuse of indices, thus combining the advantages of the other two. The implementations of all three schemes are compared on a simple synthetic example and on a real world example using the computational fluid dynamics solver in SU2.Comment: 20 pages, 14 figures, 4 table

    Forward-Mode Automatic Differentiation of Compiled Programs

    Full text link
    Algorithmic differentiation (AD) is a set of techniques that provide partial derivatives of computer-implemented functions. Such a function can be supplied to state-of-the-art AD tools via its source code, or via an intermediate representation produced while compiling its source code. We present the novel AD tool Derivgrind, which augments the machine code of compiled programs with forward-mode AD logic. Derivgrind leverages the Valgrind instrumentation framework for a structured access to the machine code, and a shadow memory tool to store dot values. Access to the source code is required at most for the files in which input and output variables are defined. Derivgrind's versatility comes at the price of scaling the run-time by a factor between 30 and 75, measured on a benchmark based on a numerical solver for a partial differential equation. Results of our extensive regression test suite indicate that Derivgrind produces correct results on GCC- and Clang-compiled programs, including a Python interpreter, with a small number of exceptions. While we provide a list of scenarios that Derivgrind does not handle correctly, nearly all of them are academic counterexamples or originate from highly optimized math libraries. As long as differentiating those is avoided, Derivgrind can be applied to an unprecedentedly wide range of cross-language or partially closed-source software with little integration efforts.Comment: 21 pages, 3 figures, 3 tables, 5 listing

    Tools for Brain-Computer Interaction: A General Concept for a Hybrid BCI

    Get PDF
    The aim of this work is to present the development of a hybrid Brain-Computer Interface (hBCI) which combines existing input devices with a BCI. Thereby, the BCI should be available if the user wishes to extend the types of inputs available to an assistive technology system, but the user can also choose not to use the BCI at all; the BCI is active in the background. The hBCI might decide on the one hand which input channel(s) offer the most reliable signal(s) and switch between input channels to improve information transfer rate, usability, or other factors, or on the other hand fuse various input channels. One major goal therefore is to bring the BCI technology to a level where it can be used in a maximum number of scenarios in a simple way. To achieve this, it is of great importance that the hBCI is able to operate reliably for long periods, recognizing and adapting to changes as it does so. This goal is only possible if many different subsystems in the hBCI can work together. Since one research institute alone cannot provide such different functionality, collaboration between institutes is necessary. To allow for such a collaboration, a new concept and common software framework is introduced. It consists of four interfaces connecting the classical BCI modules: signal acquisition, preprocessing, feature extraction, classification, and the application. But it provides also the concept of fusion and shared control. In a proof of concept, the functionality of the proposed system was demonstrated

    Exploration of differentiability in a proton computed tomography simulation framework

    Get PDF
    Objective. Gradient-based optimization using algorithmic derivatives can be a useful technique to improve engineering designs with respect to a computer-implemented objective function. Likewise, uncertainty quantification through computer simulations can be carried out by means of derivatives of the computer simulation. However, the effectiveness of these techniques depends on how ‘well-linearizable’ the software is. In this study, we assess how promising derivative information of a typical proton computed tomography (pCT) scan computer simulation is for the aforementioned applications. Approach. This study is mainly based on numerical experiments, in which we repeatedly evaluate three representative computational steps with perturbed input values. We support our observations with a review of the algorithmic steps and arithmetic operations performed by the software, using debugging techniques. Main results. The model-based iterative reconstruction (MBIR) subprocedure (at the end of the software pipeline) and the Monte Carlo (MC) simulation (at the beginning) were piecewise differentiable. However, the observed high density and magnitude of jumps was likely to preclude most meaningful uses of the derivatives. Jumps in the MBIR function arose from the discrete computation of the set of voxels intersected by a proton path, and could be reduced in magnitude by a ‘fuzzy voxels’ approach. The investigated jumps in the MC function arose from local changes in the control flow that affected the amount of consumed random numbers. The tracking algorithm solves an inherently non-differentiable problem. Significance. Besides the technical challenges of merely applying AD to existing software projects, the MC and MBIR codes must be adapted to compute smoother functions. For the MBIR code, we presented one possible approach for this while for the MC code, this will be subject to further research. For the tracking subprocedure, further research on surrogate models is necessary

    Advanced techniques for the semi automatic transition from simulation to design software

    No full text
    FĂŒr den Einsatz von ableitungsbasierten Optimierungsverfahren fĂŒr die Verbesserung von ZielgrĂ¶ĂŸen industrieller Produkte, wie z.B. dem Wirkungsgrad einer Turbine, werden exakte Ableitungen benötigt, um die letzten Prozent an möglicher Effizienz-steigerung zu erhalten. DafĂŒr ist es notwendig, dass die Ableitungen immer konsistent zu den Lösungsverfahren in der eingesetzten Lösersoftware sind. Problematisch ist dabei die fortlaufende Weiterentwicklung an der Lösersoftware, die meist dazu fĂŒhrt, dass approximative Ableitungsverfahren eingesetzt werden oder die Ableitungsberechnung in der Software nicht erneuert wird und somit veraltet und inkonsistent ist. In dieser Arbeit wird ein universeller Ansatz vorgeschlagen, der zum einen die gesamte Software mittels Algorithmischen Differenzierens (AD) ableitet und zum anderem eine korrekte und konsistente Ableitung nach jeder Änderung sicherstellt. Um die Korrektheit und Konsistenz zu garantieren, wird die Technik des Variable Tagging entwickelt. Diese ĂŒberprĂŒft zur Laufzeit ob alle AbhĂ€ngigkeiten von den eingesetzten Ableitungsmethoden korrekt berĂŒcksichtigt werden. FĂŒr die generelle ÜberprĂŒfung, ob eine Ableitungsmethode korrekt implementiert ist, wird ein Theorem fĂŒr die Vergleichbarkeit von AD Ableitungen entwickelt. Aus diesem Theorem ergeben sich Techniken, wie eine Implementierung getestet werden kann. Durch Analyse von vorliegenden industriellen FĂ€llen wird die praktische Anwendbarkeit der entwickelten Techniken erfolgreich bestĂ€tigt. Die so erzeugten Ableitungen sind damit bereits konsistent und korrekt, jedoch kann die Effizienz des Verfahrens noch gesteigert werden. Dazu werden neue Ablei-tungsalgorithmen entwickelt. Eine konsistente Herleitung mit einem Fix-Punkt-Iterator beinhaltet alle dem Stand der Technik entsprechenden Algorithmen und ergibt zwei neue Algorithmen, die alle implementationstechnischen Details mitberĂŒcksichtigen und damit die Konsistenz der Ableitungsergebnisse nicht verletzen. Des Weiteren werden bekannte Techniken fĂŒr das automatische Auffinden der grĂ¶ĂŸ-ten Ressourcenverbraucher vorgestellt und erweitert. Das Datenlayout fĂŒr die Berechnung der KenngrĂ¶ĂŸen fĂŒr die Ressourcenverbraucher, wie z.B. die Anzahl der Eingabe- und Ausgabewerte oder der Speicherverbrauch, wurde so erweitert, dass die Geschwindigkeit der Anwendung nur geringfĂŒgig verĂ€ndert wird. Die Ressourcenverbraucher können mit Techniken wie Checkpointing und Preaccumulation behandelt werden. Die bisher in der Literatur fehlende Analyse, wie diese Techniken den Zeit- und Speicherverbrauch verĂ€ndern, wird durchgefĂŒhrt und Besonderheiten bezĂŒglich verschiedener AD-Werkzeuge werden betrachtet. Als letzten Schritt werden die benutzten AD Werkzeuge genauer analysiert. Basie-rend auf den existierenden Implementierungen wird eine generelle Übersicht von allen möglichen Implementationstechniken durch OperatorĂŒberladen gezeigt. Das Hauptaugenmerk liegt auf dem minimalen Speicherverbrauch eines AD-Werkzeuges und stellt implementationstechnische Verbesserungen vor. Es resultiert die erstmals mögliche Vergleichbarkeit von AD-Werkzeugen auf einer theoretischen Ebene. Dies dient als Basis zur Entwicklung eines optimalen Werkzeugs. Das neue Software-Werkzeug CoDiPack geht aus diesen Überlegungen hervor und wird in seinem Design und Konzepten vorgestellt. Die in dieser Arbeit vorgestellten Verbesserungen und Analysen ermöglichen es, eine automatisierte, konsistente und korrekte Ableitung fĂŒr industrielle Zwecke effizient zur VerfĂŒgung zu stellen.If gradient based derivative algorithms are used to improve industrial products by reducing their target functions, the derivatives need to be exact. The last percent of possible improvement, like the efficiency of a turbine, can only be gained if the derivatives are consistent with the solution process that is used in the simulation software. It is problematic that the development of the simulation software is an ongoing process which leads to the use of approximated derivatives. If a derivative computation is implemented manually, it will be inconsistent after some time if it is not updated. This thesis presents a generalized approach which differentiates the whole simulation software with Algorithmic Differentiation (AD), and guarantees a correct and consistent derivative computation after each change to the software. For this purpose, the variable tagging technique is developed. The technique checks at run-time if all dependencies, which are used by the derivative algorithms, are correct. Since it is also necessary to check the correctness of the implementation, a theorem is developed which describes how AD derivatives can be compared. This theorem is used to develop further methods that can detect and correct errors. All methods are designed such that they can be applied in real world applications and are used within industrial configurations. The process described above yields consistent and correct derivatives but the efficiency can still be improved. This is done by deriving new derivative algorithms. A fixed-point iterator approach, with a consistent derivation, yields all state of the art algorithms and produces two new algorithms. These two new algorithms include all implementation details and therefore they produce consistent derivative results. For detecting hot spots in the application, the state of the art techniques are presented and extended. The data management is changed such that the performance of the software is affected only marginally when quantities, like the number of input and output variables or the memory consumption, are computed for the detection. The hot spots can be treated with techniques like checkpointing or preaccumulation. How these techniques change the time and memory consumption is analyzed and it is shown how they need to be used in selected AD tools. As a last step, the used AD tools are analyzed in more detail. The major implementation strategies for operator overloading AD tools are presented and implementation improvements for existing AD tools are discussed. The discussion focuses on a minimal memory consumption and makes it possible to compare AD tools on a theoretical level. The new AD tool CoDiPack is based on these findings and its design and concepts are presented. The improvements and findings in this thesis make it possible, that an automatic, consistent and correct derivative is generated in an efficient way for industrial applications

    Advanced techniques for the semi automatic transition from simulation to design software

    No full text
    FĂŒr den Einsatz von ableitungsbasierten Optimierungsverfahren fĂŒr die Verbesserung von ZielgrĂ¶ĂŸen industrieller Produkte, wie z.B. dem Wirkungsgrad einer Turbine, werden exakte Ableitungen benötigt, um die letzten Prozent an möglicher Effizienz-steigerung zu erhalten. DafĂŒr ist es notwendig, dass die Ableitungen immer konsistent zu den Lösungsverfahren in der eingesetzten Lösersoftware sind. Problematisch ist dabei die fortlaufende Weiterentwicklung an der Lösersoftware, die meist dazu fĂŒhrt, dass approximative Ableitungsverfahren eingesetzt werden oder die Ableitungsberechnung in der Software nicht erneuert wird und somit veraltet und inkonsistent ist. In dieser Arbeit wird ein universeller Ansatz vorgeschlagen, der zum einen die gesamte Software mittels Algorithmischen Differenzierens (AD) ableitet und zum anderem eine korrekte und konsistente Ableitung nach jeder Änderung sicherstellt. Um die Korrektheit und Konsistenz zu garantieren, wird die Technik des Variable Tagging entwickelt. Diese ĂŒberprĂŒft zur Laufzeit ob alle AbhĂ€ngigkeiten von den eingesetzten Ableitungsmethoden korrekt berĂŒcksichtigt werden. FĂŒr die generelle ÜberprĂŒfung, ob eine Ableitungsmethode korrekt implementiert ist, wird ein Theorem fĂŒr die Vergleichbarkeit von AD Ableitungen entwickelt. Aus diesem Theorem ergeben sich Techniken, wie eine Implementierung getestet werden kann. Durch Analyse von vorliegenden industriellen FĂ€llen wird die praktische Anwendbarkeit der entwickelten Techniken erfolgreich bestĂ€tigt. Die so erzeugten Ableitungen sind damit bereits konsistent und korrekt, jedoch kann die Effizienz des Verfahrens noch gesteigert werden. Dazu werden neue Ablei-tungsalgorithmen entwickelt. Eine konsistente Herleitung mit einem Fix-Punkt-Iterator beinhaltet alle dem Stand der Technik entsprechenden Algorithmen und ergibt zwei neue Algorithmen, die alle implementationstechnischen Details mitberĂŒcksichtigen und damit die Konsistenz der Ableitungsergebnisse nicht verletzen. Des Weiteren werden bekannte Techniken fĂŒr das automatische Auffinden der grĂ¶ĂŸ-ten Ressourcenverbraucher vorgestellt und erweitert. Das Datenlayout fĂŒr die Berechnung der KenngrĂ¶ĂŸen fĂŒr die Ressourcenverbraucher, wie z.B. die Anzahl der Eingabe- und Ausgabewerte oder der Speicherverbrauch, wurde so erweitert, dass die Geschwindigkeit der Anwendung nur geringfĂŒgig verĂ€ndert wird. Die Ressourcenverbraucher können mit Techniken wie Checkpointing und Preaccumulation behandelt werden. Die bisher in der Literatur fehlende Analyse, wie diese Techniken den Zeit- und Speicherverbrauch verĂ€ndern, wird durchgefĂŒhrt und Besonderheiten bezĂŒglich verschiedener AD-Werkzeuge werden betrachtet. Als letzten Schritt werden die benutzten AD Werkzeuge genauer analysiert. Basie-rend auf den existierenden Implementierungen wird eine generelle Übersicht von allen möglichen Implementationstechniken durch OperatorĂŒberladen gezeigt. Das Hauptaugenmerk liegt auf dem minimalen Speicherverbrauch eines AD-Werkzeuges und stellt implementationstechnische Verbesserungen vor. Es resultiert die erstmals mögliche Vergleichbarkeit von AD-Werkzeugen auf einer theoretischen Ebene. Dies dient als Basis zur Entwicklung eines optimalen Werkzeugs. Das neue Software-Werkzeug CoDiPack geht aus diesen Überlegungen hervor und wird in seinem Design und Konzepten vorgestellt. Die in dieser Arbeit vorgestellten Verbesserungen und Analysen ermöglichen es, eine automatisierte, konsistente und korrekte Ableitung fĂŒr industrielle Zwecke effizient zur VerfĂŒgung zu stellen.If gradient based derivative algorithms are used to improve industrial products by reducing their target functions, the derivatives need to be exact. The last percent of possible improvement, like the efficiency of a turbine, can only be gained if the derivatives are consistent with the solution process that is used in the simulation software. It is problematic that the development of the simulation software is an ongoing process which leads to the use of approximated derivatives. If a derivative computation is implemented manually, it will be inconsistent after some time if it is not updated. This thesis presents a generalized approach which differentiates the whole simulation software with Algorithmic Differentiation (AD), and guarantees a correct and consistent derivative computation after each change to the software. For this purpose, the variable tagging technique is developed. The technique checks at run-time if all dependencies, which are used by the derivative algorithms, are correct. Since it is also necessary to check the correctness of the implementation, a theorem is developed which describes how AD derivatives can be compared. This theorem is used to develop further methods that can detect and correct errors. All methods are designed such that they can be applied in real world applications and are used within industrial configurations. The process described above yields consistent and correct derivatives but the efficiency can still be improved. This is done by deriving new derivative algorithms. A fixed-point iterator approach, with a consistent derivation, yields all state of the art algorithms and produces two new algorithms. These two new algorithms include all implementation details and therefore they produce consistent derivative results. For detecting hot spots in the application, the state of the art techniques are presented and extended. The data management is changed such that the performance of the software is affected only marginally when quantities, like the number of input and output variables or the memory consumption, are computed for the detection. The hot spots can be treated with techniques like checkpointing or preaccumulation. How these techniques change the time and memory consumption is analyzed and it is shown how they need to be used in selected AD tools. As a last step, the used AD tools are analyzed in more detail. The major implementation strategies for operator overloading AD tools are presented and implementation improvements for existing AD tools are discussed.\ The discussion focuses on a minimal memory consumption and makes it possible to compare AD tools on a theoretical level. The new AD tool CoDiPack is based on these findings and its design and concepts are presented. The improvements and findings in this thesis make it possible, that an automatic, consistent and correct derivative is generated in an efficient way for industrial applications
    corecore