-
Notifications
You must be signed in to change notification settings - Fork 333
[STF] Add python bindings #5315
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
Open
caugonnet
wants to merge
279
commits into
NVIDIA:main
Choose a base branch
from
caugonnet:stf_c_api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
279 commits
Select commit
Hold shift + click to select a range
968995b
expose start/end and task type in context
caugonnet 8cc6a3c
Save some WIP
caugonnet 49064ee
Save some WIP
caugonnet f06f72e
Start to experiment with bindings for cuda_kernel
caugonnet 08a22c9
Save WIP: we cannot directly use the pointer to a global function and…
caugonnet 1482bbc
add missing variable
caugonnet f45d8da
Add missing finalize() call
caugonnet 8b03c29
axpy example works with cuda_kernel in C
caugonnet 749ca3b
check result
caugonnet 4fb7000
Add ctx_token
caugonnet 94757f8
make cudax usable in the python dir
caugonnet 189e083
Save WIP with python
caugonnet 3ed26ac
fix a typo
caugonnet 1a5038a
fixed in python for stf
caugonnet 0c1a2ae
Add a minimalistic Ctx class
caugonnet 2f519e8
Fix installation paths
caugonnet 469ff33
Add a dummy STF test
caugonnet 9acc75b
Merge branch 'main' into stf_c_api
caugonnet c2a8fde
logical_data bindings
caugonnet 3a39aa5
deps
caugonnet 4491ff3
better task api
caugonnet 74b430c
test with context managers
caugonnet 479c24b
context task get_stream
caugonnet d428651
Fix python examples
caugonnet d3e2059
Merge branch 'main' into stf_c_api
caugonnet f7c7462
fix unused var
caugonnet 17a31b9
Add const qualifiers
caugonnet 3830634
Merge branch 'main' into stf_c_api
caugonnet aaf503f
NUMBA interop
caugonnet f2f7dfb
pre-commit
caugonnet 97c5f3a
pre-commit
caugonnet a5d669d
pre-commit and stencil test
caugonnet 686b988
make it possible to create a graph_ctx
caugonnet b4688fd
implement set_exec_place for cuda_kernel and unified tasks
caugonnet bd474d6
Define some execution places in the C API
caugonnet 0b6e93a
WIP: start to support execution places
caugonnet ff9d70a
set_exec_place should also set the data place
caugonnet c610c42
rename ExecPlace to exec_place
caugonnet f65702b
Save WIP: start to implement data places (not compiling yet)
caugonnet 21c94a6
fix data places
caugonnet f863ecd
Add data places in deps
caugonnet c419e1d
Merge branch 'main' into stf_c_api
caugonnet 11b6673
test with places
caugonnet a1bff48
Merge branch 'main' into stf_c_api
caugonnet e422712
fix previous merge
caugonnet 1bb8b43
typo fix
caugonnet fc8d5eb
Save WIP: try to implement a new decorator for STF
167f6c5
fix typo
95104ef
Defer compilation until we know types
caugonnet 829f1c7
Merge branch 'main' into stf_c_api
caugonnet 920f335
Add numba-cuda as a dependency
shwina 587f33b
Replace use of pynvjitlink patch
shwina 9db83a2
Update pyproject.toml
shwina 865d337
better class name
caugonnet 09dd965
Merge branch 'stf_c_api' of github.com:caugonnet/cccl into stf_c_api
caugonnet 6899f3e
Merge branch 'main' into stf_c_api
caugonnet d051732
Merge remote-tracking branch 'shwina/add-numba-cuda-dep' into stf_c_api
caugonnet d223960
fixes to make cudastf.jit decorator work
caugonnet 3eeda4b
Merge branch 'main' into stf_c_api
caugonnet 15c2db0
revert some changes
caugonnet 011e291
support tuple configs
caugonnet 91e9d46
new test
caugonnet 0ce9e68
Merge branch 'main' into stf_c_api
caugonnet faa4cb0
Merge branch 'main' into stf_c_api
caugonnet 8be7401
Add a new test for places (C interface)
caugonnet a7da255
clang-format
caugonnet 59c791b
Merge branch 'main' into stf_c_api
caugonnet 086318c
Merge branch 'main' into stf_c_api
caugonnet 1207ecd
Merge branch 'main' into stf_c_api
caugonnet 6b86916
Merge branch 'main' into stf_c_api
caugonnet 537b3b9
Skit test if we have less than 2 devices
d804d1b
Save WIP for like_empty (broken)
ad83a63
test with and witjout graphs
54a2181
Merge branch 'main' into stf_c_api
caugonnet f74c1d4
[pre-commit.ci] auto code formatting
pre-commit-ci[bot] 95c88a3
remove unit test
caugonnet bc94c74
remove stf_logical_data_like_empty which is not designed properly yet
caugonnet 765a519
Merge branch 'main' into stf_c_api
caugonnet 3e47648
Add a missing header
caugonnet f208979
Install in a place that depends on cuda version
caugonnet 2ca0e3d
fix pytest example
caugonnet 7cff926
Try to use an intermediate "shim" module to import cu12 or cu13 versions
caugonnet c9c9672
Merge branch 'main' into stf_c_api
caugonnet b8d89ed
Fix tests (do not use graphs ...)
caugonnet 740dc86
Introduce an API to enable graph capture with a low level graph_ctx task
caugonnet 9687cbb
Enable graph capture when launching a numba kernel in the graph_ctx b…
caugonnet 5246b65
Use a forked version of numba-cuda with work-arounds for CUDA graphs
caugonnet 936bc60
fix formatting issues
caugonnet 7689834
Do return a stream even in the graph_ctx when we are capturing
caugonnet dde406d
test with graphs
caugonnet 7563014
parametrized tests
caugonnet ba4e9c3
Merge branch 'main' into stf_c_api
caugonnet b094c27
test that we get a stream in graph_task when capturing
caugonnet 222c216
Save WIP: add a mockup of FHE example, which needs a like_empty method
caugonnet b04cebf
Implement like_empty
caugonnet 9ed5ace
More comprehensive FHE test
caugonnet e27ef5b
test fhe with stf decorator
caugonnet d0f915e
Merge branch 'main' into stf_c_api
caugonnet 6963ec0
fix merge error
caugonnet 06fab11
Appropriate checks
caugonnet 2fc802e
Add missing ;
caugonnet a43db62
- Make it possible to create a borrowed context from a handle
caugonnet 9c07679
invert ctx and exec place in the decorator
caugonnet 947bbcc
fix decorator api
caugonnet 22b2d19
Add ciphertext.like_empty()
caugonnet 66bcde3
Removing prints
caugonnet 84534c8
do not import specific methods
caugonnet acf0cce
fix decorator api
caugonnet 6a6e84f
Add a pytorch experiment
297a69b
more pytorch test
533ca5a
better interop with pytorch
9aa749f
remove useless pass
b11aa4b
tensor_arguments
0af151f
simpler code
746d308
pre-commit hooks
caugonnet d9195f5
try to remove dependency on torch and have adapters (WIP)
caugonnet f5ac828
remove unused code
caugonnet 454a5da
cleanups
caugonnet ccfbb6b
fix numba adapter
caugonnet c6e7c07
skip torch test if torch is not available
caugonnet 842a651
add dot vertex even in the low level api
caugonnet 00c649c
fix types
caugonnet b0fc18d
pre-commit hooks
caugonnet 3b257df
Merge branch 'main' into stf_c_api
caugonnet 04cc07a
dot add_vertex is done in start() now
caugonnet bce25b8
Start to implement the FDTD example in pytorch
caugonnet d9c5f11
Start to port in STF version of pytorch
caugonnet 70fa5d8
Adapt the FDTD example to use STF constructs and add methods to initi…
caugonnet 5587a8d
format issue
caugonnet 5ea5243
charset issue
caugonnet f7fbd34
rank agnostic method to init
caugonnet aec2d71
use .zero_() to blank fields
caugonnet eb71880
print values
caugonnet aaf6ec6
Experiment to display output as an image
caugonnet ae4c6d6
Use non blocking API
caugonnet 9029fda
remove dead code
caugonnet ce7a33b
remove dead code
caugonnet cbde742
minor cleanup
caugonnet 1936db6
Merge branch 'main' into stf_c_api
caugonnet c91e814
clang-format
caugonnet 3fe6178
Add a C library for CUDASTF (to be used in the python bindings)
caugonnet 666bd07
Merge branch 'main' into stf_c_lib
caugonnet 522b630
remove dead code
caugonnet 4315314
do define and use CCCL_C_EXPERIMENTAL_STF_ENABLE_TESTING
caugonnet 48627aa
Add CUDASTF C lib to tests
caugonnet 410aadd
Merge branch 'main' into stf_c_lib
caugonnet c87cdaa
Add missing headers
caugonnet 02a9eb6
use snake_case
caugonnet 232133b
Do define CCCL_C_EXPERIMENTAL=1
caugonnet b60eb6b
Do not do redundant tests
caugonnet c4c99f0
Add a project to ci/inspect_changes.sh
caugonnet 2f5925b
missing changes in previous commit
caugonnet 3417075
add presets
caugonnet 8c05034
Add override matrix
alliepiper 20faa8f
Properly define structs with a typedef and remove superfluous struct …
caugonnet d378f5a
Merge branch 'main' into stf_c_lib
caugonnet 8c5e760
fix previous merge
caugonnet 78dc197
Change tensor_arguments to return an element instead of a tuple of on…
caugonnet 2eb2ace
Remove intermediate structures and use opaque pointers instead
caugonnet 6557067
Automatically generated documentation
caugonnet 60266ff
Better implementation of the help to convert C places to the C++ API,…
caugonnet 59f1983
Tell where to find cudax, and remove unnecessary libs
caugonnet c7fa9e6
Merge branch 'main' into stf_c_lib
caugonnet 97dd6f7
CCCL_ENABLE_C enables c/parallel, CCCL_ENABLE_C_EXPERIMENTAL_STF enab…
caugonnet 1610f0b
Remove unnecessary definitions
caugonnet 4383eaf
Merge branch 'main' into stf_c_lib
caugonnet 101fd0b
Merge branch 'main' into stf_c_lib
caugonnet 4db210b
Merge branch 'main' into stf_c_lib
caugonnet 90a8d20
use more consistent option names
caugonnet f2d7528
Merge branch 'main' into stf_c_lib
caugonnet ac667ca
Do not use [[maybe_unused]] for the C lib header because this is only…
caugonnet 5bf62b3
Return an error code in stf_cuda_kernel_add_desc rather than use asse…
caugonnet c0a54f1
clang-format
caugonnet 4573f9f
Merge branch 'main' into stf_c_lib
caugonnet abc58d8
Merge branch 'main' into stf_c_api
caugonnet af43da5
Merge stf_c_lib: Update c/ directory with complete C library implemen…
caugonnet c00c915
Revert Python linting changes
caugonnet cdd0d85
Fix Python CMakeLists.txt: Update C library feature flags
caugonnet afda29f
Fix Python build: Add missing CCCL_ENABLE_C master flag
caugonnet 4f1f079
Complete STF C library configuration: Enable all C library features a…
caugonnet ccfc41d
Remove obsolete CCCL_ENABLE_C flag
caugonnet e4b8277
Update CMake configuration to match stf_c_lib structure
caugonnet 6931fa8
Optimize Python build: Remove unnecessary C parallel library
caugonnet a1a1139
clang-format
caugonnet a3071f7
Merge branch 'stf_c_lib' into stf_c_api
caugonnet ecd9f4e
fix pytorch example
caugonnet 4b2ae75
use ascii symbols
caugonnet 5881081
Merge branch 'main' into stf_c_api
caugonnet 4eef870
Merge branch 'main' into stf_c_api
caugonnet dcb3d39
Cleanup some changes in the infra from a previous merge
caugonnet 1284eb2
Implement logical_data_empty logical_data_zeros, and logical_data_full
caugonnet 0514f29
short names for torch.cuda
caugonnet 5e9b4d5
Introduce pytorch_task
caugonnet 53a4542
clang-format and some minor comment
caugonnet 989f58b
Merge branch 'main' into stf_c_api
caugonnet 93055c0
Merge branch 'main' into stf_c_api
caugonnet 218fda2
make sure stf python tests are wrapped into functions so that pytest …
caugonnet 1f97482
fix the return values of pytests
caugonnet 1e482a4
Merge branch 'main' into stf_c_api
caugonnet 7a58d68
Start to experiment with Warp
caugonnet 9fb1c26
logical_data in python are now initialized with a data place, and the…
caugonnet 5c1d50e
Save WIP: add access modes
caugonnet 9f31b1e
cleanups
caugonnet c0bb070
Save WIP
caugonnet 7094dd5
Merge branch 'main' into stf_c_api
caugonnet 76d78b4
Adopt to new python hierarchy
caugonnet e03b062
Merge branch 'main' into stf_c_api
caugonnet 0c11b6a
fix errors in a previous merge
caugonnet f6c50e1
cuda.cccl.experimental.stf => cuda.stf
caugonnet efea184
Misc stf python tests improvements
caugonnet c0d3592
Save WIP on this warp example
caugonnet eba61eb
Add sanity checks to test the is_void_interface() API
caugonnet e17c261
support tokens in python
caugonnet ec9c955
remove debug print
caugonnet 52f4823
python cholesky with cupy
caugonnet 5a32881
improve cholesky example
caugonnet abd5778
POTRI and Cholesky
caugonnet 80e1085
clang-format
caugonnet 865cf7b
Merge branch 'main' into stf_c_api
caugonnet 4c1551a
how changes to numba-cuda have been merged
caugonnet 77d6af1
Merge branch 'main' into stf_c_api
caugonnet acc8f49
Merge branch 'main' into stf_c_api
andralex de333b2
Fix CI precommit
andralex 3834c8f
Merge branch 'main' into stf_c_api
andralex 9a5c265
no need for numba.cuda.config.CUDA_ENABLE_PYNVJITLINK = 1 anymore
caugonnet 9932a24
Merge origin/main into stf_c_api
caugonnet e7e2adb
Our numba-cuda fix is part of 0.21.0
caugonnet 39040a9
Minor doc fix
caugonnet 8f27fa2
Ensure matplotlib is only used if available
caugonnet 73ac963
Cleanup examples
caugonnet d90ed64
cmake fix
caugonnet eb77519
Cmake fixes (need extra cleanup)
caugonnet b38ff80
Work-around for lazy resource init during graph capture in cuda core
caugonnet 0a3e667
Use a relaxed capture mode
caugonnet 8642fdd
This work-around is not needed anymore with a relaxed capture mode
caugonnet 2a75766
Merge branch 'main' into stf_c_api
caugonnet 0f9865d
cleanup warp example
caugonnet 6466347
Cleanups in the cython code for STF
caugonnet cfb2930
no need for math.prod for such a simple thing
caugonnet 130ee2a
Simpler code to handle vector types
caugonnet 4bb4d23
fix grid dimension
caugonnet b8c745e
Use from_dlpack
caugonnet fb2a3ba
Change the mock-up FHE toy example to have operations that are homomo…
caugonnet 6c2f850
Merge branch 'main' into stf_c_api
caugonnet da2e1aa
Add some explanation for the use of a relaxed capture mode
caugonnet 852b400
cleaner pytorch adapter
caugonnet 9308af5
Merge branch 'main' into stf_c_api
caugonnet 09913dc
Code simplification
caugonnet 237b2c1
minor fixes
caugonnet dd6cc26
Merge branch 'main' into stf_c_api
caugonnet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| from ._stf_bindings import ( | ||
| context, | ||
| data_place, | ||
| dep, | ||
| exec_place, | ||
| ) | ||
| from .decorator import jit # Python-side kernel launcher | ||
|
|
||
| __all__ = [ | ||
| "context", | ||
| "dep", | ||
| "exec_place", | ||
| "data_place", | ||
| "jit", | ||
| ] | ||
|
|
||
|
|
||
| def has_torch() -> bool: | ||
| import importlib.util | ||
|
|
||
| return importlib.util.find_spec("torch") is not None | ||
|
|
||
|
|
||
| def has_numba() -> bool: | ||
| import importlib.util | ||
|
|
||
| return importlib.util.find_spec("numba") is not None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| def cai_to_numba(cai: dict): | ||
| from numba import cuda | ||
|
|
||
| return cuda.from_cuda_array_interface(cai, owner=None, sync=False) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only be for STF ?