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

Commit

Permalink
Simple benchmark is working. Beautiful output.
Browse files Browse the repository at this point in the history
  • Loading branch information
neoblizz committed Dec 23, 2021
1 parent 67e20b1 commit 8ddc1ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ target_compile_definitions(essentials
ESSENTIALS_VERSION=${ESSENTIALS_VERSION}
)

message(STATUS "Essentials CUDA Architecture: ${ESSENTIALS_ARCHITECTURES}")

####################################################
############ TARGET COMPILE FEATURES ###############
####################################################
Expand Down Expand Up @@ -187,6 +189,8 @@ option(ESSENTIALS_BUILD_BENCHMARKS

# Subdirectories for examples, testing and documentation
if(ESSENTIALS_BUILD_BENCHMARKS)
# ... see https://github.com/NVIDIA/nvbench/issues/66
set(NVBench_ENABLE_NVML OFF)
# ... set cuda architecture for nvbench.
set(CMAKE_CUDA_ARCHITECTURES ${ESSENTIALS_ARCHITECTURES})
include(${PROJECT_SOURCE_DIR}/cmake/FetchNVBench.cmake)
Expand Down
7 changes: 5 additions & 2 deletions benchmarks/for.cu
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ void parallel_for(nvbench::state& state) {
cuda::device_id_t device = 0;
cuda::multi_context_t context(device);

auto f = [=] __device__(int const& v) -> void { printf("%i\n", v); };
vector_t<int> vertices(G.get_number_of_vertices());
auto d_vertices = vertices.data().get();

state.exec([&](nvbench::launch& launch) {
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
Expand Down
2 changes: 1 addition & 1 deletion include/gunrock/container/vector.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace gunrock {

using namespace memory;

template <typename type_t, memory_space_t space>
template <typename type_t, memory_space_t space = memory_space_t::device>
using vector_t =
std::conditional_t<space == memory_space_t::host, // condition
thrust::host_vector<type_t>, // host_type
Expand Down

0 comments on commit 8ddc1ef

Please sign in to comment.