Skip to content

Commit 7e9c043

Browse files
authored
Synch the fork - hydra3
Synch the fork - hydra3
2 parents f7a9fc5 + f7f13ac commit 7e9c043

File tree

125 files changed

+2174
-5448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2174
-5448
lines changed

CHANGELOG.md

Lines changed: 160 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,165 @@
11
## CHANGE LOG
22

3+
### Hydra 3.0.0
34

4-
###Hydra 2.5.0
5+
It is the first release of the longly waited 3 series. Overall, this release is expected to be faster
6+
or at least to have similar performance to the previous releases.
7+
There are many bug fixes and other changes across. The most significant are summarized below:
8+
9+
#### C++14 compiliant release
10+
11+
This release is the first C++14 compatible release. So, move the versions of NVCC, GCC, CLANG and so on, acordinaly.
12+
Also, set the "--std" compiler flags to "--std=c++14" for both CUDA and host compilers.
13+
The first the minimal **CUDA** version has now been moved to **9.2**.
14+
The support for extended C++ lambdas in CUDA is not complete. The restrictions are discussed in the page:
15+
16+
https://docs.nvidia.com/cuda/archive/10.2/cuda-c-programming-guide/index.html#extended-lambda
17+
18+
Hydra3 can not wrap generic lambdas in host code. If this feature is necessary, use host-only uwrapped lambdas.
19+
20+
#### Function call interface
21+
22+
This is probably the most impacting change in this release, making **Hydra3** series backward incompatible with the previous series.
23+
24+
1. New interface for calling functors and lambdas.
25+
26+
a) Extensive statically-bound named parameter idiom support. This new idiom for specification of function call interfaces makes the definition callable objects in **Hydra3** much more safe, straight forward, transparent and user friendly, without compromise performance. In many cases enhancing performance, indeed. From **Hydra3**, users will be able to define new types, with *ad hoc* names wrapping around primary types, using the macro ```declvar(NewVar, Type)```.
27+
These new types are searched in compile time to bind the function call, if the type
28+
is not found a compile error is emitted, avoiding the generation of invalid or error prone code.
29+
See how it works:
30+
31+
```cpp
32+
...
33+
#include <hydra/functions/Gaussian.h>
34+
...
35+
36+
declvar(Angle, double)
37+
38+
int main(int argv, char** argc)
39+
{
40+
...
41+
42+
auto gauss = hydra::Gaussian<Angle>(mean, signa);
43+
...
44+
}
45+
```
46+
47+
in the previous code snippet, wherever the object `gauss` is called, if the argument consists of one or tuples, which are the entry type of all multidimensional dataset classes in Hydra, the `Angle`type identifier will be searched among the elements, if not found, code will not compile. If the argument is a non-tuple type, conversion will be tried. Multidimensional datasets can be defined using named parameters like in the snippet below:
48+
49+
```cpp
50+
51+
...
52+
#include <hydra/multivector.h>
53+
...
54+
55+
declvar(X, double)
56+
declvar(Y, double)
57+
declvar(Z, double)
58+
59+
int main(int argv, char** argc)
60+
{
61+
//3D device buffer
62+
hydra::multivector< hydra::tuple<X,Y,Z>, hydra::device::sys_t> data(nentries);
63+
64+
...
65+
66+
for(auto x: hydra::column<X>(data)
67+
std::cout << x << std::endl;
68+
}
69+
```
70+
71+
b) Functors: as usual, it should derive from ``hydra::BaseFunctor``, defined in ``hydra/Function.h``, but now the must inform their argument type, signature and number of parameters (``hydra::Parameter``) at template instantiation time. It is also necessary to implement the ``ResultType Evaluate(ArgType...)`` method. Default constructors should be deleted, non-default and copy constructors, as well as assignments operators should be implemented as well. See how this works for `hydra::Gaussian`:
72+
73+
```cpp
74+
75+
//implementations omited, for complete details
76+
//see: hydra/functions/Gaussian.h
77+
78+
template<typename ArgType, typename Signature=double(ArgType) >
79+
class Gaussian: public BaseFunctor<Gaussian<ArgType>, Signature, 2>
80+
{
81+
82+
public:
83+
84+
Gaussian()=delete;
85+
86+
Gaussian(Parameter const& mean, Parameter const& sigma );
87+
88+
__hydra_host__ __hydra_device__
89+
Gaussian(Gaussian<ArgType> const& other );
90+
91+
__hydra_host__ __hydra_device__
92+
Gaussian<ArgType>& operator=(Gaussian<ArgType> const& other );
93+
94+
__hydra_host__ __hydra_device__
95+
inline double Evaluate(ArgType x) const;
96+
97+
};
98+
```
99+
100+
c) Lambdas: Support for lambdas was updated to adhere the new interface. The new interface is implemented in `hydra/Lambda.h
101+
102+
```cpp
103+
...
104+
#include <hydra/multivector.h>
105+
#include <hydra/Lambda.h>
106+
...
107+
108+
declvar(X, double)
109+
declvar(Y, double)
110+
declvar(Z, double)
111+
112+
int main(int argv, char** argc)
113+
{
114+
//3D device buffer
115+
hydra::multivector< hydra::tuple<X,Y,Z>, hydra::device::sys_t> data(nentries);
116+
117+
//Lambda
118+
auto printer = hydra::wrap_lambda( []__hydra_dual__(X x, Y y){
119+
120+
print("x = %f y = %f", x(), y());
121+
122+
} );
123+
124+
for(auto entry: data) printer(entry);
125+
}
126+
127+
```
128+
129+
#### Random number generation
130+
131+
1. Support for analytical random number generation added for many functors added via `hydra::Distribution<FunctorType> specializations (see example `example/random/basic_distributions.inl`).
132+
2. Parallel filling of containers with random numbers (see example `example/random/fill_basic_distributions.inl`).
133+
134+
#### Phase-space generation
135+
136+
1. Updated `hydra::Decays` container for supporting named variable idiom.
137+
2. Changes in `hydra::PhaseSpace`and `hydra::Decays`.
138+
3. hydra::Chain not supported any more.
139+
4. New `Meld(...)` method in `hydra::Decays` for building mixed datasets and decay chains.
140+
5. Re-implemented logics for generation of events and associated weights.
141+
142+
#### Data fitting
143+
144+
1. Adding support to simultaneous fit.
145+
2. Fitting of convoluted PDFs.
146+
147+
#### General
148+
Many issues solved and bugs fixed across the tree:
149+
150+
1. https://github.com/MultithreadCorner/Hydra/issues/91#issue-631032116
151+
2. https://github.com/MultithreadCorner/Hydra/issues/90
152+
3. https://github.com/MultithreadCorner/Hydra/pull/89
153+
4. https://github.com/MultithreadCorner/Hydra/issues/87
154+
5. https://github.com/MultithreadCorner/Hydra/issues/86
155+
6. https://github.com/MultithreadCorner/Hydra/issues/82
156+
7. https://github.com/MultithreadCorner/Hydra/issues/77
157+
158+
and many others.
159+
160+
-------------------------
161+
162+
### Hydra 2.5.0
5163

6164
1. **Eigen** is not being distributed with **Hydra** anymore. **Eigen** will remain an dependency for foreseeable future.
7165
2. New facility to update **Thrust** and **CUB**. New namespaces ```hydra::hydra_thrust``` and ```hydra::hydra_cub``` defined.
@@ -11,7 +169,7 @@
11169
6. Re-implementation of the impacted examples.
12170
7. Many bug fixes across the tree...
13171

14-
###Hydra 2.4.1 (probably incomplete)
172+
### Hydra 2.4.1 (probably incomplete)
15173

16174
1. The main change is this release is the update of Thrust instance distributed with Hydra to the version 1.9.6, which enabled the support for CUDA 10.1 and hopefuly higher
17175
2. Range semantics implemented in Decays::Unweight methods

CMakeLists.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ SET(Hydra_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
1515
SET(CMAKE_MODULE_PATH "${Hydra_CMAKE_DIR}" ${CMAKE_MODULE_PATH})
1616
SET(CMAKE_VERBOSE_MAKEFILE ON)
1717

18-
#check if compiler is C++11 compliant
18+
#check if compiler is C++14 compliant
1919
include(CheckCXXCompilerFlag)
20-
CHECK_CXX_COMPILER_FLAG("--std=c++11" COMPILER_SUPPORTS_CXX11)
20+
CHECK_CXX_COMPILER_FLAG("--std=c++14" COMPILER_SUPPORTS_CXX14)
2121
if(NOT COMPILER_SUPPORTS_CXX11)
22-
message(FATAL "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
22+
message(FATAL "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
2323
endif()
2424

2525
#compiler flags
@@ -88,7 +88,7 @@ endif(FFTW_FOUND)
8888

8989
#-----------------------
9090
#get CUDA
91-
find_package(CUDA 8.0)
91+
find_package(CUDA 9.2)
9292
if(CUDA_FOUND)
9393
link_directories( ${CUDA_TOOLKIT_ROOT_DIR}/lib64/)
9494

@@ -100,12 +100,9 @@ SET(CUDA_PROPAGATE_HOST_FLAGS ON)
100100
SET(CUDA_SEPARABLE_COMPILATION OFF)
101101
SET(CUDA_VERBOSE_BUILD OFF)
102102

103-
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8)
104-
# LIST(APPEND CUDA_NVCC_FLAGS " -Xcompiler -D_MWAITXINTRIN_H_INCLUDED ")
105-
endif()
106103

107104
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.4)
108-
LIST(APPEND CUDA_NVCC_FLAGS " -Xcompiler -D__CORRECT_ISO_CPP11_MATH_H_PROTO ")
105+
# LIST(APPEND CUDA_NVCC_FLAGS " -Xcompiler -D__CORRECT_ISO_CPP11_MATH_H_PROTO ")
109106
endif()
110107
# Detect CUDA architecture and get best NVCC flags
111108

Doxyfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#PROJECT_NAME = "Hydra_examples_and_documentation"
22
PROJECT_NUMBER = 3.0.0
33

4+
45
STRIP_FROM_PATH = /home/augalves/Development/Release/Hydra
56

67
INPUT = /home/augalves/Development/Release/Hydra/hydra /home/augalves/Development/Release/Hydra/doxydefs /home/augalves/Development/Release/Hydra/examples /home/augalves/Development/Release/Hydra/README.md

README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Table of Contents
3131
What is it?
3232
-----------
3333

34-
Hydra is a C++11 compliant and header only framework designed to perform common data analysis tasks on massively parallel platforms. Hydra provides a collection of containers and algorithms commonly used in HEP data analysis, which can deploy transparently OpenMP, CUDA and TBB enabled devices, allowing the user to re-use the same code across a large range of available multi-core CPU and accelerators. The framework design is focused on performance and precision.
34+
Hydra is a C++14 compliant and header only framework designed to perform common data analysis tasks on massively parallel platforms. Hydra provides a collection of containers and algorithms commonly used in HEP data analysis, which can deploy transparently OpenMP, CUDA and TBB enabled devices, allowing the user to re-use the same code across a large range of available multi-core CPU and accelerators. The framework design is focused on performance and precision.
3535

3636
The core algorithms follow as close as possible the implementations widely used in frameworks like ROOT and libraries
3737
like GSL.
@@ -44,36 +44,38 @@ Currently Hydra supports:
4444
* Generation of phase-space Monte Carlo samples with any number of particles in the final states. Sequential decays, calculation of integrals of models over the corresponding phase-space and production of weighted and unweighted samples, which can be flat or distributed following a model provided by the user.
4545
* Sampling of multidimensional pdfs.
4646
* Multidimensional maximum likelihood fits using binned and unbinned data sets.
47+
* Multi-layered simultaneous fit of different models, over different datasets, deploying different parallelization strategies for each model.
4748
* Calculation of S-Plots, a popular technique for statistical unfolding of populations contributing to a sample.
4849
* Evaluation of multidimensional functions over heterogeneous data sets.
4950
* Numerical integration of multidimensional functions using self-adaptive Monte Carlo and quadrature methods.
5051
* Multidimensional sparse and dense histogramming of large samples.
5152
* Object-based interface to FFTW and CuFFT for performing Fast Fourier Transform in CPU and GPU.
5253
* FFT based one-dimensional convolution for arbitrary signal and kernel shapes.
5354
* Booststrap and real cubic spiline for datasets on CPU and GPU.
54-
* Sobol low discrepance sequences up to 3667 dimensions
55+
* Sobol low discrepance sequences up to 3667 dimensions.
5556

5657
Hydra also provides a bunch of custom types, optimized containers and a number of algorithms and constructs to maximize performance, avoiding unnecessary usage of memory and without losing the flexibility and portability to compile and run the same code across different platforms and deployment scenarios.
5758

5859

59-
For example, just changing .cu to .cpp in any source code written only using the Hydra and standard C++11 is enough
60+
For example, just changing .cu to .cpp in any source code written only using the Hydra and standard C++14 is enough
6061
to compile your application for OpenMP or TBB compatible devices using GCC or other compiler in a machine without a NVIDIA GPU installed.
6162

62-
In summary, by using Hydra the user can transparently typical bottle-neck calculations to a suitable parallel device and get speed-up factors ranging from dozens to hundreds.
63+
In summary, by using Hydra the user can transparently implement and dispatch typical bottle-neck calculations to a suitable parallel device and get speed-up factors ranging from dozens to hundreds.
6364

6465

6566

6667
Hydra and Thrust
6768
----------------
6869

6970
Hydra is implemented on top of the [Thrust library](https://thrust.github.io/) and relies strongly on Thrust's containers, algorithms and backend management systems.
70-
The official version of Thrust supports tuples with maximum ten elements. In order to overcome this limitation, Hydra uses the
71+
The official version of Thrust supports tuples with maximum ten elements. In order to overcome this limitation, Hydra uses an
7172
[unofficial version, forked from the original, by Andrew Currigan and collaborators](https://github.com/andrewcorrigan/thrust-multi-permutation-iterator).
7273
This version implements variadic tuples and related classes, as well as provides some additional functionality, which are missing in the official Thrust.
74+
In order to keep Hydra uptodated with the latest bug-fixes and architetural improvements in Thrust, at each Hydra release, the official [Thrust library](https://thrust.github.io/) is patched with the Currigan's variadic tuple implementation.
7375

74-
The version of Thrust distributed with Hydra is maintained by [MultithreadCorner](https://github.com/MultithreadCorner). It is basically a fork of Currigan's repository, which was merged with the latest official release available in GitHub (Thrust 1.9.7).
76+
So, version of Thrust distributed with Hydra is maintained by [MultithreadCorner](https://github.com/MultithreadCorner). It is basically a fork of Currigan's repository, which was merged with the latest official release available in GitHub (Thrust 1.9.7).
7577

76-
***Hydra does not depend or conflict with the official Thrust library distributed with the CUDA-SDK.***
78+
***Hydra does not depend or conflict with the official Thrust library distributed with the CUDA-SDK.***
7779

7880

7981
Supported Parallel Backends
@@ -97,7 +99,7 @@ nvcc -I/path/to/Hydra -Xcompiler -fopenmp -DHYDRA_HOST_SYSTEM=OMP -DHYDRA_DEVIC
9799
The available "host" and "device" backends can be freely combined.
98100
Two important features related to Hydra's design and the backend configuration:
99101

100-
* If CUDA backend is not used, [NVCC and the CUDA runtime](https://developer.nvidia.com/cuda-toolkit) are not necessary. The programs can be compiled with GCC, Clang or other host compiler compatible with C++11 directly.
102+
* If CUDA backend is not used, [NVCC and the CUDA runtime](https://developer.nvidia.com/cuda-toolkit) are not necessary. The programs can be compiled with GCC, Clang or other host compiler compatible with C++14 support directly.
101103
* Programs written using only Hydra, Thrust, STL and standard c++ constructs, it means programs without any raw CUDA code or calls to the CUDA runtime API, can be compiled with NVCC, to run on CUDA backends, or a suitable host compiler to run on OpenMP , TBB and CPP backends. **Just change the source file extension from .cu to .cpp, or something else the host compiler understands.**
102104

103105

@@ -134,11 +136,12 @@ Installation and requirements
134136

135137
Hydra is a header only library, so no build process is necessary to install it.
136138
Just place the `hydra` folder and its contents where your system can find it.
137-
The library run on Linux systems and requires at least a host compiler supporting C++11. To use NVidia's GPUs, CUDA 8 or higher is required.
138-
A suite of examples demonstrating the basic features of the library are included in the `examples` folder.
139+
The framework runs on Linux systems and requires at least a host compiler supporting C++14. To use NVidia's GPUs, CUDA 9.2 or higher is required.
140+
A suite of examples demonstrating the basic features of the framework is included in the `examples` folder.
139141
All the examples are organized in .inl files, which implements the `main()` function. These files are included by .cpp and .cu
140142
files, which are compiled according with the availability of backends. TBB and CUDA backends requires the installation of the corresponding libraries and runtimes.
141143
These code samples uses, but does not requires [ROOT](https://root.cern.ch/) for graphics, and [TCLAP](http://tclap.sourceforge.net/) library for process command line arguments.
144+
Some functionality in Hydra requires Eigen, GSL, CuFFT and FFTW.
142145

143146
Examples
144147
--------
@@ -162,10 +165,12 @@ The examples are listed below:
162165
4. __misc__ : multiarray_container, multivector_container, variant_types
163166
5. __numerical_integration__ : adaptive_gauss_kronrod, gauss_kronrod, plain_mc, vegas
164167
6. __phase_space__ : phsp_averaging_functor, phsp_evaluating_functor, phsp_reweighting, phsp_basic, phsp_unweighting, phsp_chain, phsp_unweighting_functor
165-
7. __random__ : basic_distributions, sample_distribution
166-
8. __root_macros__ : macros to run examples in ROOT
168+
7. __phys__ : breit_wigner_plus_chebychev, breit_wigner_plus_polynomial, crystal_ball_plus_exponential, dalitz_plot, double_gaussian_plus_exponential, gaussian_plus_argus,
169+
ipatia_plus_argus, particle_mass, pseudo_experiment
170+
8. __random__ : basic_distributions, sample_distribution
171+
9. __root_macros__ : macros to run examples in ROOT
167172

168-
Each compiled example executable will have an postfix (ex.: _cuda, _omp, _tbb) to indicate the deployed device backend.
173+
Each compiled example executable will have an postfix (ex.:_cpp, _cuda, _omp, _tbb) to indicate the deployed device backend.
169174
All examples use CPP as host backend.
170175

171176

@@ -208,7 +213,7 @@ Here’s what you should do if you need help or would like to contribute:
208213

209214
1. If you need help or would like to ask a general question, subscribe and use https://groups.google.com/forum/#!forum/hydra-library-users.
210215
2. If you found a bug, use GitHub issues.
211-
3. If you have an idea, suggestion of whatever, use GitHub issues.
216+
3. If you have an idea, suggestion or whatever, use GitHub issues.
212217
4. If you want to contribute, submit a pull request https://github.com/MultithreadCorner/Hydra.
213218

214219
Author
@@ -219,7 +224,7 @@ Hydra was created and is maintained by [Antonio Augusto Alves Jr](https://github
219224
Acknowledgement
220225
---------------
221226

222-
Hydra's development has been supported by the [National Science Foundation](http://nsf.gov/index.jsp)
227+
Initial Hydra's development was supported by the [National Science Foundation](http://nsf.gov/index.jsp)
223228
under the grant number [PHY-1414736](http://nsf.gov/awardsearch/showAward?AWD_ID=1414736).
224229
Any opinions, findings, and conclusions or recommendations expressed in this material are those of
225230
the developers and do not necessarily reflect the views of the National Science Foundation.

0 commit comments

Comments
 (0)