<分区>
我有以下 cuda c++。我正在尝试使用删除功能删除 h_c、h_c_Row 和 h_c_ColdIndices 数组。但是当我在 nsight eclispe 的 Debug模式下看到每个数组的内存和存储在该内存中的值时,内存并没有被删除。
float *h_c = new float[nnz_c];
int *h_c_Row = new int[n_k+1];
int *h_c_ColIndices = new int[nnz_c];
create_sparse_MY(c,n_k,d,h_c,h_c_Row,h_c_ColIndices, nnz_c);
// transfer sparse c to device memory
float *d_sc; (cudaMalloc(&d_sc, nnz_c * sizeof(float)));
(cudaMemcpy(d_sc, h_c, (nnz_c) * sizeof(float), cudaMemcpyHostToDevice));
int *d_c_ColIndices; (cudaMalloc(&d_c_ColIndices, nnz_c * sizeof(*d_c_ColIndices)));
(cudaMemcpy(d_c_ColIndices, h_c_ColIndices, (nnz_c) * sizeof(int), cudaMemcpyHostToDevice));
int *d_c_RowIndices; (cudaMalloc(&d_c_RowIndices, (n_k+1) * sizeof(*d_c_RowIndices)));
(cudaMemcpy(d_c_RowIndices, h_c_Row, (n_k+1) * sizeof(int), cudaMemcpyHostToDevice));
delete[] h_c;
delete[] h_c_Row;
delete[] h_c_ColIndices
有人可以帮我吗?这是在 cuda c++ 中删除主内存中数组的正确方法吗?