link_cuda_kernel
link_cuda_kernel copied to clipboard
Compile for mutliple architectures
First of all thanks for creating this example, it's been working great for me!
Now I'm trying to build for multiple architectures at once, for example 61
and 86
. Online I find you should just pass multiple arch and code flags, but when I try that on this example it doesn't work:
cc::Build::new()
.cuda(true)
.cudart("shared")
.flag("-gencode")
.flag("arch=compute_61,code=sm_61") // GTX 1060 max-q
.flag("arch=compute_86,code=sm_86") // RTX 3090
.include("cuda")
.files(files)
.compile("libkernels.a")
results in the error
error: failed to run custom build command for `cuda-nn-eval v0.1.0 (C:\Documents\Programming\STTT\AlphaZero\rust\cuda-nn-eval)`
Caused by:
process didn't exit successfully: `C:\Documents\Programming\STTT\AlphaZero\rust\target\debug\build\cuda-nn-eval-5e3310161a7b7153\build-script-build` (exit code: 1)
--- stdout
TARGET = Some("x86_64-pc-windows-msvc")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-pc-windows-msvc")
CXX_x86_64-pc-windows-msvc = None
CXX_x86_64_pc_windows_msvc = None
HOST_CXX = None
CXX = None
NVCC_x86_64-pc-windows-msvc = None
NVCC_x86_64_pc_windows_msvc = None
HOST_NVCC = None
NVCC = None
CXXFLAGS_x86_64-pc-windows-msvc = None
CXXFLAGS_x86_64_pc_windows_msvc = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
DEBUG = Some("true")
running: "nvcc" "-ccbin=C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe" "-Xcompiler" "-nologo" "-Xcompiler" "-MD" "-G" "-Xcompiler" "-Z7" "-Xcompiler" "-Brepro" "-I" "cuda" "-Xcompiler" "-W4" "-gencode" "arch=compute_61,code=sm_61" "arch=compute_86,code=sm_86" "-o" "C:\\Documents\\Programming\\STTT\\AlphaZero\\rust\\target\\debug\\build\\cuda-nn-eval-0c2edb18490f7faf\\out\\cuda/kernels\\fixed_conv.o" "-c" "--device-c" "cuda/kernels\\fixed_conv.cu"
nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
exit code: 1
--- stderr
error occurred: Command "nvcc" "-ccbin=C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe" "-Xcompiler" "-nologo" "-Xcompiler" "-MD" "-G" "-Xcompiler" "-Z7" "-Xcompiler" "-Brepro" "-I" "cuda" "-Xcompiler" "-W4" "-gencode" "arch=compute_61,code=sm_61" "arch=compute_86,code=sm_86" "-o" "C:\\Documents\\Programming\\STTT\\AlphaZero\\rust\\target\\debug\\build\\cuda-nn-eval-0c2edb18490f7faf\\out\\cuda/kernels\\fixed_conv.o" "-c" "--device-c" "cuda/kernels\\fixed_conv.cu" with args "nvcc" did not execute successfully (status code exit code: 1).
warning: build failed, waiting for other jobs to finish...
error: build failed
when I look for this error online I mostly find mal-formed commandline invocations, but I don't see how having multiple archs would cause that. I also attempted to put everything in a single flag
call like this
.flag("arch=compute_61,code=sm_61,arch=compute_86,code=sm_86")
But then I get the nvcc
error redefinition of keyword 'arch'
.
Is there a way to get this working?