|
25 | 25 | #include "flamegpu/simulation/detail/CUDAEnvironmentDirectedGraphBuffers.cuh" |
26 | 26 | #include "flamegpu/simulation/detail/CUDAScanCompaction.h" |
27 | 27 | #include "flamegpu/util/nvtx.h" |
28 | | -#include "flamegpu/detail/compute_capability.cuh" |
| 28 | +#include "flamegpu/detail/gpu/cuda/compute_capability.cuh" |
29 | 29 | #include "flamegpu/detail/SignalHandlers.h" |
30 | 30 | #include "flamegpu/detail/wddm.cuh" |
31 | 31 | #include "flamegpu/detail/SteadyClockTimer.h" |
@@ -1570,16 +1570,15 @@ void CUDASimulation::applyConfig_derived() { |
1570 | 1570 | THROW exception::InvalidCUDAdevice("Unable to set CUDA device to '%d' after the CUDASimulation has already initialised on device '%d'.", config.device_id, deviceInitialised); |
1571 | 1571 | } |
1572 | 1572 |
|
1573 | | -// Todo: HIP equivalent |
1574 | | -#ifdef FLAMEGPU_USE_CUDA |
1575 | | - // Check the compute capability of the device, throw an exception if not valid for the executable. |
1576 | | - if (!detail::compute_capability::checkComputeCapability(static_cast<int>(config.device_id))) { |
1577 | | - int min_cc = detail::compute_capability::minimumCompiledComputeCapability(); |
1578 | | - std::string compiled_ccs = detail::compute_capability::compiledCompiledComputeCapabilitiesString(); |
1579 | | - int cc = detail::compute_capability::getComputeCapability(static_cast<int>(config.device_id)); |
| 1573 | +#if defined(FLAMEGPU_USE_CUDA) |
| 1574 | + // On CUDA, check the compute capability of the device, throw an exception if not valid for the executable. |
| 1575 | + if (!detail::gpu::cuda::compute_capability::checkComputeCapability(static_cast<int>(config.device_id))) { |
| 1576 | + int min_cc = detail::gpu::cuda::compute_capability::minimumCompiledComputeCapability(); |
| 1577 | + std::string compiled_ccs = detail::gpu::cuda::compute_capability::compiledCompiledComputeCapabilitiesString(); |
| 1578 | + int cc = detail::gpu::cuda::compute_capability::getComputeCapability(static_cast<int>(config.device_id)); |
1580 | 1579 | THROW exception::InvalidCUDAComputeCapability("Error application compiled for CUDA Compute Capabilities \"%s\". Rebuild including compute capability <= %d for device %u.", compiled_ccs.c_str(), cc, config.device_id); |
1581 | 1580 | } |
1582 | | -#endif // FLAMEGPU_USE_CUDA |
| 1581 | +#endif // defined(FLAMEGPU_USE_CUDA) |
1583 | 1582 |
|
1584 | 1583 | cudaStatus = FLAMEGPU_GPU_RUNTIME_SYMBOL(SetDevice)(static_cast<int>(config.device_id)); |
1585 | 1584 | if (cudaStatus != FLAMEGPU_GPU_RUNTIME_SYMBOL(Success)) { |
@@ -1622,17 +1621,15 @@ void CUDASimulation::reseed(const uint64_t seed) { |
1622 | 1621 | void CUDASimulation::initialiseSingletons() { |
1623 | 1622 | // Only do this once. |
1624 | 1623 | if (!singletonsInitialised) { |
1625 | | - // If the device has not been specified, also check the compute capability is OK |
1626 | | - // Check the compute capability of the device, throw an exception if not valid for the executable. |
1627 | | - // todo: HIP equivalent |
1628 | | -#ifdef FLAMEGPU_USE_CUDA |
1629 | | - if (!detail::compute_capability::checkComputeCapability(static_cast<int>(config.device_id))) { |
1630 | | - int min_cc = detail::compute_capability::minimumCompiledComputeCapability(); |
1631 | | - std::string compiled_ccs = detail::compute_capability::compiledCompiledComputeCapabilitiesString(); |
1632 | | - int cc = detail::compute_capability::getComputeCapability(static_cast<int>(config.device_id)); |
| 1624 | +#if defined(FLAMEGPU_USE_CUDA) |
| 1625 | + // On CUDA, Check the compute capability of the device, throw an exception if not valid for the executable. |
| 1626 | + if (!detail::gpu::cuda::compute_capability::checkComputeCapability(static_cast<int>(config.device_id))) { |
| 1627 | + int min_cc = detail::gpu::cuda::compute_capability::minimumCompiledComputeCapability(); |
| 1628 | + std::string compiled_ccs = detail::gpu::cuda::compute_capability::compiledCompiledComputeCapabilitiesString(); |
| 1629 | + int cc = detail::gpu::cuda::compute_capability::getComputeCapability(static_cast<int>(config.device_id)); |
1633 | 1630 | THROW exception::InvalidCUDAComputeCapability("Error application compiled for CUDA Compute Capabilities \"%s\". Rebuild including compute capability <= %d for device %u.", compiled_ccs.c_str(), cc, config.device_id); |
1634 | 1631 | } |
1635 | | -#endif // FLAMEGPU_USE_CUDA |
| 1632 | +#endif // defined(FLAMEGPU_USE_CUDA) |
1636 | 1633 | flamegpu::detail::gpuCheck(FLAMEGPU_GPU_RUNTIME_SYMBOL(GetDevice)(&deviceInitialised)); |
1637 | 1634 | // Get references to all required singleton and store in the instance. |
1638 | 1635 | singletons = new Singletons((!submodel)? |
|
0 commit comments