Skip to content

Commit

Permalink
fixes scoped device id guard test
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelKoch committed Oct 31, 2022
1 parent 8f8f5a0 commit b59a9dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions cuda/test/base/scoped_device_id.cu
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ TEST_F(ScopedDeviceIdGuard, SetsId)

gko::detail::cuda_scoped_device_id_guard g{new_device_id};

ASSERT_EQ(cuda->get_device_id(), new_device_id);
int device_id;
cudaGetDevice(&device_id);
ASSERT_EQ(device_id, new_device_id);
}


Expand All @@ -79,7 +81,9 @@ TEST_F(ScopedDeviceIdGuard, ResetsId)
gko::detail::cuda_scoped_device_id_guard g{new_device_id};
}

ASSERT_EQ(cuda->get_device_id(), old_device_id);
int device_id;
cudaGetDevice(&device_id);
ASSERT_EQ(device_id, old_device_id);
}


Expand Down
8 changes: 6 additions & 2 deletions hip/test/base/scoped_device_id.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ TEST_F(ScopedDeviceIdGuard, SetsId)

gko::detail::hip_scoped_device_id_guard g{new_device_id};

ASSERT_EQ(hip->get_device_id(), new_device_id);
int device_id;
hipGetDevice(&device_id);
ASSERT_EQ(device_id, new_device_id);
}


Expand All @@ -79,7 +81,9 @@ TEST_F(ScopedDeviceIdGuard, ResetsId)
gko::detail::hip_scoped_device_id_guard g{new_device_id};
}

ASSERT_EQ(hip->get_device_id(), old_device_id);
int device_id;
hipGetDevice(&device_id);
ASSERT_EQ(device_id, old_device_id);
}


Expand Down

0 comments on commit b59a9dd

Please sign in to comment.