Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

org.apache.gluten.spi.SharedLibraryLoaderCentos7
org.apache.gluten.spi.SharedLibraryLoaderCentos8
org.apache.gluten.spi.SharedLibraryLoaderCentos9
org.apache.gluten.spi.SharedLibraryLoaderDebian11
org.apache.gluten.spi.SharedLibraryLoaderDebian12
org.apache.gluten.spi.SharedLibraryLoaderMacOS
org.apache.gluten.spi.SharedLibraryLoaderOpenEuler2403
org.apache.gluten.spi.SharedLibraryLoaderUbuntu2004
org.apache.gluten.spi.SharedLibraryLoaderUbuntu2204
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class VeloxListenerApi extends ListenerApi with Logging {
val loader = JniWorkspace.getDefault.libLoader

// Load shared native libraries the backend libraries depend on.
SharedLibraryLoader.load(conf, loader)
SharedLibraryLoaderUtils.load(conf, loader)

// Load backend libraries.
val libPath = conf.get(GlutenConfig.GLUTEN_LIB_PATH)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.spi

import org.apache.gluten.jni.JniLibLoader

/**
* :: DeveloperApi ::
*
* Interface for loading shared libraries based on the operating system name and version.
*/
trait SharedLibraryLoader {

/**
* Check if this loader can load libraries for the given OS name and version.
*
* @param osName
* OS name
* @param osVersion
* OS version
* @return
* true if this loader can load libraries for the given OS name and version, false otherwise
*/
def accepts(osName: String, osVersion: String): Boolean

/**
* Load the required shared libraries using the given JniLibLoader.
*
* @param loader
* JniLibLoader to load the shared libraries
*/
def loadLib(loader: JniLibLoader): Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.utils
package org.apache.gluten.spi

import org.apache.gluten.jni.JniLibLoader

class SharedLibraryLoaderCentos7 extends SharedLibraryLoader {
override def accepts(osName: String, osVersion: String): Boolean = {
(osName.contains("CentOS") && osVersion.startsWith("7")) ||
(osName.contains("Oracle") && osVersion.startsWith("7")) ||
(osName.contains("Anolis") && osVersion.startsWith("7")) ||
(osName.contains("Red Hat") && osVersion.startsWith("7")) ||
(osName.contains("Alibaba Cloud Linux") && osVersion.startsWith("2")) ||
(osName.contains("tencentos") && osVersion.contains("2.4"))
}

override def loadLib(loader: JniLibLoader): Unit = {
loader.loadAndCreateLink("libboost_atomic.so.1.84.0", "libboost_atomic.so")
loader.loadAndCreateLink("libboost_thread.so.1.84.0", "libboost_thread.so")
Expand All @@ -37,4 +46,5 @@ class SharedLibraryLoaderCentos7 extends SharedLibraryLoader {
loader.loadAndCreateLink("liblz4.so.1", "liblz4.so")
loader.loadAndCreateLink("libgeos.so.3.10.7", "libgeos.so")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.utils
package org.apache.gluten.spi

import org.apache.gluten.jni.JniLibLoader

class SharedLibraryLoaderCentos8 extends SharedLibraryLoader {

override def accepts(osName: String, osVersion: String): Boolean = {
(osName.contains("CentOS") && osVersion.startsWith("8")) ||
(osName.contains("Oracle") && osVersion.startsWith("8")) ||
(osName.contains("Anolis") && osVersion.startsWith("8")) ||
(osName.contains("Red Hat") && osVersion.startsWith("8")) ||
(osName.contains("Alibaba Cloud Linux") && osVersion.startsWith("3")) ||
(osName.contains("tencentos") && osVersion.contains("3.2"))
}

override def loadLib(loader: JniLibLoader): Unit = {
loader.loadAndCreateLink("libboost_atomic.so.1.84.0", "libboost_atomic.so")
loader.loadAndCreateLink("libboost_thread.so.1.84.0", "libboost_thread.so")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.utils
package org.apache.gluten.spi

import org.apache.gluten.jni.JniLibLoader

class SharedLibraryLoaderCentos9 extends SharedLibraryLoader {

override def accepts(osName: String, osVersion: String): Boolean = {
osName.contains("CentOS") && osVersion.startsWith("9") ||
osName.contains("Red Hat") && osVersion.startsWith("9")
}

override def loadLib(loader: JniLibLoader): Unit = {
loader.loadAndCreateLink("libboost_atomic.so.1.84.0", "libboost_atomic.so")
loader.loadAndCreateLink("libboost_thread.so.1.84.0", "libboost_thread.so")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.utils
package org.apache.gluten.spi

import org.apache.gluten.jni.JniLibLoader

class SharedLibraryLoaderDebian11 extends SharedLibraryLoader {

override def accepts(osName: String, osVersion: String): Boolean = {
osName.contains("Debian") && osVersion.startsWith("11")
}

override def loadLib(loader: JniLibLoader): Unit = {
loader.loadAndCreateLink("libicudata.so.67", "libicudata.so")
loader.loadAndCreateLink("libre2.so.9", "libre2.so")
Expand All @@ -45,4 +50,5 @@ class SharedLibraryLoaderDebian11 extends SharedLibraryLoader {
loader.loadAndCreateLink("libcurl.so.4", "libcurl.so")
loader.loadAndCreateLink("libprotobuf.so.32", "libprotobuf.so")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.utils
package org.apache.gluten.spi

import org.apache.gluten.jni.JniLibLoader

class SharedLibraryLoaderDebian12 extends SharedLibraryLoader {

override def accepts(osName: String, osVersion: String): Boolean = {
osName.contains("Debian") && osVersion.startsWith("12")
}

override def loadLib(loader: JniLibLoader): Unit = {
loader.loadAndCreateLink("libcrypto.so.3", "libcrypto.so")
loader.loadAndCreateLink("libkrb5support.so.0", "libkrb5support.so")
Expand Down Expand Up @@ -51,4 +56,5 @@ class SharedLibraryLoaderDebian12 extends SharedLibraryLoader {
loader.loadAndCreateLink("libcurl.so.4", "libcurl.so")
loader.loadAndCreateLink("libprotobuf.so.32", "libprotobuf.so")
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.spi
import org.apache.gluten.jni.JniLibLoader

class SharedLibraryLoaderMacOS extends SharedLibraryLoader {

override def accepts(osName: String, osVersion: String): Boolean = {
osName.startsWith("Mac OS X") || osName.startsWith("macOS")
}

override def loadLib(loader: JniLibLoader): Unit = {
// Placeholder for loading shared libs on MacOS if user needs.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.utils
package org.apache.gluten.spi

import org.apache.gluten.jni.JniLibLoader

class SharedLibraryLoaderOpenEuler2403 extends SharedLibraryLoader {
override def accepts(osName: String, osVersion: String): Boolean = {
osName.contains("openEuler") && osVersion.startsWith("24.03")
}

override def loadLib(loader: JniLibLoader): Unit = {
loader.loadAndCreateLink("libboost_atomic.so.1.84.0", "libboost_atomic.so")
loader.loadAndCreateLink("libboost_thread.so.1.84.0", "libboost_thread.so")
Expand All @@ -42,4 +46,5 @@ class SharedLibraryLoaderOpenEuler2403 extends SharedLibraryLoader {
loader.loadAndCreateLink("libre2.so.11", "libre2.so")
loader.loadAndCreateLink("libsodium.so.26", "libsodium.so")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.utils
package org.apache.gluten.spi

import org.apache.gluten.jni.JniLibLoader

class SharedLibraryLoaderUbuntu2004 extends SharedLibraryLoader {

override def accepts(osName: String, osVersion: String): Boolean = {
osName.contains("Ubuntu") && osVersion.startsWith("20.04")
}

override def loadLib(loader: JniLibLoader): Unit = {
loader.loadAndCreateLink("libroken.so.18", "libroken.so")
loader.loadAndCreateLink("libasn1.so.8", "libasn1.so")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.gluten.utils
package org.apache.gluten.spi

import org.apache.gluten.jni.JniLibLoader

class SharedLibraryLoaderUbuntu2204 extends SharedLibraryLoader {

override def accepts(osName: String, osVersion: String): Boolean = {
osName.contains("Ubuntu") && osVersion.startsWith("22.04")
}
override def loadLib(loader: JniLibLoader): Unit = {
loader.loadAndCreateLink("libboost_context.so.1.84.0", "libboost_context.so")
loader.loadAndCreateLink("libicudata.so.70", "libicudata.so")
Expand Down Expand Up @@ -46,4 +50,5 @@ class SharedLibraryLoaderUbuntu2204 extends SharedLibraryLoader {
loader.loadAndCreateLink("libsnappy.so.1", "libsnappy.so")
loader.loadAndCreateLink("libthrift-0.16.0.so", "libthrift.so")
}

}
Loading