-
Notifications
You must be signed in to change notification settings - Fork 201
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
Fix rmm ._lib
imports
#1693
Merged
Merged
Fix rmm ._lib
imports
#1693
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
25a4a67
Fix rmm imports
Matt711 98b098f
add missing imports to memory_resource and remove _copy_async import …
Matt711 07bd75b
add cuda_stream
Matt711 61887b5
from rmm._lib import Foo
Matt711 543a5ed
the last import, fingers crossed
Matt711 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
There are no files selected for viewing
This file contains 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,15 @@ | ||
# Copyright (c) 2018-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. | ||
|
||
from rmm.pylibrmm.cuda_stream import CudaStream # noqa: F401 |
This file contains 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,21 @@ | ||
# Copyright (c) 2018-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. | ||
|
||
from rmm.pylibrmm.device_buffer import ( # noqa: F401 | ||
DeviceBuffer, | ||
copy_device_to_ptr, | ||
copy_host_to_ptr, | ||
copy_ptr_to_host, | ||
to_device, | ||
) |
This file contains 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,24 @@ | ||
# Copyright (c) 2018-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. | ||
|
||
from rmm.librmm._logger import logging_level # noqa: F401 | ||
from rmm.pylibrmm.logger import ( # noqa: F401 | ||
_validate_level_type, | ||
flush_logger, | ||
get_flush_level, | ||
get_logging_level, | ||
set_flush_level, | ||
set_logging_level, | ||
should_log, | ||
) |
This file contains 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,44 @@ | ||
# Copyright (c) 2018-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. | ||
|
||
from rmm.pylibrmm.memory_resource import ( # noqa: F401 | ||
BinningMemoryResource, | ||
CallbackMemoryResource, | ||
CudaAsyncMemoryResource, | ||
CudaMemoryResource, | ||
DeviceMemoryResource, | ||
FailureCallbackResourceAdaptor, | ||
FixedSizeMemoryResource, | ||
LimitingResourceAdaptor, | ||
LoggingResourceAdaptor, | ||
ManagedMemoryResource, | ||
PoolMemoryResource, | ||
PrefetchResourceAdaptor, | ||
SamHeadroomMemoryResource, | ||
StatisticsResourceAdaptor, | ||
SystemMemoryResource, | ||
TrackingResourceAdaptor, | ||
UpstreamResourceAdaptor, | ||
_flush_logs, | ||
available_device_memory, | ||
disable_logging, | ||
enable_logging, | ||
get_current_device_resource, | ||
get_current_device_resource_type, | ||
get_log_filenames, | ||
get_per_device_resource_type, | ||
is_initialized, | ||
set_current_device_resource, | ||
set_per_device_resource, | ||
) |
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.
These classes are
cdef
'd, why are they importable from python? Should they becpdef
'd?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.
A
cdef class
is a normal python class that can also hold C properties. (https://cython.readthedocs.io/en/latest/src/tutorial/cdef_classes.html)cpdef
is for (predominantly) functions which should have a "fast-path" calling route from typed code in cython, and also a "slow-path" python-like calling route.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.
So its only
cpdef
functions that can be called from C and Python?Edit: I think that's true https://cython.readthedocs.io/en/latest/src/userguide/pyrex_differences.html#cpdef-functions
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.
Not exactly.
There's more information here.
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.
Thanks for the clarification (def and cpdef make sense to me). Can you give an example of a "typed context"?
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.
Can a typed context be in a *.py file?
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.
Is it the body of cpdef and cdef functions/methods?
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.
So no, a typed context cannot be in a *.py file, or at least not in the way that we use Cython. With newer versions of Cython you can use py files and compile them too, but the point is that you have to use Cython-specific syntax.