Skip to content

Commit d8ab48d

Browse files
committed
Add some strategic prints
1 parent e40aa08 commit d8ab48d

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

source/adapters/cuda/context.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ urContextCreate(uint32_t DeviceCount, const ur_device_handle_t *phDevices,
4848
ur_context_handle_t *phContext) {
4949
std::ignore = pProperties;
5050

51+
printf("Creating cuda context with the following devices:\n");
52+
for (uint32_t dev_i = 0; dev_i < DeviceCount; dev_i++) {
53+
printf("device %p with cuda context %p\n",
54+
reinterpret_cast<void *>(phDevices[dev_i]),
55+
reinterpret_cast<void *>(phDevices[dev_i]->getNativeContext()));
56+
}
57+
5158
std::unique_ptr<ur_context_handle_t_> ContextPtr{nullptr};
5259
try {
5360
ContextPtr = std::unique_ptr<ur_context_handle_t_>(

source/adapters/cuda/memory.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate(
6565
if (PerformInitialCopy && HostPtr) {
6666
// Perform initial copy to every device in context
6767
for (auto &Device : hContext->getDevices()) {
68+
printf("Making the following context active: %p\n",
69+
reinterpret_cast<void *>(Device->getNativeContext()));
6870
ScopedContext Active(Device);
6971
// getPtr may allocate mem if not already allocated
7072
const auto &Ptr = std::get<BufferMem>(URMemObj->Mem).getPtr(Device);

test/adapters/cuda/context_tests.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ TEST_P(cudaUrContextCreateTest, CreateWithChildThread) {
4545

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

0 commit comments

Comments
 (0)