Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change hardcoded value #70

Draft
wants to merge 2 commits into
base: vivek/cuda
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions cuda/Cargo.toml
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"

26 changes: 26 additions & 0 deletions cuda/build.rs
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.");
}
}
309 changes: 309 additions & 0 deletions cuda/constants.cuh

Large diffs are not rendered by default.

Loading
Loading