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
54 changes: 24 additions & 30 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
Expand All @@ -17,22 +18,22 @@ AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
# disabling the below splits, else, they'll just add to the vertical length of source files!
SplitEmptyFunction: false
SplitEmptyRecord: false
Expand Down Expand Up @@ -61,23 +62,23 @@ FixNamespaceComments: true
ForEachMacros:
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
- Regex: ^<.*\.h>
Priority: 1
- Regex: ^<.*
Priority: 2
- Regex: .*
Priority: 3
IncludeIsMainRegex: ([-_](test|unittest))?$
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
Expand All @@ -95,14 +96,7 @@ PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
Delimiters: [cc, CC, cpp, Cpp, CPP, c++, C++]
CanonicalDelimiter: ''
# Enabling comment reflow causes doxygen comments to be messed up in their formats!
ReflowComments: true
Expand Down
10 changes: 0 additions & 10 deletions .flake8

This file was deleted.

71 changes: 42 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,44 @@
---
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.5.1'
hooks:
- id: mypy
language: system
pass_filenames: false
args: ['legate_sparse']
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.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
hooks:
- id: clang-format
files: \.(cu|cuh|h|cc|inl)$
types_or: []

- repo: https://github.com/adrienverge/yamllint
rev: v1.38.0
hooks:
- id: yamllint
types: [yaml]
args: [-c, ./scripts/pre-commit/yamllint.yml]
exclude: meta\.yaml$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-json # checks that all json files have proper syntax
- id: check-toml # checks that all toml files have proper syntax
- id: end-of-file-fixer # check all files end in a newline
# handled by clang-format
exclude_types: [c, c++, cuda]
- id: pretty-format-json
args: [--autofix, --indent=4]
- id: trailing-whitespace # remove trailing whitespace
# don't mess up diff files
exclude: ^src/cmake/patches/.*\.diff$
# handled by clang-format
exclude_types: [c, c++, cuda]
- id: check-symlinks
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.9
hooks:
- id: ruff-format
- id: ruff
args: ["--config=./pyproject.toml", "--fix"]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.2 # Use the sha / tag you want to point at
hooks:
- id: clang-format
files: \.(cu|cuh|h|cc|inl)$
types_or: []
ci:
autoupdate_schedule: quarterly
default_language_version:
python: python3
python: python3
1 change: 0 additions & 1 deletion .style.yapf
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,3 @@ split_penalty_logical_operator=300

# Use the Tab character for indentation.
use_tabs=False

3 changes: 1 addition & 2 deletions 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.07.00)
set(legate_sparse_version 26.02.00)

set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CUDA_FLAGS_DEBUG "-O0 -g")
Expand Down Expand Up @@ -110,4 +110,3 @@ if(CMAKE_GENERATOR STREQUAL "Ninja")
endfunction()
add_touch_legate_sparse_ninja_build_target()
endif()

16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ git push -u origin <local-branch>:<remote-branch>
```
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
```

```
Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
```
```
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ limitations under the License.
Legate Sparse is a [Legate](https://github.com/nv-legate/legate) library
that aims to provide a distributed and accelerated drop-in replacement for the
[scipy.sparse](https://docs.scipy.org/doc/scipy/reference/sparse.html) library
on top of the [Legate](https://github.com/nv-legate/legate) runtime.
Legate Sparse interoperates with
on top of the [Legate](https://github.com/nv-legate/legate) runtime.
Legate Sparse interoperates with
[cuPyNumeric](https://github.com/nv-legate/cupynumeric),
a distributed and accelerated drop-in replacement
a distributed and accelerated drop-in replacement
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
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).
More complex and interesting applications are on the way -- stay tuned!

Legate Sparse is currently in alpha and supports a subset of APIs
and options from scipy.sparse, so if you need an API, please open
an issue and give us a summary of its usage.
Legate Sparse is currently in alpha and supports a subset of APIs
and options from scipy.sparse, so if you need an API, please open
an issue and give us a summary of its usage.

# Installation

To use Legate Sparse, `legate` and `cupynumeric` libraries have to be installed.
They can be installed either by pulling the respective conda packages
or by manually building from source. For more information,
see build instructions for [Legate](https://github.com/nv-legate/legate)
To use Legate Sparse, `legate` and `cupynumeric` libraries have to be installed.
They can be installed either by pulling the respective conda packages
or by manually building from source. For more information,
see build instructions for [Legate](https://github.com/nv-legate/legate)
and [cuPyNumeric](https://github.com/nv-legate/cupynumeric).

Follow the steps in this section.
Expand All @@ -51,7 +51,7 @@ Follow the steps in this section.
The `legate-sparse` conda package already depends on `legate` and `cupynumeric`,
and it will install these dependencies automatically.

To create a new environment and install:
To create a new environment and install:
```
conda create -n myenv -c legate -c conda-forge legate-sparse
```
Expand All @@ -65,9 +65,9 @@ conda install -c legate -c conda-forge legate-sparse

To write programs using Legate Sparse, import the `legate_sparse` module, which
contains methods and types found in `scipy.sparse`. Note that the module is imported as `legate_sparse`
and not `legate.sparse`. Here is an example program saved as `main.py`.
and not `legate.sparse`. Here is an example program saved as `main.py`.

For more details on how to run legate programs, check
For more details on how to run legate programs, check
our [documentation](https://docs.nvidia.com/cupynumeric).
To run the application on a single GPU, use this command:

Expand All @@ -79,10 +79,10 @@ import legate_sparse as sparse
import cupynumeric as np

# number of diagonals in the matrix (including main diagonal)
n_diagonals = 3
n_diagonals = 3

# number of rows in the matrix
nrows = 5
nrows = 5

# generate two tridiaonal matrices (n_diagonals=3) and multiply them
A = sparse.diags(
Expand All @@ -102,13 +102,13 @@ B = sparse.diags(
)

# spGEMM operation: multiplication of two sparse matrices
C = A @ B
C = A @ B
print(C.todense())
print()

# spMV operation: multiplication of a sparse matrix and a dense vector
x = np.ones(nrows)
C = A @ x
C = A @ x
print(C)

assert np.array_equal(A.todense().sum(axis=1), C)
Expand Down
28 changes: 28 additions & 0 deletions cmake/thirdparty/get_cudss.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#=============================================================================
# Copyright 2022-2024 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.
#=============================================================================

function(find_or_configure_cudss)

if(TARGET cudss)
return()
endif()

# cuDSS provides its own CMake config, so we use find_package directly
find_package(cudss REQUIRED)

endfunction()

find_or_configure_cudss()
Loading