Skip to content
Open
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
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.5.1'
rev: 'v1.19.1'
hooks:
- id: mypy
language: system
pass_filenames: false
args: ['legate_sparse']
- repo: https://github.com/psf/black
rev: 23.9.1
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 7.0.0
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.3.0
hooks:
- id: flake8
args: [--config=.flake8]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v16.0.6' # Use the sha / tag you want to point at
rev: 'v21.1.8' # Use the sha / tag you want to point at
hooks:
- id: clang-format
files: \.(cu|cuh|h|cc|inl)$
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ include(rapids-find)
###################################
# Project

set(legate_sparse_version 25.01.00)
set(legate_sparse_version 25.07.00)

set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CUDA_FLAGS_DEBUG "-O0 -g")
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ for [NumPy](https://numpy.org/doc/stable/reference/index.html#reference), to
enable writing programs that operate on distributed dense and sparse arrays.
Take a look at the `examples` directory for some applications that can
use Legate Sparse. We have implemented
an explicit partial-differential equation (PDE) [solver](examples/pde.py)
and [Geometric multi-grid](examples/gmg.py) solver.
an explicit partial-differential equation (PDE) [solver](examples/pde.py).
More complex and interesting applications are on the way -- stay tuned!

Legate Sparse is currently in alpha and supports a subset of APIs
Expand Down
14 changes: 8 additions & 6 deletions cmake/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
"legate" : {
"repo": "legate.internal",
"org": "nv-legate",
"version": "25.01.00",
"git_url" : "git@github.com:nv-legate/legate.internal.git",
"version": "25.07.00",
"git_url" : "git@github.com:nv-legate/legate.git",
"git_shallow": false,
"always_download": false,
"git_tag" : "c9748050eed8f6087fc2ecb86ff7eb2b5f3edb45"
"git_tag" : "a46dc3d5b176ff9546bc831409c394c1bbc3b936",
"anaconda_label": "main"
},
"cupynumeric" : {
"repo": "cupynumeric.internal",
"org": "nv-legate",
"version": "25.01.00",
"git_url" : "git@github.com:nv-legate/cupynumeric.internal",
"version": "25.07.00",
"git_url" : "git@github.com:nv-legate/cupynumeric",
"git_shallow": false,
"always_download": false,
"git_tag" : "0464776f098f7a54c1341cb3c19b3aa5812f658f"
"git_tag" : "6132d8450049a7abd7786fb4d60444eb5b4e25db",
"anaconda_label": "main"
}
}
}
57 changes: 57 additions & 0 deletions conda/conda-build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

echo -e "\n\n--------------------- CONDA/CONDA-BUILD/BUILD.SH -----------------------\n"

set -xeo pipefail;

# If run through CI, BUILD_MARCH is set externally. If it is not set, try to set it.
ARCH=$(uname -m)
if [[ -z "${BUILD_MARCH}" ]]; then
if [[ "${ARCH}" = "aarch64" ]]; then
# Use the gcc march value used by aarch64 Ubuntu.
BUILD_MARCH=armv8-a
else
# Use uname -m otherwise
BUILD_MARCH=$(uname -m | tr '_' '-')
fi
fi

# Rewrite conda's -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY to
# -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
CMAKE_ARGS="$(echo "$CMAKE_ARGS" | sed -r "s@_INCLUDE=ONLY@_INCLUDE=BOTH@g")"

# Add our options to conda's CMAKE_ARGS
CMAKE_ARGS+="
--log-level=VERBOSE
-DBUILD_SHARED_LIBS=ON
-DBUILD_MARCH=${BUILD_MARCH}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_PARALLEL_LEVEL=${JOBS:-$(nproc --ignore=1)}"
if [ -z "$CPU_ONLY" ]; then
CMAKE_ARGS+="-DCMAKE_CUDA_ARCHITECTURES=all-major"
fi

export CMAKE_GENERATOR=Ninja
export CUDAHOSTCXX=${CXX}
export OPENSSL_DIR="$PREFIX"

echo "Environment"
env

echo "Build starting on $(date)"
CUDAFLAGS="-isystem ${PREFIX}/include -L${PREFIX}/lib"
export CUDAFLAGS

SKBUILD_BUILD_OPTIONS=-j$CPU_COUNT \
$PYTHON -m pip install \
--root / \
--no-deps \
--prefix "$PREFIX" \
--no-build-isolation \
--upgrade \
--cache-dir "$PIP_CACHE_DIR" \
--disable-pip-version-check \
. -vv

echo "Build ending on $(date)"
19 changes: 19 additions & 0 deletions conda/conda-build/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
gpu_enabled:
- true
- false

upload_build:
- false

python:
- 3.11
- 3.12
- 3.13

numpy_version:
# Not 2.1.0 which segfaults on asarray() sometimes, see
# https://github.com/numpy/numpy/pull/27249
- ">=1.22,!=2.1.0"

cmake_version:
- ">=3.20.1,!=3.23.0"
165 changes: 165 additions & 0 deletions conda/conda-build/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{% set name = "legate-sparse" %}
{% 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 = '12.2.2' %}
{% set cuda_version='.'.join(environ.get('CUDA', default_cuda_version).split('.')[:2]) %}
{% set cuda_major=cuda_version.split('.')[0]|int %}
{% 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 %}
## 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') %}
{% else %}
{% set version = environ.get('GIT_DESCRIBE_TAG', placeholder_version).lstrip('v') %}
{% endif %}

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

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

build:
skip: true # [not linux]
number: {{ build_number }}
missing_dso_whitelist:
- '*libcuda.so*'
{% if gpu_enabled_bool %}
{% set cpu_gpu_tag='gpu' %}
{% else %}
{% set cpu_gpu_tag='cpu' %}
{% endif %}
{% set upload_tag='' %}

## Create legate/cupynumeric version and build string
{% set legate_version = os.environ.get("LEGATE_VERSION", "1.0.0") %}
{% set legate_buildstr = "_".join(["py" ~ py_version, "*" ~ cpu_gpu_tag.strip('_'), os.environ.get("LEGATE_BUILDSTR", "") ]) %}
{% set cupynumeric_version = os.environ.get("CUPYNUMERIC_VERSION", "1.0.0") %}
{% set cupynumeric_buildstr = "_".join(["cuda" ~ cuda_major, "py" ~ py_version, cpu_gpu_tag, os.environ.get("CUPYNUMERIC_BUILDSTR", "")]) %}

{% if use_local_path is not defined %}
# use git hash
string: "cuda{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ PKG_BUILDNUM }}_{{ cpu_gpu_tag }}{{ upload_tag }}"
{% else %}
# do not use git hash
string: "cuda{{ cuda_major }}_py{{ py_version }}_{{ PKG_BUILDNUM }}_{{ cpu_gpu_tag }}{{ upload_tag }}"
{% endif %}
script_env:
- SCCACHE_BUCKET
- SCCACHE_REGION
- SCCACHE_IDLE_TIMEOUT
- SCCACHE_S3_KEY_PREFIX
- SCCACHE_S3_KEY_PREFIX
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- BUILD_MARCH
{% if not gpu_enabled_bool %}
- CPU_ONLY=1
# The CPU-only packages having more track_features than the GPU builds helps
# the solver to prefer the GPU builds when both are viable candidates.
# ref: https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#track-features
track_features:
- cpu_only
{% endif %}

ignore_run_exports_from:
# scikit-build should really be a part of the build env, but then it installs its own Python. Conda build stacks
# the build environment on the host environment, and the build python takes over causing paths havoc. So, we put
# scikit-build into the host env, but we ignore any exports it may bring.
- scikit-build

requirements:
build:
- make
- ninja
- cmake {{ cmake_version }}
- {{ compiler('c') }} =11.2
- {{ compiler('cxx') }} =11.2
# the nvcc requirement is necessary because it contains crt/host_config.h used by cuda runtime. This is a packaging bug that has been reported.
- cuda-nvcc
# cudart needed for CPU and GPU builds because of curand
- cuda-cudart-dev
- cuda-version ={{ cuda_version }}
- libcusparse-dev


host:
# List shared libraries *for the target platfrom* here
- python
- scikit-build
# libcurand is used both in CPU and GPU builds
#- libcurand-dev
- openblas =* =*openmp*
- llvm-openmp
- legate ={{ legate_version }}=*{{ legate_buildstr }}
- cupynumeric ={{ cupynumeric_version }}={{ cupynumeric_buildstr }}
{% if gpu_enabled_bool %}
# cupynumeric could be only in the run section and we could have just legate
# here, but we want to make sure that we get a legate version compatible
# with *some* cupynumeric. With the dev versions, if we pick the latest
# legate, there may not be a cupynumeric package that is compatible. So, we
# list cupynumeric here to get a pair of legate and cupynumeric that are
# compatible.
- cuda-cccl
- libcusparse
- cuda-version ={{ cuda_version }}
- cuda-cudart
- nccl
{% endif %}

run:
- numpy {{ numpy_version }}
- scipy
- openblas =* =*openmp*
- cupynumeric ={{ cupynumeric_version }}={{ cupynumeric_buildstr }}
{% if gpu_enabled_bool %}
- libnvjitlink
- libcusparse
# Pin to all minor versions of CUDA newer than the one built against, within the same major version.
# cuda-version constrains the CUDA runtime version and ensures a compatible driver is available
- {{ pin_compatible('cuda-version', min_pin='x.x', max_pin='x') }}
- __cuda >={{ cuda_version }}
- cuda-cudart
{% endif %}

run_constrained:
- __glibc >=2.17 # [linux]

about:
home: https://github.com/nv-legate/legate-sparse
license: Apache-2.0
license_file: LICENSE
summary: 'Aspiring drop-in replacment for Scipy Sparse'
description: |
Legate Sparse is a Legate library that aims to provide
a distributed and accelerated drop-in replacement
for the Scipy Sparse API on top of the Legate runtime.
doc_url: https://github.com/nv-legate/legate-sparse
dev_url: https://github.com/nv-legate/legate-sparse
Loading