Hydra
4.0.1
A header-only templated C++ framework to perform data analysis on massively parallel platforms.
|
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.
The core algorithms follow as close as possible the implementations widely used in frameworks like ROOT and libraries like GSL.
Currently Hydra supports:
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.
For example, just changing .cu to .cpp in any source code written only using the Hydra and standard C++14 is enough to compile your application for OpenMP or TBB compatible devices using GCC or other compiler in a machine without a NVIDIA GPU installed.
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.
Hydra is implemented on top of the Thrust library and relies strongly on Thrust's containers, algorithms and backend management systems. The official version of Thrust supports tuples with maximum ten elements. In order to overcome this limitation, Hydra uses an unofficial version, forked from the original, by Andrew Currigan and collaborators. This version implements variadic tuples and related classes, as well as provides some additional functionality, which are missing in the official Thrust.
In order to keep Hydra uptodated with the latest bug-fixes and architetural improvements in Thrust, at each Hydra release, the official Thrust library is patched with the Currigan's variadic tuple implementation.
So, version of Thrust distributed with Hydra is maintained by 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).
Hydra does not depend or conflict with the official Thrust library distributed with the CUDA-SDK.
Hydra uses the underlying Thrust's "backend systems" to control how the algorithms get mapped to and executed on the parallel processors and accelerators available to a given application. When necessary, the backends can be specified using the symbols hydra::device::sys_t, hydra::host::sys_t, hydra::omp::sys_t, hydra::tbb::sys_t, hydra::cuda::sys_t, hydra::cpp::sys_t. The backends hydra::device::sys_t and hydra::host::sys_t are selected in compile time using the macros HYDRA_HOST_SYSTEM
and HYDRA_DEVICE_SYSTEM
. The following possibilities are available:
For example, this will compile my_program.cu
using OpenMP as host backend and CUDA as device backend using the NVidia's compiler nvcc
:
The available "host" and "device" backends can be freely combined. Two important features related to Hydra's design and the backend configuration:
The latest release can be downloaded here.
The complete and updated Doxygen source code documentation in HTML format is available at the Reference documentation web-page. It is also possible to browse the documentation by class, file or name using the links:
1.classes
2.files
3.names
The Hydra User's Guide is available in the following formats:
Hydra is a header only library, so no build process is necessary to install it. Just place the hydra
folder and its contents where your system can find it. 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.
A suite of examples demonstrating the basic features of the framework is included in the examples
folder. All the examples are organized in .inl files, which implements the main()
function. These files are included by .cpp and .cu files, which are compiled according with the availability of backends. TBB and CUDA backends requires the installation of the corresponding libraries and runtimes. These code samples uses, but does not requires ROOT for graphics, and TCLAP library for process command line arguments. Some functionality in Hydra requires Eigen, GSL, CuFFT and FFTW.
The examples are built using CMAKE with the following instructions:
git clone https://github.com/MultithreadCorner/Hydra.git
cd Hydra
mkdir build
cd build
cmake ..
make
The compiled examples will be placed in the build/examples folder. The sub-directories are named according to the functionalities they illustrate.
The examples are listed below:
Each compiled example executable will have an postfix (ex.:_cpp, _cuda, _omp, _tbb) to indicate the deployed device backend.
All examples use CPP as host backend.
[1]Alves Junior, A.A. - MultithreadCorner/Hydra, (2018). doi:10.5281/zenodo.1206261
bibtex:
Hydra is released under the GNU General Public License version 3. Please see the file called COPYING.
Here’s what you should do if you need help or would like to contribute:
Hydra was created and is maintained by Antonio Augusto Alves Jr.
Initial Hydra's development was supported by the National Science Foundation under the grant number PHY-1414736. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the developers and do not necessarily reflect the views of the National Science Foundation.