Installing ROOT with CUDA support in a Conda environment

I have updated the instructions now.

To try it out:

  • Build the content of roofit/batchcompute in the ROOT repository, replacing the CMakeLists.txt file with the code listing below:
  • Build the project. You should now have a libRooBatchCompute_CUDA.so file. Make sure it’s in the LD_LIBRARY_PATH
  • Your fits should now work with EvalBackend("cuda") (see also the RooAbsPdf documentation about this)
# Adapt to your system
set (CMAKE_CUDA_ARCHITECTURES "native" CACHE STRING "" FORCE)
set (CMAKE_CUDA_HOST_COMPILER /usr/bin/g++-13 CACHE STRING "" FORCE)
set (CMAKE_CUDA_COMPILER "/opt/cuda/bin/nvcc" CACHE STRING "" FORCE)

find_package(ROOT REQUIRED)
include(${ROOT_USE_FILE})

cmake_minimum_required(VERSION 3.14)
project(batchcompute-cuda LANGUAGES CUDA)

# in the src directory, put all files from roofit/batchcompute/src and roofit/batchcompute/res
add_library(RooBatchCompute_CUDA SHARED src/RooBatchCompute.cu src/ComputeFunctions.cu src/CudaInterface.cu)
target_include_directories(RooBatchCompute_CUDA PRIVATE src res)

target_compile_options(RooBatchCompute_CUDA  PRIVATE -lineinfo --expt-relaxed-constexpr)