INSTALL CUDA START TO FINISH EASY INSTRUCTIONS

Documentation, usage tips and configuration guides for GCV scripts published by the community users.

INSTALL CUDA START TO FINISH EASY INSTRUCTIONS

Postby lordofkillz » Sun Mar 28, 2021 8:58 pm

FIRST OF ALL I WOULD LIKE TO THANK JAJ FOR HIS ORGINAL INSTRUCTIONS ON SETTING UP CUDA. I WOULD ALSO LKE TO THANK USER101,Scachi,Taylor310,CWIGGY78 AND INTERVISION FOR PROVIDING ADDTIONAL INSTRUCTIONS AND INPUT

If this is your first time, skip steps 1, 2 and 3
1.Download Ccleaner https://www.ccleaner.com/ccleaner/download.

2.Uninstall python on your system. This includes the Python 3.8 environment that most will be using only for Gtuner.

3. Uninstall Gtuner. This will ensure all reminates of python have been deleted. Run Ccleaner

4. update Windows

SET-UP: FIRST TIME INSTALL START HERE

To ensure this works do everything that I say to do. As long as you can follow step by step instructions then this will work.

Before you begin update Windows and disable your antivirus or any program that can block paths.

This is for windows only, and you will need a cuda capable graphics card. To check down load GPUZ
https://www.techpowerup.com/gpuz/.

To ensure everything installs correctly DO NOT USE 7-ZIP,WINWAR OR ANY OTHER PROGRAM JUST USE THE BUILT IN EXTRACTOR FROM WINDOWS. DO NOT change any slashes or any part of the code other than YOUR_USER.

1. Download and install https://visualstudio.microsoft.com/downloads/ This part is very important. In the installer when the workloads screen pops up, you must check Python Development, and Desktop development with C++
.
Image

2. Download and install https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4-win64-x64.msi ENSURE Do not add CMake to the system path remains checked.

3. Download and install https://www.anaconda.com/products/individual 64 bit. ENSURE Install for Just Me.
Image
In the installer, you must select Register Anaconda as my default Python. DO NOT select the other option adding Anaconda to path.

4. Open Anaconda Prompt (anaconda3) and type in (or copy/paste):

(a)
Code: Select all
conda create -n gpu anaconda python=3.8


This will create the new environment called anaconda prompt (GPU). Wait for that to finish, and you can close the prompt for now.

5. Now install cuda 11.1 click this link and download for windows/X86_64/-10./-exe local https://developer.nvidia.com/cuda-11.1.1-download-archive.
Image

6.Download cuDNN v8.0.4 (for CUDA v11.1) https://developer.nvidia.com/rdp/cudnn-archive You'll need to sign up for an Nvidia developer account to gain access to the download. It's quick and free to sign up.
ENSURE you only get this exact archived version, the description needs to say Download cuDNN v8.0.4 (September 28th, 2020), for CUDA 11.1. Then you click cuDNN Library for Windows [x86]
Image


*Throughout the tutorial be sure to swap out YOUR_USER with your own user path.

7. Once the zip file is downloaded you want to simply extract the contents into your CUDA installation folder, found at the path:

(b)
Code: Select all
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1


DO NOT USE 7-zip or any other extractor programs it will create extra folders. Windows has a built in extractor.

8. Download opencv 4.4.0. https://github.com/opencv/opencv/archive/4.4.0.zip.

9. Download opencv contrib 4.4.0. https://github.com/opencv/opencv_contrib/archive/4.4.0.zip.

10.Extract the contents of both files to this path location:

(c)
Code: Select all
C:\Users\YOUR_USER\anaconda3\envs\gpu\lib\

Here is an example of how it s
Code: Select all
 
hould look with both folders extracted.
Image



BUILDING THE FILES


So the files and folders are all set up. Now we need to build the Python 3.8 bindings for a CUDA supported opencv.

We need to be sure that the CUDA system variables have been added properly during installation. Type
(EDIT THE SYSTEM ENVIRONMENT VARIABLES) into your search bar, open 'Environment Variables' In the pop up the 'System Variables' box on the bottom search for the following system variables:
Variable                        Value
Code: Select all
CUDA_HOME
         
Code: Select all
  C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1

Code: Select all
CUDA_PATH 
       
Code: Select all
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1

Code: Select all
CUDA_PATH_V11_1 
 
Code: Select all
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1 


figure1
Image

If they are not there you'll have to add them. Example how to add: Click in box at bottom "click NEW” top line(Variable) CUDA_HOME. second line (value) C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1

Next, double click Path and check to make sure that it contains the paths bellow:

(d-1)
Code: Select all
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin

(d-2)
Code: Select all
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\libnvvp

figure2 Image


They should be there but if not, click New and add them in.

11.You'll have to set some variables for the next steps. Assuming you followed all the steps exactly, your paths will match this one and you can use the following.

open start menu and select anaconda prompt (GPU) as admin

Copy/paste these one line at a time and hit enter after each be sure to swap YOUR_USER

(e)
Code: Select all
set "openCvSource=C:\Users\YOUR_USER\anaconda3\envs\gpu\lib\opencv-4.4.0"


(f)
Code: Select all
set "openCVExtraModules=C:\Users\YOUR_USER\anaconda3\envs\gpu\lib\opencv_contrib-4.4.0\modules"


(g)
Code: Select all
set "openCvBuild=C:\Users\YOUR_USER\anaconda3\envs\gpu\lib\opencv-4.4.0\build"


(h)
Code: Select all
set "buildType=Release"


(i)
Code: Select all
set "generator=Visual Studio 16 2019"


(j)
Code: Select all
set "pathToAnaconda=C:/Users/YOUR_USER/anaconda3/envs/gpu"


(k)
Code: Select all
set "pyVer=38"



12. Ok, variables are set copy/paste this into anacodna prompt (GPU) as admin.

(l)
Code: Select all
"C:\Program Files\CMake\bin\cmake.exe" -B"%openCvBuild%/" -H"%openCvSource%/" -G"%generator%" -DCMAKE_BUILD_TYPE=%buildType% -DOPENCV_EXTRA_MODULES_PATH="%openCVExtraModules%/" ^ -DINSTALL_TESTS=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON ^ -DBUILD_opencv_world=ON ^ -DWITH_CUDA=ON -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1" -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DCUDA_ARCH_PTX=8.0 -DWITH_NVCUVID=ON ^ -DWITH_OPENGL=ON ^ -DWITH_MFX=ON -DBUILD_opencv_python3=ON -DPYTHON3_INCLUDE_DIR=%pathToAnaconda%/include -DPYTHON3_LIBRARY=%pathToAnaconda%/libs/python%pyVer%.lib -DPYTHON3_EXECUTABLE=%pathToAnaconda%/python.exe -DPYTHON3_NUMPY_INCLUDE_DIRS=%pathToAnaconda%/lib/site-packages/numpy/core/include -DPYTHON3_PACKAGES_PATH=%pathToAnaconda%/Lib/site-packages/ -DOPENCV_SKIP_PYTHON_LOADER=ON


13. Once the cmake configuration is done, it's time to build the files.
Assuming you had no errors while configurating and generating the files, you can now copy/paste in this command:

(m)
Code: Select all
"C:\Program Files\CMake\bin\cmake.exe" --build %openCvBuild% --target INSTALL --config Release


This is going to take around 3-4 hours to build the python bindings, depending on your hardware. You will see hundreds of warnings if you watch the command prompt while building, so I'd suggest looking away.

14. Type (EDIT THE SYSTEM ENVIRONMENT VARIABLES) into your search bar, and open 'Environment Variables' from the pop up. Scroll down and Double click PATH in SYSTEM VARIABLES.. and then click NEW and u can copy these one at a time. Ensure you chanage YOUR_USER.

(n-1)
Code: Select all
C:\Users\YOUR_USER\anaconda3\envs\gpu\lib

(n-2)
Code: Select all
C:\Users\YOUR_USER\anaconda3\envs\gpu\Library

(n-3)
Code: Select all
C:\Users\YOUR_USER\anaconda3\envs\gpu\Library\bin

(n-4)
Code: Select all
C:\Users\YOUR_USER\anaconda3\envs\gpu\lib\opencv-4.4.0\build\lib\python3\Release

(n-5)
Code: Select all
C:\Users\YOUR_USER\anaconda3\envs\gpu\lib\opencv-4.4.0\build\install\x64\vc16\bin


Figure4 Image

15.Open start menu and select anaconda prompt (GPU) as admin and copy and paste these 1 at a time pressing enter after each one.

(o)
Code: Select all
python

(p)
Code: Select all
import cv2 

(q)
Code: Select all
cv2.cuda.getCudaEnabledDeviceCount()


If u get a 1 your are good! Gratz.
If u get a 0 well you must start over.(because you didn't follow directions exactly).

16. If its good open start menu find anaconda Navigator in programs. Select environments
select (GPU), at the bottom select (Clone).name it GPU2. This will take about 10-15 min. let it finish.

figure5 Image

Install GTUNER IV NOW if you need to. https://www.consoletuner.com/downloads/
open Gtuner and navigate to tools/preferences/computer vision/ click browse and navigate to.
Code: Select all
%userprofile%\anaconda3\envs\gpu
select folder make sure u got all green checks in gtuner.

lets create a Working directory on the left in Gtuner just navigate to a place doesn't matter, make a new folder called e.g.(computer vision) click on it and in the top right click the “little folder to lock it in” see figure6 at bottom.

GTUNER SET-UP[/color][/size][/u][/b]

Go to computer vision "bottom tab", at the top click add video input (the little + symbol)
1.Select Video capture Device if your using a capture card. Then select detect at the bottom type CAP_PROP_FPS=80 to get more FPS.
2. Select Display capture if are you using PS remote play or Xbox companion app. detect display. It will be the display your capture is playing on.
Go to online resources and download both the python script(it will say download) and the GPC script (the one u drag and drop) you must now, select the python script from the left side in your working directory and hit the green arrow at the top of Gtuner.
figure6 Image




come join us USERVISION Discord. https://discord.gg/WP4F5ptU5e
Attachments
commands.txt
(2.71 KiB) Downloaded 183 times
Last edited by lordofkillz on Mon May 24, 2021 12:36 am, edited 8 times in total.
User avatar
lordofkillz
Sergeant
Sergeant
 
Posts: 6
Joined: Sat Dec 26, 2020 2:10 am

Re: USERVISION/PRO INSTALL CUDA START TO FINISH

Postby Julien57 » Wed May 05, 2021 9:00 am

Hello, I installed all this little world has successfully passed the checkpoints already, it's cool, my question is to use uservision. I'm here user 101 video without doing anything else or, have to do a particular manipulation? That's thank you and great clean and well explained tutorial
User avatar
Julien57
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Wed Dec 04, 2019 5:03 pm

Re: USERVISION/PRO INSTALL CUDA START TO FINISH

Postby evo0ne » Sat May 08, 2021 10:16 pm

just a quick question,

in item "t" below, you have the following pytorch install arguments set:

"conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c -f pytorch"

i have run this and get the following error:

"conda-script.py install: error: argument -c/--channel: expected one argument"

now looking at the available arguments for conda install, the "-f" argument is not listed. is this a mistake or did i do something wrong in this process?

thanks
User avatar
evo0ne
Corporal
Corporal
 
Posts: 4
Joined: Tue Jan 08, 2019 11:12 pm

Re: USERVISION/PRO INSTALL CUDA START TO FINISH

Postby Scachi » Sat May 08, 2021 10:25 pm

this works:
Code: Select all
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch --force-reinstall
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 2861
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: USERVISION/PRO INSTALL CUDA START TO FINISH

Postby evo0ne » Sat May 08, 2021 11:16 pm

Wow that was a fast reply, much appreciation. you are correct, no adverse affects from leaving the -f flag out completely on a new installation, although as you mentioned, for someone that has a previous install the -f flag at the end may be needed? not sure.

thank you so much.
User avatar
evo0ne
Corporal
Corporal
 
Posts: 4
Joined: Tue Jan 08, 2019 11:12 pm

Re: INSTALL CUDA START TO FINISH EASY INSTRUCTIONS

Postby lavarsicious » Thu Jun 10, 2021 7:12 am

I recently ran through these setup instructions on multiple computers with success.

A very big thank you to @lordofkillz and any other contributors as this was immeasurably helpful.
lavarsicious
Sergeant
Sergeant
 
Posts: 7
Joined: Mon Dec 31, 2018 4:43 pm

Re: INSTALL CUDA START TO FINISH EASY INSTRUCTIONS

Postby antithesis » Thu Jun 10, 2021 10:14 pm

Thank you for the detailed instructions, but there’s no explanation for why CUDA said a being installed.

What is the purpose of installing CUDA? Is it to improve FPS in Gtuner IV while using PS Remote Play or Xbox app for video capture into Computer Vision?
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1867
Joined: Sat May 28, 2016 10:45 pm

Re: INSTALL CUDA START TO FINISH EASY INSTRUCTIONS

Postby lordofkillz » Thu Jun 10, 2021 10:18 pm

Yeah it’s bunch of reasons
User avatar
lordofkillz
Sergeant
Sergeant
 
Posts: 6
Joined: Sat Dec 26, 2020 2:10 am

Re: INSTALL CUDA START TO FINISH EASY INSTRUCTIONS

Postby lavarsicious » Fri Jun 11, 2021 3:35 pm

antithesis wrote:What is the purpose of installing CUDA? Is it to improve FPS in Gtuner IV while using PS Remote Play or Xbox app for video capture into Computer Vision?


For me it was to improve the cv frame rate. I have the console hdmi plugged into an Elgato HD60 Pro for decoding and a GTX1080 accessible now in GTuner Python land.

The performance gain was immediately clear as the frame rate went from about 4-15 depending on the complexity of the operation to about 55-60 no sweat.
lavarsicious
Sergeant
Sergeant
 
Posts: 7
Joined: Mon Dec 31, 2018 4:43 pm

Re: INSTALL CUDA START TO FINISH EASY INSTRUCTIONS

Postby antithesis » Sat Jun 12, 2021 11:50 am

Gotcha. Thanks for the explanation :)
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1867
Joined: Sat May 28, 2016 10:45 pm


Return to User's Script Documentation

Who is online

Users browsing this forum: No registered users and 9 guests