Skip to content

Commit

Permalink
Add ndim to CArray and CIndexer
Browse files Browse the repository at this point in the history
  • Loading branch information
okuta committed Jun 18, 2017
1 parent 320fad3 commit 201c872
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cupy/core/carray.cuh
Expand Up @@ -137,8 +137,10 @@ __device__ int signbit(float16 x) {return x.signbit();}
i < (n); \
i += blockDim.x * gridDim.x)

template <typename T, int ndim>
template <typename T, int _ndim>
class CArray {
public:
static const int ndim = _ndim;
private:
T* data_;
ptrdiff_t size_;
Expand Down Expand Up @@ -197,6 +199,8 @@ private:
ptrdiff_t size_;

public:
static const int ndim = 0;

__device__ int size() const {
return size_;
}
Expand All @@ -220,8 +224,10 @@ public:
}
};

template <int ndim>
template <int _ndim>
class CIndexer {
public:
static const int ndim = _ndim;
private:
ptrdiff_t size_;
ptrdiff_t shape_[ndim];
Expand Down Expand Up @@ -271,6 +277,8 @@ private:
ptrdiff_t size_;

public:
static const int ndim = 0;

__device__ int size() const {
return size_;
}
Expand Down

0 comments on commit 201c872

Please sign in to comment.