Skip to content

Commit

Permalink
Delete the deprecated data_type_id_t enum (#4737)
Browse files Browse the repository at this point in the history
Prep work for temporal graphs.  We renamed `data_type_id_t` to `cugraph_data_id_t` about 8 months ago, this finishes the transition.  We also split the types out into their own file in the C API.

Marked as breaking since we are deleting a deprecated type from the C API.

Authors:
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Ralph Liu (https://github.com/nv-rliu)

Approvers:
  - Seunghwa Kang (https://github.com/seunghwak)
  - Rick Ratzel (https://github.com/rlratzel)

URL: #4737
  • Loading branch information
ChuckHastings authored Oct 29, 2024
1 parent e892fc2 commit 3224a65
Show file tree
Hide file tree
Showing 87 changed files with 562 additions and 407 deletions.
17 changes: 2 additions & 15 deletions cpp/include/cugraph_c/resource_handle.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
* Copyright (c) 2022-2024, 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/types.h>

#include <stddef.h>
#include <stdint.h>
Expand All @@ -25,20 +26,6 @@
extern "C" {
#endif

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

typedef int8_t byte_t;

/**
* @deprecated - use cugraph_data_type_id_t;
*/
typedef enum data_type_id_ { INT32 = 0, INT64, FLOAT32, FLOAT64, SIZE_T, NTYPES } data_type_id_t;

/**
* @brief - Enumeration of data types
*/
typedef data_type_id_t cugraph_data_type_id_t;

typedef struct cugraph_resource_handle_ {
int32_t align_;
} cugraph_resource_handle_t;
Expand Down
47 changes: 47 additions & 0 deletions cpp/include/cugraph_c/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2022-2024, 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 <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_ {
INT8 = 0,
INT16,
INT32,
INT64,
UINT8,
UINT16,
UINT32,
UINT64,
FLOAT32,
FLOAT64,
SIZE_T,
BOOL,
NTYPES
} cugraph_data_type_id_t;

#ifdef __cplusplus
}
#endif
3 changes: 2 additions & 1 deletion cpp/src/c_api/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
namespace cugraph {
namespace c_api {

size_t data_type_sz[] = {4, 8, 4, 8, 8};
// FIXME: This is paired with type definition... better solution coming in 24.12 release.
size_t data_type_sz[] = {1, 2, 4, 8, 1, 2, 4, 8, 4, 8, 8, 1};

} // namespace c_api
} // namespace cugraph
Expand Down
70 changes: 35 additions & 35 deletions cpp/tests/c_api/biased_neighbor_sample_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ typedef int32_t vertex_t;
typedef int32_t edge_t;
typedef float weight_t;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

int vertex_id_compare_function(const void* a, const void* b)
{
Expand Down Expand Up @@ -468,11 +468,11 @@ int generic_biased_neighbor_sample_test(const cugraph_resource_handle_t* handle,

int test_biased_neighbor_sample_with_labels(const cugraph_resource_handle_t* handle)
{
data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

size_t num_edges = 8;
size_t num_vertices = 6;
Expand Down Expand Up @@ -686,11 +686,11 @@ int test_biased_neighbor_sample_with_labels(const cugraph_resource_handle_t* han

int test_biased_neighbor_sample_clean(const cugraph_resource_handle_t* handle)
{
data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

size_t num_edges = 9;
size_t num_vertices = 6;
Expand Down Expand Up @@ -740,11 +740,11 @@ int test_biased_neighbor_sample_clean(const cugraph_resource_handle_t* handle)

int test_biased_neighbor_sample_dedupe_sources(const cugraph_resource_handle_t* handle)
{
data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

size_t num_edges = 9;
size_t num_vertices = 6;
Expand Down Expand Up @@ -794,11 +794,11 @@ int test_biased_neighbor_sample_dedupe_sources(const cugraph_resource_handle_t*

int test_biased_neighbor_sample_unique_sources(const cugraph_resource_handle_t* handle)
{
data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

size_t num_edges = 9;
size_t num_vertices = 6;
Expand Down Expand Up @@ -848,11 +848,11 @@ int test_biased_neighbor_sample_unique_sources(const cugraph_resource_handle_t*

int test_biased_neighbor_sample_carry_over_sources(const cugraph_resource_handle_t* handle)
{
data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

size_t num_edges = 9;
size_t num_vertices = 6;
Expand Down Expand Up @@ -902,11 +902,11 @@ int test_biased_neighbor_sample_carry_over_sources(const cugraph_resource_handle

int test_biased_neighbor_sample_renumber_results(const cugraph_resource_handle_t* handle)
{
data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

size_t num_edges = 9;
size_t num_vertices = 6;
Expand Down
10 changes: 5 additions & 5 deletions cpp/tests/c_api/c_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ int create_test_graph_double(const cugraph_resource_handle_t* p_handle,
cugraph_error_t** ret_error);

int create_sg_test_graph(const cugraph_resource_handle_t* handle,
data_type_id_t vertex_tid,
data_type_id_t edge_tid,
cugraph_data_type_id_t vertex_tid,
cugraph_data_type_id_t edge_tid,
void* h_src,
void* h_dst,
data_type_id_t weight_tid,
cugraph_data_type_id_t weight_tid,
void* h_wgt,
data_type_id_t edge_type_tid,
cugraph_data_type_id_t edge_type_tid,
void* h_edge_type,
data_type_id_t edge_id_tid,
cugraph_data_type_id_t edge_id_tid,
void* h_edge_id,
size_t num_edges,
bool_t store_transposed,
Expand Down
10 changes: 5 additions & 5 deletions cpp/tests/c_api/count_multi_edges_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ typedef int32_t vertex_t;
typedef int32_t edge_t;
typedef float weight_t;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

/*
* Create graph and count multi-edges
Expand Down
36 changes: 18 additions & 18 deletions cpp/tests/c_api/create_graph_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ int test_create_sg_graph_simple()
properties.is_symmetric = FALSE;
properties.is_multigraph = FALSE;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;

handle = cugraph_create_resource_handle(NULL);
TEST_ASSERT(test_ret_value, handle != NULL, "resource handle creation failed.");
Expand Down Expand Up @@ -161,9 +161,9 @@ int test_create_sg_graph_csr()
properties.is_symmetric = FALSE;
properties.is_multigraph = FALSE;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;

handle = cugraph_create_resource_handle(NULL);
TEST_ASSERT(test_ret_value, handle != NULL, "resource handle creation failed.");
Expand Down Expand Up @@ -355,9 +355,9 @@ int test_create_sg_graph_symmetric_error()
properties.is_symmetric = TRUE;
properties.is_multigraph = FALSE;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;

handle = cugraph_create_resource_handle(NULL);
TEST_ASSERT(test_ret_value, handle != NULL, "resource handle creation failed.");
Expand Down Expand Up @@ -462,9 +462,9 @@ int test_create_sg_graph_with_isolated_vertices()
properties.is_symmetric = FALSE;
properties.is_multigraph = FALSE;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;

handle = cugraph_create_resource_handle(NULL);
TEST_ASSERT(test_ret_value, handle != NULL, "resource handle creation failed.");
Expand Down Expand Up @@ -626,9 +626,9 @@ int test_create_sg_graph_csr_with_isolated()
properties.is_symmetric = FALSE;
properties.is_multigraph = FALSE;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;

handle = cugraph_create_resource_handle(NULL);
TEST_ASSERT(test_ret_value, handle != NULL, "resource handle creation failed.");
Expand Down Expand Up @@ -778,9 +778,9 @@ int test_create_sg_graph_with_isolated_vertices_multi_input()
properties.is_symmetric = FALSE;
properties.is_multigraph = FALSE;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;

handle = cugraph_create_resource_handle(NULL);
TEST_ASSERT(test_ret_value, handle != NULL, "resource handle creation failed.");
Expand Down
10 changes: 5 additions & 5 deletions cpp/tests/c_api/ecg_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ int generic_ecg_test(vertex_t* h_src,
cugraph_graph_t* graph = NULL;
cugraph_hierarchical_clustering_result_t* result = NULL;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

handle = cugraph_create_resource_handle(NULL);
TEST_ASSERT(test_ret_value, handle != NULL, "resource handle creation failed.");
Expand Down
10 changes: 5 additions & 5 deletions cpp/tests/c_api/egonet_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ int generic_egonet_test(vertex_t* h_src,
cugraph_error_code_t ret_code = CUGRAPH_SUCCESS;
cugraph_error_t* ret_error;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

cugraph_resource_handle_t* resource_handle = NULL;
cugraph_graph_t* graph = NULL;
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/c_api/induced_subgraph_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ int generic_induced_subgraph_test(vertex_t* h_src,

cugraph_induced_subgraph_result_t* result = NULL;

data_type_id_t vertex_tid = INT32;
data_type_id_t size_t_tid = SIZE_T;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t size_t_tid = SIZE_T;

handle = cugraph_create_resource_handle(NULL);
TEST_ASSERT(test_ret_value, handle != NULL, "resource handle creation failed.");
Expand Down
11 changes: 6 additions & 5 deletions cpp/tests/c_api/k_core_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include "c_test_utils.h" /* RUN_TEST */
#include "cugraph_c/types.h"

#include <cugraph_c/algorithms.h>
#include <cugraph_c/array.h>
Expand Down Expand Up @@ -43,11 +44,11 @@ int generic_k_core_test(vertex_t* h_src,
cugraph_error_code_t ret_code = CUGRAPH_SUCCESS;
cugraph_error_t* ret_error;

data_type_id_t vertex_tid = INT32;
data_type_id_t edge_tid = INT32;
data_type_id_t weight_tid = FLOAT32;
data_type_id_t edge_id_tid = INT32;
data_type_id_t edge_type_tid = INT32;
cugraph_data_type_id_t vertex_tid = INT32;
cugraph_data_type_id_t edge_tid = INT32;
cugraph_data_type_id_t weight_tid = FLOAT32;
cugraph_data_type_id_t edge_id_tid = INT32;
cugraph_data_type_id_t edge_type_tid = INT32;

cugraph_resource_handle_t* resource_handle = NULL;
cugraph_graph_t* graph = NULL;
Expand Down
Loading

0 comments on commit 3224a65

Please sign in to comment.