Skip to content

Conversation

@IvanGrigorik
Copy link
Collaborator

This PR fixes CUDA_HOME environment variable
Now, users need to to specify it explicitly to build it
This fixes that

@kennykos
Copy link
Collaborator

This PR fixes CUDA_HOME environment variable Now, users need to to specify it explicitly to build it This fixes that

How was the CUDA_HOME environment variable broken? What is the specific bug that this is addressing?

@IvanGrigorik
Copy link
Collaborator Author

I'm not sure, but @gliga told me that he was unable to install PyKokkos and got some problems with CUDA_HOME env variable
This PR fixes it, if the CUDA_HOME is not already exported

@IvanGrigorik IvanGrigorik requested a review from gliga December 29, 2025 18:06
Copy link
Contributor

@JBludau JBludau left a comment

Choose a reason for hiding this comment

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

I don't think that is going in the right direction

@JBludau
Copy link
Contributor

JBludau commented Dec 31, 2025

@gliga could you describe what exactly was your problem? This is kind of nebulous right now

@gliga
Copy link
Contributor

gliga commented Jan 1, 2026

@gliga could you describe what exactly was your problem? This is kind of nebulous right now

I had to

export CUDA_HOME=
export CUDAToolkit_ROOT=
export PATH=
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH

for the install to work.
This should be either in instructions and ideally the script should fail saying which variables should be set.

If we can set those automatically (or in the limit suggest the values to use), that will simplify steps further.

@IvanGrigorik
Copy link
Collaborator Author

@gliga @JBludau I suggest creating a script/environment updater that, if the CUDA option is specified, will install CUDA using the Conda environment. Currently, we may encounter many problems if users have incorrectly installed the CUDA toolkit.

Ping if you think this is a good/bad idea. I will create it if someone will say that this is ok

@IvanGrigorik IvanGrigorik requested a review from JBludau January 1, 2026 22:59
Comment on lines +107 to +111
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${INCLUDE_DIR}")
SET(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -I${INCLUDE_DIR}")
ENDFOREACH()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "Flags used by the C++ compiler" FORCE)
SET(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS}" CACHE STRING "Flags used by the CUDA compiler" FORCE)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am still not understanding why we need this. This looks like CMake pre version 3. why are we not simply linking to cuda and that populates the flags corresponding to the found cuda toolkit?

@JBludau
Copy link
Contributor

JBludau commented Jan 2, 2026

@gliga @JBludau I suggest creating a script/environment updater that, if the CUDA option is specified, will install CUDA using the Conda environment. Currently, we may encounter many problems if users have incorrectly installed the CUDA toolkit.

Ping if you think this is a good/bad idea. I will create it if someone will say that this is ok

I am not sure. In general I don't like autoinstalls but if you would use conda to install it, we would stay within the conda world which I would say is ok.

@IvanGrigorik
Copy link
Collaborator Author

@JBludau I have some issues with pykokkos build now, and it looks like its related to Kokkos itself:

[  1%] Building CXX object _deps/kokkos-build/simd/src/CMakeFiles/kokkossimd.dir/Kokkos_SIMD_dummy.cpp.o
[  2%] Linking CXX shared library libkokkossimd.so
[  2%] Built target kokkossimd
[  3%] Building CXX object _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Abort.cpp.o
[  4%] Building CXX object _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_CPUDiscovery.cpp.o
[  5%] Building CXX object _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Command_Line_Parsing.cpp.o
[  6%] Building CXX object _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Core.cpp.o
~/pykokkos/base/_skbuild/linux-x86_64-3.12/cmake-build/_deps/kokkos-src/core/src/Kokkos_MathematicalFunctions.hpp(301): warning #20013-D: calling a constexpr __host__ function("remainder") from a __host__ __device__ function("remainder") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.

Remark: The warnings can be suppressed with "-diag-suppress <warning-number>"

~/pykokkos/base/_skbuild/linux-x86_64-3.12/cmake-build/_deps/kokkos-src/core/src/Kokkos_MathematicalFunctions.hpp(301): warning #20013-D: calling a constexpr __host__ function("remainder") from a __host__ __device__ function("remainderf") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.

And these checks repeated multiple times.
AFAIK, this is the issue with CUDA declarations, but I don't understand why this issue arouse only after my changes.

@JBludau
Copy link
Contributor

JBludau commented Jan 2, 2026

@JBludau I have some issues with pykokkos build now, and it looks like its related to Kokkos itself:

[  1%] Building CXX object _deps/kokkos-build/simd/src/CMakeFiles/kokkossimd.dir/Kokkos_SIMD_dummy.cpp.o
[  2%] Linking CXX shared library libkokkossimd.so
[  2%] Built target kokkossimd
[  3%] Building CXX object _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Abort.cpp.o
[  4%] Building CXX object _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_CPUDiscovery.cpp.o
[  5%] Building CXX object _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Command_Line_Parsing.cpp.o
[  6%] Building CXX object _deps/kokkos-build/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Core.cpp.o
~/pykokkos/base/_skbuild/linux-x86_64-3.12/cmake-build/_deps/kokkos-src/core/src/Kokkos_MathematicalFunctions.hpp(301): warning #20013-D: calling a constexpr __host__ function("remainder") from a __host__ __device__ function("remainder") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.

Remark: The warnings can be suppressed with "-diag-suppress <warning-number>"

~/pykokkos/base/_skbuild/linux-x86_64-3.12/cmake-build/_deps/kokkos-src/core/src/Kokkos_MathematicalFunctions.hpp(301): warning #20013-D: calling a constexpr __host__ function("remainder") from a __host__ __device__ function("remainderf") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.

And these checks repeated multiple times. AFAIK, this is the issue with CUDA declarations, but I don't understand why this issue arouse only after my changes.

That is weird ... let me see if I can track that down

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.

5 participants