Skip to content

Commit

Permalink
fix: asv.conf.json defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
dPys committed Nov 7, 2024
1 parent 3a3f1cf commit 76cef1a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -U build pip twine
pip install -e .[doc,test,scrape]
pip install -e .[doc,test]
- name: Build and check package
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[test,scrape]
pip install -e .[test]
- name: Cache Test Data
uses: actions/cache@v4
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,7 @@ downloaded_pdfs/
results/*

# html
html/*
html/*

# envs
env/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ datasets:
```bash
# Install development dependencies
pip install -e .[test,scrape,doc] # testing, scraping of real-world graph data, and documentation
pip install -e .[test,doc] # testing and documentation

# Run tests
make test
Expand Down
6 changes: 3 additions & 3 deletions asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"branches": [
"main"
],
"environment_type": "virtualenv",
"environment_type": "existing",
"show_commit_url": "https://github.com/dpys/nxbench/commit/",
"pythons": [
"3.11"
Expand All @@ -24,7 +24,7 @@
"2024.2.0"
]
},
"env": {
"env_nobuild": {
"NUM_THREAD": [
"1",
"4",
Expand All @@ -50,7 +50,7 @@
"asv_runner"
],
"build_command": [
"python -m pip install ."
"PIP_NO_BUILD_ISOLATION=false python -m pip install ."
],
"install_command": [
"python -m pip install {wheel_file}"
Expand Down
12 changes: 7 additions & 5 deletions nxbench/benchmarks/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
available_backends = get_available_backends()
backends = [
backend
for backend, version_list in config.matrix.get("req", {"networkx": ["3.3"]}).items()
for backend, version_list in config.matrix.get(
"req", {"networkx": ["3.4.2"]}
).items()
if backend in available_backends
]
num_thread_values = [
int(v) for v in config.matrix.get("env", {}).get("NUM_THREAD", ["1"])
int(v) for v in config.matrix.get("env_nobuild", {}).get("NUM_THREAD", ["1"])
]


Expand Down Expand Up @@ -196,7 +198,7 @@ def do_benchmark(
except (ImportError, AttributeError):
logger.exception(f"Function not available for backend {backend}")
logger.debug(traceback.format_exc())
self.teardown(dataset_name, backend)
self.teardown(dataset_name, backend, num_thread)
return {"execution_time": float("nan"), "memory_used": float("nan")}

try:
Expand Down Expand Up @@ -234,11 +236,11 @@ def do_benchmark(
logger.debug(traceback.format_exc())
metrics = {"execution_time": float("nan"), "memory_used": float("nan")}
finally:
self.teardown(dataset_name, backend)
self.teardown(dataset_name, backend, num_thread)

return metrics

def teardown(self, dataset_name: str, backend: str):
def teardown(self, dataset_name: str, backend: str, num_thread: int = 1):
"""Reset any backend-specific configurations to avoid state leakage."""
if backend == "parallel":
nx.config.backends.parallel.active = False
Expand Down
2 changes: 1 addition & 1 deletion nxbench/benchmarks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def load_default_config() -> BenchmarkConfig:
"nx-parallel": ["0.3"],
"python-graphblas": ["2024.2.0"],
},
"env": {
"env_nobuild": {
"NUM_THREAD": ["1", "4", "8"],
},
}
Expand Down
19 changes: 9 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,19 @@ dependencies = [
"pydantic >=2.8",
"setuptools >=75.1",
"nest-asyncio >=1.6",
"pytest-asyncio >= 0.24.0",
"asv>=0.6.4",
"asv >=0.6.4",
"dash >= 2.18.1",
"dash-bootstrap-components >= 1.6.0"
]

[project.optional-dependencies]
cuda = ["cugraph"]

scrape = ["aiohttp >= 3.9.5",
"dash-bootstrap-components >=1.6.0",
"aiohttp >= 3.9.5",
"aiofiles >= 24.1.0",
"chardet >= 4.0.0",
"beautifulsoup4 >= 4.12.3",
"multidict >= 6.0.5",
"yarl >= 1.9.4"]
"yarl >= 1.9.4"
]

[project.optional-dependencies]
cuda = ["cugraph"]

test = [
'pre-commit>=3.8.0',
Expand All @@ -60,6 +58,7 @@ test = [
'pytest-xdist>=1.32.0',
'pytest-metadata>=2.0.2',
'pytest-env>=1.1.5',
"pytest-asyncio >= 0.24.0",
'coverage>=7.6.1',
'build>=1.2.2',
'isort>=5.13.2'
Expand Down

0 comments on commit 76cef1a

Please sign in to comment.