How to Install Tensorflow With Cuda in GPU Windows with Git Bash
- install Anaconda and Git Bash
- create environment with python 3.10.13
- Setup Conda in Git Bash
dell@AHMADROIHAN-DELL MINGW64 /e/Program-Files/anaconda3/etc/profile.d
$ echo ". ${PWD}/conda.sh" >> ~/.bashrc
dell@AHMADROIHAN-DELL MINGW64 /e/Program-Files/anaconda3/etc/profile.d
$ echo ". '${PWD}'/conda.sh" >> ~/.bashrc
$ echo ". ${PWD}/conda.sh" >> ~/.bashrc
dell@AHMADROIHAN-DELL MINGW64 /e/Program-Files/anaconda3/etc/profile.d
$ echo ". '${PWD}'/conda.sh" >> ~/.bashrc
- Set up Git Bash to always run as Administrator
- Click the Windows Start button and type bash.
- Right-click the found link and select Open file location.
- Right-click the menu shortcut and select Properties.
- On the Compatibility tab select Run this program as administrator.
- Reopen Git Bash in other project directory and activate environment
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ conda activate p31013
(p31013)
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ conda install -c conda-forge cudatoolkit cudnn
$ conda activate p31013
(p31013)
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ conda install -c conda-forge cudatoolkit cudnn
.................
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ pip install "tensorflow<2.11"
.................
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
2023-12-28 06:46:05.405858: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-12-28 06:46:07.065071: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1616] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 1654 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3050 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6
tf.Tensor(1.7581177, shape=(), dtype=float32)
(p31013)
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
$ python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
2023-12-28 06:46:05.405858: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-12-28 06:46:07.065071: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1616] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 1654 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3050 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6
tf.Tensor(1.7581177, shape=(), dtype=float32)
(p31013)
dell@AHMADROIHAN-DELL MINGW64 /f/PYTHON/gpu
$ python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
No comments:
Post a Comment