Skip to content

Commit

Permalink
Added nvrtc checking
Browse files Browse the repository at this point in the history
  • Loading branch information
nshtengauer committed Nov 29, 2024
1 parent 8ae00e9 commit 78b0be1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {
}

group = "com.huskerdev"
version = "1.0.2"
version = "1.0.3"

repositories {
google()
Expand Down
6 changes: 4 additions & 2 deletions src/jvmMain/kotlin/com/huskerdev/gpkt/apis/cuda/Cuda.jvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.huskerdev.gpkt.apis.cuda
import jcuda.Pointer
import jcuda.driver.JCudaDriver
import jcuda.driver.JCudaDriver.*
import jcuda.nvrtc.JNvrtc
import jcuda.nvrtc.JNvrtc.*


Expand All @@ -14,17 +15,18 @@ actual class nvrtcProgram(val ptr: jcuda.nvrtc.nvrtcProgram)
actual class CUfunction(val ptr: jcuda.driver.CUfunction)

internal actual fun isCUDASupported() = try {
JNvrtc.setExceptionsEnabled(true)
cuInit(0)
val buffer = IntArray(1)
cuDeviceGetCount(buffer)
if(buffer[0] == 0){
println("[INFO] CUDA is supported, but can not find supported devices.")
false
}else true
}catch (e: UnsatisfiedLinkError){
}catch (_: UnsatisfiedLinkError){
println("[INFO] Failed to load CUDA. Check toolkit installation.")
false
}catch (t: Throwable){
}catch (_: Throwable){
false
}

Expand Down

0 comments on commit 78b0be1

Please sign in to comment.