Skip to content

Commit b7708c5

Browse files
authored
Merge pull request #2026 from OvenMediaLabs/fix/cuda-stub
fix: added missing functions to libcudart.so.12
2 parents 1918f7f + f2e522d commit b7708c5

File tree

5 files changed

+338
-17
lines changed

5 files changed

+338
-17
lines changed

misc/ome_docker_launcher.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ banner()
138138

139139
# Configurations
140140
IMAGE_NAME=airensoft/ovenmediaengine:latest
141-
CONTAINER_NAME=${CONTAINER_NAME:-ovenemediaengine}
141+
CONTAINER_NAME=${CONTAINER_NAME:-ovenmediaengine}
142142
PREFIX=${PREFIX:-/usr/share/ovenmediaengine/}
143143

144144
if command -v realpath > /dev/null 2>&1

misc/ome_launcher.sh

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,10 @@ banner()
145145
#############################################################################################
146146
append_ld_preload() {
147147
local lib_path="$1"
148-
logd "Checking library for PRELOAD_PATH ${lib_path}"
149148
[[ -f "${lib_path}" ]] || return 0
150149

150+
logd "found for PRELOAD_PATH: ${lib_path}"
151+
151152
if [[ -z "${LD_PRELOAD:-}" ]]; then
152153
LD_PRELOAD="${lib_path}"
153154
elif [[ ":${LD_PRELOAD}:" != *":${lib_path}:"* ]]; then
@@ -157,9 +158,11 @@ append_ld_preload() {
157158

158159
append_ld_library_path() {
159160
local lib_path="$1"
160-
logd "Checking library path for LD_LIBRARY_PATH: ${lib_path}"
161+
161162
[[ -d "${lib_path}" ]] || return 0
162163

164+
logd "found for LD_LIBRARY_PATH: ${lib_path}"
165+
163166
if [[ -z "${LD_LIBRARY_PATH:-}" ]]; then
164167
LD_LIBRARY_PATH="${lib_path}"
165168
elif [[ ":${LD_LIBRARY_PATH}:" != *":${lib_path}:"* ]]; then
@@ -199,7 +202,7 @@ load_library_set_if_complete() {
199202
local lib_path=""
200203
lib_path="$(find_lib "${lib_file}")"
201204
if [[ -z "${lib_path}" || ! -f "${lib_path}" ]]; then
202-
logw "${label} libraries are not loaded. Missing: ${lib_file}"
205+
logd "${label} libraries are not loaded. Missing: ${lib_file}"
203206
return 1
204207
fi
205208

@@ -238,7 +241,7 @@ show_stub_linkage() {
238241
# Preload the installed drivers
239242
##########################################################################################
240243
preload_xilinx_driver() {
241-
logi "Checking for XILINX/XMA drivers to preload..."
244+
logd "Checking for XILINX/XMA drivers to preload..."
242245

243246
if [[ -f /opt/xilinx/xcdr/xrmd_start.bash ]]; then
244247
local lib_files=(
@@ -249,6 +252,7 @@ preload_xilinx_driver() {
249252
)
250253

251254
if ! load_library_set_if_complete "XILINX/XMA" "${lib_files[@]}"; then
255+
logi "Xiline/XMA driver not found. hardware acceleration is not supported"
252256
return
253257
fi
254258

@@ -257,14 +261,15 @@ preload_xilinx_driver() {
257261
source /opt/xilinx/xrm/setup.sh > /dev/null 2>&1 || true
258262
source /opt/xilinx/xcdr/xrmd_start.bash || true
259263
else
260-
logw "XILINX/XMA drivers not found, skipping preload."
264+
logi "Xilinx/XMA driver not found. hardware acceleration is not supported"
261265
fi
262266
}
263267

264268
preload_nvidia_driver() {
265-
logi "Checking for NVIDIA/CUDA drivers to preload..."
269+
logd "Checking for NVIDIA/CUDA drivers to preload..."
266270

267-
# CUDA 10.x libraries. It will be deprecated soon.
271+
# Deprecated
272+
# CUDA 10.x libraries.
268273
local lib_files_10=(
269274
"libnvidia-ml.so.1"
270275
"libcuda.so.1"
@@ -298,18 +303,22 @@ preload_nvidia_driver() {
298303
)
299304

300305
if load_library_set_if_complete "NVIDIA/CUDA 12.x" "${lib_files_12[@]}"; then
306+
logi "NVIDIA/CUDA 12.x drivers are installed. hardware acceleration is supported"
301307
return
302308
fi
303309

304310
if load_library_set_if_complete "NVIDIA/CUDA 11.x" "${lib_files_11[@]}"; then
311+
logw "NVIDIA/CUDA 11.x drivers are installed. hardware acceleration is supported. However, Some features may not be supported. it is recommended to update to CUDA 12.x for better performance and compatibility.."
305312
return
306313
fi
307314

308-
if load_library_set_if_complete "NVIDIA/CUDA 10.x" "${lib_files_10[@]}"; then
309-
return
310-
fi
315+
# Deprecated
316+
#if load_library_set_if_complete "NVIDIA/CUDA 10.x" "${lib_files_10[@]}"; then
317+
# logw "NVIDIA/CUDA 10.x drivers are installed. hardware acceleration is supported. However, Some features may not be supported. it is strongly recommended to update to CUDA 12.x for better performance and compatibility. "
318+
# return
319+
#fi
311320

312-
logd "No complete NVIDIA/CUDA library set found. Skipping NVIDIA preload."
321+
logi "NVIDIA/CUDA driver not found. hardware acceleration is not supported"
313322
}
314323

315324
############################################################################################
@@ -341,8 +350,8 @@ banner
341350

342351
# Check the installed drivers and preload them.
343352
LD_PRELOAD=""
344-
preload_xilinx_driver
345353
preload_nvidia_driver
354+
preload_xilinx_driver
346355

347356
# Set LD_LIBRARY_PATH (prepend required paths while preserving the existing value).
348357
append_ld_library_path "${DEFAULT_LIB_DIR}/lib/stubs"
@@ -370,4 +379,4 @@ else
370379
loge "OvenMediaEngine executable not found."
371380
fi
372381

373-
exit 1
382+
exit 1

misc/stubs/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CFLAGS = -Wall -fPIC
88
LDFLAGS = -shared
99

1010
# Source files
11-
SOURCES = libnvidia-ml_stub.c libcuda_stub.c libcudart_stub.c libcublas_stub.c libcublasLt_stub.c libxma2api_stub.c libxrm_stub.c libxrt_core_stub.c
11+
SOURCES = libnvidia-ml_stub.c libcuda_stub.c libcudart11_stub.c libcudart12_stub.c libcublas_stub.c libcublasLt_stub.c libxma2api_stub.c libxrm_stub.c libxrt_core_stub.c
1212

1313
# Object files
1414
OBJECTS = $(SOURCES:.c=.o)
@@ -32,7 +32,7 @@ libnvidia-ml.so.1: libnvidia-ml_stub.o
3232
libcuda.so.1: libcuda_stub.o
3333
$(CC) $(LDFLAGS) -Wl,-soname,libcuda.so.1 -Wl,--version-script=libcuda.map -o $@ $^
3434

35-
libcudart.so.11.0: libcudart_stub.o
35+
libcudart.so.11.0: libcudart11_stub.o
3636
$(CC) $(LDFLAGS) -Wl,-soname,libcudart.so.11.0 -Wl,--version-script=libcudart11.map -o $@ $^
3737

3838
libcublas.so.11: libcublas_stub.o
@@ -41,7 +41,7 @@ libcublas.so.11: libcublas_stub.o
4141
libcublasLt.so.11: libcublasLt_stub.o
4242
$(CC) $(LDFLAGS) -Wl,-soname,libcublasLt.so.11 -Wl,--version-script=libcublasLt11.map -o $@ $^
4343

44-
libcudart.so.12: libcudart_stub.o
44+
libcudart.so.12: libcudart12_stub.o
4545
$(CC) $(LDFLAGS) -Wl,-soname,libcudart.so.12 -Wl,--version-script=libcudart12.map -o $@ $^
4646

4747
libcublas.so.12: libcublas_stub.o

0 commit comments

Comments
 (0)