Skip to content

Commit

Permalink
Fix MKL builds
Browse files Browse the repository at this point in the history
  • Loading branch information
karllessard committed May 15, 2020
1 parent e365b31 commit 9e9398d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
echo Downloading Bazel
curl -L https://github.com/bazelbuild/bazel/releases/download/2.0.0/bazel-2.0.0-installer-darwin-x86_64.sh -o bazel.sh --retry 10
bash bazel.sh
brew install libomp
- name: Checkout repository
uses: actions/checkout@v1
- name: Build project
Expand All @@ -77,6 +78,7 @@ jobs:
strategy:
matrix:
ext: ["", -mkl, -gpu, -mkl-gpu]
timeout-minutes: 480
steps:
- name: Configure page file
uses: al-cheb/[email protected]
Expand Down
14 changes: 4 additions & 10 deletions tensorflow-core/tensorflow-core-api/BUILD
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts")
load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts", "tf_cc_binary")
load("@rules_java//java:defs.bzl", "java_proto_library")

cc_binary(
tf_cc_binary(
name = "java_op_generator",
srcs = [
"src/bazel/op_generator/op_gen_main.cc",
],
copts = tf_copts(),
linkopts = select({
"@org_tensorflow//tensorflow:windows": [],
"//conditions:default": ["-lm"],
}),
deps = [
":java_op_gen_lib",
"@org_tensorflow//tensorflow:libtensorflow_framework_import_lib",
],
)

cc_library(
name = "java_op_gen_lib",
srcs = [
"src/bazel/op_generator/op_gen_main.cc",
"src/bazel/op_generator/op_generator.cc",
"src/bazel/op_generator/op_specs.cc",
"src/bazel/op_generator/source_writer.cc",
Expand All @@ -45,20 +41,18 @@ filegroup(
srcs = glob(["src/bazel/api_def/*"])
)

cc_binary(
tf_cc_binary(
name = "java_api_import",
srcs = [
"src/bazel/api_def/import/api_import.cc",
],
copts = tf_copts(),
linkopts = select({
"@org_tensorflow//tensorflow:windows": [],
"//conditions:default": ["-lm"],
}),
deps = [
"@org_tensorflow//tensorflow/core:op_gen_lib",
"@org_tensorflow//tensorflow/tools/api/lib:api_objects_proto_cc",
"@org_tensorflow//tensorflow:libtensorflow_framework_import_lib"
],
)

Expand Down
3 changes: 1 addition & 2 deletions tensorflow-core/tensorflow-core-api/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "org_tensorflow",
patches = [
":tensorflow-visibility.patch",
":tensorflow-windows.patch", # https://github.com/tensorflow/tensorflow/issues/25213
":tensorflow-proto.patch",
":tensorflow-api-def.patch",
":tensorflow-framework.patch"
],
patch_tool = "patch",
patch_args = ["-p1"],
Expand Down
18 changes: 9 additions & 9 deletions tensorflow-core/tensorflow-core-api/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ export TENSORFLOW_BIN=$BAZEL_BIN/external/org_tensorflow/tensorflow
# Normalize some paths with symbolic links
TENSORFLOW_SO=($TENSORFLOW_BIN/libtensorflow.so.?.?.?)
if [[ -f $TENSORFLOW_SO ]]; then
export TENSORFLOW_LIB=$(basename $TENSORFLOW_SO)
ln -sf $TENSORFLOW_LIB $TENSORFLOW_BIN/libtensorflow.so
ln -sf $TENSORFLOW_LIB $TENSORFLOW_BIN/libtensorflow.so.2
export TENSORFLOW_LIB=$TENSORFLOW_SO
ln -sf $(basename $TENSORFLOW_SO) $TENSORFLOW_BIN/libtensorflow.so
ln -sf $(basename $TENSORFLOW_SO) $TENSORFLOW_BIN/libtensorflow.so.2
fi
TENSORFLOW_DYLIB=($TENSORFLOW_BIN/libtensorflow.?.?.?.dylib)
if [[ -f $TENSORFLOW_DYLIB ]]; then
export TENSORFLOW_LIB=$(basename $TENSORFLOW_DYLIB)
ln -sf $TENSORFLOW_LIB $TENSORFLOW_BIN/libtensorflow.dylib
ln -sf $TENSORFLOW_LIB $TENSORFLOW_BIN/libtensorflow.2.dylib
export TENSORFLOW_LIB=$TENSORFLOW_DYLIB
ln -sf $(basename $TENSORFLOW_DYLIB) $TENSORFLOW_BIN/libtensorflow.dylib
ln -sf $(basename $TENSORFLOW_DYLIB) $TENSORFLOW_BIN/libtensorflow.2.dylib
fi
TENSORFLOW_DLLS=($TENSORFLOW_BIN/tensorflow.dll.if.lib $TENSORFLOW_BIN/libtensorflow.dll.ifso)
for TENSORFLOW_DLL in ${TENSORFLOW_DLLS[@]}; do
if [[ -f $TENSORFLOW_DLL ]]; then
export TENSORFLOW_LIB=$(basename $TENSORFLOW_DLL)
ln -sf $TENSORFLOW_LIB $TENSORFLOW_BIN/tensorflow.lib
export TENSORFLOW_LIB=$TENSORFLOW_DLL
ln -sf $(basename $TENSORFLOW_DLL) $TENSORFLOW_BIN/tensorflow.lib
fi
done
ls -l $TENSORFLOW_BIN
Expand All @@ -68,7 +68,7 @@ GEN_SRCS_DIR=src/gen/java
mkdir -p $GEN_SRCS_DIR

# Generate Java operator wrappers
LD_LIBRARY_PATH=$TENSORFLOW_BIN $BAZEL_BIN/java_op_generator \
$BAZEL_BIN/java_op_generator \
--output_dir=$GEN_SRCS_DIR \
--api_dirs=$BAZEL_SRCS/external/org_tensorflow/tensorflow/core/api_def/base_api,src/bazel/api_def \
$TENSORFLOW_LIB
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
diff --git a/tensorflow/BUILD b/tensorflow/BUILD
index 55406a5686..35d1547dfb 100644
--- a/tensorflow/BUILD
+++ b/tensorflow/BUILD
@@ -33,7 +33,7 @@ load(
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

package(
- default_visibility = [":internal"],
+ default_visibility = ["//visibility:public"],
licenses = ["notice"], # Apache 2.0
)

diff --ruN a/tensorflow/core/api_def/BUILD b/tensorflow/core/api_def/BUILD
--- a/tensorflow/core/api_def/BUILD 2020-03-26 18:19:19.000000000 -0400
+++ b/tensorflow/core/api_def/BUILD 2020-04-01 22:50:37.000000000 -0400
Expand All @@ -21,3 +34,4 @@ diff -ruN a/tensorflow/tools/api/lib/BUILD b/tensorflow/tools/api/lib/BUILD
)

py_library(

0 comments on commit 9e9398d

Please sign in to comment.