THCDegree.cuh 425 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
#ifndef THC_DEGREE_INC
#define THC_DEGREE_INC

rusty1s's avatar
rusty1s committed
4
#include "common.cuh"
rusty1s's avatar
rusty1s committed
5
6
#include "THCNumerics.cuh"

rusty1s's avatar
rusty1s committed
7
8
9
10
11
12
13
14
template<typename T>
__global__ void cumDegreeKernel(T *self, int64_t *index, ptrdiff_t nEdges) {
  KERNEL_LOOP(i, nEdges) {
    int64_t r = index[i];
    if (r != index[i+1]) { self[r] = ScalarConvert<int, T>::to(i + 1); }
  }
}

rusty1s's avatar
rusty1s committed
15
16
17
18
#include "generic/THCDegree.cuh"
#include "THC/THCGenerateAllTypes.h"

#endif  // THC_DEGREE_INC