[CMake] FindCUDA fails to find libcuda.so

Robert Maynard robert.maynard at kitware.com
Wed May 1 09:09:24 EDT 2013


It looks like you used the ubuntu cuda package which installs the cuda
library to a directory that FindCUDA wasn't expecting. I think we can
extend FindCUDA to also use x86_64-linux-gnu as a valid directory to
search for libcuda.

can you submit a bug on mantis for this, so it doesn't get forgotten?

On Tue, Apr 30, 2013 at 4:37 PM, Marcel Loose <marcel.loose at zonnet.nl> wrote:
> Here are the results on my Ubuntu 12.10 system:
>
> $ cmake --debug-output ..
> Running with debug output on.
> -- The C compiler identification is GNU 4.7.2
>    Called from: [2]
> /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
> -- The CXX compiler identification is GNU 4.7.2
>    Called from: [2]
> /usr/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Check for working C compiler: /usr/bin/gcc
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Check for working C compiler: /usr/bin/gcc -- works
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Detecting C compiler ABI info
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Detecting C compiler ABI info - done
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Check for working CXX compiler: /usr/bin/c++
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Check for working CXX compiler: /usr/bin/c++ -- works
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Detecting CXX compiler ABI info
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Detecting CXX compiler ABI info - done
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
> -- Found CUDA: /usr (found version "4.2")
>    Called from: [2] /usr/share/cmake-2.8/Modules/FindCUDA.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
> -- CUDA_LIBRARIES = /usr/lib/x86_64-linux-gnu/libcudart.so
>    Called from: [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
> -- Configuring done
> -- Generating /home/marcel/temp/cmake/cuda/build
> -- Generating done
> -- Build files have been written to: /home/marcel/temp/cmake/cuda/build
>
> And here's the output when setting CUDA_LIB_PATH:
>
> $ CUDA_LIB_PATH=/usr/lib/nvidia-current cmake --debug-output ..
> Running with debug output on.
> -- The C compiler identification is GNU 4.7.2
>    Called from: [2]
> /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
> -- The CXX compiler identification is GNU 4.7.2
>    Called from: [2]
> /usr/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Check for working C compiler: /usr/bin/gcc
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Check for working C compiler: /usr/bin/gcc -- works
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Detecting C compiler ABI info
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Detecting C compiler ABI info - done
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Check for working CXX compiler: /usr/bin/c++
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Check for working CXX compiler: /usr/bin/c++ -- works
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Detecting CXX compiler ABI info
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
>
> -- Detecting CXX compiler ABI info - done
>    Called from: [2] /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
> -- Found CUDA: /usr (found version "4.2")
>    Called from: [2] /usr/share/cmake-2.8/Modules/FindCUDA.cmake
>                 [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
> -- CUDA_LIBRARIES =
> /usr/lib/x86_64-linux-gnu/libcudart.so;/usr/lib/nvidia-current/libcuda.so
>    Called from: [1] /home/marcel/temp/cmake/cuda/CMakeLists.txt
> -- Configuring done
> -- Generating /home/marcel/temp/cmake/cuda/build
> -- Generating done
> -- Build files have been written to: /home/marcel/temp/cmake/cuda/build
>
> Best regards,
> Marcel Loose.
>
> Op 29-04-13 18:04, Robert Maynard schreef:
>
>> I have had no problem with Ubuntu 12.10 and Cuda 5; findCuda is able
>> to find cuda in /usr/lib.  Can you run CMake --debug-output output
>> enable and see where findCuda is searching?
>>
>> On Mon, Apr 29, 2013 at 11:52 AM, Marcel Loose <loose at astron.nl> wrote:
>>>
>>> Hi Robert,
>>>
>>> I agree that on the CentOS machine the install paths are non-standard.
>>> For
>>> the Ubuntu system, on the other hand, I have to disagree with that
>>> statement. It is a *standard* Ubuntu 12.10 system, so IMHO FindCUDA.cmake
>>> should be able to locate libcuda.so on that system.
>>>
>>> Regards,
>>> Marcel Loose.
>>>
>>>
>>> On 29/04/13 16:54, Robert Maynard wrote:
>>>>
>>>> You have a nonstandard install path that will require you to use
>>>> CUDA_PATH / CUDA_BIN_PATH and CUDA_LIB_PATH.
>>>>
>>>> On Mon, Apr 29, 2013 at 10:10 AM, Marcel Loose <loose at astron.nl> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> It fails to find CUDA 5.0. See below.
>>>>>
>>>>> $ env | grep CUDA
>>>>> CUDA_PATH=/cm/shared/apps/cuda50/toolkit/5.0.35
>>>>> CUDA_INC_PATH=/cm/shared/apps/cuda50/toolkit/5.0.35
>>>>> CUDA_SDK=/cm/shared/apps/cuda50/sdk/5.0.35
>>>>> CUDA_CACHE_DISABLE=1
>>>>> CUDA_INSTALL_PATH=/cm/shared/apps/cuda50/toolkit/5.0.35
>>>>> CUDA_ROOT=/cm/local/apps/cuda50/libs/304.54
>>>>>
>>>>> $ cat ../CMakeLists.txt
>>>>> cmake_minimum_required(VERSION 2.8)
>>>>> project(CheckCUDALibs)
>>>>> find_package(CUDA)
>>>>> message(STATUS "CUDA_LIBRARIES = ${CUDA_LIBRARIES}")
>>>>>
>>>>> $ cmake ..
>>>>> -- The C compiler identification is GNU
>>>>> -- The CXX compiler identification is GNU
>>>>> -- Check for working C compiler: /usr/bin/gcc
>>>>> -- Check for working C compiler: /usr/bin/gcc -- works
>>>>> -- Detecting C compiler ABI info
>>>>> -- Detecting C compiler ABI info - done
>>>>> -- Check for working CXX compiler: /usr/bin/c++
>>>>> -- Check for working CXX compiler: /usr/bin/c++ -- works
>>>>> -- Detecting CXX compiler ABI info
>>>>> -- Detecting CXX compiler ABI info - done
>>>>> -- Found CUDA: /cm/shared/apps/cuda50/toolkit/5.0.35 (found version
>>>>> "5.0")
>>>>> -- CUDA_LIBRARIES =
>>>>> /cm/shared/apps/cuda50/toolkit/5.0.35/lib64/libcudart.so
>>>>> -- Configuring done
>>>>> -- Generating done
>>>>> -- Build files have been written to: /home/loose/temp/cmake/cuda/build
>>>>>
>>>>> $ CUDA_LIB_PATH=$CUDA_ROOT/lib cmake ..
>>>>> -- CUDA_LIBRARIES =
>>>>>
>>>>>
>>>>> /cm/shared/apps/cuda50/toolkit/5.0.35/lib64/libcudart.so;/cm/local/apps/cuda50/libs/304.54/lib64/libcuda.so
>>>>> -- Configuring done
>>>>> -- Generating done
>>>>> -- Build files have been written to: /home/loose/temp/cmake/cuda/build
>>>>>
>>>>> Only when explicitly setting CUDA_LIB_PATH, libcuda.so is found.
>>>>>
>>>>> BTW: On Ubuntu I also need to set CUDA_LIB_PATH, but then to
>>>>> /usr/lib/nvidia-current.
>>>>>
>>>>> Regards,
>>>>> Marcel Loose.
>>>>>
>>>>>
>>>>>
>>>>> On 29/04/13 15:36, Robert Maynard wrote:
>>>>>>
>>>>>> Can you provide what Cuda version FindCuda is failing to find, and
>>>>>> where Cluster Manager is installing the CUDA toolkit and library?
>>>>>>
>>>>>> On Mon, Apr 29, 2013 at 7:38 AM, Marcel Loose <loose at astron.nl> wrote:
>>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I noticed that FindCUDA.cmake fails to locate libcuda.so on at least
>>>>>>> two
>>>>>>> different platforms: Ubuntu 12.10 and CentOS 6.3 using Cluster
>>>>>>> Manager
>>>>>>> v5.2.
>>>>>>> I can persuade FindCUDA.cmake to search for this library by
>>>>>>> explicitly
>>>>>>> setting the environment variable CUDA_LIB_PATH, and then it finds it.
>>>>>>> However, IMHO, using this trick should only be necessary as a last
>>>>>>> resort.
>>>>>>> Is this a bug?
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Marcel Loose.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Powered by www.kitware.com
>>>>>>>
>>>>>>> Visit other Kitware open-source projects at
>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>
>>>>>>> Please keep messages on-topic and check the CMake FAQ at:
>>>>>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>>>>>
>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>>>
>>>>>
>


More information about the CMake mailing list