Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS) (found version "12.6") Error with CUDA 12.4 and 12.6 (part 3) #59

Open
1 task done
q10 opened this issue Dec 18, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@q10
Copy link

q10 commented Dec 18, 2024

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

This is a followup to conda-forge/cuda-nvcc-feedstock#56 and #58. Unlike the other two issues, all packages have been installed using the conda-forge channel.

We are trying to build FBGEMM against the CUDA 12.6 (pytorch/FBGEMM#3503), and are running into the following error:

-- Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS) (found version "12.6")
CMake Warning at /github/home/miniconda/envs/build_binary/lib/python3.13/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:31 (message):
  PyTorch: CUDA cannot be found.  Depending on whether you are building
  PyTorch or a PyTorch dependent library, the next warning / error will give
  you more info.
Call Stack (most recent call first):
  /github/home/miniconda/envs/build_binary/lib/python3.13/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /github/home/miniconda/envs/build_binary/lib/python3.13/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  /__w/FBGEMM/FBGEMM/cmake/modules/PyTorchSetup.cmake:14 (find_package)
  CMakeLists.txt:78 (include)

Contrary to conda-forge/cuda-nvcc-feedstock#56, we are now installing CUDA using the conda-forge channel, i.e.

conda install --force-reinstall -n build_env -c conda-forge -y cuda=12.6.3

We did notice that for CUDA 12.6, when we look for cuda.h, we see:

(base) bash-5.2# find / -name cuda.h
/root/miniconda/envs/build_env/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h
/root/miniconda/envs/build_env/targets/x86_64-linux/include/cuda.h
/root/miniconda/pkgs/cuda-cudart-dev_linux-64-12.4.127-h85509e4_2/targets/x86_64-linux/include/cuda.h
/root/miniconda/pkgs/kernel-headers_linux-64-3.10.0-he073ed8_18/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h

likewise with CUDA 12.4, we have:

(base) bash-5.2# find / -name cuda.h
/root/miniconda/envs/build_env/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h
/root/miniconda/envs/build_env/targets/x86_64-linux/include/cuda.h
/root/miniconda/pkgs/cuda-cudart-dev_linux-64-12.6.77-h3f2d84a_0/targets/x86_64-linux/include/cuda.h
/root/miniconda/pkgs/kernel-headers_linux-64-3.10.0-he073ed8_18/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h

Note that if we install CUDA 12.4 using the nvidia channel for example, i.e.:

conda install --force-reinstall -n build_env -c "nvidia/label/cuda-12.4.1" -y cuda

then we get:

(base) bash-5.2# find / -name cuda.h
/root/miniconda/envs/build_env/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h
/root/miniconda/envs/build_env/include/cuda.h
/root/miniconda/pkgs/cuda-cudart-dev-12.4.127-0/include/cuda.h
/root/miniconda/pkgs/kernel-headers_linux-64-3.10.0-he073ed8_18/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h

In other words, when installing using conda-forge, the CUDA headers do not appear to be installed onto $CONDA_PREFIX/include, which seems to be the reason that cmake is unable to find the path.

How do we resolve this?

Installed packages

(build_env) bash-5.2# conda list
# packages in environment at /root/miniconda/envs/build_env:                                                                                                                                                                                  
#                                                                                                                                                                                                                                             
# Name                    Version                   Build  Channel                                                                                                                                                                            
_libgcc_mutex             0.1                 conda_forge    conda-forge                                                                                                                                                                      
_openmp_mutex             4.5                       2_gnu    conda-forge                                                                                                                                                                      
alsa-lib                  1.2.13               hb9d3cd8_0    conda-forge
attr                      2.5.1                h166bdaf_1    conda-forge
attrs                     24.3.0             pyh71513ae_0    conda-forge
bazel                     7.3.2                h7df20bc_1    conda-forge
binutils                  2.40                 h4852527_7    conda-forge
binutils_impl_linux-64    2.40                 ha1999f0_7    conda-forge
binutils_linux-64         2.40                 hb3c18ed_4    conda-forge
bzip2                     1.0.8                h4bc722e_7    conda-forge
c-ares                    1.34.4               hb9d3cd8_0    conda-forge
c-compiler                1.5.2                h0b41bf4_0    conda-forge
ca-certificates           2024.12.14           hbcca054_0    conda-forge
cairo                     1.18.0               hbb29018_2    conda-forge
clang                     16.0.6          default_h9e3a008_13    conda-forge
clang-16                  16.0.6          default_hb5137d0_13    conda-forge
clangxx                   16.0.6          default_ha78316a_13    conda-forge
click                     8.1.7           unix_pyh707e725_1    conda-forge
cmake                     3.31.2               h74e3db0_1    conda-forge
compiler-rt               16.0.6               h00ab1b0_2    conda-forge
compiler-rt_linux-64      16.0.6               h00ab1b0_2    conda-forge
cuda                      12.6.3               ha804496_0    conda-forge
cuda-cccl_linux-64        12.6.77              ha770c72_0    conda-forge
cuda-command-line-tools   12.6.3               ha770c72_0    conda-forge
cuda-compiler             12.6.3               hbad6d8a_0    conda-forge
cuda-crt-dev_linux-64     12.6.85              ha770c72_0    conda-forge
cuda-crt-tools            12.6.85              ha770c72_0    conda-forge
cuda-cudart               12.6.77              h5888daf_0    conda-forge
cuda-cudart-dev           12.6.77              h5888daf_0    conda-forge
cuda-cudart-dev_linux-64  12.6.77              h3f2d84a_0    conda-forge
cuda-cudart-static        12.6.77              h5888daf_0    conda-forge
cuda-cudart-static_linux-64 12.6.77              h3f2d84a_0    conda-forge
cuda-cudart_linux-64      12.6.77              h3f2d84a_0    conda-forge
cuda-cuobjdump            12.6.77              hbd13f7d_1    conda-forge
cuda-cupti                12.6.80              hbd13f7d_0    conda-forge
cuda-cupti-dev            12.6.80              h5888daf_0    conda-forge
cuda-cuxxfilt             12.6.77              hbd13f7d_1    conda-forge
cuda-driver-dev           12.6.77              h5888daf_0    conda-forge
cuda-driver-dev_linux-64  12.6.77              h3f2d84a_0    conda-forge
cuda-gdb                  12.6.77              h50b4baa_1    conda-forge
cuda-libraries            12.6.3               ha770c72_0    conda-forge
cuda-libraries-dev        12.6.3               ha770c72_0    conda-forge
cuda-nsight               12.6.77              h7938cbb_0    conda-forge
cuda-nvcc                 12.6.85              hcdd1206_0    conda-forge
cuda-nvcc-dev_linux-64    12.6.85              he91c749_0    conda-forge
cuda-nvcc-impl            12.6.85              h85509e4_0    conda-forge
cuda-nvcc-tools           12.6.85              he02047a_0    conda-forge
cuda-nvcc_linux-64        12.6.85              h04802cd_0    conda-forge
cuda-nvdisasm             12.6.77              hbd13f7d_1    conda-forge
cuda-nvml-dev             12.6.77              hbd13f7d_1    conda-forge
cuda-nvprof               12.6.80              hbd13f7d_0    conda-forge
cuda-nvprune              12.6.77              hbd13f7d_1    conda-forge
cuda-nvrtc                12.6.85              hbd13f7d_0    conda-forge
cuda-nvrtc-dev            12.6.85              h5888daf_0    conda-forge
cuda-nvtx                 12.6.77              hbd13f7d_0    conda-forge
cuda-nvvm-dev_linux-64    12.6.85              ha770c72_0    conda-forge
cuda-nvvm-impl            12.6.85              he02047a_0    conda-forge
cuda-nvvm-tools           12.6.85              he02047a_0    conda-forge
cuda-nvvp                 12.6.80              hbd13f7d_1    conda-forge
cuda-opencl               12.6.77              hbd13f7d_0    conda-forge
cuda-opencl-dev           12.6.77              h5888daf_0    conda-forge
cuda-profiler-api         12.6.77              h7938cbb_0    conda-forge
cuda-runtime              12.6.3               ha804496_0    conda-forge
cuda-sanitizer-api        12.6.77              hbd13f7d_1    conda-forge
cuda-toolkit              12.6.3               ha804496_0    conda-forge
cuda-tools                12.6.3               ha770c72_0    conda-forge
cuda-version              12.6                 h7480c83_3    conda-forge
cuda-visual-tools         12.6.3               ha770c72_0    conda-forge
cxx-compiler              1.5.2                hf52228f_0    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
distro                    1.9.0              pyhd8ed1ab_0    conda-forge
exceptiongroup            1.2.2              pyhd8ed1ab_1    conda-forge
expat                     2.6.4                h5888daf_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_3    conda-forge
fontconfig                2.15.0               h7e30c49_1    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
gcc                       11.4.0              h602e360_13    conda-forge
gcc_impl_linux-64         11.4.0              h00c12a0_13    conda-forge
gcc_linux-64              11.4.0               ha077dfb_4    conda-forge
gds-tools                 1.11.1.6             h5888daf_4    conda-forge
giflib                    5.2.2                hd590300_0    conda-forge
gmp                       6.3.0                hac33072_2    conda-forge
graphite2                 1.3.13            h59595ed_1003    conda-forge
gxx                       11.4.0              h602e360_13    conda-forge
gxx_impl_linux-64         11.4.0              h634f3ee_13    conda-forge
gxx_linux-64              11.4.0               h35bfe5d_4    conda-forge
harfbuzz                  9.0.0                hfac3d4d_0    conda-forge
hypothesis                6.122.3            pyha770c72_0    conda-forge
icu                       73.2                 h59595ed_0    conda-forge
ijar                      7.3.2                h5888daf_0    conda-forge
jinja2                    3.1.4              pyhd8ed1ab_1    conda-forge
kernel-headers_linux-64   3.10.0              he073ed8_18    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.21.3               h659f571_0    conda-forge
lcms2                     2.16                 hb7c19ff_0    conda-forge
ld_impl_linux-64          2.40                 hf3520f5_7    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libabseil                 20240722.0      cxx17_h5888daf_1    conda-forge
libcap                    2.71                 h39aace5_0    conda-forge
libclang-cpp16            16.0.6          default_hb5137d0_13    conda-forge
libcublas                 12.6.4.1             hbd13f7d_0    conda-forge
libcublas-dev             12.6.4.1             h5888daf_0    conda-forge
libcufft                  11.3.0.4             hbd13f7d_0    conda-forge
libcufft-dev              11.3.0.4             h5888daf_0    conda-forge
libcufile                 1.11.1.6             h12f29b5_4    conda-forge
libcufile-dev             1.11.1.6             h5888daf_4    conda-forge
libcups                   2.3.3                h4637d8d_4    conda-forge
libcurand                 10.3.7.77            hbd13f7d_0    conda-forge
libcurand-dev             10.3.7.77            h5888daf_0    conda-forge
libcurl                   8.11.1               h332b0f4_0    conda-forge
libcusolver               11.7.1.2             hbd13f7d_0    conda-forge
libcusolver-dev           11.7.1.2             h5888daf_0    conda-forge
libcusparse               12.5.4.2             hbd13f7d_0    conda-forge
libcusparse-dev           12.5.4.2             h5888daf_0    conda-forge
libcxx                    19.1.5               hb37ccd0_0    conda-forge
libcxxabi                 19.1.5               h108a707_0    conda-forge
libdeflate                1.23                 h4ddbbb0_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libexpat                  2.6.4                h5888daf_0    conda-forge
libffi                    3.4.4                h6a678d5_1    
libgcc                    14.2.0               h77fa898_1    conda-forge
libgcc-devel_linux-64     11.4.0             h8f596e0_113    conda-forge
libgcc-ng                 14.2.0               h69a702a_1    conda-forge
libgcrypt-lib             1.11.0               hb9d3cd8_2    conda-forge
libgfortran               14.2.0               h69a702a_1    conda-forge
libgfortran5              14.2.0               hd5240d6_1    conda-forge
libglib                   2.82.2               h2ff4ddf_0    conda-forge
libgomp                   14.2.0               h77fa898_1    conda-forge
libgpg-error              1.51                 hbd13f7d_1    conda-forge
libgrpc                   1.67.1               hc2c308b_0    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
libllvm16                 16.0.6               hb3ce162_3    conda-forge
liblzma                   5.6.3                hb9d3cd8_1    conda-forge
liblzma-devel             5.6.3                hb9d3cd8_1    conda-forge
libmpdec                  4.0.0                h4bc722e_0    conda-forge
libnghttp2                1.64.0               h161d5f1_0    conda-forge
libnl                     3.11.0               hb9d3cd8_0    conda-forge
libnpp                    12.3.1.54            h5888daf_0    conda-forge
libnpp-dev                12.3.1.54            h5888daf_0    conda-forge
libnuma                   2.0.18               h4ab18f5_2    conda-forge
libnvfatbin               12.6.77              hbd13f7d_0    conda-forge
libnvfatbin-dev           12.6.77              h5888daf_0    conda-forge
libnvjitlink              12.6.85              hbd13f7d_0    conda-forge
libnvjitlink-dev          12.6.85              h5888daf_0    conda-forge
libnvjpeg                 12.3.3.54            h5888daf_0    conda-forge
libnvjpeg-dev             12.3.3.54            ha770c72_0    conda-forge
libopenblas               0.3.28          pthreads_h94d23a6_1    conda-forge
libpng                    1.6.44               hadc24fc_0    conda-forge
libprotobuf               5.28.2               h5b01275_0    conda-forge
libre2-11                 2024.07.02           hbbce691_1    conda-forge
libsanitizer              11.4.0              h5763a12_13    conda-forge
libsqlite                 3.47.2               hee588c1_0    conda-forge
libssh2                   1.11.1               hf672d98_0    conda-forge
libstdcxx                 14.2.0               hc0a3c3a_1    conda-forge
libstdcxx-devel_linux-64  11.4.0             h8f596e0_113    conda-forge
libstdcxx-ng              14.2.0               h4852527_1    conda-forge
libsystemd0               256.9                h0b6a36f_2    conda-forge
libtiff                   4.7.0                hd9ff511_3    conda-forge
libudev1                  256.9                h9a4d06a_2    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libuv                     1.49.2               hb9d3cd8_0    conda-forge
libwebp-base              1.4.0                hd590300_0    conda-forge
libxcb                    1.17.0               h8a09558_0    conda-forge
libxkbcommon              1.7.0                h2c5496b_1    conda-forge
libxkbfile                1.1.0                h166bdaf_1    conda-forge
libxml2                   2.12.7               hc051c1a_1    conda-forge
libzlib                   1.3.1                hb9d3cd8_2    conda-forge
llvm-openmp               16.0.6               h4dfa4b3_0    conda-forge
lz4-c                     1.10.0               h5888daf_1    conda-forge
make                      4.4.1                hb9d3cd8_2    conda-forge
markupsafe                3.0.2           py313h8060acc_1    conda-forge
ncurses                   6.5                  he02047a_1    conda-forge
ninja                     1.12.1               h297d8ca_0    conda-forge
nsight-compute            2024.3.2.3           hb5ebaad_0    conda-forge
nspr                      4.36                 h5888daf_0    conda-forge
nss                       3.107                hdf54f9c_0    conda-forge
ocl-icd                   2.3.2                hb9d3cd8_2    conda-forge
openblas                  0.3.28          pthreads_h6ec200e_1    conda-forge
opencl-headers            2024.10.24           h5888daf_0    conda-forge
openjdk                   23.0.1               h4c11d01_0    conda-forge
openssl                   3.4.0                hb9d3cd8_0    conda-forge
packaging                 24.2               pyhd8ed1ab_2    conda-forge
patchelf                  0.17.2               h58526e2_0    conda-forge
pcre2                     10.44                hba22ea6_2    conda-forge
pip                       24.3.1             pyh145f28c_2    conda-forge
pixman                    0.44.2               h29eaf8c_0    conda-forge
pthread-stubs             0.4               hb9d3cd8_1002    conda-forge
python                    3.13.1          ha99a958_102_cp313    conda-forge
python_abi                3.13                    5_cp313    conda-forge
rdma-core                 55.0                 h5888daf_0    conda-forge
re2                       2024.07.02           h77b4e00_1    conda-forge
readline                  8.2                  h8228510_1    conda-forge
rhash                     1.4.5                hb9d3cd8_0    conda-forge
scikit-build              0.18.1             pyh4afc917_0    conda-forge
setuptools                75.6.0             pyhff2d567_1    conda-forge
singlejar                 7.3.2                h5c8f2c3_1    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sqlite                    3.47.2               h9eae976_0    conda-forge
sysroot_linux-64          2.17                h4a8ded7_18    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tomli                     2.2.1              pyhd8ed1ab_1    conda-forge
typing-extensions         4.12.2               hd8ed1ab_1    conda-forge
typing_extensions         4.12.2             pyha770c72_1    conda-forge
tzdata                    2024b                hc8b5060_0    conda-forge
wayland                   1.23.1               h3e06ad9_0    conda-forge
wheel                     0.45.1             pyhd8ed1ab_1    conda-forge
xcb-util                  0.4.1                hb711507_2    conda-forge
xcb-util-cursor           0.1.5                hb9d3cd8_0    conda-forge
xcb-util-image            0.4.0                hb711507_2    conda-forge
xcb-util-keysyms          0.4.1                hb711507_0    conda-forge
xcb-util-renderutil       0.3.10               hb711507_0    conda-forge
xcb-util-wm               0.4.2                hb711507_0    conda-forge
xkeyboard-config          2.43                 hb9d3cd8_0    conda-forge
xorg-libice               1.1.2                hb9d3cd8_0    conda-forge
xorg-libsm                1.2.5                he73a12e_0    conda-forge
xorg-libx11               1.8.10               h4f16b4b_1    conda-forge
xorg-libxau               1.0.12               hb9d3cd8_0    conda-forge
xorg-libxcomposite        0.4.6                hb9d3cd8_2    conda-forge
xorg-libxdamage           1.1.6                hb9d3cd8_0    conda-forge
xorg-libxdmcp             1.1.5                hb9d3cd8_0    conda-forge
xorg-libxext              1.3.6                hb9d3cd8_0    conda-forge
xorg-libxfixes            6.0.1                hb9d3cd8_0    conda-forge
xorg-libxi                1.8.2                hb9d3cd8_0    conda-forge
xorg-libxrandr            1.5.4                hb9d3cd8_0    conda-forge
xorg-libxrender           0.9.12               hb9d3cd8_0    conda-forge
xorg-libxt                1.3.1                hb9d3cd8_0    conda-forge
xorg-libxtst              1.2.5                hb9d3cd8_3    conda-forge
xz                        5.6.3                hbcc6ac9_1    conda-forge
xz-gpl-tools              5.6.3                hbcc6ac9_1    conda-forge
xz-tools                  5.6.3                hb9d3cd8_1    conda-forge
zlib                      1.3.1                hb9d3cd8_2    conda-forge
zstd                      1.5.6                ha6fb4c9_0    conda-forge

Environment info

(build_env) bash-5.2# conda info

     active environment : build_env
    active env location : /root/miniconda/envs/build_env
            shell level : 2
       user config file : /root/.condarc
 populated config files : /root/miniconda/.condarc
          conda version : 24.11.1
    conda-build version : not installed
         python version : 3.12.8.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=skylake
                          __conda=24.11.1=0
                          __glibc=2.34=0
                          __linux=5.15.49=0
                          __unix=0=0
       base environment : /root/miniconda  (writable)
      conda av data dir : /root/miniconda/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /root/miniconda/pkgs
                          /root/.conda/pkgs
       envs directories : /root/miniconda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/24.11.1 requests/2.32.3 CPython/3.12.8 Linux/5.15.49-linuxkit amzn/2023.6.20241121 glibc/2.34 solver/libmamba conda-libmamba-solver/24.9.0 libmambapy/1.5.11 aau/0.5.0 c/. s/. e/.
                UID:GID : 0:0
             netrc file : None
           offline mode : False
@q10 q10 added the bug Something isn't working label Dec 18, 2024
@jakirkham
Copy link
Member

Thanks for the continued persistence! 🙏

libffi is still coming from defaults. Can we get that from conda-forge?

Once that is done, we have a conda-forge only issue to debug

@q10
Copy link
Author

q10 commented Dec 18, 2024

Yes, I have the setup withlibffi from conda-forge now, but same results:

(build_env) bash-5.2# conda info

     active environment : build_env
    active env location : /root/miniconda/envs/build_env
            shell level : 2
       user config file : /root/.condarc
 populated config files : /root/miniconda/.condarc
          conda version : 24.11.1
    conda-build version : not installed
         python version : 3.12.8.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=skylake
                          __conda=24.11.1=0
                          __glibc=2.34=0
                          __linux=5.15.49=0
                          __unix=0=0
       base environment : /root/miniconda  (writable)
      conda av data dir : /root/miniconda/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /root/miniconda/pkgs
                          /root/.conda/pkgs
       envs directories : /root/miniconda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/24.11.1 requests/2.32.3 CPython/3.12.8 Linux/5.15.49-linuxkit amzn/2023.6.20241121 glibc/2.34 solver/libmamba conda-libmamba-solver/24.9.0 libmambapy/1.5.11 aau/0.5.0 c/. s/. e/.
                UID:GID : 0:0
             netrc file : None
           offline mode : False
(build_env) bash-5.2# conda list 
# packages in environment at /root/miniconda/envs/build_env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
alsa-lib                  1.2.13               hb9d3cd8_0    conda-forge
attr                      2.5.1                h166bdaf_1    conda-forge
attrs                     24.3.0             pyh71513ae_0    conda-forge
bazel                     7.3.2                h7df20bc_1    conda-forge
binutils                  2.40                 h4852527_7    conda-forge
binutils_impl_linux-64    2.40                 ha1999f0_7    conda-forge
binutils_linux-64         2.40                 hb3c18ed_4    conda-forge
bzip2                     1.0.8                h4bc722e_7    conda-forge
c-ares                    1.34.4               hb9d3cd8_0    conda-forge
c-compiler                1.5.2                h0b41bf4_0    conda-forge
ca-certificates           2024.12.14           hbcca054_0    conda-forge
cairo                     1.18.0               hbb29018_2    conda-forge
clang                     16.0.6          default_h9e3a008_13    conda-forge
clang-16                  16.0.6          default_hb5137d0_13    conda-forge
clangxx                   16.0.6          default_ha78316a_13    conda-forge
click                     8.1.7           unix_pyh707e725_1    conda-forge
cmake                     3.31.2               h74e3db0_1    conda-forge
compiler-rt               16.0.6               h00ab1b0_2    conda-forge
compiler-rt_linux-64      16.0.6               h00ab1b0_2    conda-forge
cuda                      12.6.3               ha804496_0    conda-forge
cuda-cccl_linux-64        12.6.77              ha770c72_0    conda-forge
cuda-command-line-tools   12.6.3               ha770c72_0    conda-forge
cuda-compiler             12.6.3               hbad6d8a_0    conda-forge
cuda-crt-dev_linux-64     12.6.85              ha770c72_0    conda-forge
cuda-crt-tools            12.6.85              ha770c72_0    conda-forge
cuda-cudart               12.6.77              h5888daf_0    conda-forge
cuda-cudart-dev           12.6.77              h5888daf_0    conda-forge
cuda-cudart-dev_linux-64  12.6.77              h3f2d84a_0    conda-forge
cuda-cudart-static        12.6.77              h5888daf_0    conda-forge
cuda-cudart-static_linux-64 12.6.77              h3f2d84a_0    conda-forge
cuda-cudart_linux-64      12.6.77              h3f2d84a_0    conda-forge
cuda-cuobjdump            12.6.77              hbd13f7d_1    conda-forge
cuda-cupti                12.6.80              hbd13f7d_0    conda-forge
cuda-cupti-dev            12.6.80              h5888daf_0    conda-forge
cuda-cuxxfilt             12.6.77              hbd13f7d_1    conda-forge
cuda-driver-dev           12.6.77              h5888daf_0    conda-forge
cuda-driver-dev_linux-64  12.6.77              h3f2d84a_0    conda-forge
cuda-gdb                  12.6.77              h50b4baa_1    conda-forge
cuda-libraries            12.6.3               ha770c72_0    conda-forge
cuda-libraries-dev        12.6.3               ha770c72_0    conda-forge
cuda-nsight               12.6.77              h7938cbb_0    conda-forge
cuda-nvcc                 12.6.85              hcdd1206_0    conda-forge
cuda-nvcc-dev_linux-64    12.6.85              he91c749_0    conda-forge
cuda-nvcc-impl            12.6.85              h85509e4_0    conda-forge
cuda-nvcc-tools           12.6.85              he02047a_0    conda-forge
cuda-nvcc_linux-64        12.6.85              h04802cd_0    conda-forge
cuda-nvdisasm             12.6.77              hbd13f7d_1    conda-forge
cuda-nvml-dev             12.6.77              hbd13f7d_1    conda-forge
cuda-nvprof               12.6.80              hbd13f7d_0    conda-forge
cuda-nvprune              12.6.77              hbd13f7d_1    conda-forge
cuda-nvrtc                12.6.85              hbd13f7d_0    conda-forge
cuda-nvrtc-dev            12.6.85              h5888daf_0    conda-forge
cuda-nvtx                 12.6.77              hbd13f7d_0    conda-forge
cuda-nvvm-dev_linux-64    12.6.85              ha770c72_0    conda-forge
cuda-nvvm-impl            12.6.85              he02047a_0    conda-forge
cuda-nvvm-tools           12.6.85              he02047a_0    conda-forge
cuda-nvvp                 12.6.80              hbd13f7d_1    conda-forge
cuda-opencl               12.6.77              hbd13f7d_0    conda-forge
cuda-opencl-dev           12.6.77              h5888daf_0    conda-forge
cuda-profiler-api         12.6.77              h7938cbb_0    conda-forge
cuda-runtime              12.6.3               ha804496_0    conda-forge
cuda-sanitizer-api        12.6.77              hbd13f7d_1    conda-forge
cuda-toolkit              12.6.3               ha804496_0    conda-forge
cuda-tools                12.6.3               ha770c72_0    conda-forge
cuda-version              12.6                 h7480c83_3    conda-forge
cuda-visual-tools         12.6.3               ha770c72_0    conda-forge
cxx-compiler              1.5.2                hf52228f_0    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
distro                    1.9.0              pyhd8ed1ab_0    conda-forge
exceptiongroup            1.2.2              pyhd8ed1ab_1    conda-forge
expat                     2.6.4                h5888daf_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_3    conda-forge
fontconfig                2.15.0               h7e30c49_1    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
gcc                       11.4.0              h602e360_13    conda-forge
gcc_impl_linux-64         11.4.0              h00c12a0_13    conda-forge
gcc_linux-64              11.4.0               ha077dfb_4    conda-forge
gds-tools                 1.11.1.6             h5888daf_4    conda-forge
giflib                    5.2.2                hd590300_0    conda-forge
gmp                       6.3.0                hac33072_2    conda-forge
graphite2                 1.3.13            h59595ed_1003    conda-forge
gxx                       11.4.0              h602e360_13    conda-forge
gxx_impl_linux-64         11.4.0              h634f3ee_13    conda-forge
gxx_linux-64              11.4.0               h35bfe5d_4    conda-forge
harfbuzz                  9.0.0                hfac3d4d_0    conda-forge
hypothesis                6.122.3            pyha770c72_0    conda-forge
icu                       73.2                 h59595ed_0    conda-forge
ijar                      7.3.2                h5888daf_0    conda-forge
jinja2                    3.1.4              pyhd8ed1ab_1    conda-forge
kernel-headers_linux-64   3.10.0              he073ed8_18    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.21.3               h659f571_0    conda-forge
lcms2                     2.16                 hb7c19ff_0    conda-forge
ld_impl_linux-64          2.40                 hf3520f5_7    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libabseil                 20240722.0      cxx17_h5888daf_1    conda-forge
libcap                    2.71                 h39aace5_0    conda-forge
libclang-cpp16            16.0.6          default_hb5137d0_13    conda-forge
libcublas                 12.6.4.1             hbd13f7d_0    conda-forge
libcublas-dev             12.6.4.1             h5888daf_0    conda-forge
libcufft                  11.3.0.4             hbd13f7d_0    conda-forge
libcufft-dev              11.3.0.4             h5888daf_0    conda-forge
libcufile                 1.11.1.6             h12f29b5_4    conda-forge
libcufile-dev             1.11.1.6             h5888daf_4    conda-forge
libcups                   2.3.3                h4637d8d_4    conda-forge
libcurand                 10.3.7.77            hbd13f7d_0    conda-forge
libcurand-dev             10.3.7.77            h5888daf_0    conda-forge
libcurl                   8.11.1               h332b0f4_0    conda-forge
libcusolver               11.7.1.2             hbd13f7d_0    conda-forge
libcusolver-dev           11.7.1.2             h5888daf_0    conda-forge
libcusparse               12.5.4.2             hbd13f7d_0    conda-forge
libcusparse-dev           12.5.4.2             h5888daf_0    conda-forge
libcxx                    19.1.5               hb37ccd0_0    conda-forge
libcxxabi                 19.1.5               h108a707_0    conda-forge
libdeflate                1.23                 h4ddbbb0_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libexpat                  2.6.4                h5888daf_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc                    14.2.0               h77fa898_1    conda-forge
libgcc-devel_linux-64     11.4.0             h8f596e0_113    conda-forge
libgcc-ng                 14.2.0               h69a702a_1    conda-forge
libgcrypt-lib             1.11.0               hb9d3cd8_2    conda-forge
libgfortran               14.2.0               h69a702a_1    conda-forge
libgfortran5              14.2.0               hd5240d6_1    conda-forge
libglib                   2.82.2               h2ff4ddf_0    conda-forge
libgomp                   14.2.0               h77fa898_1    conda-forge
libgpg-error              1.51                 hbd13f7d_1    conda-forge
libgrpc                   1.67.1               hc2c308b_0    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
libllvm16                 16.0.6               hb3ce162_3    conda-forge
liblzma                   5.6.3                hb9d3cd8_1    conda-forge
liblzma-devel             5.6.3                hb9d3cd8_1    conda-forge
libmpdec                  4.0.0                h4bc722e_0    conda-forge
libnghttp2                1.64.0               h161d5f1_0    conda-forge
libnl                     3.11.0               hb9d3cd8_0    conda-forge
libnpp                    12.3.1.54            h5888daf_0    conda-forge
libnpp-dev                12.3.1.54            h5888daf_0    conda-forge
libnuma                   2.0.18               h4ab18f5_2    conda-forge
libnvfatbin               12.6.77              hbd13f7d_0    conda-forge
libnvfatbin-dev           12.6.77              h5888daf_0    conda-forge
libnvjitlink              12.6.85              hbd13f7d_0    conda-forge
libnvjitlink-dev          12.6.85              h5888daf_0    conda-forge
libnvjpeg                 12.3.3.54            h5888daf_0    conda-forge
libnvjpeg-dev             12.3.3.54            ha770c72_0    conda-forge
libopenblas               0.3.28          pthreads_h94d23a6_1    conda-forge
libpng                    1.6.44               hadc24fc_0    conda-forge
libprotobuf               5.28.2               h5b01275_0    conda-forge
libre2-11                 2024.07.02           hbbce691_1    conda-forge
libsanitizer              11.4.0              h5763a12_13    conda-forge
libsqlite                 3.47.2               hee588c1_0    conda-forge
libssh2                   1.11.1               hf672d98_0    conda-forge
libstdcxx                 14.2.0               hc0a3c3a_1    conda-forge
libstdcxx-devel_linux-64  11.4.0             h8f596e0_113    conda-forge
libstdcxx-ng              14.2.0               h4852527_1    conda-forge
libsystemd0               256.9                h0b6a36f_2    conda-forge
libtiff                   4.7.0                hd9ff511_3    conda-forge
libudev1                  256.9                h9a4d06a_2    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libuv                     1.49.2               hb9d3cd8_0    conda-forge
libwebp-base              1.4.0                hd590300_0    conda-forge
libxcb                    1.17.0               h8a09558_0    conda-forge
libxkbcommon              1.7.0                h2c5496b_1    conda-forge
libxkbfile                1.1.0                h166bdaf_1    conda-forge
libxml2                   2.12.7               hc051c1a_1    conda-forge
libzlib                   1.3.1                hb9d3cd8_2    conda-forge
llvm-openmp               16.0.6               h4dfa4b3_0    conda-forge
lz4-c                     1.10.0               h5888daf_1    conda-forge
make                      4.4.1                hb9d3cd8_2    conda-forge
markupsafe                3.0.2           py313h8060acc_1    conda-forge
ncurses                   6.5                  he02047a_1    conda-forge
ninja                     1.12.1               h297d8ca_0    conda-forge
nsight-compute            2024.3.2.3           hb5ebaad_0    conda-forge
nspr                      4.36                 h5888daf_0    conda-forge
nss                       3.107                hdf54f9c_0    conda-forge
ocl-icd                   2.3.2                hb9d3cd8_2    conda-forge
openblas                  0.3.28          pthreads_h6ec200e_1    conda-forge
opencl-headers            2024.10.24           h5888daf_0    conda-forge
openjdk                   23.0.1               h4c11d01_0    conda-forge
openssl                   3.4.0                hb9d3cd8_0    conda-forge
packaging                 24.2               pyhd8ed1ab_2    conda-forge
patchelf                  0.17.2               h58526e2_0    conda-forge
pcre2                     10.44                hba22ea6_2    conda-forge
pip                       24.3.1             pyh145f28c_2    conda-forge
pixman                    0.44.2               h29eaf8c_0    conda-forge
pthread-stubs             0.4               hb9d3cd8_1002    conda-forge
python                    3.13.1          ha99a958_102_cp313    conda-forge
python_abi                3.13                    5_cp313    conda-forge
rdma-core                 55.0                 h5888daf_0    conda-forge
re2                       2024.07.02           h77b4e00_1    conda-forge
readline                  8.2                  h8228510_1    conda-forge
rhash                     1.4.5                hb9d3cd8_0    conda-forge
scikit-build              0.18.1             pyh4afc917_0    conda-forge
setuptools                75.6.0             pyhff2d567_1    conda-forge
singlejar                 7.3.2                h5c8f2c3_1    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sqlite                    3.47.2               h9eae976_0    conda-forge
sysroot_linux-64          2.17                h4a8ded7_18    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tomli                     2.2.1              pyhd8ed1ab_1    conda-forge
typing-extensions         4.12.2               hd8ed1ab_1    conda-forge
typing_extensions         4.12.2             pyha770c72_1    conda-forge
tzdata                    2024b                hc8b5060_0    conda-forge
wayland                   1.23.1               h3e06ad9_0    conda-forge
wheel                     0.45.1             pyhd8ed1ab_1    conda-forge
xcb-util                  0.4.1                hb711507_2    conda-forge
xcb-util-cursor           0.1.5                hb9d3cd8_0    conda-forge
xcb-util-image            0.4.0                hb711507_2    conda-forge
xcb-util-keysyms          0.4.1                hb711507_0    conda-forge
xcb-util-renderutil       0.3.10               hb711507_0    conda-forge
xcb-util-wm               0.4.2                hb711507_0    conda-forge
xkeyboard-config          2.43                 hb9d3cd8_0    conda-forge
xorg-libice               1.1.2                hb9d3cd8_0    conda-forge
xorg-libsm                1.2.5                he73a12e_0    conda-forge
xorg-libx11               1.8.10               h4f16b4b_1    conda-forge
xorg-libxau               1.0.12               hb9d3cd8_0    conda-forge
xorg-libxcomposite        0.4.6                hb9d3cd8_2    conda-forge
xorg-libxdamage           1.1.6                hb9d3cd8_0    conda-forge
xorg-libxdmcp             1.1.5                hb9d3cd8_0    conda-forge
xorg-libxext              1.3.6                hb9d3cd8_0    conda-forge
xorg-libxfixes            6.0.1                hb9d3cd8_0    conda-forge
xorg-libxi                1.8.2                hb9d3cd8_0    conda-forge
xorg-libxrandr            1.5.4                hb9d3cd8_0    conda-forge
xorg-libxrender           0.9.12               hb9d3cd8_0    conda-forge
xorg-libxt                1.3.1                hb9d3cd8_0    conda-forge
xorg-libxtst              1.2.5                hb9d3cd8_3    conda-forge
xz                        5.6.3                hbcc6ac9_1    conda-forge
xz-gpl-tools              5.6.3                hbcc6ac9_1    conda-forge
xz-tools                  5.6.3                hb9d3cd8_1    conda-forge
zlib                      1.3.1                hb9d3cd8_2    conda-forge
zstd                      1.5.6                ha6fb4c9_0    conda-forge
(build_env) bash-5.2# find / -name cuda.h
/root/miniconda/envs/build_env/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h
/root/miniconda/envs/build_env/targets/x86_64-linux/include/cuda.h
/root/miniconda/pkgs/cuda-cudart-dev_linux-64-12.6.77-h3f2d84a_0/targets/x86_64-linux/include/cuda.h
/root/miniconda/pkgs/kernel-headers_linux-64-3.10.0-he073ed8_18/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h

@leofang
Copy link
Member

leofang commented Dec 18, 2024

I think we have enough info in debugging with the info from OP.

@q10 The problem, IIUC (@robertmaynard can correct me), is that Caffe is still using the old FindCUDA routine, which has been long deprecated:
https://github.com/pytorch/pytorch/blob/17a6d4b8829e24b45045d7bd061f9db4db2092e3/cmake/public/cuda.cmake#L29
We've been working with the CMake team to ensure the new FindCUDAToolkit routine supports the file layout in conda. For long-term maintenance please kindly report to and work with upstream to fix it.

As for a short-term solution, the CUDA headers are located in $CONDA_PREFIX/targets/<arch>/include, and the list of archs used in the path can be seen, e.g., here:
https://github.com/conda-forge/cuda-cudart-feedstock/blob/5332513859c6841f3306563a40556bf699b5a003/recipe/meta.yaml#L8-L10

@jakirkham
Copy link
Member

If it is PyTorch using the legacy find_package(CUDA), that is already tracked in upstream issue: pytorch/pytorch#76082

@q10
Copy link
Author

q10 commented Dec 18, 2024

As for a short-term solution, the CUDA headers are located in $CONDA_PREFIX/targets/<arch>/include, and the list of archs used in the path can be seen, e.g., here:

Just one last question, what CMake variable should I use to pass in the directory as workaround? I've tried -DCUDA_INCLUDE_DIRS, -DCUDA_TOOLKIT_INCLUDE, and -DCMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES, but none seem to work.

@jakirkham
Copy link
Member

Both know how to look for headers and libraries based on those paths

@q10
Copy link
Author

q10 commented Dec 24, 2024

I added the cmake variables, but now I run into this error:

CMake Error at /github/home/miniconda/envs/build_binary/lib/python3.13/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:186 (set_property):
  The link interface of target "torch::nvtoolsext" contains:

    CUDA::nvToolsExt

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /github/home/miniconda/envs/build_binary/lib/python3.13/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /github/home/miniconda/envs/build_binary/lib/python3.13/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  /__w/FBGEMM/FBGEMM/cmake/modules/PyTorchSetup.cmake:14 (find_package)
  CMakeLists.txt:78 (include)

Upon further investigation, it seems that nvToolsExt.h is not present in $CONDA_PREFIX/include either:

(base) bash-5.2# find / -name *nvToolsExt.h*
/root/miniconda/envs/build_env/nsight-compute-2024.3.1/host/target-linux-x64/nvtx/include/nvtx3/nvToolsExt.h
/root/miniconda/pkgs/nsight-compute-2024.3.1.2-0/nsight-compute-2024.3.1/host/target-linux-x64/nvtx/include/nvtx3/nvToolsExt.h
(base) bash-5.2# 

How should I remedy this?

@matthewfeickert
Copy link
Member

matthewfeickert commented Jan 8, 2025

We're seeing a similar situation in a JOSS review for https://github.com/Cambridge-ICCS/FTorch: Cambridge-ICCS/FTorch#214

Here's a reproducer pixi manifest:

[project]
authors = ["Matthew Feickert <[email protected]>"]
channels = ["conda-forge"]
description = "Add a short description here"
name = "example"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

# Selecting 6055a7dd35e394daff469673feac063f1bfaae01 as reference
clone = """
rm -rf FTorch && \
git clone https://github.com/Cambridge-ICCS/FTorch.git && \
cd FTorch && \
git reset --hard 6055a7dd35e394daff469673feac063f1bfaae01 && \
sed -i 's/cmake_minimum_required(VERSION 3.15 FATAL_ERROR)/cmake_minimum_required(VERSION 3.15...3.31 FATAL_ERROR)/g' src/CMakeLists.txt && \
sed -i 's/set(Python_FIND_VIRTUALENV FIRST)/set(Python_FIND_STRATEGY LOCATION)/g' src/CMakeLists.txt
"""

# Note that libtorch is at $CONDA_PREFIX/lib/libtorch.so
build = """
rm -rf build && \
cmake \
    -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
    -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
    -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_CUDA=TRUE \
    -DCUDA_TOOLKIT_ROOT_DIR=$CONDA_PREFIX/targets/x86_64-linux/include/cuda \
    -DCUDA_nvrtc_LIBRARY=$CONDA_PREFIX/targets/x86_64-linux/lib/libnvrtc.so.12.6.85 \
    -S FTorch/src/ \
    -B build && \
cmake -LH build && \
cmake --build build --clean-first --parallel=10 && \
cmake --install build
"""

start = { depends-on = ["clone", "build"] }

[system-requirements]
cuda = "12.0"

[dependencies]
fortran-compiler = ">=1.8.0,<2"
cxx-compiler = ">=1.8.0,<2"
cuda-compiler = ">=12.6.3,<13"
cmake = ">=3.31.2,<4"
pytorch = ">=2.5.1,<3"
zlib = ">=1.3.1,<2"
git = ">=2.47.1,<3"
sed = ">=4.8,<5"

where CUDA_TOOLKIT_ROOT_DIR is set given #59 (comment) and CUDA_nvrtc_LIBRARY is set to avoid

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nvrtc_LIBRARY (ADVANCED)
    linked by target "ftorch" in directory /tmp/example/FTorch/src
pixi info:
System
------------
       Pixi version: 0.39.5
           Platform: linux-64
   Virtual packages: __unix=0=0
                   : __linux=6.8.0=0
                   : __glibc=2.35=0
                   : __cuda=12.2=0
                   : __archspec=1=skylake
          Cache dir: /home/feickert/.cache/rattler/cache
       Auth storage: /home/feickert/.rattler/credentials.json
   Config locations: No config files found

Global
------------
            Bin dir: /home/feickert/.pixi/bin
    Environment dir: /home/feickert/.pixi/envs
       Manifest dir: /home/feickert/.pixi/manifests/pixi-global.toml

Project
------------
               Name: example
            Version: 0.1.0
      Manifest file: /tmp/example/pixi.toml
       Last updated: 07-01-2025 22:56:39

Environments
------------
        Environment: default
           Features: default
           Channels: conda-forge
   Dependency count: 8
       Dependencies: fortran-compiler, cxx-compiler, cuda-compiler, cmake, pytorch, zlib, git, sed
   Target platforms: linux-64
System requirements: cuda = "12.0"
              Tasks: build, clone, start



pixi list:
Package                      Version       Build                           Size       Kind   Source
_libgcc_mutex                0.1           conda_forge                     2.5 KiB    conda  _libgcc_mutex
_openmp_mutex                4.5           2_kmp_llvm                      5.6 KiB    conda  _openmp_mutex
attr                         2.5.1         h166bdaf_1                      69.4 KiB   conda  attr
binutils                     2.43          h4852527_2                      33.1 KiB   conda  binutils
binutils_impl_linux-64       2.43          h4bf12b8_2                      5.4 MiB    conda  binutils_impl_linux-64
binutils_linux-64            2.43          h4852527_2                      34.1 KiB   conda  binutils_linux-64
bzip2                        1.0.8         h4bc722e_7                      246.9 KiB  conda  bzip2
c-ares                       1.34.4        hb9d3cd8_0                      201.3 KiB  conda  c-ares
c-compiler                   1.8.0         h2b85faf_1                      5.9 KiB    conda  c-compiler
ca-certificates              2024.12.14    hbcca054_0                      153.4 KiB  conda  ca-certificates
cmake                        3.31.2        h74e3db0_1                      19.5 MiB   conda  cmake
cpython                      3.12.8        py312hd8ed1ab_1                 43.7 KiB   conda  cpython
cuda-cccl_linux-64           12.6.77       ha770c72_0                      1 MiB      conda  cuda-cccl_linux-64
cuda-compiler                12.6.3        hbad6d8a_0                      19.7 KiB   conda  cuda-compiler
cuda-crt-dev_linux-64        12.6.85       ha770c72_0                      86.7 KiB   conda  cuda-crt-dev_linux-64
cuda-crt-tools               12.6.85       ha770c72_0                      26.5 KiB   conda  cuda-crt-tools
cuda-cudart                  12.6.77       h5888daf_0                      21.9 KiB   conda  cuda-cudart
cuda-cudart-dev              12.6.77       h5888daf_0                      22.3 KiB   conda  cuda-cudart-dev
cuda-cudart-dev_linux-64     12.6.77       h3f2d84a_0                      356.8 KiB  conda  cuda-cudart-dev_linux-64
cuda-cudart-static           12.6.77       h5888daf_0                      21.9 KiB   conda  cuda-cudart-static
cuda-cudart-static_linux-64  12.6.77       h3f2d84a_0                      744.5 KiB  conda  cuda-cudart-static_linux-64
cuda-cudart_linux-64         12.6.77       h3f2d84a_0                      184.2 KiB  conda  cuda-cudart_linux-64
cuda-cuobjdump               12.6.77       hbd13f7d_1                      240.8 KiB  conda  cuda-cuobjdump
cuda-cupti                   12.6.80       hbd13f7d_0                      1.9 MiB    conda  cuda-cupti
cuda-cuxxfilt                12.6.77       hbd13f7d_1                      210.9 KiB  conda  cuda-cuxxfilt
cuda-driver-dev_linux-64     12.6.77       h3f2d84a_0                      34.9 KiB   conda  cuda-driver-dev_linux-64
cuda-nvcc                    12.6.85       hcdd1206_0                      23.1 KiB   conda  cuda-nvcc
cuda-nvcc-dev_linux-64       12.6.85       he91c749_0                      10.8 MiB   conda  cuda-nvcc-dev_linux-64
cuda-nvcc-impl               12.6.85       h85509e4_0                      24.9 KiB   conda  cuda-nvcc-impl
cuda-nvcc-tools              12.6.85       he02047a_0                      23 MiB     conda  cuda-nvcc-tools
cuda-nvcc_linux-64           12.6.85       h04802cd_0                      24.7 KiB   conda  cuda-nvcc_linux-64
cuda-nvdisasm                12.6.77       hbd13f7d_1                      47.6 MiB   conda  cuda-nvdisasm
cuda-nvprune                 12.6.77       hbd13f7d_1                      66.4 KiB   conda  cuda-nvprune
cuda-nvrtc                   12.6.85       hbd13f7d_0                      17.3 MiB   conda  cuda-nvrtc
cuda-nvtx                    12.6.77       hbd13f7d_0                      30.6 KiB   conda  cuda-nvtx
cuda-nvvm-dev_linux-64       12.6.85       ha770c72_0                      24.6 KiB   conda  cuda-nvvm-dev_linux-64
cuda-nvvm-impl               12.6.85       he02047a_0                      7.7 MiB    conda  cuda-nvvm-impl
cuda-nvvm-tools              12.6.85       he02047a_0                      10.4 MiB   conda  cuda-nvvm-tools
cuda-version                 12.6          h7480c83_3                      20.4 KiB   conda  cuda-version
cudnn                        9.3.0.75      h62a6f1c_2                      383.2 MiB  conda  cudnn
cusparselt                   0.6.3.2       hdea8103_1                      56.6 MiB   conda  cusparselt
cxx-compiler                 1.8.0         h1a2810e_1                      5.9 KiB    conda  cxx-compiler
filelock                     3.16.1        pyhd8ed1ab_1                    17 KiB     conda  filelock
fortran-compiler             1.8.0         h36df796_1                      6 KiB      conda  fortran-compiler
fsspec                       2024.12.0     pyhd8ed1ab_0                    134.5 KiB  conda  fsspec
gcc                          13.3.0        h9576a4e_1                      52.6 KiB   conda  gcc
gcc_impl_linux-64            13.3.0        hfea6d02_1                      64.3 MiB   conda  gcc_impl_linux-64
gcc_linux-64                 13.3.0        hc28eda2_7                      31.3 KiB   conda  gcc_linux-64
gfortran                     13.3.0        h9576a4e_1                      52.1 KiB   conda  gfortran
gfortran_impl_linux-64       13.3.0        h10434e7_1                      15.2 MiB   conda  gfortran_impl_linux-64
gfortran_linux-64            13.3.0        hb919d3a_7                      29.6 KiB   conda  gfortran_linux-64
git                          2.47.1        pl5321h59d505e_0                10.1 MiB   conda  git
gmp                          6.3.0         hac33072_2                      449.3 KiB  conda  gmp
gmpy2                        2.1.5         py312h7201bc8_3                 204.7 KiB  conda  gmpy2
gxx                          13.3.0        h9576a4e_1                      52.1 KiB   conda  gxx
gxx_impl_linux-64            13.3.0        hdbfa832_1                      12.7 MiB   conda  gxx_impl_linux-64
gxx_linux-64                 13.3.0        h6834431_7                      29.6 KiB   conda  gxx_linux-64
jinja2                       3.1.5         pyhd8ed1ab_0                    109.9 KiB  conda  jinja2
kernel-headers_linux-64      3.10.0        he073ed8_18                     921.4 KiB  conda  kernel-headers_linux-64
keyutils                     1.6.1         h166bdaf_0                      115.1 KiB  conda  keyutils
krb5                         1.21.3        h659f571_0                      1.3 MiB    conda  krb5
ld_impl_linux-64             2.43          h712a8e2_2                      653.5 KiB  conda  ld_impl_linux-64
libabseil                    20240722.0    cxx17_hbbce691_4                1.3 MiB    conda  libabseil
libblas                      3.9.0         26_linux64_openblas             16 KiB     conda  libblas
libcap                       2.71          h39aace5_0                      99.9 KiB   conda  libcap
libcblas                     3.9.0         26_linux64_openblas             16 KiB     conda  libcblas
libcublas                    12.6.4.1      hbd13f7d_0                      255.6 MiB  conda  libcublas
libcudss0                    0.4.0.2       he55f5cd_2                      22.5 MiB   conda  libcudss0
libcufft                     11.3.0.4      hbd13f7d_0                      156.2 MiB  conda  libcufft
libcufile                    1.11.1.6      h12f29b5_4                      899.6 KiB  conda  libcufile
libcurand                    10.3.7.77     hbd13f7d_0                      39.9 MiB   conda  libcurand
libcurl                      8.11.1        h332b0f4_0                      413.1 KiB  conda  libcurl
libcusolver                  11.7.1.2      hbd13f7d_0                      95.8 MiB   conda  libcusolver
libcusparse                  12.5.4.2      hbd13f7d_0                      118.6 MiB  conda  libcusparse
libedit                      3.1.20240808  pl5321h7949ede_0                131.5 KiB  conda  libedit
libev                        4.33          hd590300_2                      110.1 KiB  conda  libev
libexpat                     2.6.4         h5888daf_0                      71.6 KiB   conda  libexpat
libffi                       3.4.2         h7f98852_5                      56.9 KiB   conda  libffi
libgcc                       14.2.0        h77fa898_1                      828.9 KiB  conda  libgcc
libgcc-devel_linux-64        13.3.0        h84ea5a7_101                    2.5 MiB    conda  libgcc-devel_linux-64
libgcc-ng                    14.2.0        h69a702a_1                      52.9 KiB   conda  libgcc-ng
libgcrypt-lib                1.11.0        hb9d3cd8_2                      572.4 KiB  conda  libgcrypt-lib
libgfortran                  14.2.0        h69a702a_1                      52.7 KiB   conda  libgfortran
libgfortran5                 14.2.0        hd5240d6_1                      1.4 MiB    conda  libgfortran5
libgomp                      14.2.0        h77fa898_1                      450.2 KiB  conda  libgomp
libgpg-error                 1.51          hbd13f7d_1                      262.4 KiB  conda  libgpg-error
libhwloc                     2.11.2        default_h0d58e46_1001           2.3 MiB    conda  libhwloc
libiconv                     1.17          hd590300_2                      689.2 KiB  conda  libiconv
liblapack                    3.9.0         26_linux64_openblas             16 KiB     conda  liblapack
libllvm19                    19.1.6        ha7bfdaf_0                      38.3 MiB   conda  libllvm19
liblzma                      5.6.3         hb9d3cd8_1                      108.5 KiB  conda  liblzma
libmagma                     2.8.0         h566cb83_2                      282.3 MiB  conda  libmagma
libnghttp2                   1.64.0        h161d5f1_0                      632.4 KiB  conda  libnghttp2
libnl                        3.11.0        hb9d3cd8_0                      723.9 KiB  conda  libnl
libnsl                       2.0.1         hd590300_0                      32.6 KiB   conda  libnsl
libnvjitlink                 12.6.85       hbd13f7d_0                      14.9 MiB   conda  libnvjitlink
libopenblas                  0.3.28        pthreads_h94d23a6_1             5.3 MiB    conda  libopenblas
libprotobuf                  5.28.3        h6128344_1                      2.8 MiB    conda  libprotobuf
libsanitizer                 13.3.0        heb74ff8_1                      3.9 MiB    conda  libsanitizer
libsqlite                    3.47.2        hee588c1_0                      853.1 KiB  conda  libsqlite
libssh2                      1.11.1        hf672d98_0                      297.1 KiB  conda  libssh2
libstdcxx                    14.2.0        hc0a3c3a_1                      3.7 MiB    conda  libstdcxx
libstdcxx-devel_linux-64     13.3.0        h84ea5a7_101                    13.4 MiB   conda  libstdcxx-devel_linux-64
libstdcxx-ng                 14.2.0        h4852527_1                      52.8 KiB   conda  libstdcxx-ng
libsystemd0                  256.9         h0b6a36f_2                      400.9 KiB  conda  libsystemd0
libtorch                     2.5.1         cuda126_mkl_h2a4acef_308        491.1 MiB  conda  libtorch
libudev1                     256.9         h9a4d06a_2                      137.7 KiB  conda  libudev1
libuuid                      2.38.1        h0b41bf4_0                      32.8 KiB   conda  libuuid
libuv                        1.49.2        hb9d3cd8_0                      863.9 KiB  conda  libuv
libxcrypt                    4.4.36        hd590300_1                      98 KiB     conda  libxcrypt
libxml2                      2.13.5        h0d44e9d_1                      673.8 KiB  conda  libxml2
libzlib                      1.3.1         hb9d3cd8_2                      59.5 KiB   conda  libzlib
llvm-openmp                  19.1.6        h024ca30_0                      3.1 MiB    conda  llvm-openmp
lz4-c                        1.10.0        h5888daf_1                      163.1 KiB  conda  lz4-c
markupsafe                   3.0.2         py312h178313f_1                 24 KiB     conda  markupsafe
mkl                          2024.2.2      ha957f24_16                     118.9 MiB  conda  mkl
mpc                          1.3.1         h24ddda3_1                      114 KiB    conda  mpc
mpfr                         4.2.1         h90cbb55_3                      619.9 KiB  conda  mpfr
mpmath                       1.3.0         pyhd8ed1ab_1                    429.4 KiB  conda  mpmath
nccl                         2.24.3.1      hb92ee24_0                      120.1 MiB  conda  nccl
ncurses                      6.5           he02047a_1                      868.2 KiB  conda  ncurses
networkx                     3.4.2         pyh267e887_2                    1.2 MiB    conda  networkx
numpy                        2.2.1         py312h7e784f5_0                 8.1 MiB    conda  numpy
openssl                      3.4.0         h7b32b05_1                      2.8 MiB    conda  openssl
pcre2                        10.44         hba22ea6_2                      930 KiB    conda  pcre2
perl                         5.32.1        7_hd590300_perl5                12.7 MiB   conda  perl
python                       3.12.8        h9e4cc4f_1_cpython              30.1 MiB   conda  python
python_abi                   3.12          5_cp312                         6.1 KiB    conda  python_abi
pytorch                      2.5.1         cuda126_mkl_py312_hdbe889e_308  35.6 MiB   conda  pytorch
rdma-core                    55.0          h5888daf_0                      1.2 MiB    conda  rdma-core
readline                     8.2           h8228510_1                      274.9 KiB  conda  readline
rhash                        1.4.5         hb9d3cd8_0                      182.5 KiB  conda  rhash
sed                          4.8           he412f7d_0                      264.4 KiB  conda  sed
setuptools                   75.6.0        pyhff2d567_1                    756.1 KiB  conda  setuptools
sleef                        3.7           h1b44611_2                      1.8 MiB    conda  sleef
sympy                        1.13.3        pyh2585a3b_105                  4.3 MiB    conda  sympy
sysroot_linux-64             2.17          h0157908_18                     14.5 MiB   conda  sysroot_linux-64
tbb                          2021.13.0     hceb3a55_1                      171.8 KiB  conda  tbb
tk                           8.6.13        noxft_h4845f30_101              3.2 MiB    conda  tk
triton                       3.1.0         cuda126py312h776fbae_4          89 MiB     conda  triton
typing_extensions            4.12.2        pyha770c72_1                    38.7 KiB   conda  typing_extensions
tzdata                       2024b         hc8b5060_0                      119.5 KiB  conda  tzdata
zlib                         1.3.1         hb9d3cd8_2                      90.1 KiB   conda  zlib
zstd                         1.5.6         ha6fb4c9_0                      541.8 KiB  conda  zstd

However, pixi run start fails with

CMake Error at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:186 (set_property):
  The link interface of target "torch::nvtoolsext" contains:

    CUDA::nvToolsExt

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


-- Generating done (0.0s)
CMake Generate step failed.  Build files cannot be regenerated correctly.
Full build log:

-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- The Fortran compiler identification is GNU 13.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-gfortran - skipped
-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
-- Verifying Fortran/CXX Compiler Compatibility
-- Verifying Fortran/CXX Compiler Compatibility - Success
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - /tmp/example/.pixi/envs/default/bin/nvcc
-- The CUDA compiler identification is NVIDIA 12.6.85 with host compiler GNU 13.3.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /tmp/example/.pixi/envs/default/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Found ZLIB: /tmp/example/.pixi/envs/default/lib/libz.so (found version "1.3.1")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 28.3.0
-- Found CUDA: /tmp/example/.pixi/envs/default/targets/x86_64-linux/include/cuda (found version "12.6") 
-- Unable to find cublas_v2.h in either "/tmp/example/.pixi/envs/default/targets/x86_64-linux/include" or "/tmp/example/.pixi/envs/default/math_libs/include"
-- Found CUDAToolkit: /tmp/example/.pixi/envs/default/targets/x86_64-linux/include (found version "12.6.85")
-- Caffe2: CUDA detected: 12.6
-- Caffe2: CUDA nvcc is: /tmp/example/.pixi/envs/default/bin/nvcc
-- Caffe2: CUDA toolkit directory: /tmp/example/.pixi/envs/default/targets/x86_64-linux/include/cuda
-- Caffe2: Header version is: 12.6
-- Found Python: /home/feickert/.pyenv/versions/3.11.7/envs/base/bin/python3.11 (found version "3.11.7") found components: Interpreter
CMake Warning at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:140 (message):
  Failed to compute shorthash for libnvrtc.so
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


CMake Warning (dev) at /tmp/example/.pixi/envs/default/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:441 (message):
  The package name passed to `find_package_handle_standard_args` (nvtx3) does
  not match the name of the calling package (Caffe2).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:178 (find_package_handle_standard_args)
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find nvtx3 (missing: nvtx3_dir) 
CMake Warning at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:184 (message):
  Cannot find NVTX3, find old NVTX instead
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


-- USE_CUDNN is set to 0. Compiling without cuDNN support
-- USE_CUSPARSELT is set to 0. Compiling without cuSPARSELt support
-- USE_CUDSS is set to 0. Compiling without cuDSS support
-- USE_CUFILE is set to 0. Compiling without cuFile support
-- Autodetected CUDA architecture(s):  8.9
-- Added CUDA NVCC flags for: -gencode;arch=compute_89,code=sm_89
-- Found Torch: /tmp/example/.pixi/envs/default/lib/libtorch.so
-- Configuring done (7.0s)
CMake Error at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:186 (set_property):
  The link interface of target "torch::nvtoolsext" contains:

    CUDA::nvToolsExt

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


-- Generating done (0.0s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

Similar to @q10 I'm not clear on if this is an issue with PyTorch (e.g. pytorch/pytorch#76082) or if there is a missing dependency that has escaped my attention.

The project's CMakeLists.txt is here: https://github.com/Cambridge-ICCS/FTorch/blob/6055a7dd35e394daff469673feac063f1bfaae01/src/CMakeLists.txt

@jakirkham
Copy link
Member

Is the goal here simply to build PyTorch?

If so, would recommend starting from the conda-forge PyTorch recipe

Note that it needs quite a few patches to fix different build issues. For example this patch fixes an NVTX detection issue probably similar to the one encountered here

@matthewfeickert
Copy link
Member

matthewfeickert commented Jan 8, 2025

Is the goal here simply to build PyTorch?

@jakirkham No, PyTorch is just providing libtorch which FTorch (a library for calling TorchScript models from Fotran) compiles against (and then providing PyTorch itself for use examples). Testing the GPU components requires being able to compile with CUDA but that's proving to be difficult, but it is unclear if this is because of errors in the configuration for FTorch CMakeLists.txt or if this is because of issues with the existing interplay between the conda-forge CUDA enabled PyTorch distributions and cuda-compiler metapackage. I could be totally wrong and it could be something else as well.

(My interest here is that I'm the editor for a JOSS paper and I'm trying to help both the reviewers and the authors reach an easily installable environment for testing, hence going to conda-forge.)

@jakirkham
Copy link
Member

CUDA::nvToolsExt is the legacy NVTX v2 header and library, which preceded CUDA 10.0

Users are recommended to move to the NVTX 3 header-only component introduced in CUDA 10.0, which can be picked up by using the target CUDA::nvtx3

Am wondering if there is some reason the newer NVTX is not used in this case


In terms of the search path issue, one thing to try would be to pass ${CMAKE_ARGS} to the cmake call. This is set in conda-forge to provide additional configuration to CMake (like where to look for certain things)

If that doesn't work, we may need verbose info from CMake to debug further

@matthewfeickert
Copy link
Member

matthewfeickert commented Jan 8, 2025

Am wondering if there is some reason the newer NVTX is not used in this case

$ grep -r 'CUDA::nvToolsExt'
...
.pixi/envs/default/share/cmake/Caffe2/FindCUDAToolkit.cmake:- ``CUDA::nvToolsExt``
.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:  set_property(TARGET torch::nvtoolsext PROPERTY INTERFACE_LINK_LIBRARIES CUDA::nvToolsExt)
.pixi/envs/default/share/cmake-3.31/Modules/FindCUDAToolkit.cmake:- ``CUDA::nvToolsExt``
.pixi/envs/default/share/cmake-3.31/Modules/FindCUDAToolkit.cmake:    if(TARGET CUDA::nvToolsExt AND CMAKE_MINIMUM_REQUIRED_VERSION VERSION_GREATER_EQUAL 3.25)
.pixi/envs/default/share/cmake-3.31/Modules/FindCUDAToolkit.cmake:      set_property(TARGET CUDA::nvToolsExt PROPERTY DEPRECATION "nvToolsExt has been superseded by nvtx3 since CUDA 10.0 and CMake 3.25. Use CUDA::nvtx3 and include <nvtx3/nvToolsExt.h> instead.")

so these are apparently coming from Caffe2 in PyTorch

$ pixi list pytorch
Package  Version  Build                           Size      Kind   Source
pytorch  2.5.1    cuda126_mkl_py312_hdbe889e_308  35.6 MiB  conda  pytorch

but as to the why I don't know. Though from $CONDA_PREFIX/share/cmake/Caffe2/public/cuda.cmake

...
# nvToolsExt
if(USE_SYSTEM_NVTX)
  find_path(nvtx3_dir NAMES nvtx3)
else()
  find_path(nvtx3_dir NAMES nvtx3 PATHS "${PROJECT_SOURCE_DIR}/third_party/NVTX/c/include" NO_DEFAULT_PATH)
endif()
find_package_handle_standard_args(nvtx3 DEFAULT_MSG nvtx3_dir)
if(nvtx3_FOUND)
  add_library(torch::nvtx3 INTERFACE IMPORTED)
  target_include_directories(torch::nvtx3 INTERFACE "${nvtx3_dir}")
  target_compile_definitions(torch::nvtx3 INTERFACE TORCH_CUDA_USE_NVTX3)
else()
  message(WARNING "Cannot find NVTX3, find old NVTX instead")
  add_library(torch::nvtoolsext INTERFACE IMPORTED)
  set_property(TARGET torch::nvtoolsext PROPERTY INTERFACE_LINK_LIBRARIES CUDA::nvToolsExt)
endif()
...

(on Pytorch's GitHub I can only find this in cmake/public/cuda.cmake so I guess it is patched or has its path renamed?)

I now see that I can set -DUSE_SYSTEM_NVTX=TRUE in my cmake args and things work (though with warnings and for the wrong reasons as it is finding my local machine's /usr/include/nvtx3/ and not anything installed in the pixi environment).

Looking for anything nvtx3 related in the environment only surfaces

# find . -type f -iname "*nvtx3*"
$CONDA_PREFIX/targets/x86_64-linux/include/cub/detail/nvtx3.hpp
Build log with warnings:
...
CMake Warning at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:140 (message):
  Failed to compute shorthash for libnvrtc.so
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


CMake Warning (dev) at /tmp/example/.pixi/envs/default/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:441 (message):
  The package name passed to `find_package_handle_standard_args` (nvtx3) does
  not match the name of the calling package (Caffe2).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:178 (find_package_handle_standard_args)
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found nvtx3: /usr/include
-- USE_CUDNN is set to 0. Compiling without cuDNN support
-- USE_CUSPARSELT is set to 0. Compiling without cuSPARSELt support
-- USE_CUDSS is set to 0. Compiling without cuDSS support
-- USE_CUFILE is set to 0. Compiling without cuFile support
-- Autodetected CUDA architecture(s):  8.9
-- Added CUDA NVCC flags for: -gencode;arch=compute_89,code=sm_89
-- Found Torch: /tmp/example/.pixi/envs/default/lib/libtorch.so
-- Configuring done (7.0s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/example/build
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 28.3.0
-- Unable to find cublas_v2.h in either "/tmp/example/.pixi/envs/default/targets/x86_64-linux/include" or "/tmp/example/.pixi/envs/default/math_libs/include"
-- Caffe2: CUDA detected: 12.6
-- Caffe2: CUDA nvcc is: /tmp/example/.pixi/envs/default/bin/nvcc
-- Caffe2: CUDA toolkit directory: /tmp/example/.pixi/envs/default/targets/x86_64-linux/include/cuda
-- Caffe2: Header version is: 12.6
CMake Warning at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:140 (message):
  Failed to compute shorthash for libnvrtc.so
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


CMake Warning (dev) at /tmp/example/.pixi/envs/default/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:441 (message):
  The package name passed to `find_package_handle_standard_args` (nvtx3) does
  not match the name of the calling package (Caffe2).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:178 (find_package_handle_standard_args)
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- USE_CUDNN is set to 0. Compiling without cuDNN support
-- USE_CUSPARSELT is set to 0. Compiling without cuSPARSELt support
-- USE_CUDSS is set to 0. Compiling without cuDSS support
-- USE_CUFILE is set to 0. Compiling without cuFile support
-- Autodetected CUDA architecture(s):  8.9
-- Added CUDA NVCC flags for: -gencode;arch=compute_89,code=sm_89
-- Configuring done (1.1s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/example/build
-- Cache values
// Path to a library.
C10_CUDA_LIBRARY:FILEPATH=/tmp/example/.pixi/envs/default/lib/libc10_cuda.so

// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=Release

// CUDA architectures
CMAKE_CUDA_ARCHITECTURES:STRING=52

// Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/tmp/example/.pixi/envs/default

// Host side compiler used by NVCC
CUDA_HOST_COMPILER:FILEPATH=/tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-cc

// Path to a program.
CUDA_NVCC_EXECUTABLE:FILEPATH=/tmp/example/.pixi/envs/default/bin/nvcc

// 
CUDA_NVRTC_LIB:FILEPATH=/tmp/example/.pixi/envs/default/targets/x86_64-linux/lib/libnvrtc.so.12.6.85

// Path to a file.
CUDA_SDK_ROOT_DIR:PATH=CUDA_SDK_ROOT_DIR-NOTFOUND

// The directory containing a CMake configuration file for Caffe2.
Caffe2_DIR:PATH=/tmp/example/.pixi/envs/default/share/cmake/Caffe2

// The directory containing a CMake configuration file for MKLDNN.
MKLDNN_DIR:PATH=MKLDNN_DIR-NOTFOUND

// The directory containing a CMake configuration file for MKL.
MKL_DIR:PATH=MKL_DIR-NOTFOUND

// The directory containing a CMake configuration file for Protobuf.
Protobuf_DIR:PATH=/tmp/example/.pixi/envs/default/lib/cmake/protobuf

// Path to a library.
TORCH_LIBRARY:FILEPATH=/tmp/example/.pixi/envs/default/lib/libtorch.so

// The directory containing a CMake configuration file for Torch.
Torch_DIR:PATH=/tmp/example/.pixi/envs/default/share/cmake/Torch

// The directory containing a CMake configuration file for absl.
absl_DIR:PATH=/tmp/example/.pixi/envs/default/lib/cmake/absl

// Path to a library.
c10_LIBRARY:FILEPATH=/tmp/example/.pixi/envs/default/lib/libc10.so

// Path to a file.
nvtx3_dir:PATH=/usr/include

// The directory containing a CMake configuration file for utf8_range.
utf8_range_DIR:PATH=/tmp/example/.pixi/envs/default/lib/cmake/utf8_range

[ 25%] Building Fortran object CMakeFiles/ftorch.dir/ftorch.F90.o
[ 50%] Building CXX object CMakeFiles/ftorch.dir/ctorch.cpp.o
[ 75%] Building Fortran object CMakeFiles/ftorch.dir/ftorch_test_utils.f90.o
[100%] Linking CXX shared library libftorch.so
[100%] Built target ftorch
-- Install configuration: "Release"
-- Installing: /tmp/example/.pixi/envs/default/lib/libftorch.so
-- Set non-toolchain portion of runtime path of "/tmp/example/.pixi/envs/default/lib/libftorch.so" to "$ORIGIN/../lib:/lib/intel64:/lib/intel64_win:/lib/win-x64"
-- Installing: /tmp/example/.pixi/envs/default/include/ctorch.h
-- Installing: /tmp/example/.pixi/envs/default/lib/cmake/FTorch/FTorchConfig.cmake
-- Installing: /tmp/example/.pixi/envs/default/lib/cmake/FTorch/FTorchConfig-release.cmake
-- Installing: /tmp/example/.pixi/envs/default/include/ftorch/ftorch.mod
-- Installing: /tmp/example/.pixi/envs/default/include/ftorch/ftorch_test_utils.mod

@jakirkham
Copy link
Member

Thanks Matthew! 🙏

Right think USE_SYSTEM_NVTX comes from this aforementioned patch, which has also been upstreamed to PyTorch ( pytorch/pytorch@3cfd244 ). Looks like it will be included in PyTorch 2.6.0

In terms of the warnings, think we are missing the *-dev packages, which are used to pull in headers, config files (for pkg-config and CMake), etc.. For example cuda-nvtx-dev has the headers

Mentioning this as lines like Found nvtx3: /usr/include suggest some other copy of NVTX is getting picked up

Also there are a few warnings like these. Not sure whether FTorch actually uses these. If not, this may not matter

-- USE_CUDNN is set to 0. Compiling without cuDNN support
-- USE_CUSPARSELT is set to 0. Compiling without cuSPARSELt support
-- USE_CUDSS is set to 0. Compiling without cuDSS support
-- USE_CUFILE is set to 0. Compiling without cuFile support

Fixing these would depend on providing the corresponding CUDA packages and possibly setting some environment variables from here or here

@matthewfeickert
Copy link
Member

Thanks very much for your help, @jakirkham. I was missing cuda-libraries-dev and cuda-nvtx-dev. Combining these with the cmake args -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python and -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 did the trick as the following pixi manifest

[project]
authors = ["Matthew Feickert <[email protected]>"]
channels = ["conda-forge"]
description = "Add a short description here"
name = "example"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

# Selecting 6055a7dd35e394daff469673feac063f1bfaae01 as reference
clone = """
rm -rf FTorch && \
git clone https://github.com/Cambridge-ICCS/FTorch.git && \
cd FTorch && \
git reset --hard 6055a7dd35e394daff469673feac063f1bfaae01 && \
sed -i 's/cmake_minimum_required(VERSION 3.15 FATAL_ERROR)/cmake_minimum_required(VERSION 3.15...3.31 FATAL_ERROR)/g' src/CMakeLists.txt
"""

# Note that libtorch is at $CONDA_PREFIX/lib/libtorch.so
build = """
rm -rf build && \
cmake \
    $CMAKE_ARGS \
    -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
    -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
    -DCMAKE_BUILD_TYPE=Release \
    -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python \
    -DENABLE_CUDA=TRUE \
    -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 \
    -DCMAKE_VERBOSE_MAKEFILE=TRUE \
    -S FTorch/src/ \
    -B build && \
cmake -LH build && \
cmake --build build --clean-first --parallel=10 && \
cmake --install build
"""

start = { depends-on = ["clone", "build"] }

[system-requirements]
cuda = "12.0"

[dependencies]
fortran-compiler = ">=1.5.2,<2"
cxx-compiler = ">=1.5.2,<2"
cuda-compiler = ">=12.6.3,<13"
cuda-libraries-dev = ">=12.6.3,<13"
cuda-nvtx-dev = ">=12.6.77,<13"
cmake = ">=3.31.2,<4"
pytorch = ">=2.5.1,<3"
zlib = ">=1.3.1,<2"
# build tools
git = ">=2.47.1,<3"
sed = ">=4.8,<5"
# examples
torchvision = ">=0.20.1,<0.21"
mpi4py = ">=4.0.1,<5"
openmpi-mpifort = ">=5.0.6,<6"

now provides a working (still with warnings, but I think tolerable warnings) build.

$ pixi list | grep 'python\|pytorch\|cuda'
cpython                      3.12.8        py312hd8ed1ab_1                 43.7 KiB   conda  cpython
cuda-cccl_linux-64           12.6.77       ha770c72_0                      1 MiB      conda  cuda-cccl_linux-64
cuda-compiler                12.6.3        hbad6d8a_0                      19.7 KiB   conda  cuda-compiler
cuda-crt-dev_linux-64        12.6.85       ha770c72_0                      86.7 KiB   conda  cuda-crt-dev_linux-64
cuda-crt-tools               12.6.85       ha770c72_0                      26.5 KiB   conda  cuda-crt-tools
cuda-cudart                  12.6.77       h5888daf_0                      21.9 KiB   conda  cuda-cudart
cuda-cudart-dev              12.6.77       h5888daf_0                      22.3 KiB   conda  cuda-cudart-dev
cuda-cudart-dev_linux-64     12.6.77       h3f2d84a_0                      356.8 KiB  conda  cuda-cudart-dev_linux-64
cuda-cudart-static           12.6.77       h5888daf_0                      21.9 KiB   conda  cuda-cudart-static
cuda-cudart-static_linux-64  12.6.77       h3f2d84a_0                      744.5 KiB  conda  cuda-cudart-static_linux-64
cuda-cudart_linux-64         12.6.77       h3f2d84a_0                      184.2 KiB  conda  cuda-cudart_linux-64
cuda-cuobjdump               12.6.77       hbd13f7d_1                      240.8 KiB  conda  cuda-cuobjdump
cuda-cupti                   12.6.80       hbd13f7d_0                      1.9 MiB    conda  cuda-cupti
cuda-cuxxfilt                12.6.77       hbd13f7d_1                      210.9 KiB  conda  cuda-cuxxfilt
cuda-driver-dev              12.6.77       h5888daf_0                      21.7 KiB   conda  cuda-driver-dev
cuda-driver-dev_linux-64     12.6.77       h3f2d84a_0                      34.9 KiB   conda  cuda-driver-dev_linux-64
cuda-libraries-dev           12.6.3        ha770c72_0                      19.6 KiB   conda  cuda-libraries-dev
cuda-nvcc                    12.6.85       hcdd1206_0                      23.1 KiB   conda  cuda-nvcc
cuda-nvcc-dev_linux-64       12.6.85       he91c749_0                      10.8 MiB   conda  cuda-nvcc-dev_linux-64
cuda-nvcc-impl               12.6.85       h85509e4_0                      24.9 KiB   conda  cuda-nvcc-impl
cuda-nvcc-tools              12.6.85       he02047a_0                      23 MiB     conda  cuda-nvcc-tools
cuda-nvcc_linux-64           12.6.85       h04802cd_0                      24.7 KiB   conda  cuda-nvcc_linux-64
cuda-nvdisasm                12.6.77       hbd13f7d_1                      47.6 MiB   conda  cuda-nvdisasm
cuda-nvprune                 12.6.77       hbd13f7d_1                      66.4 KiB   conda  cuda-nvprune
cuda-nvrtc                   12.6.85       hbd13f7d_0                      17.3 MiB   conda  cuda-nvrtc
cuda-nvrtc-dev               12.6.85       h5888daf_0                      31.5 KiB   conda  cuda-nvrtc-dev
cuda-nvtx                    12.6.77       hbd13f7d_0                      30.6 KiB   conda  cuda-nvtx
cuda-nvtx-dev                12.6.77       ha770c72_0                      49.1 KiB   conda  cuda-nvtx-dev
cuda-nvvm-dev_linux-64       12.6.85       ha770c72_0                      24.6 KiB   conda  cuda-nvvm-dev_linux-64
cuda-nvvm-impl               12.6.85       he02047a_0                      7.7 MiB    conda  cuda-nvvm-impl
cuda-nvvm-tools              12.6.85       he02047a_0                      10.4 MiB   conda  cuda-nvvm-tools
cuda-opencl                  12.6.77       hbd13f7d_0                      29.4 KiB   conda  cuda-opencl
cuda-opencl-dev              12.6.77       h5888daf_0                      93 KiB     conda  cuda-opencl-dev
cuda-profiler-api            12.6.77       h7938cbb_0                      22.3 KiB   conda  cuda-profiler-api
cuda-version                 12.6          h7480c83_3                      20.4 KiB   conda  cuda-version
libtorch                     2.5.1         cuda126_mkl_h2a4acef_308        491.1 MiB  conda  libtorch
python                       3.12.8        h9e4cc4f_1_cpython              30.1 MiB   conda  python
python_abi                   3.12          5_cp312                         6.1 KiB    conda  python_abi
pytorch                      2.5.1         cuda126_mkl_py312_hdbe889e_308  35.6 MiB   conda  pytorch
torchvision                  0.20.1        cuda126_py312_h17ccbaa_4        2.7 MiB    conda  torchvision
triton                       3.1.0         cuda126py312h776fbae_4          89 MiB     conda  triton
Full build log:
$ pixi clean && rm -rf pixi.lock && pixi run start
  removed /tmp/example/.pixi/envs                                                                                                                                                                           ✨ Pixi task (clone): rm -rf FTorch && git clone https://github.com/Cambridge-ICCS/FTorch.git && cd FTorch && git reset --hard 6055a7dd35e394daff469673feac063f1bfaae01 && sed -i 's/cmake_minimum_required(VERSION 3.15 FATAL_ERROR)/cmake_minimum_required(VERSION 3.15...3.31 FATAL_ERROR)/g' src/CMakeLists.txt

Cloning into 'FTorch'...
remote: Enumerating objects: 5458, done.
remote: Counting objects: 100% (1658/1658), done.
remote: Compressing objects: 100% (584/584), done.
remote: Total 5458 (delta 1347), reused 1116 (delta 1074), pack-reused 3800 (from 2)
Receiving objects: 100% (5458/5458), 5.94 MiB | 7.24 MiB/s, done.
Resolving deltas: 100% (4215/4215), done.
HEAD is now at 6055a7d Unit tests (using pFunit) (#76)

✨ Pixi task (build): rm -rf build && cmake $CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python -DENABLE_CUDA=TRUE -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 -DCMAKE_VERBOSE_MAKEFILE=TRUE -S FTorch/src/ -B build && cmake -LH build && cmake --build build --clean-first --parallel=10 && cmake --install build

-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- The Fortran compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-gfortran - skipped
-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
-- Verifying Fortran/CXX Compiler Compatibility
-- Verifying Fortran/CXX Compiler Compatibility - Success
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - /tmp/example/.pixi/envs/default/bin/nvcc
-- The CUDA compiler identification is NVIDIA 12.6.85 with host compiler GNU 11.4.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /tmp/example/.pixi/envs/default/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Found ZLIB: /tmp/example/.pixi/envs/default/lib/libz.so (found version "1.3.1")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 28.3.0
-- Found CUDA: /tmp/example/.pixi/envs/default (found version "12.6") 
-- Found CUDAToolkit: /tmp/example/.pixi/envs/default/targets/x86_64-linux/include (found version "12.6.85")
-- Caffe2: CUDA detected: 12.6
-- Caffe2: CUDA nvcc is: /tmp/example/.pixi/envs/default/bin/nvcc
-- Caffe2: CUDA toolkit directory: /tmp/example/.pixi/envs/default
-- Caffe2: Header version is: 12.6
-- Found Python: /tmp/example/.pixi/envs/default/bin/python (found version "3.12.8") found components: Interpreter
CMake Warning at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:140 (message):
  Failed to compute shorthash for libnvrtc.so
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


CMake Warning (dev) at /tmp/example/.pixi/envs/default/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:441 (message):
  The package name passed to `find_package_handle_standard_args` (nvtx3) does
  not match the name of the calling package (Caffe2).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:178 (find_package_handle_standard_args)
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found nvtx3: /tmp/example/.pixi/envs/default/targets/x86_64-linux/include/nvtx3
-- USE_CUDNN is set to 0. Compiling without cuDNN support
-- USE_CUSPARSELT is set to 0. Compiling without cuSPARSELt support
-- USE_CUDSS is set to 0. Compiling without cuDSS support
-- USE_CUFILE is set to 0. Compiling without cuFile support
-- Autodetected CUDA architecture(s):  8.9
-- Added CUDA NVCC flags for: -gencode;arch=compute_89,code=sm_89
-- Found Torch: /tmp/example/.pixi/envs/default/lib/libtorch.so
-- Configuring done (6.5s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/example/build
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 28.3.0
-- Caffe2: CUDA detected: 12.6
-- Caffe2: CUDA nvcc is: /tmp/example/.pixi/envs/default/bin/nvcc
-- Caffe2: CUDA toolkit directory: /tmp/example/.pixi/envs/default
-- Caffe2: Header version is: 12.6
CMake Warning at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:140 (message):
  Failed to compute shorthash for libnvrtc.so
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


CMake Warning (dev) at /tmp/example/.pixi/envs/default/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:441 (message):
  The package name passed to `find_package_handle_standard_args` (nvtx3) does
  not match the name of the calling package (Caffe2).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:178 (find_package_handle_standard_args)
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- USE_CUDNN is set to 0. Compiling without cuDNN support
-- USE_CUSPARSELT is set to 0. Compiling without cuSPARSELt support
-- USE_CUDSS is set to 0. Compiling without cuDSS support
-- USE_CUFILE is set to 0. Compiling without cuFile support
-- Autodetected CUDA architecture(s):  8.9
-- Added CUDA NVCC flags for: -gencode;arch=compute_89,code=sm_89
-- Configuring done (1.1s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/example/build
-- Cache values
// Path to a library.
C10_CUDA_LIBRARY:FILEPATH=/tmp/example/.pixi/envs/default/lib/libc10_cuda.so

// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=Release

// CUDA architectures
CMAKE_CUDA_ARCHITECTURES:STRING=52

// Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/tmp/example/.pixi/envs/default

// Host side compiler used by NVCC
CUDA_HOST_COMPILER:FILEPATH=/tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-cc

// Path to a program.
CUDA_NVCC_EXECUTABLE:FILEPATH=/tmp/example/.pixi/envs/default/bin/nvcc

// 
CUDA_NVRTC_LIB:FILEPATH=/tmp/example/.pixi/envs/default/lib/libnvrtc.so

// Path to a file.
CUDA_SDK_ROOT_DIR:PATH=CUDA_SDK_ROOT_DIR-NOTFOUND

// Toolkit location.
CUDA_TOOLKIT_ROOT_DIR:PATH=/tmp/example/.pixi/envs/default

// The directory containing a CMake configuration file for Caffe2.
Caffe2_DIR:PATH=/tmp/example/.pixi/envs/default/share/cmake/Caffe2

// The directory containing a CMake configuration file for MKLDNN.
MKLDNN_DIR:PATH=MKLDNN_DIR-NOTFOUND

// The directory containing a CMake configuration file for MKL.
MKL_DIR:PATH=MKL_DIR-NOTFOUND

// The directory containing a CMake configuration file for Protobuf.
Protobuf_DIR:PATH=/tmp/example/.pixi/envs/default/lib/cmake/protobuf

// Path to a library.
TORCH_LIBRARY:FILEPATH=/tmp/example/.pixi/envs/default/lib/libtorch.so

// The directory containing a CMake configuration file for Torch.
Torch_DIR:PATH=/tmp/example/.pixi/envs/default/share/cmake/Torch

// The directory containing a CMake configuration file for absl.
absl_DIR:PATH=/tmp/example/.pixi/envs/default/lib/cmake/absl

// Path to a library.
c10_LIBRARY:FILEPATH=/tmp/example/.pixi/envs/default/lib/libc10.so

// Path to a file.
nvtx3_dir:PATH=/tmp/example/.pixi/envs/default/targets/x86_64-linux/include/nvtx3

// The directory containing a CMake configuration file for utf8_range.
utf8_range_DIR:PATH=/tmp/example/.pixi/envs/default/lib/cmake/utf8_range

Change Dir: '/tmp/example/build'

Run Clean Command: /tmp/example/.pixi/envs/default/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile -j10 clean
/usr/bin/gmake  -f CMakeFiles/Makefile2 clean
gmake[1]: Entering directory '/tmp/example/build'
/usr/bin/gmake  -f CMakeFiles/ftorch.dir/build.make CMakeFiles/ftorch.dir/clean
gmake[2]: Entering directory '/tmp/example/build'
/tmp/example/.pixi/envs/default/bin/cmake -P CMakeFiles/ftorch.dir/cmake_clean.cmake
gmake[2]: Leaving directory '/tmp/example/build'
gmake[1]: Leaving directory '/tmp/example/build'

Run Build Command(s): /tmp/example/.pixi/envs/default/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile -j10
/tmp/example/.pixi/envs/default/bin/cmake -S/tmp/example/FTorch/src -B/tmp/example/build --check-build-system CMakeFiles/Makefile.cmake 0
/tmp/example/.pixi/envs/default/bin/cmake -E cmake_progress_start /tmp/example/build/CMakeFiles /tmp/example/build//CMakeFiles/progress.marks
/usr/bin/gmake  -f CMakeFiles/Makefile2 all
gmake[1]: Entering directory '/tmp/example/build'
/usr/bin/gmake  -f CMakeFiles/ftorch.dir/build.make CMakeFiles/ftorch.dir/depend
gmake[2]: Entering directory '/tmp/example/build'
cd /tmp/example/build && /tmp/example/.pixi/envs/default/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/example/FTorch/src /tmp/example/FTorch/src /tmp/example/build /tmp/example/build /tmp/example/build/CMakeFiles/ftorch.dir/DependInfo.cmake "--color="
Dependee "/tmp/example/build/CMakeFiles/ftorch.dir/DependInfo.cmake" is newer than depender "/tmp/example/build/CMakeFiles/ftorch.dir/depend.internal".
Dependee "/tmp/example/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/tmp/example/build/CMakeFiles/ftorch.dir/depend.internal".
Scanning dependencies of target ftorch
gmake[2]: Leaving directory '/tmp/example/build'
/usr/bin/gmake  -f CMakeFiles/ftorch.dir/build.make CMakeFiles/ftorch.dir/build
gmake[2]: Entering directory '/tmp/example/build'
[ 25%] Building Fortran object CMakeFiles/ftorch.dir/ftorch.F90.o
/tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-gfortran -DPROTOBUF_USE_DLLS -DUNIX -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_RPC -DUSE_TENSORPIPE -Dftorch_EXPORTS -I/tmp/example/build/modules -I/tmp/example/.pixi/envs/default/include -I/tmp/example/.pixi/envs/default/include/torch/csrc/api/include -I/tmp/example/.pixi/envs/default/targets/x86_64-linux/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /tmp/example/.pixi/envs/default/include -O3 -Jmodules -fPIC -D_GLIBCXX_USE_CXX11_ABI=1 -c /tmp/example/FTorch/src/ftorch.F90 -o CMakeFiles/ftorch.dir/ftorch.F90.o
[ 50%] Building Fortran object CMakeFiles/ftorch.dir/ftorch_test_utils.f90.o
[ 75%] Building CXX object CMakeFiles/ftorch.dir/ctorch.cpp.o
/tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-gfortran -DPROTOBUF_USE_DLLS -DUNIX -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_RPC -DUSE_TENSORPIPE -Dftorch_EXPORTS -I/tmp/example/build/modules -I/tmp/example/.pixi/envs/default/include -I/tmp/example/.pixi/envs/default/include/torch/csrc/api/include -I/tmp/example/.pixi/envs/default/targets/x86_64-linux/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /tmp/example/.pixi/envs/default/include -O3 -Jmodules -fPIC -D_GLIBCXX_USE_CXX11_ABI=1 -c /tmp/example/FTorch/src/ftorch_test_utils.f90 -o CMakeFiles/ftorch.dir/ftorch_test_utils.f90.o
/tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-c++ -DPROTOBUF_USE_DLLS -DUNIX -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_RPC -DUSE_TENSORPIPE -Dftorch_EXPORTS -I/tmp/example/build/modules -isystem /tmp/example/.pixi/envs/default/include/torch/csrc/api/include -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /tmp/example/.pixi/envs/default/include  -I/tmp/example/.pixi/envs/default/targets/x86_64-linux/include -O3 -DNDEBUG -std=c++17 -fPIC -D_GLIBCXX_USE_CXX11_ABI=1 -MD -MT CMakeFiles/ftorch.dir/ctorch.cpp.o -MF CMakeFiles/ftorch.dir/ctorch.cpp.o.d -o CMakeFiles/ftorch.dir/ctorch.cpp.o -c /tmp/example/FTorch/src/ctorch.cpp
/tmp/example/.pixi/envs/default/bin/cmake -E cmake_copy_f90_mod modules/ftorch_test_utils.mod CMakeFiles/ftorch.dir/ftorch_test_utils.mod.stamp GNU
/tmp/example/.pixi/envs/default/bin/cmake -E touch CMakeFiles/ftorch.dir/ftorch_test_utils.f90.o.provides.build
/tmp/example/.pixi/envs/default/bin/cmake -E cmake_copy_f90_mod modules/ftorch.mod CMakeFiles/ftorch.dir/ftorch.mod.stamp GNU
/tmp/example/.pixi/envs/default/bin/cmake -E touch CMakeFiles/ftorch.dir/ftorch.F90.o.provides.build
[100%] Linking CXX shared library libftorch.so
/tmp/example/.pixi/envs/default/bin/cmake -E cmake_link_script CMakeFiles/ftorch.dir/link.txt --verbose=1
/tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-c++ -fPIC -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /tmp/example/.pixi/envs/default/include  -I/tmp/example/.pixi/envs/default/targets/x86_64-linux/include -O3 -DNDEBUG -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,/tmp/example/.pixi/envs/default/lib -Wl,-rpath-link,/tmp/example/.pixi/envs/default/lib -L/tmp/example/.pixi/envs/default/lib  -L/tmp/example/.pixi/envs/default/targets/x86_64-linux/lib -L/tmp/example/.pixi/envs/default/targets/x86_64-linux/lib/stubs -shared -Wl,-soname,libftorch.so -o libftorch.so CMakeFiles/ftorch.dir/ctorch.cpp.o CMakeFiles/ftorch.dir/ftorch.F90.o CMakeFiles/ftorch.dir/ftorch_test_utils.f90.o   -L/lib/intel64  -L/lib/intel64_win  -L/lib/win-x64  -Wl,-rpath,/lib/intel64:/lib/intel64_win:/lib/win-x64::::::::::::::: /tmp/example/.pixi/envs/default/lib/libtorch.so /tmp/example/.pixi/envs/default/lib/libc10.so /tmp/example/.pixi/envs/default/lib/libnvrtc.so /tmp/example/.pixi/envs/default/lib/libc10_cuda.so -Wl,--no-as-needed,"/tmp/example/.pixi/envs/default/lib/libtorch_cpu.so" -Wl,--as-needed /tmp/example/.pixi/envs/default/lib/libprotobuf.so.28.3.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_internal_check_op.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_leak_check.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_die_if_null.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_internal_conditions.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_internal_message.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_internal_nullguard.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_examine_stack.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_internal_format.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_internal_proto.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_internal_log_sink_set.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_sink.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_entry.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_flags_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_flags_marshalling.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_flags_reflection.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_flags_config.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_flags_program_name.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_flags_private_handle_accessor.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_flags_commandlineflag.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_flags_commandlineflag_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_initialize.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_internal_globals.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_globals.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_vlog_config_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_internal_fnmatch.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_raw_hash_set.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_hash.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_city.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_low_level_hash.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_hashtablez_sampler.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_distributions.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_seed_sequences.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_internal_pool_urbg.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_internal_randen.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_internal_randen_hwaes.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_internal_randen_hwaes_impl.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_internal_randen_slow.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_internal_platform.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_internal_seed_material.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_random_seed_gen_exception.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_statusor.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_status.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_cord.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_cordz_info.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_cord_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_cordz_functions.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_exponential_biased.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_cordz_handle.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_crc_cord_state.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_crc32c.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_crc_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_crc_cpu_detect.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_bad_optional_access.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_strerror.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_str_format_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_synchronization.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_stacktrace.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_symbolize.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_debugging_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_demangle_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_demangle_rust.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_decode_rust_punycode.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_utf8_for_code_point.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_graphcycles_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_kernel_timeout_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_malloc_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_time.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_civil_time.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_time_zone.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_bad_variant_access.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_strings.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_int128.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_strings_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_string_view.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_base.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_spinlock_wait.so.2407.0.0 -lpthread /tmp/example/.pixi/envs/default/lib/libabsl_throw_delegate.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_raw_logging_internal.so.2407.0.0 /tmp/example/.pixi/envs/default/lib/libabsl_log_severity.so.2407.0.0 -Wl,--no-as-needed,"/tmp/example/.pixi/envs/default/lib/libtorch_cuda.so" -Wl,--as-needed /tmp/example/.pixi/envs/default/lib/libc10_cuda.so /tmp/example/.pixi/envs/default/lib/libc10.so /tmp/example/.pixi/envs/default/lib/libcudart.so -Wl,--no-as-needed,"/tmp/example/.pixi/envs/default/lib/libtorch.so" -Wl,--as-needed -lgfortran -lquadmath
gmake[2]: Leaving directory '/tmp/example/build'
[100%] Built target ftorch
gmake[1]: Leaving directory '/tmp/example/build'
/tmp/example/.pixi/envs/default/bin/cmake -E cmake_progress_start /tmp/example/build/CMakeFiles 0

-- Install configuration: "Release"
-- Installing: /tmp/example/.pixi/envs/default/lib/libftorch.so
-- Set non-toolchain portion of runtime path of "/tmp/example/.pixi/envs/default/lib/libftorch.so" to "$ORIGIN/../lib:/lib/intel64:/lib/intel64_win:/lib/win-x64"
-- Installing: /tmp/example/.pixi/envs/default/include/ctorch.h
-- Installing: /tmp/example/.pixi/envs/default/lib/cmake/FTorch/FTorchConfig.cmake
-- Installing: /tmp/example/.pixi/envs/default/lib/cmake/FTorch/FTorchConfig-release.cmake
-- Installing: /tmp/example/.pixi/envs/default/include/ftorch/ftorch.mod
-- Installing: /tmp/example/.pixi/envs/default/include/ftorch/ftorch_test_utils.mod

So I think I have everything I need now. 👍


@q10, I'm not sure if your questions are resolved now, but I would try

conda install --channel conda-forge cuda-libraries-dev cuda-nvtx-dev

and try again while setting nvtx3_dir for your CMake build.

@jakirkham
Copy link
Member

Great, thanks Matthew! 🙏

The cuda-libraries-dev package can be a good choice if one just wants to grab all of the CUDA Toolkit (CTK) development library packages. It's possible a more focused subset could be used for situations where network, space, or other limitations apply. That said, it is certainly nice to have that one package to install and can be more ergonomic

FWIW the equivalent of installing the entire CUDA Toolkit (except the driver) would be

conda install --channel conda-forge cuda-version=<CTK version> cuda

@matthewfeickert
Copy link
Member

Hm. Curiously, the environment I arrived at in #59 (comment) seems brittle. I had run this under /tmp/example on my machine, and after having /tmp get cleared I reran this again today and found that I arrive at @q10's original issue again during cmake execution.

...
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 28.3.0
-- Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS) (found version "12.6")
CMake Warning at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:31 (message):
  Caffe2: CUDA cannot be found.  Depending on whether you are building Caffe2
  or a Caffe2 dependent library, the next warning / error will give you more
  info.
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


CMake Error at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:90 (message):
  Your installed Caffe2 version uses CUDA but I cannot find the CUDA
  libraries.  Please set the proper CUDA prefixes and / or install CUDA.
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


-- Configuring incomplete, errors occurred!

Reproducer

If I start from #59 (comment) and modify it in the following ways:

  • Update to use Cambridge-ICCS/FTorch@03c5475 (though the issue is repeatable with the original 6055a7dd35e394daff469673feac063f1bfaae01)
  • Replicate the environment from 2025-01-08 as much as possible with:
    • Restricting Python to >=3.12.8,<3.13
    • Setting cuda-version=12.6

This results in the following pixi manifest pixi.toml

pixi.toml:
[project]
authors = ["Matthew Feickert <[email protected]>"]
channels = ["conda-forge"]
description = "Add a short description here"
name = "example"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

# Selecting 03c5475b6d05bf2c90cc1cd572187ef4b5946b3e as reference
clone = """
rm -rf FTorch && \
git clone https://github.com/Cambridge-ICCS/FTorch.git && \
cd FTorch && \
git reset --hard 03c5475b6d05bf2c90cc1cd572187ef4b5946b3e
"""

# Note that libtorch is at $CONDA_PREFIX/lib/libtorch.so
build = """
rm -rf build && \
cmake \
    $CMAKE_ARGS \
    -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
    -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
    -DCMAKE_BUILD_TYPE=Release \
    -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python \
    -DENABLE_CUDA=TRUE \
    -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 \
    -DCMAKE_VERBOSE_MAKEFILE=TRUE \
    -S FTorch/src/ \
    -B build && \
cmake -LH build && \
cmake --build build --clean-first --parallel=10 && \
cmake --install build
"""

start = { depends-on = ["clone", "build"] }

[system-requirements]
cuda = "12.0"

[dependencies]
fortran-compiler = ">=1.5.2,<2"
cxx-compiler = ">=1.5.2,<2"
cuda-compiler = ">=12.6.3,<13"
cuda-libraries-dev = ">=12.6.3,<13"
cuda-nvtx-dev = ">=12.6.77,<13"
cuda-version = "12.6.*"
python = ">=3.12.8,<3.13"
cmake = ">=3.31.2,<4"
pytorch = ">=2.5.1,<3"
zlib = ">=1.3.1,<2"
# build tools
git = ">=2.47.1,<3"

which in terms of a conda environment.yml

pixi project export conda-environment environment.yml

would be

name: default
channels:
- conda-forge
- nodefaults
dependencies:
- fortran-compiler >=1.5.2,<2
- cxx-compiler >=1.5.2,<2
- cuda-compiler >=12.6.3,<13
- cuda-libraries-dev >=12.6.3,<13
- cuda-nvtx-dev >=12.6.77,<13
- cuda-version 12.6.*
- python >=3.12.8,<3.13
- cmake >=3.31.2,<4
- pytorch >=2.5.1,<3
- zlib >=1.3.1,<2
- git >=2.47.1,<3
Full build log:
$ pixi clean && rm -rf pixi.lock && pixi run start
  removed /tmp/example/.pixi/envs                                                                                                                                                                           ✨ Pixi task (clone): rm -rf FTorch && git clone https://github.com/Cambridge-ICCS/FTorch.git && cd FTorch && git reset --hard 03c5475b6d05bf2c90cc1cd572187ef4b5946b3e

Cloning into 'FTorch'...
remote: Enumerating objects: 5966, done.
remote: Counting objects: 100% (1653/1653), done.
remote: Compressing objects: 100% (701/701), done.
remote: Total 5966 (delta 1304), reused 1019 (delta 948), pack-reused 4313 (from 2)
Receiving objects: 100% (5966/5966), 6.40 MiB | 4.05 MiB/s, done.
Resolving deltas: 100% (4683/4683), done.
HEAD is now at 03c5475 Avoid double negatives in the run tests shell script to make things clearer.

✨ Pixi task (build): rm -rf build && cmake $CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python -DENABLE_CUDA=TRUE -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 -DCMAKE_VERBOSE_MAKEFILE=TRUE -S FTorch/src/ -B build && cmake -LH build && cmake --build build --clean-first --parallel=10 && cmake --install build

-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- The Fortran compiler identification is GNU 13.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /tmp/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-gfortran - skipped
-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
-- Verifying Fortran/CXX Compiler Compatibility
-- Verifying Fortran/CXX Compiler Compatibility - Success
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - /tmp/example/.pixi/envs/default/bin/nvcc
-- The CUDA compiler identification is NVIDIA 12.6.85 with host compiler GNU 13.3.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /tmp/example/.pixi/envs/default/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Found ZLIB: /tmp/example/.pixi/envs/default/lib/libz.so (found version "1.3.1")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 28.3.0
-- Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS) (found version "12.6")
CMake Warning at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:31 (message):
  Caffe2: CUDA cannot be found.  Depending on whether you are building Caffe2
  or a Caffe2 dependent library, the next warning / error will give you more
  info.
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


CMake Error at /tmp/example/.pixi/envs/default/share/cmake/Caffe2/Caffe2Config.cmake:90 (message):
  Your installed Caffe2 version uses CUDA but I cannot find the CUDA
  libraries.  Please set the proper CUDA prefixes and / or install CUDA.
Call Stack (most recent call first):
  /tmp/example/.pixi/envs/default/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:54 (find_package)


-- Configuring incomplete, errors occurred!

Notes

In terms of (what I thought was) the relevant subsection of the environment

pixi list for python pytorch and cuda:
$ pixi list | grep 'python\|pytorch\|cuda'
cpython                      3.12.8        py312hd8ed1ab_1                 43.7 KiB   conda  cpython
cuda-cccl_linux-64           12.6.77       ha770c72_0                      1 MiB      conda  cuda-cccl_linux-64
cuda-compiler                12.6.3        hbad6d8a_0                      19.7 KiB   conda  cuda-compiler
cuda-crt-dev_linux-64        12.6.85       ha770c72_0                      86.7 KiB   conda  cuda-crt-dev_linux-64
cuda-crt-tools               12.6.85       ha770c72_0                      26.5 KiB   conda  cuda-crt-tools
cuda-cudart                  12.6.77       h5888daf_0                      21.9 KiB   conda  cuda-cudart
cuda-cudart-dev              12.6.77       h5888daf_0                      22.3 KiB   conda  cuda-cudart-dev
cuda-cudart-dev_linux-64     12.6.77       h3f2d84a_0                      356.8 KiB  conda  cuda-cudart-dev_linux-64
cuda-cudart-static           12.6.77       h5888daf_0                      21.9 KiB   conda  cuda-cudart-static
cuda-cudart-static_linux-64  12.6.77       h3f2d84a_0                      744.5 KiB  conda  cuda-cudart-static_linux-64
cuda-cudart_linux-64         12.6.77       h3f2d84a_0                      184.2 KiB  conda  cuda-cudart_linux-64
cuda-cuobjdump               12.6.77       hbd13f7d_1                      240.8 KiB  conda  cuda-cuobjdump
cuda-cupti                   12.6.80       hbd13f7d_0                      1.9 MiB    conda  cuda-cupti
cuda-cuxxfilt                12.6.77       hbd13f7d_1                      210.9 KiB  conda  cuda-cuxxfilt
cuda-driver-dev              12.6.77       h5888daf_0                      21.7 KiB   conda  cuda-driver-dev
cuda-driver-dev_linux-64     12.6.77       h3f2d84a_0                      34.9 KiB   conda  cuda-driver-dev_linux-64
cuda-libraries-dev           12.6.3        ha770c72_0                      19.6 KiB   conda  cuda-libraries-dev
cuda-nvcc                    12.6.85       hcdd1206_0                      23.1 KiB   conda  cuda-nvcc
cuda-nvcc-dev_linux-64       12.6.85       he91c749_0                      10.8 MiB   conda  cuda-nvcc-dev_linux-64
cuda-nvcc-impl               12.6.85       h85509e4_0                      24.9 KiB   conda  cuda-nvcc-impl
cuda-nvcc-tools              12.6.85       he02047a_0                      23 MiB     conda  cuda-nvcc-tools
cuda-nvcc_linux-64           12.6.85       h04802cd_0                      24.7 KiB   conda  cuda-nvcc_linux-64
cuda-nvdisasm                12.6.77       hbd13f7d_1                      47.6 MiB   conda  cuda-nvdisasm
cuda-nvprune                 12.6.77       hbd13f7d_1                      66.4 KiB   conda  cuda-nvprune
cuda-nvrtc                   12.6.85       hbd13f7d_0                      17.3 MiB   conda  cuda-nvrtc
cuda-nvrtc-dev               12.6.85       h5888daf_0                      31.5 KiB   conda  cuda-nvrtc-dev
cuda-nvtx                    12.6.77       hbd13f7d_0                      30.6 KiB   conda  cuda-nvtx
cuda-nvtx-dev                12.6.77       ha770c72_0                      49.1 KiB   conda  cuda-nvtx-dev
cuda-nvvm-dev_linux-64       12.6.85       ha770c72_0                      24.6 KiB   conda  cuda-nvvm-dev_linux-64
cuda-nvvm-impl               12.6.85       he02047a_0                      7.7 MiB    conda  cuda-nvvm-impl
cuda-nvvm-tools              12.6.85       he02047a_0                      10.4 MiB   conda  cuda-nvvm-tools
cuda-opencl                  12.6.77       hbd13f7d_0                      29.4 KiB   conda  cuda-opencl
cuda-opencl-dev              12.6.77       h5888daf_0                      93 KiB     conda  cuda-opencl-dev
cuda-profiler-api            12.6.77       h7938cbb_0                      22.3 KiB   conda  cuda-profiler-api
cuda-version                 12.6          h7480c83_3                      20.4 KiB   conda  cuda-version
libtorch                     2.5.1         cuda126_mkl_haa0cf67_310        491.5 MiB  conda  libtorch
python                       3.12.8        h9e4cc4f_1_cpython              30.1 MiB   conda  python
python_abi                   3.12          5_cp312                         6.1 KiB    conda  python_abi
pytorch                      2.5.1         cuda126_mkl_py312_hdbe889e_310  26.1 MiB   conda  pytorch
triton                       3.1.0         cuda126py312h776fbae_5          89 MiB     conda  triton

the only relevant differences (beyond that I'm not including torchvision here to further simplify things for debugging) seems to be the PyTorch build number

$ diff -u pixi_list_2025-01-08.txt pixi_list_2025-01-28.txt
--- pixi_list_2025-01-08.txt	2025-01-28 23:41:01.092714388 -0700
+++ pixi_list_2025-01-28.txt	2025-01-28 23:39:48.732605805 -0700
@@ -33,9 +33,8 @@
 cuda-opencl-dev              12.6.77       h5888daf_0                      93 KiB     conda  cuda-opencl-dev
 cuda-profiler-api            12.6.77       h7938cbb_0                      22.3 KiB   conda  cuda-profiler-api
 cuda-version                 12.6          h7480c83_3                      20.4 KiB   conda  cuda-version
-libtorch                     2.5.1         cuda126_mkl_h2a4acef_308        491.1 MiB  conda  libtorch
+libtorch                     2.5.1         cuda126_mkl_haa0cf67_310        491.5 MiB  conda  libtorch
 python                       3.12.8        h9e4cc4f_1_cpython              30.1 MiB   conda  python
 python_abi                   3.12          5_cp312                         6.1 KiB    conda  python_abi
-pytorch                      2.5.1         cuda126_mkl_py312_hdbe889e_308  35.6 MiB   conda  pytorch
-torchvision                  0.20.1        cuda126_py312_h17ccbaa_4        2.7 MiB    conda  torchvision
-triton                       3.1.0         cuda126py312h776fbae_4          89 MiB     conda  triton
+pytorch                      2.5.1         cuda126_mkl_py312_hdbe889e_310  26.1 MiB   conda  pytorch
+triton                       3.1.0         cuda126py312h776fbae_5          89 MiB     conda  triton

Even if I constrain the build numbers to be the same

$ pixi add "pytorch [build_number=308]" "triton [build_number=4]"
✔ Added pytorch [build_number=308]
✔ Added triton [build_number=4]
$ diff -u pixi_list_2025-01-08.txt pixi_list_2025-01-28_pinned.txt
--- pixi_list_2025-01-08.txt	2025-01-28 23:41:01.092714388 -0700
+++ pixi_list_2025-01-28_pinned.txt	2025-01-28 23:56:10.779856268 -0700
@@ -37,5 +37,4 @@
 python                       3.12.8        h9e4cc4f_1_cpython              30.1 MiB   conda  python
 python_abi                   3.12          5_cp312                         6.1 KiB    conda  python_abi
 pytorch                      2.5.1         cuda126_mkl_py312_hdbe889e_308  35.6 MiB   conda  pytorch
-torchvision                  0.20.1        cuda126_py312_h17ccbaa_4        2.7 MiB    conda  torchvision
 triton                       3.1.0         cuda126py312h776fbae_4          89 MiB     conda  triton

the same build error happens.

Taking the error message at face value, and noting comment #59 (comment), then

$ grep -r "find_package(CUDAToolkit)"
$ grep -r "find_package(CUDA)"
.pixi/envs/default/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA.cmake:#   use this module or call ``find_package(CUDA)``.  This module
.pixi/envs/default/share/cmake/Caffe2/public/cuda.cmake:find_package(CUDA)
.pixi/envs/default/share/cmake-3.31/Modules/FindCUDA.cmake:It is no longer necessary to use this module or call ``find_package(CUDA)``
.pixi/envs/default/share/cmake-3.31/Help/policy/CMP0146.rst:The ``OLD`` behavior of this policy is for ``find_package(CUDA)`` to

indicates that Caffe2 will check the legacy CUDA_TOOLKIT_ROOT_DIR, but setting that to $CONDA_PREFIX

...
cmake \
    $CMAKE_ARGS \
    -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
    -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
    -DCMAKE_BUILD_TYPE=Release \
    -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python \
    -DENABLE_CUDA=TRUE \
    -DCUDA_TOOLKIT_ROOT_DIR=$CONDA_PREFIX \
    -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 \
    -DCMAKE_VERBOSE_MAKEFILE=TRUE \
    -S FTorch/src/ \
    -B build
...

given

$ find .pixi/envs/default/ -type f -name nvcc
.pixi/envs/default/bin/nvcc

has no effect. Same goes for -DCUDAToolkit_ROOT=$CONDA_PREFIX.

It seems that I've gotten myself back to where I started a few weeks ago, and I'm not really sure how to debug this particular problem.

@jakirkham, do you happen to have any suggestions for basic debugging steps that I've missed so far?

@matthewfeickert
Copy link
Member

matthewfeickert commented Jan 29, 2025

indicates that Caffe2 will check the legacy CUDA_TOOLKIT_ROOT_DIR, but setting that to $CONDA_PREFIX

...
cmake \
    $CMAKE_ARGS \
    -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
    -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
    -DCMAKE_BUILD_TYPE=Release \
    -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python \
    -DENABLE_CUDA=TRUE \
    -DCUDA_TOOLKIT_ROOT_DIR=$CONDA_PREFIX \
    -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 \
    -DCMAKE_VERBOSE_MAKEFILE=TRUE \
    -S FTorch/src/ \
    -B build
...

given

$ find .pixi/envs/default/ -type f -name nvcc
.pixi/envs/default/bin/nvcc

has no effect. Same goes for -DCUDAToolkit_ROOT=$CONDA_PREFIX.

Ah, seems that I had the wrong value of CUDA_TOOLKIT_ROOT_DIR. Using $CONDA_PREFIX/targets/x86_64-linux now works fine

...
cmake \
    $CMAKE_ARGS \
    -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
    -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
    -DCMAKE_BUILD_TYPE=Release \
    -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python \
    -DENABLE_CUDA=TRUE \
    -DCUDA_TOOLKIT_ROOT_DIR=$CONDA_PREFIX/targets/x86_64-linux \
    -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 \
    -DCMAKE_VERBOSE_MAKEFILE=TRUE \
    -S FTorch/src/ \
    -B build
...

👍


So, for the purposes of Cambridge-ICCS/FTorch#214:

Python and CUDA version constrained environment

pixi manifest pixi.toml:
[project]
authors = ["Matthew Feickert <[email protected]>"]
channels = ["conda-forge"]
description = "Add a short description here"
name = "example"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

# Selecting 03c5475b6d05bf2c90cc1cd572187ef4b5946b3e as reference
clone = """
rm -rf FTorch && \
git clone https://github.com/Cambridge-ICCS/FTorch.git && \
cd FTorch && \
git reset --hard 03c5475b6d05bf2c90cc1cd572187ef4b5946b3e
"""

# Note that libtorch is at $CONDA_PREFIX/lib/libtorch.so
build = """
rm -rf build && \
cmake \
    $CMAKE_ARGS \
    -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
    -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
    -DCMAKE_BUILD_TYPE=Release \
    -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python \
    -DENABLE_CUDA=TRUE \
    -DCUDA_TOOLKIT_ROOT_DIR=$CONDA_PREFIX/targets/x86_64-linux \
    -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 \
    -DCMAKE_VERBOSE_MAKEFILE=TRUE \
    -S FTorch/src/ \
    -B build && \
cmake -LH build && \
cmake --build build --clean-first --parallel=10 && \
cmake --install build
"""

start = { depends-on = ["clone", "build"] }

[system-requirements]
cuda = "12.0"

[dependencies]
fortran-compiler = ">=1.5.2,<2"
cxx-compiler = ">=1.5.2,<2"
cuda-compiler = ">=12.6.3,<13"
cuda-libraries-dev = ">=12.6.3,<13"
cuda-nvtx-dev = ">=12.6.77,<13"
cuda-version = "12.6.*"
python = ">=3.12.8,<3.13"
cmake = ">=3.31.2,<4"
pytorch = ">=2.5.1,<3"
zlib = ">=1.3.1,<2"
# build tools
git = ">=2.47.1,<3"
# examples
torchvision = ">=0.20.1,<0.21"
mpi4py = ">=4.0.1,<5"
openmpi-mpifort = ">=5.0.6,<6"

where

pixi project export conda-environment environment.yml

gives

name: default
channels:
- conda-forge
- nodefaults
dependencies:
- fortran-compiler >=1.5.2,<2
- cxx-compiler >=1.5.2,<2
- cuda-compiler >=12.6.3,<13
- cuda-libraries-dev >=12.6.3,<13
- cuda-nvtx-dev >=12.6.77,<13
- cuda-version 12.6.*
- python >=3.12.8,<3.13
- cmake >=3.31.2,<4
- pytorch >=2.5.1,<3
- zlib >=1.3.1,<2
- git >=2.47.1,<3
- torchvision >=0.20.1,<0.21
- mpi4py >=4.0.1,<5
- openmpi-mpifort >=5.0.6,<6

unconstrained environment

pixi manifest pixi.toml:
[project]
authors = ["Matthew Feickert <[email protected]>"]
channels = ["conda-forge"]
description = "Add a short description here"
name = "example"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

# Selecting 03c5475b6d05bf2c90cc1cd572187ef4b5946b3e as reference
clone = """
rm -rf FTorch && \
git clone https://github.com/Cambridge-ICCS/FTorch.git && \
cd FTorch && \
git reset --hard 03c5475b6d05bf2c90cc1cd572187ef4b5946b3e
"""

# Note that libtorch is at $CONDA_PREFIX/lib/libtorch.so
build = """
rm -rf build && \
cmake \
    $CMAKE_ARGS \
    -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
    -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
    -DCMAKE_BUILD_TYPE=Release \
    -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python \
    -DENABLE_CUDA=TRUE \
    -DCUDA_TOOLKIT_ROOT_DIR=$CONDA_PREFIX/targets/x86_64-linux \
    -Dnvtx3_dir=$CONDA_PREFIX/targets/x86_64-linux/include/nvtx3 \
    -DCMAKE_VERBOSE_MAKEFILE=TRUE \
    -S FTorch/src/ \
    -B build && \
cmake -LH build && \
cmake --build build --clean-first --parallel=10 && \
cmake --install build
"""

start = { depends-on = ["clone", "build"] }

[system-requirements]
cuda = "12.0"

[dependencies]
fortran-compiler = ">=1.5.2,<2"
cxx-compiler = ">=1.5.2,<2"
cuda-compiler = ">=12.6.3,<13"
cuda-libraries-dev = ">=12.6.3,<13"
cuda-nvtx-dev = ">=12.6.77,<13"
cmake = ">=3.31.2,<4"
pytorch = ">=2.5.1,<3"
zlib = ">=1.3.1,<2"
# build tools
git = ">=2.47.1,<3"
# examples
torchvision = ">=0.20.1,<0.21"
mpi4py = ">=4.0.1,<5"
openmpi-mpifort = ">=5.0.6,<6"

where

pixi project export conda-environment environment.yml

gives

name: default
channels:
- conda-forge
- nodefaults
dependencies:
- fortran-compiler >=1.5.2,<2
- cxx-compiler >=1.5.2,<2
- cuda-compiler >=12.6.3,<13
- cuda-libraries-dev >=12.6.3,<13
- cuda-nvtx-dev >=12.6.77,<13
- cmake >=3.31.2,<4
- pytorch >=2.5.1,<3
- zlib >=1.3.1,<2
- git >=2.47.1,<3
- torchvision >=0.20.1,<0.21
- mpi4py >=4.0.1,<5
- openmpi-mpifort >=5.0.6,<6

@h-vetinari
Copy link
Member

on Pytorch's GitHub I can only find this in cmake/public/cuda.cmake so I guess it is patched or has its path renamed?

That's a weakness of github's search not checking .cmake.in files, because this is the original:
https://github.com/pytorch/pytorch/blob/v2.5.1/cmake/Caffe2Config.cmake.in

I'm noticing the failures with pytorch's CMake metadata now, perhaps newer CMake got stricter about something (because this didn't use to fail before)?

I'm open to a patch in pytorch that replaces find_package(CUDA) with its more modern equivalent, but it's really hard to know what other variables in that file would need to be changed as a consequence (no thanks to CMake's opaque DSL and the very similarly named variables before/after).

@matthewfeickert
Copy link
Member

That's a weakness of github's search not checking .cmake.in files, because this is the original: https://github.com/pytorch/pytorch/blob/v2.5.1/cmake/Caffe2Config.cmake.in

Thanks for noting this, @h-vetinari. I hadn't noticed that these got skipped. That's useful to know.

I'm noticing the failures with pytorch's CMake metadata now, perhaps newer CMake got stricter about something (because this didn't use to fail before)?

Unclear(?). The errors that I noticed where in the last weeks I needed to add CUDA_TOOLKIT_ROOT_DIR to get around Torch's Caffe2 CMake errors don't seem to be CMake version related, as I can replicate them with cmake v3.31.2, which is the version I had on 2025-01-08 with things passing. I unfortunately don't have the original lock file from 2025-01-08 to verify what actually changed in my previously passing environment, though my guess is that you're referring to different CMake errors with PyTorch now.

I'm open to a patch in pytorch that replaces find_package(CUDA) with its more modern equivalent, but it's really hard to know what other variables in that file would need to be changed as a consequence (no thanks to CMake's opaque DSL and the very similarly named variables before/after).

Thanks for also making useful notes RE: find_package(CUDA) on pytorch/pytorch#76082 (comment), conda-forge/pytorch-cpu-feedstock#333 (comment), and your start of the update migration on conda-forge/pytorch-cpu-feedstock#333 (comment). That's great to see!

Yes, I suspect that it won't be trivially easy. I've subscribed to those issues, so if there's an opportunity to help I will try, but given my current timeline for the week that probably won't be in the next 4 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants