Added requirements file, added batch benchmarking script, added README, added ability to set number of processes to use
parent
e62be8f201
commit
09a9d6b221
@ -0,0 +1,51 @@ |
||||
# pyCTBN - Benchmarks |
||||
|
||||
This benchmark is tailored to work with the "modernized" and polished version |
||||
of `pyCTBN`. |
||||
|
||||
## Preparation |
||||
|
||||
To clone with all submodules: |
||||
|
||||
```sh |
||||
git clone --recursive git@git-service.tld:user/repo.git |
||||
``` |
||||
|
||||
If you cloned without `--recursive`, you probably want to initialize the |
||||
submodules: |
||||
|
||||
```sh |
||||
git submodule update --init --recursive |
||||
``` |
||||
|
||||
Create a virtual environment: |
||||
|
||||
```sh |
||||
python3 -m venv .venv && source .venv/bin/activate |
||||
``` |
||||
|
||||
Install the dependencies: |
||||
|
||||
```sh |
||||
pip3 install -r requirements.txt |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
Create a `networks.d` directory in this project workspace. |
||||
|
||||
Move the `json` files of the networks in the just created `networks.d` |
||||
directory. |
||||
|
||||
Execute the shell script `./run.sh` to run the tests contained in the |
||||
`networks.d` directory: |
||||
|
||||
```sh |
||||
./run.sh |
||||
``` |
||||
|
||||
To learn to use directly the benchmark program: |
||||
|
||||
```sh |
||||
./benchmark.py --help |
||||
``` |
@ -0,0 +1,2 @@ |
||||
./deps/PyCTBN |
||||
memory_profiler |
@ -0,0 +1,24 @@ |
||||
#!/bin/sh |
||||
|
||||
set -e |
||||
|
||||
_jobs=0 |
||||
|
||||
mkdir -p "./networks.d" |
||||
mkdir -p "./profiling" |
||||
|
||||
find "./networks.d/" ! -name "$(printf "*\n*")" -name '*.json' > bench_nets.tmp |
||||
|
||||
while IFS= read -r _file; do |
||||
printf "Benchmarking '%s' file...\n" "$_file" |
||||
mprof run \ |
||||
--output "profiling/mprofile_$(basename "$_file").dat" \ |
||||
--backend psutil_pss \ |
||||
--python \ |
||||
--include-children \ |
||||
./benchmark.py \ |
||||
-j $_jobs \ |
||||
"$_file" |
||||
printf "Benchmark '%s' file completed.\n" "$_file" |
||||
done < bench_nets.tmp |
||||
rm bench_nets.tmp |
Loading…
Reference in new issue