Skip to content

Merge master to gold/2021 #1456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 17 additions & 46 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,71 +1,42 @@
BasedOnStyle: LLVM
IndentWidth: 4
UseTab: Never
Language: Cpp
Standard: Cpp11

AccessModifierOffset: -4

AlignConsecutiveDeclarations: false
AlignConsecutiveAssignments: false
AlignConsecutiveMacros: true
AlignTrailingComments: true
AlignConsecutiveBitFields: true
AlignEscapedNewlines: Right

AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty

AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
AlwaysBreakTemplateDeclarations: Yes

BinPackArguments: false
BinPackParameters: false

BreakBeforeBraces: Allman
BreakConstructorInitializersBeforeComma: true

BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterControlStatement: MultiLine
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
BeforeCatch: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBraces: Custom

ColumnLimit: 120
CommentPragmas: '.*'
ColumnLimit: 80

IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: true

KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: All

PointerAlignment: Left
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false

SortIncludes: false
ReflowComments: true

IncludeCategories:
- Regex: '^".*'
Priority: 3
- Regex: '^<.*'
Priority: 2
SortIncludes: true
Standard: c++17
64 changes: 64 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[flake8]
extend-ignore =
# whitespace before ':' (currently conflicts with black formatting):
E203,
# line too long (in docstrings):
E501,
# ‘from module import *’ used; unable to detect undefined names:
F403,
# name may be undefined, or defined from star imports: module:
F405,
# doc line too long (105 > 80 characters):
W505,
# missing docstring in public module:
D100,
# missing docstring in public class:
D101,
# missing docstring in public method:
D102,
# missing docstring in public function:
D103,
# missing docstring in public package:
D104,
# missing docstring in magic method:
D105,
# missing docstring in __init__:
D107,
# no blank lines allowed after function docstring:
D202,
# first line should end with a period:
D400,
# first line should be in imperative mood:
D401,
# first line should not be the function's "signature":
D402,
# section has no content:
D414

per-file-ignores =
__init__.py: E402, F401
dpnp/dpnp_algo/__init__.py: F401
dpnp/dpnp_algo/__init__.py: F401
dpnp/fft/__init__.py: F401
dpnp/linalg/__init__.py: F401
dpnp/random/__init__.py: F401
dpnp/dpnp_iface.py: D205

filename = *.py, *.pyx, *.pxi, *.pxd
max_line_length = 80
max-doc-length = 80
show-source = True

exclude =
.git,
benchmarks/*.py,
build,
dpnp/to_numba/*.py,
conda.recipe,
tests/*.py,
tests_external/*.py,
version.py,

# Print detailed statistic if any issue detected
count = True
statistics = True
19 changes: 19 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs

# Add pre-commit hooks
b0cd5f85c9b0c2705359fee3a3f4f3feda53bfa0

# Add black to pre-commit config
88981b5ae1c99f9b64758db44dfb39f2c20b10db

# Add clang-format to pre-commit config
ae755b57a9aeeb09435594aa7f6a04bf4cdc55fa

# Add isort to pre-commit config
3f202cf778cc47698310f2d040e5f83bdf2a90da

# Add flake8 to pre-commit config
c106d91b866f4acd30226b68519b12a73a881490

# Add pygrep-hooks to pre-commit config
e62718415aa3660da5f607e352c991a063a54219
3 changes: 3 additions & 0 deletions .github/workflows/build-sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
with:
access_token: ${{ github.token }}

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main

- name: Install Intel repository
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: '3.10'
- uses: pre-commit/[email protected]
- name: Set up clang-format
run: |
sudo apt-get install -y clang-format-12
sudo unlink /usr/bin/clang-format
sudo ln -s /usr/bin/clang-format-12 /usr/bin/clang-format
clang-format --version

- uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: '3.10'
- uses: pre-commit/[email protected]
66 changes: 65 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,72 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/PyCQA/bandit
rev: '1.7.0'
rev: '1.7.5'
hooks:
- id: bandit
pass_filenames: false
args: ["-r", "dpnp", "-lll"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-toml
- id: debug-statements
- id: destroyed-symlinks
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-check-mock-methods
- id: python-no-eval
exclude: |
(?x)^(
tests/test_arraycreation.py|
tests/test_sycl_queue.py|
tests/test_usm_type.py
)$
- id: python-no-log-warn
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args: ["--check", "--diff", "--color"]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: ["--config=.flake8"]
additional_dependencies:
- flake8-docstrings==1.7.0
- flake8-bugbear==23.6.5
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args: ["-i"]
22 changes: 11 additions & 11 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
Copyright (c) 2016-2020, Intel Corporation
Copyright (c) 2016-2023, Intel Corporation
All rights reserved.

Redistribution and use in source and binary forms, with or without
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Pre-commit](https://github.com/IntelPython/dpnp/actions/workflows/pre-commit.yml/badge.svg?branch=master&event=push)](https://github.com/IntelPython/dpnp/actions/workflows/pre-commit.yml)
[![Conda package](https://github.com/IntelPython/dpnp/actions/workflows/conda-package.yml/badge.svg?branch=master&event=push)](https://github.com/IntelPython/dpnp/actions/workflows/conda-package.yml)
[![Coverage Status](https://coveralls.io/repos/github/IntelPython/dpnp/badge.svg?branch=master)](https://coveralls.io/github/IntelPython/dpnp?branch=master)
Expand Down
15 changes: 9 additions & 6 deletions benchmarks/benchmarks/bench_elementwise.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import numpy

import dpnp

from .common import Benchmark


Expand All @@ -8,12 +10,13 @@
# but looks like first execution has additional overheads
# (need to be investigated)
class Elementwise(Benchmark):
executors = {'dpnp': dpnp, 'numpy': numpy}
params = [['dpnp', 'numpy'],
[2**16, 2**20, 2**24],
['float64', 'float32', 'int64', 'int32']
]
param_names = ['executor', 'size', 'dtype']
executors = {"dpnp": dpnp, "numpy": numpy}
params = [
["dpnp", "numpy"],
[2**16, 2**20, 2**24],
["float64", "float32", "int64", "int32"],
]
param_names = ["executor", "size", "dtype"]

def setup(self, executor, size, dtype):
self.np = self.executors[executor]
Expand Down
Loading