Skip to content

Commit bf85b59

Browse files
committed
sync merge with master...
2 parents ba2ded9 + 89f8082 commit bf85b59

File tree

80 files changed

+27366
-2275
lines changed

Some content is hidden

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

80 files changed

+27366
-2275
lines changed

CHANGELOG.md

Lines changed: 110 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,72 @@
11
## CHANGE LOG
22

3+
### Hydra 3.2.2
4+
5+
This release:
6+
7+
1)
8+
9+
Bug fixes:
10+
11+
1) Missing assignment operators for hydra::FunctionArgments
12+
13+
2) Covering composite of composites (https://github.com/MultithreadCorner/Hydra/issues/100)
14+
15+
16+
### Hydra 3.2.1
17+
18+
This release:
19+
20+
1) In certain corner cases, a substantial part of the calculations performed to evaluate a functor depends only on the functor's state and it's parameters; i.e. it does not depend on the current functor's arguments that can be dataset points, numerical integration abscissas and so on. To further optimize the calculations in these cases, Hydra now provides the method ``virtual void hydra::Parameter::Update(void)``, which can be overridden by the functors
21+
in order to pre-calculate the factors only depending in the parameters, before the calculations are distributed to one of the parallel backends.
22+
23+
2) Introduction of `hydra::random_range` and retirement of `hydra::random_uniform_range`, `hydra::random_gaussian_range`, `hydra::random_exp_range` , to define iterators for drawing samples from functors. Examples updated accordingly.
24+
25+
26+
Bug fixes:
27+
28+
1) ROOT examples updated and tested against ROOT/6.22.00. ( https://github.com/MultithreadCorner/Hydra/commit/acd303e7fb21d220beb7986ab7122206ac6a8eed )
29+
30+
2) Correction of `hydra::CrystalBallShape` math. ( https://github.com/MultithreadCorner/Hydra/commit/a7ce56d4c9efad46351ddee630f7afce245c9909 )
31+
32+
3) Spelling of some words (in code) accross the tree. (https://github.com/MultithreadCorner/Hydra/commit/d2161898bd9ed4e09ee6593d27372c8ad43347b1)
33+
34+
4) Fixing fallback path in `MSB.h`. ( https://github.com/MultithreadCorner/Hydra/commit/5b10e05e2517c27f270507c27ea76c85a62e24f5 )
35+
36+
5) Reimplementation of `hydra::detail::is_valid_type_pack` ( https://github.com/MultithreadCorner/Hydra/commit/f30b97a414f513e3e410195555bd0eb8f44eb9f9 )
37+
38+
39+
-------------------------------------
40+
41+
42+
### Hydra 3.1.0
43+
44+
This release substantially expands the set of pseudorandom number generators available in Hydra.
45+
From Random123 (see: *John K. Salmon and others, (2011) "Parallel random numbers: as easy as 1, 2, 3"*. https://dl.acm.org/doi/10.1145/2063384.2063405), Hydra provides wrappers and implementations for
46+
47+
1) *Philox*
48+
2) *Ars*
49+
3) *Threefry*
50+
51+
*Squares* PRNG ( see: *Widynski, Bernard (2020). "Squares: A Fast Counter-Based RNG"*. https://arxiv.org/abs/2004.06278v2 ), are available from now, in two versions:
52+
53+
1) *Squares3*
54+
2) *Squares4*
55+
56+
All the new generators belong to the *count-based family*, have excelent statistical properties, passing BigCrush (TestU01) and other tests easily, without any failure. All implementations provide very long periods (2^64 -1 or higher). For Squares{3,4}, users get a set of 2500 precalculated seeds for generation of sequences (streams) without statistical artifacts among them (all credits to Bernard Widynski!).
57+
58+
In summary, ***Squares3, Squares4 and Philox are way faster*** than the any option available in the previous releases. Ars and Threefry are competitive, being most of the time slightly faster than the fastest native `Thrust` rng.
59+
60+
**From this release, the defaut PRNG in Hydra is set to hydra::squares3**.
61+
62+
#### General
63+
64+
* Bug fixed in ```hydra::unweight``` implementation.
65+
* Other minor fixes and modifitions across the tree.
66+
67+
______________________________
68+
69+
370
### Hydra 3.0.0
471

572
It is the first release of the longly waited 3 series. Overall, this release is expected to be faster
@@ -23,7 +90,7 @@ This is probably the most impacting change in this release, making **Hydra3** se
2390

2491
1. New interface for calling functors and lambdas.
2592

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)```.
93+
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 ```declarg(NewVar, Type)```.
2794
These new types are searched in compile time to bind the function call, if the type
2895
is not found a compile error is emitted, avoiding the generation of invalid or error prone code.
2996
See how it works:
@@ -33,7 +100,7 @@ See how it works:
33100
#include <hydra/functions/Gaussian.h>
34101
...
35102

36-
declvar(Angle, double)
103+
declarg(Angle, double)
37104

38105
int main(int argv, char** argc)
39106
{
@@ -52,9 +119,9 @@ See how it works:
52119
#include <hydra/multivector.h>
53120
...
54121
55-
declvar(X, double)
56-
declvar(Y, double)
57-
declvar(Z, double)
122+
declarg(X, double)
123+
declarg(Y, double)
124+
declarg(Z, double)
58125

59126
int main(int argv, char** argc)
60127
{
@@ -105,9 +172,9 @@ See how it works:
105172
#include <hydra/Lambda.h>
106173
...
107174

108-
declvar(X, double)
109-
declvar(Y, double)
110-
declvar(Z, double)
175+
declarg(X, double)
176+
declarg(Y, double)
177+
declarg(Z, double)
111178

112179
int main(int argv, char** argc)
113180
{
@@ -137,7 +204,7 @@ is not found a compile error is emitted, informing and suggesting the user to us
137204
#include <hydra/functions/Gaussian.h>
138205
...
139206

140-
declvar(Xvar, double)
207+
declarg(Xvar, double)
141208

142209
int main(int argv, char** argc)
143210
{
@@ -165,7 +232,40 @@ The filling functions can be called also with a specific backend policy and with
165232

166233
#### Data fitting
167234

168-
1. Adding support to simultaneous fit.
235+
1. Added support to multi-layered simultaneous fit of different models, over different datasets, deploying different parallelization strategies for each model. No categorization of the dataset is needed, but just to set up preliminarly the different component FCNs, that can be optimized in isolation or in the context of the simultaneous FCN. Simultaneous FCNs can be created via direct instantiation or using the convenience function `hydra::make_simultaneous_fcn(...)`, as shown in the following snippet.
236+
237+
```cpp
238+
...
239+
#include <hydra/LogLikelihoodFCN.h>
240+
...
241+
242+
int main(int argv, char** argc)
243+
{
244+
...
245+
//=====================================================================================
246+
// +----< fcn(model-x)
247+
// +----< simultaneous fcn 1 ----- |
248+
// | +----< fcn(model-y)
249+
// simultaneous fcn <----+
250+
// | +----< fcn(model-w)
251+
// +----< simultaneous fcn 2 ------|
252+
// | +----< fcn(model-z)
253+
// +----< fcn(model-v)
254+
//=====================================================================================
255+
auto fcnX = hydra::make_loglikehood_fcn(modelX, dataX);
256+
auto fcnY = hydra::make_loglikehood_fcn(modelY, dataY);
257+
auto fcnW = hydra::make_loglikehood_fcn(modelY, dataY);
258+
auto fcnZ = hydra::make_loglikehood_fcn(modelZ, dataZ);
259+
auto fcnV = hydra::make_loglikehood_fcn(modelv, datav);
260+
261+
auto sim_fcn1 = hydra::make_simultaneous_fcn(fcnx, fcny);
262+
auto sim_fcn2 = hydra::make_simultaneous_fcn(fcnw, fcnz);
263+
auto sim_fcn = hydra::make_simultaneous_fcn(sim_fcn1, sim_fcn2, fcnV);
264+
...
265+
}
266+
```
267+
Moreover, the generic interface allows to build up a simultaneous FCN object by composing usual FCNs and simultaneous FCNs. An example of such new method can be found in `examples/fit/simultaneous_fit.inl`.
268+
169269
2. Fitting of convoluted PDFs.
170270

171271
#### General

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SET(CMAKE_VERBOSE_MAKEFILE ON)
1818
#check if compiler is C++14 compliant
1919
include(CheckCXXCompilerFlag)
2020
CHECK_CXX_COMPILER_FLAG("--std=c++14" COMPILER_SUPPORTS_CXX14)
21-
if(NOT COMPILER_SUPPORTS_CXX11)
21+
if(NOT COMPILER_SUPPORTS_CXX14)
2222
message(FATAL "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
2323
endif()
2424

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#PROJECT_NAME = "Hydra_examples_and_documentation"
2-
PROJECT_NUMBER = 3.0.0
2+
PROJECT_NUMBER = 3.2.2
33

44
STRIP_FROM_PATH = /home/augalves/Development/Release/Hydra
55

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1206261.svg)](https://doi.org/10.5281/zenodo.1206261)
2+
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
23
[![Documentation Status](https://readthedocs.org/projects/hydra-documentation/badge/?version=latest)](http://hydra-documentation.readthedocs.io/en/latest/?badge=latest)
34
[![latest version](https://badge.fury.io/gh/MultithreadCorner%2FHydra.svg)](https://github.com/MultithreadCorner/Hydra/releases/latest)
45

docs/conf.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@
3030
# Add any Sphinx extension module names here, as strings. They can be
3131
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3232
# ones.
33+
import sphinx_rtd_theme
34+
3335
extensions = ['sphinx.ext.autodoc',
3436
'sphinx.ext.todo',
3537
'sphinx.ext.mathjax',
36-
'sphinxcontrib.bibtex']
38+
'sphinxcontrib.bibtex',
39+
#'sphinxcontrib.fulltoc',
40+
"sphinx_rtd_theme"]
3741

3842

3943
# Add any paths that contain templates here, relative to this directory.
@@ -50,17 +54,17 @@
5054

5155
# General information about the project.
5256
project = u'Hydra'
53-
copyright = u'2017, Antonio Augusto Alves Junior'
57+
copyright = u'2016-2020, Antonio Augusto Alves Junior'
5458
author = u'Antonio Augusto Alves Junior'
5559

5660
# The version info for the project you're documenting, acts as replacement for
5761
# |version| and |release|, also used in various other places throughout the
5862
# built documents.
5963
#
6064
# The short X.Y version.
61-
version = u'2.0'
65+
version = u'3.X.Y'
6266
# The full version, including alpha/beta/rc tags.
63-
release = u'2.0'
67+
release = u'3.X.Y'
6468

6569
# The language for content autogenerated by Sphinx. Refer to documentation
6670
# for a list of supported languages.
@@ -86,14 +90,28 @@
8690
# The theme to use for HTML and HTML Help pages. See the documentation for
8791
# a list of builtin themes.
8892
#
89-
html_theme = 'classic'
93+
html_theme = "sphinx_rtd_theme"#'classic'
94+
#html_theme_options = {
95+
# "relbarbgcolor": "black",
96+
# "sidebarbgcolor":"lavender",
97+
# "sidebartextcolor": "black",
98+
# "sidebarlinkcolor": "brown"
99+
#}
90100
html_theme_options = {
91-
"relbarbgcolor": "black",
92-
"sidebarbgcolor":"lavender",
93-
"sidebartextcolor": "black",
94-
"sidebarlinkcolor": "brown"
101+
'canonical_url': '',
102+
'logo_only': False,
103+
'display_version': True,
104+
'prev_next_buttons_location': 'bottom',
105+
'style_external_links': False,
106+
'vcs_pageview_mode': '',
107+
'style_nav_header_background': 'white',
108+
# Toc options
109+
'collapse_navigation': True,
110+
'sticky_navigation': True,
111+
'navigation_depth': 4,
112+
'includehidden': True,
113+
'titles_only': False
95114
}
96-
97115
# Theme options are theme-specific and customize the look and feel of a theme
98116
# further. For a list of options available for each theme, see the
99117
# documentation.

docs/containers.rst

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
Containers
22
==========
33

4-
Hydra framework provides one dimensional STL-like vector containers for each supported back-end, aliasing the underlying Thrust types. Beyond this, Hydra implements two native multidimensional containers: ``hydra::multivector`` and ``hydra::multiarray`` .
5-
In these containers, the data corresponding to each dimension is stored in contiguous memory regions and when the container is traversed, each entry is accessed as
6-
a ``hydra::tuple``, where each field holds a value corresponding to a dimension. Both classes implement an interface completely compliant with a STL vector and
7-
also provides constant and non-constant accessors for the single dimensional data. The container
8-
``hydra::multivector`` is suitable to store data-sets where the dimensions are represented by entries with different POD types. ``hydra::multiarray`` is designed to store data-sets where all dimensions are represented by fields with the same type. Data is always copyable across different back-ends and movable between containers on the same back-end.
9-
10-
4+
Hydra framework provides an one-dimensional STL-like vector container for each supported back-end, aliasing the underlying Thrust types. The framework also implements two native multidimensional containers called hydra::multivector`` and ``hydra::multiarray`` .
5+
6+
In these containers, the data corresponding to each dimension is stored in contiguous memory addresses that can be traversed in a CPU/GPU cache friendly way, independently of the other dimensions. In the case of multidimensional containers, when the data is traversed each entry is accessed as
7+
a ``hydra::tuple`` object, where each field holds a value corresponding to a dimension.
8+
119
One-dimensional containers
1210
--------------------------
1311

14-
Hydra's one-dimensional containers are aliases to the corresponding [Thrust]_ vectors and defined for each supported back-end. They are:
12+
Hydra's one-dimensional containers are aliases to the corresponding [Thrust]_ vectors and are defined for each supported back-end. They are:
1513

16-
1. ``hydra::device::vector`` : storage allocated in the device back-end defined at compile time using the macro ``THRUST_DEVICE_SYSTEM``
17-
2. ``hydra::host::vector`` : storage allocated in the device back-end defined at compile time using the macro ``THRUST_HOST_SYSTEM``
14+
1. ``hydra::device::vector`` : storage allocated in the device back-end defined at compile time using the macro ``HYDRA_DEVICE_SYSTEM``
15+
2. ``hydra::host::vector`` : storage allocated in the device back-end defined at compile time using the macro ``HYDRA_HOST_SYSTEM``
1816
3. ``hydra::omp::vector`` : storage allocated in the [OpenMP]_ back-end. Usually the CPU memory space.
1917
4. ``hydra::tbb::vector`` : storage allocated in the [TBB]_ back-end. Usually the CPU memory space.
2018
5. ``hydra::cuda::vector`` : storage allocated in the [CUDA]_ back-end. The GPU memory space.
2119
6. ``hydra::cpp::vector`` : storage allocated in the [CPP]_ back-end. Usually the CPU memory
2220

23-
The usage of these containers is extensively documented in the [Thrust]_ library.
21+
The usage of these containers is extensively documented in STL and [Thrust]_ library. Hydra also implements range-semantics for many of these containers.
2422

2523
Multi-dimensional containers
2624
----------------------------
2725

2826
Hydra implements two multidimensional containers:``hydra::multivector`` and ``hydra::multiarray``.
2927
These containers store data using [SoA]_ layout and provides a STL-vector compliant interface.
3028

31-
The best way to understand how these containers operates is to visualize them as a table, there each row corresponds to a entry and each column to a dimension. The design of ``hydra::multivector`` and ``hydra::multiarray`` makes possible to iterate over the container to access a complete row
32-
or to iterate over one or more columns to access only the data of interest in a given entry, without to load the entire row.
29+
Both classes provides constant and non-constant accessors for the single dimensional data. The container
30+
``hydra::multivector`` is suitable to store data-sets where the dimensions are represented by entries with different POD types. ``hydra::multiarray`` is designed to store data-sets where all dimensions are represented by fields of the same type. Data is always copyable across different back-ends and movable between containers on the same back-end.
31+
32+
The best way to understand how these containers operate is to visualize them as a table, there each row corresponds to a entry and each column to a dimension. The design of ``hydra::multivector`` and ``hydra::multiarray`` makes possible to iterate over the container to access a complete row
33+
or to iterate over one or more columns to access only the data of interest in a given entry, without loading the entire row.
3334

34-
When the user iterates over the whole container, each entry (row) is returned as a ``hydra::tuple``. If the user iterates over one single column, the entries have the type of the column. If two or more columns are accessed, entry's data is returned as again as ``hydra::tuple`` containing only the elements of interest. Hydra's multi-dimensional containers can hold any type of data per dimension, but there is not real gain using these containers for describing dimensions with non-POD data.
35+
When the user iterates over the whole container, each entry (row) is returned as a ``hydra::tuple``. If the user iterates over one single column, the entries have the type of the column. If two or more columns are accessed, entry's data is returned as again as ``hydra::tuple`` containing only the elements of interest. Hydra's multi-dimensional containers can hold any type of data per dimension, but there is not real gain using these containers for describing dimensions with non-POD or non alignable data.
3536

36-
Both containers can store the state of arbitrary objects and perform type conversions on-the-fly, using suitable overloaded iterators and ``push_back()`` methods.
37+
These containers can store the state of arbitrary objects and perform type conversions on-the-fly, using suitable overloaded iterators and ``push_back()`` methods.
3738

3839

3940
``hydra::multivector``
@@ -70,7 +71,7 @@ this will print in stdout something like it :
7071
...
7172
(9, 18, 9.0, 18.0)
7273
73-
To access the columns the user needs to deploy ``hydra::placeholders``: _0, _1, _2,...,_99;
74+
To access the columns the user needs ``hydra::placeholders``: _0, _1, _2,..., _99;
7475

7576
.. code-block:: cpp
7677
:name: multivector-example2
@@ -90,7 +91,8 @@ To access the columns the user needs to deploy ``hydra::placeholders``: _0, _1,
9091
}
9192
9293
for(auto x = mvector.begin(_1, _3);
93-
x != mvector.end(_1, _3); x++ )
94+
x != mvector.end(_1, _3); ++x )
95+
9496
std::cout << *x << std::endl;
9597
9698
now in stdout the user will get:
@@ -120,13 +122,13 @@ It is not necessary to access each field stored in each entry to perform a conve
120122
mvector.push_back(hydra::make_tuple( i, 2*i, i, 2*i));
121123
}
122124
123-
auto caster = [] __host__ device__ (hydra::tuple<int, int, double, double>& entry )
125+
auto caster = [] __host__ device__ ( hydra::tuple<int, int, double, double>& entry )
124126
{
125127
126-
hydra::complex<int> c_int(hydra::get<0>(entry), hydra::get<1>(entry));
127-
hydra::complex<double> c_double(hydra::get<2>(entry), hydra::get<2>(entry));
128+
hydra::complex<int> cint(hydra::get<0>(entry), hydra::get<1>(entry));
129+
hydra::complex<double> cdouble(hydra::get<2>(entry), hydra::get<2>(entry));
128130
129-
return hydra::make_pair( c_int, c_double );
131+
return hydra::make_pair( cint, cdouble );
130132
};
131133
132134
for(auto x = mvector.begin(caster); x != mvector.end(caster); x++ )
@@ -142,9 +144,11 @@ stdout will look like:
142144
...
143145
((9, 18), (9.0, 18.0))
144146
147+
Same effect can be
148+
145149

146150
``hydra::multiarray``
147-
......................
151+
.................
148152

149153

150154
``hydra::multiarray`` templates are instantiated passing the type and the number of dimensions via and the back-end where memory will be allocated. The snippet

docs/fit_and_splot.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ to build a extended model, which can be used to predict the yields:
131131
132132
The user can get a reference to one of the component PDFs using the method ``PDF( hydra::placeholder )``.
133133
This is useful, for example, to change the state of a component PDF "in place". Same operation can
134-
be performed for coeficients using the method ``Coeficient( unsigned int )`` :
134+
be performed for coeficients using the method ``Coefficient( unsigned int )`` :
135135

136136
.. code-block:: cpp
137137
@@ -145,7 +145,7 @@ be performed for coeficients using the method ``Coeficient( unsigned int )`` :
145145
model.PDF( _0 ).SetParameter(0, 2.0);
146146
147147
//set Gaussian coeficient to 1.5e4
148-
model.Coeficient(0).SetValue(1.5e4);
148+
model.Coefficient(0).SetValue(1.5e4);
149149
150150
151151

0 commit comments

Comments
 (0)