Skip to content

Commit

Permalink
Minimal fix for SparseRandomProjection (#4100)
Browse files Browse the repository at this point in the history
Answers #3857

This PR directly fixes the issue described in #3857. Further updates to the `SparseRandomProjection` model will be merged from #3899 once RAPIDS will drop CentOS7 support in favor of CentOS8.

Authors:
  - Victor Lafargue (https://github.com/viclafargue)

Approvers:
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: #4100
  • Loading branch information
viclafargue authored Jul 27, 2021
1 parent 5a7177c commit 0e26888
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cpp/src/random_projection/rproj.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ void sparse_random_matrix(const raft::handle_t& h,
} else {
auto alloc = h.get_host_allocator();

double max_total_density = params.density * 1.2;
size_t indices_alloc =
(params.n_features * params.n_components * max_total_density) * sizeof(int);
size_t indptr_alloc = (params.n_components + 1) * sizeof(int);
int* indices = (int*)alloc->allocate(indices_alloc, stream);
int* indptr = (int*)alloc->allocate(indptr_alloc, stream);
size_t indices_alloc = params.n_features * params.n_components * sizeof(int);
size_t indptr_alloc = (params.n_components + 1) * sizeof(int);
int* indices = (int*)alloc->allocate(indices_alloc, stream);
int* indptr = (int*)alloc->allocate(indptr_alloc, stream);

size_t offset = 0;
size_t indices_idx = 0;
Expand Down

0 comments on commit 0e26888

Please sign in to comment.