Add datasize scalability results

This commit is contained in:
Loïc Guégan 2024-06-29 14:27:13 +02:00
parent 7bc73b807f
commit 072ce4f48f
24 changed files with 457985 additions and 10 deletions

2
.Rhistory Normal file
View file

@ -0,0 +1,2 @@
q()
n

4
.gitignore vendored
View file

@ -1,6 +1,6 @@
simulator
libs/simgrid
libs/rapidjson
libs/simgrid*
libs/rapidjson*
compile_commands.json
platform.xml
./scenarios

View file

@ -7,7 +7,7 @@ CC := g++ $(addprefix -L , $(LIBS)) $(addprefix -I , $(INCLUDES))
all: $(EXEC) $(basename $(notdir $(SCENARIOS)))
$(EXEC): $(filter-out $(SCENARIOS), $(wildcard src/*))
$(CC) -lsimgrid $^ -o $@
$(CC) $^ -lsimgrid -o $@
$(basename $(notdir $(SCENARIOS))): $(SCENARIOS)
$(CC) $^ -o $@

View file

@ -2,8 +2,8 @@
set -e
[ ! -e "simgrid" ] && git clone https://framagit.org/simgrid/simgrid
[ ! -e "rapidjson"] && git clone https://github.com/Tencent/rapidjson
[ ! -e "simgrid" ] && wget https://data.loicguegan.com/Apps/SimGrid/simgrid-v3.27.tar.gz && tar -xvf simgrid-v3.27.tar.gz && ln -s simgrid-v3.27 simgrid # We use the SimGrid Ragnar Release
[ ! -e "rapidjson" ] && wget https://data.loicguegan.com/Apps/RapidJSON/rapidjson-commit_ab1842a-Aprl9.tar.gz && tar -xvf rapidjson-commit_ab1842a-Aprl9.tar.gz && ln -s rapidjson-commit_ab1842a-Aprl9 rapidjson
cd simgrid
mkdir -p build

4
results/.Rhistory Normal file
View file

@ -0,0 +1,4 @@
q()
n
q()
n

View file

@ -0,0 +1,68 @@
library("tidyverse")
library("gridExtra")
library("patchwork")
library("knitr")
library(RColorBrewer)
library(latex2exp)
r_=function(x){round(x,digits=2)}
color=function(){scale_fill_brewer(palette = "Accent")}
color2=function(){scale_fill_brewer(palette = "Set2")}
nolegend=function(){theme(legend.position="none")}
simkeys=unique(read_csv("results.csv")$simkey)
nsimkeys=length(simkeys)
s_=function(x){if(x<0){return("")}else{return("+")}}
simkey_rename=function(key){
if(key=="hint")
return("Hints")
if(key=="baseline")
return("Baseline")
if(key=="extended")
return("Extended")
if(key=="hintandextended")
return("Hints+\nExtended")
return(key)
}
dformat=function(data){
data%>%rowwise()%>%mutate(simkey=simkey_rename(simkey))%>%
mutate(wireless=ifelse(wireless=="lora","LoRa","Nb-IoT"))%>%mutate(facet=paste0("With ",wakeupfor,"s uptime using ",wireless))
}
data=read_csv("results_datasize.csv")
data=data%>%filter(isSender!=0)%>%group_by(wakeupfor,simkey,datasize,wireless)%>%summarize(success_mean=mean(nSend),success_sd=sd(nSend))
data=data%>%mutate(datasize=ifelse(datasize==1000,"1KB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==10000,"10KB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==100000,"100KB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==500000,"500KB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==1000000,"1MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==2000000,"2MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==10000000,"10MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==50000000,"50MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==100000000,"100MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==500000000,"500MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==1000000000,"1GB",as.character(datasize)))
data$datasize=factor(data$datasize,levels=c("1KB","10KB","100KB","500KB","1MB","2MB","10MB","50MB","100MB","500MB","1GB"))
data=data%>%dformat()
data$facet=factor(data$facet,levels=c("With 60s uptime using LoRa","With 60s uptime using Nb-IoT","With 180s uptime using LoRa","With 180s uptime using Nb-IoT"))
#ggplot(data,aes(x=datasize,y=success, color=simkey))+geom_point()
ggplot(data,aes(x=datasize,y=success_mean,color=simkey,group=simkey))+
geom_point()+geom_line()+facet_wrap(~facet)+
xlab("Data size")+ylab(TeX(r'(#Succ$_p$)'))+scale_fill_brewer(palette = "Set1")+scale_color_brewer(palette = "Set1")+
labs(color="Policy:")+labs(fill="Standard deviation:")+
geom_ribbon(aes(ymin=success_mean-success_sd, ymax=success_mean+success_sd,fill=simkey),linetype=0,alpha=0.2)+
guides(color=guide_legend(override.aes=list(fill=NA)))+theme_bw()+ theme(legend.position="top")
ggsave("datasize.pdf",width=12,height=6)
ggplot(data%>%filter(wakeupfor==180,wireless=="LoRa"),aes(x=datasize,y=success_mean,color=simkey,group=simkey))+
geom_point()+geom_line()+facet_wrap(~facet)+
xlab("Data size")+ylab(TeX(r'(#Succ$_p$)'))+scale_fill_brewer(palette = "Set1")+scale_color_brewer(palette = "Set1")+
labs(color="Policy:")+labs(fill="Standard deviation:")+
geom_ribbon(aes(ymin=success_mean-success_sd, ymax=success_mean+success_sd,fill=simkey),linetype=0,alpha=0.2)+
guides(color=guide_legend(override.aes=list(fill=NA)))+theme_bw()+ theme(legend.position="top")
ggsave("datasize_lora180.pdf",width=9.5,height=4)

View file

@ -0,0 +1,135 @@
library("tidyverse")
library("ggthemes")
library("gridExtra")
library("patchwork")
library(RColorBrewer)
data=read_csv("results_datasize.csv")
r_=function(x){round(x,digits=1)}
color=function(){scale_fill_brewer(palette = "Accent")}
color2=function(){scale_fill_brewer(palette = "Set2")}
nolegend=function(){theme(legend.position="none")}
simkeys=unique(data$simkey)
nsimkeys=length(simkeys)
s_=function(x){if(x<0){return("")}else{return("+")}}
simkey_rename=function(key){
if(key=="hint")
return("Hints")
if(key=="baseline")
return("Baseline")
if(key=="extended")
return("Extended")
if(key=="hintandextended")
return("Hints+Extended")
return(key)
}
dformat=function(data){
data%>%rowwise()%>%mutate(simkey=simkey_rename(simkey))%>%mutate(wireless=ifelse(wireless=="lora","LoRa","Nb-IoT"))
}
dsformat=function(data){
data=data%>%mutate(datasize=ifelse(datasize==1000,"1KB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==10000,"10KB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==100000,"100KB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==500000,"500KB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==1000000,"1MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==2000000,"2MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==10000000,"10MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==50000000,"50MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==100000000,"100MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==500000000,"500MB",as.character(datasize)))
data=data%>%mutate(datasize=ifelse(datasize==1000000000,"1GB",as.character(datasize)))
data$datasize=factor(data$datasize,levels=c("1KB","10KB","100KB","500KB","1MB","2MB","10MB","50MB","100MB","500MB","1GB"))
return(data)
}
g_legend <- function(a.gplot){
tmp <- ggplot_gtable(ggplot_build(a.gplot))
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
legend <- tmp$grobs[[leg]]
legend
}
custom_theme=function(){theme_clean()+ theme(plot.background=element_blank())}
data=data%>%dformat()
# Compute delivery success
statsSuccess=data%>%filter(isSender!=0)%>%group_by(wireless,wakeupfor,datasize,seed,simkey)%>%summarize(success=mean(nSend))%>%ungroup()
data=data%>%left_join(statsSuccess,by=c("wireless","wakeupfor","datasize","seed","simkey"))
# Computer stats senders
statsSender=data%>%filter(isSender!=0)%>%group_by(wireless,wakeupfor,datasize,seed,simkey)%>%summarize(success=mean(success),energy=mean(energy))%>%ungroup()
statsSender=statsSender%>%group_by(wireless,wakeupfor,datasize,simkey)%>%summarize(success_sd=sd(success),success=mean(success),energy_sd=sd(energy),energy=mean(energy))%>%ungroup()
# Computer stats receiver
statsReceiver=data%>%filter(isSender==0)%>%group_by(wireless,wakeupfor,datasize,seed,simkey)%>%summarize(success=mean(success),energy=mean(energy))%>%ungroup()
statsReceiver=statsReceiver%>%group_by(wireless,wakeupfor,datasize,simkey)%>%summarize(success_sd=sd(success),success=mean(success),energy_sd=sd(energy),energy=mean(energy))%>%ungroup()
# Energy
sender60sPlotEnergy=ggplot(statsSender%>%filter(wakeupfor==60)%>%dsformat(),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
sender180sPlotEnergy=ggplot(statsSender%>%filter(wakeupfor==180)%>%dsformat(),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Sender")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
receiver60sPlotEnergy=ggplot(statsReceiver%>%filter(wakeupfor==60)%>%dsformat(),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy") + custom_theme()+theme(legend.position="top")+ggtitle("Receiver")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
receiver180sPlotEnergy=ggplot(statsReceiver%>%filter(wakeupfor==180)%>%dsformat(),aes(datasize,energy,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=energy-energy_sd, ymax=energy+energy_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Data size")+ylab("Energy consumption (J)")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+ggtitle("Receiver")+
guides(colour=FALSE,fill=guide_legend(title="Policy"))
# Success
sender60sPlotSuccess=ggplot(statsSender%>%filter(wakeupfor==60)%>%dsformat(),aes(datasize,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Data size")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
sender180sPlotSuccess=ggplot(statsSender%>%filter(wakeupfor==180)%>%dsformat(),aes(datasize,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Data size")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
receiver60sPlotSuccess=ggplot(statsReceiver%>%filter(wakeupfor==60)%>%dsformat(),aes(datasize,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Data size")+ylab("Number of delivery success")+labs(colour="Policy") + custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
receiver180sPlotSuccess=ggplot(statsReceiver%>%filter(wakeupfor==180)%>%dsformat(),aes(datasize,success,color=simkey,group=simkey))+
geom_ribbon(aes(ymin=success-success_sd, ymax=success+success_sd,fill=simkey),linetype=1,alpha=0.4)+
geom_point()+geom_line()+
facet_wrap(~wireless)+xlab("Data size")+ylab("Number of delivery success")+labs(colour="Policy")+custom_theme()+theme(legend.position="top")+
theme(panel.background = element_rect(fill = '#EFEFEF', color=NA))+guides(colour=FALSE,fill=guide_legend(title="Policy"))
w1=10
h1=4
w2=15
h2=4
ggsave("scalability_datasize_60s_sender_energy.pdf",plot=sender60sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("scalability_datasize_60s_receiver_energy.pdf",plot=receiver60sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("scalability_datasize_60s_success.pdf",plot=sender60sPlotSuccess,width=w2,height=h2)
ggsave("scalability_datasize_180s_sender_energy.pdf",plot=sender180sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("scalability_datasize_180s_receiver_energy.pdf",plot=receiver180sPlotEnergy+guides(fill = FALSE, color = FALSE),width=w1,height=h1)
ggsave("scalability_datasize_180s_success.pdf",plot=sender180sPlotSuccess,width=w2,height=h2)

BIN
results/datasize.pdf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

140
results/paper_datasize.sh Executable file
View file

@ -0,0 +1,140 @@
#!/usr/bin/env bash
set -e
wai=$(dirname $(readlink -f "$0"))
scenarios="${wai}/../scenarios"
inputs="${wai}/../inputs.json"
simulator="make -C ${wai}/../ run"
sched="${wai}/scheduler/analysis.sh"
parser="${wai}/../parser.awk"
results="${wai}/results_datasize.csv"
aheaders="simkey,wireless,wakeupfor,n_nodes,datasize"
avalues="none,none,none,none"
log_file="${wai}/logs/$(date +%s).org" && mkdir -p "${wai}/logs/"
gen_log=0 # Should we generate logs ?
run-simulation () {
# Generate inputs
$scenarios $seed $simtime $wakeupevery $wakeupfor $n_nodes $extended $hint $poff $pon $prx $ptx $datasize $bitrate $hintsize $latency $shutdown_on_rcv $unschedule_on_rcv $farhint $hintdist > "$inputs"
# Init logs
[ $gen_log -eq 1 ] && echo -e "* seed=$seed simtime=$simtime wakeupevery=$wakeupevery wakeupfor=$wakeupfor n_nodes=$n_nodes extended=$extended hint=$hint poff=$poff pon=$pon prx=$prx ptx=$ptx datasize=$datasize bitrate=$bitrate \n" >> "${log_file}"
# Run simulations
tmp=$(mktemp)
$simulator &> $tmp
[ $gen_log -eq 1 ] && cp $tmp "${log_file}"
# Gen csv
[ ! -e "$results" ] && { cat $tmp | $parser | sed "1 s/$/,${aheaders}/g" | sed "2,\$s/$/,${avalues}/" > "$results"; }
[ -e "$results" ] && { cat $tmp | $parser | sed 1d | sed "s/$/,${avalues}/" >> "$results"; }
# Gen scheduler analysis
#[ $seed -eq 1 ] && $sched $tmp "logs/$(echo ${avalues}|tr ',' '_')_hint${hint}_extended${extended}.png"
# Clear tmp
rm $tmp
}
# Default Parameters
seed=0
simtime=86400 # One day
wakeupevery=3600
wakeupfor=60
n_nodes=13 # First node will be the sender so n_receivers=n_nodes-1
extended="false"
hint="false"
poff=0
pon=0.4
prx=0.16
ptx=0.16
datasize=1000000 # 1Mb
hintsize=8 # Integer
hintdist=10800 # Hint distance while using farhint
latency=0 # in Seconds
shutdown_on_rcv="false"
unschedule_on_rcv="false"
farhint="false"
bitrate="100kbps"
run-scenarios() {
# Configure number of seed per scenarios
nseed=200
# Baseline
avalues="baseline,$wireless,$wakeupfor,$n_nodes,$datasize"
for seed in $(seq 1 $nseed)
do
printf "\rBaseline...${seed}"
run-simulation
done
echo
# Hint
hint="true"
avalues="hint,$wireless,$wakeupfor,$n_nodes,$datasize"
for seed in $(seq 1 $nseed)
do
printf "\rHint...${seed}"
run-simulation
done
hint="false"
echo
# Extended
extended="true"
avalues="extended,$wireless,$wakeupfor,$n_nodes,$datasize"
for seed in $(seq 1 $nseed)
do
printf "\rExtended...${seed}"
run-simulation
done
extended="false"
echo
# Hint+Extended
extended="true"
hint="true"
avalues="hintandextended,$wireless,$wakeupfor,$n_nodes,$datasize"
for seed in $(seq 1 $nseed)
do
printf "\rHint + Extended...${seed}"
run-simulation
done
extended="false"
hint="false"
echo
}
# Clean previous runs
[ -e "${results}" ] && rm "${results}"
for wakeupfor in 60 180
do
# Datasize: 1KB 10KB 100KB 500KB 1MB 2MB 10MB 50MB 100MB 500MB 1GB
for datasize in 1000 10000 100000 500000 1000000 2000000 10000000 50000000 100000000 500000000 1000000000
do
# Lora
echo "----- Run Lora (wakeupfor=$wakeupfor datasize=$datasize) -----"
wireless="lora"
bitrate="50kbps"
pon=0.4
prx=0.16
ptx=0.16
latency=0
run-scenarios
# NbIot
echo "----- Run NbIoT (wakeupfor=$wakeupfor datasize=$datasize) -----"
wireless="nbiot"
bitrate="200kbps"
pon=0.4
prx=0.65
ptx=0.65
latency=0
run-scenarios
done
done

View file

@ -93,14 +93,26 @@ pareto = pareto %>% mutate(success = as.numeric(success))
pareto = pareto %>% arrange(energy,success)
pareto = pareto %>% dformat()
ggplot(stats%>%dformat(),aes(energy,success,color=simkey,shape=strategy))+
##### Policies
ggplot(stats%>%dformat(),aes(energy,success,color=simkey,shape=simkey))+
geom_line(data=pareto,aes(energy,success),linetype="dashed", size=1,inherit.aes=FALSE)+
geom_point(alpha=0.1,size=4)+
geom_point(size=4)+
geom_point(data=pareto,size=4)+scale_y_reverse()+
labs(color="Policies:",shape="Strategies:")+scale_color_brewer(palette = "Spectral")+theme_minimal()+theme(text=element_text(size=20), legend.position=c(.8,.75),legend.box.background = element_rect(color="black", size=1, fill="white"))+
labs(color="Policies:",shape="Policies:")+scale_color_brewer(palette = "Set1")+theme_minimal()+theme(text=element_text(size=20), legend.position=c(.8,.75),legend.box.background = element_rect(color="black", size=1, fill="white"))+scale_shape_manual(values = c(17,18,20,3,4))+
xlab("Sender energy consumption (J)")+ylab(TeX(r'(#Succ$_p$)'))
# +facet_wrap(~wakeupfor+wireless,scale="free")
ggsave("pareto.pdf",width=10,height=9)
ggsave("pareto_policies.pdf",width=10,height=9)
##### Strategies
ggplot(stats%>%dformat(),aes(energy,success,color=strategy,shape=strategy))+
geom_line(data=pareto,aes(energy,success),linetype="dashed", size=1,inherit.aes=FALSE)+
geom_point(size=4)+
geom_point(data=pareto,size=4)+scale_y_reverse()+
labs(color="Strategies:",shape="Strategies:")+scale_color_brewer(palette = "Dark2")+theme_minimal()+theme(text=element_text(size=20), legend.position=c(.8,.75),legend.box.background = element_rect(color="black", size=1, fill="white"))+scale_shape_manual(values = c(17,18,20,3,4))+
xlab("Sender energy consumption (J)")+ylab(TeX(r'(#Succ$_p$)'))
# +facet_wrap(~wakeupfor+wireless,scale="free")
ggsave("pareto_strategies.pdf",width=10,height=9)
message("Pareto infos:")
print(pareto%>%group_by(simkey)%>%summarize(count=n()))

Binary file not shown.

BIN
results/pareto_bak.pdf Normal file

Binary file not shown.

BIN
results/pareto_policies.pdf Normal file

Binary file not shown.

Binary file not shown.

457614
results/results_datasize.csv Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
scenarios

Binary file not shown.