Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] Fixes typo in CudaUtils #3008

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}
}
}
Loading