Skip to content

Commit

Permalink
Merge branch 'branch-22.03' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinz committed Mar 31, 2022
2 parents 27a3248 + 77abab6 commit fb1b1b2
Show file tree
Hide file tree
Showing 149 changed files with 13,302 additions and 5,392 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@ jobs:
if: ${{ github.repository == 'nv-legate/cunumeric' }}
runs-on: self-hosted
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJSON(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJSON(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJSON(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJSON(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJSON(matrix) }}
run: echo "$MATRIX_CONTEXT"
- name: Run CI build
run: |
/data/github-runner/legate-bin/setup.sh
Expand Down Expand Up @@ -54,6 +78,30 @@ jobs:
- {name: Eager execution test, options: --use eager, log: eager}
name: ${{ matrix.name }}
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJSON(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJSON(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJSON(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJSON(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJSON(matrix) }}
run: echo "$MATRIX_CONTEXT"
- name: Prepare
run: |
/data/github-runner/legate-bin/setup.sh
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ realm_defines.h
cunumeric/install_info.py
/build/*
/docs/cunumeric/build
/docs/cunumeric/source/api/generated
/docs/cunumeric/source/comparison/comparison_table.rst.inc
*.egg-info
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v13.0.0' # Use the sha / tag you want to point at
rev: 'v13.0.1' # Use the sha / tag you want to point at
hooks:
- id: clang-format
files: \.(cu|cuh|h|cc|inl)$
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to cuNumeric

CuNumeric is an open-source project released under the [Apache license](LICENSE). We welcome any and all contributions, and we hope that you can help us develop a strong community.
CuNumeric is an open-source project released under the [Apache license, version 2.0](https://www.apache.org/licenses/LICENSE-2.0). We welcome any and all contributions, and we hope that you can help us develop a strong community.

## How to begin

Expand All @@ -10,7 +10,7 @@ Once you are ready to start development, we ask you to work on a [fork](https://

## The Legalese: Developer Certificate of Origin

CuNumeric is released under the open-source Apache license (see our [LICENSE](LICENSE) file) free to use, modify, and redistribute. To ensure that the license can be exercised without encumbrance, we ask you that you only contribute your own work or work to which you have the intellectual rights. To that end, we employ the Developer's Certificate of Origin (DCO), which is the lightweight mechanism for you to certify that you are legally able to make your contribution. Here is the full text of the certificate (also available at [DeveloperCertificate.org](DeveloperCertificate.org)):
CuNumeric is released under the open-source [Apache license, version 2.0](https://www.apache.org/licenses/LICENSE-2.0), and is free to use, modify, and redistribute. To ensure that the license can be exercised without encumbrance, we ask you that you only contribute your own work or work to which you have the intellectual rights. To that end, we employ the Developer's Certificate of Origin (DCO), which is the lightweight mechanism for you to certify that you are legally able to make your contribution. Here is the full text of the certificate (also available at [DeveloperCertificate.org](https://DeveloperCertificate.org)):

````
Developer Certificate of Origin
Expand Down Expand Up @@ -67,6 +67,6 @@ As we suggested at the beginning of this document, it will be really helpful to

## Code Formatting Requirements

CuNumeric has a set of coding standards that are expected from all the code merged into the project. The coding standards are defined by the set of tools we use to format our code. We use the [pre-commit](https://pre-commit.com/) framework to run our formatting tools. Our specific setup of pre-commit is defined in [.pre-commit-config.yaml](.pre-commit-config.yaml). The easiest way to meet the coding standards is to simply use the pre-commit framework to run all the checks for you. Please visit the [pre-commit project page](https://pre-commit.com/) for pre-commit installation and usage instructions. Once pre-commit is installed in the cuNumeric repo, all the checks and formatting will be run on every commit, but one can also run the checks explicitly as detailed in pre-commit documentation.
CuNumeric has a set of coding standards that are expected from all the code merged into the project. The coding standards are defined by the set of tools we use to format our code. We use the [pre-commit](https://pre-commit.com/) framework to run our formatting tools. The easiest way to meet the coding standards is to simply use the pre-commit framework to run all the checks for you. Please visit the [pre-commit project page](https://pre-commit.com/) for pre-commit installation and usage instructions. Once pre-commit is installed in the cuNumeric repo, all the checks and formatting will be run on every commit, but one can also run the checks explicitly as detailed in pre-commit documentation.

We hope that the automation of our formatting checks will make it easy to comply with our coding standards. If you encounter problems with code formatting, however, please let us know in a comment on your PR, and we will do our best to help.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ If you have questions, please contact us at legate(at)nvidia.com.

## Installation

cuNumeric is available on conda:
cuNumeric is available [on conda](https://anaconda.org/legate/cunumeric):

```
conda install -c nvidia -c conda-forge -c legate cunumeric
Expand All @@ -66,12 +66,14 @@ Users must have a working installation of the
[Legate Core](https://github.com/nv-legate/legate.core)
library prior to installing cuNumeric.

cuNumeric has similar dependencies to Legate Core:
cuNumeric requires the following:

- Python >= 3.7
- [CUDA](https://developer.nvidia.com/cuda-downloads) >= 8.0
- GNU Make
- C++14 compatible compiler (g++, clang, or nvc++)
- the Python packages listed in the [conda environment file](conda/cunumeric_dev.yml)
- Fortran compiler (for building OpenBLAS; not necessary if you provide a pre-built version of OpenBLAS)
- the Python packages listed in `conda/cunumeric_dev.yml`

See the [corresponding section](https://github.com/nv-legate/legate.core#dependencies)
on the Legate Core instructions for help on installing the required Python packages
Expand Down
7 changes: 3 additions & 4 deletions conda/cunumeric_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ dependencies:
- clang>=8
- clang-tools>=8
- cutensor>=1.3.3
- nccl
- numpy
- numpydoc
- opt_einsum
- packaging
- pre-commit
- pyarrow>=5
- pydata-sphinx-theme
- python>=3.7
- scipy
- setuptools>=60
- sphinx
- pydata-sphinx-theme
- sphinx-markdown-tables
- sphinx-copybutton
- sphinx-markdown-tables
18 changes: 6 additions & 12 deletions cunumeric/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,15 @@
:meta private:
"""

import sys as _sys

import numpy as _np

from cunumeric import linalg, random
from cunumeric.array import ndarray
from cunumeric.module import *
from cunumeric.ufunc import *
from cunumeric.utils import (
add_missing_attributes as _add_missing_attributes,
)

_thismodule = _sys.modules[__name__]
from cunumeric._ufunc import *
from cunumeric.coverage import clone_module

# map any undefined attributes to numpy
_add_missing_attributes(_np, _thismodule)
clone_module(_np, globals())

# Remote this method from the scope
del _add_missing_attributes
del clone_module
del _np
21 changes: 21 additions & 0 deletions cunumeric/_ufunc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2022 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .bit_twiddling import *
from .comparison import *
from .math import *
from .floating import *
from .trigonometric import *
from .ufunc import ufunc
64 changes: 64 additions & 0 deletions cunumeric/_ufunc/bit_twiddling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2022 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from cunumeric.config import BinaryOpCode, UnaryOpCode

from .ufunc import create_binary_ufunc, create_unary_ufunc, integer_dtypes

bitwise_and = create_binary_ufunc(
"Compute the bit-wise AND of two arrays element-wise.",
"bitwise_and",
BinaryOpCode.BITWISE_AND,
["?"] + integer_dtypes,
)

bitwise_or = create_binary_ufunc(
"Compute the bit-wise OR of two arrays element-wise.",
"bitwise_or",
BinaryOpCode.BITWISE_OR,
["?"] + integer_dtypes,
)

bitwise_xor = create_binary_ufunc(
"Compute the bit-wise XOR of two arrays element-wise.",
"bitwise_xor",
BinaryOpCode.BITWISE_XOR,
["?"] + integer_dtypes,
)

invert = create_unary_ufunc(
"Compute bit-wise inversion, or bit-wise NOT, element-wise.",
"invert",
UnaryOpCode.INVERT,
["?"] + integer_dtypes,
overrides={"?": UnaryOpCode.LOGICAL_NOT},
)

left_shift = create_binary_ufunc(
"Shift the bits of an integer to the left.",
"left_shift",
BinaryOpCode.LEFT_SHIFT,
integer_dtypes,
)

right_shift = create_binary_ufunc(
"Shift the bits of an integer to the right.",
"right_shift",
BinaryOpCode.RIGHT_SHIFT,
integer_dtypes,
)


bitwise_not = invert
121 changes: 121 additions & 0 deletions cunumeric/_ufunc/comparison.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Copyright 2022 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from cunumeric.config import BinaryOpCode, UnaryOpCode, UnaryRedCode

from .ufunc import (
all_dtypes,
create_binary_ufunc,
create_unary_ufunc,
float_dtypes,
integer_dtypes,
predicate_types_of,
relation_types_of,
)

greater = create_binary_ufunc(
"Return the truth value of (x1 > x2) element-wise.",
"greater",
BinaryOpCode.GREATER,
relation_types_of(all_dtypes),
)

greater_equal = create_binary_ufunc(
"Return the truth value of (x1 >= x2) element-wise.",
"greater_equal",
BinaryOpCode.GREATER_EQUAL,
relation_types_of(all_dtypes),
)

less = create_binary_ufunc(
"Return the truth value of (x1 < x2) element-wise.",
"less",
BinaryOpCode.LESS,
relation_types_of(all_dtypes),
)

less_equal = create_binary_ufunc(
"Return the truth value of (x1 =< x2) element-wise.",
"less",
BinaryOpCode.LESS_EQUAL,
relation_types_of(all_dtypes),
)

not_equal = create_binary_ufunc(
"Return (x1 != x2) element-wise.",
"not_equal",
BinaryOpCode.NOT_EQUAL,
relation_types_of(all_dtypes),
)

equal = create_binary_ufunc(
"Return (x1 == x2) element-wise.",
"equal",
BinaryOpCode.EQUAL,
relation_types_of(all_dtypes),
)

logical_and = create_binary_ufunc(
"Compute the truth value of x1 AND x2 element-wise.",
"logical_and",
BinaryOpCode.LOGICAL_AND,
relation_types_of(all_dtypes),
)

logical_or = create_binary_ufunc(
"Compute the truth value of x1 OR x2 element-wise.",
"logical_or",
BinaryOpCode.LOGICAL_OR,
relation_types_of(all_dtypes),
)

logical_xor = create_binary_ufunc(
"Compute the truth value of x1 XOR x2, element-wise.",
"logical_xor",
BinaryOpCode.LOGICAL_XOR,
relation_types_of(all_dtypes),
)

logical_not = create_unary_ufunc(
"Compute bit-wise inversion, or bit-wise NOT, element-wise.",
"invert",
UnaryOpCode.LOGICAL_NOT,
(
["??"]
+ predicate_types_of(integer_dtypes)
+ predicate_types_of(float_dtypes)
),
overrides={"?": UnaryOpCode.LOGICAL_NOT},
)

maximum = create_binary_ufunc(
"Element-wise maximum of array elements.",
"maximum",
BinaryOpCode.MAXIMUM,
all_dtypes,
red_code=UnaryRedCode.MAX,
)

fmax = maximum

minimum = create_binary_ufunc(
"Element-wise minimum of array elements.",
"minimum",
BinaryOpCode.MINIMUM,
all_dtypes,
red_code=UnaryRedCode.MIN,
)

fmin = minimum
Loading

0 comments on commit fb1b1b2

Please sign in to comment.