Skip to content

Commit b4f2c85

Browse files
committed
Assuming at least 4GB memory
1 parent 2dc6c17 commit b4f2c85

6 files changed

Lines changed: 62 additions & 31 deletions

File tree

python/cuml/tests/dask/test_dask_tsvd.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@
2828
)
2929
@pytest.mark.parametrize("input_type", ["dataframe", "array"])
3030
def test_pca_fit(data_info, input_type, client):
31+
# Assume at least 4GB memory
32+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
3133

3234
nrows, ncols, n_parts = data_info
33-
if nrows == int(9e6) and pytest.max_gpu_memory < 48:
35+
if nrows == int(9e6) and max_gpu_memory < 48:
3436
if pytest.adapt_stress_test:
35-
nrows = nrows * pytest.max_gpu_memory // 256
36-
ncols = ncols * pytest.max_gpu_memory // 256
37+
nrows = nrows * max_gpu_memory // 256
38+
ncols = ncols * max_gpu_memory // 256
3739
else:
3840
pytest.skip(
3941
"Insufficient GPU memory for this test."

python/cuml/tests/test_dbscan.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,15 @@ def test_dbscan(
6262
out_dtype,
6363
algorithm,
6464
):
65+
# Assume at least 4GB memory
66+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
67+
6568
if algorithm == "rbc":
6669
if datatype == np.float64 or out_dtype in ["int32", np.int32]:
6770
pytest.skip("RBC does not support float64 dtype or int32 labels")
68-
if nrows == 500000 and pytest.max_gpu_memory < 32:
71+
if nrows == 500000 and max_gpu_memory < 32:
6972
if pytest.adapt_stress_test:
70-
nrows = nrows * pytest.max_gpu_memory // 32
73+
nrows = nrows * max_gpu_memory // 32
7174
else:
7275
pytest.skip(
7376
"Insufficient GPU memory for this test. "
@@ -213,9 +216,12 @@ def test_dbscan_cosine(nrows, max_mbytes_per_batch, out_dtype):
213216
# Vary the eps to get a range of core point counts
214217
@pytest.mark.parametrize("eps", [0.05, 0.1, 0.5])
215218
def test_dbscan_sklearn_comparison(name, nrows, eps):
216-
if nrows == 500000 and name == "blobs" and pytest.max_gpu_memory < 32:
219+
# Assume at least 4GB memory
220+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
221+
222+
if nrows == 500000 and name == "blobs" and max_gpu_memory < 32:
217223
if pytest.adapt_stress_test:
218-
nrows = nrows * pytest.max_gpu_memory // 32
224+
nrows = nrows * max_gpu_memory // 32
219225
else:
220226
pytest.skip(
221227
"Insufficient GPU memory for this test."

python/cuml/tests/test_lars.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,13 @@ def test_lars_model(datatype, nrows, column_info, precompute):
119119
)
120120
@pytest.mark.parametrize("precompute", [True, False])
121121
def test_lars_collinear(datatype, nrows, column_info, precompute):
122+
# Assume at least 4GB memory
123+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
124+
122125
ncols, n_info = column_info
123-
if nrows == 500000 and ncols == 1000 and pytest.max_gpu_memory < 32:
126+
if nrows == 500000 and ncols == 1000 and max_gpu_memory < 32:
124127
if pytest.adapt_stress_test:
125-
nrows = nrows * pytest.max_gpu_memory // 32
128+
nrows = nrows * max_gpu_memory // 32
126129
else:
127130
pytest.skip(
128131
"Insufficient GPU memory for this test."

python/cuml/tests/test_mbsgd_regressor.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@
4545
)
4646
def make_dataset(request):
4747
nrows, ncols, n_info, datatype = request.param
48-
if (
49-
nrows == 500000
50-
and datatype == np.float64
51-
and pytest.max_gpu_memory < 32
52-
):
48+
# Assume at least 4GB memory
49+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
50+
51+
if nrows == 500000 and datatype == np.float64 and max_gpu_memory < 32:
5352
if pytest.adapt_stress_test:
54-
nrows = nrows * pytest.max_gpu_memory // 32
53+
nrows = nrows * max_gpu_memory // 32
5554
else:
5655
pytest.skip(
5756
"Insufficient GPU memory for this test."

python/cuml/tests/test_pca.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,13 @@ def test_pca_defaults(n_samples, n_features, sparse):
140140
"name", [unit_param(None), quality_param("iris"), stress_param("blobs")]
141141
)
142142
def test_pca_fit_then_transform(datatype, input_type, name, use_handle):
143+
# Assume at least 4GB memory
144+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
145+
143146
blobs_n_samples = 500000
144-
if name == "blobs" and pytest.max_gpu_memory < 32:
147+
if name == "blobs" and max_gpu_memory < 32:
145148
if pytest.adapt_stress_test:
146-
blobs_n_samples = int(blobs_n_samples * pytest.max_gpu_memory / 32)
149+
blobs_n_samples = int(blobs_n_samples * max_gpu_memory / 32)
147150
else:
148151
pytest.skip(
149152
"Insufficient GPU memory for this test."
@@ -193,11 +196,14 @@ def test_pca_fit_then_transform(datatype, input_type, name, use_handle):
193196
"name", [unit_param(None), quality_param("iris"), stress_param("blobs")]
194197
)
195198
def test_pca_fit_transform(datatype, input_type, name, use_handle):
199+
# Assume at least 4GB memory
200+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
201+
196202
blobs_n_samples = 500000
197203

198-
if name == "blobs" and pytest.max_gpu_memory < 32:
204+
if name == "blobs" and max_gpu_memory < 32:
199205
if pytest.adapt_stress_test:
200-
blobs_n_samples = int(blobs_n_samples * pytest.max_gpu_memory / 32)
206+
blobs_n_samples = int(blobs_n_samples * max_gpu_memory / 32)
201207
else:
202208
pytest.skip(
203209
"Insufficient GPU memory for this test."
@@ -273,9 +279,12 @@ def test_pca_inverse_transform(datatype, input_type, name, use_handle, nrows):
273279
@pytest.mark.parametrize("return_sparse", [True, False])
274280
@pytest.mark.parametrize("cupy_input", [True, False])
275281
def test_sparse_pca_inputs(nrows, ncols, whiten, return_sparse, cupy_input):
276-
if ncols == 20000 and pytest.max_gpu_memory < 48:
282+
# Assume at least 4GB memory
283+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
284+
285+
if ncols == 20000 and max_gpu_memory < 48:
277286
if pytest.adapt_stress_test:
278-
ncols = int(ncols * pytest.max_gpu_memory / 48)
287+
ncols = int(ncols * max_gpu_memory / 48)
279288
else:
280289
pytest.skip(
281290
"Insufficient GPU memory for this test."

python/cuml/tests/test_pickle.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,19 @@ def assert_model(pickled_model, X_test):
224224
)
225225
@pytest.mark.parametrize("fit_intercept", [True, False])
226226
def test_regressor_pickle(tmpdir, datatype, keys, data_size, fit_intercept):
227+
# Assume at least 4GB memory
228+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
229+
227230
if (
228231
data_size[0] == 500000
229232
and datatype == np.float64
230233
and ("LogisticRegression" in keys or "Ridge" in keys)
231-
and pytest.max_gpu_memory < 32
234+
and max_gpu_memory < 32
232235
):
233236
if pytest.adapt_stress_test:
234-
data_size[0] = data_size[0] * pytest.max_gpu_memory // 640
235-
data_size[1] = data_size[1] * pytest.max_gpu_memory // 640
236-
data_size[2] = data_size[2] * pytest.max_gpu_memory // 640
237+
data_size[0] = data_size[0] * max_gpu_memory // 640
238+
data_size[1] = data_size[1] * max_gpu_memory // 640
239+
data_size[2] = data_size[2] * max_gpu_memory // 640
237240
else:
238241
pytest.skip(
239242
"Insufficient GPU memory for this test."
@@ -437,13 +440,16 @@ def test_unfit_clone(model_name):
437440
[unit_param([500, 20, 10, 5]), stress_param([500000, 1000, 500, 50])],
438441
)
439442
def test_neighbors_pickle(tmpdir, datatype, keys, data_info):
443+
# Assume at least 4GB memory
444+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
445+
440446
if (
441447
data_info[0] == 500000
442-
and pytest.max_gpu_memory < 32
448+
and max_gpu_memory < 32
443449
and ("KNeighborsClassifier" in keys or "KNeighborsRegressor" in keys)
444450
):
445451
if pytest.adapt_stress_test:
446-
data_info[0] = data_info[0] * pytest.max_gpu_memory // 32
452+
data_info[0] = data_info[0] * max_gpu_memory // 32
447453
else:
448454
pytest.skip(
449455
"Insufficient GPU memory for this test."
@@ -486,13 +492,16 @@ def assert_model(pickled_model, X_test):
486492
)
487493
@pytest.mark.parametrize("keys", k_neighbors_models.keys())
488494
def test_k_neighbors_classifier_pickle(tmpdir, datatype, data_info, keys):
495+
# Assume at least 4GB memory
496+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
497+
489498
if (
490499
data_info[0] == 500000
491500
and "NearestNeighbors" in keys
492-
and pytest.max_gpu_memory < 32
501+
and max_gpu_memory < 32
493502
):
494503
if pytest.adapt_stress_test:
495-
data_info[0] = data_info[0] * pytest.max_gpu_memory // 32
504+
data_info[0] = data_info[0] * max_gpu_memory // 32
496505
else:
497506
pytest.skip(
498507
"Insufficient GPU memory for this test."
@@ -561,9 +570,12 @@ def assert_model(loaded_model, X):
561570
"data_size", [unit_param([500, 20, 10]), stress_param([500000, 1000, 500])]
562571
)
563572
def test_dbscan_pickle(tmpdir, datatype, keys, data_size):
564-
if data_size[0] == 500000 and pytest.max_gpu_memory < 32:
573+
# Assume at least 4GB memory
574+
max_gpu_memory = pytest.max_gpu_memory if pytest.max_gpu_memory else 4
575+
576+
if data_size[0] == 500000 and max_gpu_memory < 32:
565577
if pytest.adapt_stress_test:
566-
data_size[0] = data_size[0] * pytest.max_gpu_memory // 32
578+
data_size[0] = data_size[0] * max_gpu_memory // 32
567579
else:
568580
pytest.skip(
569581
"Insufficient GPU memory for this test."

0 commit comments

Comments
 (0)