The backend system is currently restricted to build and install the library only for a single backend.
Current behavior:
- Set
STDGPU_BACKEND to either STDGPU_BACKEND_CUDA (default) or STDGPU_BACKEND_OPENMP to control which backend will be used.
- Build target
stdgpu::stdgpu for the particular choice of STDGPU_BACKEND. Other backends will not be considered at all.
Proposed behavior:
- Set
STDGPU_ENABLE_<BACKEND> where <BACKEND> is one of CUDA, OPENMP.
- Build backend targets
stdgpu::<BACKEND> for each enabled backend using the backend-specific settings and dependency checks.
- Define
stdgpu::stdgpu as an alias target to stdgpu::<BACKEND> serving as a default which can be controlled via STDGPU_BACKEND to match current behavior.
This will make the system more flexible and allow users to choose freely between all enabled backends in their projects rather than being globally restricted to a single choice. Note that linking to more than one backend at the same time will be considered undefined behavior/ODR violation.
Furthermore, if only a single backend should be used at all times, this intend can also be expressed more clearly by linking to stdgpu::<BACKEND> rather than the configuration-dependent stdgpu::stdgpu target.
The backend system is currently restricted to build and install the library only for a single backend.
Current behavior:
STDGPU_BACKENDto eitherSTDGPU_BACKEND_CUDA(default) orSTDGPU_BACKEND_OPENMPto control which backend will be used.stdgpu::stdgpufor the particular choice ofSTDGPU_BACKEND. Other backends will not be considered at all.Proposed behavior:
STDGPU_ENABLE_<BACKEND>where<BACKEND>is one ofCUDA,OPENMP.stdgpu::<BACKEND>for each enabled backend using the backend-specific settings and dependency checks.stdgpu::stdgpuas an alias target tostdgpu::<BACKEND>serving as a default which can be controlled viaSTDGPU_BACKENDto match current behavior.This will make the system more flexible and allow users to choose freely between all enabled backends in their projects rather than being globally restricted to a single choice. Note that linking to more than one backend at the same time will be considered undefined behavior/ODR violation.
Furthermore, if only a single backend should be used at all times, this intend can also be expressed more clearly by linking to
stdgpu::<BACKEND>rather than the configuration-dependentstdgpu::stdgputarget.