From 76cef1afb3d81cd3a9567456c00d6c0084e6f5ea Mon Sep 17 00:00:00 2001 From: dpys Date: Thu, 7 Nov 2024 16:59:58 -0500 Subject: [PATCH] fix: asv.conf.json defaults --- .github/workflows/pythonpackage.yml | 2 +- .github/workflows/test.yml | 2 +- .gitignore | 5 ++++- README.md | 2 +- asv.conf.json | 6 +++--- nxbench/benchmarks/benchmark.py | 12 +++++++----- nxbench/benchmarks/utils.py | 2 +- pyproject.toml | 19 +++++++++---------- 8 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index cf8e81c..f0ccc1f 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -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: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f7f510..32e891b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/.gitignore b/.gitignore index e8fd304..4b0fd06 100644 --- a/.gitignore +++ b/.gitignore @@ -192,4 +192,7 @@ downloaded_pdfs/ results/* # html -html/* \ No newline at end of file +html/* + +# envs +env/* diff --git a/README.md b/README.md index 5851156..343ee93 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/asv.conf.json b/asv.conf.json index 8cbf036..786e883 100644 --- a/asv.conf.json +++ b/asv.conf.json @@ -7,7 +7,7 @@ "branches": [ "main" ], - "environment_type": "virtualenv", + "environment_type": "existing", "show_commit_url": "https://github.com/dpys/nxbench/commit/", "pythons": [ "3.11" @@ -24,7 +24,7 @@ "2024.2.0" ] }, - "env": { + "env_nobuild": { "NUM_THREAD": [ "1", "4", @@ -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}" diff --git a/nxbench/benchmarks/benchmark.py b/nxbench/benchmarks/benchmark.py index bc90f71..01ded0e 100644 --- a/nxbench/benchmarks/benchmark.py +++ b/nxbench/benchmarks/benchmark.py @@ -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"]) ] @@ -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: @@ -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 diff --git a/nxbench/benchmarks/utils.py b/nxbench/benchmarks/utils.py index a92075f..9d8185c 100644 --- a/nxbench/benchmarks/utils.py +++ b/nxbench/benchmarks/utils.py @@ -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"], }, } diff --git a/pyproject.toml b/pyproject.toml index c0894b0..5d7b57d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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', @@ -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'