• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17set -e
18
19
20# Determine the number of cores, for parallel make.
21N_JOBS=$(grep -c ^processor /proc/cpuinfo)
22if [[ -z ${N_JOBS} ]]; then
23  # The Linux way didn't work. Try the Mac way.
24  N_JOBS=$(sysctl -n hw.ncpu)
25fi
26if [[ -z ${N_JOBS} ]]; then
27  N_JOBS=1
28  echo ""
29  echo "WARNING: Failed to determine the number of CPU cores. "\
30"Will use --jobs=1 for make."
31fi
32
33echo ""
34echo "make will use ${N_JOBS} concurrent job(s)."
35echo ""
36
37
38# Run TensorFlow cmake build.
39# Clean up, because certain modules, e.g., highwayhash, seem to be sensitive
40# to state.
41rm -rf build
42
43mkdir -p build
44pushd build
45
46cmake -DCMAKE_BUILD_TYPE=Release ../tensorflow/contrib/cmake
47make --jobs=${N_JOBS} all
48
49popd
50