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

[ML-105][Core] Fix crash when libfabric version conflict #112

Merged
merged 1 commit into from
Aug 4, 2021
Merged
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
16 changes: 14 additions & 2 deletions mllib-dal/src/main/java/org/apache/spark/ml/util/LibLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ public static synchronized void loadLibraries() throws IOException {
* Load oneCCL libs in dependency order
*/
private static synchronized void loadLibCCL() throws IOException {
loadFromJar(subDir, "libfabric.so.1");
// Load libfabric from system first, if failed load from jar
if (!loadFromSystem("libfabric.so.1")) {
loadFromJar(subDir, "libfabric.so.1");
loadFromJar(subDir, "libsockets-fi.so");
}
loadFromJar(subDir, "libmpi.so.12");
loadFromJar(subDir, "libccl.so");
loadFromJar(subDir, "libsockets-fi.so");
}

/**
Expand All @@ -72,6 +75,15 @@ private static synchronized void loadLibMLlibDAL() throws IOException {
loadFromJar(subDir, "libMLlibDAL.so");
}

private static synchronized boolean loadFromSystem(String name) {
try {
System.loadLibrary(name);
} catch (UnsatisfiedLinkError e) {
return false;
}
return true;
}

/**
* Load lib as resource
*
Expand Down