Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 2 additions & 3 deletions python/cuml/cuml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
libcuml.load_library()
del libcuml

import cuml.common.cuda as cuda
from pylibraft.common import Handle

import cuml.feature_extraction
from cuml._version import __git_commit__, __version__
from cuml.cluster.agglomerative import AgglomerativeClustering
from cuml.cluster.dbscan import DBSCAN
from cuml.cluster.hdbscan import HDBSCAN
from cuml.cluster.kmeans import KMeans
from cuml.common.handle import Handle
from cuml.common.pointer_utils import device_of_gpu_matrix
from cuml.datasets.arima import make_arima
from cuml.datasets.blobs import make_blobs
Expand Down Expand Up @@ -116,7 +116,6 @@ def __getattr__(name):
"AutoARIMA",
"Base",
"CD",
"cuda",
"DBSCAN",
"ElasticNet",
"ExponentialSmoothing",
Expand Down
2 changes: 0 additions & 2 deletions python/cuml/cuml/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# =============================================================================

set(cython_sources "")
add_module_gpu_default("cuda.pyx")
add_module_gpu_default("handle.pyx")
add_module_gpu_default("pointer_utils.pyx")

if(NOT SINGLEGPU)
Expand Down
30 changes: 0 additions & 30 deletions python/cuml/cuml/common/cuda.pxd

This file was deleted.

81 changes: 0 additions & 81 deletions python/cuml/cuml/common/cuda.pyx

This file was deleted.

21 changes: 0 additions & 21 deletions python/cuml/cuml/common/handle.pyx

This file was deleted.

2 changes: 0 additions & 2 deletions python/cuml/cuml/ensemble/randomforest_shared.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ from cuml.internals.base import Base

from pylibraft.common.handle cimport handle_t

cimport cuml.common.cuda


cdef extern from "treelite/c_api.h":
ctypedef void* TreeliteModelHandle
Expand Down
1 change: 0 additions & 1 deletion python/cuml/cuml/ensemble/randomforestclassifier.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ from libc.stdint cimport uint64_t, uintptr_t
from libcpp cimport bool
from pylibraft.common.handle cimport handle_t

cimport cuml.common.cuda
from cuml.ensemble.randomforest_shared cimport *
from cuml.internals.logger cimport level_enum

Expand Down
2 changes: 0 additions & 2 deletions python/cuml/cuml/ensemble/randomforestregressor.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ from libc.stdint cimport uint64_t, uintptr_t
from libcpp cimport bool
from pylibraft.common.handle cimport handle_t

cimport cuml.common.cuda


cdef extern from "cuml/ensemble/randomforest.hpp" namespace "ML":

Expand Down
5 changes: 2 additions & 3 deletions python/cuml/cuml/internals/base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ from cupy import ndarray as cp_ndarray
import cuml
import cuml.accel
import cuml.common
import cuml.common.cuda
import cuml.internals
import cuml.internals.input_utils
import cuml.internals.logger as logger
Expand Down Expand Up @@ -218,15 +217,15 @@ class Base(TagsMixin,

# stream and handle example:

stream = cuml.common.cuda.Stream()
stream = pylibraft.common.Stream()
handle = pylibraft.common.Handle(stream=stream)

algo = MyAlgo(handle=handle)
algo.fit(...)
result = algo.predict(...)

# final sync of all gpu-work launched inside this object
# this is same as `cuml.cuda.Stream.sync()` call, but safer in case
# this is same as `pylibraft.common.Stream.sync()` call, but safer in case
# the default stream inside the `raft::handle_t` is being used
base.handle.sync()
del base # optional!
Expand Down
2 changes: 0 additions & 2 deletions python/cuml/cuml/legacy/fil/fil.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ from rmm.pylibrmm.memory_resource cimport (

import treelite.sklearn as tl_skl

cimport cuml.common.cuda


cdef extern from "treelite/c_api.h":
cdef struct TreelitePyBufferFrame:
Expand Down
1 change: 0 additions & 1 deletion python/cuml/cuml/manifold/t_sne.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ from libc.stdint cimport int64_t, uintptr_t
from libc.stdlib cimport free
from libcpp cimport bool

cimport cuml.common.cuda
from cuml.metrics.distance_type cimport DistanceType


Expand Down
2 changes: 0 additions & 2 deletions python/cuml/cuml/metrics/cluster/adjusted_rand_index.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ from cuml.common import input_to_cuml_array
from libc.stdint cimport uintptr_t
from pylibraft.common.handle cimport handle_t

cimport cuml.common.cuda


cdef extern from "cuml/metrics/metrics.hpp" namespace "ML::Metrics":

Expand Down
2 changes: 0 additions & 2 deletions python/cuml/cuml/metrics/cluster/entropy.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ from cuml.internals.input_utils import input_to_cupy_array
from libc.stdint cimport uintptr_t
from pylibraft.common.handle cimport handle_t

cimport cuml.common.cuda


cdef extern from "cuml/metrics/metrics.hpp" namespace "ML::Metrics":
double entropy(const handle_t &handle,
Expand Down
2 changes: 0 additions & 2 deletions python/cuml/cuml/neighbors/kneighbors_classifier.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ from libc.stdint cimport int64_t, uintptr_t
from libcpp.vector cimport vector
from pylibraft.common.handle cimport handle_t

cimport cuml.common.cuda


cdef extern from "cuml/neighbors/knn.hpp" namespace "ML":

Expand Down
2 changes: 0 additions & 2 deletions python/cuml/cuml/neighbors/kneighbors_regressor.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ from libc.stdint cimport int64_t, uintptr_t
from libcpp.vector cimport vector
from pylibraft.common.handle cimport handle_t

cimport cuml.common.cuda


cdef extern from "cuml/neighbors/knn.hpp" namespace "ML":

Expand Down
1 change: 0 additions & 1 deletion python/cuml/cuml/neighbors/nearest_neighbors.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ from libcpp cimport bool
from libcpp.vector cimport vector
from pylibraft.common.handle cimport handle_t

cimport cuml.common.cuda
from cuml.metrics.distance_type cimport DistanceType
from cuml.metrics.raft_distance_type cimport DistanceType as RaftDistanceType
from cuml.neighbors.ann cimport *
Expand Down
11 changes: 3 additions & 8 deletions python/cuml/cuml/tests/test_svm.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,7 @@ def get_memsize(svc):
"n_iter", [unit_param(10), quality_param(100), stress_param(1000)]
)
@pytest.mark.parametrize("n_cols", [1000])
@pytest.mark.parametrize("use_handle", [True, False])
def test_svm_memleak(
params, n_rows, n_iter, n_cols, use_handle, dataset="blobs"
):
def test_svm_memleak(params, n_rows, n_iter, n_cols, dataset="blobs"):
"""
Test whether there is any memory leak.

Expand All @@ -464,8 +461,7 @@ def test_svm_memleak(

"""
X_train, X_test, y_train, y_test = make_dataset(dataset, n_rows, n_cols)
stream = cuml.cuda.Stream()
handle = cuml.Handle(stream=stream)
handle = cuml.Handle()
Comment thread
betatim marked this conversation as resolved.
# Warmup. Some modules that are used in SVC allocate space on the device
# and consume memory. Here we make sure that this allocation is done
# before the first call to get_memory_info.
Expand Down Expand Up @@ -519,8 +515,7 @@ def test_svm_memleak_on_exception(
n_samples=n_rows, n_features=n_cols, random_state=137, centers=2
)
X_train = X_train.astype(np.float32)
stream = cuml.cuda.Stream()
handle = cuml.Handle(stream=stream)
handle = cuml.Handle()

# Warmup. Some modules that are used in SVC allocate space on the device
# and consume memory. Here we make sure that this allocation is done
Expand Down