PixelHistogramCUDA_<input>_<storage> for uint16, float32 and float64 frames and the six storage types of PixelHistogram, behind an aare.PixelHistogramCUDA() factory. Frames are never converted: a wrong dtype raises TypeError, so a registered buffer is always the one copied. The GIL is released during GPU work. - C++: fill_histogram() and submit_batch() take const views, so read-only arrays (np.memmap mode="r") work; register_output_buffer() pins the destination of values(out). - Python: register_input_buffer()/register_output_buffer() keep their array alive; values(out=...) writes into a given array. With a pinned out, reading back a 640 MB histogram takes 28 ms instead of 230 ms. - Tests in test_PixelHistogramCUDA.py; PixelHistogramCUDA.ipynb compares CPU and GPU on 100k Moench frames (identical, ~13x faster on the GPU).
aare
Data analysis library for PSI hybrid detectors
Documentation
Detailed documentation including installation can be found in Documentation
License
This project is licensed under the MPL-2.0 license. See the LICENSE file or https://www.mozilla.org/en-US/MPL/ for details.
Two files contain code from other projects and keep their original licenses:
include/aare/ProducerConsumerQueue.hppis Apache-2.0, from folly by Meta Platforms.src/NumpyHelpers.cppis MIT, from libnpy by Leon Merten Lohse.
The full license texts are in the LICENSES directory.
The Python wheels and conda packages also contain Minuit2
(LGPL-2.1-or-later), {fmt} and nlohmann/json (MIT), and pybind11
(BSD-3-Clause), which CMake downloads at build time. See
THIRD-PARTY-NOTICES.txt for their notices.
Build and install
Prerequisites
- cmake >= 3.14
- C++17 compiler (gcc >= 8)
- python >= 3.10
Development install (for Python)
git clone git@github.com:slsdetectorgroup/aare.git --branch=v1 #or using http...
mkdir build
cd build
#configure using cmake
cmake ../aare -DAARE_PYTHON_BINDINGS=ON
#build (replace 4 with the number of threads you want to use)
make -j4
Now you can use the Python module from your build directory
import aare
f = aare.File('Some/File/I/Want_to_open_master_0.json')
To run from other folders either add the path to your conda environment using conda-build or add the module to your PYTHONPATH
export PYTHONPATH=path_to_aare/aare/build:$PYTHONPATH
Install using conda/mamba
#enable your env first!
conda install aare -c slsdetectorgroup # installs latest version
Install to a custom location and use in your project
Working example in: https://github.com/slsdetectorgroup/aare-examples
#build and install aare
git clone git@github.com:slsdetectorgroup/aare.git --branch=v1 #or using http...
mkdir build
cd build
#configure using cmake
cmake ../aare -DCMAKE_INSTALL_PREFIX=/where/to/put/aare
#build (replace 4 with the number of threads you want to use)
make -j4
#install
make install
#Now configure your project
cmake .. -DCMAKE_PREFIX_PATH=SOME_PATH
Local build of conda pkgs
conda build . --variants="{python: [3.11, 3.12, 3.13]}"
Developer's guide
We are looking forward to your contributions via pull requests!
If you want to fix an existing bug or propose a new feature:
- Install
pre-commitpython package and setup itpre-commit install - Create a new branch with
git branch branch_name - Implement your changes and make a commit (
pre-commitwill check your code automatically) - Push your commit and open a pull request if needed