提交 aeb60d27 编写于 作者: L Liangliang He

Update opencl c++ header wrapper inclusion

上级 65c34b78
...@@ -5,71 +5,79 @@ workspace(name = "mace") ...@@ -5,71 +5,79 @@ workspace(name = "mace")
# This statement defines the @com_google_protobuf repo. # This statement defines the @com_google_protobuf repo.
http_archive( http_archive(
name = "com_google_protobuf", name = "com_google_protobuf",
urls = ["http://v9.git.n.xiaomi.com/deep-computing/protobuf/repository/archive.zip?ref=c7457ef65a7a8584b1e3bd396c401ccf8e275ffa"],
strip_prefix = "protobuf-c7457ef65a7a8584b1e3bd396c401ccf8e275ffa-c7457ef65a7a8584b1e3bd396c401ccf8e275ffa",
sha256 = "0a54cae83b77f4b54b7db4eaebadd81fbe91655e84a1ef3f6d29116d75f3a45f", sha256 = "0a54cae83b77f4b54b7db4eaebadd81fbe91655e84a1ef3f6d29116d75f3a45f",
strip_prefix = "protobuf-c7457ef65a7a8584b1e3bd396c401ccf8e275ffa-c7457ef65a7a8584b1e3bd396c401ccf8e275ffa",
urls = ["http://v9.git.n.xiaomi.com/deep-computing/protobuf/repository/archive.zip?ref=c7457ef65a7a8584b1e3bd396c401ccf8e275ffa"],
) )
# cc_proto_library rules implicitly depend on @com_google_protobuf_cc//:cc_toolchain, # cc_proto_library rules implicitly depend on @com_google_protobuf_cc//:cc_toolchain,
# which is the C++ proto runtime (base classes and common utilities). # which is the C++ proto runtime (base classes and common utilities).
http_archive( http_archive(
name = "com_google_protobuf_cc", name = "com_google_protobuf_cc",
urls = ["http://v9.git.n.xiaomi.com/deep-computing/protobuf/repository/archive.zip?ref=c7457ef65a7a8584b1e3bd396c401ccf8e275ffa"],
strip_prefix = "protobuf-c7457ef65a7a8584b1e3bd396c401ccf8e275ffa-c7457ef65a7a8584b1e3bd396c401ccf8e275ffa",
sha256 = "0a54cae83b77f4b54b7db4eaebadd81fbe91655e84a1ef3f6d29116d75f3a45f", sha256 = "0a54cae83b77f4b54b7db4eaebadd81fbe91655e84a1ef3f6d29116d75f3a45f",
strip_prefix = "protobuf-c7457ef65a7a8584b1e3bd396c401ccf8e275ffa-c7457ef65a7a8584b1e3bd396c401ccf8e275ffa",
urls = ["http://v9.git.n.xiaomi.com/deep-computing/protobuf/repository/archive.zip?ref=c7457ef65a7a8584b1e3bd396c401ccf8e275ffa"],
) )
new_http_archive( new_http_archive(
name = "gtest", name = "gtest",
url = "http://v9.git.n.xiaomi.com/deep-computing/googletest/repository/archive.zip?ref=release-1.8.0",
strip_prefix = "googletest-release-1.8.0-ec44c6c1675c25b9827aacd08c02433cccde7780",
sha256 = "a0b43a0a43cda0cc401a46d75519d961ef27f6674d4126366e47d9c946c4bbcd",
build_file = "mace/third_party/gtest.BUILD", build_file = "mace/third_party/gtest.BUILD",
sha256 = "a0b43a0a43cda0cc401a46d75519d961ef27f6674d4126366e47d9c946c4bbcd",
strip_prefix = "googletest-release-1.8.0-ec44c6c1675c25b9827aacd08c02433cccde7780",
url = "http://v9.git.n.xiaomi.com/deep-computing/googletest/repository/archive.zip?ref=release-1.8.0",
) )
new_http_archive( new_http_archive(
name = "six_archive", name = "six_archive",
build_file = "mace/third_party/six.BUILD",
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
strip_prefix = "six-1.10.0",
urls = [ urls = [
"http://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", "http://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
"https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
], ],
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
strip_prefix = "six-1.10.0",
build_file = "mace/third_party/six.BUILD",
) )
bind( bind(
name = "six", name = "six",
actual = "@six_archive//:six", actual = "@six_archive//:six",
) )
new_http_archive( new_http_archive(
name = "opencl_headers", name = "opencl_headers",
urls = ["http://v9.git.n.xiaomi.com/deep-computing/OpenCL-Headers/repository/archive.zip?ref=master"],
strip_prefix = "OpenCL-Headers-master-f039db6764d52388658ef15c30b2237bbda49803",
sha256 = "439dbdb4e7a02a218dd90d82170c9f7671487cd0e626a20e136690a91f173ad2",
build_file = "mace/third_party/opencl-headers.BUILD", build_file = "mace/third_party/opencl-headers.BUILD",
sha256 = "439dbdb4e7a02a218dd90d82170c9f7671487cd0e626a20e136690a91f173ad2",
strip_prefix = "OpenCL-Headers-master-f039db6764d52388658ef15c30b2237bbda49803",
urls = ["http://v9.git.n.xiaomi.com/deep-computing/OpenCL-Headers/repository/archive.zip?ref=master"],
) )
# Set up Android NDK new_git_repository(
android_ndk_repository( name = "opencl_clhpp",
name = "androidndk", build_file = "mace/third_party/opencl-clhpp.BUILD",
# Android 5.0 commit = "4c6f7d56271727e37fb19a9b47649dd175df2b12",
api_level = 21 remote = "https://github.com/KhronosGroup/OpenCL-CLHPP.git",
) )
git_repository( git_repository(
name = "com_github_gflags_gflags", name = "com_github_gflags_gflags",
#tag = "v2.2.0", #tag = "v2.2.0",
commit = "30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e", # v2.2.0 + fix of include path commit = "30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e", # v2.2.0 + fix of include path
remote = "https://github.com/gflags/gflags.git" remote = "https://github.com/gflags/gflags.git",
) )
bind( bind(
name = "gflags", name = "gflags",
actual = "@com_github_gflags_gflags//:gflags", actual = "@com_github_gflags_gflags//:gflags",
) )
bind( bind(
name = "gflags_nothreads", name = "gflags_nothreads",
actual = "@com_github_gflags_gflags//:gflags_nothreads", actual = "@com_github_gflags_gflags//:gflags_nothreads",
) )
# Set up Android NDK
android_ndk_repository(
name = "androidndk",
# Android 5.0
api_level = 21,
)
...@@ -37,7 +37,6 @@ cc_library( ...@@ -37,7 +37,6 @@ cc_library(
]), ]),
hdrs = glob([ hdrs = glob([
"*.h", "*.h",
"runtime/opencl/cl2.hpp",
"runtime/opencl/*.h", "runtime/opencl/*.h",
"runtime/hexagon/*.h", "runtime/hexagon/*.h",
]), ]),
...@@ -61,10 +60,10 @@ cc_library( ...@@ -61,10 +60,10 @@ cc_library(
cc_library( cc_library(
name = "opencl_headers", name = "opencl_headers",
hdrs = glob([ hdrs = glob([
"runtime/opencl/cl2.hpp",
"runtime/opencl/*.h", "runtime/opencl/*.h",
]), ]),
deps = [ deps = [
"@opencl_clhpp//:opencl_clhpp",
"@opencl_headers//:opencl20_headers", "@opencl_headers//:opencl20_headers",
], ],
) )
......
此差异已折叠。
...@@ -9,6 +9,6 @@ ...@@ -9,6 +9,6 @@
#define CL_HPP_TARGET_OPENCL_VERSION 200 #define CL_HPP_TARGET_OPENCL_VERSION 200
#include "mace/core/runtime/opencl/cl2.hpp" #include "include/CL/cl2.hpp"
#endif // MACE_CORE_RUNTIME_OPENCL_CL2_HEADER_H_ #endif // MACE_CORE_RUNTIME_OPENCL_CL2_HEADER_H_
...@@ -40,7 +40,7 @@ void *OpenCLAllocator::New(size_t nbytes) const { ...@@ -40,7 +40,7 @@ void *OpenCLAllocator::New(size_t nbytes) const {
cl::Buffer *buffer = new cl::Buffer(OpenCLRuntime::Global()->context(), cl::Buffer *buffer = new cl::Buffer(OpenCLRuntime::Global()->context(),
CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR,
nbytes, nullptr, &error); nbytes, nullptr, &error);
MACE_CHECK(error == CL_SUCCESS); MACE_CHECK(error == CL_SUCCESS) << "error code: " << error;
MACE_CHECK_NOTNULL(buffer); MACE_CHECK_NOTNULL(buffer);
return static_cast<void *>(buffer); return static_cast<void *>(buffer);
} }
......
genrule(
name = "gen_opencl_clhpp",
srcs = glob([
"*",
"**/*",
]),
outs = ["include/CL/cl.hpp", "include/CL/cl2.hpp"],
cmd = "workdir=$$(mktemp -d -t opencl-clhpp-build.XXXXXXXXXX); cp -aL $$(dirname $(location CMakeLists.txt))/* $$workdir; pushd $$workdir; mkdir build; pushd build; cmake ../ -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF; make generate_clhpp generate_cl2hpp; popd; popd; cp -a $$workdir/build/* $(@D); rm -rf $$workdir; echo installing to $(@D)",
)
cc_library(
name = "opencl_clhpp",
srcs = ["include/CL/cl.hpp", "include/CL/cl2.hpp"],
visibility = ["//visibility:public"],
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册