Skip to content

Commit 9957736

Browse files
committed
Add some strategic prints\n
1 parent e40aa08 commit 9957736

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

source/adapters/cuda/context.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ 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", phDevices[dev_i],
54+
phDevices[dev_i]->getNativeContext());
55+
}
56+
5157
std::unique_ptr<ur_context_handle_t_> ContextPtr{nullptr};
5258
try {
5359
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+
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

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ 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", device);
4849
ASSERT_SUCCESS(urContextCreate(1, &device, nullptr, context.ptr()));
4950
ASSERT_NE(context, nullptr);
5051

0 commit comments

Comments
 (0)