[FEAT]: Build Workflow + Templates (#15)

This commit is contained in:
Jeremy Felder
2023-03-14 11:58:27 +02:00
committed by GitHub
parent 00231723b9
commit db43edb64b
6 changed files with 114 additions and 3 deletions

32
.github/ISSUE_TEMPLATE/bug_issue.md vendored Normal file
View File

@@ -0,0 +1,32 @@
---
name: ":bug: Bug Report"
about: Create a bug report to help us improve the repo
title: "[BUG]: "
labels: bug
---
## Description
Please provide a clear and concise description of the bug.
### Reproduce
Please list the steps to reproduce the issue.
## Expected Behavior
Please provide a clear and concise description of what you expected to happen.
## Environment
Please complete the following information:
OS + Version:
Cargo Version:
GPU type:
## Additional context
Please provide any additional context that may be helpful in confirming and resolving this issue.

View File

@@ -0,0 +1,14 @@
---
name: ":sparkles: Feature Request"
about: Request the inclusion of a new feature or functionality
title: "[FEAT]: "
labels: enhancement
---
## Description
Please provide a clear and concise description of the feature you would like included.
## Motivation
Please provide a clear and concise description of the motivation for adding this feature.

View File

@@ -0,0 +1,7 @@
## Describe the changes
This PR...
## Linked Issues
Closes #

46
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: Build
on:
pull_request:
branches: [ "main" ]
paths:
- "icicle/**"
- "src/**"
- "Cargo.toml"
- "build.rs"
env:
CARGO_TERM_COLOR: always
ARCH_TYPE: sm_70
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
# Checkout code
- uses: actions/checkout@v3
# Download (or from cache) and install CUDA Toolkit 12.1.0
- uses: Jimver/cuda-toolkit@v0.2.9
id: cuda-toolkit
with:
cuda: '12.1.0'
use-github-cache: true
# Build from cargo - Rust utils are preinstalled on latest images
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#rust-tools
- name: Build
run: cargo build --release --verbose
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: Jimver/cuda-toolkit@v0.2.9
id: cuda-toolkit
with:
cuda: '12.1.0'
use-github-cache: true
- name: Build
run: cargo build --release --verbose

View File

@@ -36,7 +36,7 @@ ICICLE is a CUDA implementation of general functions widely used in ZKP. ICICLE
```sh
mkdir -p build
nvcc -o build/<ENTER_DIR_NAME> icicle/lib.cu --cuda -arch=native
nvcc -o build/<ENTER_DIR_NAME> icicle/lib.cu -arch=native
```
### Rust Bindings
@@ -53,7 +53,9 @@ For convenience, we also provide rust bindings to the ICICLE library for the fol
- Scalar Vector Multiplication
- Point Vector Multiplication
A custom [build script][B_SCRIPT] is used to compile and link the ICICLE library. Make sure to change the `arch` flag depending on your GPU type or leave it as `native` for the compiler to detect the installed GPU type.
A custom [build script][B_SCRIPT] is used to compile and link the ICICLE library. The environement variable `ARCH_TYPE` is used to determine which GPU type the library should be compiled for and it defaults to `native` when it is not set allowing the compiler to detect the installed GPU type.
> NOTE: A GPU must be detectable and therefore installed if the `ARCH_TYPE` is not set.
Once you have your parameters set, run:

View File

@@ -1,3 +1,5 @@
use std::env;
fn main() {
//TODO: check cargo features selected
//TODO: can conflict/duplicate with make ?
@@ -5,11 +7,19 @@ fn main() {
println!("cargo:rerun-if-env-changed=CXXFLAGS");
println!("cargo:rerun-if-changed=./icicle");
let arch_type = env::var("ARCH_TYPE")
.unwrap_or(String::from("native"));
let mut arch = String::from("-arch=");
arch.push_str(&arch_type);
let mut nvcc = cc::Build::new();
println!("Compiling icicle library using arch: {}", &arch);
nvcc.cuda(true);
nvcc.debug(false);
nvcc.flag("-arch=native");
nvcc.flag(&arch);
nvcc.files([
"./icicle/lib.cu",
"./icicle/appUtils/msm/msm.cu",