Fix cmake build
* Use dedicated Dockerflie.cmake for cmake: Ensure cmake version >=3.5. * Let cmake build protobuf 3.0.0-beta-2 from source. Version 3.0.0 cannot be used a.t.m. due to an integer type issue. * Fix a bug in tf_models.cmake. * Perform parallel make based on the number of cores. New build command: tensorflow/tools/ci_build/ci_build.sh cmake tensorflow/tools/ci_build/builds/cmake.sh
This commit is contained in:
parent
c5f94b10bb
commit
da933d57d7
@ -71,7 +71,7 @@ target_include_directories(tf_models_word2vec_kernels PRIVATE
|
|||||||
${re2_INCLUDES}
|
${re2_INCLUDES}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(tf_models_word2vec_ops
|
add_dependencies(tf_models_word2vec_kernels
|
||||||
tf_core_cpu
|
tf_core_cpu
|
||||||
)
|
)
|
||||||
|
|
||||||
|
16
tensorflow/tools/ci_build/Dockerfile.cmake
Normal file
16
tensorflow/tools/ci_build/Dockerfile.cmake
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
FROM ubuntu:16.04
|
||||||
|
|
||||||
|
MAINTAINER Shanqing Cai <cais@google.com>
|
||||||
|
|
||||||
|
# Copy and run the install scripts.
|
||||||
|
COPY install/*.sh /install/
|
||||||
|
RUN /install/install_bootstrap_deb_packages.sh
|
||||||
|
RUN /install/install_deb_packages.sh
|
||||||
|
RUN /install/install_proto3_from_source.sh
|
||||||
|
|
||||||
|
RUN pip install --upgrade numpy
|
||||||
|
|
||||||
|
# Install golang
|
||||||
|
RUN add-apt-repository -y ppa:ubuntu-lxc/lxd-stable
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y golang
|
@ -16,7 +16,34 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the number of cores, for parallel make.
|
||||||
|
N_JOBS=$(grep -c ^processor /proc/cpuinfo)
|
||||||
|
if [[ -z ${N_JOBS} ]]; then
|
||||||
|
# The Linux way didn't work. Try the Mac way.
|
||||||
|
N_JOBS=$(sysctl -n hw.ncpu)
|
||||||
|
fi
|
||||||
|
if [[ -z ${N_JOBS} ]]; then
|
||||||
|
N_JOBS=1
|
||||||
|
echo ""
|
||||||
|
echo "WARNING: Failed to determine the number of CPU cores. "\
|
||||||
|
"Will use --jobs=1 for make."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "make will use ${N_JOBS} concurrent job(s)."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
# Run TensorFlow cmake build.
|
||||||
|
# Clean up, because certain modules, e.g., highwayhash, seem to be sensitive
|
||||||
|
# to state.
|
||||||
|
rm -rf build
|
||||||
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
pushd build
|
||||||
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release ../tensorflow/contrib/cmake
|
cmake -DCMAKE_BUILD_TYPE=Release ../tensorflow/contrib/cmake
|
||||||
make all
|
make --jobs=${N_JOBS} all
|
||||||
|
|
||||||
|
popd
|
||||||
|
55
tensorflow/tools/ci_build/install/install_proto3_from_source.sh
Executable file
55
tensorflow/tools/ci_build/install/install_proto3_from_source.sh
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Install protobuf3 from source.
|
||||||
|
|
||||||
|
# Determine the number of cores, for parallel make.
|
||||||
|
N_JOBS=$(grep -c ^processor /proc/cpuinfo)
|
||||||
|
if [[ -z ${N_JOBS} ]]; then
|
||||||
|
# The Linux way didn't work. Try the Mac way.
|
||||||
|
N_JOBS=$(sysctl -n hw.ncpu)
|
||||||
|
fi
|
||||||
|
if [[ -z ${N_JOBS} ]]; then
|
||||||
|
N_JOBS=1
|
||||||
|
echo ""
|
||||||
|
echo "WARNING: Failed to determine the number of CPU cores. "\
|
||||||
|
"Will use --jobs=1 for make."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "make will use ${N_JOBS} concurrent job(s)."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
# Build and install protobuf.
|
||||||
|
PROTOBUF_VERSION="3.0.0-beta-2"
|
||||||
|
PROTOBUF_DOWNLOAD_DIR="/tmp/protobuf"
|
||||||
|
|
||||||
|
mkdir "${PROTOBUF_DOWNLOAD_DIR}"
|
||||||
|
pushd "${PROTOBUF_DOWNLOAD_DIR}"
|
||||||
|
curl -fSsL -O https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-cpp-$PROTOBUF_VERSION.tar.gz
|
||||||
|
tar zxf protobuf-cpp-$PROTOBUF_VERSION.tar.gz
|
||||||
|
cd protobuf-$PROTOBUF_VERSION
|
||||||
|
./autogen.sh
|
||||||
|
./configure
|
||||||
|
make --jobs=${N_JOBS}
|
||||||
|
sudo make install
|
||||||
|
make clean
|
||||||
|
sudo ldconfig
|
||||||
|
popd
|
||||||
|
rm -rf "${PROTOBUF_DOWNLOAD_DIR}"
|
Loading…
Reference in New Issue
Block a user