Expecting to run setup.py and have it compile dlib with CUDA support and make it accessible in Python.
I was able to successfully compile dlib with CUDA support when I used the command:
cmake -G "Visual Studio 14 2015 Win64" -T host=x64 ..
Below is the relevant output letting me know that it was successful.
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1 (found suitable version "9.1", minimum required is "7.5")
-- Looking for cuDNN install...
-- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/lib/x64/cudnn.lib
-- Building a CUDA test project to see if your compiler is compatible with CUDA...
-- Checking if you have the right version of cuDNN installed.
-- Enabling CUDA support for dlib. DLIB WILL USE CUDA
According to the readme file, in order to use Python, I need to run the setup.py file. I issued
python setup.py install
and I get this:
Building extension for Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Photo\Documents\GitHub\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Photo\Documents\GitHub\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe -G Visual Studio 14 2015 Win64 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Photo\Documents\GitHub\dlib\build\lib.win-amd64-3.6 -A x64'
-- Selecting Windows SDK version to target Windows 10.0.17134.
CMake Error in CMakeLists.txt:
GeneratorVisual Studio 14 2015 Win64
does not support platform specification, but platform
x64
was specified.
(Was previously using Visual Studio 2017 which did not work)
Uninstalled Visual Studio 2017
Installed Visual Studio 2015
Uninstalled CMAKE
Reinstalled CMAKE
Did not touch CUDA installation.
Added C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin to my path (contains compiler cl.exe.)
Opened
VS2015 x64 Native Tools Command Prompt
in Administrative Mode
and issued:
python setup.py install
I also did
python setup.py -G "Visual Studio 14 2015 Win64" install
without any success
What happens when you run: python setup.py -G "Visual Studio 14 2015" install --clean?
Here is my output. Note: I added the Win64 part. Without it, I received an error that the C,CXX compilers could not be found.
C:\Users\Photo\Documents\GitHub\dlib>python setup.py -G "Visual Studio 14 2015 Win64" install --clean
running install
running bdist_egg
running egg_info
writing dlib.egg-info\PKG-INFO
writing dependency_links to dlib.egg-info\dependency_links.txt
writing top-level names to dlib.egg-info\top_level.txt
package init file 'dlib__init__.py' not found (or not a regular file)
reading manifest file 'dlib.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'dlib.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
Removing old directory C:\Users\Photo\Documents\GitHub\dlib\build\temp.win-amd64-3.6Release
Building extension for Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Photo\Documents\GitHub\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Photo\Documents\GitHub\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe -G Visual Studio 14 2015 Win64 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Photo\Documents\GitHub\dlib\build\lib.win-amd64-3.6 -A x64'
-- Selecting Windows SDK version to target Windows 10.0.17134.
CMake Error in CMakeLists.txt:
GeneratorVisual Studio 14 2015 Win64
does not support platform specification, but platform
x64
was specified.
-- Configuring incomplete, errors occurred!
I think you just haven鈥檛 installed all of visual studio.
Thank you!
I re-installed Visual Studio 2015 in the python setup.py install --clean ran to completion. Is there another step to have the previous version of dlib replaced? That version was installed via conda.
Also,
How can I tell that Python is indeed using the version that uses CUDA?
I'm running a training session and according to my NVIDIA GPU Activity monitor, only 3 items are listed:
logonui.exe
microsoft.photos.exe
MicrosoftEdge.exe
Thank you.
Adrian
There are no other steps other than having cmake and a working compiler installed.
http://dlib.net/faq.html#IcompileddlibsPythoninterfacewithCUDAenabled,whyisntitusingCUDA
Thanks again.
I have dlib.DLIB_USE_CUDA = True.
This issue seems different, but I would like to add for reference that I got an almost identical error message when the Visual Studio compiler was _not_ installed. As the error message told about platform specification it was quite difficult to find out the real cause.
CMake Error in CMakeLists.txt:
GeneratorNMake
does not support platform specification, but platformx64
...
Most helpful comment
This issue seems different, but I would like to add for reference that I got an almost identical error message when the Visual Studio compiler was _not_ installed. As the error message told about platform specification it was quite difficult to find out the real cause.