Skip to content

Commit

Permalink
Merge pull request #392 from nv-legate/branch-22.05
Browse files Browse the repository at this point in the history
Release v22.05.00
  • Loading branch information
marcinz authored Jun 4, 2022
2 parents 5e0e6b3 + 3a0e83e commit 0a642e8
Show file tree
Hide file tree
Showing 579 changed files with 20,257 additions and 13,922 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
fail-fast: false
matrix:
include:
- {name: 1 CPU test, options: --cpus 1, log: cpu}
- {name: 1 CPU test, options: --cpus 1 --unit, log: cpu}
- {name: 2 CPUs test, options: --cpus 2, log: cpus}
- {name: GPU test, options: --use cuda --gpus 1, log: gpu}
- {name: 2 GPUs test, options: --use cuda --gpus 2, log: gpus}
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.1.0
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v13.0.1' # Use the sha / tag you want to point at
rev: 'v14.0.3' # Use the sha / tag you want to point at
hooks:
- id: clang-format
files: \.(cu|cuh|h|cc|inl)$
Expand Down
39 changes: 39 additions & 0 deletions LICENSES_bundled.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
The cuNumeric repository and source distributions bundle several libraries that are
compatibly licensed. We list these here.


Name: Cephes
Files: src/cunumeric/cephes/*
License: 3-clause BSD
Distributed under 3-clause BSD license with permission from the author,
see https://lists.debian.org/debian-legal/2004/12/msg00295.html

Cephes Math Library Release 2.8: June, 2000
Copyright 1984, 1995, 2000 by Stephen L. Moshier

This software is derived from the Cephes Math Library and is
incorporated herein by permission of the author.

All rights reserved.

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, 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 and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

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 <COPYRIGHT HOLDER> 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 THE POSSIBILITY OF SUCH DAMAGE.
54 changes: 36 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ cuNumeric is available [on conda](https://anaconda.org/legate/cunumeric):
```
conda install -c nvidia -c conda-forge -c legate cunumeric
```
The conda package is compatible with CUDA >= 11.4 (CUDA driver version >= r470),
and Volta or later GPU architectures.

Pre-built docker images containing all Legate libraries, as well as specialized
install scripts for supported clusters are available on the
Docker image build scripts, as well as specialized install scripts for
supported clusters are available on the
[quickstart](https://github.com/nv-legate/quickstart) repo.

Read on for general instructions on building cuNumeric from source.
Expand All @@ -68,17 +70,25 @@ library prior to installing cuNumeric.

cuNumeric requires the following:

- Python >= 3.7
- [CUDA](https://developer.nvidia.com/cuda-downloads) >= 8.0
- Python >= 3.8
- [CUDA](https://developer.nvidia.com/cuda-downloads) >= 10.2
- GNU Make
- C++14 compatible compiler (g++, clang, or nvc++)
- C++17 compatible compiler (g++, clang, or nvc++)
- 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`
- the Python packages listed in any one of the conda environment files:
- `conda/environment-test-3.8.yml`
- `conda/environment-test-3.9.yml`
- `conda/environment-test-3.10.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
using conda.

cuNumeric is tested and guaranteed to be compatible with Volta and later GPU
architectures. You can use cuNumeric with Pascal GPUs as well, but there could
be issues due to lack of independent thread scheduling. Please report any such
issues on GitHub.

## Building from Source

Installation of cuNumeric is done with either `setup.py` for simple
Expand All @@ -92,22 +102,30 @@ python setup.py --with-core <path-to-legate-core-installation>
This will build cuNumeric against the Legate Core installation and then
install cuNumeric into the same location.

Note that after the first invocation of `setup.py` this repository will remember
which Legate Core installation to use and the `--with-core` option can be
omitted unless the user wants to change it.

Advanced users can also invoke `install.py --help` to see options for
configuring cuNumeric by invoking the `install.py` script directly.
If Legate Core has been installed with CUDA support, a working cuTENSOR
installation must also be provided to the installation command with the
`--with-cutensor` option:
```
python setup.py --with-core <path-to-legate-core-installation> --with-cutensor <path-to-cutensor-installation>
```

Of particular interest to cuNumeric users will likely be the option for
specifying an installation of [OpenBLAS](https://www.openblas.net/) to use.
If you already have an installation of OpenBLAS on your machine you can
inform the `install.py` script about its location using the `--with-openblas` flag:
You can also specify an installation of [OpenBLAS](https://www.openblas.net/)
to use for the build. If you already have an installation of OpenBLAS on your
machine, you can inform the installation script using the `--with-openblas`
option:

```
python setup.py --with-openblas /path/to/open/blas/
python setup.py --with-openblas <path-to-OpenBLAS>
```

Advanced users can also invoke `install.py --help` to see options for
configuring cuNumeric by invoking the `install.py` script directly.

Note that after the first invocation of `setup.py` or `install.py` this
repository will remember the paths you provided with the installation options
and they can be omitted in subsequent invocations unless you want to change
them.

## Usage and Execution

Using cuNumeric as a replacement for NumPy is easy. Users only need
Expand All @@ -131,7 +149,7 @@ legate cunumeric_program.py
```

For execution with multiple nodes (assuming Legate Core is installed with GASNet support)
users can supply the `--nodes` flag. For execution with GPUs, users can use the
users can supply the `--nodes` option. For execution with GPUs, users can use the
`--gpus` flags to specify the number of GPUs to use per node. We encourage all users
to familiarize themselves with these resource flags as described in the Legate Core
documentation or simply by passing `--help` to the `legate` driver script.
Expand Down
31 changes: 31 additions & 0 deletions conda/conda-build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
install_args=()

# We rely on an environment variable to determine if we need to build cpu-only bits
if [ -z "$CPU_ONLY" ]; then
# cutensor, relying on the conda cutensor package
install_args+=("--with-cutensor" "$PREFIX")
fi

# location of legate-core
install_args+=("--with-core" "$PREFIX")

# location of openblas, relying on the conda openblas package
install_args+=("--with-openblas" "$PREFIX")

# Verbose mode
install_args+=("-v")

# Move the stub library into the lib package to make the install think it's pointing at a live installation
if [ -z "$CPU_ONLY" ]; then
cp $PREFIX/lib/stubs/libcuda.so $PREFIX/lib/libcuda.so
ln -s $PREFIX/lib $PREFIX/lib64
fi

echo "Install command: $PYTHON install.py ${install_args[@]}"
$PYTHON install.py "${install_args[@]}"

# Remove the stub library and linking
if [ -z "$CPU_ONLY" ]; then
rm $PREFIX/lib/libcuda.so
rm $PREFIX/lib64
fi
7 changes: 7 additions & 0 deletions conda/conda-build/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gpu_enabled:
- true
- false
python:
- 3.8
- 3.9
- 3.10
126 changes: 126 additions & 0 deletions conda/conda-build/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{% set name = "cunumeric" %}
{% if gpu_enabled == "true" %}
{% set gpu_enabled_bool = true %}
{% elif gpu_enabled == "false" %}
{% set gpu_enabled_bool = false %}
{% else %}
{# We need to have a default value for the initial pass over the recipe #}
{% set gpu_enabled_bool = false %}
{% endif %}
## The placeholder version is strictly for making two-pass conda build process.
## It should not be used for any other purpose, and this is not a default version.
{% set placeholder_version = '0.0.0.dev' %}
{% set default_cuda_version = '11.5' %}
{% set cuda_version='.'.join(environ.get('CUDA', default_cuda_version).split('.')[:2]) %}
{% set cuda_major=cuda_version.split('.')[0] %}
{% set py_version=environ.get('CONDA_PY', '') %}
{% if build_number is defined %}
{# do nothing if defined #}
{% else %}
{% set build_number = environ.get('GIT_DESCRIBE_NUMBER', '0') %}
{% endif %}
{% if package_version is defined %}
{% set version = package_version %}
{% set core_version = version %}
## The tag must be in one of the two formats (where N is a digit):
## vNN.NN.NN
## vNN.NN.NN.dev

## Note: default values are only given to make conda build work. They should not be necessary in principle.
{% elif 'dev' in environ.get('GIT_DESCRIBE_TAG', placeholder_version) %}
{% set version = (environ.get('GIT_DESCRIBE_TAG', placeholder_version) ~ environ.get('GIT_DESCRIBE_NUMBER', '')).lstrip('v') %}
{% set core_version = (version.rsplit('.',1)[0] ~ ".dev" ~ "|>=" ~ version.rsplit('.',1)[0]) %}
{% else %}
{% set version = environ.get('GIT_DESCRIBE_TAG', placeholder_version).lstrip('v') %}
{% set core_version = version %}
{% endif %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
{% if package_tar is defined %}
url: {{ package_tar }}
{% else %}
git_url: ../../
{% endif %}

build:
skip: true # [not linux]
number: {{ build_number }}
missing_dso_whitelist:
- '*libcuda.so*'
{% if not gpu_enabled_bool %}
string: "cuda{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ PKG_BUILDNUM }}_cpu"
{% else %}
string: "cuda{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ PKG_BUILDNUM }}"
{% endif %}
{% if not gpu_enabled_bool %}
track_features:
- cpu_only
script_env:
- CPU_ONLY=1
{% endif %}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- make
{% if gpu_enabled_bool %}
- cuda-nvcc ={{ cuda_version }}
{% endif %}
host:
- python
- openblas =* =*openmp*
{% if not gpu_enabled_bool %}
- legate-core >={{ core_version }} =*_cpu
{% else %}
- legate-core >={{ core_version }}
- cuda-driver-dev ={{ cuda_version }}
- cuda-cudart-dev ={{ cuda_version }}
# - libcutensor-dev >=1.3
- cutensor >=1.3
- cuda-nvtx
- libcublas-dev
- libcusolver-dev
- libcufft-dev
- nccl
{% endif %}

run:
- numpy
- libopenblas =* =*openmp*
{% if gpu_enabled_bool %}
# - libcutensor >=1.3
- cutensor >=1.3
- libcublas
- libcusolver
- libcufft
{% endif %}
- opt_einsum >=3.3
- scipy
- typing_extensions

run_constrained:
{% if gpu_enabled_bool %}
- __cuda >=11.4
{% endif %}
- __glibc >=2.17 # [linux]

about:
home: https://github.com/nv-legate/cunumeric
license: Apache-2.0
license_file: LICENSE
summary: 'Drop-in Replacment for NumPy'
description: |
cuNumeric is a Legate library that aims to provide
a distributed and accelerated drop-in replacement
for the NumPy API on top of the Legion runtime.
doc_url: https://github.com/nv-legate/cunumeric
dev_url: https://github.com/nv-legate/cunumeric

extra:
recipe-maintainers:
- m3vaz
21 changes: 0 additions & 21 deletions conda/cunumeric_dev.yml

This file was deleted.

44 changes: 44 additions & 0 deletions conda/environment-test-3.10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: cunumeric-test
channels:
- conda-forge
- defaults
dependencies:
- python=3.10

# build
- cutensor>=1.3.3
- nccl
- setuptools>=60

# runtime
- cffi
- numpy>=1.22
- opt_einsum
- pyarrow>=5
- scipy
- typing_extensions

# tests
- clang>=8
- clang-tools>=8
- coverage
- mock
- mypy>=0.942
- pre-commit
- pynvml
- pytest
- pytest-cov

# pip dependencies
- pip
- pip:
# docs
- jinja2
- pydata-sphinx-theme
- recommonmark
- sphinx>=4.4.0
- sphinx-copybutton
- sphinx-markdown-tables

# examples
- tifffile
Loading

0 comments on commit 0a642e8

Please sign in to comment.