Skip to content

Example of using Enzyme AD on a simple multi-file C++ program

Notifications You must be signed in to change notification settings

l90lpa/EnzymeExampleCpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enzyme Example - C++

This project gives an example of using the Enzyme AD tool on a simple C++ project using the Clang compiler, and the LLVM-based Intel DPC++/C++ Compiler.

Dependencies (using Intel compiler)

  • LLVMEnzyme-15.so, this is the Enzyme LLVM pass plugin built against LLVM version 15
  • llvm-link, version 15 (llvm bitcode module linker)
  • opt, version 15 (llvm bitcode module optimizer)
  • icx, version 2022.2.1 (Intel DPC++/C++ Compiler)

Dependencies (using Clang compiler)

  • LLDEnzyme-15.so, this is the Enzyme LLD pass plugin built against LLVM version 15
  • ld.lld, version 15 (llvm linker - drop in replacement for GNU's ld linker)
  • clang, version 15

Setup

  • If clang, ld.lld, llvm-link, opt, or icx aren't in your path then either add them to your path, or put their paths in the appropriate variables in Makefile.
  • In Makefile-icx and Makefile-clang, modify respectively the paths /usr/local/lib/Enzyme/LLVMEnzyme-15.so to be and /usr/local/lib/Enzyme/LLDEnzyme-15.so be actual paths to the libraries.

Notes

  • Documentation for building LLVMEnzyme-15.so/LLDEnzyme-15.so can be found at here, however the process can be simplified. Instead of building LLVM manually as suggested, simply install the llvm headers/libraries and build against these. The headers/libraries can be installed using apt install llvm-15-dev (you might need to first add the llvm 15 toolchain repository to apt)), and then the required cmake directory can be found using dpkg -L llvm-15-dev | grep lib/cmake/llvm, at which point one can then follow the Enzyme build steps. Furthermore, if you additionally install the headers/libraries for Clang, say using apt install libclang-15-dev, then the Clang pass plugin ClangEnzyme-15.so will also be built.

About

Example of using Enzyme AD on a simple multi-file C++ program

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages