diff --git a/examples/daal4py/readcsv.py b/examples/daal4py/readcsv.py index 564b8cbd18..8651ee1d71 100644 --- a/examples/daal4py/readcsv.py +++ b/examples/daal4py/readcsv.py @@ -14,19 +14,25 @@ # limitations under the License. # ============================================================================== -from importlib.machinery import SourceFileLoader +from importlib.util import module_from_spec, spec_from_file_location from pathlib import Path utils_path = Path(__file__).parent.parent / "utils" +module_name = "readcsv" +module_path = str(utils_path / "readcsv.py") -readcsv = SourceFileLoader("readcsv", str(utils_path / "readcsv.py")).load_module() +spec = spec_from_file_location(module_name, module_path) +readcsv = module_from_spec(spec) +spec.loader.exec_module(readcsv) np_read_csv = readcsv.np_read_csv pd_read_csv = readcsv.pd_read_csv csr_read_csv = readcsv.csr_read_csv +read_next = readcsv.read_next __all__ = [ "np_read_csv", "pd_read_csv", "csr_read_csv", + "read_next", ] diff --git a/examples/mb/readcsv.py b/examples/mb/readcsv.py index 5edf201907..f66455ce65 100644 --- a/examples/mb/readcsv.py +++ b/examples/mb/readcsv.py @@ -14,12 +14,16 @@ # limitations under the License. # ============================================================================== -from importlib.machinery import SourceFileLoader +from importlib.util import module_from_spec, spec_from_file_location from pathlib import Path utils_path = Path(__file__).parent.parent / "utils" +module_name = "readcsv" +module_path = str(utils_path / "readcsv.py") -readcsv = SourceFileLoader("readcsv", str(utils_path / "readcsv.py")).load_module() +spec = spec_from_file_location(module_name, module_path) +readcsv = module_from_spec(spec) +spec.loader.exec_module(readcsv) np_read_csv = readcsv.np_read_csv pd_read_csv = readcsv.pd_read_csv diff --git a/examples/sklearnex/knn_bf_regression_spmd.py b/examples/sklearnex/knn_bf_regression_spmd.py index 28ce112290..863c79d8e2 100644 --- a/examples/sklearnex/knn_bf_regression_spmd.py +++ b/examples/sklearnex/knn_bf_regression_spmd.py @@ -21,7 +21,7 @@ import numpy as np from mpi4py import MPI from numpy.testing import assert_allclose -from sklearn.metrics import mean_squared_error +from sklearn.metrics import root_mean_squared_error from sklearnex.spmd.neighbors import KNeighborsRegressor @@ -80,6 +80,6 @@ def generate_X_y(par, coef_seed, data_seed): ) print( "RMSE for entire rank {}: {}\n".format( - rank, mean_squared_error(y_test, dpt.to_numpy(y_predict), squared=False) + rank, root_mean_squared_error(y_test, dpt.to_numpy(y_predict)) ) ) diff --git a/tests/run_examples.py b/tests/run_examples.py index ba84c26968..de1676469e 100755 --- a/tests/run_examples.py +++ b/tests/run_examples.py @@ -223,10 +223,12 @@ def get_exe_cmd(ex, args): return None if not args.nodist and ex.endswith("spmd.py"): if IS_WIN: - return 'mpiexec -localonly -n 4 "' + sys.executable + '" "' + ex + '"' - return 'mpirun -n 4 "' + sys.executable + '" "' + ex + '"' + return ( + 'mpiexec -localonly -n 4 "' + sys.executable + '" -W error "' + ex + '"' + ) + return 'mpirun -n 4 "' + sys.executable + '" -W error "' + ex + '"' else: - return '"' + sys.executable + '" "' + ex + '"' + return '"' + sys.executable + '" -W error "' + ex + '"' def run(exdir, logdir, args):