Skip to content

Commit e3ba171

Browse files
authored
Merge pull request #18 from uos/fix-cuda13
Compilation fix for CUDA 13
2 parents 6d772fc + 89c0180 commit e3ba171

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.14)
22
project(rmagine
33
LANGUAGES CXX C
4-
VERSION 2.3.2)# TODO update this version when merging into main-branch
4+
VERSION 2.3.3)# TODO update this version when merging into main-branch
55

66
option(RMAGINE_BUILD_TOOLS "Build tools" ON)
77
option(RMAGINE_BUILD_TESTS "Build tests" ON)

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<package format="2">
33
<name>rmagine</name>
4-
<version>2.3.2</version>
4+
<version>2.3.3</version>
55
<description>
66
Library for fast and accurate simulation of range sensors in large 3D environments using ray tracing. The simulations can even be computed on embedded devices installed on a robot.
77
</description>

src/rmagine_cuda/src/util/cuda/CudaContext.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ void cuda_initialize()
1818
cuda_initialized_ = true;
1919
}
2020

21+
#define STR_HELPER(x) #x
22+
#define STR(x) STR_HELPER(x)
23+
2124
CudaContext::CudaContext(int device_id)
2225
{
2326
if(!cuda_initialized())
@@ -30,7 +33,16 @@ CudaContext::CudaContext(int device_id)
3033
cudaDeviceProp info = cuda::getDeviceInfo(device_id);
3134
std::cout << "[RMagine - CudaContext] Construct context on device " << device_id << " - " << info.name << " " << info.luid << std::endl;
3235

36+
// We use cuCtxCreate which is part of the driver.
37+
// this is why we can use CUDA_VERSION
38+
#if CUDA_VERSION >= 13000
39+
// New API since CUDA 13: CUctxCreateParams* ctxCreateParams (nullptr)
40+
// TODO: check if we should do something with it instead of setting it to nullptr
41+
cuCtxCreate(&m_context, nullptr, 0, device_id);
42+
#else
43+
// CUDA < 13
3344
cuCtxCreate(&m_context, 0, device_id);
45+
#endif
3446
}
3547

3648
CudaContext::CudaContext(CUcontext ctx)

0 commit comments

Comments
 (0)