python -m venv venv
source venv/bin/activate
pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple/
Make sure your tf is using GPU:
# python
Python 3.8.3 (default, May 19 2020, 18:47:26)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.2.0'
>>> print(len(tf.config.list_physical_devices('GPU')))
...
[2]
It's extremely slow to use default pypi mirror - need to change to the mirror from Tsinghua.
source venv/bin/activate
mkdir ~/.pip
cd ~/.pip
touch pip.conf
vim pip.conf
put the following to the pip.conf
, save and quit vim:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
then, test out the pypi source has changed by using --verbose
and you can see Looking in indexes
using the new source from Tsinghua:
pip install --verbose scikit-learn
Created temporary directory: /tmp/pip-ephem-wheel-cache-f0xb37qz
Created temporary directory: /tmp/pip-req-tracker-jfcbjoto
Created requirements tracker '/tmp/pip-req-tracker-jfcbjoto'
Created temporary directory: /tmp/pip-install-r_y341o4
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Data has to be uploaded to the /data/User/v3
folder, then run python /data/User/v3/gpu-speed-test-tf2.py