-
Notifications
You must be signed in to change notification settings - Fork 593
[GLUTEN-9149][CORE] Remove Spark-specific code from JniLibLoader & JniWorkspace #9150
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
Changes from all commits
b4eb323
4462d55
e135c36
4432e3d
be45858
d5d62ec
80771b2
8362cff
33fdd37
1d22fa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,6 @@ | |
|
|
||
| import com.google.common.base.Preconditions; | ||
| import org.apache.commons.io.FileUtils; | ||
| import org.apache.spark.util.SparkDirectoryUtil; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
|
|
@@ -32,6 +31,7 @@ | |
| import java.util.Map; | ||
| import java.util.UUID; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
| import java.util.function.Supplier; | ||
|
|
||
| public class JniWorkspace { | ||
| private static final Logger LOG = LoggerFactory.getLogger(JniWorkspace.class); | ||
|
|
@@ -60,19 +60,6 @@ private JniWorkspace(String rootDir) { | |
| } | ||
| } | ||
|
|
||
| private static JniWorkspace createDefault() { | ||
| try { | ||
| final String tempRoot = | ||
| SparkDirectoryUtil.get() | ||
| .namespace("jni") | ||
| .mkChildDirRandomly(UUID.randomUUID().toString()) | ||
| .getAbsolutePath(); | ||
| return createOrGet(tempRoot); | ||
| } catch (Exception e) { | ||
| throw new GlutenException(e); | ||
| } | ||
| } | ||
|
|
||
| public static void enableDebug(String debugDir) { | ||
| // Preserve the JNI libraries even after process exits. | ||
| // This is useful for debugging native code if the debug symbols were embedded in | ||
|
|
@@ -99,16 +86,19 @@ public static void enableDebug(String debugDir) { | |
| } | ||
| } | ||
|
|
||
| public static JniWorkspace getDefault() { | ||
| public static void initializeDefault(Supplier<String> rootDir) { | ||
| synchronized (DEFAULT_INSTANCE_INIT_LOCK) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In tests, driver and executors are in the same process, so |
||
| if (DEFAULT_INSTANCE == null) { | ||
| DEFAULT_INSTANCE = createDefault(); | ||
| DEFAULT_INSTANCE = createOrGet(rootDir.get()); | ||
| } | ||
| Preconditions.checkNotNull(DEFAULT_INSTANCE); | ||
| return DEFAULT_INSTANCE; | ||
| } | ||
| } | ||
|
|
||
| public static JniWorkspace getDefault() { | ||
| Preconditions.checkNotNull(DEFAULT_INSTANCE, "Not call initializeDefault yet"); | ||
| return DEFAULT_INSTANCE; | ||
| } | ||
|
|
||
| private static JniWorkspace createOrGet(String rootDir) { | ||
| return INSTANCES.computeIfAbsent(rootDir, JniWorkspace::new); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the
forceUnloadAllis used to fix the coredump in ch backends. Can we remove this now? @taiyang-li @baibaichenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is still needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems can not be removed, or will still coredump