-
Notifications
You must be signed in to change notification settings - Fork 137
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
Compiling scs-gpu from source on Python, using Windows. #186
Comments
I don't see much in that error to tell us what's happening. Can you post a little more to take a look at. Also, the windows special case for gpu is handled here: https://github.com/bodono/scs-python/blob/master/setup.py#L206 First, is the 'CUDA_PATH' env variable set? And if so you should make sure that the include and lib directories are as SCS expect (otherwise you can edit the code to point to the right place, if it's a general fix I would be happy to accept a PR). |
By the way, it is often the case that the GPU version is not actually faster than the vanilla direct version, so bear that in mind. |
So, the dirty way to fix this was to point directly to an environment install of CUDA, as CUDA_PATH otherwise points to the regular Windows install. I don't know if there's a way to make it work otherwise, because both Now, trying to solve with I assume this is still related to the compiling process, but I can move it to a new issue if needed. I will definitely benchmark CPU and GPU performances once it is working, I'll keep you updated. |
It sounds like you got the paths right for the install, so you probably need to add the paths where the cuda binaries live to the PATH variable (or whatever the equivalent is for windows), eg
|
That did the trick ! I added The solver now works on some problems, but crashes on others :
I recursively try to solve problems of varying complexity, and using data of varying sizes, so I would understand if GPU support is more fit towards solving single, larger problems. |
Great, glad it's (kind of) working for you! It sounds like the solver has a GPU memory leak if this is happening after some number of solves, is it easy enough to send me the script that runs this? |
Sure ! The script itself involves several modules, but the actual problem solving part is as follows :
That function is then called as part of another module that loops over CSV files containing data. |
I've profiled the code quite deeply now and I don't see a memory leak anywhere. Does it always crash on the same problem? Does it crash if the problem is called outside of the loop? |
Also, could you |
Here's the full output of
Running problems independently, out of the loop, seems to prevent such crashes. While looking at the verbose output in details, I found out that it doesn't look like the problems are actually getting solved, some metrics stay the same even if I push the maximum iterations to run for a while, and CVXPY always end up finding a solution that is "unbounded".
Or, on some problems :
The problems that result in "unbonded" rather than just "inaccurate" are also noticeably slower to reach the same number of iterations. |
Thanks for sending this. I ran your code for about a week continuously on randomly generated data on my own GPU machine and was unable to reproduce this. However, examining your output it looks like the data types are getting confused, eg the GPU is expecting a particular integer or floating point width and it's getting passed something different. For one of these problems instances where it takes a very long time to solve could you pass the argument |
I'll try running it with different data on my side, and see how it goes ! I'll send the tmp file by mail, I let it run for 10 000 iterations to shorten wait time. |
Running the data you sent me using my GPU I get:
In other words it's clearly different to what you're getting and appears to be working correctly. My guess is that something is wrong in the types we assume that CUDA is using, but only for some versions of CUDA or some GPUs, see similar issue here: bodono/scs-python#54. I would recommend you stick to the cpu direct version for now. |
Specifications
Description
I am trying to make use of a GPU to speed up SCS, but unfortunately the GPU-equipped machine I have access to is shared, and I have to install it on Windows.
It seems that Visual Studio C++ and Windows 10 SDK are required to compile, but apparently that doesn't work.
The only answer I could find related to that suggested removing Visual Studio entirely which, unsurprisingly, doesn't work.
Building from source without any options (
python setup.py install
) seems to work, so the issue might be GPU related.How to reproduce
As instructed in the docs :
Additional information
I understand that SCS probably hasn't been tested or used on Windows that much, especially for GPU uses. I am asking in case someone did manage to compile from source, with GPU, outside of Linux.
The environment I'm using is Python 3.8.12 with
cudatoolkit 10.1.243
andcudnn 7.6.5
, installed as part oftensorflow-gpu
.CUDA works fine with ML uses in that environment.
Output
The entire output is (very) verbose, but here's the final part :
error: Command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYTHON -DCTRLC=1 -DCOPYAMATRIX -DGPU_TRANSPOSE_MAT=1 -DPY_GPU -DINDIRECT=1 -Iscs/include -Iscs/linsys -IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5/include -Iscs/linsys/gpu/ -Iscs/linsys/gpu/indirect -IC:\Users\M T\anaconda3\envs\scs_gpu\lib\site-packages\numpy\core\include -IC:\Users\M T\anaconda3\envs\scs_gpu\include -IC:\Users\M T\anaconda3\envs\scs_gpu\include -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE -IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE -IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt /Tcscs/linsys/gpu\gpu.c /Fobuild\temp.win-amd64-3.8\Release\scs/linsys/gpu\gpu.obj -O3" failed with exit status 2
The text was updated successfully, but these errors were encountered: