leezu edited a comment on issue #17293: [Build] Add a reasonable default for CMAKE_CUDA_COMPILER in *nix URL: https://github.com/apache/incubator-mxnet/pull/17293#issuecomment-575337042 @larroy, yes it's required to check the environment variables (both `CUDACXX` and `PATH`) first before "falling back" to some default path. But it may be hard check both environment variables correctly. So let's just rely on cmake to figure out if it can find nvcc by standard means. Then only if this fails, fall back to the path. Thus I suggest the following approach instead ``` cmake check_language(CUDA) if (NOT CMAKE_CUDA_COMPILER_LOADED AND UNIX AND EXISTS "/usr/local/cuda/bin/nvcc") set(CMAKE_CUDA_COMPILER "/usr/local/cuda/bin/nvcc") message(WARNING "CMAKE_CUDA_COMPILER guessed: ${CMAKE_CUDA_COMPILER}") endif() ``` It should be placed at the same position as the changes done in this PR. My concern is that if nvcc is not on the PATH, users may also have forgotten to set `LD_LIBRARY_PATH`. This will lead to issues when attempting to load mxnet later. Thus I think it's preferable to educate users how to set up there system correctly, instead of attempting to work with broken systems (as we would never be able to catch all various ways that the system may be broken).
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
