-
Notifications
You must be signed in to change notification settings - Fork 886
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
Add gdb
pretty-printers for simple types
#11499
Add gdb
pretty-printers for simple types
#11499
Conversation
This seems to be working for all the cases I tested. The csv reader is a good place to try them out, since it uses host_span, device_span and device_uvector. |
Is this the right home for all of this? You already added pretty printers for thrust in thrust. Pretty printers for RMM should probably live in RMM so more of RAPIDS can benefit? |
I believe it would be hard to import dependencies from other components, since they may be placed in an arbitrary location (build/$config/_deps/.../scripts/gdb-pretty-printers.py in rapids-compose if pulling it via CPM, somewhere else if using an existing library). If I wanted to use pretty-printers from the individual files, I'd have to run
manually instead of just sourcing a single file. OTOH, you mentioned |
Selfishly, I want to be able to find RMM pretty printers in RMM so that I can use them there and in other libraries. So I guess it's OK to duplicate them in cuDF, but I think they should be added to RMM as well. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## branch-22.10 #11499 +/- ##
===============================================
Coverage ? 86.41%
===============================================
Files ? 145
Lines ? 22993
Branches ? 0
===============================================
Hits ? 19870
Misses ? 3123
Partials ? 0 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I'm also in favor of putting these in their respective repos. Perhaps a script can be used to wrap the
Could we not just have a script to do these calls? I'd rather not have duplicates to maintain. |
I totally see the issue - we could configure the rmm and thrust path via CMake and create the pretty-printer/load script inside |
I think that makes sense. These are only useful if you do a debug build after all. |
Considering the horrible things I have to do to try and make the deduplication work (concatenating files in CMake! |
The gdb approach seems reasonable. Perhaps we could create some documentation on debugging and include a gdb helper script to illustrate how to load/use these. |
style check cmake-format.............................................................Failed |
yes, this depends on rapidsai/rmm#1088 being merged, so I removed the incorrect label. I'll update it soon™️ |
This PR adds a pretty-printer for `device_uvector` and pulls in Thrust pretty-printers that were added in NVIDIA/thrust#1631. CMake provides a convenience script to load all of the pretty-printers, to resolve the duplication concerns raised in rapidsai/cudf#11499. Example output: <details> ``` $ gdb -q gtests/DEVICE_UVECTOR_TEST Reading symbols from gtests/DEVICE_UVECTOR_TEST... (gdb) b cudaMalloc Function "cudaMalloc" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (cudaMalloc) pending. (gdb) run Starting program: /home/nfs/tribizel/rapids/rmm/build/cuda-11.5.0/feature__pretty-printers/debug/gtests/DEVICE_UVECTOR_TEST warning: Error disabling address space randomization: Operation not permitted [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/x86_64-linux-gnu/libthread_db.so.1". Running main() from gmock_main.cc [==========] Running 95 tests from 5 test suites. [----------] Global test environment set-up. [----------] 19 tests from TypedUVectorTest/0, where TypeParam = signed char [ RUN ] TypedUVectorTest/0.MemoryResource [New Thread 0x7f741efc1000 (LWP 86147)] Thread 1 "DEVICE_UVECTOR_" hit Breakpoint 1, 0x00007f7426dddc80 in cudaMalloc () from /home/nfs/tribizel/rapids/compose/etc/conda/cuda_11.5/envs/rapids/lib/libcudart.so.11.0 (gdb) c Continuing. [New Thread 0x7f741e7c0000 (LWP 86148)] [ OK ] TypedUVectorTest/0.MemoryResource (999 ms) [ RUN ] TypedUVectorTest/0.ZeroSizeConstructor [ OK ] TypedUVectorTest/0.ZeroSizeConstructor (0 ms) [ RUN ] TypedUVectorTest/0.NonZeroSizeConstructor Thread 1 "DEVICE_UVECTOR_" hit Breakpoint 1, 0x00007f7426dddc80 in cudaMalloc () from /home/nfs/tribizel/rapids/compose/etc/conda/cuda_11.5/envs/rapids/lib/libcudart.so.11.0 (gdb) finish Run till exit from #0 0x00007f7426dddc80 in cudaMalloc () from /home/nfs/tribizel/rapids/compose/etc/conda/cuda_11.5/envs/rapids/lib/libcudart.so.11.0 rmm::mr::cuda_memory_resource::do_allocate (bytes=<optimized out>, this=<optimized out>) at /home/nfs/tribizel/rapids/rmm/include/rmm/mr/device/cuda_memory_resource.hpp:70 70 RMM_CUDA_TRY_ALLOC(cudaMalloc(&ptr, bytes)); (gdb) finish Run till exit from #0 rmm::mr::cuda_memory_resource::do_allocate (bytes=<optimized out>, this=<optimized out>) at /home/nfs/tribizel/rapids/rmm/include/rmm/mr/device/cuda_memory_resource.hpp:70 0x00005587874feef0 in rmm::device_buffer::allocate_async (bytes=12345, this=0x7ffefebb46b0) at /home/nfs/tribizel/rapids/rmm/include/rmm/device_buffer.hpp:418 418 _data = (bytes > 0) ? memory_resource()->allocate(bytes, stream()) : nullptr; Value returned is $1 = (void *) 0x7f73ff000000 (gdb) finish Run till exit from #0 0x00005587874feef0 in rmm::device_buffer::allocate_async (bytes=12345, this=0x7ffefebb46b0) at /home/nfs/tribizel/rapids/rmm/include/rmm/device_buffer.hpp:418 TypedUVectorTest_NonZeroSizeConstructor_Test<signed char>::TestBody (this=<optimized out>) at /home/nfs/tribizel/rapids/rmm/tests/device_uvector_tests.cpp:55 55 EXPECT_EQ(vec.size(), size); (gdb) print vec $2 = {_storage = {_data = 0x7f73ff000000, _size = 12345, _capacity = 12345, _stream = {stream_ = 0x0}, _mr = 0x558787561008 <rmm::mr::detail::initial_resource()::mr>}} (gdb) source load-pretty-printers (gdb) print vec $3 = rmm::device_uvector<signed char> of length 12345, capacity 12345 = {0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000', 0 '\000'...} (gdb) ``` </details> Authors: - Tobias Ribizel (https://github.com/upsj) Approvers: - Mark Harris (https://github.com/harrism) - Bradley Dice (https://github.com/bdice) URL: #1088
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.
Nice work!
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.
LGTM 👍
|
||
|
||
def lookup_cudf_type(val): | ||
if not str(val.type.unqualified()).startswith("cudf::"): |
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.
does this printer work if we use using namespace cudf
?
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.
yes, using
is a source-level alias that doesn't affect the generated debug info, afaik.
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.
I can confirm that's the case after some small experiments :)
@gpucibot merge |
Description
This adds
gdb
pretty printers forrmm::device_uvector
,thrust::*_vector
,thrust::device_reference
andcudf::*_span
. The implementation is based on NVIDIA/thrust#1631. I will probably backport the thrust-specific changes to there as well, but since the location of the thrust source is not fixed, I'd prefer having all types in a self-contained file.Checklist