Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions applications/plugins/SofaCUDA/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ if (${CUDA_HOST_COMPILER} MATCHES "ccache$")
endif()

add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${CUDA_SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}")
message("CMAKE_CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES}")
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${SOFACUDA_COMPILE_DEFINITIONS}")
if(SOFACUDA_VERBOSE_PTXAS)
target_compile_options(${PROJECT_NAME} PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:--ptxas-options=-v>)
Expand Down
19 changes: 19 additions & 0 deletions applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/mycuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,29 @@ int mycudaInit(int device)
{
if (cudaInitCalled) return 1;

// Driver and API checks
#if defined(__cplusplus)
mycudaPrintf("C++ standard = %ld", __cplusplus);
#endif

// ── Driver & Runtime versions ──────────────────────────────────────────
int driverVersion = 0, runtimeVersion = 0;
cudaDriverGetVersion(&driverVersion);
cudaRuntimeGetVersion(&runtimeVersion);

mycudaPrintf("=== CUDA Version Diagnostics ===\n");
mycudaPrintf("Driver version : %d.%d\n", driverVersion / 1000, (driverVersion % 100) / 10);
mycudaPrintf("Runtime version : %d.%d\n", runtimeVersion / 1000, (runtimeVersion % 100) / 10);

if (driverVersion < runtimeVersion) {
mycudaPrintf("[ERROR] Driver is too old for this runtime!\n");
mycudaPrintf(" Minimum required driver for runtime %d.%d: see CUDA release notes.\n",
runtimeVersion / 1000, (runtimeVersion % 100) / 10);
return 0;
}
mycudaPrintf("[OK] Driver is compatible with runtime.\n\n");

// Hardware checks
cudaInitCalled = true;
const cudaError_t getDeviceCountError = cudaGetDeviceCount(&deviceCount);
if (getDeviceCountError != cudaSuccess)
Expand Down
Loading