Skip to content

hits Cuda Cache but many link errors on Windows #1077

Open

Description

@mszhanyi

I tried to build PyTorch locally with ninja+CMake+sccache.
With the lastest sccache(0.2.16-alpha.0), No CUDA Cache Hits and the non-cacheable reasons are.

Non-cacheable reasons:
multiple input files          137

One example command is

[4141/4734] C:\git\bin\nvcc.exe -forward-unknown-to-host-compiler -DBUILD_SPLIT_CUDA -DIDEEP_USE_MKL -DMAGMA_V2 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTH_BLAS_MKL -DTORCH_CUDA_CU_BUILD_MAIN_LIB -DUSE_CUDA -DUSE_EXTERNAL_MZCRC -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE=1 -D_OPENMP_NOFORCE_MANIFEST -Dtorch_cuda_cu_EXPORTS -IC:\git\check\p1\pytorch\build\aten\src -IC:\git\check\p1\pytorch\aten\src -IC:\git\check\p1\pytorch\build -IC:\git\check\p1\pytorch -IC:\git\check\p1\pytorch\cmake\..\third_party\benchmark\include -IC:\git\check\p1\pytorch\cmake\..\third_party\cudnn_frontend\include -IC:\git\check\p1\pytorch\third_party\onnx -IC:\git\check\p1\pytorch\build\third_party\onnx -IC:\git\check\p1\pytorch\third_party\foxi -IC:\git\check\p1\pytorch\build\third_party\foxi -IC:\git\check\p1\pytorch\build\include -IC:\git\check\p1\pytorch\build\caffe2\aten\src\TH -IC:\git\check\p1\pytorch\aten\src\TH -IC:\git\check\p1\pytorch\aten\src\THC -IC:\git\check\p1\pytorch\aten\src\ATen\cuda -IC:\git\check\p1\pytorch\build\caffe2\aten\src -IC:\git\check\p1\pytorch\aten\..\third_party\catch\single_include -IC:\git\check\p1\pytorch\aten\src\ATen\.. -IC:\git\check\p1\pytorch\build\caffe2\aten\src\ATen -IC:\git\check\p1\pytorch\c10\cuda\..\.. -IC:\git\check\p1\pytorch\c10\.. -IC:\git\check\p1\pytorch\torch\csrc\api -IC:\git\check\p1\pytorch\torch\csrc\api\include -isystem=C:\git\check\p1\pytorch\cmake\..\third_party\googletest\googlemock\include -isystem=C:\git\check\p1\pytorch\cmake\..\third_party\googletest\googletest\include -isystem=C:\git\check\p1\pytorch\third_party\protobuf\src -isystem=C:\git\mkl\include -isystem=C:\git\check\p1\pytorch\third_party\XNNPACK\include -isystem=C:\git\check\p1\pytorch\third_party -isystem=C:\git\check\p1\pytorch\cmake\..\third_party\eigen -isystem=D:\programs\Continuum\anaconda3\envs\check\include -isystem=D:\programs\Continuum\anaconda3\envs\check\lib\site-packages\numpy\core\include -isystem=C:\git\check\p1\pytorch\cmake\..\third_party\pybind11\include -isystem="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -isystem=C:\git\magma113\include -isystem=C:\git\check\p1\pytorch\third_party\ideep\mkl-dnn\include -isystem=C:\git\check\p1\pytorch\third_party\ideep\include -isystem="C:\Program Files\NVIDIA Corporation\NvToolsExt\include" -Xcompiler /w -w -Xfatbin -compress-all -DONNX_NAMESPACE=onnx_torch --use-local-env -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -Xcudafe --diag_suppress=cc_clobber_ignored,--diag_suppress=integer_sign_change,--diag_suppress=useless_using_declaration,--diag_suppress=set_but_not_used,--diag_suppress=field_without_dll_interface,--diag_suppress=base_class_has_different_dll_interface,--diag_suppress=dll_interface_conflict_none_assumed,--diag_suppress=dll_interface_conflict_dllexport_assumed,--diag_suppress=implicit_return_from_non_void_function,--diag_suppress=unsigned_compare_with_zero,--diag_suppress=declared_but_not_referenced,--diag_suppress=bad_friend_decl --Werror cross-execution-space-call --no-host-device-move-forward --expt-relaxed-constexpr --expt-extended-lambda -Xfatbin -compress-all -Xcompiler=/wd4819,/wd4503,/wd4190,/wd4244,/wd4251,/wd4275,/wd4522 -Wno-deprecated-gpu-targets --expt-extended-lambda -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -Xcompiler="-MD -O2 -Ob2" -DNDEBUG -Xcompiler /MD -DCUDA_HAS_FP16=1 -DUSE_GCC_GET_CPUID -DUSE_AVX -DUSE_AVX2 -DTH_HAVE_THREAD -Xcompiler= -DTORCH_CUDA_CU_BUILD_MAIN_LIB -std=c++14 -MD -MT caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\Im2Col.cu.obj -MF caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\Im2Col.cu.obj.d -x cu -c C:\git\check\p1\pytorch\aten\src\ATen\native\cuda\Im2Col.cu -o caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\Im2Col.cu.obj -Xcompiler=-Fdcaffe2\CMakeFiles\torch_cuda_cu.dir\,-FS
[2021-12-07T11:11:20Z DEBUG sccache::config] Attempting to read config file at "C:\\Users\\zhanyi\\AppData\\Roaming\\Mozilla\\sccache\\config\\config"
[2021-12-07T11:11:20Z DEBUG sccache::config] Couldn't open config file: The system cannot find the path specified. (os error 3)
[2021-12-07T11:11:20Z DEBUG sccache::commands] Server sent UnhandledCompile
Im2Col.cu

Then I tried adding
take_arg!("--Werror", OsString, Separated, PassThrough), in counted_array! of nvcc.rs
the sccache -s shows that there's no Non-cacheable reasons and there're many Cache hits (CUDA)
But it throws many error LNK2019 and error LNK2005, such as

IndexKernel.cpp.obj : error LNK2019: unresolved external symbol "void __cdecl at::native::launch_masked_scatter_kernel(class at::TensorBase const &,class at::TensorBase const &,class at::TensorBase const &,class at::TensorBase const &)" (?launch_masked_scatter_kernel@native@at@@YAXAEBVTensorBase@2@000@Z) referenced in function "class at::Tensor & __cdecl at::native::masked_scatter__cuda(class at::Tensor &,class at::Tensor const &,class at::Tensor const &)" (?masked_scatter__cuda@native@at@@YAAEAVTensor@2@AEAV32@AEBV32@1@Z)
and
Unique.cu.obj : error LNK2005: "void __cdecl at::native::softplus_backward_kernel(struct at::TensorIteratorBase &,class c10::Scalar const &,class c10::Scalar const &)" (?softplus_backward_kernel@native@at@@YAXAEAUTensorIteratorBase@2@AEBVScalar@c10@@1@Z) already defined in THCSleep.cu.obj

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions