This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from gunrock/dev
Bring changes over, so I can improve kernels.
- Loading branch information
Showing
14 changed files
with
340 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
set(BENCHMARK_SOURCES | ||
for.cu | ||
) | ||
|
||
foreach(SOURCE IN LISTS BENCHMARK_SOURCES) | ||
get_filename_component(BENCHMARK_NAME ${SOURCE} NAME_WLE) | ||
add_executable(${BENCHMARK_NAME} ${SOURCE}) | ||
target_link_libraries(${BENCHMARK_NAME} | ||
PRIVATE essentials | ||
PRIVATE nvbench::main | ||
) | ||
get_target_property(ESSENTIALS_ARCHITECTURES | ||
essentials CUDA_ARCHITECTURES | ||
) | ||
set_target_properties(${BENCHMARK_NAME} | ||
PROPERTIES | ||
CUDA_ARCHITECTURES ${ESSENTIALS_ARCHITECTURES} | ||
) | ||
message(STATUS "Benchmark Added: ${BENCHMARK_NAME}") | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include <gunrock/error.hxx> | ||
#include <gunrock/graph/graph.hxx> | ||
#include <gunrock/formats/formats.hxx> | ||
#include <gunrock/cuda/cuda.hxx> | ||
#include <gunrock/framework/operators/for/for.hxx> | ||
#include <gunrock/util/sample.hxx> | ||
|
||
#include <nvbench/nvbench.cuh> | ||
|
||
namespace gunrock { | ||
namespace benchmark { | ||
void parallel_for(nvbench::state& state) { | ||
auto csr = sample::csr(); | ||
|
||
// -- | ||
// Build graph | ||
|
||
auto G = graph::build::from_csr<memory_space_t::device, graph::view_t::csr>( | ||
csr.number_of_rows, // rows | ||
csr.number_of_columns, // columns | ||
csr.number_of_nonzeros, // nonzeros | ||
csr.row_offsets.data().get(), // row_offsets | ||
csr.column_indices.data().get(), // column_indices | ||
csr.nonzero_values.data().get() // values | ||
); | ||
|
||
// Initialize the context. | ||
cuda::device_id_t device = 0; | ||
cuda::multi_context_t context(device); | ||
|
||
vector_t<int> vertices(G.get_number_of_vertices()); | ||
auto d_vertices = vertices.data().get(); | ||
|
||
auto f = [=] __device__(int const& v) -> void { d_vertices[v] = v; }; | ||
|
||
state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) { | ||
operators::parallel_for::execute<operators::parallel_for_each_t::vertex>( | ||
G, // graph | ||
f, // lambda function | ||
context // context | ||
); | ||
}); | ||
} | ||
|
||
NVBENCH_BENCH(parallel_for).set_name("parallel_for"); | ||
|
||
} // namespace benchmark | ||
} // namespace gunrock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
include(FetchContent) | ||
set(FETCHCONTENT_QUIET ON) | ||
|
||
message(STATUS "Cloning External Project: NVBench") | ||
get_filename_component(FC_BASE "../externals" | ||
REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") | ||
set(FETCHCONTENT_BASE_DIR ${FC_BASE}) | ||
|
||
FetchContent_Declare( | ||
nvbench | ||
GIT_REPOSITORY https://github.com/NVIDIA/nvbench.git | ||
GIT_TAG main | ||
) | ||
|
||
FetchContent_GetProperties(nvbench) | ||
if(NOT nvbench_POPULATED) | ||
FetchContent_Populate( | ||
nvbench | ||
) | ||
endif() | ||
|
||
# Exposing nvbench's source and include directory | ||
set(NVBENCH_INCLUDE_DIR "${nvbench_SOURCE_DIR}") | ||
set(NVBENCH_BUILD_DIR "${nvbench_BINARY_DIR}") | ||
|
||
# Add subdirectory ::nvbench | ||
add_subdirectory(${NVBENCH_INCLUDE_DIR} ${NVBENCH_BUILD_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.