示例#1
0
文件: _runtime.py 项目: wphicks/cupy
    def __init__(self):
        self.cupy_version = cupy.__version__

        if not is_hip:
            self.cuda_path = cupy.cuda.get_cuda_path()
        else:
            self.cuda_path = cupy._environment.get_rocm_path()

        self.cuda_build_version = cupy.cuda.driver.get_build_version()
        self.cuda_driver_version = _eval_or_error(
            cupy.cuda.runtime.driverGetVersion,
            cupy.cuda.runtime.CUDARuntimeError)

        self.cuda_runtime_version = _eval_or_error(
            cupy.cuda.runtime.runtimeGetVersion,
            cupy.cuda.runtime.CUDARuntimeError)

        self.cublas_version = _eval_or_error(
            lambda: cupy.cuda.cublas.getVersion(cupy.cuda.device.
                                                get_cublas_handle()),
            cupy.cuda.cublas.CUBLASError)
        self.cufft_version = _eval_or_error(cupy.cuda.cufft.getVersion,
                                            cupy.cuda.cufft.CuFFTError)
        self.curand_version = _eval_or_error(cupy.cuda.curand.getVersion,
                                             cupy.cuda.curand.CURANDError)
        self.cusolver_version = _eval_or_error(
            cupy.cuda.cusolver._getVersion, cupy.cuda.cusolver.CUSOLVERError)
        self.cusparse_version = _eval_or_error(
            lambda: cupy.cuda.cusparse.getVersion(cupy.cuda.device.
                                                  get_cusparse_handle()),
            cupy.cuda.cusparse.CuSparseError)
        self.nvrtc_version = _eval_or_error(cupy.cuda.nvrtc.getVersion,
                                            cupy.cuda.nvrtc.NVRTCError)

        if thrust is not None:
            self.thrust_version = thrust.get_build_version()

        if cudnn is not None:
            self.cudnn_build_version = cudnn.get_build_version()
            self.cudnn_version = _eval_or_error(cudnn.getVersion,
                                                cudnn.CuDNNError)

        if nccl is not None:
            self.nccl_build_version = nccl.get_build_version()
            nccl_runtime_version = nccl.get_version()
            if nccl_runtime_version == 0:
                nccl_runtime_version = '(unknown)'
            self.nccl_runtime_version = nccl_runtime_version

        if cub is not None:
            self.cub_build_version = cub.get_build_version()

        if cutensor is not None:
            self.cutensor_version = cutensor.get_version()

        self.numpy_version = numpy.version.full_version
        if scipy is not None:
            self.scipy_version = scipy.version.full_version
示例#2
0
文件: runtime.py 项目: mnicely/cupy
    def __init__(self):
        self.cupy_version = cupy.__version__

        self.cuda_path = cupy.cuda.get_cuda_path()

        self.cuda_build_version = cupy.cuda.driver.get_build_version()
        self.cuda_driver_version = _eval_or_error(
            cupy.cuda.runtime.driverGetVersion,
            cupy.cuda.runtime.CUDARuntimeError)

        self.cuda_runtime_version = _eval_or_error(
            cupy.cuda.runtime.runtimeGetVersion,
            cupy.cuda.runtime.CUDARuntimeError)

        self.cublas_version = _eval_or_error(
            lambda: cupy.cuda.cublas.getVersion(cupy.cuda.device.
                                                get_cublas_handle()),
            cupy.cuda.cublas.CUBLASError)
        self.cufft_version = _eval_or_error(cupy.cuda.cufft.getVersion,
                                            cupy.cuda.cufft.CuFFTError)
        self.curand_version = _eval_or_error(cupy.cuda.curand.getVersion,
                                             cupy.cuda.curand.CURANDError)
        self.cusolver_version = _eval_or_error(
            cupy.cuda.cusolver._getVersion, cupy.cuda.cusolver.CUSOLVERError)
        self.cusparse_version = _eval_or_error(
            lambda: cupy.cuda.cusparse.getVersion(cupy.cuda.device.
                                                  get_cusparse_handle()),
            cupy.cuda.cusparse.CuSparseError)
        self.nvrtc_version = _eval_or_error(cupy.cuda.nvrtc.getVersion,
                                            cupy.cuda.nvrtc.NVRTCError)

        if thrust is not None:
            self.thrust_version = thrust.get_build_version()

        if cudnn is not None:
            self.cudnn_build_version = cudnn.get_build_version()
            self.cudnn_version = _eval_or_error(cudnn.getVersion,
                                                cudnn.CuDNNError)

        if nccl is not None:
            self.nccl_build_version = nccl.get_build_version()
            nccl_runtime_version = nccl.get_version()
            if nccl_runtime_version == 0:
                nccl_runtime_version = '(unknown)'
            self.nccl_runtime_version = nccl_runtime_version

        if cub is not None:
            # There is no API in CUB to retrieve the current version
            # We show if its enabled or disabled
            self.cub_version = 'Enabled'

        if cutensor is not None:
            self.cutensor_version = cutensor.get_version()
示例#3
0
    def __init__(self, *, full=True):
        self.cupy_version = cupy.__version__

        if not is_hip:
            self.cuda_path = cupy.cuda.get_cuda_path()
        else:
            self.cuda_path = cupy._environment.get_rocm_path()

        if not is_hip:
            self.nvcc_path = cupy._environment.get_nvcc_path()
        else:
            self.nvcc_path = cupy._environment.get_hipcc_path()

        driver_build_version = cupy.cuda.driver.get_build_version()
        if cupy.cuda.driver._is_cuda_python():
            import cuda
            self.cuda_build_version = (f'{driver_build_version} '
                                       f'(CUDA Python: {cuda.__version__})')
        else:
            self.cuda_build_version = driver_build_version
        self.cuda_driver_version = _eval_or_error(
            cupy.cuda.runtime.driverGetVersion,
            cupy.cuda.runtime.CUDARuntimeError)

        self.cuda_runtime_version = _eval_or_error(
            cupy.cuda.runtime.runtimeGetVersion,
            cupy.cuda.runtime.CUDARuntimeError)

        if full:
            self.cublas_version = _eval_or_error(
                lambda: cupy.cuda.cublas.getVersion(cupy.cuda.device.
                                                    get_cublas_handle()),
                cupy.cuda.cublas.CUBLASError)
        else:
            self.cublas_version = '(available)'
        self.cufft_version = _eval_or_error(cupy.cuda.cufft.getVersion,
                                            cupy.cuda.cufft.CuFFTError)
        self.curand_version = _eval_or_error(cupy.cuda.curand.getVersion,
                                             cupy.cuda.curand.CURANDError)
        self.cusolver_version = _eval_or_error(
            cupy.cuda.cusolver._getVersion, cupy.cuda.cusolver.CUSOLVERError)
        if full:
            self.cusparse_version = _eval_or_error(
                lambda: cupy.cuda.cusparse.getVersion(cupy.cuda.device.
                                                      get_cusparse_handle()),
                cupy.cuda.cusparse.CuSparseError)
        else:
            self.cusparse_version = '(available)'

        self.nvrtc_version = _eval_or_error(cupy.cuda.nvrtc.getVersion,
                                            cupy.cuda.nvrtc.NVRTCError)

        if thrust is not None:
            self.thrust_version = thrust.get_build_version()

        if cudnn is not None:
            self.cudnn_build_version = cudnn.get_build_version()
            self.cudnn_version = _eval_or_error(cudnn.getVersion,
                                                cudnn.CuDNNError)

        if nccl is not None:
            self.nccl_build_version = nccl.get_build_version()
            nccl_runtime_version = nccl.get_version()
            if nccl_runtime_version == 0:
                nccl_runtime_version = '(unknown)'
            self.nccl_runtime_version = nccl_runtime_version

        if cub is not None:
            self.cub_build_version = cub.get_build_version()

        if jitify is not None:
            self.jitify_build_version = jitify.get_build_version()

        if cutensor is not None:
            self.cutensor_version = cutensor.get_version()

        if cusparselt is not None:
            self.cusparselt_version = cusparselt.get_build_version()

        self.cython_build_version = cupy._util.cython_build_ver
        if Cython is not None:
            self.cython_version = Cython.__version__

        self.numpy_version = numpy.version.full_version
        if scipy is not None:
            self.scipy_version = scipy.version.full_version
示例#4
0
文件: _runtime.py 项目: toslunar/cupy
    def __init__(self, *, full=True):
        self.cupy_version = cupy.__version__

        if not is_hip:
            self.cuda_path = cupy.cuda.get_cuda_path()
        else:
            self.cuda_path = cupy._environment.get_rocm_path()

        if not is_hip:
            self.nvcc_path = cupy._environment.get_nvcc_path()
        else:
            self.nvcc_path = cupy._environment.get_hipcc_path()

        # CUDA Driver
        self.cuda_build_version = str(cupy.cuda.driver.get_build_version())
        if cupy.cuda.driver._is_cuda_python():
            import cuda
            self.cuda_build_version += f' (CUDA Python: {cuda.__version__})'
        self.cuda_driver_version = _eval_or_error(
            cupy.cuda.runtime.driverGetVersion,
            cupy.cuda.runtime.CUDARuntimeError)

        # CUDA Runtime
        self.cuda_runtime_version = _eval_or_error(
            cupy.cuda.runtime.runtimeGetVersion,
            cupy.cuda.runtime.CUDARuntimeError)

        # cuBLAS
        self.cublas_version = '(available)'
        if full:
            self.cublas_version = _eval_or_error(
                lambda: cupy.cuda.cublas.getVersion(cupy.cuda.device.
                                                    get_cublas_handle()),
                cupy.cuda.cublas.CUBLASError)

        # cuFFT
        self.cufft_version = _eval_or_error(cupy.cuda.cufft.getVersion,
                                            cupy.cuda.cufft.CuFFTError)

        # cuRAND
        self.curand_version = _eval_or_error(cupy.cuda.curand.getVersion,
                                             cupy.cuda.curand.CURANDError)

        # cuSOLVER
        self.cusolver_version = _eval_or_error(
            cupy.cuda.cusolver._getVersion, cupy.cuda.cusolver.CUSOLVERError)

        # cuSPARSE
        self.cusparse_version = '(available)'
        if full:
            self.cusparse_version = _eval_or_error(
                lambda: cupy.cuda.cusparse.getVersion(cupy.cuda.device.
                                                      get_cusparse_handle()),
                cupy.cuda.cusparse.CuSparseError)

        # NVRTC
        self.nvrtc_version = _eval_or_error(cupy.cuda.nvrtc.getVersion,
                                            cupy.cuda.nvrtc.NVRTCError)

        # Thrust
        try:
            import cupy.cuda.thrust as thrust
            self.thrust_version = thrust.get_build_version()
        except ImportError:
            pass

        # cuDNN
        if cupy._environment._can_attempt_preload('cudnn'):
            if full:
                cupy._environment._preload_library('cudnn')
            else:
                self.cudnn_build_version = (
                    '(not loaded; try `import cupy.cuda.cudnn` first)')
                self.cudnn_version = self.cudnn_build_version
        try:
            import cupy_backends.cuda.libs.cudnn as cudnn
            self.cudnn_build_version = cudnn.get_build_version()
            self.cudnn_version = _eval_or_error(cudnn.getVersion,
                                                cudnn.CuDNNError)
        except ImportError:
            pass

        # NCCL
        try:
            import cupy_backends.cuda.libs.nccl as nccl
            self.nccl_build_version = nccl.get_build_version()
            nccl_runtime_version = nccl.get_version()
            if nccl_runtime_version == 0:
                nccl_runtime_version = '(unknown)'
            self.nccl_runtime_version = nccl_runtime_version
        except ImportError:
            pass

        # CUB
        self.cub_build_version = cupy.cuda.cub.get_build_version()

        try:
            import cupy.cuda.jitify as jitify
            self.jitify_build_version = jitify.get_build_version()
        except ImportError:
            pass

        # cuTENSOR
        try:
            import cupy_backends.cuda.libs.cutensor as cutensor
            self.cutensor_version = cutensor.get_version()
        except ImportError:
            pass

        # cuSparseLT
        try:
            import cupy_backends.cuda.libs.cusparselt as cusparselt
            self.cusparselt_version = cusparselt.get_build_version()
        except ImportError:
            pass

        # Cython
        self.cython_build_version = cupy._util.cython_build_ver
        try:
            import Cython
            self.cython_version = Cython.__version__
        except ImportError:
            pass

        # NumPy
        self.numpy_version = numpy.version.full_version

        # SciPy
        try:
            import scipy
            self.scipy_version = scipy.version.full_version
        except ImportError:
            pass