mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-08 22:28:01 -05:00
chore: make typos version fixed
- add a script to properly install the correct version - correct new typos
This commit is contained in:
committed by
IceTDrinker
parent
67dc8583b1
commit
00ce0deec9
6
Makefile
6
Makefile
@@ -30,6 +30,7 @@ WASM_PACK_VERSION="0.13.1"
|
||||
WASM_BINDGEN_VERSION:=$(shell cargo tree --target wasm32-unknown-unknown -e all --prefix none | grep "wasm-bindgen v" | head -n 1 | cut -d 'v' -f2)
|
||||
WEB_RUNNER_DIR=web-test-runner
|
||||
WEB_SERVER_DIR=tfhe/web_wasm_parallel_tests
|
||||
TYPOS_VERSION=1.39.0
|
||||
# This is done to avoid forgetting it, we still precise the RUSTFLAGS in the commands to be able to
|
||||
# copy paste the command in the terminal and change them if required without forgetting the flags
|
||||
export RUSTFLAGS?=-C target-cpu=native
|
||||
@@ -182,9 +183,8 @@ install_cargo_audit: install_rs_build_toolchain
|
||||
|
||||
.PHONY: install_typos_checker # Install typos checker
|
||||
install_typos_checker: install_rs_build_toolchain
|
||||
@typos --version > /dev/null 2>&1 || \
|
||||
cargo $(CARGO_RS_BUILD_TOOLCHAIN) install --locked typos-cli || \
|
||||
( echo "Unable to install typos-cli, unknown error." && exit 1 )
|
||||
@./scripts/install_typos.sh --rust-toolchain $(CARGO_RS_BUILD_TOOLCHAIN) \
|
||||
--typos-version $(TYPOS_VERSION)
|
||||
|
||||
.PHONY: install_zizmor # Install zizmor workflow security checker
|
||||
install_zizmor: install_rs_build_toolchain
|
||||
|
||||
@@ -72,7 +72,7 @@ impl From<FwParameters> for asm::DigitParameters {
|
||||
}
|
||||
|
||||
/// Fw trait abstraction
|
||||
/// Use to handle Fw implemantion in an abstract way
|
||||
/// Use to handle Fw implementation in an abstract way
|
||||
#[enum_dispatch]
|
||||
pub trait Fw {
|
||||
/// Expand a program of IOp into a program of DOp
|
||||
|
||||
64
scripts/install_typos.sh
Executable file
64
scripts/install_typos.sh
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
rust_toolchain=""
|
||||
required_typos_version=""
|
||||
|
||||
function usage() {
|
||||
echo "$0: install typos-cli"
|
||||
echo
|
||||
echo "--help Print this message"
|
||||
echo "--rust-toolchain The toolchain to check the version for with leading"
|
||||
echo "--typos-version Version of typos-cli to install"
|
||||
echo
|
||||
}
|
||||
|
||||
while [ -n "$1" ]
|
||||
do
|
||||
case "$1" in
|
||||
"--rust-toolchain" )
|
||||
shift
|
||||
rust_toolchain="$1"
|
||||
;;
|
||||
|
||||
"--typos-version" )
|
||||
shift
|
||||
required_typos_version="$1"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown param : $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ "${rust_toolchain::1}" != "+" ]]; then
|
||||
rust_toolchain="+${rust_toolchain}"
|
||||
fi
|
||||
|
||||
if ! which typos ; then
|
||||
cargo "${rust_toolchain}" install --locked typos-cli --version ~"${required_typos_version}" || \
|
||||
( echo "Unable to install typos-cli, unknown error." && exit 1 )
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ver_string="$(typos --version | cut -d ' ' -f 2)"
|
||||
|
||||
ver_major="$(echo "${ver_string}" | cut -d '.' -f 1)"
|
||||
ver_minor="$(echo "${ver_string}" | cut -d '.' -f 2)"
|
||||
|
||||
min_ver_major="$(echo "${required_typos_version}" | cut -d '.' -f 1)"
|
||||
min_ver_minor="$(echo "${required_typos_version}" | cut -d '.' -f 2)"
|
||||
|
||||
if [[ "${ver_major}" -gt "${min_ver_major}" ]]; then
|
||||
exit 0
|
||||
elif [[ "${ver_major}" -eq "${min_ver_major}" ]] && [[ "${ver_minor}" -ge "${min_ver_minor}" ]]; then
|
||||
exit 0
|
||||
else
|
||||
cargo "${rust_toolchain}" install --locked typos-cli --version ~"${required_typos_version}" || \
|
||||
( echo "Unable to install typos-cli, unknown error." && exit 1 )
|
||||
fi
|
||||
@@ -945,10 +945,10 @@ fn bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
let bench_id =
|
||||
format!("{bench_name}::throughput::{fn_name}::{type_name}::{num_elems}_elems");
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
let pendings_0_in = (0..num_elems)
|
||||
let pending_0_in = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
let pendings_1_in = (0..num_elems)
|
||||
let pending_1_in = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
let total_tokens_0_in = (0..num_elems).map(|_| rng.gen::<u64>()).collect::<Vec<_>>();
|
||||
@@ -969,9 +969,9 @@ fn bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
b.iter(|| {
|
||||
let (amounts_0_out, amounts_1_out): (Vec<_>, Vec<_>) = pendings_0_in
|
||||
let (amounts_0_out, amounts_1_out): (Vec<_>, Vec<_>) = pending_0_in
|
||||
.par_iter()
|
||||
.zip(pendings_1_in.par_iter())
|
||||
.zip(pending_1_in.par_iter())
|
||||
.zip(total_tokens_0_in.par_iter())
|
||||
.zip(total_tokens_1_in.par_iter())
|
||||
.zip(total_tokens_0_out.par_iter())
|
||||
@@ -1084,10 +1084,10 @@ fn cuda_bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
let bench_id =
|
||||
format!("{bench_name}::throughput::{fn_name}::{type_name}::{num_elems}_elems");
|
||||
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
|
||||
let pendings_0_in = (0..num_elems)
|
||||
let pending_0_in = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
let pendings_1_in = (0..num_elems)
|
||||
let pending_1_in = (0..num_elems)
|
||||
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
|
||||
.collect::<Vec<_>>();
|
||||
let total_tokens_0_in = (0..num_elems).map(|_| rng.gen::<u64>()).collect::<Vec<_>>();
|
||||
@@ -1116,9 +1116,9 @@ fn cuda_bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
let num_streams_per_gpu = 2.min(num_elems / num_gpus);
|
||||
let chunk_size = (num_elems / num_gpus) as usize;
|
||||
b.iter(|| {
|
||||
pendings_0_in
|
||||
pending_0_in
|
||||
.par_chunks(chunk_size)
|
||||
.zip(pendings_1_in.par_chunks(chunk_size))
|
||||
.zip(pending_1_in.par_chunks(chunk_size))
|
||||
.zip(total_tokens_0_in.par_chunks(chunk_size))
|
||||
.zip(total_tokens_1_in.par_chunks(chunk_size))
|
||||
.zip(total_tokens_0_out.par_chunks(chunk_size))
|
||||
@@ -1131,7 +1131,7 @@ fn cuda_bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
(
|
||||
(
|
||||
(
|
||||
(pendings_0_in_gpu_i, pendings_1_in_gpu_i),
|
||||
(pending_0_in_gpu_i, pending_1_in_gpu_i),
|
||||
total_tokens_0_in_gpu_i,
|
||||
),
|
||||
total_tokens_1_in_gpu_i,
|
||||
@@ -1142,10 +1142,10 @@ fn cuda_bench_swap_claim_throughput<FheType, F1, F2>(
|
||||
),
|
||||
)| {
|
||||
let stream_chunk_size =
|
||||
pendings_0_in_gpu_i.len() / num_streams_per_gpu as usize;
|
||||
pendings_0_in_gpu_i
|
||||
pending_0_in_gpu_i.len() / num_streams_per_gpu as usize;
|
||||
pending_0_in_gpu_i
|
||||
.par_chunks(stream_chunk_size)
|
||||
.zip(pendings_1_in_gpu_i.par_chunks(stream_chunk_size))
|
||||
.zip(pending_1_in_gpu_i.par_chunks(stream_chunk_size))
|
||||
.zip(total_tokens_0_in_gpu_i.par_chunks(stream_chunk_size))
|
||||
.zip(total_tokens_1_in_gpu_i.par_chunks(stream_chunk_size))
|
||||
.zip(total_tokens_0_out_gpu_i.par_chunks(stream_chunk_size))
|
||||
|
||||
@@ -201,7 +201,7 @@ impl<Scalar: UnsignedInteger> Upgrade<Shortint128BootstrappingKey<Scalar>>
|
||||
} else {
|
||||
Err(Error::new(
|
||||
"Shortint128BootstrappingKey from TFHE-rs 1.3 and before only support u64 drift\
|
||||
mitigation key coeffecients"
|
||||
mitigation key coefficients"
|
||||
.to_string(),
|
||||
))
|
||||
}
|
||||
@@ -265,7 +265,7 @@ impl<Scalar: UnsignedInteger> Upgrade<CompressedShortint128BootstrappingKey<Scal
|
||||
} else {
|
||||
Err(Error::new(
|
||||
"CompressedShortint128BootstrappingKey from TFHE-rs 1.3 and before only support u64 \
|
||||
drift mitigation key coeffecients"
|
||||
drift mitigation key coefficients"
|
||||
.to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user