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

Method allocate

XM/include/Utils/memory.h:363–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361 }
362
363 inline void allocate() {
364
365 // std::cout << "allocate with size: " << this->total_size<<std::endl;
366 CHECK_CUDA(cudaSetDevice(this->gpu_id));
367 CHECK_CUDA(cudaMalloc((void**)&this->vals, sizeof(T) * total_size));
368 CHECK_CUDA(cudaMemset(this->vals, 0, sizeof(T) * total_size));
369 if(num_dims == 1){
370 CHECK_CUSPARSE(cusparseCreateDnVec(&this->cusparse_descr, total_size, this->vals, CudaTypeMapper<T>::value));
371 }
372 else if(num_dims == 2){
373 CHECK_CUSPARSE(cusparseCreateDnMat(&this->cusparse_descr_mat, dimensions[0],dimensions[1],dimensions[0], this->vals, CudaTypeMapper<T>::value, CUSPARSE_ORDER_COL));
374 }
375
376
377 }
378
379 void setValueAt(size_s index, T value) {
380 setValueKernel<<<1, 1>>>(vals, index, value);

Callers 2

DeviceDnTenMethod · 0.95
copyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected