Skip to content

Commit

Permalink
[api] Fixes unitest (#3210)
Browse files Browse the repository at this point in the history
The test was failing on the machine installed cuda but no GPU
  • Loading branch information
frankfliu authored May 28, 2024
1 parent 97c6a0d commit d241860
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api/src/test/java/ai/djl/util/cuda/CudaUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public class CudaUtilsTest {
@Test
public void testCudaUtils() {
if (!CudaUtils.hasCuda()) {
Assert.assertThrows(CudaUtils::getCudaVersionString);
try {
CudaUtils.getCudaVersionString();
} catch (IllegalStateException | IllegalArgumentException ignore) {
// ignore exception
}
Assert.assertThrows(() -> CudaUtils.getComputeCapability(0));
Assert.assertThrows(() -> CudaUtils.getGpuMemory(Device.gpu()));
return;
Expand Down

0 comments on commit d241860

Please sign in to comment.