From 11e47f4579d7d04ee444cc0b43eab5dbe4363f02 Mon Sep 17 00:00:00 2001 From: Saloni Jain Date: Thu, 15 Aug 2019 13:54:42 -0700 Subject: [PATCH 1/4] update the dask files to throw an exception --- python/cuml/dask/cluster/kmeans.py | 8 +++++++- python/cuml/dask/linear_model/linear_regression.py | 13 ++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/python/cuml/dask/cluster/kmeans.py b/python/cuml/dask/cluster/kmeans.py index 39a6b0c711..44f9c244fd 100644 --- a/python/cuml/dask/cluster/kmeans.py +++ b/python/cuml/dask/cluster/kmeans.py @@ -105,7 +105,13 @@ def func_fit(sessionId, n_clusters, max_iter, tol, verbose, random_state, :param r: Stops memoizatiion caching :return: The fit model """ - from cuml.cluster.kmeans_mg import KMeansMG as cumlKMeans + try: + from cuml.cluster.kmeans_mg import KMeansMG as cumlKMeans + except ImportError: + raise Exception("cuML has not been built with multiGPU support " + "enabled. Build with the --multigpu flag to enable" + " multiGPU support.") + handle = worker_state(sessionId)["handle"] df = concat(dfs) diff --git a/python/cuml/dask/linear_model/linear_regression.py b/python/cuml/dask/linear_model/linear_regression.py index ac08fd2ec7..44a38e1f3a 100644 --- a/python/cuml/dask/linear_model/linear_regression.py +++ b/python/cuml/dask/linear_model/linear_regression.py @@ -366,8 +366,10 @@ def _fit_on_worker(data, params): from cuml.linear_model.linear_regression_mg import LinearRegressionMG as cuOLS # NOQA ols = cuOLS() intercept = ols._fit_mg(alloc_info, params) - except Exception as e: - print("FAILURE in FIT: " + str(e)) + except ImportError: + raise Exception("cuML has not been built with multiGPU support " + "enabled. Build with the --multigpu flag to enable" + " multiGPU support.") [t.close() for t in open_ipcs] # [t.join() for t in open_ipcs] @@ -413,9 +415,10 @@ def _predict_on_worker(data, intercept, params): from cuml.linear_model.linear_regression_mg import LinearRegressionMG as cuOLS # NOQA ols = cuOLS() ols._predict_mg(alloc_info, intercept, params) - - except Exception as e: - print("Failure in predict(): " + str(e)) + except ImportError: + raise Exception("cuML has not been built with multiGPU support " + "enabled. Build with the --multigpu flag to enable" + " multiGPU support.") [t.close() for t in open_ipcs] # [t.join() for t in open_ipcs] From cc8ec620d2ed5abdf6e7dd1b0c5cb2839bb930d3 Mon Sep 17 00:00:00 2001 From: Saloni Jain Date: Thu, 15 Aug 2019 14:01:25 -0700 Subject: [PATCH 2/4] fixed style errors --- python/cuml/dask/cluster/kmeans.py | 4 ++-- python/cuml/dask/linear_model/linear_regression.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/python/cuml/dask/cluster/kmeans.py b/python/cuml/dask/cluster/kmeans.py index 44f9c244fd..76b0c89290 100644 --- a/python/cuml/dask/cluster/kmeans.py +++ b/python/cuml/dask/cluster/kmeans.py @@ -109,8 +109,8 @@ def func_fit(sessionId, n_clusters, max_iter, tol, verbose, random_state, from cuml.cluster.kmeans_mg import KMeansMG as cumlKMeans except ImportError: raise Exception("cuML has not been built with multiGPU support " - "enabled. Build with the --multigpu flag to enable" - " multiGPU support.") + "enabled. Build with the --multigpu flag to" + " enable multiGPU support.") handle = worker_state(sessionId)["handle"] diff --git a/python/cuml/dask/linear_model/linear_regression.py b/python/cuml/dask/linear_model/linear_regression.py index 44a38e1f3a..c43a096af0 100644 --- a/python/cuml/dask/linear_model/linear_regression.py +++ b/python/cuml/dask/linear_model/linear_regression.py @@ -370,6 +370,8 @@ def _fit_on_worker(data, params): raise Exception("cuML has not been built with multiGPU support " "enabled. Build with the --multigpu flag to enable" " multiGPU support.") + except Exception as e: + print("Failure in predict(): " + str(e)) [t.close() for t in open_ipcs] # [t.join() for t in open_ipcs] @@ -419,6 +421,8 @@ def _predict_on_worker(data, intercept, params): raise Exception("cuML has not been built with multiGPU support " "enabled. Build with the --multigpu flag to enable" " multiGPU support.") + except Exception as e: + print("Failure in predict(): " + str(e)) [t.close() for t in open_ipcs] # [t.join() for t in open_ipcs] From e64883967b05b40692508c9f4390b5d606bfadd2 Mon Sep 17 00:00:00 2001 From: Saloni Jain Date: Thu, 15 Aug 2019 14:09:48 -0700 Subject: [PATCH 3/4] updated CHANGELOG.md and fixed style errors in t_sne.pyx --- CHANGELOG.md | 1 + python/cuml/manifold/t_sne.pyx | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11530cd56c..9f25a2fe4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,7 @@ - PR #988: Switch to exact tsne - PR #991: Cleanup python code in cuml.dask.cluster - PR #996: ucx_initialized being properly set in CommsContext +- PR #1007: Throws a well defined error when mutigpu is not enabled # cuML 0.8.0 (27 June 2019) diff --git a/python/cuml/manifold/t_sne.pyx b/python/cuml/manifold/t_sne.pyx index 9a8b342885..4aff7061fa 100644 --- a/python/cuml/manifold/t_sne.pyx +++ b/python/cuml/manifold/t_sne.pyx @@ -83,9 +83,9 @@ class TSNE(Base): then the Barnes-Hut algorithm as data sizes grow. A preview implementation of Barnes-Hut (derived from CannyLabs' BH open source CUDA code) is also available for problems with n_components = 2, though this implementation - currently has outstanding issues that can lead to crashes in rare scenarios. - Future releases of TSNE will fix these issues (tracked as cuML Issue #1002) - and switch Barnes-Hut to be the default. + currently has outstanding issues that can lead to crashes in rare + scenarios. Future releases of TSNE will fix these issues + (tracked as cuML Issue #1002) and switch Barnes-Hut to be the default. Parameters ---------- From 6f3eb8121ad4f53cb1360e2935da71aaecb0a7fd Mon Sep 17 00:00:00 2001 From: Saloni Jain Date: Thu, 15 Aug 2019 17:37:49 -0700 Subject: [PATCH 4/4] update branch --- python/cuml/dask/linear_model/linear_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cuml/dask/linear_model/linear_regression.py b/python/cuml/dask/linear_model/linear_regression.py index c43a096af0..088b2bb2d3 100644 --- a/python/cuml/dask/linear_model/linear_regression.py +++ b/python/cuml/dask/linear_model/linear_regression.py @@ -371,7 +371,7 @@ def _fit_on_worker(data, params): "enabled. Build with the --multigpu flag to enable" " multiGPU support.") except Exception as e: - print("Failure in predict(): " + str(e)) + print("Failure in Fit(): " + str(e)) [t.close() for t in open_ipcs] # [t.join() for t in open_ipcs]