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

Euclidean distance example #315

Merged
merged 6 commits into from
Sep 10, 2024

Conversation

abner-ma
Copy link
Contributor

@abner-ma abner-ma commented Sep 6, 2024

Add euclidean distance calculation example in c.

@abner-ma abner-ma requested a review from a team as a code owner September 6, 2024 05:07
Copy link

copy-pr-bot bot commented Sep 6, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions bot added the CMake label Sep 6, 2024
@cjnolet cjnolet added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Sep 6, 2024
Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @abner-ma! Just a couple brief and minor things. Overall, contributions like this are very welcome!

@@ -0,0 +1,105 @@
#include <cuvs/core/c_api.h>
Copy link
Member

Choose a reason for hiding this comment

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

Need the copyright here. You can copy this over from other files.

}
/* Ended by AICoder, pid:96cd0bcb6ad27b1149870b5f20ef16170f62a328 */

int calcL2Distance(int64_t n_cols,float x[], float y[], float *ret) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you provide some docs in this file, that briefly describe what the different steps are doing? Bonus points for function-level descriptions also (though not required).


int initResources(void){
// Create a cuvsResources_t object
cuvsResourcesCreate(&res);
Copy link
Member

Choose a reason for hiding this comment

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

Since these are one-liners anyways, it reduces the size of the code and clarity of the example to keep these inline in the example. Another small nitpick: we have intentionally named the C API functions consistently- cuvsNounVerb and changing that to verbNoun breaks this consistently. I'd keep initializeTensor below but rename it to tensor_initialize just to separate the casing from the C API. I'd also rename calcL2Distance to l2_distance_calc

@cjnolet
Copy link
Member

cjnolet commented Sep 6, 2024

/ok to test

@@ -0,0 +1,123 @@
/*
* Copyright (c) 2022-2024, NVIDIA CORPORATION.
Copy link
Member

Choose a reason for hiding this comment

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

Please only use the current year for new files.

Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@cjnolet
Copy link
Member

cjnolet commented Sep 10, 2024

/ok to test

@cjnolet
Copy link
Member

cjnolet commented Sep 10, 2024

/merge

@rapids-bot rapids-bot bot merged commit 1e9793e into rapidsai:branch-24.10 Sep 10, 2024
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
Development

Successfully merging this pull request may close these issues.

2 participants