Skip to content

Commit c8c76f5

Browse files
authored
reference tensor proto of tensorflow (#1729)
* init * update * refine cmd * polish again * test ci * test ci * trigger ci * fix ci * follow comments
1 parent 3a157c1 commit c8c76f5

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

elasticdl/Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
PYTHON = python
2-
3-
EDL_PROTO_FILE = elasticdl/proto/elasticdl.proto
4-
52
GO_FILE_DIR = elasticdl/pkg/proto
6-
GO_PB_FILE = $(GO_FILE_DIR)/elasticdl.pb.go
7-
83
CXX = g++
94
CAPI_DIR = elasticdl/pkg/kernel/capi
105

11-
all: python_pb $(GO_PB_FILE) kernel
6+
all: python_pb go_pb kernel
127

13-
python_pb:
14-
$(PYTHON) -m grpc_tools.protoc -I . $(EDL_PROTO_FILE) --python_out=. --grpc_python_out=.
8+
python_pb: elasticdl/proto/elasticdl.proto
9+
$(PYTHON) -m grpc_tools.protoc -I${TF_PATH} -I. \
10+
elasticdl/proto/elasticdl.proto --python_out=. --grpc_python_out=.
1511

16-
$(GO_PB_FILE): $(EDL_PROTO_FILE)
12+
go_pb: elasticdl/proto/elasticdl.proto
1713
mkdir -p $(GO_FILE_DIR)
18-
protoc -I . $< --go_out=plugins=grpc:.
14+
protoc -I${TF_PATH} ${TF_PATH}/tensorflow/core/framework/types.proto --go_out=${GOPATH}/src
15+
protoc -I${TF_PATH} ${TF_PATH}/tensorflow/core/framework/resource_handle.proto --go_out=${GOPATH}/src
16+
protoc -I${TF_PATH} ${TF_PATH}/tensorflow/core/framework/tensor_shape.proto --go_out=${GOPATH}/src
17+
protoc -I${TF_PATH} ${TF_PATH}/tensorflow/core/framework/tensor.proto --go_out=${GOPATH}/src
18+
protoc -I${TF_PATH} -Ielasticdl/proto elasticdl/proto/elasticdl.proto --go_out=plugins=grpc:.
1919

2020
kernel:
2121
${CXX} -O3 -std=c++11 ${CAPI_DIR}/kernel_api.cc -c -o ${CAPI_DIR}/libkernel_api.o

elasticdl/docker/Dockerfile.dev

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ RUN /install-protobuf.bash && rm /install-protobuf.bash
4949

5050
# Install elasticdl.org/elasticdl Go package
5151
ENV ELASTICDLPATH $GOPATH/src/elasticdl.org/elasticdl
52+
ENV TF_PATH /tmp/tensorflow
53+
RUN cd /tmp && git clone --depth=1 https://github.com/tensorflow/tensorflow.git
5254
COPY . /tmp/elasticdl
53-
RUN cd /tmp/elasticdl && make -f elasticdl/Makefile && \
54-
mkdir -p $ELASTICDLPATH && \
55+
RUN cd /tmp/elasticdl && mkdir -p $ELASTICDLPATH && \
56+
make -f elasticdl/Makefile && \
5557
cp -r /tmp/elasticdl/elasticdl/pkg $ELASTICDLPATH && \
5658
cd $GOPATH/src/elasticdl.org/elasticdl && \
57-
export GO111MODULE=on && \
58-
go mod init elasticdl.org/elasticdl && \
5959
go install ./... && cd / && rm -rf /tmp/elasticdl

elasticdl/docker/scripts/install-go.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ GO_MIRROR_URL=$1
66

77
curl --silent ${GO_MIRROR_URL}/go1.13.4.linux-amd64.tar.gz | tar -C /usr/local -xzf -
88

9-
go env -w GO111MODULE=on
109
go env -w GOPROXY=https://goproxy.io,direct
1110

1211
go get github.com/golang/protobuf/protoc-gen-go
@@ -16,5 +15,6 @@ go get golang.org/x/tools/cmd/cover
1615
go get github.com/mattn/goveralls
1716
go get github.com/rakyll/gotest
1817
go get github.com/wangkuiyi/goyaccfmt
18+
go get github.com/stretchr/testify/assert
1919

2020
cp $GOPATH/bin/* /usr/local/bin/

elasticdl/proto/elasticdl.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
syntax = "proto3";
22

33
import "google/protobuf/empty.proto";
4+
import "tensorflow/core/framework/tensor.proto";
45

56
package proto;
67
option go_package = "elasticdl/pkg/proto";

0 commit comments

Comments
 (0)