Giter VIP home page Giter VIP logo

a2d-multiphysics's Introduction

A2D - a PDE discretization library using almost automatic differentiation

A toolkit for almost automatic differentiation of vector and matrix expressions.

This code relies heavily on the approach for deriving auto-diff expressions by M. B. Giles, "Collected matrix derivative results for forward and reverse mode AD".

A2D is a header only c++ templated library.

Install

A2D is currently header-only so no need to build itself. The following command can be used to build examples and unit tests:

# You must start from the root directory of a2d
mkdir build &&
cd build &&
cmake .. -DCMAKE_BUILD_TYPE=[Debug,Release] -DA2D_KOKKOS_DIR=<your Kokkos install dir> -DA2D_METIS_DIR=<your metis install dir> -DA2D_BUILD_EXAMPLES=ON -DA2D_BUILD_UNIT_TESTS=ON &&
make -j # parallel make using maximum number of processors

Note: metis and Kokkos are assumed to be installed in a2d/installs/metis and a2d/installs/kokkos if corresponding CMake variables are not specified. See CMake variables for a complete list of A2D CMake variables and defaults. See Install Kokkos and Install METIS for instructions on installing Kokkos and METIS.

CMake variables

Below is the complete table of CMake variables that A2D accepts to control the compilation.

Recall that to give the variable VARIABLE value VAL, use the following syntax int the command line:

cmake ... -DVARIABLE=VAL ...
Variable Description Default Choices
CMAKE_BUILD_TYPE whether this is a release (optimized) build or debug (containing debug info) build No default Debug/Release
A2D_KOKKOS_DIR directory of kokkos installation a2d/installs/kokkos a valid path
A2D_METIS_DIR directory of metis installation a2d/installs/metis a valid path
A2D_BUILD_EXAMPLES build examples if set to ON ON ON/OFF
A2D_BUILD_UNIT_TESTS build unit tests if set to ON OFF ON/OFF

Theory

So, how does A2D solve PDEs?

Dependencies

A2D requires following dependencies

Install Kokkos

To build Kokkos with OpenMP and CUDA backend, use the following commands:

# You must start from the root directory of a2d
cd extern &&
git clone https://github.com/kokkos/kokkos.git &&
cd kokkos &&
mkdir build &&
cd build &&
cmake .. -DCMAKE_INSTALL_PREFIX=../../../installs/kokkos -DKokkos_ENABLE_OPENMP=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_CUDA_LAMBDA=ON -G Ninja &&
ninja install

For a complete instruction on installing Kokkos, see Kokkos documentation.

Install METIS

Obtain the tarball from here. The following commands can be used to download METIS to a2d/extern/ and install it in a2d/installs/metis/:

# You must start from the root directory of a2d
METIS_SOURCE_DIR=$(pwd)/extern &&
METIS_INSTALL_DIR=$(pwd)/installs/metis &&
cd $METIS_SOURCE_DIR &&
wget https://src.fedoraproject.org/lookaside/pkgs/metis/metis-5.1.0.tar.gz/5465e67079419a69e0116de24fce58fe/metis-5.1.0.tar.gz &&
tar -zxvf metis-5.1.0.tar.gz &&
cd metis-5.1.0 &&
make config prefix=$METIS_INSTALL_DIR &&
make &&
make install

Testing

Unit tests are implemented using Google Test framework, which is automatically downloaded when building tests.

CTest (bundled with CMake) is used to execute tests, simply go to<build dir>/tests and execute

ctest

Coding style

clangFormat is used as the auto-formatter, with style --style=Google. If you would like to contribute to the project, please make sure you set up the auto-formatter accordingly.

a2d-multiphysics's People

Contributors

gjkennedy avatar aaronyicongfu avatar jtgloyd avatar 12libao avatar lonniewebb avatar

Watchers

 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.