From 10a016a1dfa05479d2a59b59e50f486f64603553 Mon Sep 17 00:00:00 2001 From: Naim Date: Thu, 8 Feb 2024 02:38:59 +0100 Subject: [PATCH] Restructure example dir --- cpp/examples/README.md | 19 ++++++++++++++----- .../cugraph_operations/CMakeLists.txt | 14 +++++++------- .../cugraph_operations/graph_operations.cu | 0 .../graph_partition/CMakeLists.txt | 14 +++++++------- .../vertex_and_edge_partition.cu | 0 cpp/examples/build.sh | 8 ++++---- cpp/examples/fetch_dependencies.cmake | 2 +- .../multi_gpu_application/CMakeLists.txt | 14 +++++++------- .../mg_graph_algorithms.cpp | 0 .../single_gpu_application/CMakeLists.txt | 12 ++++++------ .../sg_graph_algorithms.cpp | 0 11 files changed, 46 insertions(+), 37 deletions(-) rename cpp/examples/{ => advanced}/cugraph_operations/CMakeLists.txt (83%) rename cpp/examples/{ => advanced}/cugraph_operations/graph_operations.cu (100%) rename cpp/examples/{ => advanced}/graph_partition/CMakeLists.txt (84%) rename cpp/examples/{ => advanced}/graph_partition/vertex_and_edge_partition.cu (100%) rename cpp/examples/{ => simple}/multi_gpu_application/CMakeLists.txt (83%) rename cpp/examples/{ => simple}/multi_gpu_application/mg_graph_algorithms.cpp (100%) rename cpp/examples/{ => simple}/single_gpu_application/CMakeLists.txt (86%) rename cpp/examples/{ => simple}/single_gpu_application/sg_graph_algorithms.cpp (100%) diff --git a/cpp/examples/README.md b/cpp/examples/README.md index 682c72dbb22..82de18bfbdb 100644 --- a/cpp/examples/README.md +++ b/cpp/examples/README.md @@ -4,17 +4,24 @@ Example codes on how to use libcugraph. ## Contents -- single_gpu_application: example code on how to use libgraph to run different graph algorithms on a single-GPU node. +- simple -- multi_gpu_application: example code on how to use libgraph to run different graph algorithms on a multi-GPU node. + - single_gpu_application: example code on how to use libgraph to run different graph algorithms on a single-GPU node. -- graph_partition: code to explain vertex and edge partitioning in cugraph. + - multi_gpu_application: example code on how to use libgraph to run different graph algorithms on a multi-GPU node. -- cugraph_operations: example code for using cugraph primitives for simple graph operations needed to implement graph algorithms. +- advanced + - graph_partition: code to explain vertex and edge partitioning in cugraph. + + - cugraph_operations: example code for using cugraph primitives for simple graph operations needed to implement graph algorithms. ## Build instructions: -Run `build.sh` to build the above listed examples. +Run `build.sh` to from examples dir to build the above listed examples. + +```sh +~/cugraph/cpp/examples$./build.sh +``` ## Run instructions @@ -26,6 +33,8 @@ For multi_gpu, graph_partitioning and cugraph_operations `mpirun -np 2 path_to_executable path_to_a_csv_graph_file [memory allocation mode]` +NOTE: The example codes a + Memory allocation mode can be one of the followings - - cuda diff --git a/cpp/examples/cugraph_operations/CMakeLists.txt b/cpp/examples/advanced/cugraph_operations/CMakeLists.txt similarity index 83% rename from cpp/examples/cugraph_operations/CMakeLists.txt rename to cpp/examples/advanced/cugraph_operations/CMakeLists.txt index 7f33ffde232..e71f177022a 100644 --- a/cpp/examples/cugraph_operations/CMakeLists.txt +++ b/cpp/examples/advanced/cugraph_operations/CMakeLists.txt @@ -22,18 +22,18 @@ project( LANGUAGES CXX CUDA ) -include(../fetch_dependencies.cmake) +include(../../fetch_dependencies.cmake) find_package(MPI REQUIRED COMPONENTS CXX) -include(../../cmake/thirdparty/get_nccl.cmake) +include(../../../cmake/thirdparty/get_nccl.cmake) -add_library(csvfileutil STATIC ../../tests/utilities/csv_file_utilities.cu) +add_library(csvfileutil STATIC ../../../tests/utilities/csv_file_utilities.cu) target_include_directories(csvfileutil PUBLIC - "../../../thirdparty/mmio" - "../../tests" - "../../include" - "../../src" + "../../../../thirdparty/mmio" + "../../../tests" + "../../../include" + "../../../src" ) set_target_properties(csvfileutil PROPERTIES CUDA_ARCHITECTURES "native") target_link_libraries(csvfileutil PUBLIC cugraph::cugraph NCCL::NCCL MPI::MPI_CXX) diff --git a/cpp/examples/cugraph_operations/graph_operations.cu b/cpp/examples/advanced/cugraph_operations/graph_operations.cu similarity index 100% rename from cpp/examples/cugraph_operations/graph_operations.cu rename to cpp/examples/advanced/cugraph_operations/graph_operations.cu diff --git a/cpp/examples/graph_partition/CMakeLists.txt b/cpp/examples/advanced/graph_partition/CMakeLists.txt similarity index 84% rename from cpp/examples/graph_partition/CMakeLists.txt rename to cpp/examples/advanced/graph_partition/CMakeLists.txt index 4314bbecee8..cb70efcec36 100644 --- a/cpp/examples/graph_partition/CMakeLists.txt +++ b/cpp/examples/advanced/graph_partition/CMakeLists.txt @@ -22,18 +22,18 @@ project( LANGUAGES CXX CUDA ) -include(../fetch_dependencies.cmake) +include(../../fetch_dependencies.cmake) find_package(MPI REQUIRED COMPONENTS CXX) -include(../../cmake/thirdparty/get_nccl.cmake) +include(../../../cmake/thirdparty/get_nccl.cmake) -add_library(csvfileutil STATIC ../../tests/utilities/csv_file_utilities.cu) +add_library(csvfileutil STATIC ../../../tests/utilities/csv_file_utilities.cu) target_include_directories(csvfileutil PUBLIC - "../../../thirdparty/mmio" - "../../tests" - "../../include" - "../../src" + "../../../../thirdparty/mmio" + "../../../tests" + "../../../include" + "../../../src" ) set_target_properties(csvfileutil PROPERTIES CUDA_ARCHITECTURES "native") target_link_libraries(csvfileutil PUBLIC cugraph::cugraph NCCL::NCCL MPI::MPI_CXX) diff --git a/cpp/examples/graph_partition/vertex_and_edge_partition.cu b/cpp/examples/advanced/graph_partition/vertex_and_edge_partition.cu similarity index 100% rename from cpp/examples/graph_partition/vertex_and_edge_partition.cu rename to cpp/examples/advanced/graph_partition/vertex_and_edge_partition.cu diff --git a/cpp/examples/build.sh b/cpp/examples/build.sh index 5c656dbea0c..eee8a161ade 100755 --- a/cpp/examples/build.sh +++ b/cpp/examples/build.sh @@ -26,8 +26,8 @@ build_example() { cmake --build ${build_dir} -j${PARALLEL_LEVEL} } -build_example single_gpu_application -build_example multi_gpu_application -build_example graph_partition -build_example cugraph_operations +build_example simple/single_gpu_application +build_example simple/multi_gpu_application +build_example advanced/graph_partition +build_example advanced/cugraph_operations diff --git a/cpp/examples/fetch_dependencies.cmake b/cpp/examples/fetch_dependencies.cmake index ef074bc6e4f..7d8eb2eab33 100644 --- a/cpp/examples/fetch_dependencies.cmake +++ b/cpp/examples/fetch_dependencies.cmake @@ -29,5 +29,5 @@ CPMFindPackage( cpp ) -include(../../../fetch_rapids.cmake) +include(../../../../fetch_rapids.cmake) include(rapids-find) diff --git a/cpp/examples/multi_gpu_application/CMakeLists.txt b/cpp/examples/simple/multi_gpu_application/CMakeLists.txt similarity index 83% rename from cpp/examples/multi_gpu_application/CMakeLists.txt rename to cpp/examples/simple/multi_gpu_application/CMakeLists.txt index bb51d3f64ee..22fc6729825 100644 --- a/cpp/examples/multi_gpu_application/CMakeLists.txt +++ b/cpp/examples/simple/multi_gpu_application/CMakeLists.txt @@ -22,19 +22,19 @@ project( LANGUAGES CXX CUDA ) -include(../fetch_dependencies.cmake) +include(../../fetch_dependencies.cmake) find_package(MPI REQUIRED COMPONENTS CXX) -include(../../cmake/thirdparty/get_nccl.cmake) +include(../../../cmake/thirdparty/get_nccl.cmake) -add_library(csvfileutil STATIC ../../tests/utilities/csv_file_utilities.cu) +add_library(csvfileutil STATIC ../../../tests/utilities/csv_file_utilities.cu) target_include_directories(csvfileutil PUBLIC - "../../../thirdparty/mmio" - "../../tests" + "../../../../thirdparty/mmio" + "../../../tests" PRIVATE - "../../include" - "../../src" + "../../../include" + "../../../src" ) set_target_properties(csvfileutil PROPERTIES CUDA_ARCHITECTURES "native") target_link_libraries(csvfileutil PUBLIC cugraph::cugraph NCCL::NCCL MPI::MPI_CXX) diff --git a/cpp/examples/multi_gpu_application/mg_graph_algorithms.cpp b/cpp/examples/simple/multi_gpu_application/mg_graph_algorithms.cpp similarity index 100% rename from cpp/examples/multi_gpu_application/mg_graph_algorithms.cpp rename to cpp/examples/simple/multi_gpu_application/mg_graph_algorithms.cpp diff --git a/cpp/examples/single_gpu_application/CMakeLists.txt b/cpp/examples/simple/single_gpu_application/CMakeLists.txt similarity index 86% rename from cpp/examples/single_gpu_application/CMakeLists.txt rename to cpp/examples/simple/single_gpu_application/CMakeLists.txt index be262af3427..35869056a77 100644 --- a/cpp/examples/single_gpu_application/CMakeLists.txt +++ b/cpp/examples/simple/single_gpu_application/CMakeLists.txt @@ -22,16 +22,16 @@ project( LANGUAGES CXX CUDA ) -include(../fetch_dependencies.cmake) +include(../../fetch_dependencies.cmake) -add_library(csvfileutil STATIC ../../tests/utilities/csv_file_utilities.cu) +add_library(csvfileutil STATIC ../../../tests/utilities/csv_file_utilities.cu) target_include_directories(csvfileutil PUBLIC -"../../../thirdparty/mmio" -"../../tests" +"../../../../thirdparty/mmio" +"../../../tests" PRIVATE -"../../include" -"../../src" +"../../../include" +"../../../src" ) set_target_properties(csvfileutil PROPERTIES CUDA_ARCHITECTURES "native") target_link_libraries(csvfileutil PUBLIC cugraph::cugraph) diff --git a/cpp/examples/single_gpu_application/sg_graph_algorithms.cpp b/cpp/examples/simple/single_gpu_application/sg_graph_algorithms.cpp similarity index 100% rename from cpp/examples/single_gpu_application/sg_graph_algorithms.cpp rename to cpp/examples/simple/single_gpu_application/sg_graph_algorithms.cpp