Skip to content
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

Update benchmark base #2788

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
22 changes: 17 additions & 5 deletions asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@
"project": "tardis",
"project_url": "https://tardis-sn.github.io/tardis",
"repo": ".",
"install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"],
"uninstall_command": ["return-code=any python -mpip uninstall -y {project}"],
"install_command": [
"in-dir={env_dir} 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}"
],
"branches": ["origin/master", "HEAD"],
"branches": [
"origin/master",
"HEAD"
],
"environment_type": "mamba",
"show_commit_url": "https://github.com/tardis-sn/tardis/commit/",
"conda_environment_file": "tardis_env3.yml",
"benchmark_dir": "benchmarks",
"env_dir": ".asv/env",
"results_dir": ".asv/results",
"html_dir": ".asv/html"
}
"html_dir": ".asv/html",
"matrix": {
"env": {
"TARDIS_REF_PATH": "tardis-refdata/atom_data"
Copy link
Member Author

Choose a reason for hiding this comment

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

does the atom_data needs to be passed by a different env variable?

}
}
}
17 changes: 8 additions & 9 deletions benchmarks/benchmark_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import functools
import os.environ as env
from copy import deepcopy
from os.path import dirname, join, realpath
from pathlib import Path

import numpy as np
Expand All @@ -27,14 +27,13 @@ class BenchmarkBase:
timeout = 600

@staticmethod
def get_relative_path(partial_path: str):
path = dirname(realpath(__file__))
targets = Path(partial_path).parts
def get_relative_path(partial_path: str) -> str:
path = Path(__file__).resolve().parent

for target in targets:
path = join(path, target)
for target in Path(partial_path).parts:
path = path / target

return path
return str(path)

def get_absolute_path(self, partial_path):
partial_path = "../" + partial_path
Expand Down Expand Up @@ -63,7 +62,7 @@ def config_rpacket_tracking(self):
def tardis_ref_path(self):
ref_data_path = Path(
Path(__file__).parent.parent,
"tardis-refdata"
env.get("TARDIS_REF_PATH")
).resolve()
return ref_data_path

Expand All @@ -80,7 +79,7 @@ def atomic_dataset(self) -> AtomData:
@functools.cached_property
def atomic_data_fname(self):
atomic_data_fname = (
f"{self.tardis_ref_path}/atom_data/kurucz_cd23_chianti_H_He.h5"
f"{self.tardis_ref_path}/kurucz_cd23_chianti_H_He.h5"
)

if not Path(atomic_data_fname).exists():
Expand Down
Loading