easybuilders / easybuild-easyconfigs

A collection of easyconfig files that describe which software to build using which build options with EasyBuild.
https://easybuild.io
GNU General Public License v2.0
378 stars 701 forks source link

Include CUDA stubs location in CUDA easyconfig #6602

Closed dominikborkowski closed 6 years ago

dominikborkowski commented 6 years ago

Many applications link against libcuda.so.1 which is available in full in the cuda driver package. When one attempts to compile cuda enabled aps, for example TensorFlow-1.7.0-foss-2018a-Python-3.6.4-CUDA-9.1.85.eb, on a system without that external package, compilation will fail while trying to link.

There is a potential simple fix, which would allow full compilation of CUDA apps with the existing CUDA provided by CUDA-9.1.85.eb, and it involves library stubs. Per Nvidia's documentation from http://developer.download.nvidia.com/compute/cuda/6_5/rel/docs/CUDA_Toolkit_Release_Notes.pdf

"On Linux, stubs that applications can link against at build time have been added for each library. This removes the need to have the full library installed when building an application. In addition to the CUDA Toolkit libraries, a stub has been provided for the CUDA Driver library (libcuda.so). See the NVIDIA CUDA Getting Started Guide for LINUX for details on how to use these stubs."

By adding lib64/stubs location to LIBRARY_PATH in CUDA-9.1.85.eb applications now can link properly. For example:

# Provide means for linker to find the cuda stub libraries.
# This is important for systems which do not have cuda-driver package installed
modextrapaths = {
    'LIBRARY_PATH': ["lib64/stubs"],
    }

This has a potential to allow people to compile code on systems that do not have the cuda driver system packages installed, and it seems to be fully blessed by Nvidia.

Cheers!

ocaisa commented 6 years ago

This seems reasonable to me. Would you like to open a PR against the CUDA easyblock? You just need to add a line at https://github.com/easybuilders/easybuild-easyblocks/blob/master/easybuild/easyblocks/c/cuda.py#L171

    'LIBRARY_PATH': os.path.join(lib_path, 'stubs'),
dominikborkowski commented 6 years ago

Looks like AndiH beat me to the PR. Thank you!

damianam commented 6 years ago

I am closing this issue, as it has been fixed here: https://github.com/easybuilders/easybuild-easyblocks/pull/1464