code: def test_svm_memleak_on_exception(
      params, n_rows=1000, n_iter=10, n_cols=1000, dataset="blobs"
  ):
      """
      Test whether there is any mem leak when we exit training with an exception.
      The poly kernel with degree=30 will overflow, and triggers the
      'SMO error: NaN found...' exception.
      """
      X_train, y_train = make_blobs(
          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)
  
      # 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.
      tmp = cu_svm.SVC(handle=handle, **params)
      with pytest.raises(RuntimeError):
          tmp.fit(X_train, y_train)
          # SMO error: NaN found during fitting.
  
      free_mem = cuda.current_context().get_memory_info()[0]
  
      # Main test loop
      for i in range(n_iter):
          cuSVC = cu_svm.SVC(handle=handle, **params)
          with pytest.raises(RuntimeError):
              cuSVC.fit(X_train, y_train)
              # SMO error: NaN found during fitting.
  
      del cuSVC
      handle.sync()
      delta_mem = free_mem - cuda.current_context().get_memory_info()[0]
      print("Delta GPU mem: {} bytes".format(delta_mem))
      assert delta_mem == 0
  
imports: import platform
  from sklearn.preprocessing import StandardScaler
  from sklearn.model_selection import train_test_split
  from sklearn.metrics import mean_squared_error
  from sklearn.datasets import make_classification, make_gaussian_quantiles
  from sklearn.datasets import make_regression, make_friedman1
  from sklearn.datasets import load_iris, make_blobs
  from sklearn import svm
  from cuml.testing.utils import unit_param, quality_param, stress_param, compare_svm, compare_probabilistic_svm, svm_array_equal
  from cuml.common import input_to_cuml_array
  import cuml.svm
  import cuml
  from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.internals.safe_imports import cpu_only_import
  import pytest
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 14 for calling a global function with example usage: test_svm_memleak_on_exception(params, n_rows, n_iter, n_cols, dataset) without return types