Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 5 additions & 2 deletions python/cuml/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,11 @@ def _get_gpu_memory():
if len(tokens) > 1:
gpus_memory.append(int(tokens[0]))
gpus_memory.sort()
max_gpu_memory = ceil(gpus_memory[-1] / 1024)
return max_gpu_memory
if len(gpus_memory) > 0:
max_gpu_memory = ceil(gpus_memory[-1] / 1024)
return max_gpu_memory
else:
return None


# =============================================================================
Expand Down
8 changes: 5 additions & 3 deletions python/cuml/tests/dask/test_dask_tsvd.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
)
@pytest.mark.parametrize("input_type", ["dataframe", "array"])
def test_pca_fit(data_info, input_type, client):
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

nrows, ncols, n_parts = data_info
if nrows == int(9e6) and pytest.max_gpu_memory < 48:
if nrows == int(9e6) and max_gpu_memory < 48:
if pytest.adapt_stress_test:
nrows = nrows * pytest.max_gpu_memory // 256
ncols = ncols * pytest.max_gpu_memory // 256
nrows = nrows * max_gpu_memory // 256
ncols = ncols * max_gpu_memory // 256
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down
14 changes: 10 additions & 4 deletions python/cuml/tests/test_dbscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,15 @@ def test_dbscan(
out_dtype,
algorithm,
):
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

if algorithm == "rbc":
if datatype == np.float64 or out_dtype in ["int32", np.int32]:
pytest.skip("RBC does not support float64 dtype or int32 labels")
if nrows == 500000 and pytest.max_gpu_memory < 32:
if nrows == 500000 and max_gpu_memory < 32:
if pytest.adapt_stress_test:
nrows = nrows * pytest.max_gpu_memory // 32
nrows = nrows * max_gpu_memory // 32
else:
pytest.skip(
"Insufficient GPU memory for this test. "
Expand Down Expand Up @@ -213,9 +216,12 @@ def test_dbscan_cosine(nrows, max_mbytes_per_batch, out_dtype):
# Vary the eps to get a range of core point counts
@pytest.mark.parametrize("eps", [0.05, 0.1, 0.5])
def test_dbscan_sklearn_comparison(name, nrows, eps):
if nrows == 500000 and name == "blobs" and pytest.max_gpu_memory < 32:
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

if nrows == 500000 and name == "blobs" and max_gpu_memory < 32:
if pytest.adapt_stress_test:
nrows = nrows * pytest.max_gpu_memory // 32
nrows = nrows * max_gpu_memory // 32
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down
7 changes: 5 additions & 2 deletions python/cuml/tests/test_lars.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ def test_lars_model(datatype, nrows, column_info, precompute):
)
@pytest.mark.parametrize("precompute", [True, False])
def test_lars_collinear(datatype, nrows, column_info, precompute):
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

ncols, n_info = column_info
if nrows == 500000 and ncols == 1000 and pytest.max_gpu_memory < 32:
if nrows == 500000 and ncols == 1000 and max_gpu_memory < 32:
if pytest.adapt_stress_test:
nrows = nrows * pytest.max_gpu_memory // 32
nrows = nrows * max_gpu_memory // 32
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down
11 changes: 5 additions & 6 deletions python/cuml/tests/test_mbsgd_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@
)
def make_dataset(request):
nrows, ncols, n_info, datatype = request.param
if (
nrows == 500000
and datatype == np.float64
and pytest.max_gpu_memory < 32
):
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

if nrows == 500000 and datatype == np.float64 and max_gpu_memory < 32:
if pytest.adapt_stress_test:
nrows = nrows * pytest.max_gpu_memory // 32
nrows = nrows * max_gpu_memory // 32
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down
21 changes: 15 additions & 6 deletions python/cuml/tests/test_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,13 @@ def test_pca_defaults(n_samples, n_features, sparse):
"name", [unit_param(None), quality_param("iris"), stress_param("blobs")]
)
def test_pca_fit_then_transform(datatype, input_type, name, use_handle):
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

blobs_n_samples = 500000
if name == "blobs" and pytest.max_gpu_memory < 32:
if name == "blobs" and max_gpu_memory < 32:
if pytest.adapt_stress_test:
blobs_n_samples = int(blobs_n_samples * pytest.max_gpu_memory / 32)
blobs_n_samples = int(blobs_n_samples * max_gpu_memory / 32)
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down Expand Up @@ -193,11 +196,14 @@ def test_pca_fit_then_transform(datatype, input_type, name, use_handle):
"name", [unit_param(None), quality_param("iris"), stress_param("blobs")]
)
def test_pca_fit_transform(datatype, input_type, name, use_handle):
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

blobs_n_samples = 500000

if name == "blobs" and pytest.max_gpu_memory < 32:
if name == "blobs" and max_gpu_memory < 32:
if pytest.adapt_stress_test:
blobs_n_samples = int(blobs_n_samples * pytest.max_gpu_memory / 32)
blobs_n_samples = int(blobs_n_samples * max_gpu_memory / 32)
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down Expand Up @@ -273,9 +279,12 @@ def test_pca_inverse_transform(datatype, input_type, name, use_handle, nrows):
@pytest.mark.parametrize("return_sparse", [True, False])
@pytest.mark.parametrize("cupy_input", [True, False])
def test_sparse_pca_inputs(nrows, ncols, whiten, return_sparse, cupy_input):
if ncols == 20000 and pytest.max_gpu_memory < 48:
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

if ncols == 20000 and max_gpu_memory < 48:
if pytest.adapt_stress_test:
ncols = int(ncols * pytest.max_gpu_memory / 48)
ncols = int(ncols * max_gpu_memory / 48)
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down
32 changes: 22 additions & 10 deletions python/cuml/tests/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,19 @@ def assert_model(pickled_model, X_test):
)
@pytest.mark.parametrize("fit_intercept", [True, False])
def test_regressor_pickle(tmpdir, datatype, keys, data_size, fit_intercept):
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

if (
data_size[0] == 500000
and datatype == np.float64
and ("LogisticRegression" in keys or "Ridge" in keys)
and pytest.max_gpu_memory < 32
and max_gpu_memory < 32
):
if pytest.adapt_stress_test:
data_size[0] = data_size[0] * pytest.max_gpu_memory // 640
data_size[1] = data_size[1] * pytest.max_gpu_memory // 640
data_size[2] = data_size[2] * pytest.max_gpu_memory // 640
data_size[0] = data_size[0] * max_gpu_memory // 640
data_size[1] = data_size[1] * max_gpu_memory // 640
data_size[2] = data_size[2] * max_gpu_memory // 640
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down Expand Up @@ -437,13 +440,16 @@ def test_unfit_clone(model_name):
[unit_param([500, 20, 10, 5]), stress_param([500000, 1000, 500, 50])],
)
def test_neighbors_pickle(tmpdir, datatype, keys, data_info):
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

if (
data_info[0] == 500000
and pytest.max_gpu_memory < 32
and max_gpu_memory < 32
and ("KNeighborsClassifier" in keys or "KNeighborsRegressor" in keys)
):
if pytest.adapt_stress_test:
data_info[0] = data_info[0] * pytest.max_gpu_memory // 32
data_info[0] = data_info[0] * max_gpu_memory // 32
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down Expand Up @@ -486,13 +492,16 @@ def assert_model(pickled_model, X_test):
)
@pytest.mark.parametrize("keys", k_neighbors_models.keys())
def test_k_neighbors_classifier_pickle(tmpdir, datatype, data_info, keys):
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

if (
data_info[0] == 500000
and "NearestNeighbors" in keys
and pytest.max_gpu_memory < 32
and max_gpu_memory < 32
):
if pytest.adapt_stress_test:
data_info[0] = data_info[0] * pytest.max_gpu_memory // 32
data_info[0] = data_info[0] * max_gpu_memory // 32
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down Expand Up @@ -561,9 +570,12 @@ def assert_model(loaded_model, X):
"data_size", [unit_param([500, 20, 10]), stress_param([500000, 1000, 500])]
)
def test_dbscan_pickle(tmpdir, datatype, keys, data_size):
if data_size[0] == 500000 and pytest.max_gpu_memory < 32:
# Assume at least 4GB memory
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4

if data_size[0] == 500000 and max_gpu_memory < 32:
if pytest.adapt_stress_test:
data_size[0] = data_size[0] * pytest.max_gpu_memory // 32
data_size[0] = data_size[0] * max_gpu_memory // 32
else:
pytest.skip(
"Insufficient GPU memory for this test."
Expand Down