xref: /aosp_15_r20/external/tensorflow/tensorflow/tools/ci_build/linux/cmake/run.sh (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1#!/usr/bin/env bash
2# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16# ==============================================================================
17
18set -e
19set -x
20
21# Run TensorFlow cmake build.
22# Clean up, because certain modules, e.g., highwayhash, seem to be sensitive
23# to state.
24rm -rf build
25
26mkdir -p build
27pushd build
28
29cmake -DCMAKE_BUILD_TYPE=Release ../tensorflow/contrib/cmake
30# When building do not use all CPUs due to jobs running out of memory.
31# TODO(gunan): Figure out why we run out of memory in large GCE instances.
32make --jobs 20 tf_python_build_pip_package
33
34virtualenv cmake_test --system-site-packages
35source cmake_test/bin/activate
36
37# For older versions of PIP, remove the ABI tag.
38# TODO(gunan) get rid of this part once pip is upgraded on all test machines.
39WHEEL_FILE_PATH=`ls tf_python/dist/*tensorflow*.whl`
40FIXED_WHEEL_PATH=`echo $WHEEL_FILE_PATH | sed -e s/cp27mu/none/`
41mv $WHEEL_FILE_PATH $FIXED_WHEEL_PATH
42
43# Install the pip package we just built.
44pip install --upgrade $FIXED_WHEEL_PATH
45
46# Run all tests.
47ctest -C Release --output-on-failure -j
48
49# Finalize and go back to the initial directory.
50deactivate
51popd
52