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

fix: update MSRV to 1.70.0 #55

Merged
merged 2 commits into from
Aug 27, 2024
Merged
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
193 changes: 0 additions & 193 deletions .circleci/config.yml

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI

on: [pull_request, push]

# Cancel a job if there's a new on on the same branch started.
# Based on https://stackoverflow.com/questions/58895283/stop-already-running-workflow-job-in-github-actions/67223051#67223051
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
# Faster crates.io index checkout.
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

jobs:
set-msrv:
runs-on: ubuntu-latest
outputs:
msrv: ${{ steps.msrv.outputs.MSRV }}
steps:
- uses: actions/checkout@v4
- name: Get MSRV from rust-toolchain
id: msrv
run: |
MSRV=$(cat ./rust-toolchain)
echo "MSRV=$MSRV" | tee --append "$GITHUB_OUTPUT"

linux:
needs: set-msrv
runs-on: ubuntu-latest
name: Build and test
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{needs.set-msrv.outputs.msrv}}
- name: Install required packages
run: sudo apt install --no-install-recommends --yes ocl-icd-opencl-dev nvidia-cuda-toolkit
- name: Build with default features
run: cargo build --workspace
# Machine has no GPU installed, hence run without the `cuda` or `opencl` feature.
- name: Run tests without default features
run: cargo test --workspace --no-default-features -- --nocapture

clippy_check:
needs: set-msrv
runs-on: ubuntu-latest
name: Clippy
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set-msrv.outputs.msrv }}
components: clippy
- name: Install required packages
run: sudo apt install --no-install-recommends --yes ocl-icd-opencl-dev nvidia-cuda-dev
- name: Run cargo clippy default features
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Run cargo clippy with cuda and opencl features
run: cargo clippy --workspace --all-targets --features cuda,opencl -- -D warnings
- name: Run cargo clippy with cuda feature
run: cargo clippy --workspace --all-targets --no-default-features --features cuda -- -D warnings
- name: Run cargo clippy with opencl feature
run: cargo clippy --workspace --all-targets --no-default-features --features opencl -- -D warnings

check_fmt_and_docs:
needs: set-msrv
runs-on: ubuntu-latest
name: Checking fmt and docs
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set-msrv.outputs.msrv }}
components: rustfmt
- name: fmt
run: cargo fmt --all -- --check
- name: Docs
env:
# Making sure that the documentation can be built without having the NVIDIA toolkit
# installed.
DOCS_RS: true
run: |
cargo rustdoc --package ec-gpu --all-features -- -D warnings
cargo rustdoc --package ec-gpu-gen --all-features -- -D warnings
2 changes: 1 addition & 1 deletion ec-gpu-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "Code generator for field and eliptic curve operations on the GPUs
homepage = "https://github.com/filecoin-project/ff-cl-gen"
repository = "https://github.com/filecoin-project/ff-cl-gen"
license = "MIT/Apache-2.0"
rust-version = "1.62.1"
rust-version = "1.70.0"

[dependencies]
bitvec = "1.0.1"
Expand Down
8 changes: 4 additions & 4 deletions ec-gpu-gen/src/fft_cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn serial_fft<F: PrimeField>(a: &mut [F], omega: &F, log_n: u32) {

let mut m = 1;
for _ in 0..log_n {
let w_m = omega.pow_vartime(&[u64::from(n / (2 * m))]);
let w_m = omega.pow_vartime([u64::from(n / (2 * m))]);

let mut k = 0;
while k < n {
Expand Down Expand Up @@ -68,16 +68,16 @@ pub fn parallel_fft<F: PrimeField>(
let num_threads = 1 << log_threads;
let log_new_n = log_n - log_threads;
let mut tmp = vec![vec![F::ZERO; 1 << log_new_n]; num_threads];
let new_omega = omega.pow_vartime(&[num_threads as u64]);
let new_omega = omega.pow_vartime([num_threads as u64]);

worker.scope(0, |scope, _| {
let a = &*a;

for (j, tmp) in tmp.iter_mut().enumerate() {
scope.execute(move || {
// Shuffle into a sub-FFT
let omega_j = omega.pow_vartime(&[j as u64]);
let omega_step = omega.pow_vartime(&[(j as u64) << log_new_n]);
let omega_j = omega.pow_vartime([j as u64]);
let omega_step = omega.pow_vartime([(j as u64) << log_new_n]);

let mut elt = F::ONE;
for (i, tmp) in tmp.iter_mut().enumerate() {
Expand Down
2 changes: 1 addition & 1 deletion ec-gpu-gen/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ fn generate_opencl(source_builder: &SourceBuilder) -> PathBuf {
// build.
let source_path: PathBuf = [&out_dir, "kernel.cl"].iter().collect();

fs::write(&source_path, &kernel_source).unwrap_or_else(|_| {
fs::write(&source_path, kernel_source).unwrap_or_else(|_| {
panic!(
"Cannot write kernel source at {}.",
source_path.to_str().unwrap()
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.62.1
1.70.0