Skip to content

Commit

Permalink
io.{c,cu} -> run.{c,cu}
Browse files Browse the repository at this point in the history
  • Loading branch information
enricozb committed Jun 5, 2024
1 parent 6273aaf commit ba6f06a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ fn main() {
let cores = num_cpus::get();
let tpcl2 = (cores as f64).log2().floor() as u32;

println!("cargo:rerun-if-changed=src/io.c");
println!("cargo:rerun-if-changed=src/run.c");
println!("cargo:rerun-if-changed=src/hvm.c");
println!("cargo:rerun-if-changed=src/io.cu");
println!("cargo:rerun-if-changed=src/run.cu");
println!("cargo:rerun-if-changed=src/hvm.cu");

match cc::Build::new()
.file("src/io.c")
.file("src/run.c")
.opt_level(3)
.warnings(false)
.define("TPC_L2", &*tpcl2.to_string())
.define("IO", None)
.try_compile("hvm-c") {
Ok(_) => println!("cargo:rustc-cfg=feature=\"c\""),
Err(e) => {
println!("cargo:warning=\x1b[1m\x1b[31mWARNING: Failed to compile/io.c:\x1b[0m {}", e);
println!("cargo:warning=Ignoring/io.c and proceeding with build. \x1b[1mThe C runtime will not be available.\x1b[0m");
println!("cargo:warning=\x1b[1m\x1b[31mWARNING: Failed to compile/run.c:\x1b[0m {}", e);
println!("cargo:warning=Ignoring/run.c and proceeding with build. \x1b[1mThe C runtime will not be available.\x1b[0m");
}
}

Expand All @@ -31,7 +31,7 @@ fn main() {

cc::Build::new()
.cuda(true)
.file("src/io.cu")
.file("src/run.cu")
.define("IO", None)
.flag("-diag-suppress=177") // variable was declared but never referenced
.flag("-diag-suppress=550") // variable was set but never used
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fn main() {
let hvm_c = hvm_c.replace("//COMPILED_BOOK_BUF//", &bookb);
let hvm_c = hvm_c.replace("#define WITHOUT_MAIN", "#define WITH_MAIN");
let hvm_c = hvm_c.replace("#define TPC_L2 0", &format!("#define TPC_L2 {} // {} cores", tpcl2, cores));
let hvm_c = format!("{hvm_c}\n\n{}", include_str!("io.c"));
let hvm_c = format!("{hvm_c}\n\n{}", include_str!("run.c"));
let hvm_c = hvm_c.replace(r#"#include "hvm.c""#, "");
println!("{}", hvm_c);
}
Expand Down Expand Up @@ -149,7 +149,7 @@ fn main() {
let hvm_cu = format!("#define IO\n\n{hvm_cu}");
let hvm_cu = hvm_cu.replace("//COMPILED_BOOK_BUF//", &bookb);
let hvm_cu = hvm_cu.replace("#define WITHOUT_MAIN", "#define WITH_MAIN");
let hvm_cu = format!("{hvm_cu}\n\n{}", include_str!("io.cu"));
let hvm_cu = format!("{hvm_cu}\n\n{}", include_str!("run.cu"));
let hvm_cu = hvm_cu.replace(r#"#include "hvm.cu""#, "");
println!("{}", hvm_cu);
}
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit ba6f06a

Please sign in to comment.