Commit c11a22f3 authored by Julien Jerphanion's avatar Julien Jerphanion

Simplify benchmark analysis

parent 4254a348
SHELL = /bin/bash SHELL = /bin/bash
PROJECT = cython+ PROJECT = kdtree
VENV_PATH=`conda info --base`/envs/${PROJECT} VENV_PATH=`conda info --base`/envs/${PROJECT}
PIP_EXECUTABLE=${VENV_PATH}/bin/pip PIP_EXECUTABLE=${VENV_PATH}/bin/pip
......
This diff is collapsed.
...@@ -35,7 +35,7 @@ def benchmark(config, results_folder, bench_name): ...@@ -35,7 +35,7 @@ def benchmark(config, results_folder, bench_name):
one_GiB = 1e9 one_GiB = 1e9
benchmarks = pd.DataFrame() benchmarks = pd.DataFrame()
n_threads = _openmp_effective_n_threads() n_threads = int(_openmp_effective_n_threads())
env_specs_file = f"{results_folder}/{bench_name}.json" env_specs_file = f"{results_folder}/{bench_name}.json"
...@@ -112,21 +112,21 @@ def benchmark(config, results_folder, bench_name): ...@@ -112,21 +112,21 @@ def benchmark(config, results_folder, bench_name):
benchmarks = benchmarks.append(row, ignore_index=True) benchmarks = benchmarks.append(row, ignore_index=True)
pprint(row) pprint(row)
print("---") print("---")
benchmarks.to_csv( benchmarks.to_csv(
f"{results_folder}/{bench_name}.csv", f"{results_folder}/{bench_name}.csv",
mode="w+", mode="w+",
index=False, index=False,
) )
for k in n_neighbors: for k in n_neighbors:
t0_ = time.perf_counter() t0_ = time.perf_counter()
sk_tree.query(X_test, k=k, return_distance=False) sk_tree.query(X_test, k=k, return_distance=False)
t1_ = time.perf_counter() t1_ = time.perf_counter()
time_elapsed = round(t1_ - t0_, 5) time_elapsed = round(t1_ - t0_, 5)
row = dict( row = dict(
trial=trial, trial=trial,
func="query", func="query",
...@@ -143,8 +143,8 @@ def benchmark(config, results_folder, bench_name): ...@@ -143,8 +143,8 @@ def benchmark(config, results_folder, bench_name):
benchmarks = benchmarks.append(row, ignore_index=True) benchmarks = benchmarks.append(row, ignore_index=True)
pprint(row) pprint(row)
print("---") print("---")
closests = np.zeros((ns_test, k), dtype=np.int32) closests = np.zeros((ns_test, k), dtype=np.int32)
t0_ = time.perf_counter() t0_ = time.perf_counter()
tree.query(X_test, closests) tree.query(X_test, closests)
t1_ = time.perf_counter() t1_ = time.perf_counter()
...@@ -165,7 +165,7 @@ def benchmark(config, results_folder, bench_name): ...@@ -165,7 +165,7 @@ def benchmark(config, results_folder, bench_name):
benchmarks = benchmarks.append(row, ignore_index=True) benchmarks = benchmarks.append(row, ignore_index=True)
pprint(row) pprint(row)
print("---") print("---")
benchmarks.to_csv( benchmarks.to_csv(
f"{results_folder}/{bench_name}.csv", f"{results_folder}/{bench_name}.csv",
...@@ -173,7 +173,7 @@ def benchmark(config, results_folder, bench_name): ...@@ -173,7 +173,7 @@ def benchmark(config, results_folder, bench_name):
index=False, index=False,
) )
# Overriding again now that all the dyn. lib. have been loaded # Overriding again now that all the dyn. lib. have been loaded
env_specs["threadpool_info"] = threadpoolctl.threadpool_info() env_specs["threadpool_info"] = threadpoolctl.threadpool_info()
...@@ -198,4 +198,4 @@ if __name__ == "__main__": ...@@ -198,4 +198,4 @@ if __name__ == "__main__":
print(f"Benchmarking {bench_name}") print(f"Benchmarking {bench_name}")
benchmark(config, results_folder, bench_name) benchmark(config, results_folder, bench_name)
print(f"Benchmark results wrote in {results_folder}") print(f"Benchmark results wrote in {results_folder}")
\ No newline at end of file
...@@ -77,4 +77,6 @@ if __name__ == "__main__": ...@@ -77,4 +77,6 @@ if __name__ == "__main__":
% vals % vals
) )
_ = fig.suptitle(title, fontsize=16) _ = fig.suptitle(title, fontsize=16)
plt.savefig(f"{commit_result_folder}/{i}.pdf", bbox_inches="tight") fig_file = f"{commit_result_folder}/{i}.pdf"
plt.savefig(fig_file, bbox_inches="tight")
print(f"{fig_file} written.")
name: cython+ name: kdtree
channels: channels:
- conda-forge - conda-forge
dependencies: dependencies:
...@@ -15,6 +15,7 @@ dependencies: ...@@ -15,6 +15,7 @@ dependencies:
- pytest - pytest
- scikit-learn - scikit-learn
- memory_profiler - memory_profiler
- pip
- pip: - pip:
# Install cython+ from upstream directly # Install cython+ from upstream directly
- -e git+https://lab.nexedi.com/nexedi/cython.git@b30eafec6a7b174afdc4f023b45b21f85104e2fe#egg=Cython - -e git+https://lab.nexedi.com/nexedi/cython.git@b30eafec6a7b174afdc4f023b45b21f85104e2fe#egg=Cython
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment