All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cuda.hashtable.GroupSumKernel.cu Maven / Gradle / Ivy

Go to download

Komputation is a neural network framework for the JVM written in the Kotlin programming language.

There is a newer version: 0.12.5
Show newest version
__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