Commit e79e07c8 authored by Renato Caminha Juaçaba Neto's avatar Renato Caminha Juaçaba Neto 🙂
Browse files

scripts

parent c2baa9c2
......@@ -8,7 +8,7 @@ configure:
./waf configure --disable-python --enable-module ndnSIM
configure_cluster:
./waf configure --disable-python --enable-module ndnSIM --boost-includes=${BOOSTROOT}/include --boost-libs=${BOOSTROOT}/lib --check-c-compile=clang --check-cxx-compiler=clang++ --boost-toolset=clang --enable-rpath --with-sqlite3=${HOME}/sqlite
./waf configure --build-profile optimized --disable-python --enable-module ndnSIM --boost-includes=${BOOSTROOT}/include --boost-libs=${BOOSTROOT}/lib --check-c-compile=clang --check-cxx-compiler=clang++ --boost-toolset=clang --enable-rpath --with-sqlite3=${HOME}/sqlite
build:
./waf build
......
......@@ -16,4 +16,4 @@ NAME="dsubs.$SLURM_JOB_ID"
[[ -v SLURM_ARRAY_JOB_ID ]] && NAME="$NAME.aid$SLURM_ARRAY_JOB_ID"
[[ -v SLURM_RESTART_COUNT ]] && NAME=$NAME.r$SLURM_RESTART_COUNT
python3 scripts/run_multiple.py --nruns=$NRUNS $NAME random-domain-streams --appScenario=DirectSubscriptions --nConsumers='250 325 400'
python3 scripts/run_multiple.py --nruns=$NRUNS $NAME random-domain-streams --appScenario=DirectSubscriptions --nConsumers='400'
......@@ -16,4 +16,4 @@ NAME="dsubs.$SLURM_JOB_ID"
[[ -v SLURM_ARRAY_JOB_ID ]] && NAME="$NAME.aid$SLURM_ARRAY_JOB_ID"
[[ -v SLURM_RESTART_COUNT ]] && NAME=$NAME.r$SLURM_RESTART_COUNT
python3 scripts/run_multiple.py --nruns=$NRUNS $NAME random-domain-streams --appScenario=DirectSubscriptions --nConsumers='400'
python3 scripts/run_multiple.py --nruns=$NRUNS $NAME random-domain-streams --appScenario=DirectSubscriptions --nConsumers='475'
#!/bin/bash
#SBATCH -N 1 --exclusive
#SBATCH -D /b/home/icube/rcaminha/nas-ndnsim
#SBATCH -o dsubsV5.%j.out
#SBATCH -e dsubsV5.%j.err
#SBATCH -J dsubsV5
if [ -z "$1" ]; then
NRUNS=5
else
NRUNS="$1"
fi
NAME="dsubs.$SLURM_JOB_ID"
[[ -v SLURM_ARRAY_JOB_ID ]] && NAME="$NAME.aid$SLURM_ARRAY_JOB_ID"
[[ -v SLURM_RESTART_COUNT ]] && NAME=$NAME.r$SLURM_RESTART_COUNT
python3 scripts/run_multiple.py --nruns=$NRUNS $NAME random-domain-streams --appScenario=DirectSubscriptions --nConsumers='550'
......@@ -2,9 +2,9 @@
#SBATCH -N 1 --exclusive
#SBATCH -D /b/home/icube/rcaminha/nas-ndnsim
#SBATCH -o dsubs.%j.out
#SBATCH -e dsubs.%j.err
#SBATCH -J dsubs
#SBATCH -o dsubsV1.%j.out
#SBATCH -e dsubsV1.%j.err
#SBATCH -J dsubsV1
if [ -z "$1" ]; then
NRUNS=5
......@@ -16,4 +16,4 @@ NAME="dsubs.$SLURM_JOB_ID"
[[ -v SLURM_ARRAY_JOB_ID ]] && NAME="$NAME.aid$SLURM_ARRAY_JOB_ID"
[[ -v SLURM_RESTART_COUNT ]] && NAME=$NAME.r$SLURM_RESTART_COUNT
python3 scripts/run_multiple.py --nruns=$NRUNS $NAME random-domain-streams --appScenario=DirectSubscriptions --nConsumers='100 175 250 325 400'
python3 scripts/run_multiple.py --nruns=$NRUNS $NAME random-domain-streams --appScenario=DirectSubscriptions --nConsumers='100 175 250'
#!/bin/bash
#SBATCH -N 1 --exclusive
#SBATCH -D /b/home/icube/rcaminha/nas-ndnsim
#SBATCH -o dsubs_test.%j.out
#SBATCH -e dsubs_test.%j.err
#SBATCH -J dsubs_test
if [ -z "$1" ]; then
NRUNS=5
else
NRUNS="$1"
fi
NAME="dsubs.$SLURM_JOB_ID"
[[ -v SLURM_ARRAY_JOB_ID ]] && NAME="$NAME.aid$SLURM_ARRAY_JOB_ID"
[[ -v SLURM_RESTART_COUNT ]] && NAME=$NAME.r$SLURM_RESTART_COUNT
python3 scripts/run_multiple.py --nruns=$NRUNS $NAME random-domain-streams --appScenario=DirectSubscriptions --nConsumers='100 200 300' --nSystems=40 --nExtraEdges=20 --nMaxProducersPerSystem=10 --percSystemActivation=0.45 --randomTransformationCount=2 --randomTransformationParamCount=1
#!/bin/bash
#SBATCH -N 1 --exclusive
#SBATCH -D /b/home/icube/rcaminha/nas-ndnsim
#SBATCH -o rtrees_test.%j.out
#SBATCH -e rtrees_test.%j.err
#SBATCH -J rtrees_test
if [ -z "$1" ]; then
NRUNS=5
else
NRUNS="$1"
fi
NAME="rtrees.$SLURM_JOB_ID"
[[ -v SLURM_ARRAY_JOB_ID ]] && NAME="$NAME.aid$SLURM_ARRAY_JOB_ID"
[[ -v SLURM_RESTART_COUNT ]] && NAME=$NAME.r$SLURM_RESTART_COUNT
python3 scripts/run_multiple.py --nruns=$NRUNS $NAME random-domain-streams --appScenario=RandomTrees --nConsumers='100 200 300' --nSystems=40 --nExtraEdges=20 --nMaxProducersPerSystem=10 --percSystemActivation=0.45 --randomTransformationCount=2 --randomTransformationParamCount=1
<component name="ProjectDictionaryState">
<dictionary name="renatocjn">
<words>
<w>dataframes</w>
<w>dataset</w>
<w>datasets</w>
<w>sharex</w>
<w>sharey</w>
</words>
</dictionary>
</component>
\ No newline at end of file
This diff is collapsed.
......@@ -20,8 +20,8 @@ pd.set_option('display.width', 1000)
parser = argparse.ArgumentParser(description='This script plots data from simulations')
parser.add_argument('path', metavar='Experiment path', type=str,
help='Root folder to search for traces')
parser.add_argument('paths', metavar='Experiment path', type=str, nargs=argparse.REMAINDER,
help='Root folders to search for traces', default=['.'])
#
parser.add_argument('--log_to_file', action='store_true',
help="Output log messages to file")
......@@ -40,18 +40,23 @@ parser.add_argument('--cat-type', dest='catType', default="violin", type=str,
choices=["point", "bar", "strip", "swarm", "box", "violin", "boxen"])
params = parser.parse_args()
# pprint(params)
# exit(1)
if path.isdir(params.path):
chdir(params.path)
else:
print(params.path, "is not a directory", file=stderr)
exit(1)
logger = nas_utils.setup_logger("PlotMultipleRuns", params.loglevel, params.log_to_file)
sim_folders = glob('**/seed=*', recursive=True)
if len(params.paths) != 0:
if all(map(path.isdir, params.paths)) is not True:
print("One of the params is not a directory", file=stderr)
exit(1)
sim_folders = list()
for folder in params.paths:
sim_folders += glob(path.join(folder, '**', 'seed=*'), recursive=True)
else:
sim_folders = glob(path.join('.', '**', 'seed=*'), recursive=True)
def is_finished_sim_folder(f: str):
return path.isfile(path.join(f, 'consumer-metrics.trace'))
sim_folders = list(filter(is_finished_sim_folder, sim_folders))
logger.debug("Found %d simulation folders.", len(sim_folders))
logger.info("Gathering data from simulations...")
......@@ -70,7 +75,7 @@ def append_params_to_dataframe(params, *datasets):
statistics_dataframes_with_params = list(map(list, zip(*starmap(append_params_to_dataframe, statistics_dataframes))))
fullCsDF = pd.concat(statistics_dataframes_with_params[0], ignore_index=True)
fullStreamHitsDF = pd.concat(statistics_dataframes_with_params[1], ignore_index=True)
# fullStreamHitsDF = pd.concat(statistics_dataframes_with_params[1], ignore_index=True)
fullL3DF = pd.concat(statistics_dataframes_with_params[2], ignore_index=True)
fullConsumerStatsDF = pd.concat(statistics_dataframes_with_params[3], ignore_index=True)
......
......@@ -3,6 +3,7 @@ import pandas as pd
from os import path
import logging
import numpy as np
import seaborn as sb
def get_node_type(node_name):
client_name_pattern = r"^C\d+$"
......@@ -31,10 +32,12 @@ def get_node_type(node_name):
elif re.match(producer_name_pattern, node_name):
return "Producer"
else:
print (repr(node_name))
print(repr(node_name))
return "Unknown"
def read_statistics(dir_path = '', read_l3_dataset=True, read_cs_dataset=True, read_stream_hits_dataset=True, read_consumer_dataset=True):
def read_statistics(dir_path='', read_l3_dataset=True, read_cs_dataset=True, read_stream_hits_dataset=True,
read_consumer_dataset=True, read_delay_metrics=True):
logger = logging.getLogger('ReadStatistics')
logger.info("Starting")
......@@ -48,7 +51,7 @@ def read_statistics(dir_path = '', read_l3_dataset=True, read_cs_dataset=True, r
### Cache metrics
if read_cs_dataset and path.isfile(path.join(dir_path, "cs-trace.trace")):
logger.info("Reading content store metrics")
cs_dataset = pd.read_csv(path.join(dir_path, "cs-trace.trace"), sep='\s+')
cs_dataset = pd.read_csv(path.join(dir_path, "cs-trace.trace"), sep="\s+")
# cs_dataset['Type'] = cs_dataset.loc[:, 'Type'].astype('category')
cs_dataset['NodeType'] = pd.Series(map(get_node_type, cs_dataset['Node']), dtype='category')
......@@ -67,7 +70,8 @@ def read_statistics(dir_path = '', read_l3_dataset=True, read_cs_dataset=True, r
stream_hits_dataset = pd.read_csv(path.join(dir_path, "stream-hits.trace"), sep='\s+')
if (stream_hits_dataset.size != 0):
# stream_hits_dataset['Type'] = stream_hits_dataset['Type'].astype('category')
stream_hits_dataset['NodeType'] = pd.Series(map(get_node_type, stream_hits_dataset['Node']), dtype='category')
stream_hits_dataset['NodeType'] = pd.Series(map(get_node_type, stream_hits_dataset['Node']),
dtype='category')
else:
stream_hits_dataset = None
else:
......@@ -76,7 +80,7 @@ def read_statistics(dir_path = '', read_l3_dataset=True, read_cs_dataset=True, r
### L3 metrics
if read_l3_dataset and path.isfile(path.join(dir_path, "l3-rate-trace.trace")):
logger.info("Reading L3 metrics")
l3_dataset = pd.read_csv(path.join(dir_path, "l3-rate-trace.trace"), sep='\s+')
l3_dataset = pd.read_csv(path.join(dir_path, "l3-rate-trace.trace"), sep="\s+")
# l3_dataset['Type'] = l3_dataset['Type'].astype('category')
l3_dataset['NodeType'] = pd.Series(map(get_node_type, l3_dataset['Node']), dtype='category')
l3_dataset['Megabytes'] = l3_dataset['Kilobytes'].divide(1000)
......@@ -87,16 +91,91 @@ def read_statistics(dir_path = '', read_l3_dataset=True, read_cs_dataset=True, r
### Consumer metrics
if read_consumer_dataset and path.isfile(path.join(dir_path, "consumer-metrics.trace")):
logger.info("Reading consumer metrics")
consumer_dataset = pd.read_csv(path.join(dir_path, "consumer-metrics.trace"), sep='\s+')
consumer_dataset = pd.read_csv(path.join(dir_path, "consumer-metrics.trace"), sep="\s+")
# l3_dataset['Type'] = l3_dataset['Type'].astype('category')
consumer_dataset['NodeType'] = pd.Series(map(get_node_type, consumer_dataset['Node']), dtype='category')
else:
consumer_dataset = None
### Delay metrics
if read_delay_metrics and path.isfile(path.join(dir_path, "stream-delays.trace")):
logger.info("Reading stream delays")
stream_delays = pd.read_csv(path.join(dir_path, "stream-delays.trace"), sep="\s+")
# l3_dataset['Type'] = l3_dataset['Type'].astype('category')
stream_delays['NodeType'] = pd.Series(map(get_node_type, consumer_dataset['Node']), dtype='category')
else:
stream_delays = None
logger.info("Finished reading statistics")
return sim_parameters, cs_dataset, stream_hits_dataset, l3_dataset, consumer_dataset
return sim_parameters, cs_dataset, stream_hits_dataset, l3_dataset, consumer_dataset, stream_delays
def get_iqr_outliers(series):
q1, q3 = np.quantile(series, [.25, .75])
iqr = q3 - q1
return (series < q1 - iqr*1.5) | (series > q3 + iqr*1.5)
\ No newline at end of file
return (series < q1 - iqr * 1.5) | (series > q3 + iqr * 1.5)
filled_markers = ('o', 'd', '^', 'v', 's', '<', '>', '*', '8', 'p', 'h', 'H', 'D', 'P', 'X')
sizingParams = {
'height': 5,
'aspect': 1,
}
wideSizingParams = {
**sizingParams,
'aspect': 2,
}
lineParams = {
'markers': filled_markers,
'dashes': False,
'err_style': "bars",
'ci': 99
}
top_space = {'single': .85, 'duo': .9}
bottom_space = {'single': .275, 'duo': .15}
def fs_friendly_title(title: str):
return title.strip().lower().replace(" ", "-")
def duo_line_plot(xlabel, ylabel, title=None, single_pdf=None, **plot_params):
graph = sb.relplot(**plot_params, **sizingParams, **lineParams)
graph.set_xlabels(xlabel)
graph.set_ylabels(ylabel)
lines, texts = graph.axes[0, 0].get_legend_handles_labels()
graph._legend.remove()
if single_pdf is not None:
graph.fig.suptitle(title)
graph.fig.legend(handles=lines[1:], labels=texts[1:], loc='lower center', ncol=3)
graph.fig.tight_layout()
graph.fig.subplots_adjust(bottom=bottom_space['duo'])
graph.fig.subplots_adjust(top=top_space['duo'])
single_pdf.savefig(graph.fig)
else:
graph.fig.legend(handles=lines[1:], labels=texts[1:], loc='upper center', ncol=3)
graph.fig.tight_layout()
graph.fig.subplots_adjust(top=top_space['duo'])
graph.fig.savefig(fs_friendly_title(title)+'-line.pdf')
def duo_violin_plot(xlabel, ylabel, title=None, single_pdf=None, **plot_params):
graph = sb.catplot(**plot_params, **wideSizingParams)
graph.set_xlabels(xlabel)
graph.set_ylabels(ylabel)
graph._legend.remove()
if single_pdf is not None:
graph.fig.suptitle(title)
graph.axes[1, 0].legend(loc='lower center', ncol=3, bbox_to_anchor=(0.45, -0.35))
graph.fig.tight_layout()
graph.fig.subplots_adjust(bottom=bottom_space['duo'])
graph.fig.subplots_adjust(top=top_space['duo'])
single_pdf.savefig(graph.fig)
else:
graph.axes[0, 0].legend(loc='upper center', ncol=3, bbox_to_anchor=(0.45, 0.95))
graph.fig.tight_layout()
graph.fig.subplots_adjust(top=top_space['duo'])
graph.fig.savefig('content-store-by-device-type-violin.pdf')
\ No newline at end of file
Supports Markdown
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