You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
- 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
104
122
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.
106
124
- Each comment line should be a max of 80 chars.
107
125
- 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
110
128
rest of the header.
111
129
112
-
### Python File Headers
130
+
---
131
+
132
+
133
+
### Python* File Headers
113
134
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:
115
136
116
137
```
117
138
# Data Parallel Control (dpctl)
@@ -130,42 +151,49 @@ Every Python and Cython file should only include the following license header:
130
151
# See the License for the specific language governing permissions and
131
152
# limitations under the License.
132
153
```
154
+
133
155
The copyright year should be updated every calendar year.
134
156
135
157
## Security
136
158
137
159
### Bandit
138
160
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.
141
163
142
-
Install: `pip install bandit`
164
+
To install, run:
165
+
```bash
166
+
pip install bandit
167
+
```
143
168
144
-
-Revision: `1.7.0`
169
+
Revision: `1.7.0`
145
170
146
-
Run before each commit: `bandit -r dpctl -lll`
171
+
Before each commit, run:
172
+
```bash
173
+
bandit -r dpctl -lll
174
+
```
147
175
148
176
## Code Coverage
149
177
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
151
179
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:
155
184
156
185
1. Install dependencies for C/C++ source.
157
186
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`
162
190
environment variable to make sure the correct one is used to generate
163
191
coverage.
164
192
165
-
2. Install dependencies for Python sources.
193
+
2. Install dependencies for Python* sources.
166
194
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`:
169
197
170
198
```bash
171
199
python -m pip install coverage[toml]
@@ -178,14 +206,14 @@ these steps:
178
206
coverage html
179
207
```
180
208
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
182
210
reason, the coverage script builds the package in`develop` mode of
183
211
`setup.py`.
184
212
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
189
217
the `htmlcov` directory.
190
218
191
219
The coverage data for every PR is also available online at
@@ -201,37 +229,39 @@ these steps:
201
229
> ^
202
230
> 1 error generated.
203
231
> ```
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.
206
234
207
235
## Error Reporting and Logging
208
236
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:
211
239
212
240
```bash
213
241
export DPCTL_VERBOSITY=warning
214
242
```
215
243
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.
217
245
218
-
### Optional use of the Google logging library (glog)
246
+
### Optional use of the Google* logging library (glog*)
219
247
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).
221
249
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
223
253
224
254
```bash
225
255
conda install glog
226
256
```
227
-
2. Build dpctl with glog support
257
+
2. Build dpctl with the glog* support
228
258
229
259
```bash
230
260
python scripts/build_locally.py --oneapi --glog
231
261
```
232
262
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:
235
265
236
266
```python
237
267
from dpctl._diagnostics import syclinterface_diagnostics
@@ -245,10 +275,9 @@ with syclinterface_diagnostics():
- `*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``.
251
281
252
282
> **_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