Skip to content

Add support for parallel multibench targets and JSON input #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion run_sandmark_backfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def get_script_dir():
SANDMARK_REPO = os.path.join(SCRIPTDIR, 'sandmark')
SANDMARK_COMP_FMT_DEFAULT = 'https://github.com/ocaml/ocaml/archive/{tag}.tar.gz'
SANDMARK_RUN_BENCH_TARGETS_DEFAULT = 'run_orun'
SANDMARK_RUN_JSON_DEFAULT = 'run_config.json'
SANDMARK_BUILD_BENCH_TARGET_DEFAULT = 'buildbench'
CODESPEED_URL = 'http://localhost:8000/'
ENVIRONMENT = 'macbook'

Expand Down Expand Up @@ -55,6 +57,8 @@ def get_script_dir():
parser.add_argument('--upload_date_tag', type=str, help='specific date tag to upload', default=None)
parser.add_argument('--configure_options', type=str, help='configure options to compiler', default='')
parser.add_argument('--ocamlrunparam', type=str, help='OCAMLRUNPARAM', default='')
parser.add_argument('--run_json', type=str, help='Run JSON', default=SANDMARK_RUN_JSON_DEFAULT)
parser.add_argument('--build_bench_target', type=str, help='Build Bench Target', default=SANDMARK_BUILD_BENCH_TARGET_DEFAULT)
parser.add_argument('--codespeed_url', type=str, help='codespeed URL for upload', default=CODESPEED_URL)
parser.add_argument('-v', '--verbose', action='store_true', default=False)

Expand Down Expand Up @@ -216,6 +220,8 @@ def check_hash_new(h):
print('writing hash information to: %s'%comp_file)
with open(comp_file, 'w') as f:
json.dump(json_contents, f)
if args.run_json:
shell_exec('cd %s; make %s'%(sandmark_dir, args.run_json))

if 'bench' in args.run_stages:
## run bench
Expand All @@ -229,7 +235,7 @@ def check_hash_new(h):
print('Running bench target %s'%target)

log_fname = os.path.join(hashdir, '%s_%s.log'%(run_timestamp, target))
completed_proc = shell_exec_redirect('cd %s; make %s.bench ITER=%i PRE_BENCH_EXEC=%s RUN_BENCH_TARGET=%s'%(sandmark_dir, version_tag, args.sandmark_iter, args.sandmark_pre_exec, target), log_fname)
completed_proc = shell_exec_redirect('cd %s; make %s.bench ITER=%i PRE_BENCH_EXEC=%s RUN_BENCH_TARGET=%s BUILD_BENCH_TARGET=%s RUN_CONFIG_JSON=%s'%(sandmark_dir, version_tag, args.sandmark_iter, args.sandmark_pre_exec, target, args.build_bench_target, args.run_json), log_fname)
if completed_proc.returncode != 0:
print('ERROR[%d] in sandmark bench run for %s (see %s)'%(completed_proc.returncode, h, log_fname))
## TODO: the error isn't fatal, just that something failed in there...
Expand Down
4 changes: 3 additions & 1 deletion sandmark_batch_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ def get_script_dir():

BENCH_TARGETS={bench_targets}
BENCH_CORE={bench_core}
BUILD_BENCH_TARGET={build_bench_target}
ENVIRONMENT={environment}
EXEC_SPEC={exec_spec}
CODESPEED_URL={codespeed_url}
CODESPEED_DB={ocamlspeed_dir}/data/data.db
RUN_JSON={run_json}
ARCHIVE_DIR={ocamlspeed_dir}/artifacts/

GITHUB_USER={github_user}
Expand Down Expand Up @@ -95,7 +97,7 @@ def get_script_dir():
sqlite3 ${CODESPEED_DB} "INSERT INTO codespeed_project (name,repo_type,repo_path,repo_user,repo_pass,commit_browsing_url,track,default_branch) SELECT '${CODESPEED_NAME}', 'G', 'https://github.com/${GITHUB_USER}/${GITHUB_REPO}', '${GITHUB_USER}', '', 'https://github.com/${GITHUB_USER}/${GITHUB_REPO}/commit/{commitid}',1,'${BRANCH}' WHERE NOT EXISTS(SELECT 1 FROM codespeed_project WHERE name = '${CODESPEED_NAME}')"

## run backfill script
./run_sandmark_backfill.py --run_stages ${RUN_STAGES} --branch ${BRANCH} --main_branch ${BRANCH} --repo ${REPO} --repo_pull --repo_reset_hard --use_repo_reference --max_hashes ${MAX_HASHES} --incremental_hashes --commit_choice_method from_hash=${FIRST_COMMIT} --executable_spec=${EXEC_SPEC} --environment ${ENVIRONMENT} --sandmark_comp_fmt https://github.com/${GITHUB_USER}/${GITHUB_REPO}/archive/{tag}.tar.gz --sandmark_tag_override ${OCAML_VERSION} --sandmark_iter 1 --sandmark_pre_exec="'taskset --cpu-list "${BENCH_CORE}" setarch `uname -m` --addr-no-randomize'" --sandmark_run_bench_targets ${BENCH_TARGETS} --archive_dir ${ARCHIVE_DIR} --codespeed_url ${CODESPEED_URL} --configure_options="${CONFIGURE_OPTIONS}" --ocamlrunparam="${OCAMLRUNPARAM}" --upload_project_name ${CODESPEED_NAME} -v ${RUNDIR}
./run_sandmark_backfill.py --run_stages ${RUN_STAGES} --branch ${BRANCH} --main_branch ${BRANCH} --repo ${REPO} --repo_pull --repo_reset_hard --use_repo_reference --max_hashes ${MAX_HASHES} --incremental_hashes --commit_choice_method from_hash=${FIRST_COMMIT} --executable_spec=${EXEC_SPEC} --environment ${ENVIRONMENT} --sandmark_comp_fmt https://github.com/${GITHUB_USER}/${GITHUB_REPO}/archive/{tag}.tar.gz --sandmark_tag_override ${OCAML_VERSION} --sandmark_iter 1 --sandmark_pre_exec="'taskset --cpu-list "${BENCH_CORE}" setarch `uname -m` --addr-no-randomize'" --sandmark_run_bench_targets ${BENCH_TARGETS} --archive_dir ${ARCHIVE_DIR} --codespeed_url ${CODESPEED_URL} --configure_options="${CONFIGURE_OPTIONS}" --ocamlrunparam="${OCAMLRUNPARAM}" --run_json ${RUN_JSON} --build_bench_target ${BUILD_BENCH_TARGET} --upload_project_name ${CODESPEED_NAME} -v ${RUNDIR}

'''

Expand Down