Skip to content

Commit 59e2136

Browse files
committed
Initial PR with doc changes
1 parent 3d79ef9 commit 59e2136

File tree

19 files changed

+585
-468
lines changed

19 files changed

+585
-468
lines changed

CODE_OF_CONDUCT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
## Our Pledge
44

55
In the interest of fostering an open and welcoming environment, we as
6-
contributors and maintainers pledge to making participation in our project and
6+
contributors and maintainers pledge to make participation in our project and
77
our community a harassment-free experience for everyone, regardless of age, body
88
size, disability, ethnicity, sex characteristics, gender identity and expression,
99
level of experience, education, socio-economic status, nationality, personal
1010
appearance, race, religion, or sexual identity and orientation.
1111

12-
## Our Standards
12+
# Our Standards
1313

1414
Examples of behavior that contributes to creating a positive environment
1515
include:
@@ -28,7 +28,7 @@ Examples of unacceptable behavior by participants include:
2828
* Public or private harassment
2929
* Publishing others' private information, such as a physical or electronic
3030
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
31+
* Other conduct that could reasonably be considered inappropriate in a
3232
professional setting
3333

3434
## Our Responsibilities

CONTRIBUTING.md

Lines changed: 108 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,48 @@
1-
# Contributing
2-
3-
We welcome your contributions. To contribute, please
4-
- create an [issue](https://github.com/IntelPython/dpctl/issues/new),
5-
- participate in [discussions](https://github.com/IntelPython/dpctl/discussions), or
6-
- open a [pull request](https://github.com/IntelPython/dpctl/compare) from changes committed to your own fork
7-
of `dpctl`.
8-
9-
**N.B.**: Please make sure to tick the checkmark "[x] Allow edits from maintainers" to allow proper functioning
10-
of automation bots, see "[Working with forks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)" GitHub document for more details.
11-
1+
# Contributing <!-- omit in toc -->
2+
3+
We welcome your contributions!
4+
5+
To contribute, do one of the following:
6+
- create an [issue](https://github.com/IntelPython/dpctl/issues/new)
7+
- participate in [discussions](https://github.com/IntelPython/dpctl/discussions)
8+
- open a [pull request](https://github.com/IntelPython/dpctl/compare) from changes committed to your fork
9+
of `dpctl`
10+
11+
> **NOTE:** Make sure to check the box ``"[x] Allow edits from maintainers"`` to allow the proper functioning
12+
> of automation bots. See [Working with forks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) for more details.
13+
14+
# Table of Contents <!-- omit in toc -->
15+
- [Mechanical Source Issues](#mechanical-source-issues)
16+
- [Source Code Formatting](#source-code-formatting)
17+
- [C/C++ Code Style](#cc-code-style)
18+
- [Python Code Style](#python-code-style)
19+
- [Setting Up a Pre-commit](#setting-up-a-pre-commit)
20+
- [C/C++ File Headers](#cc-file-headers)
21+
- [Python* File Headers](#python-file-headers)
22+
- [Security](#security)
23+
- [Bandit](#bandit)
24+
- [Code Coverage](#code-coverage)
25+
- [Error Reporting and Logging](#error-reporting-and-logging)
26+
- [Optional use of the Google* logging library (glog*)](#optional-use-of-the-google-logging-library-glog)
1227

1328

1429
# Mechanical Source Issues
1530

1631
## Source Code Formatting
1732

18-
### C/C++ code style
33+
### C/C++ Code Style
1934

20-
We use [clang-format](https://clang.llvm.org/docs/ClangFormat.html) code formatter.
35+
We use a [clang-format](https://clang.llvm.org/docs/ClangFormat.html) code formatter.
2136

22-
Install: `conda install clang-tools`
37+
To install, run:
38+
```bash
39+
conda install clang-tools
40+
```
41+
Revision: `10.0.1`
2342

24-
- Revision: `10.0.1`
25-
- See the default configuration used by dpctl in `.clang-format`.
43+
See the default configuration used by dpctl in `.clang-format`.
2644

27-
Run before each commit:
45+
Before each commit, run:
2846

2947
```bash
3048
clang-format -style=file -i \
@@ -36,10 +54,9 @@ clang-format -style=file -i \
3654
libsyclinterface/helper/source/*.cpp
3755
```
3856

39-
> **_NOTE:_** A much simpler option is to use `pre-commit` and the
40-
> `clang-format` hook that we provide.
57+
> **NOTE:** It is easier to use `pre-commit` and the `clang-format` hook.
4158
42-
### Python code style
59+
### Python Code Style
4360

4461
We use the following Python code style tools:
4562
- [black](https://black.readthedocs.io/en/stable/) code formatter.
@@ -49,27 +66,27 @@ We use the following Python code style tools:
4966
- [isort](https://pycqa.github.io/isort/) import sorter.
5067
- Revision `5.10.1`.
5168

52-
- Refer `pyproject.toml` and `.flake8` config files for current configurations.
69+
> **NOTE:** Refer `pyproject.toml` and `.flake8` config files for current configurations.
70+
71+
Run these three tools before each commit.
5372

54-
Please run these three tools before each commit. Although, you may choose to
55-
do so manually, but it is much easier and preferable to automate these checks.
56-
Refer your IDE docs to set them up in your IDE, or you can set up `pre-commit`
57-
to add git hooks.
73+
> **TIP:** Refer your IDE docs to automate these checks or set up `pre-commit` to add git hooks.
5874
59-
### Setting up pre-commit
75+
### Setting Up a Pre-commit
76+
77+
A `.pre-commit-config.yaml` is included to run various checks before you
78+
commit your code.
6079

61-
A `.pre-commit-config.yaml` is included to run various check before you
62-
commit your code. Here are the steps to setup `pre-commit` in your workflow:
80+
To setup `pre-commit` in your workflow, install:
6381

64-
- Install `pre-commit`: `pip install pre-commit`
65-
- Install the git hook scripts: `pre-commit install`
82+
- `pre-commit`: `pip install pre-commit`
83+
- the git hook scripts: `pre-commit install`
6684

67-
That should be it!
6885

6986
### C/C++ File Headers
7087

71-
Every C API source file should have a header on it that describes the basic
72-
purpose of the file. The standard header looks like this:
88+
Every C API source file should have a header that describes the file’s basic purpose.
89+
The standard header looks like this:
7390

7491
```
7592
//===----- dpctl_sycl_event_interface.h - C API for sycl::event -*-C++-*- ===//
@@ -97,21 +114,25 @@ purpose of the file. The standard header looks like this:
97114
///
98115
//===----------------------------------------------------------------------===//
99116
```
100-
Few things to note about this format:
101-
- The `-*- C++ -*-` string on the first line is needed to tell Emacs that
102-
the file is a C++ file. The string is only needed for `*.h` headers and
103-
should be omitted for `*.cpp` files. Without the string Emacs assumes that
117+
---
118+
> **NOTE:**
119+
- The `-*- C++ -*-` string on the first line tells Emacs* that
120+
it is a C++ file. The string is only needed for `*.h` headers and
121+
should be omitted for `*.cpp` files. Without the string, Emacs* assumes the
104122
file is a C header.
105-
- The copyright year should be updated every calendar year.
123+
- The copyright year must be updated every calendar year.
106124
- Each comment line should be a max of 80 chars.
107125
- A Doxygen `\file` tag describing the contents of the file must be provided.
108-
Also note that the `\file` tag is inside a Doxygen comment block (
109-
defined by `///` comment marker instead of the `//` comment marker used in the
126+
Note that the `\file` tag is inside a Doxygen comment block. It is
127+
defined by the `///` comment marker instead of the `//` comment marker used in the
110128
rest of the header.
111129

112-
### Python File Headers
130+
---
131+
132+
133+
### Python* File Headers
113134

114-
Every Python and Cython file should only include the following license header:
135+
Every Python* and Cython* file should only include the following license header:
115136

116137
```
117138
# Data Parallel Control (dpctl)
@@ -130,42 +151,49 @@ Every Python and Cython file should only include the following license header:
130151
# See the License for the specific language governing permissions and
131152
# limitations under the License.
132153
```
154+
133155
The copyright year should be updated every calendar year.
134156

135157
## Security
136158

137159
### Bandit
138160

139-
We use [Bandit](https://github.com/PyCQA/bandit) to find common security issues
140-
in Python code.
161+
We use [Bandit*](https://github.com/PyCQA/bandit) to find common security issues
162+
in the Python* code.
141163

142-
Install: `pip install bandit`
164+
To install, run:
165+
```bash
166+
pip install bandit
167+
```
143168

144-
- Revision: `1.7.0`
169+
Revision: `1.7.0`
145170

146-
Run before each commit: `bandit -r dpctl -lll`
171+
Before each commit, run:
172+
```bash
173+
bandit -r dpctl -lll
174+
```
147175

148176
## Code Coverage
149177

150-
Code coverage for both C and Python sources in dpctl is generated for each
178+
Code coverage, for both C and Python sources in dpctl, is generated for each
151179
pull request (PR). A PR cannot be merged if it leads to a drop in the code
152-
coverage by more than five percentage points. *Ergo, do not forget to write
153-
unit tests for your changes.* To check the code coverage for your code, follow
154-
these steps:
180+
coverage by more than five percentage points. Therefore, write
181+
unit tests for your changes.
182+
183+
To check the code coverage for your code, follow these steps:
155184

156185
1. Install dependencies for C/C++ source.
157186

158-
For C/C++ source we require `lcov`, `llvm-cov`, and `llvm-profdata`. Note
159-
that `llvm-cov` and `llvm-profdata` should be version 11.0 or higher. If you
160-
have multiple `llvm-cov` tools installed, most likely because you have
161-
multiple llvm installations, you should set the `LLVM_TOOLS_HOME`
187+
For C/C++ source, we require `lcov`, `llvm-cov`, and `llvm-profdata`. `llvm-cov` and `llvm-profdata`
188+
should be version 11.0 or higher. If you
189+
have multiple `llvm-cov` tools installed, set the `LLVM_TOOLS_HOME`
162190
environment variable to make sure the correct one is used to generate
163191
coverage.
164192

165-
2. Install dependencies for Python sources.
193+
2. Install dependencies for Python* sources.
166194

167-
To generate the coverage data for dpctl's Python sources, you only need to
168-
install `coverage`.
195+
To generate the coverage data for dpctl Python* sources,
196+
install `coverage`:
169197

170198
```bash
171199
python -m pip install coverage[toml]
@@ -178,14 +206,14 @@ these steps:
178206
coverage html
179207
```
180208

181-
Note that code coverage builds the C sources with debug symbols. For this
209+
The code coverage builds the C sources with debug symbols. For this
182210
reason, the coverage script builds the package in `develop` mode of
183211
`setup.py`.
184212

185-
The coverage results for the C and Python sources will be printed to the
186-
terminal during the build (C API) and during the pytest execution (Python).
187-
The detailed coverage reports for the C API is saved to the
188-
`dpctl-c-api-coverage` directory. The Python coverage reports are saved to
213+
The coverage results for the C and Python* sources are printed to the
214+
terminal during the build (C API) and pytest execution (Python*).
215+
The detailed coverage reports for the C API are saved to the
216+
`dpctl-c-api-coverage` directory. The Python* coverage reports are saved to
189217
the `htmlcov` directory.
190218

191219
The coverage data for every PR is also available online at
@@ -201,37 +229,39 @@ these steps:
201229
> ^
202230
> 1 error generated.
203231
> ```
204-
> The error is related to the `tcl` package. You should uninstall the `tcl`
205-
> package to resolve the error.
232+
> The error is related to the `tcl` package. Uninstall the `tcl`
233+
> package to resolve it.
206234

207235
## Error Reporting and Logging
208236

209-
The SyclInterface library responds to `DPCTL_VERBOSITY` environment variable that controls the severity level of errors printed to console.
210-
One can specify one of the following severity levels (in increasing order of severity): `warning` and `error`.
237+
The SyclInterface library responds to the `DPCTL_VERBOSITY` environment variable that controls the severity level of errors printed to the console.
238+
Specify one of the following severity levels (in increasing order of severity): `warning` and `error` by running:
211239

212240
```bash
213241
export DPCTL_VERBOSITY=warning
214242
```
215243

216-
Messages of a given severity are shown not only in the console for that severity, but also for the higher severity. For example, the severity level `warning` will output severity errors for `error` and `warning` to the console.
244+
Messages of a given severity are shown not only in the console for that severity but also for the higher severity. For example, the severity level `warning` outputs severity errors for `error` and `warning` to the console.
217245

218-
### Optional use of the Google logging library (glog)
246+
### Optional use of the Google* logging library (glog*)
219247

220-
Dpctl's error handler for libsyclinterface can be optionally configured to use [glog](https://github.com/google/glog). To use glog, follow the following steps:
248+
The dpctl error handler for libsyclinterface can be optionally configured to use [glog*](https://github.com/google/glog).
221249

222-
1. Install glog package of the latest version (0.5.0)
250+
To use glog*, complete the following steps:
251+
252+
1. Install glog* package of the latest version
223253

224254
```bash
225255
conda install glog
226256
```
227-
2. Build dpctl with glog support
257+
2. Build dpctl with the glog* support
228258

229259
```bash
230260
python scripts/build_locally.py --oneapi --glog
231261
```
232262

233-
3. Use `dpctl._diagnostics.syclinterface_diagnostics(verbosity="warning", log_dir=None)` context manager to switch library diagnostics on for a block of Python code.
234-
Use `DPCTLService_InitLogger` and `DPCTLService_ShutdownLogger` library C functions during library development to initialize the Google's logging library and de-initialize accordingly
263+
3. Use `dpctl._diagnostics.syclinterface_diagnostics(verbosity="warning", log_dir=None)` context manager to switch library diagnostics on for a block of a Python* code.
264+
Use `DPCTLService_InitLogger` and `DPCTLService_ShutdownLogger` library C functions during library development to initialize Google's logging library and de-initialize accordingly:
235265
236266
```python
237267
from dpctl._diagnostics import syclinterface_diagnostics
@@ -245,10 +275,9 @@ with syclinterface_diagnostics():
245275
DPCTLService_InitLogger(const char *app_name, const char *log_dir);
246276
DPCTLService_ShutdownLogger();
247277
```
248-
249-
- `*app_name` - name of the executable file (prefix for logs of various levels).
250-
- `*log_dir` - directory path for writing log files. Specifying `NULL` results in logging to ``std::cerr``.
278+
Where:
279+
- `*app_name` - the name of the executable file (prefix for logs of various levels).
280+
- `*log_dir` - a directory path for writing log files. Specifying `NULL` results in logging to ``std::cerr``.
251281
252282
> **_NOTE:_**
253-
>
254-
> If `InitGoogleLogging` is not called before first use of glog, the library will self-initialize to `logtostderr` mode and log files will not be generated.
283+
> If `InitGoogleLogging` is not called before the first use of the glog*, the library self-initializes to the `logtostderr` mode, and log files are not generated.

0 commit comments

Comments
 (0)