forked from 0xPolygonZero/plonky2
-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
7a3b7d4
commit 0ffdb10
Showing
18 changed files
with
2,381 additions
and
14 deletions.
There are no files selected for viewing
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,13 @@ | ||
[package] | ||
name = "plonky2-cuda" | ||
version = "0.1.0" | ||
authors = ["Mozak"] | ||
description = "GPU acceleration for plonky2" | ||
edition = "2021" | ||
|
||
[build-dependencies.cc] | ||
version = "^1.0.70" | ||
|
||
[build-dependencies.which] | ||
version = "^4.0" | ||
|
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,26 @@ | ||
use std::{env}; | ||
|
||
fn main() { | ||
|
||
// Detect if there is CUDA compiler and engage "cuda" feature accordingly | ||
let nvcc = match env::var("NVCC") { | ||
Ok(var) => which::which(var), | ||
Err(_) => which::which("nvcc"), | ||
}; | ||
|
||
if nvcc.is_ok() { | ||
let mut nvcc = cc::Build::new(); | ||
nvcc.cuda(true); | ||
nvcc.flag("-g"); | ||
nvcc.flag("-O5"); | ||
nvcc.flag("-arch=sm_75"); | ||
nvcc.flag("-maxrregcount=255"); | ||
nvcc.file("plonky2_gpu.cu").compile("plonky2_cuda"); | ||
|
||
println!("cargo:rustc-cfg=feature=\"cuda\""); | ||
println!("cargo:rerun-if-changed=cuda"); | ||
println!("cargo:rerun-if-env-changed=CXXFLAGS"); | ||
} else { | ||
println!("nvcc must be in the path. Consider adding /usr/local/cuda/bin."); | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.