Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update mechanism for detecting we're on Pascal or earlier GPU #4

Merged
Show file tree
Hide file tree
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
38 changes: 16 additions & 22 deletions cpp/src/community/louvain.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,8 @@
*/

#include <community/louvain.cuh>

// "FIXME": remove the guards after support for Pascal will be dropped;
//
// Disable louvain(experimenta::graph_view_t,...)
// versions for GPU architectures < 700
//(this is because cuco/static_map.cuh would not
// compile on those)
//
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 700
#include <experimental/graph.hpp>
#else
#include <experimental/louvain.cuh>
#endif

namespace cugraph {

Expand Down Expand Up @@ -58,13 +47,22 @@ std::pair<size_t, weight_t> louvain(
{
CUGRAPH_EXPECTS(clustering != nullptr, "Invalid input argument: clustering is null");

#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 700
CUGRAPH_FAIL("Louvain not supported on Pascal and older architectures");
#else
experimental::Louvain<experimental::graph_view_t<vertex_t, edge_t, weight_t, false, multi_gpu>>
runner(handle, graph_view);
return runner(clustering, max_level, resolution);
#endif
// "FIXME": remove this check
//
// Disable louvain(experimental::graph_view_t,...)
// versions for GPU architectures < 700
// (cuco/static_map.cuh depends on features not supported on or before Pascal)
//
cudaDeviceProp device_prop;
CUDA_CHECK(cudaGetDeviceProperties(&device_prop, 0));

if (device_prop.major < 7) {
CUGRAPH_FAIL("Louvain not supported on Pascal and older architectures");
} else {
experimental::Louvain<experimental::graph_view_t<vertex_t, edge_t, weight_t, false, multi_gpu>>
runner(handle, graph_view);
return runner(clustering, max_level, resolution);
}
}

} // namespace detail
Expand All @@ -78,11 +76,7 @@ std::pair<size_t, typename graph_t::weight_type> louvain(raft::handle_t const &h
{
CUGRAPH_EXPECTS(clustering != nullptr, "Invalid input argument: clustering is null");

#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 700
CUGRAPH_FAIL("Louvain not supported on Pascal and older architectures");
#else
return detail::louvain(handle, graph, clustering, max_level, resolution);
#endif
}

// Explicit template instantations
Expand Down
42 changes: 23 additions & 19 deletions cpp/tests/experimental/louvain_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@
#include <utilities/base_fixture.hpp>
#include <utilities/test_utilities.hpp>

#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 700
#include <raft/cudart_utils.h>
#include <raft/handle.hpp>
#include <rmm/mr/device/cuda_memory_resource.hpp>

#include <experimental/graph.hpp>
#else
#include <experimental/louvain.cuh>
#endif

#include <algorithms.hpp>

#include <raft/cudart_utils.h>
#include <raft/handle.hpp>
#include <rmm/mr/device/cuda_memory_resource.hpp>

#include <gtest/gtest.h>

#include <algorithm>
Expand Down Expand Up @@ -64,21 +61,28 @@ class Tests_Louvain : public ::testing::TestWithParam<Louvain_Usecase> {
template <typename vertex_t, typename edge_t, typename weight_t, typename result_t>
void run_current_test(Louvain_Usecase const& configuration)
{
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 700
CUGRAPH_FAIL("Louvain not supported on Pascal and older architectures");
#else
raft::handle_t handle{};

std::cout << "read graph file: " << configuration.graph_file_full_path << std::endl;
// "FIXME": remove this check
//
// Disable louvain(experimental::graph_view_t,...)
// versions for GPU architectures < 700
// (cuco/static_map.cuh depends on features not supported on or before Pascal)
//
cudaDeviceProp device_prop;
CUDA_CHECK(cudaGetDeviceProperties(&device_prop, 0));

if (device_prop.major < 7) {
std::cout << "Louvain not supported on Pascal and older architectures" << std::endl;
} else {
raft::handle_t handle{};

auto graph =
cugraph::test::read_graph_from_matrix_market_file<vertex_t, edge_t, weight_t, false>(
handle, configuration.graph_file_full_path, configuration.test_weighted);
auto graph =
cugraph::test::read_graph_from_matrix_market_file<vertex_t, edge_t, weight_t, false>(
handle, configuration.graph_file_full_path, configuration.test_weighted);

auto graph_view = graph.view();
auto graph_view = graph.view();

louvain(graph_view);
#endif
louvain(graph_view);
}
}

template <typename graph_t>
Expand Down