Skip to content

Commit 475514e

Browse files
Refactoring the 'replicate-results' into a makefile
1 parent 7cdebb2 commit 475514e

File tree

6 files changed

+156
-55
lines changed

6 files changed

+156
-55
lines changed

bin/README.md

Whitespace-only changes.

bin/measure-scaling-performance.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# # # # #
4+
#
5+
# Function to call the requisite Haskell and Python binary/script (respectively)
6+
# which will generate the results data and figures presented in the paper.
7+
#
8+
# # # # #
9+
10+
function using()
11+
{
12+
./bin/generate-timings $5 \
13+
--data "data-sets/$1.afasta" \
14+
--tree "data-sets/$1.tree" \
15+
--tcm "data-sets/tcm-${2}.tcm" \
16+
--output "$1-$2" \
17+
-n "$3" \
18+
-k "$4"
19+
20+
python3 ./bin/plot-figure.py \
21+
"replicate-results/csv/${1}-${2}.preorder.csv" \
22+
"replicate-results/img/${1}-preorder.eps"
23+
24+
python3 ./bin/plot-figure.py \
25+
"replicate-results/csv/${1}-${2}.postorder.csv" \
26+
"replicate-results/img/${1}-postorder.eps"
27+
}
28+
29+
"$@"

plot-figure.py renamed to bin/plot-figure.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/python3
2+
13
from mpl_toolkits import mplot3d
24
import math
35
import matplotlib.pyplot as plt

cabal.project

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
allow-newer:
2-
base,
3-
Cabal,
4-
ghc-prim,
5-
template-haskell
1+
installdir: ./bin
2+
3+
install-method: copy
64

75
packages: .
86

97
with-compiler: ghc-9.2.1
8+

makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# # # # #
2+
#
3+
# Script to reproduce the results of the paper from a clean environment.
4+
# Installs all required dependencies. Builds the required binaries.
5+
# Run the experimental algorithm on datasets to generate the empirical results.
6+
#
7+
# # # # #
8+
9+
bin-dir := ./bin
10+
data-dir := replicate-results
11+
executable := $(bin-dir)/generate-timings
12+
generate := $(bin-dir)/measure-scaling-performance.sh using
13+
biological-scale := [1%1,1%2,1%4,1%8,1%16,1%32]
14+
customized-scale := [1%1,1%2,1%4,1%8,1%16,1%32,1%64]
15+
customized-nodes := [4,8,16,32,64,128,256]
16+
17+
18+
# All synonyms for replicating the paper's results.
19+
all: results
20+
21+
replicate: results
22+
23+
reproduce: results
24+
25+
results: fungi metazoa pathological
26+
27+
28+
# Install dependencies required to replicate results:
29+
ensure-Haskell: $(bin-dir)/generate-timings
30+
@command -v ghcup &> /dev/null || curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
31+
32+
ensure-Python:
33+
@command -v python3 &> /dev/null || apt-get install python3 --yes
34+
@command -v pip3 &> /dev/null || apt-get install python3-pip --yes
35+
@pip3 show matplotlib &> /dev/null || pip3 install --upgrade matplotlib
36+
37+
ensure-R:
38+
command -v &> /dev/null || sudo apt install r-base
39+
40+
compile-binaries: ensure-Haskell
41+
@echo "Copiling binaries"
42+
@ghcup run \
43+
--ghc 9.2.1 \
44+
--cabal 3.6.2.0 \
45+
-- cabal update && \
46+
cabal install \
47+
--installdir=$(bin-dir) \
48+
--install-method=copy
49+
50+
ensure-workspace:
51+
@mkdir -p $(data-dir)/csv
52+
@mkdir -p $(data-dir)/data
53+
@mkdir -p $(data-dir)/img
54+
@mkdir -p $(data-dir)/taxa
55+
@mkdir -p $(data-dir)/tree
56+
57+
fungi: compile-binaries ensure-Python ensure-R ensure-workspace
58+
$(generate) \
59+
'fungi' '11' '[25,50,100,200,400,800,1553]' $(biological-scale)
60+
61+
metazoa: compile-binaries ensure-Python ensure-R ensure-workspace
62+
$(generate) \
63+
'metazoa' '11' '[25,50,100,200,400,800,1766]' $(biological-scale)
64+
65+
pathological: compile-binaries ensure-Python ensure-R ensure-workspace
66+
$(generate) \
67+
'pathological' '12' $(customized-nodes) $(customized-scale)
68+
$(generate) \
69+
'pathological' '31' $(customized-nodes) $(customized-scale) '--no-generate'

replicate-results.sh

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,67 @@
11
#!/bin/bash
2-
#Script to run implied alingment data sets
32

4-
#load Haskell dependencies
5-
which stack || curl -sSL https://get.haskellstack.org/ | sh
63

7-
#load Python3 dependencies
8-
which python3 || apt-get install python3 --yes
9-
which pip3 || apt-get install python3-pip --yes
10-
pip3 show matplotlib || pip3 install --upgrade matplotlib
4+
# # # # #
5+
#
6+
# Script to reproduce the results of the paper from a clean environment.
7+
# Installs all required dependencies. Builds the required binaries.
8+
# Run the experimental algorithm on datasets to generate the empirical results.
9+
#
10+
# # # # #
1111

12-
#load R dependencies
13-
which R || sudo apt install r-base
1412

15-
#build binaries
16-
stack install
13+
# Install dependencies required to replicate results:
14+
# * Load Python3 dependencies
15+
which python3 &> /dev/null || apt-get install python3 --yes
16+
which pip3 &> /dev/null || apt-get install python3-pip --yes
17+
pip3 show matplotlib &> /dev/null || pip3 install --upgrade matplotlib
1718

18-
#ensure target directories exist
19+
# * Load R dependencies
20+
which R &> /dev/null || sudo apt install r-base
21+
22+
# * Load Haskell dependencies
23+
which ghcup &> /dev/null || curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
24+
25+
26+
# Build binaries
27+
ghcup run \
28+
--ghc 9.2.1 \
29+
--cabal 3.6.2.0 \
30+
-- cabal update && \
31+
cabal install \
32+
--installdir=./bin \
33+
--install-method=copy
34+
35+
36+
# Ensure output directories exist to place results data
1937
mkdir -p replicate-results/csv
2038
mkdir -p replicate-results/data
2139
mkdir -p replicate-results/img
2240
mkdir -p replicate-results/taxa
2341
mkdir -p replicate-results/tree
2442

25-
#run data sets
26-
./bin/generate-timings \
27-
--data data-sets/fungi.afasta \
28-
--tree data-sets/fungi.tree \
29-
--tcm data-sets/tcm-11.tcm \
30-
--output fungi-11 \
31-
-n [25,50,100,200,400,800,1553] \
32-
-k [1%1,1%2,1%4,1%8,1%16,1%32]
33-
python3 plot-figure.py replicate-results/csv/fungi-11.preorder.csv replicate-results/img/fungi-preorder.eps
34-
python3 plot-figure.py replicate-results/csv/fungi-11.postorder.csv replicate-results/img/fungi-postorder.eps
3543

36-
./bin/generate-timings \
37-
--data data-sets/metazoa.afasta \
38-
--tree data-sets/metazoa.tree \
39-
--tcm data-sets/tcm-11.tcm \
40-
--output metazoa-11 \
41-
-n [25,50,100,200,400,800,1766] \
42-
-k [1%1,1%2,1%4,1%8,1%16,1%32]
43-
python3 plot-figure.py replicate-results/csv/metazoa-11.preorder.csv replicate-results/img/metazoa-preorder.eps
44-
python3 plot-figure.py replicate-results/csv/metazoa-11.postorder.csv replicate-results/img/metazoa-postorder.eps
44+
# Run data sets to produce the results data
45+
function generate()
46+
{
47+
./bin/generate-timings $5 \
48+
--data "data-sets/$1.afasta" \
49+
--tree "data-sets/$1.tree" \
50+
--tcm "data-sets/tcm-${2}.tcm" \
51+
--output "$1-$2" \
52+
-n "$3" \
53+
-k "$4"
54+
55+
python3 plot-figure.py \
56+
"replicate-results/csv/${1}-${2}.preorder.csv" \
57+
"replicate-results/img/${1}-preorder.eps"
4558

46-
./bin/generate-timings \
47-
--data data-sets/pathological.afasta \
48-
--tree data-sets/pathological.tree \
49-
--tcm data-sets/tcm-12.tcm \
50-
--output pathological-12 \
51-
-n [4,8,16,32,64,128,256] \
52-
-k [1%1,1%2,1%4,1%8,1%16,1%32,1%64]
53-
python3 plot-figure.py replicate-results/csv/pathological-12.preorder.csv replicate-results/img/pathological-12-preorder.eps
54-
python3 plot-figure.py replicate-results/csv/pathological-12.postorder.csv replicate-results/img/pathological-12-postorder.eps
59+
python3 plot-figure.py \
60+
"replicate-results/csv/${1}-${2}.postorder.csv" \
61+
"replicate-results/img/${1}-postorder.eps"
62+
}
5563

56-
./bin/generate-timings \
57-
--no-generate \
58-
--data data-sets/pathological.afasta \
59-
--tree data-sets/pathological.tree \
60-
--tcm data-sets/tcm-31.tcm \
61-
--output pathological-31 \
62-
-n [4,8,16,32,64,128,256] \
63-
-k [1%1,1%2,1%4,1%8,1%16,1%32,1%64]
64-
python3 plot-figure.py replicate-results/csv/pathological-31.preorder.csv replicate-results/img/pathological-31-preorder.eps
65-
python3 plot-figure.py replicate-results/csv/pathological-31.postorder.csv replicate-results/img/pathological-31-postorder.eps
64+
generate 'fungi' '11' '[25,50,100,200,400,800,1553]' '[1%1,1%2,1%4,1%8,1%16,1%32]'
65+
generate 'metazoa' '11' '[25,50,100,200,400,800,1766]' '[1%1,1%2,1%4,1%8,1%16,1%32]'
66+
generate 'pathological' '12' '[4,8,16,32,64,128,256]' '[1%1,1%2,1%4,1%8,1%16,1%32,1%64]'
67+
generate 'pathological' '31' '[4,8,16,32,64,128,256]' '[1%1,1%2,1%4,1%8,1%16,1%32,1%64]' '--no-generate'

0 commit comments

Comments
 (0)