Skip to content

Commit 4dd3969

Browse files
committed
Merge branch 'develop-hydra3' of https://github.com/MultithreadCorner/Hydra into develop-hydra3
2 parents 27b9bfe + c5ef5fc commit 4dd3969

File tree

3 files changed

+109
-63
lines changed

3 files changed

+109
-63
lines changed

CHANGELOG.md

Lines changed: 83 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ It is the first release of the longly waited 3 series. Overall, this release is
66
or at least to have similar performance to the previous releases.
77
There are many bug fixes and other changes across. The most significant are summarized below:
88

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+
920
#### Function call interface
1021

1122
This is probably the most impacting change in this release, making **Hydra3** series backward incompatible with the previous series.
@@ -31,98 +42,122 @@ See how it works:
3142
auto gauss = hydra::Gaussian<Angle>(mean, signa);
3243
...
3344
}
34-
```
35-
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.
36-
Multidimensional datasets can be defined using named parameters like in the snippet below:
37-
38-
```cpp
39-
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+
4051
...
4152
#include <hydra/multivector.h>
4253
...
43-
54+
4455
declvar(X, double)
4556
declvar(Y, double)
4657
declvar(Z, double)
4758

4859
int main(int argv, char** argc)
4960
{
50-
//3D device buffer
51-
hydra::multivector< hydra::tuple<X,Y,Z>, hydra::device::sys_t> data(nentries);
52-
53-
...
54-
55-
for(auto x: hydra::column<X>(data)
56-
{
57-
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)
5867
std::cout << x << std::endl;
59-
60-
}
6168
}
62-
63-
```
69+
```
6470

65-
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``:
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`:
6672

6773
```cpp
6874

6975
//implementations omited, for complete details
7076
//see: hydra/functions/Gaussian.h
71-
77+
7278
template<typename ArgType, typename Signature=double(ArgType) >
7379
class Gaussian: public BaseFunctor<Gaussian<ArgType>, Signature, 2>
7480
{
75-
76-
public:
77-
78-
Gaussian()=delete;
79-
80-
Gaussian(Parameter const& mean, Parameter const& sigma );
8181

82-
__hydra_host__ __hydra_device__
83-
Gaussian(Gaussian<ArgType> const& other );
84-
85-
__hydra_host__ __hydra_device__
86-
Gaussian<ArgType>& operator=(Gaussian<ArgType> const& other );
87-
88-
__hydra_host__ __hydra_device__
89-
inline double Evaluate(ArgType x) const;
90-
91-
};
82+
public:
9283

93-
```
84+
Gaussian()=delete;
85+
86+
Gaussian(Parameter const& mean, Parameter const& sigma );
87+
88+
__hydra_host__ __hydra_device__
89+
Gaussian(Gaussian<ArgType> const& other );
9490

95-
c) Lambdas: Support for lambdas is updated for the new interface. The new interface is implemented
96-
in ``hydra/Lambda.h``
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;
9796

98-
```cpp
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
99101

102+
```cpp
100103
...
101104
#include <hydra/multivector.h>
102105
#include <hydra/Lambda.h>
103106
...
104-
107+
105108
declvar(X, double)
106109
declvar(Y, double)
107110
declvar(Z, double)
108-
111+
109112
int main(int argv, char** argc)
110113
{
111114
//3D device buffer
112115
hydra::multivector< hydra::tuple<X,Y,Z>, hydra::device::sys_t> data(nentries);
113-
116+
114117
//Lambda
115118
auto printer = hydra::wrap_lambda( []__hydra_dual__(X x, Y y){
116-
119+
117120
print("x = %f y = %f", x(), y());
118-
121+
119122
} );
120-
123+
121124
for(auto entry: data) printer(entry);
122125
}
123-
126+
124127
```
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`).
125133

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+
-------------------------
126161

127162
### Hydra 2.5.0
128163

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.

THANKS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@
1111
* Andrea Contu for moral support, extensive testing and bug report whn using hydra in his own projetcs.
1212
* Marcos Romero for a number of contributions, from new functors to bug reports and corrections.,
1313
* Scott Stevenson for nicely reviewing the spelling of Readme.md.
14+
15+
## Hydra 3.0.0
16+
17+
* Davide Brundu for a number of contributions, from new functionality to bug reports and corrections.
18+
* Andrea Contu always for the moral support, extensive testing and bug report whn using hydra in his own projetcs.
19+
* Angelo di Canto, for the support, testing and skype based bug report.

0 commit comments

Comments
 (0)