MUSIC unknown
Analysis for the MUSIC active-target ionization chamber
Loading...
Searching...
No Matches

Runtime access to the CUDA timestamp-sort kernel. More...

#include <GpuAccel.hpp>

Public Types

typedef int(* SortFunc) (void *, long long)
 Signature of the sort entry point: buffer, element count, status.

Static Public Member Functions

static Bool_t Init ()
 Load the GPU library and resolve the sort symbol.
static Bool_t Available ()
 Whether the kernel loaded successfully.
static SortFunc GetSort ()
 The resolved sort entry point.
static Bool_t TryAcquireSortSlot ()
 Claim one of the concurrent GPU sort slots.
static void ReleaseSortSlot ()
 Give back a slot claimed by TryAcquireSortSlot().

Detailed Description

Runtime access to the CUDA timestamp-sort kernel.

The kernel lives in libgpuaccel.so, built from tooling/gpu/ and loaded with dlopen at first use rather than linked. That keeps the tooling runnable on a machine with no CUDA runtime: if the library or its symbol is missing, every entry point here degrades to reporting unavailable and the caller takes the CPU path.

All state is process-global and initialised once.

Definition at line 21 of file GpuAccel.hpp.

Member Typedef Documentation

◆ SortFunc

typedef int(* GpuAccel::SortFunc) (void *, long long)

Signature of the sort entry point: buffer, element count, status.

Definition at line 24 of file GpuAccel.hpp.

Member Function Documentation

◆ Available()

Bool_t GpuAccel::Available ( )
static

Whether the kernel loaded successfully.

Returns
kFALSE before Init() has run, and whenever the load failed.

Definition at line 41 of file GpuAccel.cpp.

Referenced by Timing::SortHitsByTimestamp().

◆ GetSort()

GpuAccel::SortFunc GpuAccel::GetSort ( )
static

The resolved sort entry point.

Returns
The function pointer, or null if unavailable. Check Available() rather than testing this.

Definition at line 43 of file GpuAccel.cpp.

Referenced by Timing::SortHitsByTimestamp().

◆ Init()

Bool_t GpuAccel::Init ( )
static

Load the GPU library and resolve the sort symbol.

Idempotent.

Does nothing and reports unavailable when Constants::cfg.USE_GPU_ACCELERATION is off. The library path is baked in at build time by the Makefile, falling back to a bare libgpuaccel.so resolved through LD_LIBRARY_PATH.

Returns
kTRUE if the kernel is usable. Repeat calls return the first result without retrying the load.
Note
Diagnostics go to stdout on success and stderr on failure; a failed load is reported, not raised.

Definition at line 9 of file GpuAccel.cpp.

Referenced by Pipeline::Run().

◆ ReleaseSortSlot()

void GpuAccel::ReleaseSortSlot ( )
static

Give back a slot claimed by TryAcquireSortSlot().

Warning
Call exactly once per successful acquire. It is not guarded against an unmatched call, which would let the cap drift upward.

Definition at line 53 of file GpuAccel.cpp.

Referenced by Timing::SortHitsByTimestamp().

◆ TryAcquireSortSlot()

Bool_t GpuAccel::TryAcquireSortSlot ( )
static

Claim one of the concurrent GPU sort slots.

The pipeline processes subfiles in parallel, so without a cap they would all dispatch to the GPU at once and exhaust device memory. Constants::cfg.MAX_GPU_CONCURRENT_SORTS bounds how many may be in flight.

Returns
kTRUE if a slot was taken, in which case the caller must pair it with ReleaseSortSlot(). kFALSE if all slots are busy, in which case the caller should take the CPU path rather than wait.
Warning
Non-blocking, and not RAII. An early return between acquire and release leaks a slot for the lifetime of the process.

Definition at line 45 of file GpuAccel.cpp.

Referenced by Timing::SortHitsByTimestamp().


The documentation for this class was generated from the following files: