Python with Cuda Support
Compile tensorflow 2.1 in old CPU without AVX support Requirements:
- tensorflow 2.1.0
- python 3.7
- MSVC 2017
- Bazel 0.27.1
- cuDNN 7.4.2.24
- CUDA 10.0.130 and replace C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cudafe++.exe from CUDA 10.1 update 1(check only to install nvcc)
- Edit .bazelrc file on line 131 and 132 change -std=c++14 to /std:c++14
- Run: python configure.py; Make sure set XLA JIT support = no and Please set to unknown option like /arch:SSE42
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout r2.1
cmd admin:
python configure.py
bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true --copt=-nvcc_options=disable-warnings //tensorflow/tools/pip_package:build_pip_package
bazel-bin\tensorflow\tools\pip_package\build_pip_package C:/Users/LENOVO/Downloads/tmp/tensorflow_pkg
pip install package_name
Compile tensorflow 2.0 in old CPU without AVX support Requirements:
- tensorflow_gpu-2.0.0
- python 3.7
- MSVC 2017
- Bazel 0.26.1
- cuDNN 7.4.2.24 (on ubuntu not tested in windows use v7.6.5)
- CUDA 10.0.130 and replace C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cudafe++.exe from CUDA 10.1 update 1(check only to install nvcc)
- Make sure avoid default set extension /arch:AVX. Please set to unknown option like /arch:SSE4
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout r2.0
cmd admin:
python configure.py
XLA JIT support : no
/arch:SSE4
bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true --copt=-nvcc_options=disable-warnings //tensorflow/tools/pip_package:build_pip_package
bazel-bin\tensorflow\tools\pip_package\build_pip_package C:/Users/LENOVO/Downloads/tmp/tensorflow_pkg
pip install package_name
Installation of keras gpu :
conda install python=3.6
conda install keras-gpu
test if GPU was connected to the tensorflow
import tensorflow as tf
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
To show Existing GPU, in the Command Window of Matlab
gpuDeviceCount
gpuDevice(1)
To use GPUArray
g = gpuDevice(1);
M = gpuArray(magic(4));
M_exists = existsOnGPU(M)