Skip to content

Commit

Permalink
[cmake] Rename Clad cmake variables to start with the CLAD prefix (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvassilev authored Dec 8, 2023
1 parent 20e4b9c commit 75b30eb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ jobs:
clang-runtime: '11'
coverage: true
cuda: true
extra_cmake_options: '-DLLVM_ENABLE_WERROR=On -DENABLE_ENZYME_BACKEND=On'
extra_cmake_options: '-DLLVM_ENABLE_WERROR=On -DCLAD_ENABLE_ENZYME_BACKEND=On'
#clang-format: true

- name: ubu20-gcc7-runtime11-benchmarks
os: ubuntu-20.04
compiler: gcc-7
clang-runtime: '11'
extra_cmake_options: '-DCLAD_ENABLE_BENCHMARKS=On -DENABLE_ENZYME_BACKEND=On'
extra_cmake_options: '-DCLAD_ENABLE_BENCHMARKS=On -DCLAD_ENABLE_ENZYME_BACKEND=On'
benchmark: true

- name: ubu20-gcc8-runtime11-coverity
Expand Down
4 changes: 2 additions & 2 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ include(AddCladBenchmark)
CB_ADD_GBENCHMARK(Simple Simple.cpp)
CB_ADD_GBENCHMARK(AlgorithmicComplexity AlgorithmicComplexity.cpp)
CB_ADD_GBENCHMARK(ArrayExpressionTemplates ArrayExpressionTemplates.cpp)
if (ENABLE_ENZYME_BACKEND)
if (CLAD_ENABLE_ENZYME_BACKEND)
CB_ADD_GBENCHMARK(EnzymeCladComparison EnzymeCladComparison.cpp)
endif(ENABLE_ENZYME_BACKEND)
endif(CLAD_ENABLE_ENZYME_BACKEND)
CB_ADD_GBENCHMARK(VectorModeComparison VectorModeComparison.cpp)
CB_ADD_GBENCHMARK(MemoryComplexity MemoryComplexity.cpp)

Expand Down
10 changes: 5 additions & 5 deletions docs/userDocs/source/user/UsingEnzymeWithinClad.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ section describes how Enzyme can be used within Clad.
Configuring Clad to use Enzyme
=================================
To enable the use of enzyme within Clad, one needs to configure Clad to use
Enzyme. This can be done by adding the flag ``-DENABLE_ENZYME_BACKEND=On`` to
cmake while configuring Clad build. Thus the overall cmake command should look
something like this
Enzyme. This can be done by adding the flag ``-DCLAD_ENABLE_ENZYME_BACKEND=On``
to cmake while configuring Clad build. Thus the overall cmake command should
look something like this

.. code-block:: bash
cmake ../clad -DClang_DIR=/usr/lib/llvm-11 -DLLVM_DIR=/usr/lib/llvm-11
-DCMAKE_INSTALL_PREFIX=../inst -DLLVM_EXTERNAL_LIT="``which lit``"
-DENABLE_ENZYME_BACKEND=On
-DCLAD_ENABLE_ENZYME_BACKEND=On
This flag instructs the build system to download and build Enzyme. Then it is
linked as a static library to Clad.
Expand Down Expand Up @@ -72,4 +72,4 @@ Currently functions that take in arrays, pointers and primitive types(integer
and real) as parameters are supported for differentiation with Enzyme within
Clad. For more ideas on the type of functions supported, please have a look at
``test/Enzyme/ReverseMode.C`` for examples that can be differentiated within
Clad.
Clad.
2 changes: 1 addition & 1 deletion test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ config.llvm_lib_output_intdir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
config.clad_obj_root = "@CLAD_BINARY_DIR@"
config.target_triple = "@TARGET_TRIPLE@"
config.shlibext = "@TARGET_SHLIBEXT@"
config.have_enzyme = "@ENABLE_ENZYME_BACKEND@"
config.have_enzyme = "@CLAD_ENABLE_ENZYME_BACKEND@"

# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
Expand Down
4 changes: 2 additions & 2 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (NOT CLAD_BUILD_STATIC_ONLY)
target_link_libraries(clad PRIVATE cladDifferentiator)

# Add Enzyme as a backend.
if (ENABLE_ENZYME_BACKEND)
if (CLAD_ENABLE_ENZYME_BACKEND)

if (LLVM_VERSION_MAJOR VERSION_LESS 9 OR LLVM_VERSION_MAJOR VERSION_GREATER 12)
message(FATAL_ERROR "The enzyme backend is supported only in LLVM versions 9 to 12")
Expand Down Expand Up @@ -94,6 +94,6 @@ if (NOT CLAD_BUILD_STATIC_ONLY)
target_link_libraries(clad PUBLIC ${_enzyme_link_flags})

add_dependencies(clad LLVMEnzyme)
endif(ENABLE_ENZYME_BACKEND)
endif(CLAD_ENABLE_ENZYME_BACKEND)
endif()
set_source_files_properties(ClangPlugin.cpp PROPERTIES COMPILE_DEFINITIONS CLANG_MAJOR_VERSION="${CLANG_VERSION_MAJOR}")

0 comments on commit 75b30eb

Please sign in to comment.