-
Notifications
You must be signed in to change notification settings - Fork 525
Closed
Description
I'm trying to compile multiple Cuda files that have dependencies. and I got an error message.
Is there a way to compile multiple CUDA files using cc-rs?
build.rs
extern crate cc;
fn main() {
cc::Build::new()
.cuda(true)
.flag("-gencode")
.flag("arch=compute_60,code=sm_60")
.flag("-gencode")
.flag("arch=compute_61,code=sm_61")
.flag("-gencode")
.flag("arch=compute_62,code=sm_62")
.file("cuda_src/a.cu")
.file("cuda_src/b.cu")
.compile("kernel.o");
println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64");
println!("cargo:rustc-link-lib=cudart");
}
a.cu
#include "b.h"
__device__ int a_func(int x) {
return b_func(x) + 1;
}
b.cu
#include "b.h"
__device__ int b_func(int x) {
return x + 1;
}
b.h
__device__ int b_func(int x);
error
warning: ptxas fatal : Unresolved extern function '_Z6b_funci'
error: failed to run custom build command for `cc-rs-test v0.1.0
Activity
alexcrichton commentedon May 26, 2020
Sorry I do not know anything about cuda, so I am not able to help you here.