-
Notifications
You must be signed in to change notification settings - Fork 945
[FEA] Add a method to cudf::table and cudf::column to get its size in bytes without kernel launches or d -> h memcpy #18462
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
Comments
Why is it important to not to perform device-to-host copies? |
For the velox-cudf use case, this will be called a lot, between almost every two other cudf actual compute calls. So it's more of a why do a copy when the information is readily available on host? |
For a large number of columns this could take awhile to add up on the host. |
Yes, but so would adding up using the tools we already have. The scale of sum operations we'd need to do would be the same.
It is indeed, but it's a different use case. We don't need this information to pass to other libcudf APIs, which are designed to work with sliced tables and views of tables on existing data pointers. We need this to be able to track the size of the output tables returned from cudf calls, for the engine's bookkeeping and potentially memory management purpose. |
I believe The end result is a column of integers which you could use |
IIUC |
I agree that adding APIs to get the allocated byte size of each column and its children should be implemented, and the information should be readily available on the host without performing memory copies. |
I think we are talking about something like adding a |
Yeah, I'm talking about that as well.
The result would be fragile and can become out-of-sync, but if it's specified as an estimate (minimum), that would be sufficient. |
That is exactly what we want as well.
That's actually the desired behavior because when managing memory, we'd need to know how much memory a table occupies, padding included. I thought of using rmm in some way to get this information by checking the usage before and after table creation but the situation was complicated by the multi-threaded nature of the engine. There's also an rmm resource that can track allocations using custom counters but it's advertised as a debugging tool with performance implications. |
@lamarrr That's also avoidable because we can get that information from the |
Adds a new member function to the `cudf::table` and `cudf::column` classes to report the device memory allocation size of the internal device-buffers of itself and its children. The value will including padding and may not be computable from the logical column type and the number of elements and null-count. Closes #18462 Authors: - David Wendt (https://github.com/davidwendt) Approvers: - Shruti Shivakumar (https://github.com/shrshi) - Vukasin Milovanovic (https://github.com/vuule) - Bradley Dice (https://github.com/bdice) URL: #18639
Is your feature request related to a problem? Please describe.
Currently, there is no clean way to get the size in bytes of all buffers owned by a const
cudf::table
or acudf::column
without requiring estimation and d->h copies.We can use the following APIs which can also work with a
cudf::table_view
:cudf::bitmask_allocation_size_bytes
to estimate the nullmask buffer size.cudf::strings_column_view::chars_size
for char size of any string columns. However this needs to do a d->h copy to get a single elementDescribe the solution you'd like
The desired API should be able to return the size in bytes value by summing the sizes of all device_buffers owned by all constituent columns of a
cudf::table
Describe alternatives you've considered
Currently, we're able to workaround this by disassembling, inspecting, and reassembling the
cudf::table
andcudf::column
like so:The text was updated successfully, but these errors were encountered: