cupy / cupy

NumPy & SciPy for GPU
https://cupy.dev
MIT License
9.39k stars 845 forks source link

Runtime compilation failed - CUDA synchronization primitives are only supported for sm_70 and up #8260

Closed lucascolley closed 7 months ago

lucascolley commented 7 months ago

Description

/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/_logic/truth.py:52: in all
    return a.all(axis=axis, out=out, keepdims=keepdims)
        a          = array([[ True, False],
       [ True,  True],
       [ True,  True],
       [ True,  True],
       [ True,  True]])
        axis       = None
        keepdims   = False
        out        = None
cupy/_core/core.pyx:1169: in cupy._core.core._ndarray_base.all
    ???
cupy/_core/core.pyx:1171: in cupy._core.core._ndarray_base.all
    ???
cupy/_core/_routines_logic.pyx:8: in cupy._core._routines_logic._ndarray_all
    ???
cupy/_core/_reduction.pyx:618: in cupy._core._reduction._SimpleReductionKernel.__call__
    ???
cupy/_core/_reduction.pyx:370: in cupy._core._reduction._AbstractReductionKernel._call
    ???
cupy/_core/_cub_reduction.pyx:689: in cupy._core._cub_reduction._try_to_call_cub_reduction
    ???
cupy/_core/_cub_reduction.pyx:526: in cupy._core._cub_reduction._launch_cub
    ???
cupy/_core/_cub_reduction.pyx:461: in cupy._core._cub_reduction._cub_two_pass_launch
    ???
cupy/_util.pyx:64: in cupy._util.memoize.decorator.ret
    ???
cupy/_core/_cub_reduction.pyx:240: in cupy._core._cub_reduction._SimpleCubReductionKernel_get_cached_function
    ???
cupy/_core/_cub_reduction.pyx:223: in cupy._core._cub_reduction._create_cub_reduction_function
    ???
cupy/_core/core.pyx:2254: in cupy._core.core.compile_with_cache
    ???
/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/cuda/compiler.py:484: in _compile_module_with_cache
    return _compile_with_cache_cuda(
        arch       = None
        backend    = 'nvrtc'
        cache_dir  = None
        cache_in_memory = False
        enable_cooperative_groups = False
        extra_source = '/*  Copyright 2008-2013 NVIDIA Corporation\n *  Copyright 2013 Filipe RNC Maia\n *\n *  Licensed under the Apache Lic...)\n#define CUDART_NAN              __longlong_as_double(0xfff8000000000000ULL)\n\n\n#endif  // CUPY_MATH_CONSTANTS_H\n'
        jitify     = True
        log_stream = None
        name_expressions = None
        options    = ('-I/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/_core/include/cupy/_cccl/cub', '-I/home/lu...packages/cupy/_core/include/cupy/_cccl/libcudacxx', '-DFIRST_PASS=1', '--std=c++11', '-DCUB_DISABLE_BF16_SUPPORT', ...)
        source     = '#include <cupy/cuda_workaround.h>\n#include <cupy/complex.cuh>\n#include <cupy/carray.cuh>\n#include <cupy/atomics.cu...ge\n  }\n\n  if (_tid == 0) {\n      type_mid_out& out0 = *(_out0 + blockIdx.x);\n      POST_MAP(aggregate);\n  }\n}\n'
/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/cuda/compiler.py:562: in _compile_with_cache_cuda
    ptx, mapping = compile_using_nvrtc(
        arch       = '61'
        backend    = 'nvrtc'
        base       = '//\n// Generated by NVIDIA NVVM Compiler\n//\n// Compiler Build ID: CL-31968024\n// Cuda compilation tools, release 12.0, V12.0.76\n// Based on NVVM 7.0.1\n//'
        cache_dir  = '/home/lucas/.cupy/kernel_cache'
        cache_in_memory = False
        cu_name    = 'f6e5d8b89fedaa52df30d2fdeab874d1544d8996.cubin.cu'
        enable_cooperative_groups = False
        env        = ('61', ('-I/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/_core/include/cupy/_cccl/cub', '-I/...udacxx', '-DFIRST_PASS=1', '--std=c++11', '-DCUB_DISABLE_BF16_SUPPORT', ...), (12, 0), 'nvrtc', '-arch=sm_61', 'cubin')
        extra_source = '/*  Copyright 2008-2013 NVIDIA Corporation\n *  Copyright 2013 Filipe RNC Maia\n *\n *  Licensed under the Apache Lic...)\n#define CUDART_NAN              __longlong_as_double(0xfff8000000000000ULL)\n\n\n#endif  // CUPY_MATH_CONSTANTS_H\n'
        is_jitify_requested = False
        jitify     = True
        key_src    = b'(\'61\', (\'-I/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/_core/include/cupy/_cccl/cub\'...)\n#define CUDART_NAN              __longlong_as_double(0xfff8000000000000ULL)\n\n\n#endif  // CUPY_MATH_CONSTANTS_H\n'
        log_stream = None
        mod        = <cupy.cuda.function.Module object at 0x7a5f92cf6180>
        name       = 'f6e5d8b89fedaa52df30d2fdeab874d1544d8996.cubin'
        name_expressions = None
        options    = ('-I/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/_core/include/cupy/_cccl/cub', '-I/home/lu...packages/cupy/_core/include/cupy/_cccl/libcudacxx', '-DFIRST_PASS=1', '--std=c++11', '-DCUB_DISABLE_BF16_SUPPORT', ...)
        path       = '/home/lucas/.cupy/kernel_cache/f6e5d8b89fedaa52df30d2fdeab874d1544d8996.cubin'
        source     = '#include <cupy/cuda_workaround.h>\n#include <cupy/complex.cuh>\n#include <cupy/carray.cuh>\n#include <cupy/atomics.cu...ge\n  }\n\n  if (_tid == 0) {\n      type_mid_out& out0 = *(_out0 + blockIdx.x);\n      POST_MAP(aggregate);\n  }\n}\n'
/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/cuda/compiler.py:319: in compile_using_nvrtc
    return _compile(source, options, cu_path,
        _compile   = <function compile_using_nvrtc.<locals>._compile at 0x7a5f92ced080>
        arch       = '61'
        cache_in_memory = False
        cu_file    = <_io.TextIOWrapper name='/tmp/tmp8irf01i3/f6e5d8b89fedaa52df30d2fdeab874d1544d8996.cubin.cu' mode='w' encoding='ANSI_X3.4-1968'>
        cu_path    = '/tmp/tmp8irf01i3/f6e5d8b89fedaa52df30d2fdeab874d1544d8996.cubin.cu'
        filename   = 'f6e5d8b89fedaa52df30d2fdeab874d1544d8996.cubin.cu'
        jitify     = True
        log_stream = None
        name_expressions = None
        options    = ('-I/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/_core/include/cupy/_cccl/cub', '-I/home/lu...packages/cupy/_core/include/cupy/_cccl/libcudacxx', '-DFIRST_PASS=1', '--std=c++11', '-DCUB_DISABLE_BF16_SUPPORT', ...)
        root_dir   = '/tmp/tmp8irf01i3'
        source     = '#include <cupy/cuda_workaround.h>\n#include <cupy/complex.cuh>\n#include <cupy/carray.cuh>\n#include <cupy/atomics.cu...ge\n  }\n\n  if (_tid == 0) {\n      type_mid_out& out0 = *(_out0 + blockIdx.x);\n      POST_MAP(aggregate);\n  }\n}\n'
/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/cuda/compiler.py:284: in _compile
    options, headers, include_names = _jitify_prep(
        arch       = '61'
        cu_path    = '/tmp/tmp8irf01i3/f6e5d8b89fedaa52df30d2fdeab874d1544d8996.cubin.cu'
        jitify     = True
        log_stream = None
        name_expressions = None
        options    = ('-I/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/_core/include/cupy/_cccl/cub', '-I/home/lu...packages/cupy/_core/include/cupy/_cccl/libcudacxx', '-DFIRST_PASS=1', '--std=c++11', '-DCUB_DISABLE_BF16_SUPPORT', ...)
        source     = '#include <cupy/cuda_workaround.h>\n#include <cupy/complex.cuh>\n#include <cupy/carray.cuh>\n#include <cupy/atomics.cu...ge\n  }\n\n  if (_tid == 0) {\n      type_mid_out& out0 = *(_out0 + blockIdx.x);\n      POST_MAP(aggregate);\n  }\n}\n'
/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/cuda/compiler.py:233: in _jitify_prep
    jitify._init_module()
        core       = <module 'cupy._core.core' from '/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/_core/core.cpython-311-x86_64-linux-gnu.so'>
        cu_path    = '/tmp/tmp8irf01i3/f6e5d8b89fedaa52df30d2fdeab874d1544d8996.cubin.cu'
        jitify     = <module 'cupy.cuda.jitify' from '/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/cuda/jitify.cpython-311-x86_64-linux-gnu.so'>
        options    = ('-I/home/lucas/mambaforge/envs/scipy-dev/lib/python3.11/site-packages/cupy/_core/include/cupy/_cccl/cub', '-I/home/lu...packages/cupy/_core/include/cupy/_cccl/libcudacxx', '-DFIRST_PASS=1', '--std=c++11', '-DCUB_DISABLE_BF16_SUPPORT', ...)
        source     = '#include <cupy/cuda_workaround.h>\n#include <cupy/complex.cuh>\n#include <cupy/carray.cuh>\n#include <cupy/atomics.cu...ge\n  }\n\n  if (_tid == 0) {\n      type_mid_out& out0 = *(_out0 + blockIdx.x);\n      POST_MAP(aggregate);\n  }\n}\n'
cupy/cuda/jitify.pyx:212: in cupy.cuda.jitify._init_module
    ???
cupy/cuda/jitify.pyx:233: in cupy.cuda.jitify._init_module
    ???
cupy/cuda/jitify.pyx:209: in cupy.cuda.jitify._init_cupy_headers
    ???
cupy/cuda/jitify.pyx:192: in cupy.cuda.jitify._init_cupy_headers_from_scratch
    ???
cupy/cuda/jitify.pyx:264: in cupy.cuda.jitify.jitify
    ???
E   RuntimeError: Runtime compilation failed
------------------------------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------------------------------
---------------------------------------------------
--- JIT compile log for cupy_jitify_exercise ---
---------------------------------------------------
cub/util_cpp_dialect.cuh(143): warning #161-D: unrecognized #pragma

Remark: The warnings can be suppressed with "-diag-suppress <warning-number>"

std/barrier(16): catastrophic error: #error directive: "CUDA synchronization primitives are only supported for sm_70 and up."

1 catastrophic error detected in the compilation of "cupy_jitify_exercise".
Compilation terminated.

---------------------------------------------------

To Reproduce

import cupy
x = cupy.array([1, 2])
cupy.all(x)

Installation

Conda-Forge (conda install ...)

Environment

OS                           : Linux-6.5.0-26-generic-x86_64-with-glibc2.35
Python Version               : 3.11.8
CuPy Version                 : 13.0.0
CuPy Platform                : NVIDIA CUDA
NumPy Version                : 1.26.4
SciPy Version                : None
Cython Build Version         : 0.29.37
Cython Runtime Version       : 3.0.9
CUDA Root                    : /usr/local/cuda
nvcc PATH                    : /usr/local/cuda/bin/nvcc
CUDA Build Version           : 12000
CUDA Driver Version          : 12000
CUDA Runtime Version         : 12000 (linked to CuPy) / 12040 (locally installed)
cuBLAS Version               : (available)
cuFFT Version                : 11000
cuRAND Version               : 10301
cuSOLVER Version             : (11, 4, 2)
cuSPARSE Version             : (available)
NVRTC Version                : (12, 4)
Thrust Version               : 200001
CUB Build Version            : 200200
Jitify Build Version         : c08b8c6
cuDNN Build Version          : None
cuDNN Version                : None
NCCL Build Version           : None
NCCL Runtime Version         : None
cuTENSOR Version             : None
cuSPARSELt Build Version     : None
Device 0 Name                : NVIDIA GeForce GTX 1060 6GB
Device 0 Compute Capability  : 61
Device 0 PCI Bus ID          : 0000:08:00.0

Additional Information

my env:

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
accessible-pygments       0.0.4              pyhd8ed1ab_0    conda-forge
alabaster                 0.7.16             pyhd8ed1ab_0    conda-forge
alsa-lib                  1.2.11               hd590300_1    conda-forge
anyio                     4.3.0              pyhd8ed1ab_0    conda-forge
argon2-cffi               23.1.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0          py311h459d7ec_4    conda-forge
array-api-strict          1.1                pyhd8ed1ab_0    conda-forge
arrow                     1.3.0              pyhd8ed1ab_0    conda-forge
asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
asv                       0.6.3           py311hb755f60_0    conda-forge
asv_runner                0.2.1              pyhd8ed1ab_0    conda-forge
attr                      2.5.1                h166bdaf_1    conda-forge
attrs                     23.2.0             pyh71513ae_0    conda-forge
babel                     2.14.0             pyhd8ed1ab_0    conda-forge
backports.zoneinfo        0.2.1           py311h38be061_8    conda-forge
beautifulsoup4            4.12.3             pyha770c72_0    conda-forge
beniget                   0.4.1              pyhd8ed1ab_0    conda-forge
binutils                  2.40                 hdd6e379_0    conda-forge
binutils_impl_linux-64    2.40                 hf600244_0    conda-forge
binutils_linux-64         2.40                 hdade7a5_3    conda-forge
bleach                    6.1.0              pyhd8ed1ab_0    conda-forge
brotli                    1.1.0                hd590300_1    conda-forge
brotli-bin                1.1.0                hd590300_1    conda-forge
brotli-python             1.1.0           py311hb755f60_1    conda-forge
bzip2                     1.0.8                hd590300_5    conda-forge
c-compiler                1.7.0                hd590300_0    conda-forge
ca-certificates           2024.2.2             hbcca054_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cairo                     1.18.0               h3faef2a_0    conda-forge
certifi                   2024.2.2           pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py311hb3a22ac_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
click                     8.1.7           unix_pyh707e725_0    conda-forge
cloudpickle               3.0.0              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
colorlog                  6.8.2           py311h38be061_0    conda-forge
comm                      0.2.2              pyhd8ed1ab_0    conda-forge
compilers                 1.7.0                ha770c72_0    conda-forge
contourpy                 1.2.0           py311h9547e67_0    conda-forge
coverage                  7.4.4           py311h459d7ec_0    conda-forge
cuda-nvrtc                12.0.76              hd3aeb46_2    conda-forge
cuda-version              12.0                 hffde075_3    conda-forge
cupy                      13.0.0          py311h8a5e998_3    conda-forge
cupy-core                 13.0.0          py311h84cfafc_3    conda-forge
cxx-compiler              1.7.0                h00ab1b0_0    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
cython                    3.0.9           py311hb755f60_0    conda-forge
cython-lint               0.16.0             pyhd8ed1ab_0    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
debugpy                   1.8.1           py311hb755f60_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
distlib                   0.3.8              pyhd8ed1ab_0    conda-forge
docutils                  0.20.1          py311h38be061_3    conda-forge
doit                      0.36.0             pyhd8ed1ab_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
exceptiongroup            1.2.0              pyhd8ed1ab_2    conda-forge
execnet                   2.0.2              pyhd8ed1ab_0    conda-forge
executing                 2.0.1              pyhd8ed1ab_0    conda-forge
expat                     2.6.2                h59595ed_0    conda-forge
fastrlock                 0.8.2           py311hb755f60_2    conda-forge
filelock                  3.13.2             pyhd8ed1ab_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 h77eed37_1    conda-forge
fontconfig                2.14.2               h14ed4e7_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.50.0          py311h459d7ec_0    conda-forge
fortran-compiler          1.7.0                heb67821_0    conda-forge
fqdn                      1.5.1              pyhd8ed1ab_0    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
gast                      0.5.4              pyhd8ed1ab_0    conda-forge
gcc                       12.3.0               h95e488c_3    conda-forge
gcc_impl_linux-64         12.3.0               he2b93b0_5    conda-forge
gcc_linux-64              12.3.0               h6477408_3    conda-forge
gettext                   0.21.1               h27087fc_0    conda-forge
gfortran                  12.3.0               h7389182_3    conda-forge
gfortran_impl_linux-64    12.3.0               hfcedea8_5    conda-forge
gfortran_linux-64         12.3.0               h617cb40_3    conda-forge
gh                        2.45.0               ha8f183a_0    conda-forge
glib                      2.80.0               hf2295e7_1    conda-forge
glib-tools                2.80.0               hde27a5a_1    conda-forge
gmp                       6.3.0                h59595ed_1    conda-forge
gmpy2                     2.1.2           py311h6a5fa03_1    conda-forge
graphite2                 1.3.13            h58526e2_1001    conda-forge
greenlet                  3.0.3           py311hb755f60_0    conda-forge
gst-plugins-base          1.22.9               hfa15dee_1    conda-forge
gstreamer                 1.22.9               h98fc4e7_1    conda-forge
gxx                       12.3.0               h95e488c_3    conda-forge
gxx_impl_linux-64         12.3.0               he2b93b0_5    conda-forge
gxx_linux-64              12.3.0               h4a1b8e8_3    conda-forge
harfbuzz                  8.3.0                h3d44ed6_0    conda-forge
hypothesis                6.99.13            pyha770c72_0    conda-forge
icu                       73.2                 h59595ed_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
imagesize                 1.4.1              pyhd8ed1ab_0    conda-forge
importlib-metadata        7.1.0              pyha770c72_0    conda-forge
importlib_metadata        7.1.0                hd8ed1ab_0    conda-forge
importlib_resources       6.4.0              pyhd8ed1ab_0    conda-forge
iniconfig                 2.0.0              pyhd8ed1ab_0    conda-forge
ipykernel                 6.29.3             pyhd33586a_0    conda-forge
ipython                   8.22.2             pyh707e725_0    conda-forge
isoduration               20.11.0            pyhd8ed1ab_0    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.3              pyhd8ed1ab_0    conda-forge
json5                     0.9.24             pyhd8ed1ab_0    conda-forge
jsonpointer               2.4             py311h38be061_3    conda-forge
jsonschema                4.21.1             pyhd8ed1ab_0    conda-forge
jsonschema-specifications 2023.12.1          pyhd8ed1ab_0    conda-forge
jsonschema-with-format-nongpl 4.21.1             pyhd8ed1ab_0    conda-forge
jupyter-cache             1.0.0              pyhd8ed1ab_0    conda-forge
jupyter_client            8.6.1              pyhd8ed1ab_0    conda-forge
jupyter_core              5.7.2           py311h38be061_0    conda-forge
jupyter_events            0.10.0             pyhd8ed1ab_0    conda-forge
jupyter_server            2.13.0             pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.5.3              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.3.0              pyhd8ed1ab_1    conda-forge
jupyterlab_server         2.25.4             pyhd8ed1ab_0    conda-forge
jupyterlite-core          0.2.3              pyhd8ed1ab_0    conda-forge
jupyterlite-sphinx        0.13.1             pyhd8ed1ab_0    conda-forge
jupytext                  1.16.1             pyhd8ed1ab_0    conda-forge
kernel-headers_linux-64   2.6.32              he073ed8_17    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.5           py311h9547e67_1    conda-forge
krb5                      1.21.2               h659d440_0    conda-forge
lame                      3.100             h166bdaf_1003    conda-forge
lcms2                     2.16                 hb7c19ff_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libblas                   3.9.0           21_linux64_openblas    conda-forge
libbrotlicommon           1.1.0                hd590300_1    conda-forge
libbrotlidec              1.1.0                hd590300_1    conda-forge
libbrotlienc              1.1.0                hd590300_1    conda-forge
libcap                    2.69                 h0f662aa_0    conda-forge
libcblas                  3.9.0           21_linux64_openblas    conda-forge
libclang-cpp15            15.0.7          default_h127d8a8_5    conda-forge
libclang13                18.1.2          default_h5d6823c_1    conda-forge
libcublas                 12.0.1.189           hd3aeb46_3    conda-forge
libcufft                  11.0.0.21            hd3aeb46_2    conda-forge
libcups                   2.3.3                h4637d8d_4    conda-forge
libcurand                 10.3.1.50            hd3aeb46_1    conda-forge
libcusolver               11.4.2.57            hd3aeb46_2    conda-forge
libcusparse               12.0.0.76            hd3aeb46_2    conda-forge
libdeflate                1.20                 hd590300_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libevent                  2.1.12               hf998b51_1    conda-forge
libexpat                  2.6.2                h59595ed_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libflac                   1.4.3                h59595ed_0    conda-forge
libgcc-devel_linux-64     12.3.0             h8bca6fd_105    conda-forge
libgcc-ng                 13.2.0               h807b86a_5    conda-forge
libgcrypt                 1.10.3               hd590300_0    conda-forge
libgfortran-ng            13.2.0               h69a702a_5    conda-forge
libgfortran5              13.2.0               ha4646dd_5    conda-forge
libglib                   2.80.0               hf2295e7_1    conda-forge
libgomp                   13.2.0               h807b86a_5    conda-forge
libgpg-error              1.48                 h71f35ed_0    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
liblapack                 3.9.0           21_linux64_openblas    conda-forge
libllvm15                 15.0.7               hb3ce162_4    conda-forge
libllvm18                 18.1.2               h2448989_0    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libnvjitlink              12.0.76              hd3aeb46_2    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.26          pthreads_h413a1c8_0    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpng                    1.6.43               h2797004_0    conda-forge
libpq                     16.2                 h33b98f1_1    conda-forge
libsanitizer              12.3.0               h0f45ef3_5    conda-forge
libsndfile                1.2.2                hc60ed4a_1    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsqlite                 3.45.2               h2797004_0    conda-forge
libstdcxx-devel_linux-64  12.3.0             h8bca6fd_105    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_5    conda-forge
libsystemd0               255                  h3516f8a_1    conda-forge
libtiff                   4.6.0                h1dd3fc0_3    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libwebp-base              1.3.2                hd590300_0    conda-forge
libxcb                    1.15                 h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libxkbcommon              1.7.0                h662e7e4_0    conda-forge
libxml2                   2.12.6               h232c23b_1    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
markdown-it-py            3.0.0              pyhd8ed1ab_0    conda-forge
markupsafe                2.1.5           py311h459d7ec_0    conda-forge
matplotlib                3.8.3           py311h38be061_0    conda-forge
matplotlib-base           3.8.3           py311h54ef318_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mdit-py-plugins           0.4.0              pyhd8ed1ab_0    conda-forge
mdurl                     0.1.2              pyhd8ed1ab_0    conda-forge
meson                     1.4.0              pyhd8ed1ab_0    conda-forge
meson-python              0.15.0             pyh0c530f3_0    conda-forge
mistune                   3.0.2              pyhd8ed1ab_0    conda-forge
mpc                       1.3.1                hfe3b2da_0    conda-forge
mpfr                      4.2.1                h9458935_0    conda-forge
mpg123                    1.32.4               h59595ed_0    conda-forge
mpmath                    1.3.0              pyhd8ed1ab_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mypy                      1.9.0           py311h459d7ec_0    conda-forge
mypy_extensions           1.0.0              pyha770c72_0    conda-forge
mysql-common              8.3.0                hf1915f5_4    conda-forge
mysql-libs                8.3.0                hca2cd23_4    conda-forge
myst-nb                   1.0.0              pyhd8ed1ab_0    conda-forge
myst-parser               2.0.0              pyhd8ed1ab_0    conda-forge
nbclient                  0.10.0             pyhd8ed1ab_0    conda-forge
nbconvert-core            7.16.3             pyhd8ed1ab_0    conda-forge
nbformat                  5.10.3             pyhd8ed1ab_0    conda-forge
ncurses                   6.4.20240210         h59595ed_0    conda-forge
nest-asyncio              1.6.0              pyhd8ed1ab_0    conda-forge
ninja                     1.11.1               h924138e_0    conda-forge
nspr                      4.35                 h27087fc_0    conda-forge
nss                       3.98                 h1d7d5a4_0    conda-forge
numpy                     1.26.4          py311h64a7726_0    conda-forge
numpydoc                  1.6.0              pyhd8ed1ab_0    conda-forge
openblas                  0.3.26          pthreads_h7a3da1a_0    conda-forge
openjpeg                  2.5.2                h488ebb8_0    conda-forge
openssl                   3.2.1                hd590300_1    conda-forge
overrides                 7.7.0              pyhd8ed1ab_0    conda-forge
packaging                 24.0               pyhd8ed1ab_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pcre2                     10.43                hcad00b1_0    conda-forge
pexpect                   4.9.0              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    10.2.0          py311ha6c5da5_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
pixman                    0.43.2               h59595ed_0    conda-forge
pkg-config                0.29.2            h36c2ea0_1008    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_1    conda-forge
platformdirs              4.2.0              pyhd8ed1ab_0    conda-forge
pluggy                    1.4.0              pyhd8ed1ab_0    conda-forge
ply                       3.11                       py_1    conda-forge
pooch                     1.8.1              pyhd8ed1ab_0    conda-forge
prometheus_client         0.20.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.42             pyha770c72_0    conda-forge
psutil                    5.9.8           py311h459d7ec_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pulseaudio-client         17.0                 hb77b528_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pybind11                  2.11.1          py311h9547e67_2    conda-forge
pybind11-global           2.11.1          py311h9547e67_2    conda-forge
pycodestyle               2.11.1             pyhd8ed1ab_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydata-sphinx-theme       0.15.2             pyhd8ed1ab_0    conda-forge
pydevtool                 0.3.0              pyhd8ed1ab_0    conda-forge
pygments                  2.17.2             pyhd8ed1ab_0    conda-forge
pympler                   1.0.1              pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.2              pyhd8ed1ab_0    conda-forge
pyproject-metadata        0.7.1              pyhd8ed1ab_0    conda-forge
pyqt                      5.15.9          py311hf0fb5b6_5    conda-forge
pyqt5-sip                 12.12.2         py311hb755f60_5    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
pytest                    8.1.1              pyhd8ed1ab_0    conda-forge
pytest-cov                4.1.0              pyhd8ed1ab_0    conda-forge
pytest-timeout            2.2.0              pyhd8ed1ab_0    conda-forge
pytest-xdist              3.5.0              pyhd8ed1ab_0    conda-forge
python                    3.11.8          hab00c5b_0_cpython    conda-forge
python-dateutil           2.9.0              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.19.1             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.7              pyhd8ed1ab_0    conda-forge
python_abi                3.11                    4_cp311    conda-forge
pythran                   0.15.0          py311h92ebd52_1    conda-forge
pytz                      2024.1             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1           py311h459d7ec_1    conda-forge
pyzmq                     25.1.2          py311h34ded2d_0    conda-forge
qt-main                   5.15.8              h112747c_20    conda-forge
readline                  8.2                  h8228510_1    conda-forge
referencing               0.34.0             pyhd8ed1ab_0    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
rfc3339-validator         0.1.4              pyhd8ed1ab_0    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
rich                      13.7.1             pyhd8ed1ab_0    conda-forge
rich-click                1.7.4              pyhd8ed1ab_0    conda-forge
rpds-py                   0.18.0          py311h46250e7_0    conda-forge
ruff                      0.3.4           py311h7145743_0    conda-forge
send2trash                1.8.2              pyh41d4057_0    conda-forge
setuptools                67.1.0             pyhd8ed1ab_0    conda-forge
sip                       6.7.12          py311hb755f60_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sniffio                   1.3.1              pyhd8ed1ab_0    conda-forge
snowballstemmer           2.2.0              pyhd8ed1ab_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.5                pyhd8ed1ab_1    conda-forge
sphinx                    7.2.6              pyhd8ed1ab_0    conda-forge
sphinx-design             0.5.0              pyhd8ed1ab_0    conda-forge
sphinxcontrib-applehelp   1.0.8              pyhd8ed1ab_0    conda-forge
sphinxcontrib-devhelp     1.0.6              pyhd8ed1ab_0    conda-forge
sphinxcontrib-htmlhelp    2.0.5              pyhd8ed1ab_0    conda-forge
sphinxcontrib-jsmath      1.0.1              pyhd8ed1ab_0    conda-forge
sphinxcontrib-qthelp      1.0.7              pyhd8ed1ab_0    conda-forge
sphinxcontrib-serializinghtml 1.1.10             pyhd8ed1ab_0    conda-forge
sqlalchemy                2.0.29          py311h459d7ec_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
sysroot_linux-64          2.12                he073ed8_17    conda-forge
tabulate                  0.9.0              pyhd8ed1ab_1    conda-forge
terminado                 0.18.1             pyh0d859eb_0    conda-forge
threadpoolctl             3.4.0              pyhc1e730c_0    conda-forge
tinycss2                  1.2.1              pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tokenize-rt               5.2.0              pyhd8ed1ab_1    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tornado                   6.4             py311h459d7ec_0    conda-forge
traitlets                 5.14.2             pyhd8ed1ab_0    conda-forge
types-psutil              5.9.5.6            pyhd8ed1ab_0    conda-forge
types-python-dateutil     2.9.0.20240316     pyhd8ed1ab_0    conda-forge
typing-extensions         4.10.0               hd8ed1ab_0    conda-forge
typing_extensions         4.10.0             pyha770c72_0    conda-forge
typing_utils              0.1.0              pyhd8ed1ab_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
uri-template              1.3.0              pyhd8ed1ab_0    conda-forge
urllib3                   2.2.1              pyhd8ed1ab_0    conda-forge
virtualenv                20.25.1            pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.13             pyhd8ed1ab_0    conda-forge
webcolors                 1.13               pyhd8ed1ab_0    conda-forge
webencodings              0.5.1              pyhd8ed1ab_2    conda-forge
websocket-client          1.7.0              pyhd8ed1ab_0    conda-forge
wheel                     0.43.0             pyhd8ed1ab_0    conda-forge
xcb-util                  0.4.0                hd590300_1    conda-forge
xcb-util-image            0.4.0                h8ee46fc_1    conda-forge
xcb-util-keysyms          0.4.0                h8ee46fc_1    conda-forge
xcb-util-renderutil       0.3.9                hd590300_1    conda-forge
xcb-util-wm               0.4.1                h8ee46fc_1    conda-forge
xkeyboard-config          2.41                 hd590300_0    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.1.1                hd590300_0    conda-forge
xorg-libsm                1.2.4                h7391055_0    conda-forge
xorg-libx11               1.8.7                h8ee46fc_0    conda-forge
xorg-libxau               1.0.11               hd590300_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h0b41bf4_2    conda-forge
xorg-libxrender           0.9.11               hd590300_0    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h0b41bf4_1003    conda-forge
xorg-xf86vidmodeproto     2.3.1             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
zeromq                    4.3.5                h59595ed_1    conda-forge
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               hd590300_5    conda-forge
zstd                      1.5.5                hfc55251_0    conda-forge
leofang commented 7 months ago

I think this has been fixed in #8200 and will be available in CuPy v13.1.0. Any chance you can build from the latest main branch and confirm?

lucascolley commented 7 months ago

Any chance you can build from the latest main branch and confirm?

What is the best way to do this with conda-forge? Just pip install git+https://github.com/cupy/cupy.git?

leofang commented 7 months ago

That should work because I see you already have CUDA Toolkit installed locally (/usr/local/cuda). You may want to use a fresh conda env to test this, to avoid installing CUDA packages from conda-forge. Also, setting this should help accelerate compilation:

CUPY_NVCC_GENERATE_CODE="arch=compute_61,code=sm_61"

see https://docs.cupy.dev/en/stable/reference/environment.html#envvar-CUPY_NVCC_GENERATE_CODE.

lucascolley commented 7 months ago

Looks like my environment still needs some change:

Collecting git+https://github.com/cupy/cupy.git
  Cloning https://github.com/cupy/cupy.git to /tmp/pip-req-build-5lgrbb8e
  Running command git clone --filter=blob:none --quiet https://github.com/cupy/cupy.git /tmp/pip-req-build-5lgrbb8e
  Resolved https://github.com/cupy/cupy.git to commit 028889eef3ba110829d677726348aa0f75aadb4e
  Running command git submodule update --init --recursive -q
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy<1.29,>=1.22 in /home/lucas/mambaforge/envs/cupy-test/lib/python3.11/site-packages (from cupy==13.0.0rc1) (1.26.4)
Collecting fastrlock>=0.5 (from cupy==13.0.0rc1)
  Using cached fastrlock-0.8.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.metadata (9.3 kB)
Using cached fastrlock-0.8.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl (52 kB)
Building wheels for collected packages: cupy
  Building wheel for cupy (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [122 lines of output]
      Generating cache key from header files...
      Cache key (1545 files matching /tmp/pip-req-build-5lgrbb8e/cupy/_core/include/**): d156d4e64becd06cf23cd475b2ea91c4574dd026
      Clearing directory: /tmp/pip-req-build-5lgrbb8e/cupy/.data

      -------- Configuring Module: cuda --------

      -------- Configuring Module: cusolver --------

      -------- Configuring Module: cudnn --------
      /tmp/tmp6v0u1th7/a.cpp:1:10: fatal error: cudnn.h: No such file or directory
          1 | #include <cudnn.h>
            |          ^~~~~~~~~
      compilation terminated.
      command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

      -------- Configuring Module: nccl --------
      /tmp/tmp86566xpf/a.cpp:1:10: fatal error: nccl.h: No such file or directory
          1 | #include <nccl.h>
            |          ^~~~~~~~
      compilation terminated.
      command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

      -------- Configuring Module: nvtx --------

      -------- Configuring Module: cutensor --------
      /tmp/tmpoiv5w6z3/a.cpp:1:10: fatal error: cutensor.h: No such file or directory
          1 | #include <cutensor.h>
            |          ^~~~~~~~~~~~
      compilation terminated.
      command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

      -------- Configuring Module: cub --------

      -------- Configuring Module: jitify --------
      /home/lucas/mambaforge/envs/cupy-test/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: cannot find -lcuda: No such file or directory
      collect2: error: ld returned 1 exit status
      Cannot build a stub file.
      Original error: command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-c++' failed with exit code 1

      -------- Configuring Module: random --------

      -------- Configuring Module: thrust --------

      -------- Configuring Module: cusparselt --------
      /tmp/tmpew_e5zf2/a.cpp:1:10: fatal error: cusparseLt.h: No such file or directory
          1 | #include <cusparseLt.h>
            |          ^~~~~~~~~~~~~~
      compilation terminated.
      command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

      -------- Configuring Module: dlpack --------
      /home/lucas/mambaforge/envs/cupy-test/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /usr/local/cuda/lib64/libcudart.so: undefined reference to `memcpy@GLIBC_2.14'
      /home/lucas/mambaforge/envs/cupy-test/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /usr/local/cuda/lib64/libcudart.so: undefined reference to `clock_gettime@GLIBC_2.17'
      collect2: error: ld returned 1 exit status
      **************************************************
      *** WARNING: Cannot check compute capability
      Cannot build a stub file.
      Original error: command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-c++' failed with exit code 1
      **************************************************

      ************************************************************
      * CuPy Configuration Summary                               *
      ************************************************************

      Build Environment:
        Include directories: ['/tmp/pip-req-build-5lgrbb8e/cupy/_core/include/cupy/_cccl/libcudacxx', '/tmp/pip-req-build-5lgrbb8e/cupy/_core/include/cupy/_cccl/thrust', '/tmp/pip-req-build-5lgrbb8e/cupy/_core/include/cupy/_cccl/cub', '/tmp/pip-req-build-5lgrbb8e/cupy/_core/include', '/usr/local/cuda/include']
        Library directories: ['/usr/local/cuda/lib64']
        nvcc command       : ['/usr/local/cuda/bin/nvcc']
        hipcc command      : (not found)

      Environment Variables:
        CFLAGS          : -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/lucas/mambaforge/envs/cupy-test/include
        LDFLAGS         : -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined -Wl,-rpath,/home/lucas/mambaforge/envs/cupy-test/lib -Wl,-rpath-link,/home/lucas/mambaforge/envs/cupy-test/lib -L/home/lucas/mambaforge/envs/cupy-test/lib
        LIBRARY_PATH    : (none)
        CUDA_PATH       : (none)
        NVCC            : (none)
        HIPCC           : (none)
        ROCM_HOME       : (none)

      Modules:
        cuda      : Yes (version 12040)
        cusolver  : Yes
        cudnn     : No
          -> Include files not found: ['cudnn.h']
          -> Check your CFLAGS environment variable.
        nccl      : No
          -> Include files not found: ['nccl.h']
          -> Check your CFLAGS environment variable.
        nvtx      : Yes
        cutensor  : No
          -> Include files not found: ['cutensor.h']
          -> Check your CFLAGS environment variable.
        cub       : Yes (version 200200)
        jitify    : No
          -> Cannot link libraries: ['cuda', 'nvrtc', 'cudart_static', 'pthread', 'rt', 'dl']
          -> Check your LDFLAGS environment variable.
        random    : Yes
        thrust    : Yes (version 200200)
        cusparselt: No
          -> Include files not found: ['cusparseLt.h']
          -> Check your CFLAGS environment variable.
        dlpack    : Yes

      WARNING: Some modules could not be configured.
      CuPy will be installed without these modules.
      Please refer to the Installation Guide for details:
      https://docs.cupy.dev/en/stable/install.html

      ************************************************************

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-5lgrbb8e/setup.py", line 93, in <module>
          ext_modules = cupy_setup_build.get_ext_modules(True, ctx)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-req-build-5lgrbb8e/install/cupy_builder/cupy_setup_build.py", line 475, in get_ext_modules
          extensions = make_extensions(ctx, compiler, use_cython)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-req-build-5lgrbb8e/install/cupy_builder/cupy_setup_build.py", line 328, in make_extensions
          raise Exception('Your CUDA environment is invalid. '
      Exception: Your CUDA environment is invalid. Please check above error log.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cupy
  Running setup.py clean for cupy
  error: subprocess-exited-with-error

  × python setup.py clean did not run successfully.
  │ exit code: 1
  ╰─> [122 lines of output]
      Generating cache key from header files...
      Cache key (1545 files matching /tmp/pip-req-build-5lgrbb8e/cupy/_core/include/**): d156d4e64becd06cf23cd475b2ea91c4574dd026
      Clearing directory: /tmp/pip-req-build-5lgrbb8e/cupy/.data

      -------- Configuring Module: cuda --------

      -------- Configuring Module: cusolver --------

      -------- Configuring Module: cudnn --------
      /tmp/tmpe5f81sv_/a.cpp:1:10: fatal error: cudnn.h: No such file or directory
          1 | #include <cudnn.h>
            |          ^~~~~~~~~
      compilation terminated.
      command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

      -------- Configuring Module: nccl --------
      /tmp/tmp5mssrxxm/a.cpp:1:10: fatal error: nccl.h: No such file or directory
          1 | #include <nccl.h>
            |          ^~~~~~~~
      compilation terminated.
      command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

      -------- Configuring Module: nvtx --------

      -------- Configuring Module: cutensor --------
      /tmp/tmph7vsxk2x/a.cpp:1:10: fatal error: cutensor.h: No such file or directory
          1 | #include <cutensor.h>
            |          ^~~~~~~~~~~~
      compilation terminated.
      command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

      -------- Configuring Module: cub --------

      -------- Configuring Module: jitify --------
      /home/lucas/mambaforge/envs/cupy-test/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: cannot find -lcuda: No such file or directory
      collect2: error: ld returned 1 exit status
      Cannot build a stub file.
      Original error: command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-c++' failed with exit code 1

      -------- Configuring Module: random --------

      -------- Configuring Module: thrust --------

      -------- Configuring Module: cusparselt --------
      /tmp/tmpl2e5yyx5/a.cpp:1:10: fatal error: cusparseLt.h: No such file or directory
          1 | #include <cusparseLt.h>
            |          ^~~~~~~~~~~~~~
      compilation terminated.
      command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

      -------- Configuring Module: dlpack --------
      /home/lucas/mambaforge/envs/cupy-test/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /usr/local/cuda/lib64/libcudart.so: undefined reference to `memcpy@GLIBC_2.14'
      /home/lucas/mambaforge/envs/cupy-test/bin/../lib/gcc/x86_64-conda-linux-gnu/12.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /usr/local/cuda/lib64/libcudart.so: undefined reference to `clock_gettime@GLIBC_2.17'
      collect2: error: ld returned 1 exit status
      **************************************************
      *** WARNING: Cannot check compute capability
      Cannot build a stub file.
      Original error: command '/home/lucas/mambaforge/envs/cupy-test/bin/x86_64-conda-linux-gnu-c++' failed with exit code 1
      **************************************************

      ************************************************************
      * CuPy Configuration Summary                               *
      ************************************************************

      Build Environment:
        Include directories: ['/tmp/pip-req-build-5lgrbb8e/cupy/_core/include/cupy/_cccl/libcudacxx', '/tmp/pip-req-build-5lgrbb8e/cupy/_core/include/cupy/_cccl/thrust', '/tmp/pip-req-build-5lgrbb8e/cupy/_core/include/cupy/_cccl/cub', '/tmp/pip-req-build-5lgrbb8e/cupy/_core/include', '/usr/local/cuda/include']
        Library directories: ['/usr/local/cuda/lib64']
        nvcc command       : ['/usr/local/cuda/bin/nvcc']
        hipcc command      : (not found)

      Environment Variables:
        CFLAGS          : -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/lucas/mambaforge/envs/cupy-test/include
        LDFLAGS         : -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined -Wl,-rpath,/home/lucas/mambaforge/envs/cupy-test/lib -Wl,-rpath-link,/home/lucas/mambaforge/envs/cupy-test/lib -L/home/lucas/mambaforge/envs/cupy-test/lib
        LIBRARY_PATH    : (none)
        CUDA_PATH       : (none)
        NVCC            : (none)
        HIPCC           : (none)
        ROCM_HOME       : (none)

      Modules:
        cuda      : Yes (version 12040)
        cusolver  : Yes
        cudnn     : No
          -> Include files not found: ['cudnn.h']
          -> Check your CFLAGS environment variable.
        nccl      : No
          -> Include files not found: ['nccl.h']
          -> Check your CFLAGS environment variable.
        nvtx      : Yes
        cutensor  : No
          -> Include files not found: ['cutensor.h']
          -> Check your CFLAGS environment variable.
        cub       : Yes (version 200200)
        jitify    : No
          -> Cannot link libraries: ['cuda', 'nvrtc', 'cudart_static', 'pthread', 'rt', 'dl']
          -> Check your LDFLAGS environment variable.
        random    : Yes
        thrust    : Yes (version 200200)
        cusparselt: No
          -> Include files not found: ['cusparseLt.h']
          -> Check your CFLAGS environment variable.
        dlpack    : Yes

      WARNING: Some modules could not be configured.
      CuPy will be installed without these modules.
      Please refer to the Installation Guide for details:
      https://docs.cupy.dev/en/stable/install.html

      ************************************************************

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-5lgrbb8e/setup.py", line 93, in <module>
          ext_modules = cupy_setup_build.get_ext_modules(True, ctx)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-req-build-5lgrbb8e/install/cupy_builder/cupy_setup_build.py", line 475, in get_ext_modules
          extensions = make_extensions(ctx, compiler, use_cython)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-req-build-5lgrbb8e/install/cupy_builder/cupy_setup_build.py", line 328, in make_extensions
          raise Exception('Your CUDA environment is invalid. '
      Exception: Your CUDA environment is invalid. Please check above error log.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed cleaning build dir for cupy
Failed to build cupy
ERROR: Could not build wheels for cupy, which is required to install pyproject.toml-based projects
leofang commented 7 months ago

You may want to avoid using conda-forge compiler? I don't understand how CUDA was found but -lcuda (linking to the driver libcuda.so) would fail...

leofang commented 7 months ago

Another thing to try is to set the env var export CUDA_PATH=/usr/local/cuda and retry...

lucascolley commented 7 months ago

Another thing to try is to set the env var export CUDA_PATH=/usr/local/cuda and retry...

Still fails with the same error sadly. I suppose I can try using pip instead, but I would like to get conda-forge working.

lucascolley commented 7 months ago

I think this has been fixed in https://github.com/cupy/cupy/pull/8200 and will be available in CuPy v13.1.0. Any chance you can build from the latest main branch and confirm?

Built in a pip env and can confirm that the problem is gone on main. Thanks! I would like to get conda-forge working if possible, but not urgent.

leofang commented 6 months ago

Thanks for confirming, @lucascolley! CuPy doesn't have Maxwell or Pascal GPUs in the CI, so we need to rely on users like you to help confirm a fix..

I would like to understand better: What do you mean by "getting conda-forge working"? We do maintain cupy-feedstock on conda-forge, so I'd like to know what's missing.

lucascolley commented 6 months ago

What do you mean by "getting conda-forge working"?

I just mean that I'd like to figure out what is wrong with my environment that is causing CuPy to error out. I understand that it's tricky to help as there are a lot of moving parts. Anyway, I am doing okay with my venv, so no worries if you have better things to be spending time on :)

leofang commented 6 months ago

If you write a dummy program that calls a driver API (thus requires linking to libcuda.so), and compile it with the conda-forge toolchain (gcc/nvcc), it might give you some clue. It works in cupy-feedstocks, because we link to the driver stub from cuda-driver-dev (for CUDA 12).

koolo233 commented 6 months ago

Thank you @leofang and @lucascolley . pip install git+https://github.com/cupy/cupy.git works for me (Tesla P40 + CUDA 11.7).