Skip to content

Commit 0ca3c06

Browse files
add install and contribution guides, update readme
1 parent 96f367e commit 0ca3c06

File tree

11 files changed

+250
-63
lines changed

11 files changed

+250
-63
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5-
## [Unreleased]
5+
## Unreleased
6+
7+
8+
## [0.1.3] - 2017-04-06
69
### Changed
710
- changed how scalar arguments are handled internally
811

12+
### Added
13+
- separate install and contribution guides
14+
915
## [0.1.2] - 2017-03-29
1016
### Changed
1117
- allow non-tuple problem_size for 1D grids

CONTRIBUTING.rst

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Contribution guide
2+
==================
3+
4+
The kernel tuner follows the Google Python style guide, with Sphinxdoc
5+
docstrings for module public functions. If you want to contribute to the project
6+
please fork it, create a branch including your changes and additions, and create
7+
a pull request.
8+
9+
Before creating a pull request please ensure the following:
10+
11+
* You have written unit tests to test your additions and all unit tests pass
12+
* The examples still work and produce the same (or better) results
13+
* The code is compatible with both Python 2.7 and Python 3.5
14+
* An entry about the change or addition is created in CHANGELOG.md
15+
* Any matching entries in the roadmap.md are updated/removed
16+
17+
If you are in doubt on where add your additions to the Kernel Tuner, please
18+
have look at the `design documentation <http://benvanwerkhoven.github.io/kernel_tuner/design.html>`__.
19+
20+
Development setup
21+
-----------------
22+
23+
You can install the packages required to run the tests using:
24+
25+
.. code-block:: bash
26+
27+
pip install -r requirements-dev.txt
28+
29+
After this command you should be able to run the tests and build the documentation.
30+
See below on how to do that.
31+
32+
Running tests
33+
-------------
34+
35+
To run the tests you can use ``pytest -v`` in the top-level directory. Note that
36+
pytest tests against the installed package. To update the installed package
37+
after you've made changes use:
38+
39+
.. code-block:: bash
40+
41+
pip install --upgrade .
42+
pytest -v
43+
44+
Note that tests that require PyCuda and/or a CUDA capable GPU will be skipped if these
45+
are not installed/present. The same holds for thats that require PyOpenCL.
46+
47+
Contributions you make to the Kernel Tuner should not break any of the tests
48+
even if you can not run them locally.
49+
50+
The examples can be seen as *integration tests* for the Kernel Tuner. Note that
51+
these will also use the installed package.
52+
53+
Building documentation
54+
----------------------
55+
56+
Documentation is located in the ``doc/`` directory. This is where you can type
57+
``make html`` to generate the html pages in the ``doc/build/html`` directory.
58+
59+
The source files used for building the documentation is located in
60+
``doc/source``. The tutorials should be included in the ``tutorials/`` directory
61+
and a symlink can be used to add them to the source files for building
62+
documentation.
63+
64+
To update the documentation pages hosted on the GitHub the generated contents of
65+
``doc/build/html`` should be copied to the top-level directory of the
66+
``gh-pages`` branch.

INSTALL.rst

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
Installation Guide
2+
==================
3+
4+
The Kernel Tuner requires several packages to be installed. First of all you need a
5+
working Python version, several Python packages, and optionally CUDA and/or OpenCL
6+
installations. All of this is explained in detail in this guide.
7+
8+
9+
Python
10+
------
11+
12+
First of all you need a Python installation. I recommend using Python 3 and
13+
installing it with `Miniconda <https://conda.io/miniconda.html>`__.
14+
15+
Linux users could type the following to download and install Python 3 using Miniconda:
16+
17+
.. code-block:: bash
18+
19+
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
20+
bash Miniconda3-latest-Linux-x86_64.sh
21+
22+
You are of course also free to use your own Python installation, and the Kernel Tuner
23+
is developed to be fully compatible with Python 3.5 and newer, and also Python 2.7.
24+
25+
Installing Python Packages
26+
--------------------------
27+
28+
Note that when you are using a native Python installation, the `pip` commands used to
29+
install dependencies probably require `sudo` rights.
30+
31+
Sudo rights are typically not required when using Miniconda or virtual environments.
32+
33+
The following command will install all required dependencies:
34+
35+
.. code-block:: bash
36+
37+
pip install -r requirements.txt
38+
39+
There are also optional dependencies, explained below.
40+
41+
CUDA and PyCUDA
42+
---------------
43+
44+
Installing CUDA and PyCUDA is optional, because you may want to only use the Kernel
45+
Tuner for tuning OpenCL or C kernels.
46+
47+
If you want to use the Kernel Tuner to tune
48+
CUDA kernels you will first need to install the CUDA toolkit
49+
(https://developer.nvidia.com/cuda-toolkit).
50+
51+
It's very important that you install the CUDA toolkit before trying to install PyCuda.
52+
53+
You can install PyCuda using:
54+
55+
.. code-block:: bash
56+
57+
pip install pycuda
58+
59+
If you run into trouble with installing PyCuda, make sure you have CUDA installed first.
60+
Also make sure that the Python package Numpy is already installed (this should be the case
61+
because it is also a requirement for the Kernel Tuner).
62+
63+
If you retry the ``pip install pycuda`` command you may need to use the
64+
``--no-cache-dir`` option to ensure the pycuda installation really starts over.
65+
66+
If this fails, I recommend to see the PyCuda
67+
installation guide (https://wiki.tiker.net/PyCuda/Installation)
68+
69+
70+
OpenCL and PyOpenCL
71+
-------------------
72+
73+
Before we can install PyOpenCL you'll need an OpenCL compiler. There are several
74+
OpenCL compilers available depending on the OpenCL platform you want to your
75+
code to run on.
76+
77+
`AMD APP SDK <http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/>`__
78+
`Intel OpenCL <https://software.intel.com/en-us/iocl_rt_ref>`__
79+
`CUDA Toolkit <https://developer.nvidia.com/cuda-toolkit>`__
80+
`Apple OpenCL <https://developer.apple.com/opencl/>`__
81+
`Beignet <https://www.freedesktop.org/wiki/Software/Beignet/>`__
82+
83+
You can also look at this `OpenCL Installation Guide <https://wiki.tiker.net/OpenCLHowTo>`__ for PyOpenCL.
84+
85+
After you've installed your OpenCL compiler of choice you can install PyOpenCL using:
86+
87+
.. code-block:: bash
88+
89+
pip install pyopencl
90+
91+
If this fails, please see the PyOpenCL installation guide (https://wiki.tiker.net/PyOpenCL/Installation)
92+
93+
94+
Installing the Kernel Tuner
95+
---------------------------
96+
97+
So far we've talked about all the dependencies, but not the Kernel Tuner itself.
98+
99+
The easiest way to install is using pip:
100+
101+
.. code-block:: bash
102+
103+
pip install kernel_tuner
104+
105+
But you can also install from the git repository. This way you also get the
106+
examples and the tutorials.
107+
108+
.. code-block:: bash
109+
110+
git clone https://github.com/benvanwerkhoven/kernel_tuner.git
111+
cd kernel_tuner
112+
pip install -r requirements.txt
113+
pip install .
114+
115+
Then go to any of the ``examples/cuda`` or ``examples/opencl`` directories
116+
and see if you can run the ``vector_add.py`` example to test your installation.
117+
118+
119+
120+
121+

README.rst

Lines changed: 23 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -36,41 +36,34 @@ The full documentation is available
3636
Installation
3737
------------
3838

39-
To install from PyPi:
39+
The easiest way to install the Kernel Tuner is using pip:
4040

41-
- ``pip install kernel_tuner``
41+
.. code-block:: bash
4242
43-
To install from the source (and get the tutorial and examples):
43+
pip install kernel_tuner
4444
45-
- clone the repository
46-
47-
- With a GitHub account: ``git clone git@github.com:benvanwerkhoven/kernel_tuner.git``
48-
- Without GitHub account: ``git clone https://github.com/benvanwerkhoven/kernel_tuner.git``
49-
50-
- change into the top-level directory
45+
But you can also install from the git repository. This way you also get the
46+
examples and the tutorials:
5147

52-
- ``cd kernel_tuner``
53-
54-
- install using
55-
56-
- ``pip install .``
48+
.. code-block:: bash
5749
58-
Dependencies
59-
------------
60-
Python 2.7 or Python 3.5
61-
62-
PyCuda and/or PyOpenCL (https://mathema.tician.de/software/)
63-
64-
- To tune CUDA kernels
50+
git clone https://github.com/benvanwerkhoven/kernel_tuner.git
51+
cd kernel_tuner
52+
pip install -r requirements.txt
53+
pip install .
54+
55+
To tune CUDA kernels:
6556

66-
- Make sure you have the `CUDA Toolkit <https://developer.nvidia.com/cuda-toolkit>`_ installed
67-
- You can install PyCuda using ``pip install pycuda``
57+
- First, make sure you have the `CUDA Toolkit <https://developer.nvidia.com/cuda-toolkit>`_ installed
58+
- You can install PyCuda using ``pip install pycuda``
6859

69-
- To tune OpenCL kernels
60+
To tune OpenCL kernels:
7061

71-
- Make sure you have an OpenCL compiler for your intended OpenCL platform
62+
- First, make sure you have an OpenCL compiler for your intended OpenCL platform
7263
- You can install PyOpenCL using ``pip install pyopencl``
7364

65+
If you need more information about how to install the Kernel Tuner and all dependencies see the `installation guide <http://benvanwerkhoven.github.io/kernel_tuner/install.html>`__
66+
7467
Example usage
7568
-------------
7669

@@ -96,7 +89,7 @@ The following shows a simple example for tuning a CUDA kernel:
9689
args = [c, a, b, n]
9790
9891
tune_params = dict()
99-
tune_params["block_size_x"] = [128+64*i for i in range(15)]
92+
tune_params["block_size_x"] = [32, 64, 128, 256, 512]
10093
10194
tune_kernel("vector_add", kernel_string, size, args, tune_params)
10295
@@ -128,7 +121,7 @@ kernels and the scripts to tune them.
128121
Tuning host and kernel code
129122
---------------------------
130123

131-
It is also possible to tune for combinations of tunable parameters in
124+
It is possible to tune for combinations of tunable parameters in
132125
both host and kernel code. This allows for a number of powerfull things,
133126
such as tuning the number of streams for a kernel that uses CUDA Streams
134127
or OpenCL Command Queues to overlap transfers between host and device
@@ -152,33 +145,10 @@ expected output of the kernel. Input arguments are replaced with None.
152145
answer = [a+b, None, None] # the order matches the arguments (in args) to the kernel
153146
tune_kernel("vector_add", kernel_string, size, args, tune_params, answer=answer)
154147
155-
Contribution guide
156-
------------------
157-
158-
The kernel tuner follows the Google Python style guide, with Sphinxdoc
159-
docstrings for module public functions. If you want to contribute to the
160-
project please fork it, create a branch including your addition, and
161-
create a pull request.
162-
163-
The tests use relative imports and can be run directly after making
164-
changes to the code. To run all tests use ``nosetests`` in the main
165-
directory. To run the examples after code changes, you need to run
166-
``pip install --upgrade .`` in the main directory. Documentation is
167-
generated by typing ``make html`` in the doc directory, the contents of
168-
``doc/build/html/`` should then be copied to ``sphinxdoc`` directory of
169-
the ``gh-pages`` branch.
170-
171-
Before creating a pull request please ensure the following:
172-
173-
* You have written unit tests to test your additions and all unit tests pass
174-
* The examples still work and produce the same (or better) results
175-
* The code is compatible with both Python 2.7 and Python 3.5
176-
* An entry about the change or addition is created in CHANGELOG.md
177-
178-
Contributing authors so far:
148+
Contributing
149+
------------
179150

180-
* Ben van Werkhoven
181-
* Berend Weel
151+
Please see the `Contributions Guide <http://benvanwerkhoven.github.io/kernel_tuner/contributing.html>`__.
182152

183153
Citation
184154
--------

doc/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
# built documents.
6060
#
6161
# The short X.Y version.
62-
version = u'0.1.2'
62+
version = u'0.1.3'
6363
# The full version, including alpha/beta/rc tags.
64-
release = u'0.1.2'
64+
release = u'0.1.3'
6565

6666
# The language for content autogenerated by Sphinx. Refer to documentation
6767
# for a list of supported languages.

doc/source/contributing.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. toctree::
2+
:maxdepth: 2
3+
4+
.. _contributing:
5+
6+
7+
.. include:: ../../CONTRIBUTING.rst
8+

doc/source/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Contents:
1212
:maxdepth: 1
1313

1414
Introduction <self>
15+
install
1516
examples
1617
tutorial
1718
convolution
@@ -20,6 +21,7 @@ Contents:
2021
hostcode
2122
user-api
2223
design
24+
contributing
2325

2426
Introduction
2527
============

doc/source/install.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. toctree::
2+
:maxdepth: 2
3+
4+
.. _install:
5+
6+
7+
.. include:: ../../INSTALL.rst
8+

requirements-dev.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
numpy>=1.7.1
2+
mock>=2.0.0
3+
nose>=1.3.7
4+
pytest>=3.0.3
5+
Sphinx>=1.4.8
6+
sphinx-rtd-theme>=0.1.9
7+
nbsphinx>=0.2.13

requirements.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
numpy>=1.7.1
2-
mock>=2.0.0
3-
nose>=1.3.7
4-
pytest>=3.0.3
5-
pycuda>=2016.1.1
6-
pyopencl>=2015.2.4
7-

0 commit comments

Comments
 (0)