From b220fff67d6181d70a76b10a158d6e0cc347fbfb Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 12 Sep 2023 05:51:28 -0500 Subject: [PATCH 1/6] Remove .travis, add workflow --- .github/workflows/run_tests.yaml | 39 ++++++++++++++++++++++++++++++++ .travis.yml | 7 ------ README.md | 2 -- environments/intel.yaml | 15 ++++++++++++ environments/stock.yaml | 17 ++++++++++++++ 5 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/run_tests.yaml delete mode 100644 .travis.yml create mode 100644 environments/intel.yaml create mode 100644 environments/stock.yaml diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml new file mode 100644 index 0000000..726b823 --- /dev/null +++ b/.github/workflows/run_tests.yaml @@ -0,0 +1,39 @@ +name: Run benchmark tests +on: + pull_request: + push: + branches: [master] + +jobs: + run_test: + name: Run optimization bench on intel_dev + runs-on: ubuntu-latest + + strategy: + matrix: + python: ['3.9', '3.10', '3.11'] + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set pkgs_dirs + run: | + echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc + + - name: Add conda to system path + run: echo $CONDA/bin >> $GITHUB_PATH + + - name: Create test environment + run: conda env create -f environments/intel.yaml + + - name: Run scripts + run: | + conda activate intel_dev + python run_tests.py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 995d193..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: python -python: - - "3.6" -install: - - "python create_python_envs.py" -script: - - "python run_tests.py" diff --git a/README.md b/README.md index f61f501..03dfadd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![Build Status](https://travis-ci.org/IntelPython/optimizations_bench.svg?branch=master)](https://travis-ci.org/IntelPython/optimizations_bench) - # Optimization Benchmarks Collection of performance benchmarks used to present optimizations implemented for Intel(R) Distribution for Python* diff --git a/environments/intel.yaml b/environments/intel.yaml new file mode 100644 index 0000000..1170181 --- /dev/null +++ b/environments/intel.yaml @@ -0,0 +1,15 @@ +name: intel_env +channels: + - intel + - conda-forge + - nodefaults +dependencies: + - numpy + - numexpr + - numba + - scikit-learn + - cython + - pip + - pip: + - dask +# - rdtsc diff --git a/environments/stock.yaml b/environments/stock.yaml new file mode 100644 index 0000000..a20257b --- /dev/null +++ b/environments/stock.yaml @@ -0,0 +1,17 @@ +name: stock_env +channels: + - intel + - conda-forge + - nodefaults +dependencies: + - llvmlite + - cython + - pip + - pip: + - numpy + - scikit-learn + - toolz + - numexpr +# - rdtsc + - numba + - dask From 0d606523eb7b532f255c49840e499990082cc68e Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 12 Sep 2023 06:23:00 -0500 Subject: [PATCH 2/6] Make sure to source conda scripts --- .github/workflows/run_tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 726b823..4479906 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -35,5 +35,6 @@ jobs: - name: Run scripts run: | + . $CONDA/etc/profile.d/conda.sh conda activate intel_dev python run_tests.py From 92581fe491ed84b9750e469f106c33e10235e6a9 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 13 Sep 2023 08:29:05 -0500 Subject: [PATCH 3/6] Fixed environment name, added stock_env too --- .github/workflows/run_tests.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 4479906..f6a2d48 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -30,11 +30,20 @@ jobs: - name: Add conda to system path run: echo $CONDA/bin >> $GITHUB_PATH - - name: Create test environment + - name: Create Intel test environment run: conda env create -f environments/intel.yaml - - name: Run scripts + - name: Create stock test environment + run: conda env create -f environments/stock.yaml + + - name: Run tests in Intel environment + run: | + . $CONDA/etc/profile.d/conda.sh + conda activate intel_env + python run_tests.py + + - name: Run tests in stock environment run: | . $CONDA/etc/profile.d/conda.sh - conda activate intel_dev + conda activate stock_env python run_tests.py From 04cd7407c806779c8743ef26534a40e279212b6a Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 13 Sep 2023 08:30:40 -0500 Subject: [PATCH 4/6] Only use Python 3.10 --- .github/workflows/run_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index f6a2d48..117eda0 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - python: ['3.9', '3.10', '3.11'] + python: ['3.10'] steps: - name: Cancel Previous Runs From d317f2bc90539142286c42d7fa93d6ccf16085f3 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 13 Sep 2023 08:45:38 -0500 Subject: [PATCH 5/6] Deleted unused files, tweaked workflow, added badge --- .github/workflows/run_tests.yaml | 12 ++++++++---- README.md | 13 ++++++++----- create_python_envs.py | 28 ---------------------------- run_tests.py | 7 ------- 4 files changed, 16 insertions(+), 44 deletions(-) delete mode 100644 create_python_envs.py delete mode 100644 run_tests.py diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 117eda0..b58c18a 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -39,11 +39,15 @@ jobs: - name: Run tests in Intel environment run: | . $CONDA/etc/profile.d/conda.sh - conda activate intel_env - python run_tests.py + conda activate intel_env || exit 1 + # This is toy run for GH action, + # The arguments are really bad for real perf testing, use default arguments instead + python numpy/umath/umath_mem_bench.py -v --size 10 --goal-time 0.01 --repeats 1 || exit 1 - name: Run tests in stock environment run: | . $CONDA/etc/profile.d/conda.sh - conda activate stock_env - python run_tests.py + conda activate stock_env || exit 1 + # This is toy run for GH action, + # The arguments are really bad for real perf testing, use default arguments instead + python numpy/umath/umath_mem_bench.py -v --size 10 --goal-time 0.01 --repeats 1 || exit 1 diff --git a/README.md b/README.md index 03dfadd..5290a37 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,25 @@ +[![Run benchmark tests](https://github.com/IntelPython/optimizations_bench/actions/workflows/run_tests.yaml/badge.svg)](https://github.com/IntelPython/optimizations_bench/actions/workflows/run_tests.yaml) + # Optimization Benchmarks Collection of performance benchmarks used to present optimizations implemented for Intel(R) Distribution for Python* ## Environment Setup To install Python environments from Intel channel along with pip-installed packages -- `python3 create_python_envs.py` - +- `conda env create -f environments/intel.yaml` +- `conda activate intel_env` + ## Run tests -- `python3 run_tests.py` +- `python numpy/umath/umath_mem_bench.py -v --size 10 --goal-time 0.01 --repeats 1` ## Run benchmarks ### umath - To run python benchmarks: `python numpy/umath/umath_mem_bench.py` -- To compile and run native benchmarks (requires icc): `make -C numpy/umath` +- To compile and run native benchmarks (requires `icx`): `make -C numpy/umath` ### Random number generation - To run python benchmarks: `python numpy/random/rng.py` -- To compile and run native benchmarks (requires icc): `make -C numpy/random` +- To compile and run native benchmarks (requires `icx`): `make -C numpy/random` ## See also "[Accelerating Scientific Python with Intel Optimizations](http://conference.scipy.org/proceedings/scipy2017/pdfs/oleksandr_pavlyk.pdf)" by Oleksandr Pavlyk, Denis Nagorny, Andres Guzman-Ballen, Anton Malakhov, Hai Liu, Ehsan Totoni, Todd A. Anderson, Sergey Maidanov. Proceedings of the 16th Python in Science Conference (SciPy 2017), July 10 - July 16, Austin, Texas diff --git a/create_python_envs.py b/create_python_envs.py deleted file mode 100644 index 0517f68..0000000 --- a/create_python_envs.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (C) 2017-2018 Intel Corporation -# -# SPDX-License-Identifier: MIT - -import os -import urllib.request -from os.path import join as jp - -dir = 'miniconda3' -conda = jp(dir,'bin','conda') -miniconda = 'Miniconda3-latest-Linux-x86_64.sh' -miniconda_url = 'https://repo.continuum.io/miniconda/' + miniconda - -if not os.path.exists(conda): - if not os.path.exists(dir): - os.makedirs(dir) - if not os.path.exists(miniconda): - urllib.request.urlretrieve(miniconda_url, miniconda) - os.system('chmod +x %s; ./%s -b -p %s -f' % (miniconda,miniconda,dir)) - -if not os.path.exists(jp(dir,'envs','intel3')): - os.system('%s create -q -y -n intel3 -c intel python=3 numpy numexpr numexpr numba scikit-learn tbb cython' % conda) - -pip_env = jp(dir,'envs','pip3') -if not os.path.exists(pip_env): - os.system('%s create -q -y -n pip3 -c intel python=3 pip llvmlite cython' % conda) - os.system('%s/bin/pip -q install numpy scikit-learn toolz numexpr rdtsc' % pip_env) - os.system('%s/bin/pip -q install dask numba' % pip_env) diff --git a/run_tests.py b/run_tests.py deleted file mode 100644 index 84f3c66..0000000 --- a/run_tests.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) 2017 Intel Corporation -# -# SPDX-License-Identifier: MIT - -import os -# warning: this is sanity test for Travis CI. The arguments are really bad for real perf testing, use default arguments instead -os.system('miniconda3/envs/intel3/bin/python numpy/umath/umath_mem_bench.py -v --size 10 --goal-time 0.01 --repeats 1') From dfcf8dde97a64719ce0fdb50083f35a15711614f Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 13 Sep 2023 09:56:29 -0500 Subject: [PATCH 6/6] Use mkl variant of numexpr from conda-forge --- environments/intel.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environments/intel.yaml b/environments/intel.yaml index 1170181..e2fb042 100644 --- a/environments/intel.yaml +++ b/environments/intel.yaml @@ -5,7 +5,7 @@ channels: - nodefaults dependencies: - numpy - - numexpr + - conda-forge::numexpr=*=mkl* - numba - scikit-learn - cython