Skip to content

Commit 5821dd4

Browse files
authored
Merge pull request #78 from MultithreadCorner/update-eigen-dev
Hydra: new Eigen interface, update built-in Thrust and CUB, adding `hydra::sobol` and other algos.
2 parents 2f3242d + 346c243 commit 5821dd4

File tree

2,011 files changed

+114674
-226732
lines changed

Some content is hidden

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

2,011 files changed

+114674
-226732
lines changed

CHANGELOG.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
## CHANGE LOG
22

3-
### Hydra 2.4.1 (probably incomplete)
43

5-
1. The main change is this relase 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
6-
2. Range semantics implemented in `Decays::Unweight` methods
7-
3. Fix CLANG discovery on Apple platform (not ufficialy supported yet btw)
4+
###Hydra 2.5.0
5+
6+
1. **Eigen** is not being distributed with **Hydra** anymore. **Eigen** will remain an dependency for foreseeable future.
7+
2. New facility to update **Thrust** and **CUB**. New namespaces ```hydra::hydra_thrust``` and ```hydra::hydra_cub``` defined.
8+
3. New lazy implementation of ```hydra::Splot```.
9+
4. New ```hydra::PhaseSpace``` interface, with constructors taking the mass of the mother particle as well. Ctors also protected against inconsistent arguments via exception throwing.
10+
5. New algorithm ```hydra::sobol``` support up to 3667 dimensions
11+
6. Re-implementation of the impacted examples.
12+
7. Many bug fixes across the tree...
13+
14+
###Hydra 2.4.1 (probably incomplete)
15+
16+
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
17+
2. Range semantics implemented in Decays::Unweight methods
18+
3. Fix CLANG discovery on Apple platform (not officially supported yet)
819
4. Many bug fixes across the tree...
920

10-
### Hydra 2.3.1
21+
### Hydra 2.3.1 (probably incomplete)
1122

1223
1. Interfaces to FFTW and CuFFT for performing 1D real-real complex-real and real-complex FFT on CPU and GPU
1324
2. FFT based convolution on CPU and GPU for arbitrary pair of functors: `hydra::convolute` and `hydra::ConvolutionFunctor`

CMakeLists.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif()
2626
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
2727

2828
MESSAGE(STATUS "Setting Clang flags")
29-
set(CMAKE_CXX_FLAGS " --std=c++11 -W -march=native -fPIC -O3 -ldl" CACHE STRING "compile flags" FORCE)
29+
set(CMAKE_CXX_FLAGS " --std=c++11 -W -march=native -fPIC -O4 -ldl" CACHE STRING "compile flags" FORCE)
3030

3131
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
3232

@@ -37,9 +37,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
3737

3838
MESSAGE(STATUS "Setting ICC flags")
3939
set(CMAKE_CXX_FLAGS " --std=c++11 -W -march=native -fPIC -O4 -ldl" CACHE STRING "compile flags" FORCE)
40-
41-
#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
42-
#MESSAGE(STATUS "===> Compiling with MSVC")
4340
endif()
4441

4542
#-----------------------
@@ -68,14 +65,22 @@ endif()
6865
endif(ROOT_FOUND)
6966

7067
#-----------------------
71-
# get GSL
68+
# get GSL for convolution examples
7269
find_package(GSL)
7370
if(GSL_FOUND)
7471
include_directories(${GSL_INCLUDE_DIRS})
7572
endif(GSL_FOUND)
7673

7774
#-----------------------
78-
# get FFTW
75+
# get Eigen for sPlot examples
76+
find_package( Eigen3 3.3.7 REQUIRED )
77+
include_directories( EIGEN3_INCLUDE_DIR )
78+
if(EIGEN3_FOUND)
79+
include_directories(${EIGEN3_INCLUDE_DIR})
80+
endif(EIGEN3_FOUND)
81+
82+
#-----------------------
83+
# get FFTW for convolution examples
7984
find_package(FFTW)
8085
if(FFTW_FOUND)
8186
include_directories(${FFTW_INCLUDE_DIRS})
@@ -88,8 +93,8 @@ if(CUDA_FOUND)
8893
link_directories( ${CUDA_TOOLKIT_ROOT_DIR}/lib64/)
8994

9095
#set cuda flags
91-
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -ftemplate-backtrace-limit=0; --cudart; static; -O4; --expt-relaxed-constexpr; -fmad=true; --expt-extended-lambda;--relocatable-device-code=false ;
92-
-Xptxas -dlcm=ca; -Xptxas --opt-level=4 )
96+
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -ftemplate-backtrace-limit=0; --cudart; static; -O4 ; --expt-relaxed-constexpr; -fmad=true; --expt-extended-lambda;--relocatable-device-code=false;
97+
-Xptxas -dlcm=ca;-Xptxas --opt-level=4 )
9398

9499
SET(CUDA_PROPAGATE_HOST_FLAGS ON)
95100
SET(CUDA_SEPARABLE_COMPILATION OFF)

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 = 2.3.2
2+
PROJECT_NUMBER = 2.4.0
33

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

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Currently Hydra supports:
5151
* Object-based interface to FFTW and CuFFT for performing Fast Fourier Transform in CPU and GPU.
5252
* FFT based one-dimensional convolution for arbitrary signal and kernel shapes.
5353
* Booststrap and real cubic spiline for datasets on CPU and GPU.
54+
* Sobol low discrepance sequences up to
5455

5556
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.
5657

@@ -68,9 +69,9 @@ Hydra and Thrust
6869
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.
6970
The official version of Thrust supports tuples with maximum ten elements. In order to overcome this limitation, Hydra uses the
7071
[unofficial version, forked from the original, by Andrew Currigan and collaborators](https://github.com/andrewcorrigan/thrust-multi-permutation-iterator).
71-
This version implements variadic tuples and related classes, as well as provides some additional functionalities, which are missing in the official Thrust.
72+
This version implements variadic tuples and related classes, as well as provides some additional functionality, which are missing in the official Thrust.
7273

73-
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.8.3).
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).
7475

7576
***Hydra does not depend or conflict with the official Thrust library distributed with the CUDA-SDK.***
7677

cmake/FindEigen3.cmake

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# - Try to find Eigen3 lib
2+
#
3+
# This module supports requiring a minimum version, e.g. you can do
4+
# find_package(Eigen3 3.1.2)
5+
# to require version 3.1.2 or newer of Eigen3.
6+
#
7+
# Once done this will define
8+
#
9+
# EIGEN3_FOUND - system has eigen lib with correct version
10+
# EIGEN3_INCLUDE_DIR - the eigen include directory
11+
# EIGEN3_VERSION - eigen version
12+
#
13+
# and the following imported target:
14+
#
15+
# Eigen3::Eigen - The header-only Eigen library
16+
#
17+
# This module reads hints about search locations from
18+
# the following environment variables:
19+
#
20+
# EIGEN3_ROOT
21+
# EIGEN3_ROOT_DIR
22+
23+
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
24+
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
25+
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
26+
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
27+
28+
if(NOT Eigen3_FIND_VERSION)
29+
if(NOT Eigen3_FIND_VERSION_MAJOR)
30+
set(Eigen3_FIND_VERSION_MAJOR 2)
31+
endif()
32+
if(NOT Eigen3_FIND_VERSION_MINOR)
33+
set(Eigen3_FIND_VERSION_MINOR 91)
34+
endif()
35+
if(NOT Eigen3_FIND_VERSION_PATCH)
36+
set(Eigen3_FIND_VERSION_PATCH 0)
37+
endif()
38+
39+
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
40+
endif()
41+
42+
macro(_eigen3_check_version)
43+
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
44+
45+
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
46+
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
47+
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
48+
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
49+
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
50+
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
51+
52+
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
53+
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
54+
set(EIGEN3_VERSION_OK FALSE)
55+
else()
56+
set(EIGEN3_VERSION_OK TRUE)
57+
endif()
58+
59+
if(NOT EIGEN3_VERSION_OK)
60+
61+
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
62+
"but at least version ${Eigen3_FIND_VERSION} is required")
63+
endif()
64+
endmacro()
65+
66+
if (EIGEN3_INCLUDE_DIR)
67+
68+
# in cache already
69+
_eigen3_check_version()
70+
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
71+
set(Eigen3_FOUND ${EIGEN3_VERSION_OK})
72+
73+
else ()
74+
75+
# search first if an Eigen3Config.cmake is available in the system,
76+
# if successful this would set EIGEN3_INCLUDE_DIR and the rest of
77+
# the script will work as usual
78+
find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)
79+
80+
if(NOT EIGEN3_INCLUDE_DIR)
81+
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
82+
HINTS
83+
ENV EIGEN3_ROOT
84+
ENV EIGEN3_ROOT_DIR
85+
PATHS
86+
${CMAKE_INSTALL_PREFIX}/include
87+
${KDE4_INCLUDE_DIR}
88+
PATH_SUFFIXES eigen3 eigen
89+
)
90+
endif()
91+
92+
if(EIGEN3_INCLUDE_DIR)
93+
_eigen3_check_version()
94+
endif()
95+
96+
include(FindPackageHandleStandardArgs)
97+
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
98+
99+
mark_as_advanced(EIGEN3_INCLUDE_DIR)
100+
101+
endif()
102+
103+
if(EIGEN3_FOUND AND NOT TARGET Eigen3::Eigen)
104+
add_library(Eigen3::Eigen INTERFACE IMPORTED)
105+
set_target_properties(Eigen3::Eigen PROPERTIES
106+
INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}")
107+
endif()

examples/convolution/fit_convoluted_pdfs.inl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ int main(int argv, char** argc)
202202
hydra::DenseHistogram<double, 1, hydra::device::sys_t> Hist_Data(nbins, min, max);
203203
Hist_Data.Fill( range.begin(), range.end() );
204204

205+
typedef decltype(Hist_Data) Iterable;
206+
207+
/*
208+
static_assert( (!(
209+
(hydra::detail::is_iterator<Iterable>::value)||
210+
( (0>0) && hydra::detail::are_iterators<>::value))) &&
211+
(!hydra::detail::is_hydra_dense_histogram<Iterable>::value) &&
212+
(!hydra::detail::is_hydra_sparse_histogram<Iterable>::value) &&
213+
hydra:: detail::is_iterable<Iterable>::value && hydra::detail::are_iterables<>::value ,"<<<<<<<<<<< " );
214+
*/
205215
//make model and fcn
206216
auto fcn = hydra::make_loglikehood_fcn( model, Hist_Data);
207217

examples/fit/basic_fit.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ int main(int argv, char** argc)
160160
for(size_t i=0; i<10; i++)
161161
std::cout << "[" << i << "] :" << range[i] << std::endl;
162162

163+
//static_assert(hydra::detail::is_iterable<decltype(range)>::value, "<<<<<<<<<<<<<<");
163164
auto fcn = hydra::make_loglikehood_fcn(model, range);
164165

165166
//-------------------------------------------------------

examples/fit/binned_extended_logLL_fit.inl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ int main(int argv, char** argc)
120120
//===========================
121121
//fit model
122122

123-
hydra::Parameter mean1_p = hydra::Parameter::Create().Name("Mean_1").Value( 2.5) .Error(0.0001).Limits(0.0, 10.0);
123+
hydra::Parameter mean1_p = hydra::Parameter::Create().Name("Mean_1").Value( 2.5) .Error(0.0001).Limits(1.0, 10.0);
124124
hydra::Parameter sigma1_p = hydra::Parameter::Create().Name("Sigma_1").Value(0.5).Error(0.0001).Limits(0.01, 1.5);
125125

126126
//gaussian function evaluating on the first argument
@@ -130,7 +130,7 @@ int main(int argv, char** argc)
130130
//-------------------------------------------
131131

132132
//gaussian 2
133-
hydra::Parameter mean2_p = hydra::Parameter::Create().Name("Mean_2").Value(5.0) .Error(0.0001).Limits(0.0, 10.0);
133+
hydra::Parameter mean2_p = hydra::Parameter::Create().Name("Mean_2").Value(5.0) .Error(0.0001).Limits(1.0, 10.0);
134134
hydra::Parameter sigma2_p = hydra::Parameter::Create().Name("Sigma_2").Value(0.5).Error(0.0001).Limits(0.01, 1.5);
135135

136136
//gaussian function evaluating on the first argument
@@ -141,7 +141,7 @@ int main(int argv, char** argc)
141141

142142
//exponential
143143
//parameters
144-
hydra::Parameter tau_p = hydra::Parameter::Create().Name("Tau").Value(1.0) .Error(0.0001).Limits(-2.0, 2.0);
144+
hydra::Parameter tau_p = hydra::Parameter::Create().Name("Tau").Value(-1.0) .Error(0.0001).Limits(-2.0, 2.0);
145145

146146
//gaussian function evaluating on the first argument
147147
hydra::Exponential<0> exponential(tau_p);
@@ -184,7 +184,7 @@ int main(int argv, char** argc)
184184
Generator.Gauss(mean2_p.GetValue()+0.5, sigma2_p.GetValue()+0.5, data_d.begin()+nentries, data_d.begin()+2*nentries);
185185

186186
// exponential
187-
Generator.Exp(tau_p.GetValue()+0.5, data_d.begin() + 2*nentries, data_d.end());
187+
Generator.Exp(1.0, data_d.begin() + 2*nentries, data_d.end());
188188

189189
std::cout<< std::endl<< "Generated data:"<< std::endl;
190190
for(size_t i=0; i<10; i++)
@@ -211,7 +211,7 @@ int main(int argv, char** argc)
211211
// ... Minimize and profile the time
212212

213213
auto start_d = std::chrono::high_resolution_clock::now();
214-
FunctionMinimum minimum_d = FunctionMinimum(migrad_d(std::numeric_limits<unsigned int>::max(), 5));
214+
FunctionMinimum minimum_d = FunctionMinimum(migrad_d(std::numeric_limits<unsigned int>::max(), 1));
215215
auto end_d = std::chrono::high_resolution_clock::now();
216216
std::chrono::duration<double, std::milli> elapsed_d = end_d - start_d;
217217

examples/fit/phsp_unweighting_functor_and_fit.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int main(int argv, char** argc)
179179
hydra::Vector4R B0(B0_mass, 0.0, 0.0, 0.0);
180180

181181
// Create PhaseSpace object for B0-> K pi J/psi
182-
hydra::PhaseSpace<3> phsp({Jpsi_mass, K_mass, pi_mass });
182+
hydra::PhaseSpace<3> phsp(B0_mass,{Jpsi_mass, K_mass, pi_mass });
183183

184184
// functor to calculate the 2-body masses
185185
auto dalitz_calculator = hydra::wrap_lambda(

0 commit comments

Comments
 (0)