Algorithms
All the algorithms implemented in DKS are defined in src/Algorithms using abstract base classes, which are then implemented using CUDA, OpenCL and OpenMP (for Intel MIC). The defined abstract classes are:
- BaseFFT - contains all the methods to offload FFT execution on the device. Is implemented in CUDA (cuFFT library), OpenCL (clFFT library) and OpenMP (Intel MKL library)
- CudaChiSquareRuntime - contains all the methods to offload chi square calculations on the device for musrfit. Is implemented using CUDA and OpenCL for offload on GPUs and CPUs.
-
CollimatorPhysics - Base class to implement particle matter interaction for OPAL. Implemented in CUDA and OpenMP.
-
GreensFunction - Base class to implelment integrated greens function for OPALs FFT Poisson Solver (CUDA and OpenMP)
-
ImageReconstruction - Base class for PET image reconstruction (CUDA)
DKS modules
DKS modules (DKSOPAL, DKSBaseMuSR, DKSImageReconstruction) provide the API that host applications use, to invoke the implemented algorithms.
Adding algorithms and frameworks to DKS
New algorithms that are defined in src/Algorithms and implemented in CUDA, OpenCL or MIC need to be added to one of the modules.
When a module is initialized and device that is used set DKS will chose the appropriate implementation of the algorithms to execute the code on the device.
When a new framework needs to be added to DKS, the algorithms need to be implemented using this framework and the module API need to be updated to use this implementation in case this framework is selected in DKS setup.
if (apiCuda()) {
ierr = CUDA_SAFECALL( DKS_SUCCESS );
chiSq = CUDA_SAFEINIT(new CudaChiSquareRuntime(getCudaBase()));
} else {
ierr = OPENCL_SAFECALL( DKS_SUCCESS );
chiSq = OPENCL_SAFECALL(new OpenCLChiSquareRuntime(getOpenCLBase()));
}