diff --git a/devtools/benchmarks-tools/run_all_benchmarks_on_latest_master.sh b/devtools/benchmarks-tools/run_all_benchmarks_on_latest_master.sh index 29af54cad3e427a89d4a7e1b8f423347f9bbdea3..3d15d9da0fa10cb885bc2e503e089e5340fef45c 100755 --- a/devtools/benchmarks-tools/run_all_benchmarks_on_latest_master.sh +++ b/devtools/benchmarks-tools/run_all_benchmarks_on_latest_master.sh @@ -39,6 +39,26 @@ rm -f current_run_dir TODAY=$(date +"%Y%m%d_%H%M") +# Directory variables for the io benchmarks. They must be set manually. +# Data directory. This directory should contain data from a tezos node. +IO_DATA_DIR=${IO_DATA_DIR-""} +# Cache directory. This directory is used to cache context keys during benchmarks. It should +# be cleaned if the data directory changes. It can be cleaned anytime, at the cost of performance. +IO_CACHE_DIR=${IO_CACHE_DIR-""} + +# IO benchmarks are run if and only if the [IO_BENCH] environment variable, as well as the directories +# [IO_DATA_DIR] and [IO_CACHE_DIR], are defined. +if [ -n "$IO_BENCH" ]; then + if [ -n "$IO_DATA_DIR" ] && [ -n "$IO_CACHE_DIR" ]; then + extra_param="--io-only --io-cache-dir ${IO_CACHE_DIR} --io-data-dir ${IO_DATA_DIR}" + else + dated_log "Either IO_DATA_DIR or IO_CACHE_DIR is not set for the IO benchmarks. Exiting." + exit 1 + fi +else + extra_param="" +fi + dated_log() { date +"[%Y-%m-%d %T] $1." } @@ -85,7 +105,7 @@ dated_log "Install DAL trusted setup" # Run benchmarks. dated_log "Running benchmarks" -time dune exec tezt/snoop/main.exe -- --verbose +time dune exec tezt/snoop/main.exe -- --verbose "$extra_param" dated_log "End of benchmarks run" # Move results from tezos to their dedicated directory. diff --git a/tezt/snoop/main.ml b/tezt/snoop/main.ml index 4991c7ef3fe26c0e5de09cce6b75f3b14673a377..f463ce95e67c420c8c054927d89fb1fd65d0efb9 100644 --- a/tezt/snoop/main.ml +++ b/tezt/snoop/main.ml @@ -26,13 +26,33 @@ (* This module runs the scripts implemented in all other modules of this directory. *) -let run proto = +let run ~io_only_flag ?io_data_dir ?io_cache_dir proto = Lwt_main.run (let* () = Prepare_data.main proto in - let* () = Perform_benchmarks.main proto in + let* () = + Perform_benchmarks.main ~io_only_flag ?io_data_dir ?io_cache_dir proto + in let* () = Perform_inference.main () in Perform_codegen.main ()) +let io_only = + Clap.flag + ~description:"Only run the IO benchmarks (io/READ and io/WRITE)." + ~set_long:"io-only" + false + +let io_data_dir = + Clap.optional_string + ~long:"io-data-dir" + ~description:"Path of the data dir for the io benchmarks." + () + +let io_cache_dir = + Clap.optional_string + ~long:"io-cache-dir" + ~description:"Path of the cache for the io benchmarks." + () + let () = Background.start (fun x -> raise x) ; - run Protocol.Alpha + run ~io_only_flag:io_only ?io_data_dir ?io_cache_dir Protocol.Alpha diff --git a/tezt/snoop/perform_benchmarks.ml b/tezt/snoop/perform_benchmarks.ml index d23c6fe778e94f48b48783eb872d79918663c8ac..c6eeff99a3e0b35b102738076d0846612a454ef0 100644 --- a/tezt/snoop/perform_benchmarks.ml +++ b/tezt/snoop/perform_benchmarks.ml @@ -320,20 +320,46 @@ let perform_dal_benchmarks snoop = let* benches = Snoop.(list_benchmarks ~mode:All ~tags:[Dal] snoop) in perform_benchmarks [] snoop benches -let main protocol = +let perform_io_benchmarks snoop io_data_dir io_cache_dir = + let patches = + [ + ( rex ".*", + fun (_json, parameters) -> + let data_dir = + Option.fold + ~none:[] + ~some:(fun x -> [("tezos_data_dir", Ezjsonm.string x)]) + io_data_dir + in + let cache_dir = + Option.fold + ~none:[] + ~some:(fun x -> [("cache_dir", Ezjsonm.string x)]) + io_cache_dir + in + let json = Ezjsonm.dict (data_dir @ cache_dir) in + return (Some json, parameters) ); + ] + in + let benches = ["io/READ"; "io/WRITE"] in + perform_benchmarks patches snoop benches + +let main ~io_only_flag ?io_data_dir ?io_cache_dir protocol = Log.info "Entering Perform_inference.main" ; let snoop = Snoop.create () in - let* () = perform_misc_benchmarks snoop in - let* () = perform_interpreter_benchmarks snoop protocol in - let* () = perform_typechecker_benchmarks snoop protocol in - let* () = perform_tickets_benchmarks snoop protocol in - let* () = perform_global_constants_benchmarks snoop in - let* () = perform_cache_benchmarks snoop in - let* () = perform_encoding_benchmarks snoop protocol in - let* () = perform_big_map_benchmarks snoop protocol in - let* () = perform_skip_list_benchmarks snoop protocol in - let* () = perform_carbonated_map_benchmarks snoop protocol in - let* () = perform_sc_rollup_benchmarks snoop protocol in - let* () = perform_shell_micheline_benchmarks snoop in - let* () = perform_dal_benchmarks snoop in - perform_sapling_benchmarks snoop + if io_only_flag then perform_io_benchmarks snoop io_data_dir io_cache_dir + else + let* () = perform_misc_benchmarks snoop in + let* () = perform_interpreter_benchmarks snoop protocol in + let* () = perform_typechecker_benchmarks snoop protocol in + let* () = perform_tickets_benchmarks snoop protocol in + let* () = perform_global_constants_benchmarks snoop in + let* () = perform_cache_benchmarks snoop in + let* () = perform_encoding_benchmarks snoop protocol in + let* () = perform_big_map_benchmarks snoop protocol in + let* () = perform_skip_list_benchmarks snoop protocol in + let* () = perform_carbonated_map_benchmarks snoop protocol in + let* () = perform_sc_rollup_benchmarks snoop protocol in + let* () = perform_shell_micheline_benchmarks snoop in + let* () = perform_dal_benchmarks snoop in + perform_sapling_benchmarks snoop