Skip to content

Commit

Permalink
port omp flags to yacl
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinxc committed Dec 1, 2023
1 parent 3baea61 commit 2b51b51
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
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

0 comments on commit 2b51b51

Please sign in to comment.