MCPcopy Create free account
hub / github.com/ComputationalRobotics/XM-code / allocate

Method allocate

XM/include/Utils/memory.h:1161–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1159 }
1160
1161 inline void allocate(const int gpu_id, const int row_size, const int col_size, const int nnz) {
1162 if (this->vals == nullptr) {
1163 this->gpu_id = gpu_id;
1164 this->row_size = row_size;
1165 this->col_size = col_size;
1166 this->nnz = nnz;
1167 CHECK_CUDA( cudaSetDevice(this->gpu_id) );
1168 CHECK_CUDA( cudaMalloc((void**) &this->col_ptrs, sizeof(int) * (this->col_size + 1)) );
1169 CHECK_CUDA( cudaMalloc((void**) &this->row_ids, sizeof(int) * this->nnz) );
1170 CHECK_CUDA( cudaMalloc((void**) &this->vals, sizeof(double) * this->nnz) );
1171 CHECK_CUSPARSE(cusparseCreateCsc(
1172 &this->cusparse_descr, this->row_size, this->col_size, this->nnz,
1173 this->col_ptrs, this->row_ids, this->vals,
1174 CUSPARSE_INDEX_32I, CUSPARSE_INDEX_32I, CUSPARSE_INDEX_BASE_ZERO, CUDA_R_64F
1175 ) );
1176 }
1177 return;
1178 }
1179
1180 inline double get_norm(const DeviceBlasHandle& cublas_H) {
1181 double norm;

Callers 1

DeviceSpMatDoubleCSCMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected