10000 BUG, Benchmark: fix passing optimization build options to asv by seiko2plus · Pull Request #17736 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG, Benchmark: fix passing optimization build options to asv #17736

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

Merged
merged 1 commit into from
Dec 16, 2020
Merged
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
4 changes: 3 additions & 1 deletion benchmarks/asv_compare.conf.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@

"build_command" : [
"python setup.py build {numpy_build_options}",
"PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"
// pip ignores '--global-option' when pep517 is enabled, we also enabling pip verbose to
// be reached from asv `--verbose` so we can verify the build options.
"PIP_NO_BUILD_ISOLATION=false python {build_dir}/benchmarks/asv_pip_nopep517.py -v {numpy_global_options} --no-deps --no-index -w {build_cache_dir} {build_dir}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be broken into two steps: one to check that --no-use-pep517 is supported, and one to build the wheel. It might be easier to avoid the pip build altogether by adding a bdist_wheel build step

rm -rf dist
python setup.py build {numpy_build_options} bdist_wheel
python -mpip install dist/*.whl

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be broken into two steps: one to check that --no-use-pep517 is supported, and one to build the wheel

already handle it through a separate python script asv_pip_nopep517.py, we're not free to use POSIX commands since we're targeting non-unix platforms too. e.g. windows

It might be easier to avoid the pip build altogether by adding a bdist_wheel build step

I tried to use bdist_wheel but ASV wouldn't able to fetch the wheel file and cache it.
also, I tried to only use the pip command only but idk why ccache doesn't work properly

here is the default values of build commands :

"install_command":
    ["python -mpip install {wheel_file}"],
"uninstall_command":
    ["return-code=any python -mpip uninstall -y {project}"],
"build_command":
    ["python setup.py build",
     "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"]

],
// The commits after which the regression search in `asv publish`
// should start looking for regressions. Dictionary whose keys are
Expand Down
15 changes: 15 additions & 0 deletions benchmarks/asv_pip_nopep517.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
This file is used by asv_compare.conf.json.tpl.
"""
import subprocess, sys
# pip ignores '--global-option' when pep517 is enabled therefore we disable it.
cmd = [sys.executable, '-mpip', 'wheel', '--no-use-pep517']
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except Exception as e:
output = str(e.output)
if "no such option" in output:
print("old version of pip, escape '--no-use-pep517'")
cmd.pop()

subprocess.run(cmd + sys.argv[1:])
1 change: 1 addition & 0 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ def asv_compare_config(bench_path, args, h_commits):

is_cached = asv_substitute_config(conf_path, nconf_path,
numpy_build_options = ' '.join([f'\\"{v}\\"' for v in build]),
numpy_global_options= ' '.join([f'--global-option=\\"{v}\\"' for v in ["build"] + build])
)
if not is_cached:
asv_clear_cache(bench_path, h_commits)
Expand Down
0