Skip to content

Commit

Permalink
Configure verbose of mxnet extra libraries (#728)
Browse files Browse the repository at this point in the history
Change-Id: I66d54aa496cccbb9e8c0a89eeaa458605958d9c6
  • Loading branch information
zachgk authored Mar 8, 2021
1 parent 347eb07 commit a66e168
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
public final class MxEngine extends Engine {

public static final String ENGINE_NAME = "MXNet";
private static final String MXNET_EXTRA_LIBRARY_VERBOSE = "MXNET_EXTRA_LIBRARY_VERBOSE";

/** Constructs an MXNet Engine. */
private MxEngine() {}
Expand All @@ -56,14 +57,17 @@ static Engine newInstance() {

// load extra MXNet library
String paths = System.getenv("MXNET_EXTRA_LIBRARY_PATH");
boolean extraLibVerbose =
System.getenv().containsKey(MXNET_EXTRA_LIBRARY_VERBOSE)
&& System.getenv(MXNET_EXTRA_LIBRARY_VERBOSE).equals("true");
if (paths != null) {
String[] files = paths.split(",");
for (String file : files) {
Path path = Paths.get(file);
if (Files.notExists(path)) {
throw new FileNotFoundException("Extra Library not found: " + file);
}
JnaUtils.loadLib(path.toAbsolutePath().toString(), 1);
JnaUtils.loadLib(path.toAbsolutePath().toString(), extraLibVerbose);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,9 @@ public static List<List<Shape>> inferShape(Symbol symbol, PairList<String, Shape
return null;
}

public static void loadLib(String path, int verbose) {
checkCall(LIB.MXLoadLib(path, verbose));
public static void loadLib(String path, boolean verbose) {
int intVerbose = verbose ? 1 : 0;
checkCall(LIB.MXLoadLib(path, intVerbose));
}

public static Pointer optimizeFor(Symbol current, String backend, Device device) {
Expand Down

0 comments on commit a66e168

Please sign in to comment.