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

Add Windows #49

Merged
merged 37 commits into from
Nov 9, 2020
Merged

Add Windows #49

merged 37 commits into from
Nov 9, 2020

Conversation

jaimergp
Copy link
Member

@jaimergp jaimergp commented Oct 31, 2020

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

Bringing CUDA to Windows

We need three things

Questions:

  • There's no lib stubs on Windows, so I am symlinking / copying cuda.lib from CUDA_HOME\lib\x64 to LIBRARY_LIB. Is this ok?
  • The env var is CUDA_PATH, not CUDA_HOME, but I am aliasing this one just in case.
  • There's no cuda-gdb so I am using nvcc as a fallback pathfinder
  • CUDA 9.2 requires vs2015, which is now deprecated in conda-forge. There could be a workaround, but looks tricky.

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

@jaimergp
Copy link
Member Author

This passes locally but the CLI installation of CUDA doesn't modify PATH or sets CUDA_PATH. I'll look into it tomorrow!

Copy link
Member

@isuruf isuruf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if exist "%LIBCUDA_SO_CONDA_NVCC_BACKUP%" (
ren "%LIBCUDA_SO_CONDA_NVCC_BACKUP%" "%LIBRARY_LIB%\cuda.lib"
) else (
del "%LIBRARY_LIB%\cuda.lib"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this fail somehow? If it does and the build passes, we'll be packaging this against its license.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add an errorlevel check there and also text for non-existence in the meta.yaml tests. Would that be enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that test is only for this recipe. What happens in downstream packages?

How about generating this cuda.lib ourselves from the DLL so that we can redistribute it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this?

These are the DLLs available under \bin. Which one applies here?

Directory: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin


    Length Name
    ------ ----
  89057280 cublas64_11.dll
 167523328 cublasLt64_11.dll
    335872 cudart32_110.dll
    401408 cudart64_110.dll
 162878976 cufft64_10.dll
    272896 cufftw64_10.dll
   1305600 cuinj64_110.dll
  52446720 curand64_10.dll
 525173248 cusolver64_10.dll
 314601984 cusolverMg64_10.dll
 159789568 cusparse64_11.dll
    232448 nppc64_11.dll
  10907648 nppial64_11.dll
   4569600 nppicc64_11.dll
   7840256 nppidei64_11.dll
  51866112 nppif64_11.dll
  26065920 nppig64_11.dll
   6411264 nppim64_11.dll
  20231168 nppist64_11.dll
    203264 nppisu64_11.dll
   2856960 nppitc64_11.dll
   8873472 npps64_11.dll
    299520 nvblas64_11.dll
   3133952 nvjpeg64_11.dll
   5118976 nvrtc-builtins64_110.dll
  16161792 nvrtc64_110_0.dll

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this?

Yes

These are the DLLs available under \bin. Which one applies here?

Have a look at cuda.lib (It's a text file) It should tell you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Had to use dumpbin /ALL cuda.lib to figure it out. FIle is nvcuda.dll, which should be part of the drivers at C:\Windows\system32, but I can't find it in my system. A separate installation process for the drivers seems to fix it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a stub now. Tried to generate off the drivers installation in the CI, but nvcuda.dll is not present there (I guess because no GPU). So I generated one from my 456.71 Windows installation and copied it over. Is that ok? I left a generate_stub.bat script in case it needs to be regenerated again in the future (drivers update?).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the file might get outdated in that case. How about this? create an empty cuda.lib in bld.bat here so that the empty file will get packaged and then overriding that in a activate.bat? This way, conda will not package the actual cuda.lib in a downstream package because that file is already there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that could work, yes. Check last commit 36ade89.

@jaimergp
Copy link
Member Author

jaimergp commented Nov 4, 2020

I think I was a bit too quick to push the new commits. The new conda-forge-ci-setup is not deployed yet 😬

@jaimergp
Copy link
Member Author

jaimergp commented Nov 4, 2020

I guess CUDA 11 places their Windows files elsewhere. I'll investigate locally.

@jaimergp
Copy link
Member Author

jaimergp commented Nov 4, 2020

That did it. CUDA 11 does not ship a %CUDA_HOME%\version.txt file, so I am querying %CUDA_HOME%\bin\nvcc.exe --version for release %PKG_VERSION% as a fallback mechanism.

@jaimergp
Copy link
Member Author

jaimergp commented Nov 9, 2020

Anything else needed?

@jakirkham jakirkham requested a review from isuruf November 9, 2020 17:52
Comment on lines +67 to +71
:: Make a backup of `cuda.lib` if it exists -- we make sure this is the case in install_nvcc.bat
if exist %LIBRARY_LIB%\cuda.lib (
set "LIBCUDA_SO_CONDA_NVCC_BACKUP=%LIBRARY_LIB%\cuda.lib-conda-nvcc-backup"
ren "%LIBRARY_LIB%\cuda.lib" "%LIBCUDA_SO_CONDA_NVCC_BACKUP%"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just delete this instead of keeping a backup. There's no need to restore it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is also present in the Linux version. I guess it's trying to prevent we mess with another installation that might be providing that file?

@isuruf isuruf merged commit 9481319 into conda-forge:master Nov 9, 2020
@jaimergp
Copy link
Member Author

jaimergp commented Nov 9, 2020

Thanks! 🥳

@jakirkham
Copy link
Member

Thanks for all of this work! 😄

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

Successfully merging this pull request may close these issues.

4 participants