Spaces:
Build error
Build error
Upload tf_env_collect.sh
Browse files- tf_env_collect.sh +123 -0
tf_env_collect.sh
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
# Copyright 2017 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 |
+
set -u # Check for undefined variables
|
18 |
+
|
19 |
+
die() {
|
20 |
+
# Print a message and exit with code 1.
|
21 |
+
#
|
22 |
+
# Usage: die <error_message>
|
23 |
+
# e.g., die "Something bad happened."
|
24 |
+
|
25 |
+
echo $@
|
26 |
+
exit 1
|
27 |
+
}
|
28 |
+
|
29 |
+
echo "Collecting system information..."
|
30 |
+
|
31 |
+
OUTPUT_FILE=tf_env.txt
|
32 |
+
python_bin_path=$(which python || which python3 || die "Cannot find Python binary")
|
33 |
+
|
34 |
+
{
|
35 |
+
echo
|
36 |
+
echo "== cat /etc/issue ==============================================="
|
37 |
+
uname -a
|
38 |
+
uname=`uname -s`
|
39 |
+
if [ "$(uname)" == "Darwin" ]; then
|
40 |
+
echo Mac OS X `sw_vers -productVersion`
|
41 |
+
elif [ "$(uname)" == "Linux" ]; then
|
42 |
+
cat /etc/*release | grep VERSION
|
43 |
+
fi
|
44 |
+
|
45 |
+
echo
|
46 |
+
echo '== are we in docker ============================================='
|
47 |
+
num=`cat /proc/1/cgroup | grep docker | wc -l`;
|
48 |
+
if [ $num -ge 1 ]; then
|
49 |
+
echo "Yes"
|
50 |
+
else
|
51 |
+
echo "No"
|
52 |
+
fi
|
53 |
+
|
54 |
+
echo
|
55 |
+
echo '== compiler ====================================================='
|
56 |
+
c++ --version 2>&1
|
57 |
+
|
58 |
+
echo
|
59 |
+
echo '== uname -a ====================================================='
|
60 |
+
uname -a
|
61 |
+
|
62 |
+
echo
|
63 |
+
echo '== check pips ==================================================='
|
64 |
+
pip list 2>&1 | grep "proto\|numpy\|tensorflow"
|
65 |
+
|
66 |
+
|
67 |
+
echo
|
68 |
+
echo '== check for virtualenv ========================================='
|
69 |
+
${python_bin_path} -c "import sys;print(hasattr(sys, \"real_prefix\"))"
|
70 |
+
|
71 |
+
echo
|
72 |
+
echo '== tensorflow import ============================================'
|
73 |
+
} >> ${OUTPUT_FILE}
|
74 |
+
|
75 |
+
cat <<EOF > /tmp/check_tf.py
|
76 |
+
import tensorflow as tf;
|
77 |
+
print("tf.VERSION = %s" % tf.VERSION)
|
78 |
+
print("tf.GIT_VERSION = %s" % tf.GIT_VERSION)
|
79 |
+
print("tf.COMPILER_VERSION = %s" % tf.GIT_VERSION)
|
80 |
+
with tf.Session() as sess:
|
81 |
+
print("Sanity check: %r" % sess.run(tf.constant([1,2,3])[:1]))
|
82 |
+
EOF
|
83 |
+
${python_bin_path} /tmp/check_tf.py 2>&1 >> ${OUTPUT_FILE}
|
84 |
+
|
85 |
+
DEBUG_LD=libs ${python_bin_path} -c "import tensorflow" 2>>${OUTPUT_FILE} > /tmp/loadedlibs
|
86 |
+
|
87 |
+
{
|
88 |
+
grep libcudnn.so /tmp/loadedlibs
|
89 |
+
echo
|
90 |
+
echo '== env =========================================================='
|
91 |
+
if [ -z ${LD_LIBRARY_PATH+x} ]; then
|
92 |
+
echo "LD_LIBRARY_PATH is unset";
|
93 |
+
else
|
94 |
+
echo LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ;
|
95 |
+
fi
|
96 |
+
if [ -z ${DYLD_LIBRARY_PATH+x} ]; then
|
97 |
+
echo "DYLD_LIBRARY_PATH is unset";
|
98 |
+
else
|
99 |
+
echo DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH} ;
|
100 |
+
fi
|
101 |
+
|
102 |
+
|
103 |
+
echo
|
104 |
+
echo '== nvidia-smi ==================================================='
|
105 |
+
nvidia-smi 2>&1
|
106 |
+
|
107 |
+
echo
|
108 |
+
echo '== cuda libs ==================================================='
|
109 |
+
} >> ${OUTPUT_FILE}
|
110 |
+
|
111 |
+
find /usr/local -type f -name 'libcudart*' 2>/dev/null | grep cuda | grep -v "\\.cache" >> ${OUTPUT_FILE}
|
112 |
+
find /usr/local -type f -name 'libudnn*' 2>/dev/null | grep cuda | grep -v "\\.cache" >> ${OUTPUT_FILE}
|
113 |
+
|
114 |
+
# Remove any words with google.
|
115 |
+
mv $OUTPUT_FILE old-$OUTPUT_FILE
|
116 |
+
grep -v -i google old-${OUTPUT_FILE} > $OUTPUT_FILE
|
117 |
+
|
118 |
+
echo "Wrote environment to ${OUTPUT_FILE}. You can review the contents of that file."
|
119 |
+
echo "and use it to populate the fields in the github issue template."
|
120 |
+
echo
|
121 |
+
echo "cat ${OUTPUT_FILE}"
|
122 |
+
echo
|
123 |
+
|