Skip to content

Commit b9ee34a

Browse files
author
samaid
committed
Enabled mcpi demo. Added respective documentation
1 parent 181f65e commit b9ee34a

File tree

6 files changed

+336
-7
lines changed

6 files changed

+336
-7
lines changed
Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
name: Build-test-upload mcpi package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
PACKAGE_NAME: mcpi-demo
11+
MODULE_NAME: mcpi_demo
12+
13+
jobs:
14+
build_linux:
15+
runs-on: ubuntu-20.04
16+
17+
strategy:
18+
matrix:
19+
python: ['3.8', '3.9', '3.10']
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set pkgs_dirs
26+
run: |
27+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
28+
- name: Cache conda packages
29+
uses: actions/cache@v3
30+
env:
31+
CACHE_NUMBER: 0 # Increase to reset cache
32+
with:
33+
path: ~/.conda/pkgs
34+
key:
35+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
36+
restore-keys: |
37+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
38+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
39+
- name: Add conda to system path
40+
run: echo $CONDA/bin >> $GITHUB_PATH
41+
- name: Install conda-build
42+
run: conda install conda-build
43+
- name: Build conda package
44+
run: |
45+
CHANNELS="-c intel -c main --override-channels"
46+
VERSIONS="--python ${{ matrix.python }}"
47+
TEST=""
48+
cd ./demos/mcpi
49+
conda build $TEST $VERSIONS $CHANNELS conda-recipe
50+
- name: Upload artifact
51+
uses: actions/upload-artifact@v3
52+
with:
53+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
54+
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
55+
56+
test_linux:
57+
needs: build_linux
58+
runs-on: ${{ matrix.runner }}
59+
60+
strategy:
61+
matrix:
62+
python: ['3.8', '3.9', '3.10']
63+
experimental: [true]
64+
runner: [ubuntu-20.04]
65+
continue-on-error: ${{ matrix.experimental }}
66+
env:
67+
CHANNELS: -c dppy/label/dev -c intel -c main --override-channels
68+
69+
steps:
70+
- uses: actions/checkout@v3
71+
with:
72+
fetch-depth: 0
73+
- name: Download artifact
74+
uses: actions/download-artifact@v3
75+
with:
76+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
77+
- name: Add conda to system path
78+
run: echo $CONDA/bin >> $GITHUB_PATH
79+
- name: Install conda-build
80+
# Needed to be able to run conda index
81+
run: conda install conda-build
82+
- name: Create conda channel
83+
run: |
84+
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
85+
# conda index $GITHUB_WORKSPACE/channel || exit 1
86+
mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64 || exit 1
87+
conda index $GITHUB_WORKSPACE/channel || exit 1
88+
# Test channel
89+
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json
90+
cat ver.json
91+
- name: Collect dependencies
92+
run: |
93+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
94+
conda create -n test-env $PACKAGE_NAME python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
95+
cat lockfile
96+
- name: Set pkgs_dirs
97+
run: |
98+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
99+
- name: Cache conda packages
100+
uses: actions/cache@v3
101+
env:
102+
CACHE_NUMBER: 0 # Increase to reset cache
103+
with:
104+
path: ~/.conda/pkgs
105+
key:
106+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
107+
restore-keys: |
108+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
109+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
110+
- name: Install package
111+
run: |
112+
export CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
113+
conda create -n test-env $PACKAGE_NAME pytest python=${{ matrix.python }} ${CHANNELS}
114+
. $CONDA/etc/profile.d/conda.sh
115+
conda activate test-env
116+
# Test installed packages
117+
conda list -n test-env
118+
- name: Run tests
119+
run: |
120+
. $CONDA/etc/profile.d/conda.sh
121+
conda activate test-env
122+
pushd ./${{ env.MODULE_NAME }}
123+
pytest
124+
popd
125+
126+
upload_linux:
127+
needs: test_linux
128+
if: ${{github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}}
129+
runs-on: ubuntu-20.04
130+
strategy:
131+
matrix:
132+
python: ['3.8', '3.9', '3.10']
133+
steps:
134+
- name: Download artifact
135+
uses: actions/download-artifact@v3
136+
with:
137+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
138+
139+
- name: Install anaconda-client
140+
run: conda install anaconda-client
141+
- name: Add conda to system path
142+
run: echo $CONDA/bin >> $GITHUB_PATH
143+
144+
- name: Upload
145+
env:
146+
ANACONDA_TOKEN: ${{ secrets.PYCODDIYTOKEN }}
147+
run: |
148+
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user pycoddiy --label dpep ${PACKAGE_NAME}-*.tar.bz2
149+
150+
build_windows:
151+
runs-on: windows-latest
152+
153+
strategy:
154+
matrix:
155+
python: ['3.8', '3.9', '3.10']
156+
env:
157+
conda-bld: C:\Miniconda\conda-bld\win-64\
158+
steps:
159+
- uses: actions/checkout@v3
160+
with:
161+
fetch-depth: 0
162+
- uses: conda-incubator/setup-miniconda@v2
163+
with:
164+
use-only-tar-bz2: true
165+
auto-activate-base: true
166+
conda-build-version: "*"
167+
activate-environment: true
168+
python-version: ${{ matrix.python }}
169+
170+
- name: Cache conda packages
171+
uses: actions/cache@v3
172+
env:
173+
CACHE_NUMBER: 0 # Increase to reset cache
174+
with:
175+
path: /home/runner/conda_pkgs_dir
176+
key:
177+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
178+
restore-keys: |
179+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
180+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
181+
- name: Build conda package
182+
run: |
183+
cd ./demos/mcpi
184+
conda build --keep-old-work --dirty --no-test --python ${{ matrix.python }} -c intel -c main --override-channels conda-recipe
185+
- name: Upload artifact
186+
uses: actions/upload-artifact@v3
187+
with:
188+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
189+
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
190+
191+
test_windows:
192+
needs: build_windows
193+
runs-on: ${{ matrix.runner }}
194+
defaults:
195+
run:
196+
shell: cmd /C CALL {0}
197+
strategy:
198+
matrix:
199+
python: ['3.8', '3.9', '3.10']
200+
experimental: [false]
201+
runner: [windows-latest]
202+
continue-on-error: ${{ matrix.experimental }}
203+
env:
204+
workdir: '${{ github.workspace }}'
205+
CHANNELS: -c dppy/label/dev -c intel -c main --override-channels
206+
steps:
207+
- name: Checkout sources
208+
uses: actions/checkout@v3
209+
with:
210+
fetch-depth: 0
211+
- name: Download artifact
212+
uses: actions/download-artifact@v3
213+
with:
214+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
215+
- uses: conda-incubator/setup-miniconda@v2
216+
with:
217+
use-only-tar-bz2: false
218+
auto-update-conda: true
219+
conda-build-version: '*'
220+
miniconda-version: 'latest'
221+
activate-environment: test-env
222+
python-version: ${{ matrix.python }}
223+
- name: conda info
224+
shell: cmd /C CALL {0}
225+
run: |
226+
conda info
227+
- name: conda config --show
228+
shell: cmd /C CALL {0}
229+
run: |
230+
conda config --show
231+
- name: Create conda channel with the artifact bit
232+
shell: cmd /C CALL {0}
233+
run: |
234+
echo ${{ env.workdir }}
235+
mkdir ${{ env.workdir }}\channel\win-64
236+
move ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.workdir }}\channel\win-64
237+
dir ${{ env.workdir }}\channel\win-64
238+
- name: Index the channel
239+
shell: cmd /C CALL {0}
240+
run: conda index ${{ env.workdir }}\channel
241+
- name: Collect dependencies
242+
shell: cmd /C CALL {0}
243+
run: |
244+
conda install -n test-env ${{ env.PACKAGE_NAME }} python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile && conda activate test-env
245+
- name: Display lockfile content
246+
shell: pwsh
247+
run: Get-Content -Path .\lockfile
248+
- name: Cache conda packages
249+
uses: actions/cache@v3
250+
env:
251+
CACHE_NUMBER: 0 # Increase to reset cache
252+
with:
253+
path: /home/runner/conda_pkgs_dir
254+
key:
255+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
256+
restore-keys: |
257+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
258+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
259+
- name: Install dependencies
260+
shell: cmd /C CALL {0}
261+
run: |
262+
conda install -n test-env ${{ env.PACKAGE_NAME }} pytest python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
263+
- name: Install opencl_rt
264+
shell: cmd /C CALL {0}
265+
run: conda install -n test-env opencl_rt -c intel --override-channels
266+
- name: Configure Intel OpenCL CPU RT
267+
shell: pwsh
268+
run: |
269+
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
270+
&$script_path
271+
# Check the variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default
272+
$cl_cfg="$env:CONDA_PREFIX\Library\lib\cl.cfg"
273+
Get-Content -Tail 5 -Path $cl_cfg
274+
- name: Conda list
275+
shell: cmd /C CALL {0}
276+
run: conda list -n test-env
277+
- name: Run tests
278+
shell: pwsh
279+
run: |
280+
ls
281+
conda activate test-env
282+
pushd ./${{ env.MODULE_NAME }}
283+
pytest
284+
popd
285+
286+
upload_windows:
287+
needs: test_windows
288+
if: ${{github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}}
289+
runs-on: windows-latest
290+
strategy:
291+
matrix:
292+
python: ['3.8', '3.9', '3.10']
293+
steps:
294+
- name: Download artifact
295+
uses: actions/download-artifact@v3
296+
with:
297+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
298+
- uses: conda-incubator/setup-miniconda@v2
299+
with:
300+
auto-activate-base: true
301+
activate-environment: ""
302+
- name: Install anaconda-client
303+
run: conda install anaconda-client
304+
305+
- name: Upload
306+
env:
307+
ANACONDA_TOKEN: ${{ secrets.PYCODDIYTOKEN }}
308+
run: |
309+
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user pycoddiy --label dpep ${{ env.PACKAGE_NAME }}-*.tar.bz2

docs/sources/benchmarks.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Benchmarks
55
==========
66

77
**Data Parallel Extensions for Python** provide a set of
8-
`benchmarks<https://github.com/IntelPython/dpbench>`_ illustrating different aspects of
8+
`benchmarks <https://github.com/IntelPython/dpbench>`_ illustrating different aspects of
99
implementing the performant code with Data Parallel Extensions for Python.
1010
Benchmarks represent some real life numerical problem or some important part (kernel) of real life application.
1111
Each application/kernel is implemented in several variants (not necessarily all variants):
@@ -55,4 +55,4 @@ These benchmarks are implemented in ``dpbench`` framework, which allows you to r
5555
all or select benchmarks and variants to evaluate their performance on different hardware.
5656

5757
For more details please refer to ``dpbench``
58-
`documentation<https://github.com/IntelPython/dpbench/blob/main/README.md>`_.
58+
`documentation <https://github.com/IntelPython/dpbench/blob/main/README.md>`_.

docs/sources/demos.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.. _demos:
2+
.. include:: ./ext_links.txt
3+
4+
Demos
5+
=====
6+
7+
There are several demo applications illustrating the power of the **Data Parallel Extensions for Python**. They are:
8+
9+
- `Monte Carlo Pi <https://github.com/IntelPython/DPEP/tree/main/demos/mcpi>`_ -
10+
The Monte Carlo method to estimate the value of :math:`\pi`.
11+
12+
- `Mandelbrot Set <https://github.com/IntelPython/DPEP/tree/main/demos/mandelbrot>`_ -
13+
Visualization of the breathtaking process of diving in the famous Mandelbrot fractal
14+
15+
- `Game of Life <https://github.com/IntelPython/DPEP/tree/main/demos/game-of-life>`_ -
16+
Visualization of the life evolution using famous Conway's model
17+
18+
All demos are located in the `GitHub repository <https://github.com/IntelPython/DPEP/tree/main/demos>`_.
19+
For more details please refer to the documentation located in the individual demo directory.

docs/sources/examples.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.. _examples:
22
.. include:: ./ext_links.txt
33

4-
List of examples
5-
================
6-
All examples are located in the `GitHub repository<https://github.com/IntelPython/DPEP/tree/main/examples>`_.
4+
Examples
5+
========
6+
All examples are located in the `GitHub repository <https://github.com/IntelPython/DPEP/tree/main/examples>`_.
77
Their names start with the 2-digit number followed by a descriptive name.
88
You can run examples in any order, however, if
99
you are new to the Data Parallel Extensions for Python, it is recommended to go in the order examples are enumerated.

docs/sources/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ Table of Contents
3232
examples
3333
jupyter_notebook
3434
benchmarks
35+
demos
3536
useful_links

docs/sources/jupyter_notebook.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tutorials
55
*********
66

77
Getting started Jupyter* Notebooks illustrating the usage of **Data Parallel Extensions for Python** are located
8-
in the `GitHub repository<https://github.com/IntelPython/DPEP/tree/main/notebooks>`_
8+
in the `GitHub repository <https://github.com/IntelPython/DPEP/tree/main/notebooks>`_
99

1010
To run the tutorial, in the command line prompt type:
1111

@@ -31,7 +31,7 @@ which will show a list of the notebooks, files, and subdirectories
3131
in the directory where the notebook server was started.
3232
Navigate to the notebook of your interest and open it in the dashboard.
3333

34-
For more information please refer to `Jupyter documentation<https://docs.jupyter.org/en/latest/running.html>`_
34+
For more information please refer to `Jupyter documentation <https://docs.jupyter.org/en/latest/running.html>`_
3535

3636
.. toctree::
3737
:maxdepth: 1

0 commit comments

Comments
 (0)