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

[NFC] port omp flags to yacl #167

Merged
merged 1 commit into from
Dec 1, 2023
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
13 changes: 13 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ def yacl_deps():
remote = "{}/interconnection.git".format(SECRETFLOW_GIT),
)

# Add homebrew openmp for macOS, somehow..homebrew installs to different location on Apple Silcon/Intel macs.. so we need two rules here
native.new_local_repository(
name = "macos_omp_x64",
build_file = "@yacl//bazel:local_openmp_macos.BUILD",
path = "/usr/local/opt/libomp",
)

native.new_local_repository(
name = "macos_omp_arm64",
build_file = "@yacl//bazel:local_openmp_macos.BUILD",
path = "/opt/homebrew/opt/libomp/",
)

def _com_github_brpc_brpc():
maybe(
http_archive,
Expand Down
6 changes: 6 additions & 0 deletions bazel/yacl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ AES_COPT_FLAGS = select({
],
})

OMP_LINK_FLAGS = select({
"@bazel_tools//src/conditions:darwin_x86_64": ["@macos_omp_x64//:openmp"],
"@bazel_tools//src/conditions:darwin_arm64": ["@macos_omp_arm64//:openmp"],
"//conditions:default": [],
})

def _yacl_copts():
return select({
"@yacl//bazel:yacl_build_as_release": RELEASE_FLAGS,
Expand Down
Loading