Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU not using gpu on Windows 10 #3658

Closed
lucydjo opened this issue Jul 25, 2019 · 17 comments
Closed

GPU not using gpu on Windows 10 #3658

lucydjo opened this issue Jul 25, 2019 · 17 comments

Comments

@lucydjo
Copy link

lucydjo commented Jul 25, 2019

Hi !

I compiled darknet with vcpkg and build.ps1.
I have modified the Makefile like this before:

GPU=1
CUDNN=1
CUDNN_HALF=0
OPENCV=1
AVX=0
OPENMP=0
LIBSO=0
ZED_CAMERA=0

Unfortunately my CPU is used instead of the GPU.

darknet.exe detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights road.mp4 -gpus 0

I have the impression that the modification of the Makefile didn't change anything. Do you have a solution? Have I forgotten something?

Thx !

@sholalkere
Copy link

I'm having the same issue, torch can use cuda and everything but for some reason it darknet doesnt use it

@cenit
Copy link
Collaborator

cenit commented Jul 26, 2019

build.ps1 triggers the CMake build, which should detect gpu and cuda automatically without requiring any modification at all. Can you please post some configuration and some build logs? Please restart from a clean repository if possible, without any modification.

@lucydjo
Copy link
Author

lucydjo commented Jul 26, 2019

I didn't know what files you were talking about, so I created a git with all the files after compilation.

https://github.com/lucaspojo/darknet-yolo-again

EDIT :

Console log : https://gist.github.com/lucaspojo/d207a2743bae3b59334f530c2e5f1f82
CmakeCache : https://gist.github.com/lucaspojo/4f577e509e9ce5433c4f92e246f78229

Thx !

@cenit
Copy link
Collaborator

cenit commented Jul 26, 2019

our .gitignore is made so no build artifacts can be pushed to a repository. From a quick glance there's nothing more in your repo than in a clean repo.

What I mean is just copy-paste the messages that appear on console after you launch build.ps1, and also the CMakeCache.txt file that is created inside the build_win_release folder.

Again, please launch build from a clean repository folder and do not modify any code

@lucydjo
Copy link
Author

lucydjo commented Jul 26, 2019

Console log : https://gist.github.com/lucaspojo/d207a2743bae3b59334f530c2e5f1f82
CmakeCache : https://gist.github.com/lucaspojo/4f577e509e9ce5433c4f92e246f78229

I did start the build again with a new repo. I started from scratch.

@cenit
Copy link
Collaborator

cenit commented Jul 26, 2019

Your compiler version requires at least CUDA 10.1, if I remember exactly.
Could you please update CUDA to 10.1 and retry?

@cenit
Copy link
Collaborator

cenit commented Jul 26, 2019

-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND

these lines are key to understand. Visual Studio reports back that there's no CUDA integration installed. Since you have cuda installed (-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0 (found suitable exact version "10.0")), this just means that your cuda version is not properly installed or just "too old"

@lucydjo
Copy link
Author

lucydjo commented Jul 26, 2019

I changed the version of cuda to 10.1. I have a new error. (compilation of zero at each attempt).

CMake Error at C:/Users/lpjo/Desktop/vcpkg-master/installed/x64-windows/share/opencv/OpenCVConfig.cmake:108 (message):
OpenCV static library was compiled with CUDA 10.0 support. Please, use the
same version or rebuild OpenCV with CUDA 10.1

I tried to upgrade from version 3.0 to 4.1 of openCV but the error remains the same.
I'll try to compile opencv myself

@lucydjo
Copy link
Author

lucydjo commented Jul 26, 2019

Idk how build opencv.

After several attempts by following instructions find on the opencv website and other forum. I can't do it.

I think I'm going to have to go back to linux! Too bad

@cenit
Copy link
Collaborator

cenit commented Jul 26, 2019

nope, don't worry
to build opencv for windows, please follow the vcpkg section of our readme.

@lucydjo
Copy link
Author

lucydjo commented Jul 27, 2019

I made another attempt with Cuda 10.1, but the GPU still hasn't used.

CMakeCache : https://gist.github.com/lucaspojo/d5068fd6552c13331f9f9ce82edfb94b

I have the same :

-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND

@cenit
Copy link
Collaborator

cenit commented Jul 27, 2019

Is the nvidia installer giving you any problem? Something bad must be going on there. The message indicates that for VS there is no cuda installed!
If you open visual studio, can you create a new empty cuda project?

@lucydjo
Copy link
Author

lucydjo commented Jul 27, 2019

Nvidia Cuda does not appear in the list when I want to create a new project.

Nvcc --version return :

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:26_Pacific_Standard_Time_2019
Cuda compilation tools, release 10.1, V10.1.105

did I forget something?

@lucydjo
Copy link
Author

lucydjo commented Jul 29, 2019

I found a solution by accident. I installed Cuda 8, restarted my PC, reinstalled cuda 10.1, launched GeforceExperience to update the graphics driver, restarted the compilation, and everything works!

I hope it will help someone else.

@lucydjo lucydjo closed this as completed Jul 29, 2019
@cenit
Copy link
Collaborator

cenit commented Jul 29, 2019

Ok good. Glad that you were able to fix your CUDA setup :)

@cenit
Copy link
Collaborator

cenit commented Jul 29, 2019

In case you find this problem again, we now have also another workaround that might help you

  1. pull the latest master
  2. edit build.ps1 and write "true" next to $use_ninja at the very beginning
  3. make sure you have ninja-build installed
  4. try to launch .\build.ps1 again.

This procedure does not need VS at all, just the compiler (Build Tools are enough). It might work also in your previous "broken" CUDA status

@Monkey1GIt
Copy link

My environment: Win10 + cuda 10.1 + cuddn + Visual Studio 2019.

I think I found the reason, this is problem between the cuda and Visual Studio. Because the cuda should be installed after the Visual Studio. When cuda is installed there will be a item for finding whether you have installed Visual Studio before, if you did then cuda adapting the environment, if you didn't you can ignore. Like #2971 (comment)

You can reinstall the cuda to solve the problem. There is a way to test if cuda is satisfied to Visual Studio:

open Visual Studio 2019 > New > New item

you will find a item named cuda 10.1 Runtime, like this:

Snipaste_2020-02-23_01-52-06

The cmake will like this:

Snipaste_2020-02-23_01-32-18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants