CUDA is not avaliable after building from source

Hello! I just built torch from source for cuda Compute capability = 3.5. But torch.cuda.is_available() returns False. I tried this command before with pytroch from pytorch_org and it returned True, but because of compute capability = 3.5, it can’t work properly. I have CUDA toolkit 11.6, that supports 3.5 compute capability, cudnn And videodriver 463.15-data-center-tesla. Despite the failure of some tests compilation started succesfully. Summary configuration: Summary configuration
Output: CMakeOutput.log

Idk where to start searching for a reason of this problem.
I appreciate any help! Thank you.

In CMakeError.log found the line:
Determining if the prototype magma_get_sgeqrf_nb exists for MAGMA_V2 failed with the following output:
Change Dir: G:/pytorch/build/CMakeFiles/CMakeTmp

Run Build Command(s):G:/condaEnv/Library/bin/ninja.exe cmTC_8b1dc && [1/2] Building C object CMakeFiles\cmTC_8b1dc.dir\CheckPrototypeDefinition.c.obj

FAILED: CMakeFiles/cmTC_8b1dc.dir/CheckPrototypeDefinition.c.obj

E:\Apps\vsbuild\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe /nologo /DWIN32 /D_WINDOWS /w /bigobj -openmp:experimental -IE:/Apps/vsbuild/VC/Tools/MSVC/14.29.30133/include -DNDEBUG /MDd /Z7 /Ob0 /Od /RTC1 /w /bigobj -std:c11 /showIncludes /FoCMakeFiles\cmTC_8b1dc.dir\CheckPrototypeDefinition.c.obj /FdCMakeFiles\cmTC_8b1dc.dir\ /FS -c G:\pytorch\build\CMakeFiles\CMakeTmp\CheckPrototypeDefinition.c
G:\pytorch\build\CMakeFiles\CMakeTmp\CheckPrototypeDefinition.c(1):fatal error C1083: Cannot open include file: magma.h: No such file or directory,
ninja: build stopped: subcommand failed.

but I created variable MAGMA_HOME=G:\pytorch\requirements\magma
So magma.h is here: G:\pytorch\requirements\magma\include
And why CheckPrototypeDefinition.c ends with that error?