Skip to content

[cuda] Export vcpkg_find_cuda.cmake#13440

Merged
BillyONeal merged 3 commits intomicrosoft:masterfrom
ras0219:dev/roschuma/cuda
Oct 7, 2020
Merged

[cuda] Export vcpkg_find_cuda.cmake#13440
BillyONeal merged 3 commits intomicrosoft:masterfrom
ras0219:dev/roschuma/cuda

Conversation

@ras0219
Copy link
Contributor

@ras0219 ras0219 commented Sep 10, 2020

This PR introduces a port-packaged helper vcpkg_find_cuda() that works similarly to vcpkg_find_fortran():

# ports/some_consumer/portfile.cmake

include(${CURRENT_INSTALLED_DIR}/share/vcpkg_find_cuda/vcpkg_find_cuda.cmake)
vcpkg_find_cuda(OUT_CUDA_TOOLKIT_ROOT CUDA_TOOLKIT_ROOT)
vcpkg_configure_cmake(
  SOURCE_PATH "${SOURCE_PATH}"
  OPTIONS -DCUDA_TOOLKIT_ROOT=${CUDA_TOOLKIT_ROOT}
)

@cenit and @Neumann-A for their CUDA expertise on whether this approach seems correct

@JackBoosY JackBoosY self-assigned this Sep 10, 2020
@JackBoosY JackBoosY added category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist info:internal labels Sep 10, 2020
@JackBoosY
Copy link
Contributor

Need test locally.

@JackBoosY JackBoosY added the info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. label Sep 14, 2020
@@ -0,0 +1,91 @@
function(vcpkg_find_cuda)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason not to go full vcpkg_find_fortran and use CMakeDetermineCUDACompiler.cmake ? Just trick it to ingore the FATAL_ERROR by setting CMAKE_GENERATOR to Ninja

Comment on lines +10 to +15
set(CUDA_PATHS
ENV CUDA_PATH
ENV CUDA_BIN_PATH
ENV CUDA_PATH_V11_0
ENV CUDA_PATH_V10_2
ENV CUDA_PATH_V10_1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of search in all those dirs env CUDA_PATH is actually required by CMake. As such setting up CUDA_PATH if one of the other env variables exist is the way to go since it mitigates the env removal some VS updates seem to do.

@JackBoosY
Copy link
Contributor

We should use the provided FindCUDA.cmake cmake, but it is not suitable for our expected CUDA path.

@Neumann-A
Copy link
Contributor

We should use the provided FindCUDA.cmake cmake, but it is not suitable for our expected CUDA path.

We need to differentiate between the CUDA compiler and the CUDA libraries.

@cenit
Copy link
Contributor

cenit commented Sep 16, 2020

We should use the provided FindCUDA.cmake

FindCUDA.cmake is deprecated. I would not build a vcpkg feature on top of that

@Neumann-A
Copy link
Contributor

@BillyONeal BillyONeal merged commit b7b552d into microsoft:master Oct 7, 2020
@BillyONeal
Copy link
Member

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants