| 1025 | } |
| 1026 | |
| 1027 | inline void allocate(const int gpu_id, const int size) { |
| 1028 | if (this->vals == nullptr) { |
| 1029 | this->gpu_id = gpu_id; |
| 1030 | this->size = size; |
| 1031 | CHECK_CUDA( cudaSetDevice(this->gpu_id) ); |
| 1032 | CHECK_CUDA( cudaMalloc((void**) &this->vals, sizeof(int) * this->size) ); |
| 1033 | } |
| 1034 | return; |
| 1035 | } |
| 1036 | |
| 1037 | ~DeviceDnVecInt() { |
| 1038 | CHECK_CUDA( cudaSetDevice(this->gpu_id) ); |