From 41a395de0824fee6b69a4c26ce05d8d73c4f6c53 Mon Sep 17 00:00:00 2001 From: Frank Liu Date: Wed, 2 Aug 2023 11:01:56 -0700 Subject: [PATCH] [api] Fixes NeuronUtils issue when running as non-root user (#2735) --- api/src/main/java/ai/djl/util/NeuronUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/ai/djl/util/NeuronUtils.java b/api/src/main/java/ai/djl/util/NeuronUtils.java index 762b4e1469e..e8adf215c8a 100644 --- a/api/src/main/java/ai/djl/util/NeuronUtils.java +++ b/api/src/main/java/ai/djl/util/NeuronUtils.java @@ -88,7 +88,7 @@ public static int getNeuronCoresForDevice(String location) { return 0; } Path file = path.resolve("core_count"); - if (Files.exists(file)) { + if (Files.exists(file) && Files.isReadable(file)) { try (InputStream is = Files.newInputStream(file)) { return Integer.parseInt(Utils.toString(is)); } catch (IOException e) {