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

fix: add cycle linking for mkl_core(bazel) #2967

Merged
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
15 changes: 6 additions & 9 deletions .ci/pipeline/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -534,15 +534,12 @@ jobs:
--test_thread_mode=par
displayName: 'cpp-examples-thread-release-static'

# The issue that bazel doesnt link MKL libs via -Wl, --start-group..
# oneDAL make build pass this test
# TODO: add cycle linking in bazel
# - script: |
# export DALROOT=`pwd`/bazel-bin/release/daal/latest
# bazel test //examples/oneapi/cpp:all \
# --test_link_mode=release_dynamic \
# --test_thread_mode=par
# displayName: 'cpp-examples-thread-release-dynamic'
- script: |
export DALROOT=`pwd`/bazel-bin/release/daal/latest
bazel test //examples/oneapi/cpp:all \
--test_link_mode=release_dynamic \
--test_thread_mode=par
displayName: 'cpp-examples-thread-release-dynamic'

- script: |
bazel test //cpp/daal:tests
Expand Down
13 changes: 12 additions & 1 deletion dev/bazel/deps/mkl.tpl.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,22 @@ cc_library(
"lib/libmkl_tbb_thread.a",
],
linkopts = [
# The source libraries have circular symbol dependencies. To successfully build this cc_library,
# oneMKL requires wrapping the libraries with -Wl,--start-group and -Wl,--end-group.
"-Wl,--start-group",
"$(location lib/libmkl_core.a)",
"$(location lib/libmkl_intel_ilp64.a)",
"$(location lib/libmkl_tbb_thread.a)",
"-Wl,--end-group",
"-lpthread",
"-lm",
"-ldl",
],
deps = [
":headers",
]
],
alwayslink = 1,
linkstatic = 1,
)

cc_library(
Expand Down