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

Reconciling primitives moved to RAFT #4583

Merged
merged 54 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
d615950
Using metrics from raft
cjnolet Feb 16, 2022
142b328
Updating
cjnolet Feb 16, 2022
ad03b86
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Feb 16, 2022
9722d08
Adding knn back
cjnolet Feb 16, 2022
8b1de6b
Updating copyrights
cjnolet Feb 16, 2022
5ea7a91
Adding specializations for knn gtests
cjnolet Feb 17, 2022
11e50ca
adding more specializations
cjnolet Feb 17, 2022
7cc8d21
More specializations
cjnolet Feb 17, 2022
e08dea6
Updating style
cjnolet Feb 17, 2022
41a1c5e
No longer building brute_force_knn prim anywhere
cjnolet Feb 18, 2022
a421dab
Fixing style
cjnolet Feb 18, 2022
bb474e2
Fixing copyright and removing a couple more distance funcs
cjnolet Feb 18, 2022
f5b3c66
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Feb 18, 2022
dbde267
Removing prims moved over to raft
cjnolet Feb 18, 2022
80428f1
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Feb 19, 2022
375142e
Reverting get_raft cmake
cjnolet Feb 19, 2022
8d57a72
Using distance already specialized
cjnolet Feb 19, 2022
de49049
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Feb 23, 2022
53d730a
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Mar 1, 2022
004d215
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Mar 17, 2022
0172a5b
Merge branch 'branch-22.04' into imp-2204-metrics_to_raft
cjnolet Mar 30, 2022
d95746a
updating get_raft
cjnolet Mar 30, 2022
3f24aea
Fixing includes
cjnolet Mar 30, 2022
1583169
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Mar 31, 2022
1ba60f5
Removing raft allocator from gram
cjnolet Mar 31, 2022
48edbc5
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Apr 5, 2022
d49a04e
Merge remote-tracking branch 'rapidsai/branch-22.06' into imp-2204-me…
cjnolet Apr 5, 2022
0e0e693
Removing prims benchmarks which are being moved to raft
cjnolet Apr 6, 2022
bfeeafb
Fixing completeness score
cjnolet Apr 6, 2022
9985e69
Fixing completeness score for now
cjnolet Apr 6, 2022
8663dc9
Fixing get_raft.cmake
cjnolet Apr 7, 2022
74d5be0
Merge remote-tracking branch 'rapidsai/branch-22.06' into imp-2204-me…
cjnolet May 13, 2022
0510bb5
Merge remote-tracking branch 'rapidsai/branch-22.06' into imp-2204-me…
cjnolet May 24, 2022
4571f06
Merge remote-tracking branch 'rapidsai/branch-22.08' into imp-2204-me…
cjnolet Jun 2, 2022
acee2f7
Merge remote-tracking branch 'rapidsai/branch-22.08' into imp-2204-me…
cjnolet Jun 6, 2022
756fa29
Merge branch 'branch-22.10' into imp-2204-metrics_to_raft
cjnolet Oct 3, 2022
352e6fb
emoving more files
cjnolet Oct 3, 2022
873e277
Fixing style
cjnolet Oct 3, 2022
74e1888
Merge remote-tracking branch 'rapidsai/branch-22.12' into imp-2204-me…
cjnolet Oct 14, 2022
e1fb7b7
Fixing sv test
cjnolet Oct 14, 2022
ee4b0e9
Fixing svm test
cjnolet Oct 15, 2022
2f641d6
Fixing style
cjnolet Oct 15, 2022
d05f754
Fixing more style
cjnolet Oct 15, 2022
5c27e9f
Removing gram test
cjnolet Oct 15, 2022
1e5c2be
Adding knn classify/regress tests back in
cjnolet Oct 15, 2022
c97694e
Fixing information criterion use
cjnolet Oct 15, 2022
011ebb0
Fixing bad merge
cjnolet Oct 15, 2022
1fe951b
Still fixing bad merge
cjnolet Oct 15, 2022
0d67a29
Removing duplicated labels prims
cjnolet Oct 16, 2022
a7ee4a8
Final cleanup
cjnolet Oct 16, 2022
9c0d308
Reverting get_raft.cmake
cjnolet Oct 18, 2022
edee19c
Fixing header definition and namespace for kernel gram API
cjnolet Oct 18, 2022
2a26900
Fixing style
cjnolet Oct 18, 2022
977690f
Fixing small error in v_measure
cjnolet Oct 19, 2022
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
6 changes: 2 additions & 4 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ option(BUILD_CUML_MG_TESTS "Build cuML multigpu algorithm tests" OFF)
option(BUILD_PRIMS_TESTS "Build ml-prim tests" ON)
option(BUILD_CUML_EXAMPLES "Build C++ API usage examples" ON)
option(BUILD_CUML_BENCH "Build cuML C++ benchmark tests" ON)
option(BUILD_CUML_PRIMS_BENCH "Build ml-prims C++ benchmark tests" ON)
option(BUILD_CUML_STD_COMMS "Build the standard NCCL+UCX Communicator" ON)
option(BUILD_CUML_MPI_COMMS "Build the MPI+NCCL Communicator (used for testing)" OFF)
option(CUDA_ENABLE_KERNEL_INFO "Enable kernel resource usage info" OFF)
Expand All @@ -80,7 +79,6 @@ message(VERBOSE "CUML_CPP: Building cuML multigpu algorithm tests: ${BUILD_CUML_
message(VERBOSE "CUML_CPP: Building ml-prims tests: ${BUILD_PRIMS_TESTS}")
message(VERBOSE "CUML_CPP: Building C++ API usage examples: ${BUILD_CUML_EXAMPLES}")
message(VERBOSE "CUML_CPP: Building cuML C++ benchmark tests: ${BUILD_CUML_BENCH}")
message(VERBOSE "CUML_CPP: Building ml-prims C++ benchmark tests: ${BUILD_CUML_PRIMS_BENCH}")
message(VERBOSE "CUML_CPP: Building the standard NCCL+UCX Communicator: ${BUILD_CUML_STD_COMMS}")
message(VERBOSE "CUML_CPP: Building the MPI+NCCL Communicator (used for testing): ${BUILD_CUML_MPI_COMMS}")
message(VERBOSE "CUML_CPP: Enabling detection of conda environment for dependencies: ${DETECT_CONDA_ENV}")
Expand Down Expand Up @@ -244,7 +242,7 @@ if(BUILD_CUML_TESTS OR BUILD_PRIMS_TESTS)
include(cmake/thirdparty/get_gtest.cmake)
endif()

if(BUILD_CUML_BENCH OR BUILD_CUML_PRIMS_BENCH)
if(BUILD_CUML_BENCH)
include(cmake/thirdparty/get_gbench.cmake)
endif()

Expand Down Expand Up @@ -692,7 +690,7 @@ rapids_export(BUILD cuml
##############################################################################
# - build benchmark executable -----------------------------------------------

if(BUILD_CUML_BENCH OR BUILD_CUML_PRIMS_BENCH)
if(BUILD_CUML_BENCH)
add_subdirectory(bench)
endif()

Expand Down
45 changes: 1 addition & 44 deletions cpp/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,47 +66,4 @@ if(BUILD_CUML_BENCH)
DESTINATION bin/benchmarks/libcuml
EXCLUDE_FROM_ALL
)
endif()

##############################################################################
# - build prims bench executable ----------------------------------------------

if(BUILD_CUML_PRIMS_BENCH)
# (please keep the filenames in alphabetical order)
add_executable(${PRIMS_BENCH_TARGET}
prims/gram_matrix.cu
prims/main.cpp)

target_compile_options(${PRIMS_BENCH_TARGET}
PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUML_CXX_FLAGS}>"
"$<$<COMPILE_LANGUAGE:CUDA>:${CUML_CUDA_FLAGS}>"
)

target_link_libraries(${PRIMS_BENCH_TARGET}
PUBLIC
cuml::${CUML_CPP_TARGET}
benchmark::benchmark
${TREELITE_LIBS}
raft::raft
raft::nn
raft::distance
)

target_include_directories(${PRIMS_BENCH_TARGET}
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../src_prims>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

set_target_properties(
${PRIMS_BENCH_TARGET}
PROPERTIES INSTALL_RPATH "\$ORIGIN/../../../lib"
)

install(
TARGETS ${PRIMS_BENCH_TARGET}
COMPONENT testing
DESTINATION bin/benchmarks/libcuml_prims
EXCLUDE_FROM_ALL
)
endif()
endif()
138 changes: 0 additions & 138 deletions cpp/bench/prims/gram_matrix.cu

This file was deleted.

19 changes: 0 additions & 19 deletions cpp/bench/prims/main.cpp

This file was deleted.

20 changes: 12 additions & 8 deletions cpp/bench/sg/svc.cu
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
* limitations under the License.
*/

#if defined RAFT_DISTANCE_COMPILED
#include <raft/distance/specializations.cuh>
#endif

#include "benchmark.cuh"
#include <cmath>
#include <cuml/matrix/kernelparams.h>
#include <cuml/svm/svc.hpp>
#include <cuml/svm/svm_model.h>
#include <cuml/svm/svm_parameter.h>
#include <raft/distance/kernels.cuh>
#include <sstream>
#include <utility>

Expand All @@ -31,7 +35,7 @@ template <typename D>
struct SvcParams {
DatasetParams data;
BlobsParams blobs;
MLCommon::Matrix::KernelParams kernel;
raft::distance::kernels::KernelParams kernel;
ML::SVM::SvmParameter svm_param;
ML::SVM::SvmModel<D> model;
};
Expand Down Expand Up @@ -74,7 +78,7 @@ class SVC : public BlobsFixture<D, D> {
}

private:
MLCommon::Matrix::KernelParams kernel;
raft::distance::kernels::KernelParams kernel;
ML::SVM::SvmParameter svm_param;
ML::SVM::SvmModel<D> model;
};
Expand Down Expand Up @@ -102,11 +106,11 @@ std::vector<SvcParams<D>> getInputs()

std::vector<Triplets> rowcols = {{50000, 2, 2}, {2048, 100000, 2}, {50000, 1000, 2}};

std::vector<MLCommon::Matrix::KernelParams> kernels{
MLCommon::Matrix::KernelParams{MLCommon::Matrix::LINEAR, 3, 1, 0},
MLCommon::Matrix::KernelParams{MLCommon::Matrix::POLYNOMIAL, 3, 1, 0},
MLCommon::Matrix::KernelParams{MLCommon::Matrix::RBF, 3, 1, 0},
MLCommon::Matrix::KernelParams{MLCommon::Matrix::TANH, 3, 0.1, 0}};
std::vector<raft::distance::kernels::KernelParams> kernels{
raft::distance::kernels::KernelParams{raft::distance::kernels::LINEAR, 3, 1, 0},
raft::distance::kernels::KernelParams{raft::distance::kernels::POLYNOMIAL, 3, 1, 0},
raft::distance::kernels::KernelParams{raft::distance::kernels::RBF, 3, 1, 0},
raft::distance::kernels::KernelParams{raft::distance::kernels::TANH, 3, 0.1, 0}};

for (auto& rc : rowcols) {
p.data.nrows = rc.nrows;
Expand Down
20 changes: 12 additions & 8 deletions cpp/bench/sg/svr.cu
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
* limitations under the License.
*/

#if defined RAFT_DISTANCE_COMPILED
#include <raft/distance/specializations.cuh>
#endif

#include "benchmark.cuh"
#include <cmath>
#include <cuml/matrix/kernelparams.h>
#include <cuml/svm/svc.hpp>
#include <cuml/svm/svm_model.h>
#include <cuml/svm/svm_parameter.h>
#include <cuml/svm/svr.hpp>
#include <raft/distance/kernels.cuh>
#include <utility>

namespace ML {
Expand All @@ -31,7 +35,7 @@ template <typename D>
struct SvrParams {
DatasetParams data;
RegressionParams regression;
MLCommon::Matrix::KernelParams kernel;
raft::distance::kernels::KernelParams kernel;
ML::SVM::SvmParameter svm_param;
ML::SVM::SvmModel<D>* model;
};
Expand Down Expand Up @@ -73,7 +77,7 @@ class SVR : public RegressionFixture<D> {
}

private:
MLCommon::Matrix::KernelParams kernel;
raft::distance::kernels::KernelParams kernel;
ML::SVM::SvmParameter svm_param;
ML::SVM::SvmModel<D>* model;
};
Expand Down Expand Up @@ -104,11 +108,11 @@ std::vector<SvrParams<D>> getInputs()

std::vector<Triplets> rowcols = {{50000, 2, 2}, {1024, 10000, 10}, {3000, 200, 200}};

std::vector<MLCommon::Matrix::KernelParams> kernels{
MLCommon::Matrix::KernelParams{MLCommon::Matrix::LINEAR, 3, 1, 0},
MLCommon::Matrix::KernelParams{MLCommon::Matrix::POLYNOMIAL, 3, 1, 0},
MLCommon::Matrix::KernelParams{MLCommon::Matrix::RBF, 3, 1, 0},
MLCommon::Matrix::KernelParams{MLCommon::Matrix::TANH, 3, 0.1, 0}};
std::vector<raft::distance::kernels::KernelParams> kernels{
raft::distance::kernels::KernelParams{raft::distance::kernels::LINEAR, 3, 1, 0},
raft::distance::kernels::KernelParams{raft::distance::kernels::POLYNOMIAL, 3, 1, 0},
raft::distance::kernels::KernelParams{raft::distance::kernels::RBF, 3, 1, 0},
raft::distance::kernels::KernelParams{raft::distance::kernels::TANH, 3, 0.1, 0}};

for (auto& rc : rowcols) {
p.data.nrows = rc.nrows;
Expand Down
23 changes: 5 additions & 18 deletions cpp/include/cuml/matrix/kernelparams.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-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,26 +16,13 @@

#pragma once

#include <raft/distance/distance_types.hpp>

namespace MLCommon {
namespace Matrix {

enum KernelType { LINEAR, POLYNOMIAL, RBF, TANH };

/**
* Parameters for kernel matrices.
* The following kernels are implemented:
* - LINEAR \f[ K(x_1,x_2) = <x_1,x_2>, \f] where \f$< , >\f$ is the dot product
* - POLYNOMIAL \f[ K(x_1, x_2) = (\gamma <x_1,x_2> + \mathrm{coef0})^\mathrm{degree} \f]
* - RBF \f[ K(x_1, x_2) = \exp(- \gamma |x_1-x_2|^2) \f]
* - TANH \f[ K(x_1, x_2) = \tanh(\gamma <x_1,x_2> + \mathrm{coef0}) \f]
*/
struct KernelParams {
// Kernel function parameters
KernelType kernel; //!< Type of the kernel function
int degree; //!< Degree of polynomial kernel (ignored by others)
double gamma; //!< multiplier in the
double coef0; //!< additive constant in poly and tanh kernels
};
using raft::distance::kernels::KernelParams;
using raft::distance::kernels::KernelType;

}; // end namespace Matrix
}; // end namespace MLCommon
Loading