forked from tensorflow/quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_all_wheels.sh
executable file
·71 lines (57 loc) · 2.63 KB
/
build_all_wheels.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Copyright 2020 The TensorFlow Quantum 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.
# ==============================================================================
# Build python wheels for 3.6 and 3.7 and store them in wheels/
cd ..
git clone https://github.com/tensorflow/custom-op.git
cd custom-op
git checkout 994dc6bdd5b7c0c0c0ffb55bb0ac013d9d9268cd
cd ..
# Copy the toolchain config over from custom-op.
# Upgrade existing 3.6 pip.
python3 -m pip install --upgrade pip
python3 -m pip install tensorflow==2.1.0
cp -r custom-op/third_party/toolchains quantum/third_party/
cd /quantum
echo "Y\n" | ./configure.sh
bazel build -c opt --crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.0:toolchain \
--cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" --cxxopt="-msse2" --cxxopt="-msse3" --cxxopt="-msse4" release:build_pip_package
bazel-bin/release/build_pip_package /tmp/tensorflow_quantum/
mkdir wheels
cp /tmp/tensorflow_quantum/tensorflow_quantum-0.2.0-cp36-cp36m-linux_x86_64.whl wheels/tensorflow_quantum-0.2.0-cp36-cp36m-linux_x86_64.whl
bazel clean
# Now build the 3.7 wheel.
cd /tmp
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5rc1.tar.xz
tar -xf Python-3.7.5rc1.tar.xz
cd Python-3.7.5rc1
./configure
make -j2 build_all
sudo make altinstall
cd /quantum
python3.7 -m pip install --upgrade pip setuptools
python3.7 -m pip install tensorflow==2.1.0
sed -i 's/python3/python3.7/g' configure.sh
sed -i 's/python3/python3.7/g' release/build_pip_package.sh
echo "Y\n" | ./configure.sh
bazel build -c opt --crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010-nvcc-cuda10.0:toolchain \
--cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" --cxxopt="-msse2" --cxxopt="-msse3" --cxxopt="-msse4" release:build_pip_package
bazel-bin/release/build_pip_package /tmp/tensorflow_quantum/
cp /tmp/tensorflow_quantum/tensorflow_quantum-0.2.0-cp37-cp37m-linux_x86_64.whl wheels/tensorflow_quantum-0.2.0-cp37-cp37m-linux_x86_64.whl
bazel clean
sed -i 's/python3.7/python3/g' configure.sh
sed -i 's/python3.7/python3/g' release/build_pip_package.sh
rm -r /quantum/third_party/toolchains
exit