Skip to content

Commit

Permalink
Refine CudaTest.testCudaException in case throwing wrong type of Cu…
Browse files Browse the repository at this point in the history
…daError under aarch64 (#15706)

Fix #15705

1. Replacing  `Cuda.memset(Long.MAX_VALUE, (byte) 0, 1024)` with `Cuda.freePinned(-1L)`, the previous one throws fatal CUDAError `cudaErrorIllegalAddress`  instead of nonFatal CUDAError `cudaErrorInvalidValue` under aarch64, while the later one throwing the correct kind of error. 

2. Enable the test case when Sanitizer is ON

Authors:
  - Alfred Xu (https://github.com/sperlingxx)

Approvers:
  - Tim Liu (https://github.com/NvTimLiu)
  - Jason Lowe (https://github.com/jlowe)

URL: #15706
  • Loading branch information
sperlingxx committed May 10, 2024
1 parent 65a51ff commit e1c6dc2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions java/src/test/java/ai/rapids/cudf/CudaTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023, NVIDIA CORPORATION.
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,6 @@

package ai.rapids.cudf;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -34,13 +33,13 @@ public void testGetCudaRuntimeInfo() {
assertEquals(Cuda.getNativeComputeMode(), Cuda.getComputeMode().nativeId);
}

@Tag("noSanitizer")
@Test
public void testCudaException() {
assertThrows(CudaException.class, () -> {
try {
Cuda.memset(Long.MAX_VALUE, (byte) 0, 1024);
} catch (CudaFatalException ignored) {
Cuda.freePinned(-1L);
} catch (CudaFatalException fatalEx) {
throw new AssertionError("Expected UnFatalError but got FatalError: " + fatalEx);
} catch (CudaException ex) {
assertEquals(CudaException.CudaError.cudaErrorInvalidValue, ex.getCudaError());
throw ex;
Expand Down

0 comments on commit e1c6dc2

Please sign in to comment.