Skip to content

Commit

Permalink
set compiler to 8.10.7, enable profiling on benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
paolino committed Jul 7, 2023
1 parent 8602f8e commit 9996fe8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 29 deletions.
24 changes: 6 additions & 18 deletions .buildkite/bench-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,16 @@ bench="./bench-restore/bin/restore $network --node-db $node_db"

echo "--- Run benchmarks - $network"

command time -o $total_time -v $bench +RTS -N2 -qg -A1m -I0 -T -M16G -RTS 2>&1 | tee $log
command time -o $total_time -v $bench +RTS -N2 -qg -A1m -I0 -T -M16G -h -RTS 2>&1 | tee $log

grep -v INFO $log | awk '/All results/,EOF { print $0 }' >$results

echo "+++ Results - $network"

cat $results

# https://input-output.atlassian.net/browse/ADP-3078
#
# With GHC 8.10.7 we used to use the -h flag to generate a heap profile file
# restore.hp which was then converted to a pretty graph.
#
# With the GHC 9.2.8 using the -h flag (or -hT) causes the benchmark to
# become many times slower so the code below is commented out to unblock
# the migration to 9.2.8.
#
# In the long run we shouldn't benchmark with -h anyway, but rather
# perform profiling separately.

# mv restore.hp $artifact_name.hp
# hp2pretty $artifact_name.hp
mv restore.hp $artifact_name.hp
hp2pretty $artifact_name.hp

GNUPLOT_PROGRAM=$(
cat <<EOP
Expand Down Expand Up @@ -75,7 +63,7 @@ EOP

if [ -n "${BUILDKITE:-}" ]; then
echo "--- Upload"
# buildkite-agent artifact upload $artifact_name.svg
buildkite-agent artifact upload $artifact_name.svg
buildkite-agent artifact upload $results

for file in *.timelog; do
Expand All @@ -93,8 +81,8 @@ if [ -n "${BUILDKITE:-}" ]; then
echo $GNUPLOT_PROGRAM | gnuplot
buildkite-agent artifact upload plot.svg

# echo "+++ Heap profile"
# printf '\033]1338;url='"artifact://$artifact_name.svg"';alt='"Heap profile"'\a\n'
echo "+++ Heap profile"
printf '\033]1338;url='"artifact://$artifact_name.svg"';alt='"Heap profile"'\a\n'
echo "+++ Restore plot"
printf '\033]1338;url='"artifact://plot.svg"';alt='"Restore plot"'\a\n'
fi
Expand Down
2 changes: 1 addition & 1 deletion lib/wallet/bench/db-bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{-# LANGUAGE TypeFamilies #-}

{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -Wno-ambiguous-fields #-}
-- {-# OPTIONS_GHC -Wno-ambiguous-fields #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}

-- |
Expand Down
28 changes: 18 additions & 10 deletions nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CHaP: haskell-nix: nixpkgs-recent: nodePkgs: haskell-nix.cabalProject' [
indexState = "2023-06-04T22:30:25Z";
in {
name = "cardano-wallet";
compiler-nix-name = "ghc928";
compiler-nix-name = "ghc8107";

src = haskellLib.cleanSourceWith {
name = "cardano-wallet-src";
Expand All @@ -111,21 +111,18 @@ CHaP: haskell-nix: nixpkgs-recent: nodePkgs: haskell-nix.cabalProject' [
name = "cardano-wallet-shell${lib.optionalString config.profiling "-profiled"}";
packages = ps: builtins.attrValues (haskellLib.selectProjectPackages ps);
tools = {
# cabal-cache = {};
cabal = { index-state = indexState; };
cabal-fmt = { index-state = indexState; };
haskell-language-server = {
index-state = indexState;
version = "latest";
};
hlint = { index-state = indexState; };
# haskell-language-server = {
# index-state = indexState;
# version = "latest";
# };
hoogle = { index-state = indexState; };
lentil = { index-state = indexState; };
fourmolu = { index-state = indexState; };
weeder = {
index-state = indexState;
version = "2.4.1";
};
version = "2.2.0";
};
};
nativeBuildInputs = with buildProject.hsPkgs; [
nodePkgs.cardano-cli
Expand All @@ -146,6 +143,17 @@ CHaP: haskell-nix: nixpkgs-recent: nodePkgs: haskell-nix.cabalProject' [
nixWrapped
mdbook
(haskell-nix.tool "ghc8107" "stylish-haskell" "0.11.0.3")
(haskell-nix.tool "ghc8107" "hlint" "3.3")
(haskell-nix.tool "ghc928" "fourmolu" "0.13.0.0")
(haskell-nix.tool "ghc8107" "haskell-language-server" ({pkgs, ...}: rec {
# Use the github source of HLS that is tested with haskell.nix CI
src = pkgs.haskell-nix.sources."hls-2.0";
# `tool` normally ignores the `cabal.project` (if there is one in the hackage source).
# We need to use the github one (since it has settings to make hls build).
cabalProject = __readFile (src + "/cabal.project");
# sha256 for a `source-repository-package` in the `cabal.project` file.
sha256map."https://github.com/pepeiborra/ekg-json"."7a0af7a8fd38045fd15fb13445bdcc7085325460" = "sha256-fVwKxGgM0S4Kv/4egVAAiAjV7QB5PBqMVMCfsv7otIQ=";
}))
]);
};

Expand Down

0 comments on commit 9996fe8

Please sign in to comment.