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

Method allocate

XM/include/Utils/memory.h:524–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522 }
523
524 inline void allocate() {
525 if (this->vals == nullptr) {
526 CHECK_CUDA( cudaSetDevice(this->gpu_id) );
527 CHECK_CUDA( cudaMalloc((void**) &this->col_ptrs, sizeof(int) * (this->col_size + 1)) );
528 CHECK_CUDA( cudaMalloc((void**) &this->row_ids, sizeof(int) * this->nnz) );
529 CHECK_CUDA( cudaMalloc((void**) &this->vals, sizeof(T) * this->nnz) );
530 CHECK_CUSPARSE( cusparseCreateCsc(
531 &this->cusparse_descr, this->row_size, this->col_size, this->nnz,
532 this->col_ptrs, this->row_ids, this->vals,
533 CUSPARSE_INDEX_32I, CUSPARSE_INDEX_32I, CUSPARSE_INDEX_BASE_ZERO, CudaTypeMapper<T>::value
534 ) );
535 }
536 return;
537 }
538
539 void SynchronizeHostToDevice(int* host_col_ptrs, int* host_row_ids, T* host_val){
540 // always Synchronize to avoid read-write conflict

Callers 1

DeviceSpMatCSCMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected