mirror of
https://github.com/circify/circ.git
synced 2026-01-09 13:48:02 -05:00
Replaced third party dependencies with binaries to reduce CI build times (#162)
To reduce CI build time: - Replaced ABY dependency with corresponding binary. - Removed dependencies on KaHIP and KaHyPar for now because these dependencies aren't used upstream. Minor updates: - Updated ABY source to Public branch Note: - The aby_interpreter binary will only work on Linux. We can rebuild the binary from this repo.
This commit is contained in:
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
@@ -8,9 +8,6 @@ on:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
ABY_SOURCE: "./../ABY"
|
||||
KAHIP_SOURCE: "./../KaHIP"
|
||||
KAHYPAR_SOURCE: "./../kahypar"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -27,15 +24,7 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Set all features on
|
||||
run: python3 driver.py --all_features
|
||||
- name: Cache third_party libraries
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
/home/runner/work/circ/ABY
|
||||
/home/runner/work/circ/KaHIP
|
||||
/home/runner/work/circ/kahypar
|
||||
key: ${{ runner.os }}-third_party
|
||||
- name: Install third_party libraries
|
||||
- name: Install python reqs
|
||||
run: python3 driver.py --install
|
||||
- name: Check
|
||||
run: python3 driver.py --check
|
||||
|
||||
@@ -68,8 +68,6 @@ datalog = ["pest", "pest-ast", "pest_derive", "from-pest", "lazy_static"]
|
||||
smt = ["rsmt2", "ieee754"]
|
||||
lp = ["good_lp", "lp-solvers"]
|
||||
aby = ["lp"]
|
||||
kahip = ["aby"]
|
||||
kahypar = ["aby"]
|
||||
r1cs = ["bincode"]
|
||||
poly = ["rug-polynomial"]
|
||||
spartan = ["r1cs", "dep:spartan", "merlin", "curve25519-dalek", "bincode", "gmp-mpfr-sys"]
|
||||
|
||||
26
driver.py
26
driver.py
@@ -27,30 +27,6 @@ def install(features):
|
||||
set of features required
|
||||
"""
|
||||
|
||||
def verify_path_empty(path) -> bool:
|
||||
return not os.path.isdir(path) or (os.path.isdir(path) and not os.listdir(path))
|
||||
|
||||
for f in features:
|
||||
if f == "aby":
|
||||
if verify_path_empty(ABY_SOURCE):
|
||||
subprocess.run(
|
||||
["git", "clone", "https://github.com/edwjchen/ABY.git", ABY_SOURCE]
|
||||
)
|
||||
subprocess.run(["./scripts/build_aby.zsh"])
|
||||
if f == "kahip":
|
||||
if verify_path_empty(KAHIP_SOURCE):
|
||||
subprocess.run(
|
||||
["git", "clone", "https://github.com/KaHIP/KaHIP.git", KAHIP_SOURCE]
|
||||
)
|
||||
subprocess.run(["./scripts/build_kahip.zsh"])
|
||||
if f == "kahypar":
|
||||
if verify_path_empty(KAHYPAR_SOURCE):
|
||||
subprocess.run(
|
||||
["git", "clone", "--depth=1", "--recursive",
|
||||
"https://github.com/SebastianSchlag/kahypar.git", KAHYPAR_SOURCE]
|
||||
)
|
||||
subprocess.run(["./scripts/build_kahypar.zsh"])
|
||||
|
||||
# install python requirements
|
||||
subprocess.run(["pip3", "install", "-r", "requirements.txt"])
|
||||
|
||||
@@ -116,7 +92,6 @@ def build(features):
|
||||
log_run_check(["./scripts/build_mpc_c_test.zsh"])
|
||||
if "smt" in features and "zok" in features:
|
||||
log_run_check(["./scripts/build_mpc_zokrates_test.zsh"])
|
||||
log_run_check(["./scripts/build_aby.zsh"])
|
||||
|
||||
|
||||
def test(features, extra_args):
|
||||
@@ -368,7 +343,6 @@ if __name__ == "__main__":
|
||||
verify_extra_implies_flamegraph_or_test(args)
|
||||
|
||||
features = load_features()
|
||||
set_env(features)
|
||||
|
||||
if args.flamegraph:
|
||||
if len(args.extra) > 0 and args.extra[0] == "--":
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
from util import run_tests
|
||||
from test_suite import *
|
||||
|
||||
ABY_SOURCE = os.getenv("ABY_SOURCE")
|
||||
|
||||
if __name__ == "__main__":
|
||||
tests = [[
|
||||
"loop add",
|
||||
3,
|
||||
ABY_SOURCE+"/build/bin/2pc_loop_add",
|
||||
{"a": 1, "b": 0},
|
||||
{"a": 0, "b": 2},
|
||||
]]
|
||||
|
||||
run_tests('c', tests)
|
||||
@@ -11,7 +11,7 @@ def rename_test(name: str, lang: str) -> str:
|
||||
|
||||
def build_cmd(name: str, test_file: str, role: int) -> List[str]:
|
||||
path = f"./scripts/aby_tests/tests/{name}"
|
||||
return [os.getenv("ABY_SOURCE") + "/build/bin/aby_interpreter", "-m", "mpc", "-f", path, "-t", test_file, "-r", str(role)]
|
||||
return ["./third_party/bin/ABY/aby_interpreter", "-m", "mpc", "-f", path, "-t", test_file, "-r", str(role)]
|
||||
|
||||
|
||||
def get_result(file_path):
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
if [[ ! -z ${ABY_SOURCE} ]]; then
|
||||
cd ${ABY_SOURCE}
|
||||
git checkout functions
|
||||
mkdir -p -- build
|
||||
cd build
|
||||
cmake .. -DABY_BUILD_EXE=On
|
||||
make
|
||||
else
|
||||
echo "Missing ABY_SOURCE environment variable."
|
||||
fi
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
if [[ ! -z ${KAHIP_SOURCE} ]]; then
|
||||
cd ${KAHIP_SOURCE}
|
||||
./compile_withcmake.sh -DCMAKE_BUILD_TYPE=Release -DPARHIP=off
|
||||
else
|
||||
echo "Missing KAHIP_SOURCE environment variable."
|
||||
fi
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
if [[ ! -z ${KAHYPAR_SOURCE} ]]; then
|
||||
cd ${KAHYPAR_SOURCE}
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
|
||||
make
|
||||
else
|
||||
echo "Missing KAHYPAR_SOURCE environment variable."
|
||||
fi
|
||||
@@ -1,19 +1,9 @@
|
||||
//! Utility functions to write compiler output to ABY
|
||||
|
||||
use std::env;
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
/// Get ABY source directory
|
||||
pub fn get_aby_source() -> String {
|
||||
let key = "ABY_SOURCE";
|
||||
match env::var(key) {
|
||||
Ok(val) => val,
|
||||
Err(e) => panic!("Missing env variable: ABY_SOURCE, {}", e),
|
||||
}
|
||||
}
|
||||
|
||||
/// Given Path `path` and String denominator `lang`, return the filename of the path
|
||||
pub fn get_path(path: &Path, lang: &str, t: &str, create: bool) -> String {
|
||||
let filename = Path::new(&path.iter().last().unwrap())
|
||||
|
||||
BIN
third_party/bin/ABY/aby_interpreter
vendored
Executable file
BIN
third_party/bin/ABY/aby_interpreter
vendored
Executable file
Binary file not shown.
22
util.py
22
util.py
@@ -4,26 +4,10 @@ from os import path
|
||||
# Gloable variables
|
||||
feature_path = ".features.txt"
|
||||
mode_path = ".mode.txt"
|
||||
cargo_features = {"aby", "c", "lp", "r1cs", "kahip", "kahypar",
|
||||
"smt", "zok", "datalog", "bellman", "spartan", "poly"}
|
||||
|
||||
# Environment variables
|
||||
ABY_SOURCE = "./../ABY"
|
||||
KAHIP_SOURCE = "./../KaHIP"
|
||||
KAHYPAR_SOURCE = "./../kahypar"
|
||||
|
||||
|
||||
def set_env(features):
|
||||
for f in features:
|
||||
if f == 'aby':
|
||||
if not os.getenv("ABY_SOURCE"):
|
||||
os.environ["ABY_SOURCE"] = ABY_SOURCE
|
||||
if f == 'kahip':
|
||||
if not os.getenv("KAHIP_SOURCE"):
|
||||
os.environ["KAHIP_SOURCE"] = KAHIP_SOURCE
|
||||
if f == 'kahypar':
|
||||
if not os.getenv("KAHYPAR_SOURCE"):
|
||||
os.environ["KAHYPAR_SOURCE"] = KAHYPAR_SOURCE
|
||||
# TODO: add in "kahip", "kahypar" binaries dependencies when adding new MPC changes
|
||||
cargo_features = {"aby", "c", "lp", "r1cs", "smt",
|
||||
"zok", "datalog", "bellman", "spartan", "poly"}
|
||||
|
||||
|
||||
def save_mode(mode):
|
||||
|
||||
Reference in New Issue
Block a user