Skip to content

Commit

Permalink
Remove some self developed algorithms (#149)
Browse files Browse the repository at this point in the history
Remove some self developed algorithms and support other repos rely on Adlik as a third-party library

Signed-off-by: jinshiying <jin.shiying@zte.com.cn>

Co-authored-by: amadeus-zte <54922692+amadeus-zte@users.noreply.github.com>
  • Loading branch information
shiyingjin and amadeus-zte committed May 16, 2020
1 parent e079dfc commit fceeab8
Show file tree
Hide file tree
Showing 38 changed files with 154 additions and 1,364 deletions.
124 changes: 3 additions & 121 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,121 +1,9 @@
workspace(name = "adlik")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

# Python rules.

http_archive(
name = "rules_python",
sha256 = "64a3c26f95db470c32ad86c924b23a821cd16c3879eed732a7841779a32a60f8",
strip_prefix = "rules_python-748aa53d7701e71101dfd15d800e100f6ff8e5d1",
urls = ["https://github.com/bazelbuild/rules_python/archive/748aa53d7701e71101dfd15d800e100f6ff8e5d1.tar.gz"],
)

# C++ rules.

http_archive(
name = "rules_cc",
sha256 = "e637dc045e70e43b7431fbeacb68d569a84f9fe1cb5879c432aa0855097dce57",
strip_prefix = "rules_cc-34ca16f4aa4bf2a5d3e4747229202d6cb630ebab",
urls = ["https://github.com/bazelbuild/rules_cc/archive/34ca16f4aa4bf2a5d3e4747229202d6cb630ebab.tar.gz"],
)

# TensorFlow.

http_archive(
name = "org_tensorflow",
sha256 = "e3d5876d1483a7a2bc734a481e253398f9a80ee922045786bda75072d05a698c",
strip_prefix = "tensorflow-e6e5d6df2ab26620548f35bf2e652b19f6d06652",
urls = [
"https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/e6e5d6df2ab26620548f35bf2e652b19f6d06652.tar.gz",
"https://github.com/tensorflow/tensorflow/archive/e6e5d6df2ab26620548f35bf2e652b19f6d06652.tar.gz",
],
)

http_archive(
name = "io_bazel_rules_closure",
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
],
)

# Xunit.

http_archive(
name = "xunit_cut",
sha256 = "f7c2c339a5ab06dc1d16cb03b157a96e6c591f9833f5c072f56af4a8f8013b53",
strip_prefix = "cut-1ce2bed5cbf7e9a282eee546ff5637a040e42abe",
urls = [
"https://github.com/horance-liu/cut/archive/1ce2bed5cbf7e9a282eee546ff5637a040e42abe.tar.gz",
],
)

# TensorRT.

new_local_repository(
name = "extern_lib",
build_file_content = """
cc_library(
name = "libnvinfer",
srcs = ["libnvinfer.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "libnvparsers",
srcs = ["libnvparsers.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "libnvinfer_plugin",
srcs = ["libnvinfer_plugin.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "libnvonnxparser",
srcs = ["libnvonnxparser.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "libcudnn",
srcs = ["libcudnn.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "libcublas",
srcs = ["libcublas.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "libcudart_static",
srcs = ["libcudart_static.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "libnvToolsExt",
srcs = ["libnvToolsExt.so"],
visibility = ["//visibility:public"],
)
cc_library(
name = "libcudart",
srcs = ["libcudart.so"],
visibility = ["//visibility:public"],
)
""",
path = "/usr/lib/x86_64-linux-gnu",
)

# Bazel extra actions proto file.

http_file(
name = "bazel_extra_actions_base_proto",
sha256 = "0d91fe29a80d2754f13e379713da37750c42425d92ef7de77f60acdb82479edc",
urls = ["https://github.com/bazelbuild/bazel/raw/2.1.0/src/main/protobuf/extra_actions_base.proto"],
)

# Adlik serving dependencies.
load("//adlik_serving:add_deps.bzl", "add_all_deps")

add_all_deps()

load("//adlik_serving:workspace.bzl", "adlik_serving_workspace")

Expand All @@ -128,9 +16,3 @@ grpc_deps()
load("@upb//bazel:repository_defs.bzl", "bazel_version_repository")

bazel_version_repository(name = "bazel_version")

# Specify the minimum required bazel version.

load("@org_tensorflow//tensorflow:version_check.bzl", "check_bazel_version_at_least")

check_bazel_version_at_least(minimum_bazel_version = "2.1.0")
89 changes: 89 additions & 0 deletions adlik_serving/add_deps.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# -*- Python -*-
"""
Adlik serving dependencies, this file should be called before workspace.bzl
"""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

def add_all_deps():
"""All Adlik serving external dependencies."""

# Python rules.

http_archive(
name = "rules_python",
sha256 = "64a3c26f95db470c32ad86c924b23a821cd16c3879eed732a7841779a32a60f8",
strip_prefix = "rules_python-748aa53d7701e71101dfd15d800e100f6ff8e5d1",
urls = ["https://github.com/bazelbuild/rules_python/archive/748aa53d7701e71101dfd15d800e100f6ff8e5d1.tar.gz"],
)

# C++ rules.

http_archive(
name = "rules_cc",
sha256 = "e637dc045e70e43b7431fbeacb68d569a84f9fe1cb5879c432aa0855097dce57",
strip_prefix = "rules_cc-34ca16f4aa4bf2a5d3e4747229202d6cb630ebab",
urls = ["https://github.com/bazelbuild/rules_cc/archive/34ca16f4aa4bf2a5d3e4747229202d6cb630ebab.tar.gz"],
)

http_archive(
name = "io_bazel_rules_closure",
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
],
)

# Bazel extra actions proto file.

http_file(
name = "bazel_extra_actions_base_proto",
sha256 = "0d91fe29a80d2754f13e379713da37750c42425d92ef7de77f60acdb82479edc",
urls = ["https://github.com/bazelbuild/bazel/raw/2.1.0/src/main/protobuf/extra_actions_base.proto"],
)

# TensorFlow

http_archive(
name = "org_tensorflow",
sha256 = "e3d5876d1483a7a2bc734a481e253398f9a80ee922045786bda75072d05a698c",
strip_prefix = "tensorflow-e6e5d6df2ab26620548f35bf2e652b19f6d06652",
urls = [
"https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/e6e5d6df2ab26620548f35bf2e652b19f6d06652.tar.gz",
"https://github.com/tensorflow/tensorflow/archive/e6e5d6df2ab26620548f35bf2e652b19f6d06652.tar.gz",
],
)

# Xunit.

http_archive(
name = "xunit_cut",
sha256 = "f7c2c339a5ab06dc1d16cb03b157a96e6c591f9833f5c072f56af4a8f8013b53",
strip_prefix = "cut-1ce2bed5cbf7e9a282eee546ff5637a040e42abe",
urls = [
"https://github.com/horance-liu/cut/archive/1ce2bed5cbf7e9a282eee546ff5637a040e42abe.tar.gz",
],
)

http_archive(
name = "com_github_libevent_libevent",
urls = [
"https://github.com/libevent/libevent/archive/release-2.1.8-stable.zip",
],
sha256 = "70158101eab7ed44fd9cc34e7f247b3cae91a8e4490745d9d6eb7edc184e4d96",
strip_prefix = "libevent-release-2.1.8-stable",
build_file = str(Label("//third_party/libevent:BUILD")),
)

# ===== dlib dependencies, for machine learning =====
http_archive(
name = "dlib_archive",
urls = [
"https://github.com/davisking/dlib/archive/v19.19.zip",
],
sha256 = "af1773d39eef0838421c70d34057e975b6d7ac885f490b6a383eb5d6da5baa84",
strip_prefix = "dlib-19.19",
build_file = str(Label("//third_party/dlib:BUILD")),
)
26 changes: 0 additions & 26 deletions adlik_serving/apis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,6 @@ serving_proto_library_py(
],
)

serving_proto_library(
name = "amc_task_proto",
srcs = ["amc_task.proto"],
cc_api_version = 2,
)

serving_proto_library_py(
name = "amc_task_proto_py_pb2",
srcs = ["amc_task.proto"],
proto_library = "amc_task_proto",
)

serving_proto_library(
name = "grid_task_proto",
srcs = ["grid_task.proto"],
cc_api_version = 2,
)

serving_proto_library_py(
name = "grid_task_proto_py_pb2",
srcs = ["grid_task.proto"],
proto_library = "grid_task_proto",
)

serving_proto_library(
name = "task_proto",
srcs = ["task.proto"],
Expand Down Expand Up @@ -134,8 +110,6 @@ py_proto_library(
srcs_version = "PY2AND3",
use_grpc_plugin = True,
deps = [
":amc_task_proto_py_pb2",
":grid_task_proto_py_pb2",
":task_proto_py_pb2",
"@com_google_protobuf//:protobuf_python",
],
Expand Down
18 changes: 0 additions & 18 deletions adlik_serving/apis/amc_task.proto

This file was deleted.

21 changes: 0 additions & 21 deletions adlik_serving/apis/grid_task.proto

This file was deleted.

2 changes: 1 addition & 1 deletion adlik_serving/apis/task.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ message CreateTaskRequest {
}

message CreateTaskResponse {
string status = 1; // NEW, RUNNING, ERROR, DONE
string status = 1; // ERROR, DONE

// information for specific task, different model has own definition
google.protobuf.Any detail = 2;
Expand Down
25 changes: 12 additions & 13 deletions adlik_serving/clients/task/build_pip_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,38 @@ function main() {
exit 1
fi

if [[ ! -d "bazel-bin/adlik_serving" ]]; then
echo "Could not find bazel-bin. Did you run from the root of the build"\
"tree?"
exit 1
fi

local BAZEL_PROJECT_DIR="bazel-${PWD##*/}"
local PIP_BIN_DIR=$(dirname $0)
local ADLIK_BIN_ROOT_DIR=${PIP_BIN_DIR}/../../..
DEST="$1"
TMPDIR="$(mktemp -d)"
local PIP_SRC_DIR="adlik_serving/clients/task"
local PIP_SRC_DIR=${PIP_BIN_DIR}/build_pip_package.runfiles/Adlik/adlik_serving/clients/task
if [[ ! -d ${PIP_SRC_DIR} ]]; then
PIP_SRC_DIR="adlik_serving/clients/task"
fi

echo $(date) : "=== Using tmpdir: ${TMPDIR}"
mkdir -p ${TMPDIR}/adlik_serving/framework/domain
mkdir -p ${TMPDIR}/adlik_serving/apis

echo "Adding python files"
cp bazel-bin/adlik_serving/apis/*_pb2.py \
cp ${ADLIK_BIN_ROOT_DIR}/adlik_serving/apis/*_pb2.py \
"${TMPDIR}/adlik_serving/apis"

cp bazel-bin/adlik_serving/apis/*_pb2_grpc.py \
cp ${ADLIK_BIN_ROOT_DIR}/adlik_serving/apis/*_pb2_grpc.py \
"${TMPDIR}/adlik_serving/apis"

cp bazel-bin/adlik_serving/framework/domain/*_pb2.py \
cp ${ADLIK_BIN_ROOT_DIR}/adlik_serving/framework/domain/*_pb2.py \
"${TMPDIR}/adlik_serving/framework/domain"

cp adlik_serving/clients/task/__init__.py \
"${TMPDIR}/adlik_serving/."
# cp adlik_serving/clients/task/__init__.py \
# "${TMPDIR}/adlik_serving/."

touch "${TMPDIR}/adlik_serving/__init__.py"
touch "${TMPDIR}/adlik_serving/apis/__init__.py"
touch "${TMPDIR}/adlik_serving/framework/__init__.py"
touch "${TMPDIR}/adlik_serving/framework/domain/__init__.py"


echo "Adding package setup files"
cp ${PIP_SRC_DIR}/setup.py "${TMPDIR}"

Expand Down
Loading

0 comments on commit fceeab8

Please sign in to comment.