Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
FIX: loading on Linux platform
Browse files Browse the repository at this point in the history
  • Loading branch information
cspchen committed Aug 11, 2021
1 parent be4afd0 commit 240841c
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.mxnet.jna;

import com.sun.jna.Library;
import com.sun.jna.Native;
import java.io.File;
import java.io.IOException;
Expand All @@ -29,6 +30,8 @@
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
Expand Down Expand Up @@ -69,13 +72,13 @@ public static MxnetLibrary loadLibrary() {

String libName = getLibName();
logger.debug("Loading mxnet library from: {}", libName);
// TODO: consider Linux platform
// if (System.getProperty("os.name").startsWith("Linux")) {
// Map<String, Integer> options = new ConcurrentHashMap<>();
// int rtld = 1; // Linux RTLD lazy + local
// options.put(Library.OPTION_OPEN_FLAGS, rtld);
// return Native.load(libName, MxnetLibrary.class, options);
// }
if (System.getProperty("os.name").startsWith("Linux")) {
logger.info("Loading on Linux platform");
Map<String, Integer> options = new ConcurrentHashMap<>();
int rtld = 1; // Linux RTLD lazy + local
options.put(Library.OPTION_OPEN_FLAGS, rtld);
return Native.load(libName, MxnetLibrary.class, options);
}
return Native.load(libName, MxnetLibrary.class);
}

Expand Down

0 comments on commit 240841c

Please sign in to comment.