617 Commits

Author SHA1 Message Date
Pratyush Das
be615cb351 Move declarations to fix faulty logic
llvm_vers variable required earlier for linux platform initialization
2020-06-10 12:44:04 +02:00
Pratyush Das
f8ccd27e67 Fix tar_required logic
If all requirements were satisfied, tar_required would always be false.
This commit fixes it.
2020-05-13 09:29:07 +02:00
Pratyush Das
87011bd783 Fix cmake requirement 2020-05-13 09:29:07 +02:00
Pratyush Das
98a1c4acad Fix svn installation 2020-05-13 09:29:07 +02:00
Pratyush Das
52f75d8768 Fix distro requirement (and installation of pip)
There might be an issue when using conda as default Python for Python3
because conda calls it pip but otherwise it is pip3.
2020-05-13 09:29:07 +02:00
Vassil Vassilev
a7d40e8237 Bump clad version to v0.6.
The new release includes some improvements in Reverse mode:
  * Reduce the quadratic cloning complexity to linear.
  * Support variable reassignments pontentially depending on control flow.
  * Support operators `+=`, `-=`, `*=`, `/=`, `,`, `++`, `--`.
  * Allow assignments to array subscripts.
  * Support nested assignments in expressions `a = b * ((c ? d : e) = f = g);`
  * Enable differentiation of for-loops

See more at: https://github.com/vgvassilev/clad/blob/v0.6/docs/ReleaseNotes.md

This patch enables us to upgrade to llvm9. Clad supports from clang5 to clang9.
2020-04-03 11:29:05 +02:00
Pratyush Das
82e662096c Enable tarball-tag flag to build cling using LLVM binary release.
Fixes Cling's nightly releases
2019-12-25 07:29:26 +01:00
Pratyush Das
8a64fb67e5 Cleanup 2019-12-23 06:44:30 +01:00
Pratyush Das
ba5b08c837 Fix warning - is keyword only applies to literals 2019-12-23 06:44:30 +01:00
Pratyush Das
334ac32e25 platform.linux_distribution is deprecated 2019-12-23 06:44:30 +01:00
Pratyush Das
4b928845e3 Refactor code in last_stable and current_dev 2019-12-23 06:44:30 +01:00
Pratyush Das
eec9a3559f Remove legacy code to build libcpp 2019-12-23 06:44:29 +01:00
Pratyush Das
0af62c625d Fix global namespace error on variable tar_required 2019-12-23 06:44:29 +01:00
Pratyush Das
20254e5926 Enable flag with-llvm-tar for OS X 2019-12-23 06:44:29 +01:00
Pratyush Das
ad0126f994 Fix lit.cfg for building from LLVM binary in OS X 2019-12-23 06:44:29 +01:00
Pratyush Das
e9f0bc3458 Build cling using LLVM packaged binary for OS X 2019-12-23 06:44:28 +01:00
Pratyush Das
f2ea3180f3 Force travis to use LLVM binary release tar 2019-12-23 06:44:28 +01:00
Pratyush Das
5bfb2b834d Cleanup 2019-12-23 06:44:28 +01:00
Pratyush Das
bc70947c9a Fix broken vanilla-cling tests.
Change condition of adding vanilla-cling, change directory locations for
downloaded binary release.
2019-12-23 06:44:28 +01:00
Pratyush Das
28c58fdf34 Add support to build Cling using LLVM from Distro's package manager. 2019-12-23 06:44:28 +01:00
Pratyush Das
5ebd9587dd Comply with new NVPTX update of Cling 2019-12-23 06:44:28 +01:00
Pratyush Das
21d3cd2d7c Enabled support to build Cling using downloaded LLVM release tar. 2019-12-23 06:44:27 +01:00
Pratyush Das
2796d6bf96 Proof of concept - Cling can be built using downloaded LLVM release tar. 2019-12-23 06:44:27 +01:00
Pratyush Das
495a667988 Removed redundant line 2019-12-23 06:44:27 +01:00
Simeon Ehrig
43d5583905 Add NVPTX backend to CPT 2019-11-07 19:29:15 +01:00
Pratyush Das
8482b60697 Only install necessary packages using cpt if missing requirements
and cleanup .travis.yml
2019-09-27 07:01:54 +02:00
Pratyush Das
3ed675ab01 pkg flag now defaults to tar
For non [Windows, Ubuntu, Redhat, OS X] operating systems the pkg flag to the --last stable and --current-dev arguments didn't do anything - It should create a tar because that is the default behaviour for Unix like platforms which support bash.
2019-09-26 07:29:39 +02:00
Axel Naumann
2c92b57062 Try to fix Issue #289, #302, #297: only build cling, not lli. 2019-09-18 08:44:45 +02:00
pankaj kumar
0c880f8472 Fixing the jupyter Kernel to be able to handle exceptions 2019-08-31 10:16:20 +02:00
straydragon
adb1396e4f Fix cpt.py a careless mistake
Signed-off-by: Vassil Vassilev <v.g.vassilev@gmail.com>
2019-04-18 21:46:14 +02:00
Aleksander Gajewski
07c30f424e Add non-interactive mode to cpt
Signed-off-by: Vassil Vassilev <v.g.vassilev@gmail.com>
2019-04-11 07:44:36 +02:00
lizhangwen
314018e6db Fix OSX where cmake version is '3.14.0-rc4' 2019-04-10 20:59:24 +02:00
Vassil Vassilev
6130148a58 Bump clad version to v0.5.
The new release includes some improvements in both Forward and
Reverse mode:
* Extend the way to specify a dependent variables. Consider function,
  `double f(double x, double y, double z) {...}`, `clad::differentiate(f, "z")`
  is equivalent to `clad::differentiate(f, 2)`. `clad::gradient(f, "x, y")`
  differentiates with respect to `x` and `y` but not `z`. The gradient results
  are stored in a `_result` parameter in the same order as `x` and `y` were
  specified. Namely, the result of `x` is stored in `_result[0]` and the result
  of `y` in `_result[1]`. If we invert the arguments specified in the string to
  `clad::gradient(f, "y, x")` the results will be stored inversely.
* Enable recursive differentiation.
* Support single- and multi-dimensional arrays -- works for arrays with constant
  size like `double A[] = {1, 2, 3};`, `double A[3];` or `double A[1][2][3][4];`

See more at: https://github.com/vgvassilev/clad/blob/v0.5/docs/ReleaseNotes.md
2019-04-08 20:59:15 +02:00
Vassil Vassilev
1cb36481ba Add missing dependency. 2019-03-17 08:15:02 +01:00
Oksana Shadura
59a46d513b Fixing compile time installation of clad in CMAKE_INSTALL_PATH
[ROOT-9924] Installing headers for clad
2019-02-05 11:44:03 +01:00
Vassil Vassilev
51a83f543d Reduce the libraries we link to. 2018-11-21 17:15:14 +01:00
Vassil Vassilev
fc33c22f45 Bump clad version to v0.4.
The new release includes some improvements in both Forward and
Reverse mode:
  * Support `x += y`, `x -= y`, `x *= y`, `x /= y`, `x++`, `x--`, `++x`, `--x`
    in forward mode.
  * Reduce emission of unused expressions
  * Add a special `#pragma clad ON/OFF/DEFAULT` to annotate regions which
    contain derivatives
  * Various small optimizations

See more at: https://github.com/vgvassilev/clad/blob/v0.4/docs/ReleaseNotes.md
2018-11-06 11:59:41 +01:00
Sylvain Corlay
7116e7239c Add missing libraries 2018-10-19 00:30:04 +02:00
Vassil Vassilev
38eb2b89ba Allow plugins to handle custom pragmas.
This will help clad implement pattern such as:
#pragma clad on
// code which needs derivation
#pragma clad off
2018-10-08 21:44:55 +02:00
Vassil Vassilev
818126599b Also update the version on unix.
This is part of 4ff4d9aa2d.
2018-09-30 20:59:41 +02:00
Vassil Vassilev
628288faee Bump clad version to v0.3.
The new release includes some improvements in both Forward and
Reverse mode:
  * Better correctness of C++ constructs -- handle scopes properly; allow proper
  variable shadowing; and preserve namespaces.
  * Efficient evaluation in forward mode.
  * Reduced cloning complexity.
  * Handle more C++ constructs -- variable reassignments and for loops.

See more at: https://github.com/vgvassilev/clad/blob/v0.3/docs/ReleaseNotes.md
2018-09-28 21:29:14 +02:00
Axel Naumann
0a416cd1ed Inject -isysroot ${CMAKE_OSX_SYSROOT} to clad. 2018-09-28 17:43:44 +02:00
Vassil Vassilev
c63ab13a9e Specify where the clang header files are.
In cases where we build ROOT with -Dbuiltin_llvm=Off -Dbuiltin_clang=On
and we have installed both llvm and clang in /usr/ clad will pick up
the clang headers from there too.

This patch gives higher priority to the header files which ROOT is
supposed to use. It fixes a very obscure initialization issue due to
different versions of the ASTContext.h installed and used by ROOT.
2018-08-22 20:14:52 +02:00
Oksana Shadura
6238cda8df Updating clad build CMake arguments for the case when buiting_llvm and buitin_clang is OFF 2018-08-17 13:14:37 +02:00
Bertrand Bellenot
5b55c52bda Fix builing of clad and related test on Windows 2018-08-10 10:44:09 +02:00
Vassil Vassilev
bba0c4b9e0 Update clad to v0.2
The relevant highlights are:

* Support better Windows (thanks to Bertrand Bellenot!);

* Disabled automatic discovery of system LLVM -- clad should only
  search for LLVM at DCLAD_PATH_TO_LLVM_BUILD. On some platforms
  (discovered by Oksana Shadura via rootbench) clad discovers the
  system LLVM which is compatible in principle but this is not what
  we want for ROOT.

* Implemented -CLAD_BUILD_STATIC_ONLY -- this covers the ROOT usecase
  where we do not need shared objects but link the libraries against
  another shared object (libCling.so). This allows platforms which have
  disabled LLVM_ENABLE_PLUGINS to still build clad and use it. Such
  example is CYGWIN and Windows.

See more at: https://github.com/vgvassilev/clad/releases/tag/v0.2
2018-08-08 20:14:37 +02:00
Vassil Vassilev
e9068c56b1 Enable the automatic differentiation library clad in ROOT.
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!
2018-08-03 09:15:01 +02:00
Vassil Vassilev
272905eced Implement clang plugin support.
Clang allows third party shared libraries to provide user-defined
extensions. For example, a custom libTemplateInstantiation.so can
visualize all template instantiation chains in clang. To enable it
one needs to pass a set of options such as -fplugin.

Cling should be able to inherently work with clang plugins. However,
cling still does not make full use of the clang driver where the plugin
setup is handled.

This patch enables plugins in cling and extends them in some aspects.
In particular, cling allows loading of plugins from shared libraries
but also if they are linked to the same library where cling is. This is
very useful in cases where cling runs itself in a shared library (eg
libCling). Users of libCling (such as ROOT) prefer to keep all llvm and
clang related symbols local to avoid symbol clashes if there is another
version of clang and llvm linked against a package. This can be done by
dlopen-ing libCling with RTLD_LOCAL visibility mode. Then the only way
for clang plugins to work in this scenario is to be linked to libCling.

Patch by Aleksandr Efremov and me.
2018-07-28 13:17:44 +02:00
Vassil Vassilev
19915ff6d2 Add missing link libraries. 2018-07-27 11:14:04 +02:00
Axel Naumann
c33c5fb033 cling cpt travis fold: misspelled "end". 2018-06-14 10:14:12 +02:00