Code Monkey home page Code Monkey logo

aadc-prototype's Introduction

AADC Prototype Library

Overview

That library is a prototype implementation of automatic adjoint differentiation (AAD) approach developed by MatLogica. Please check website for more information: http://www.matlogica.com/

As an example, we attempt to differentiate code recorded inside function mySuperModelFunc() and calculate derivatives using:

  • finite-differences method
  • AAD method using double scalar function
  • AAD method using AVX256 or AVX512 vector

Build and Run

Library was tested to compile with GCC, CLang & Intel compilers on Linux platform and MSVC on Windows.

On Windows, just open solution file aadc.sln using Visual Studio.

On Linux, run the following commands to build the project:

  • mkdir build
  • cd build
  • cmake ..
  • make
  • run binary ./example

Regenerate AAD function

Pre-generated AAD code is included in the project. If you wish to make changes to primal function and regenerate AAD code, you will need:

  • uncomment line #define REGENERATE_AAD_FUNCTION inside example.cpp file
  • run command make
  • run command ./example
  • comment out line #define REGENERATE_AAD_FUNCTION
  • run command make && ./example

That will update auto-generated AAD function and compile + link updated definition inside "example" binary file.

Sample Output

Primal function & FD derivatives:
f(0.5,1) = 406.892
dx = -10.2952
da = -0.793778

Compiled function & AAD derivatives (scalar case):
f(0.5,1) = 406.892
dx = -10.2904
da = -0.793772

Integral of Primal function & FD derivative:
f() = 451.175
da  = -0.717925
time= 1650860

Compiled function & AAD derivatives (AVX256)
f (0.5,1) = 406.892
dx = -10.2904
da = -0.793772

Integral[0,1] of AVX AAD function using Monte-Carlo & 1 thread:
f() = 451.175
da  = -0.718056
time= 676434

Integral[0,1] of AVX AAD function using Monte-Carlo & 4 threads:
f() = 451.175
da  = -0.718056
time= 177143

aadc-prototype's People

Contributors

dmitrigoloubentsev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.