| 1057 | } |
| 1058 | |
| 1059 | inline void allocate(const int gpu_id, const int size) { |
| 1060 | if (this->vals == nullptr) { |
| 1061 | this->gpu_id = gpu_id; |
| 1062 | this->size = size; |
| 1063 | CHECK_CUDA( cudaSetDevice(this->gpu_id) ); |
| 1064 | CHECK_CUDA( cudaMalloc((void**) &this->vals, sizeof(size_t) * this->size) ); |
| 1065 | } |
| 1066 | return; |
| 1067 | } |
| 1068 | |
| 1069 | ~DeviceDnVecLongInt() { |
| 1070 | CHECK_CUDA( cudaSetDevice(this->gpu_id) ); |