(self)
return libdir, libptn
Locate the "standard" CUDA SDK library directory in the local
        file system. Supports 64-Bit Windows, Linux and Mac OS X.
        In case the caller supplied cuda_libdir in the constructor
        other than None that value is returned unchecked, else a
        best-effort attempt is made.
        Precedence:
            Windows: cuda_libdir > %CUDA_PATH%
            Linux:   cuda_libdir > $CUDA_ROOT > $LD_LIBRARY_PATH > '/usr/lib/x86_64-linux-gnu'
        Returns a pair (libdir, libptn) where libdir is None in case
            of failure or a string containing the absolute path of the
            directory, and libptn is the %-format pattern to construct
            library file names from library names on the local system.
        Raises a RuntimeError in case of failure.
        Links:
        - Post-installation Actions
          http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions
        TODO:
        - Is $CUDA_ROOT/lib64 the correct path to assume for 64-Bit CUDA libraries on Linux?
        - Mac OS X (Darwin) is currently treated like Linux, is that correct?
        - Check CMake's FindCUDA module, it might contain some helpful clues in its sources
          https://cmake.org/cmake/help/v3.0/module/FindCUDA.html
          https://github.com/Kitware/CMake/blob/master/Modules/FindCUDA.cmake
        - Verify all Linux code paths somehow
Locate the "standard" CUDA SDK library directory in the local
        file system. Supports 64-Bit Windows, Linux and Mac OS X.
        In case the caller supplied cuda_libdir in the constructor
        other than None that value is returned unchecked, else a
        best-effort attempt is made.
        Precedence:
            Windows: cuda_libdir > %CUDA_PATH%
            Linux:   cuda_libdir > $CUDA_ROOT > $LD_LIBRARY_PATH > '/usr/lib/x86_64-linux-gnu'
        Returns a pair (libdir, libptn) where libdir is None in case
            of failure or a string containing the absolute path of the
            directory, and libptn is the %-format pattern to construct
            library file names from library names on the local system.
        Raises a RuntimeError in case of failure.
        Links:
        - Post-installation Actions
          http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions
        TODO:
        - Is $CUDA_ROOT/lib64 the correct path to assume for 64-Bit CUDA libraries on Linux?
        - Mac OS X (Darwin) is currently treated like Linux, is that correct?
        - Check CMake's FindCUDA module, it might contain some helpful clues in its sources
          https://cmake.org/cmake/help/v3.0/module/FindCUDA.html
          https://github.com/Kitware/CMake/blob/master/Modules/FindCUDA.cmake
        - Verify all Linux code paths somehow
Locate the standard CUDA SDK library directory in the local file system . Supports 64 - Bit Windows Linux and Mac OS X . In case the caller supplied cuda_libdir in the constructor other than None that value is returned unchecked else a best - effort attempt is made . Precedence : Windows : cuda_libdir > %CUDA_PATH% Linux : cuda_libdir > $CUDA_ROOT > $LD_LIBRARY_PATH > / usr / lib / x86_64 - linux - gnu Returns a pair ( libdir libptn ) where libdir is None in case of failure or a string containing the absolute path of the directory and libptn is the % - format pattern to construct library file names from library names on the local system . Raises a RuntimeError in case of failure . Links : - Post - installation Actions http : // docs . nvidia . com / cuda / cuda - installation - guide - linux / index . html#post - installation - actions TODO : - Is $CUDA_ROOT / lib64 the correct path to assume for 64 - Bit CUDA libraries on Linux? - Mac OS X ( Darwin ) is currently treated like Linux is that correct? - Check CMake s FindCUDA module it might contain some helpful clues in its sources https : // cmake . org / cmake / help / v3 . 0 / module / FindCUDA . html https : // github . com / Kitware / CMake / blob / master / Modules / FindCUDA . cmake - Verify all Linux code paths somehow
def _locate_cuda_libdir(self):
        """
        Locate the "standard" CUDA SDK library directory in the local
        file system. Supports 64-Bit Windows, Linux and Mac OS X.
        In case the caller supplied cuda_libdir in the constructor
        other than None that value is returned unchecked, else a
        best-effort attempt is made.
        Precedence:
            Windows: cuda_libdir > %CUDA_PATH%
            Linux:   cuda_libdir > $CUDA_ROOT > $LD_LIBRARY_PATH > '/usr/lib/x86_64-linux-gnu'
        Returns a pair (libdir, libptn) where libdir is None in case
            of failure or a string containing the absolute path of the
            directory, and libptn is the %-format pattern to construct
            library file names from library names on the local system.
        Raises a RuntimeError in case of failure.
        Links:
        - Post-installation Actions
          http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions
        TODO:
        - Is $CUDA_ROOT/lib64 the correct path to assume for 64-Bit CUDA libraries on Linux?
        - Mac OS X (Darwin) is currently treated like Linux, is that correct?
        - Check CMake's FindCUDA module, it might contain some helpful clues in its sources
          https://cmake.org/cmake/help/v3.0/module/FindCUDA.html
          https://github.com/Kitware/CMake/blob/master/Modules/FindCUDA.cmake
        - Verify all Linux code paths somehow
        """
        from os.path import isfile, join
        from platform import system as platform_system

        system = platform_system()
        libdir, libptn = None, None
        if system == "Windows":
            if self.cuda_libdir is not None:
                libdir = self.cuda_libdir
            elif "CUDA_PATH" in os.environ and isfile(
                join(os.environ["CUDA_PATH"], "lib\\x64\\cudadevrt.lib")
            ):
                libdir = join(os.environ["CUDA_PATH"], "lib\\x64")
            libptn = "%s.lib"
        elif system in ["Linux", "Darwin"]:
            if self.cuda_libdir is not None:
                libdir = self.cuda_libdir
            elif "CUDA_ROOT" in os.environ and isfile(
                join(os.environ["CUDA_ROOT"], "lib64/libcudadevrt.a")
            ):
                libdir = join(os.environ["CUDA_ROOT"], "lib64")
            elif "LD_LIBRARY_PATH" in os.environ:
                for ld_path in os.environ["LD_LIBRARY_PATH"].split(":"):
                    if isfile(join(ld_path, "libcudadevrt.a")):
                        libdir = ld_path
                        break

            if libdir is None and isfile("/usr/lib/x86_64-linux-gnu/libcudadevrt.a"):
                libdir = "/usr/lib/x86_64-linux-gnu"

            if libdir is None:
                nvcc_path = _find_nvcc_on_path()
                if nvcc_path is not None:
                    libdir = join(os.path.dirname(nvcc_path), "..", "lib64")

            libptn = "lib%s.a"
        if libdir is None:
            raise RuntimeError(
                "Unable to locate the CUDA SDK installation "
                "directory, set CUDA library path manually"
            )
        return libdir, libptn
def _locate_cuda_libdir ( self ) : from os . path import isfile , join from platform import system as platform_system system = platform_system ( ) libdir , libptn = None , None if system == "Windows" : if self . cuda_libdir is not None : libdir = self . cuda_libdir elif "CUDA_PATH" in os . environ and isfile ( join ( os . environ [ "CUDA_PATH" ] , "lib\\x64\\cudadevrt.lib" ) ) : libdir = join ( os . environ [ "CUDA_PATH" ] , "lib\\x64" ) libptn = "%s.lib" elif system in [ "Linux" , "Darwin" ] : if self . cuda_libdir is not None : libdir = self . cuda_libdir elif "CUDA_ROOT" in os . environ and isfile ( join ( os . environ [ "CUDA_ROOT" ] , "lib64/libcudadevrt.a" ) ) : libdir = join ( os . environ [ "CUDA_ROOT" ] , "lib64" ) elif "LD_LIBRARY_PATH" in os . environ : for ld_path in os . environ [ "LD_LIBRARY_PATH" ] . split ( ":" ) : if isfile ( join ( ld_path , "libcudadevrt.a" ) ) : libdir = ld_path break if libdir is None and isfile ( "/usr/lib/x86_64-linux-gnu/libcudadevrt.a" ) : libdir = "/usr/lib/x86_64-linux-gnu" if libdir is None : nvcc_path = _find_nvcc_on_path ( ) if nvcc_path is not None : libdir = join ( os . path . dirname ( nvcc_path ) , ".." , "lib64" ) libptn = "lib%s.a" if libdir is None : raise RuntimeError ( "Unable to locate the CUDA SDK installation " "directory, set CUDA library path manually" ) return libdir , libptn