Skip to content

Commit

Permalink
[api] Fixes typo in CudaUtils (#3008)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu authored Feb 28, 2024
1 parent 8a88c35 commit 4eb29bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions api/src/main/java/ai/djl/util/cuda/CudaUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static boolean hasCuda() {
*/
@SuppressWarnings("PMD.NonThreadSafeSingleton")
public static int getGpuCount() {
if (Boolean.getBoolean("ai.djl.util.cuda.folk")) {
if (Boolean.getBoolean("ai.djl.util.cuda.fork")) {
if (gpuInfo == null) {
gpuInfo = execute(-1); // NOPMD
}
Expand Down Expand Up @@ -95,7 +95,7 @@ public static int getGpuCount() {
*/
@SuppressWarnings("PMD.NonThreadSafeSingleton")
public static int getCudaVersion() {
if (Boolean.getBoolean("ai.djl.util.cuda.folk")) {
if (Boolean.getBoolean("ai.djl.util.cuda.fork")) {
if (gpuInfo == null) {
gpuInfo = execute(-1);
}
Expand Down Expand Up @@ -134,7 +134,7 @@ public static String getCudaVersionString() {
* @return the CUDA compute capability
*/
public static String getComputeCapability(int device) {
if (Boolean.getBoolean("ai.djl.util.cuda.folk")) {
if (Boolean.getBoolean("ai.djl.util.cuda.fork")) {
String[] ret = execute(device);
if (ret.length != 3) {
throw new IllegalArgumentException(ret[0]);
Expand Down Expand Up @@ -168,7 +168,7 @@ public static MemoryUsage getGpuMemory(Device device) {
throw new IllegalArgumentException("Only GPU device is allowed.");
}

if (Boolean.getBoolean("ai.djl.util.cuda.folk")) {
if (Boolean.getBoolean("ai.djl.util.cuda.fork")) {
String[] ret = execute(device.getDeviceId());
if (ret.length != 3) {
throw new IllegalArgumentException(ret[0]);
Expand Down Expand Up @@ -229,7 +229,7 @@ public static void main(String[] args) {

private static CudaLibrary loadLibrary() {
try {
if (Boolean.getBoolean("ai.djl.util.cuda.folk")) {
if (Boolean.getBoolean("ai.djl.util.cuda.fork")) {
return null;
}
if (System.getProperty("os.name").startsWith("Win")) {
Expand Down
6 changes: 3 additions & 3 deletions api/src/test/java/ai/djl/util/cuda/CudaUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public void testCudaUtils() {
}

@Test
public void testCudaUtilsWithFolk() {
System.setProperty("ai.djl.util.cuda.folk", "true");
public void testCudaUtilsWithFork() {
System.setProperty("ai.djl.util.cuda.fork", "true");
try {
testCudaUtils();
} finally {
System.clearProperty("ai.djl.util.cuda.folk");
System.clearProperty("ai.djl.util.cuda.fork");
}
}
}

0 comments on commit 4eb29bd

Please sign in to comment.