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

Delete the deprecated data_type_id_t enum #4737

Merged
merged 7 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
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
41 changes: 41 additions & 0 deletions cpp/include/cugraph_c/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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_ {
INT32 = 0,
INT64,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add INT8, INT16, UINT8, UINT16, UINT32, UINT64?

These may become necessary in some algorithms in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add these types but don't explicitly instantiate for these types, the cost is pretty minimal, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep the cost minimal. I have added them in the next push.

FLOAT32,
FLOAT64,
SIZE_T,
BOOL,
NTYPES
} cugraph_data_type_id_t;

#ifdef __cplusplus
}
#endif
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
10 changes: 5 additions & 5 deletions cpp/tests/c_api/k_truss_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ int generic_k_truss_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
Loading