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

core dump when link libonnxruntime_providers_shared.so #19088

Closed
kuramawzw123 opened this issue Jan 11, 2024 · 1 comment
Closed

core dump when link libonnxruntime_providers_shared.so #19088

kuramawzw123 opened this issue Jan 11, 2024 · 1 comment
Labels
ep:CUDA issues related to the CUDA execution provider

Comments

@kuramawzw123
Copy link

kuramawzw123 commented Jan 11, 2024

Describe the issue

I Build with cuda-11.8 and cudnn 8.2 on centos7.9.
build shell :
./build.sh --skip_submodule_sync
--cuda_home $CUDA_HOME
--cudnn_home $CUDNN_HOME
--use_cuda
--config $CONFIG
--build_shared_lib
--parallel 32
--cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER)
--build_dir $BUILD_DIR
--cmake_extra_defines 'CMAKE_CUDA_ARCHITECTURES=80'
--skip_tests
for debug core dump, I build with Debug mode, --config Debug, then in build dir, generate dynamice lib,
then I write simple test with link onnxruntime lib(-L$(ONNX_LIB) -lonnxruntime
-lcustom_op_library
-lonnxruntime_providers_shared
-lonnxruntime_providers_cuda)
but programe got core dump when starts , evne not enter to main function, core dump when init global variable,
here is my core dump info
#0 0x00007fffa6467060 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535)
at /home/wzw/work/ort_1.16.3/onnxruntime/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc:88
#1 0x00007fffa64670d8 in _GLOBAL__sub_I_provider_bridge_provider.cc(void) ()
at /home/wzw/work/ort_1.16.3/onnxruntime/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc:755
#2 0x00007ffff7dea9c3 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#3 0x00007ffff7ddc17a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#4 0x0000000000000001 in ?? ()
#5 0x00007fffffffd429 in ?? ()
#6 0x0000000000000000 in ?? ()

https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc#L88.
ProviderHostCPU& g_host_cpu = g_host->GetProviderHostCPU();
g_host is nullptrt,
becasue Provider_GetHost() function just return gbloal var g_host, where g_host init nullptr
(https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/providers/shared/common.cc#L8)

To reproduce

#include
#include <onnxruntime_cxx_api.h>
int main() {
std::cout << "onnx runtime test\n" << "\n";
return 0;
}
g++ -o test test.cxx -D USE_CUDA=1 -g -I./onnxruntime -L./onnxruntime --lonnxruntime
-lcustom_op_library
-lonnxruntime_providers_shared
-lonnxruntime_providers_cuda

Urgency

No response

Platform

Linux

OS Version

CentOS Linux release 7.9.2009 (Core)

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.16.3

ONNX Runtime API

C++

Architecture

X64

Execution Provider

CUDA

Execution Provider Library Version

cuda 11.8

Tasks

Preview Give feedback
No tasks being tracked yet.
@github-actions github-actions bot added the ep:CUDA issues related to the CUDA execution provider label Jan 11, 2024
@snnn
Copy link
Member

snnn commented Jan 12, 2024

You only need to link to onnxruntime. Please remove the following things from the link command.

-lcustom_op_library
-lonnxruntime_providers_shared
-lonnxruntime_providers_cuda

@snnn snnn closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:CUDA issues related to the CUDA execution provider
Projects
None yet
Development

No branches or pull requests

2 participants