Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Improve sssp_cpu performance #72

Merged
merged 2 commits into from
May 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions examples/sssp/sssp_cpu.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ float run(csr_t& csr,
vertex_t& single_source,
weight_t* distances,
vertex_t* predecessors) {
thrust::host_vector<edge_t> row_offsets(csr.row_offsets); // Copy data to CPU
thrust::host_vector<vertex_t> column_indices(csr.column_indices);
thrust::host_vector<weight_t> nonzero_values(csr.nonzero_values);

thrust::host_vector<edge_t> _row_offsets(csr.row_offsets); // Copy data to CPU
thrust::host_vector<vertex_t> _column_indices(csr.column_indices);
thrust::host_vector<weight_t> _nonzero_values(csr.nonzero_values);

edge_t* row_offsets = _row_offsets.data();
vertex_t* column_indices = _column_indices.data();
weight_t* nonzero_values = _nonzero_values.data();

for (vertex_t i = 0; i < csr.number_of_rows; i++)
distances[i] = std::numeric_limits<weight_t>::max();
Expand Down Expand Up @@ -78,4 +83,4 @@ int compute_error(thrust::device_vector<val_t> _gpu_result,
return n_errors;
}

} // namespace sssp_cpu
} // namespace sssp_cpu