Skip to content

Commit

Permalink
incorporate a temporary solution till https://github.com/NVlabs/cub/i…
Browse files Browse the repository at this point in the history
…ssues/162 is fixed.
  • Loading branch information
seunghwak committed May 10, 2019
1 parent 9aface1 commit e3399a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cpp/src/cugraph.cu
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,11 @@ gdf_error gdf_pagerank_impl (gdf_graph *graph,
cudaStream_t stream{nullptr};
ALLOC_TRY((void**)&d_leaf_vector, sizeof(WT) * m, stream);
ALLOC_TRY((void**)&d_val, sizeof(WT) * nnz , stream);
ALLOC_TRY((void**)&d_pr, sizeof(WT) * m, stream);
#if 1/* temporary solution till https://github.com/NVlabs/cub/issues/162 is resolved */
CUDA_TRY(cudaMalloc((void**)&d_pr, sizeof(WT) * m));
#else
ALLOC_TRY((void**)&d_pr, sizeof(WT) * m, stream);
#endif

// The templating for HT_matrix_csc_coo assumes that m, nnz and data are all the same type
cugraph::HT_matrix_csc_coo(m, nnz, (int *)graph->transposedAdjList->offsets->data, (int *)graph->transposedAdjList->indices->data, d_val, d_leaf_vector);
Expand All @@ -467,7 +471,11 @@ gdf_error gdf_pagerank_impl (gdf_graph *graph,
cugraph::copy<WT>(m, d_pr, (WT*)pagerank->data);

ALLOC_FREE_TRY(d_val, stream);
#if 1/* temporary solution till https://github.com/NVlabs/cub/issues/162 is resolved */
CUDA_TRY(cudaFree(d_pr));
#else
ALLOC_FREE_TRY(d_pr, stream);
#endif
ALLOC_FREE_TRY(d_leaf_vector, stream);

return GDF_SUCCESS;
Expand Down
8 changes: 8 additions & 0 deletions cpp/src/pagerank.cu
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ int pagerank(IndexType n, IndexType e, IndexType *cscPtr, IndexType *cscInd, Val
cudaStream_t stream{nullptr};

ALLOC_TRY((void**)&b, sizeof(ValueType) * n, stream);
#if 1/* temporary solution till https://github.com/NVlabs/cub/issues/162 is resolved */
CUDA_TRY(cudaMalloc((void**)&tmp, sizeof(ValueType) * n));
#else
ALLOC_TRY((void**)&tmp, sizeof(ValueType) * n, stream);
#endif
cudaCheckError();

if (!has_guess) {
Expand Down Expand Up @@ -149,7 +153,11 @@ int pagerank(IndexType n, IndexType e, IndexType *cscPtr, IndexType *cscInd, Val
//printv(n,pagerank_vector,0);

ALLOC_FREE_TRY(b, stream);
#if 1/* temporary solution till https://github.com/NVlabs/cub/issues/162 is resolved */
CUDA_TRY(cudaFree(tmp));
#else
ALLOC_FREE_TRY(tmp, stream);
#endif
ALLOC_FREE_TRY(cub_d_temp_storage, stream);

return converged ? 0 : 1;
Expand Down

0 comments on commit e3399a2

Please sign in to comment.