Skip to content
Snippets Groups Projects
  1. Sep 22, 2018
  2. Aug 03, 2018
    • Vassil Vassilev's avatar
      Enable the automatic differentiation library clad in ROOT. · 3590e277
      Vassil Vassilev authored
      clad is a C++ plugin for clang and cling that implements automatic
      differentiation of user-defined functions by employing the chain rule in
      forward and reverse mode, coupled with source code transformation and AST
      constant fold.
      
      In mathematics and computer algebra, automatic differentiation (AD) is a
      set of techniques to numerically evaluate the derivative of a function
      specified by a computer program. AD exploits the fact that every computer
      program, no matter how complicated, executes a sequence of elementary
      arithmetic operations (addition, subtraction, multiplication, division, etc.)
      and elementary functions (exp, log, sin, cos, etc.). By applying the chain
      rule repeatedly to these operations, derivatives of arbitrary order can
      be computed automatically, accurately to working precision, and using at
      most a small constant factor more arithmetic operations than the original
      program.
      
      AD is an alternative technique to symbolic and numerical differentiation.
      These classical methods run into problems: symbolic differentiation leads
      to inefficient code (unless done carefully) and faces the difficulty of
      converting a computer program into a single expression, while numerical
      differentiation can introduce round-off errors in the discretization
      process and cancellation. Both classical methods have problems with
      calculating higher derivatives, where the complexity and errors increase.
      Finally, both classical methods are slow at computing the partial
      derivatives of a function with respect to many inputs, as is needed for
      gradient-based optimization algorithms. Automatic differentiation solves
      all of these problems, at the expense of introducing more software
      dependencies.
      
      This patch allows ROOT to interoperate with clad. Namely, users can ask
      the interpreter to produce a derivative or a gradient to a known function.
      
      An illustrative example code for first order derivative:
      
      root [0] #include "Math/CladDerivator.h"
      root [1] double my_pow2(double x) { return x*x; }
      root [2] auto meta_obj = clad::differentiate(my_pow2, /*wrt 1-st argument*/0);
      root [3] meta_obj.dump();
      The code is: double my_pow2_darg0(double x) {
          return (1. * x + x * 1.);
      }
      root [5] meta_obj.execute(1) // no iterations, at the cost of function call.
      (double) 2.0000000
      
      Learn more about clad at https://github.com/vgvassilev/clad
      
      Patch by Aleksandr Efremov and me!
      3590e277
  3. May 02, 2018
  4. Mar 28, 2018
    • Vassil Vassilev's avatar
      Enable ROOT to be built with prebuilt clang and llvm. · 4dd1729c
      Vassil Vassilev authored
      To do so one needs to pass -Dbuiltin_llvm=Off -Dbuiltin_clang=Off and the
      PATH should contain the path to llvm-config.
      
      Note this is not enabling ROOT to work with vanilla clang!
      
      This patch allows ROOT to be built against a prebuilt clang and llvm from
      https://root.cern.ch/git/{llvm.git,clang.git}. It allows to reduce ROOT's
      build times (in cases when cmake decides to rebuild the in-tree llvm for
      no good reason). It moves the common denominator of different ROOT builds
      in one place to save space. It also allows easy switch between LLVM in
      debug and release mode.
      
      To build the external clang and llvm exactly in the same way as the
      in-tree builds use:
      
      CMAKE_FLAGS="\
                  -DLLVM_ENABLE_WARNINGS=OFF                   \
                  -DLLVM_INCLUDE_TESTS=OFF                     \
                  -DCLANG_INCLUDE_TESTS=OFF                    \
                  -DLLVM_INCLUDE_EXAMPLES=OFF                  \
                  -DCLANG_BUILD_TOOLS=OFF                      \
                  -DCLANG_TOOL_ARCMT_TEST_BUILD=OFF            \
                  -DCLANG_TOOL_CLANG_CHECK_BUILD=OFF           \
                  -DCLANG_TOOL_CLANG_FORMAT_BUILD=OFF          \
                  -DCLANG_TOOL_CLANG_FORMAT_VS_BUILD=OFF       \
                  -DCLANG_TOOL_CLANG_FUZZER_BUILD=OFF          \
                  -DCLANG_TOOL_CLANG_IMPORT_TEST_BUILD=OFF     \
                  -DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=OFF \
                  -DCLANG_TOOL_CLANG_RENAME_BUILD=OFF          \
                  -DCLANG_TOOL_C_ARCMT_TEST_BUILD=OFF          \
                  -DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF          \
                  -DCLANG_TOOL_DIAGTOOL_BUILD=OFF              \
                  -DCLANG_TOOL_LIBCLANG_BUILD=OFF              \
                  -DCLANG_TOOL_SCAN_BUILD_BUILD=OFF            \
                  -DCLANG_TOOL_SCAN_VIEW_BUILD=OFF             \
                  -DLLVM_BUILD_TOOLS=OFF                       \
                  -DLLVM_TOOL_LLVM_AR_BUILD=OFF                \
                  -DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=OFF \
                  -DLLVM_FORCE_USE_OLD_TOOLCHAIN=ON            \
                  -DCLANG_ENABLE_STATIC_ANALYZER=OFF           \
                  -DCLANG_ENABLE_ARCMT=OFF                     \
                  -DCLANG_ENABLE_FORMAT=OFF                    \
                  -DLLVM_TARGETS_TO_BUILD=host                 \
                  -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF         \
                  -DLLVM_ENABLE_ABI_BREAKING_CHECKS=OFF        \
                  -DCMAKE_INSTALL_PREFIX=..                    \
                  -DCMAKE_BUILD_TYPE=Debug"
      
      cmake "$CMAKE_FLAGS"   ../../../sources/root-llvm/
      4dd1729c
  5. Mar 20, 2018
    • Guilherme Amadio's avatar
      Set CLING_BUILD_PLUGINS to OFF by default · c13d5de6
      Guilherme Amadio authored
      This option uses ExternalProject_Add() to clone and build the clad
      plugin. However, things that assume a network connection have to be
      disabled by default in order not to break builds on machines without
      a network connection or inside a sandbox environment.
      c13d5de6
  6. Feb 21, 2018
  7. Feb 20, 2018
    • Vassil Vassilev's avatar
      Disable explicitly the clang tools. · e9051975
      Vassil Vassilev authored
      e9051975
    • Vassil Vassilev's avatar
      Enable ROOT's builtin_llvm=Off · 3361e913
      Vassil Vassilev authored
      This patch allows ROOT to be built against compatible external llvm (5.0
      or 5.0.1). Note that we still need to build clang (eg. we require
      builtin_clang=On) due to the ROOT-specific patches which are not yet
      upstream.
      
      Since we have externally installed llvm, we configure and build clang as
      a standalone project. The configuration relies on finding llvm-config-5.0
      and uses an adapted version of the standard clang standalone build
      procedure.
      
      Clang provides dependencies such as FileCheck and not which are used by
      cling's testsuite and are not being installed with the standard llvm
      package.
      
      Cling (which depends on llvm and clang) is built as a clang tool to avoid
      unresolved dependencies to clang and complicating further the already
      complicated cmake setup.
      
      This patch intends a minimal change and follows the initial (suboptimal)
      design to configure and build llvm, clang and cling as part of ROOT. An
      ultimate solution would be to have llvm, clang and cling built as separate
      standalone projects (following the recommended way by the LLVM cmake
      developers).
      3361e913
    • Vassil Vassilev's avatar
      Split builtin_llvm into two options. · d610068c
      Vassil Vassilev authored
      d610068c
    • Vassil Vassilev's avatar
      Implement basic plugin support in cling. · e3650250
      Vassil Vassilev authored
      We rely on clang's plugin infrastructure for loading, argument processing
      and unloading plugins.
      
      This patch teaches cling to work with clang plugins such as clad -- a
      clang plugin implementing automatic differentiation facilities.
      e3650250
  8. Jan 30, 2018
  9. Jan 29, 2018
  10. Nov 03, 2017
  11. Oct 19, 2017
  12. Oct 18, 2017
  13. Oct 10, 2017
  14. Oct 05, 2017
  15. Sep 11, 2017
    • Raphael Isemann's avatar
      [cmake] Synchronize LLVM flags with cling flags. · ec73d0e3
      Raphael Isemann authored
      So far we just hard-coded the default definitions that LLVM uses to
      the CLING_CXXFLAGS. This means that once LLVM actually changes
      its compile defintions, code that uses the CLING_CXXFLAGS is no
      longer in sync and starts reading invalid memory and so on.
      
      This patch extracts these flags from LLVM now and properly adds
      them to the CLING_CXXFLAGS instead of hardcoded them.
      
      This fixes the failing roottest-root-aclic-misc-assertROOT7027 test.
      
      Thanks to Axel for debugging this!
      ec73d0e3
  16. Aug 09, 2017
    • Raphael Isemann's avatar
      Fix OS X linking warnings due to a roaming llvm symbol. · ce401be3
      Raphael Isemann authored
      This fixes the OS X warnings like this one:
      
       ld: warning: direct access in function 'XXX' from file
       'libLLVMScalarOpts.a(NewGVN.cpp.o)' to global weak
       symbol 'llvm::ReverseIterate<bool>::value' from file
       'interpreter/llvm/src/lib/libclingUtils.a(AST.cpp.o)'
       means the weak symbol cannot be overridden
       at runtime. This was likely caused by different translation
       units being compiled with different visibility settings.
      
      I assume it's a compiler bug and it maybe fixes itself in LLVM 6.0
      as this is quite recently introduced code, so let's go with the
      most conservative fix and just disable this validation layer in LLVM
      (that we don't use from what I can see).
      ce401be3
  17. Jul 26, 2017
    • Raphael Isemann's avatar
      Disable rebuilding unnecessarily when git HEAD changes. · 3628b3c1
      Raphael Isemann authored
      Currently LLVM LTO and other parts depend on the git HEAD file
      because they pull in the current git revision (and should update
      when the git revision changes). This is causing some unnecessary
      rebuilding everytime someone is touching his git HEAD file.
      
      This commit is disabling this in future LLVM versions by setting
      the appropriate flag in LLVM to OFF (doesn't do a lot by now
      as we first need to get this revision in the ROOT llvm version
      https://reviews.llvm.org/D35377).
      3628b3c1
  18. Jun 08, 2017
  19. May 11, 2017
  20. May 03, 2017
  21. Apr 05, 2017
  22. Mar 15, 2017
  23. Mar 06, 2017
  24. Jan 31, 2017
  25. Oct 12, 2016
  26. Oct 04, 2016
  27. Sep 21, 2016
  28. Sep 19, 2016
  29. Sep 12, 2016
Loading