com.komputation.cuda.kernels.Kernel.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of komputation Show documentation
Show all versions of komputation Show documentation
Komputation is a neural network framework for the JVM written in the Kotlin programming language.
package com.komputation.cuda.kernels
import jcuda.Pointer
import jcuda.driver.CUfunction
import jcuda.nvrtc.JNvrtc.nvrtcDestroyProgram
import jcuda.nvrtc.nvrtcProgram
class Kernel(
private val computeCapabilities : Pair,
private val sourceCode : String,
private val name : String,
private val nameExpression : String,
private val headers : Array,
private val includeNames : Array) {
private val program = nvrtcProgram()
private val kernel = CUfunction()
init {
compileKernel(this.program, this.computeCapabilities, this.sourceCode, this.name, arrayOf(this.nameExpression), this.headers, this.includeNames)
loadKernel(this.kernel, this.program, this.nameExpression)
}
fun launch(pointerToParameters: Pointer, numberBlocksInXDimension : Int, numberBlocksInYDimension : Int, numberThreadsPerBlock : Int, sharedMemoryBytes : Int) =
launchKernel(this.kernel, pointerToParameters, numberBlocksInXDimension, numberBlocksInYDimension, numberThreadsPerBlock, sharedMemoryBytes)
fun destroy() {
nvrtcDestroyProgram(this.program)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy