Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 59163e2

Browse files
authored
Optimize some CI stuff (#1880)
* CI Optimizations
1 parent 5740210 commit 59163e2

File tree

8 files changed

+80
-45
lines changed

8 files changed

+80
-45
lines changed

ci/buildkite.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
steps:
2+
- command: "ci/test-stable-perf.sh"
3+
name: "stable-perf [public]"
4+
env:
5+
CARGO_TARGET_CACHE_NAME: "stable-perf"
6+
timeout_in_minutes: 20
7+
agents:
8+
- "queue=cuda"
9+
- command: "ci/test-bench.sh"
10+
name: "bench [public]"
11+
env:
12+
CARGO_TARGET_CACHE_NAME: "nightly"
13+
timeout_in_minutes: 30
214
- command: "ci/docker-run.sh solanalabs/rust:1.30.1 ci/test-stable.sh"
315
name: "stable [public]"
416
env:
517
CARGO_TARGET_CACHE_NAME: "stable"
618
timeout_in_minutes: 30
7-
- command: "ci/docker-run.sh solanalabs/rust-nightly:2018-11-12 ci/test-bench.sh"
8-
name: "bench [public]"
19+
- command: "ci/docker-run.sh solanalabs/rust:1.30.1 ci/test-checks.sh"
20+
name: "checks [public]"
921
env:
10-
CARGO_TARGET_CACHE_NAME: "nightly"
22+
CARGO_TARGET_CACHE_NAME: "checks"
1123
timeout_in_minutes: 30
1224
- command: "ci/shellcheck.sh"
1325
name: "shellcheck [public]"
@@ -17,13 +29,6 @@ steps:
1729
env:
1830
CARGO_TARGET_CACHE_NAME: "nightly"
1931
timeout_in_minutes: 30
20-
- command: "ci/test-stable-perf.sh"
21-
name: "stable-perf [public]"
22-
env:
23-
CARGO_TARGET_CACHE_NAME: "stable-perf"
24-
timeout_in_minutes: 20
25-
agents:
26-
- "queue=cuda"
2732
# TODO: Fix and re-enable test-large-network.sh
2833
# - command: "ci/test-large-network.sh || true"
2934
# name: "large-network [public] [ignored]"

ci/test-bench.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,21 @@ source ci/upload_ci_artifact.sh
99
eval "$(ci/channel-info.sh)"
1010

1111
ci/version-check.sh nightly
12-
export RUST_BACKTRACE=1
12+
if ! ci/version-check.sh nightly; then
13+
# This job doesn't run within a container, try once to upgrade tooling on a
14+
# version check failure
15+
rustup install nightly
16+
rustup default nightly
17+
ci/version-check.sh nightly
18+
fi
1319

1420
_() {
1521
echo "--- $*"
1622
"$@"
1723
}
1824

1925
set -o pipefail
26+
export RUST_BACKTRACE=1
2027

2128
UPLOAD_METRICS=""
2229
TARGET_BRANCH=$BUILDKITE_BRANCH
@@ -29,6 +36,15 @@ fi
2936
BENCH_FILE=bench_output.log
3037
BENCH_ARTIFACT=current_bench_results.log
3138
_ cargo bench --features=unstable --verbose -- -Z unstable-options --format=json | tee "$BENCH_FILE"
32-
_ cargo run --release --bin solana-upload-perf -- "$BENCH_FILE" "$TARGET_BRANCH" "$UPLOAD_METRICS" >"$BENCH_ARTIFACT"
39+
40+
# Run bpf_loader bench with bpf_c feature enabled
41+
(
42+
set -x
43+
cd "programs/native/bpf_loader"
44+
echo --- program/native/bpf_loader bench --features=bpf_c
45+
cargo bench --verbose --features="bpf_c" -- -Z unstable-options --format=json --nocapture | tee -a ../../../"$BENCH_FILE"
46+
)
47+
48+
_ cargo run --release --bin solana-upload-perf -- "$BENCH_FILE" "$TARGET_BRANCH" "$UPLOAD_METRICS" > "$BENCH_ARTIFACT"
3349

3450
upload_ci_artifact "$BENCH_ARTIFACT"

ci/test-checks.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
cd "$(dirname "$0")/.."
5+
6+
ci/version-check.sh stable
7+
export RUST_BACKTRACE=1
8+
export RUSTFLAGS="-D warnings"
9+
10+
_() {
11+
echo "--- $*"
12+
"$@"
13+
}
14+
15+
_ cargo fmt -- --check
16+
_ cargo clippy -- --version
17+
_ cargo clippy -- --deny=warnings
18+
19+
_ ci/audit.sh

ci/test-nightly.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ maybe_cargo_install() {
2727
done
2828
}
2929

30-
# Run program/native/bpf_loader's bench with bpf_c feature
31-
(
32-
set -x
33-
cd "programs/native/bpf_loader"
34-
echo --- program/native/bpf_loader bench --features=bpf_c
35-
cargo bench --verbose --features="bpf_c" -- --nocapture
36-
)
37-
3830
maybe_cargo_install cov
3931

4032
# Generate coverage data and report via unit-test suite.

ci/test-stable-perf.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,45 @@ if ! ci/version-check.sh stable; then
1010
# This job doesn't run within a container, try once to upgrade tooling on a
1111
# version check failure
1212
rustup install stable
13+
rustup default stable
1314
ci/version-check.sh stable
1415
fi
16+
1517
export RUST_BACKTRACE=1
1618
export RUSTFLAGS="-D warnings"
1719

18-
./fetch-perf-libs.sh
19-
# shellcheck source=/dev/null
20-
source ./target/perf-libs/env.sh
21-
2220
_() {
2321
echo "--- $*"
2422
"$@"
2523
}
2624

27-
FEATURES=cuda,erasure,chacha
25+
./fetch-perf-libs.sh
26+
# shellcheck source=/dev/null
27+
source ./target/perf-libs/env.sh
28+
29+
FEATURES=bpf_c,cuda,erasure,chacha
2830
_ cargo build --all --verbose --features="$FEATURES"
2931
_ cargo test --verbose --features="$FEATURES" --lib
3032

3133
# Run integration tests serially
3234
for test in tests/*.rs; do
3335
test=${test##*/} # basename x
3436
test=${test%.rs} # basename x .rs
35-
_ cargo test --verbose --jobs=1 --features="$FEATURES" --test="$test"
37+
_ cargo test --verbose --features="$FEATURES" --test="$test" -- --test-threads=1
3638
done
3739

40+
# Run bpf_loader test with bpf_c features enabled
41+
(
42+
set -x
43+
cd "programs/native/bpf_loader"
44+
echo --- program/native/bpf_loader test --features=bpf_c
45+
cargo test --verbose --features="bpf_c"
46+
)
47+
3848
echo --- ci/localnet-sanity.sh
3949
(
4050
set -x
4151
# Assume |cargo build| has populated target/debug/ successfully.
4252
export PATH=$PWD/target/debug:$PATH
4353
USE_INSTALL=1 ci/localnet-sanity.sh
44-
)
54+
)

ci/test-stable.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,17 @@ maybe_install() {
2424
done
2525
}
2626

27-
_ cargo fmt -- --check
28-
_ cargo clippy -- --version
29-
_ cargo clippy -- --deny=warnings
3027
_ cargo build --all --verbose
3128
_ cargo test --verbose --lib
3229

3330
# Run integration tests serially
3431
for test in tests/*.rs; do
3532
test=${test##*/} # basename x
3633
test=${test%.rs} # basename x .rs
37-
_ cargo test --verbose --jobs=1 --test="$test" --features="bpf_c"
34+
_ cargo test --verbose --test="$test" -- --test-threads=1
3835
done
3936

40-
# Run native program's tests
37+
# Run native program tests
4138
for program in programs/native/*; do
4239
echo --- "$program"
4340
(
@@ -47,14 +44,6 @@ for program in programs/native/*; do
4744
)
4845
done
4946

50-
# Run program/native/bpf_loader's test with bpf_c feature
51-
(
52-
set -x
53-
cd "programs/native/bpf_loader"
54-
echo --- program/native/bpf_loader test --features=bpf_c
55-
cargo test --verbose --features="bpf_c"
56-
)
57-
5847
# Build the HTML
5948
export PATH=$CARGO_HOME/bin:$PATH
6049
maybe_install mdbook
@@ -68,5 +57,3 @@ echo --- ci/localnet-sanity.sh
6857
export PATH=$PWD/target/debug:$PATH
6958
USE_INSTALL=1 ci/localnet-sanity.sh
7059
)
71-
72-
_ ci/audit.sh

programs/native/bpf_loader/benches/bpf_loader.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ fn bench_program_alu(bencher: &mut Bencher) {
9494
assert!(0f64 != summary.median);
9595
let mips = (instructions * (ns_per_s / summary.median as u64)) / one_million;
9696
println!(" {:?} MIPS", mips);
97+
println!("{{ \"type\": \"bench\", \"name\": \"bench_program_alu_interpreted_mips\", \"median\": {:?}, \"deviation\": 0 }}", mips);
9798

9899
println!("JIT to native:");
99100
vm.jit_compile().unwrap();
@@ -112,4 +113,5 @@ fn bench_program_alu(bencher: &mut Bencher) {
112113
assert!(0f64 != summary.median);
113114
let mips = (instructions * (ns_per_s / summary.median as u64)) / one_million;
114115
println!(" {:?} MIPS", mips);
116+
println!("{{ \"type\": \"bench\", \"name\": \"bench_program_alu_jit_to_native_mips\", \"median\": {:?}, \"deviation\": 0 }}", mips);
115117
}

src/bin/upload-perf.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,20 @@ fn main() {
100100
println!("bench_name, median, last_median, deviation, last_deviation");
101101
for (entry, values) in results {
102102
println!(
103-
"{}, {}, {}, {}, {}",
104-
entry, values.0, values.2, values.1, values.3
103+
"{:#10?}, {:#10?}, {:#10?}, {:#10?}, {}",
104+
values.0,
105+
values.2.parse::<i32>().unwrap(),
106+
values.1,
107+
values.3.parse::<i32>().unwrap(),
108+
entry,
105109
);
106110
}
107111
} else {
108112
println!("No previous results found for {} branch", branch);
109113
println!("hash: {}", trimmed_hash);
110114
println!("bench_name, median, deviation");
111115
for (entry, values) in results {
112-
println!("{}, {}, {}", entry, values.0, values.1);
116+
println!("{:10?}, {:10?}, {}", values.0, values.1, entry);
113117
}
114118
}
115119
solana_metrics::flush();

0 commit comments

Comments
 (0)