You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run a basic example with treelite4j, and I couldn't get the model to load as expected.
I was trying to use:
Predictor treelitePredictor = new Predictor("myModel.so", treeliteThreads, true);
but was getting the error:
Exception in thread "main" ml.dmlc.treelite4j.java.TreeliteError: [00:08:33] /local/home/thvasilo/repos/treelite/src/predictor/predictor.cc:175: Check failed: handle: Failed to load dynamic shared library `test00.so'
at ml.dmlc.treelite4j.java.TreeliteJNI.checkCall(TreeliteJNI.java:28)
at ml.dmlc.treelite4j.java.Predictor.initNativeLibrary(Predictor.java:94)
at ml.dmlc.treelite4j.java.Predictor.<init>(Predictor.java:57)
at com.amazon.treelitetest.SimpleTreelitePrediction.main(SimpleTreelitePrediction.java:22)
void *dlopen(const char *file, int mode); file is used to construct a pathname to the object file. If file contains a slash character, the file argument is used as the pathname for the file. Otherwise, file is used in an implementation-dependent manner to yield a pathname.
After I changed the call to:
Predictor treelitePredictor = new Predictor("/path/to/myModel.so", treeliteThreads, true); the model loaded fine.
So this is a bit of a sneaky bug that's possibly implementation/platform dependent. My env was Amazon Linux 2 on JDK 1.8.
The text was updated successfully, but these errors were encountered:
I'm trying to run a basic example with treelite4j, and I couldn't get the model to load as expected.
I was trying to use:
Predictor treelitePredictor = new Predictor("myModel.so", treeliteThreads, true);
but was getting the error:
Turns out that
dlopen
does not consider the input argumentconst char* file
a path unless it contains a/
, or not exactly at least:From https://pubs.opengroup.org/onlinepubs/7908799/xsh/dlopen.html
After I changed the call to:
Predictor treelitePredictor = new Predictor("/path/to/myModel.so", treeliteThreads, true);
the model loaded fine.So this is a bit of a sneaky bug that's possibly implementation/platform dependent. My env was Amazon Linux 2 on JDK 1.8.
The text was updated successfully, but these errors were encountered: