This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
274 additions
and
343 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
#![allow(incomplete_features)] | ||
#![allow(unexpected_cfgs)] | ||
#![feature(generic_const_exprs)] | ||
|
||
use cudart_sys::{cuda_lib_path, cuda_path}; | ||
|
||
mod gates; | ||
mod poseidon_constants; | ||
mod template; | ||
|
||
fn main() { | ||
gates::generate(); | ||
poseidon_constants::generate(); | ||
#[cfg(target_os = "macos")] | ||
std::process::exit(0); | ||
let dst = cmake::Config::new("native") | ||
.profile("Release") | ||
.define( | ||
"CMAKE_CUDA_ARCHITECTURES", | ||
std::env::var("CUDAARCHS").unwrap_or("native".to_string()), | ||
) | ||
.build(); | ||
println!("cargo:rustc-link-search=native={}", dst.display()); | ||
println!("cargo:rustc-link-lib=static=boojum-cuda-native"); | ||
println!("cargo:rustc-link-search=native={}", cuda_lib_path!()); | ||
println!("cargo:rustc-link-lib=cudart"); | ||
#[cfg(target_os = "linux")] | ||
println!("cargo:rustc-link-lib=stdc++"); | ||
println!("cargo::rustc-check-cfg=cfg(no_cuda)"); | ||
#[cfg(no_cuda)] | ||
{ | ||
println!("cargo::warning={}", cudart_sys::no_cuda_message!()); | ||
} | ||
#[cfg(not(no_cuda))] | ||
{ | ||
use cudart_sys::{get_cuda_lib_path, get_cuda_version}; | ||
use std::env::var; | ||
let cuda_version = get_cuda_version().expect("Failed to determine CUDA version"); | ||
if !cuda_version.starts_with("12.") { | ||
println!("cargo::warning=CUDA version {cuda_version} detected. This crate is only tested with CUDA 12.*."); | ||
} | ||
let cudaarchs = var("CUDAARCHS").unwrap_or("native".to_string()); | ||
let dst = cmake::Config::new("native") | ||
.profile("Release") | ||
.define("CMAKE_CUDA_ARCHITECTURES", cudaarchs) | ||
.build(); | ||
let boojum_lib_path = dst.to_str().unwrap(); | ||
println!("cargo:rustc-link-search=native={boojum_lib_path}"); | ||
println!("cargo:rustc-link-lib=static=boojum-cuda-native"); | ||
let cuda_lib_path = get_cuda_lib_path().unwrap(); | ||
let cuda_lib_path_str = cuda_lib_path.to_str().unwrap(); | ||
println!("cargo:rustc-link-search=native={cuda_lib_path_str}"); | ||
println!("cargo:rustc-link-lib=cudart"); | ||
#[cfg(target_os = "linux")] | ||
println!("cargo:rustc-link-lib=stdc++"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
/cmake-build-*/ | ||
/gates.cu | ||
/poseidon_constants.cuh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace gates { | ||
%CODE% | ||
} // namespace gates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "gates.cuh" | ||
#include "gates_poseidon.cuh" | ||
// do not reorder includes | ||
#include "gate_kernels.cuh" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.