Skip to content

Commit

Permalink
Add some strategic prints\n
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongreig committed Feb 21, 2025
1 parent e40aa08 commit 70902f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/adapters/cuda/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ urContextCreate(uint32_t DeviceCount, const ur_device_handle_t *phDevices,
ur_context_handle_t *phContext) {
std::ignore = pProperties;

printf("Creating cuda context with the following devices:\n");
for (uint32_t dev_i = 0; dev_i < DeviceCount; dev_i++) {
printf("device %p with cuda context %p\n",
reinterpret_cast<void *>(phDevices[dev_i]),
reinterpret_cast<void *>(phDevices[dev_i]->getNativeContext()));
}

std::unique_ptr<ur_context_handle_t_> ContextPtr{nullptr};
try {
ContextPtr = std::unique_ptr<ur_context_handle_t_>(
Expand Down
2 changes: 2 additions & 0 deletions source/adapters/cuda/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate(
if (PerformInitialCopy && HostPtr) {
// Perform initial copy to every device in context
for (auto &Device : hContext->getDevices()) {
printf("Making the following context active: %p\n",
Device->getNativeContext());
ScopedContext Active(Device);
// getPtr may allocate mem if not already allocated
const auto &Ptr = std::get<BufferMem>(URMemObj->Mem).getPtr(Device);
Expand Down
2 changes: 2 additions & 0 deletions test/adapters/cuda/context_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ TEST_P(cudaUrContextCreateTest, CreateWithChildThread) {

TEST_P(cudaUrContextCreateTest, ActiveContext) {
uur::raii::Context context = nullptr;
printf("creating ur context with device %p\n",
reinterpret_cast<void *>(device));
ASSERT_SUCCESS(urContextCreate(1, &device, nullptr, context.ptr()));
ASSERT_NE(context, nullptr);

Expand Down

0 comments on commit 70902f7

Please sign in to comment.