提交 2aa84773 编写于 作者: 李寅

Merge branch 'fix-build' into 'master'

Fix half and opencl build

See merge request !119
......@@ -48,22 +48,16 @@ cc_library(
["*.cc",],
exclude=[
"logging.cc",
"opencl_allocator.cc",
]) + if_android([
"opencl_allocator.cc",
]),
hdrs = glob(
["*.h"],
exclude=[
"logging.h",
"opencl_allocator.h",
]) + if_android([
"opencl_allocator.h",
]),
copts = ["-std=c++11"] + if_android([
"-D__USE_OPENCL",
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1"] + if_android([
"-D__USE_OPENCL",
]),
linkopts = if_android([
linkopts = ["-ldl"] + if_android([
"-pie",
]),
deps = [
......@@ -71,9 +65,8 @@ cc_library(
"//mace/proto:cc_proto",
"//mace/proto:stats_proto",
"//mace/utils",
] + if_android([
":opencl_runtime",
]),
],
)
# Main program for tests
......@@ -86,7 +79,10 @@ cc_library(
hdrs = glob([
"testing/*.h",
]),
copts = ["-std=c++11"],
copts = [
"-std=c++11",
"-D_GLIBCXX_USE_C99_MATH_TR1",
],
linkopts = ["-lm"],
deps = [
":core",
......
......@@ -53,6 +53,9 @@ bool SimpleNet::Run(RunMetadata *run_metadata) {
if (run_metadata) {
if (device_type_ == DeviceType::OPENCL) {
#ifndef __USE_OPENCL
LOG(FATAL) << "OpenCL is not supported";
#endif
OpenCLRuntime::Get()->command_queue().finish();
op_stats = run_metadata->add_op_stats();
op_stats->set_operator_name(op->debug_def().name());
......
......@@ -11,19 +11,16 @@ load("//mace:mace.bzl", "if_android", "if_android_arm64")
cc_library(
name = "kernels",
srcs = glob(["*.cc"]) + if_android(glob([
"opencl/*.cc",
])) + if_android_arm64(glob([
srcs = glob(["*.cc", "opencl/*.cc"]) + if_android_arm64(glob([
"neon/*.cc",
])),
hdrs = glob(["*.h"]) + if_android(glob([
"opencl/*.h",
])) + if_android_arm64(glob([
hdrs = glob(["*.h", "opencl/*.h"]) + if_android_arm64(glob([
"neon/*.h",
])),
copts = [
"-std=c++11",
"-fopenmp",
"-D_GLIBCXX_USE_C99_MATH_TR1",
],
linkopts = if_android(["-lm"]),
deps = [
......
......@@ -36,7 +36,7 @@ cc_library(
),
copts = [
"-std=c++11",
"-fopenmp",
"-D_GLIBCXX_USE_C99_MATH_TR1",
],
deps = [
"//mace/kernels",
......@@ -52,7 +52,7 @@ cc_test(
["*_test.cc"],
),
copts = ["-std=c++11"],
linkopts = ["-fopenmp"] + if_android(["-ldl"]),
linkopts = ["-fopenmp"],
linkstatic = 1,
deps = [
":ops",
......@@ -65,7 +65,11 @@ cc_test(
name = "ops_benchmark",
testonly = 1,
srcs = glob(["*_benchmark.cc"]),
copts = ["-std=c++11"],
copts = [
"-std=c++11",
"-fopenmp",
"-D_GLIBCXX_USE_C99_MATH_TR1",
],
linkopts = ["-fopenmp"] + if_android(["-ldl"]),
linkstatic = 1,
deps = [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册