-
Notifications
You must be signed in to change notification settings - Fork 2
/
prepare_install_tensorflow.txt
50 lines (41 loc) · 2.64 KB
/
prepare_install_tensorflow.txt
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
# Instructions for creating a tensorflow environment with GPU support:
# Check if GPU driver and CUDA is installed (you have to install it if not):
nvidia-smi
# Expected output (Nvidia Driver and CUDA should be installed already):
Fri Apr 28 14:44:14 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.182.03 Driver Version: 470.182.03 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Quadro RTX 6000 Off | 00000000:B3:00.0 Off | Off |
| 33% 28C P8 5W / 260W | 73MiB / 24211MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1404 G /usr/lib/xorg/Xorg 64MiB |
| 0 N/A N/A 1727 G /usr/bin/gnome-shell 6MiB |
+-----------------------------------------------------------------------------+
# Create environment with miniconda:
conda create --name tf python=3.9
# Activate environment:
conda deactivate
conda activate tf
# Install CUDA Toolkit and cuDNN (versions for Tensorflow 2.9.1):
conda install -c conda-forge cudatoolkit==11.2
pip install nvidia-cudnn-cu11==8.8.1.3
# Add environment variables to environment initialization:
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo 'CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
# Load environment variables:
conda deactivate
conda activate tf
# Install all required packages:
pip install -r requirements.txt