cuda.hashtable.GroupSumKernel.cu 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.
__global__ void groupSumKernel(
int dimension,
int maximumKeys,
int* mapping,
float* gradient,
float* groupSum) {
int indexInstance = blockIdx.x;
int indexKey = blockIdx.y;
int indexMapping = indexInstance * maximumKeys + indexKey;
int slot = mapping[indexMapping];
if(slot != -1) {
int indexEntry = threadIdx.x;
int indexGroupSumEntry = slot * dimension + indexEntry;
int indexGradientEntry = indexInstance * maximumKeys * dimension + indexKey * dimension + indexEntry;
float gradientEntry = gradient[indexGradientEntry];
atomicAdd(&groupSum[indexGroupSumEntry], gradientEntry);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy