Skip to content

Commit

Permalink
Merge 25967b7 into 77b2374
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuckHastings authored Mar 16, 2022
2 parents 77b2374 + 25967b7 commit 3cfd539
Show file tree
Hide file tree
Showing 46 changed files with 1,285 additions and 203 deletions.
12 changes: 9 additions & 3 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,16 @@ conda activate rapids
export PATH=$(conda info --base)/envs/rapids/bin:$PATH

gpuci_logger "Install dependencies"
gpuci_mamba_retry install -y \
"libcudf=${MINOR_VERSION}" \
# Assume libcudf and librmm will be installed via cudf and rmm respectively.
# This is done to prevent the following install scenario:
# libcudf = 22.04.00a220315, cudf = 22.04.00a220308
# where cudf 220308 was chosen possibly because it has fewer/different
# dependencies and the corresponding recipes have specified these combinations
# should work when sometimes they do not.
# FIXME: remove testing label when gpuCI has the ability to move the pyraft
# label from testing to main.
gpuci_mamba_retry install -c rapidsai-nightly/label/testing -y \
"cudf=${MINOR_VERSION}" \
"librmm=${MINOR_VERSION}" \
"rmm=${MINOR_VERSION}" \
"libraft-headers=${MINOR_VERSION}" \
"pyraft=${MINOR_VERSION}" \
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ endif()

add_library(cugraph_c SHARED
src/c_api/cugraph_api.cpp
src/c_api/resource_handle.cpp
src/c_api/array.cpp
src/c_api/error.cpp
src/c_api/graph_sg.cpp
Expand Down
3 changes: 2 additions & 1 deletion cpp/cmake/thirdparty/get_raft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ function(find_and_configure_raft)
GIT_TAG ${PKG_PINNED_TAG}
SOURCE_SUBDIR cpp
OPTIONS
"BUILD_TESTS OFF"
"RAFT_COMPILE_LIBRARIES OFF"
"BUILD_TESTS OFF"
"BUILD_BENCH OFF"
)

if(raft_ADDED)
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cugraph_c/algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

#pragma once

#include <cugraph_c/cugraph_api.h>
#include <cugraph_c/error.h>
#include <cugraph_c/graph.h>
#include <cugraph_c/resource_handle.h>

#ifdef __cplusplus
extern "C" {
Expand Down
10 changes: 5 additions & 5 deletions cpp/include/cugraph_c/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@

#pragma once

#include <cugraph_c/cugraph_api.h>
#include <cugraph_c/resource_handle.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
int align_;
int32_t align_;
} cugraph_type_erased_device_array_t;

typedef struct {
int align_;
int32_t align_;
} cugraph_type_erased_device_array_view_t;

typedef struct {
int align_;
int32_t align_;
} cugraph_type_erased_host_array_t;

typedef struct {
int align_;
int32_t align_;
} cugraph_type_erased_host_array_view_t;

/**
Expand Down
22 changes: 2 additions & 20 deletions cpp/include/cugraph_c/cugraph_api.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
#pragma once

#include <cugraph_c/error.h>
#include <cugraph_c/resource_handle.h>

#include <cuda_runtime_api.h>
#include <stddef.h>
Expand All @@ -26,21 +27,8 @@
extern "C" {
#endif

typedef enum bool_ { FALSE = 0, TRUE = 1 } bool_t;

typedef int8_t byte_t;

typedef enum data_type_id_ { INT32 = 0, INT64, FLOAT32, FLOAT64, NTYPES } data_type_id_t;

/* sizes in Bytes for data_type_id_t*/
extern int data_type_sz[];

/* C stub declarations */

typedef struct cugraph_resource_handle_ {
int align_;
} cugraph_resource_handle_t;

typedef struct cugraph_graph_envelope_ {
int align_;
} cugraph_graph_envelope_t;
Expand Down Expand Up @@ -160,12 +148,6 @@ cugraph_error_code_t cugraph_update_host_buffer(const cugraph_resource_handle_t*
byte_t* ptr_h_dst,
const cugraph_device_buffer_t* ptr_src);

/* raft::handle_t allocator (for now; possibly a more encompassing handle in the future)*/
cugraph_resource_handle_t* cugraph_create_resource_handle(void);

/* raft::handle_t deallocator*/
void cugraph_free_resource_handle(cugraph_resource_handle_t* p_handle);

#ifdef __cplusplus
}
#endif
6 changes: 4 additions & 2 deletions cpp/include/cugraph_c/error.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,8 @@

#pragma once

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -31,7 +33,7 @@ typedef enum cugraph_error_code_ {
} cugraph_error_code_t;

typedef struct cugraph_error_ {
int align_;
int32_t align_;
} cugraph_error_t;

/**
Expand Down
28 changes: 13 additions & 15 deletions cpp/include/cugraph_c/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ extern "C" {
#endif

typedef struct {
int align_;
int32_t align_;
} cugraph_graph_t;

typedef struct {
bool_t is_symmetric;
bool_t is_multigraph;
} cugraph_graph_properties_t;

// FIXME: Add support for specifying isloated vertices
/**
* @brief Construct an SG graph
*
Expand Down Expand Up @@ -73,6 +74,7 @@ cugraph_error_code_t cugraph_sg_graph_create(const cugraph_resource_handle_t* ha
// but didn't want to confuse with original cugraph_free_graph
void cugraph_sg_graph_free(cugraph_graph_t* graph);

// FIXME: Add support for specifying isloated vertices
/**
* @brief Construct an MG graph
*
Expand All @@ -94,20 +96,16 @@ void cugraph_sg_graph_free(cugraph_graph_t* graph);
* be populated if error code is not CUGRAPH_SUCCESS
* @return error code
*/
cugraph_error_code_t cugraph_mg_graph_create(
const cugraph_resource_handle_t* handle,
const cugraph_graph_properties_t* properties,
const cugraph_type_erased_device_array_view_t* src,
const cugraph_type_erased_device_array_view_t* dst,
const cugraph_type_erased_device_array_view_t* weights,
const cugraph_type_erased_host_array_view_t* vertex_partition_offsets,
const cugraph_type_erased_host_array_view_t* segment_offsets,
bool_t store_transposed,
size_t num_vertices,
size_t num_edges,
bool_t check,
cugraph_graph_t** graph,
cugraph_error_t** error);
cugraph_error_code_t cugraph_mg_graph_create(const cugraph_resource_handle_t* handle,
const cugraph_graph_properties_t* properties,
const cugraph_type_erased_device_array_view_t* src,
const cugraph_type_erased_device_array_view_t* dst,
const cugraph_type_erased_device_array_view_t* weights,
bool_t store_transposed,
size_t num_edges,
bool_t check,
cugraph_graph_t** graph,
cugraph_error_t** error);

/**
* @brief Destroy an MG graph
Expand Down
76 changes: 76 additions & 0 deletions cpp/include/cugraph_c/resource_handle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <cugraph_c/error.h>

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum bool_ { FALSE = 0, TRUE = 1 } bool_t;

typedef int8_t byte_t;

typedef enum data_type_id_ { INT32 = 0, INT64, FLOAT32, FLOAT64, NTYPES } data_type_id_t;

/* sizes in Bytes for data_type_id_t*/
extern size_t data_type_sz[];

typedef struct cugraph_resource_handle_ {
int32_t align_;
} cugraph_resource_handle_t;

// FIXME: Don't really want a raft handle here. We really want to be able to
// configure the resource handle ourselves. But that requires a bunch
// of logic that's currently only available in python.
/**
* @brief Construct a resource handle
*
* @param [in] raft_handle Handle for accessing resources
* If NULL, we will create a raft handle
* internally
*
* @return A graph resource handle
*/
cugraph_resource_handle_t* cugraph_create_resource_handle(void* raft_handle);

/**
* @brief get rank from resource handle
*
* If the resource handle has been configured for multi-gpu, this will return
* the rank for this worker. If the resource handle has not been configured for
* multi-gpu this will always return 0.
*
* @param [in] handle Handle for accessing resources
* @return rank
*/
int cugraph_resource_handle_get_rank(const cugraph_resource_handle_t* handle);

/**
* @brief Free resources in the resource handle
*
* @param [in] handle Handle for accessing resources
*/
void cugraph_free_resource_handle(cugraph_resource_handle_t* handle);

#ifdef __cplusplus
}
#endif
Loading

0 comments on commit 3cfd539

Please sign in to comment.