diff --git a/disksim/64bit-ssd-patch-files/modified-source-files/run_pfs.sh b/disksim/64bit-ssd-patch-files/modified-source-files/run_pfs.sh old mode 100755 new mode 100644 diff --git a/doc/Class_Diagram.pdf b/doc/Class_Diagram.pdf new file mode 100644 index 0000000..5e1eff5 Binary files /dev/null and b/doc/Class_Diagram.pdf differ diff --git a/doc/Diagram_Class_layers.dia b/doc/Diagram_Class_layers.dia new file mode 100644 index 0000000..16c106a Binary files /dev/null and b/doc/Diagram_Class_layers.dia differ diff --git a/omnetpp/Scripts/Grid5000/README b/omnetpp/Scripts/Grid5000/README new file mode 100644 index 0000000..d88b2a2 --- /dev/null +++ b/omnetpp/Scripts/Grid5000/README @@ -0,0 +1,123 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# + +#### launch benchmark tests #### + +The goal of this script is to launch successively different tests with IOR and stock the results in a file per iteration + +Firstly you have to verify the path of the two executables: +MPI_EXEC= +IOR_EXEC= + +There are some defaults options for MPICH and IOR +MPI_OPTIONS_D= +IOR_OPTIONS_D= + +In a terminal: launch_benchmark_tests -h to see the existing tests + +Give in argument the list of the tests : launch_benchmark_tests 5 8 7 4 +This example will execute the 5th tests and then the 8th etc + +To execute all without give the list: launch_benchmark_tests -a + +You can change the name of the result files and the path where they will be save +PATH_TO_RESULT= +PREFIX= +SUFFIX= +The file will have this form: +${PATH_TO_RESULT}${PREFIX}${ID}-${SID}${SUFFIX} + +ID identifies the test. +SID is the number of the iteration. +One file per iteration per test. + +Each simulation can be iterate Nth times (default N=5): +ITERATION= + +Define the number of servers for your tests: +NUM_SERVER= + +Add a simulation: +A simply way to add your own test is the following + +-Add an entry in the switch with an integer (the ID of the test) +-Put launchSimulation "[NAME OF YOUR TEST]" "[OPTIONS FOR MPICH]" "[OPTIONS FOR IOR]" +-Add to the help entry the number and a quick description of your test +-Add at the end of the switch in "-a" option the same line as in step two in order to launch it when you want all tests one after the other. + +----------------------------------------------------------------------------------------------------------------------------- + +#### get_time_value.py #### + +Python script to fetch the result previously generated. +It is formated to work only with a result of IOR. +It calculates the average of N iterations and put the result in the same csv file as the csv file generated for the simulations with PFSSim + +In a terminal: python get_time_value.py + +You must change this following variables if you changed PREFIX and SUFFIX: +prefix= +suffix= +CAUTION: If you change prefix for the simulations you have to change the code in this script to save the results of tests in same csv file + +Be sure that variable is the path where the CSV file of PFSSim simulations are stocked: +pathToResults= + +----------------------------------------------------------------------------------------------------------------------------- + +#### Define cluster PVFS #### + +PVFS2 and its Kernel module have to be installed correctly before launching this script +The mounted point : /mnt/pvfs2 must be created before +It uses the file OAR_NODE_FILE (list of nodes allocated) to choose clients and servers +OAR_NODE_FILE has to be in the PATH variable environment to find the list +Two arguments (in this order): $NUM_CLIENTS $NUM_SERVERS(MetaServer include) + +It creates two files : mpd.hosts (list of client nodes) + server.hosts (list of server nodes) + +CAUTION: $NUM_CLIENTS + $NUM_SERVERS have to be inferior or equal to total number of nodes + : Some configurations could not work if the sum of the three biggest clusters is strictly lower than $NUM_CLIENTS + : Work only with GRAPHENE cluster + +This script launches the other scripts to configure pvfs2: +pvfs2-genconfig /etc/pvfs2-fs.conf +launch_servers_pvfs2.sh +launch_client_pvfs2.sh +mount_pvfs2_server.sh + +----------------------------------------------------------------------------------------------------------------------------- + +#### Launch Servers PVFS2 #### + +It uses pvfs2-fs.conf and server.hosts to launch servers by ssh +It configures fstab file +Argument: $NUM_SERVERS + +----------------------------------------------------------------------------------------------------------------------------- + +#### Launch Clients PVFS2 #### + +It uses fstab and mpd.hosts to launch clients by ssh +Be sure that PATH_EXEC_CLIENT is correct to find the executable of PVFS2 client + +----------------------------------------------------------------------------------------------------------------------------- + +#### Mount PVFS2 Server #### + +It uses mpd.hosts and server.hosts to mount on each client PVFS2 file system +Argument: $NUM_SERVERS diff --git a/omnetpp/Scripts/Grid5000/define_cluster_pvfs.sh b/omnetpp/Scripts/Grid5000/define_cluster_pvfs.sh new file mode 100644 index 0000000..6fcc7f0 --- /dev/null +++ b/omnetpp/Scripts/Grid5000/define_cluster_pvfs.sh @@ -0,0 +1,169 @@ +#!/bin/bash + +NCLUSTER="graphene-" +rm -f mpd.hosts +rm -f server.hosts +rm -f /etc/pvfs2-fs.conf + +#Clust1[1-39] +#Clust2[40-74] +#Clust3[75-104] +#Clust4[105-144] +CLIENT=1 +SERVER=2 +INSUFFICIENT=3 + +NUM_CLUSTER=4 + +CLUSTER[1]=$INSUFFICIENT; +CLUSTER[2]=$INSUFFICIENT; +CLUSTER[3]=$INSUFFICIENT; +CLUSTER[4]=$INSUFFICIENT; +if [ "$#" -eq 2 ]; +then +#Count how many nodes in each cluster is allocated +for dest in $(sort <${OAR_NODEFILE} | uniq); +do + +NUM=${dest:9:$((${#dest}-27))} + +if [[ $NUM -ge 1 && $NUM -le 39 ]]; +then + Clust1[$NUM]=${NCLUSTER}${NUM} +elif [[ $NUM -ge 40 && $NUM -le 74 ]]; +then + Clust2[$NUM]=${NCLUSTER}${NUM} +elif [[ $NUM -ge 75 && $NUM -le 104 ]]; +then + Clust3[$NUM]=${NCLUSTER}${NUM} +elif [[ $NUM -ge 105 && $NUM -le 144 ]]; +then + Clust4[$NUM]=${NCLUSTER}${NUM} +fi +done + +tab[1]=${#Clust1[@]} +tab[2]=${#Clust2[@]} +tab[3]=${#Clust3[@]} +tab[4]=${#Clust4[@]} +#~ TODO : Test this lines to prevent user if there are enough nodes +#~ t=$(($tab[1]+$tab[2]+$tab[3]+$tab[4])) +#~ n=$(($1+$2)) +#~ if [[ $t -lt $n ]]; +#~ then + #~ echo "Not enough nodes are allocated for $1 clients and $2 servers" + #~ exit +#~ fi + +#sort the number of nodes on each cluster +sort_table=($(printf "%s\n" ${tab[*]} | sort -n)) + +#choose the first wich is higher than the number of server +k=0 +while [ ${sort_table[${k}]} -lt $2 ];do + k=$(($k+1)) +done + +#search wich cluster has the minimum calculate previously +if [ ${sort_table[${k}]} -eq ${#Clust1[@]} ]; +then + CLUSTER[1]=$SERVER +elif [ ${sort_table[${k}]} -eq ${#Clust2[@]} ]; +then + CLUSTER[2]=$SERVER +elif [ ${sort_table[${k}]} -eq ${#Clust3[@]} ]; +then + CLUSTER[3]=$SERVER +elif [ ${sort_table[${k}]} -eq ${#Clust4[@]} ]; +then + CLUSTER[4]=$SERVER +fi + +#sort the number of nodes on each cluster +sort_table=($(printf "%s\n" ${tab[*]} | sort -n -r)) +#Choose the cluster if the number of nodes is sufficient +TOTAL_NODE=0 +j=0 +#Assume that there are enough nodes for servers and clients +while [ $TOTAL_NODE -lt $1 -o $j -eq $NUM_CLUSTER ]; +do + if [ ${#Clust1[@]} -eq ${sort_table[j]} -a ${CLUSTER[1]} -eq $INSUFFICIENT ]; + then + CLUSTER[1]=$CLIENT + TOTAL_NODE=$(($TOTAL_NODE+${#Clust1[@]})) + else + if [ ${#Clust2[@]} -eq ${sort_table[j]} -a ${CLUSTER[2]} -eq $INSUFFICIENT ]; + then + CLUSTER[2]=$CLIENT + TOTAL_NODE=$(($TOTAL_NODE+${#Clust2[@]})) + else + if [ ${#Clust3[@]} -eq ${sort_table[j]} -a ${CLUSTER[3]} -eq $INSUFFICIENT ]; + then + CLUSTER[3]=$CLIENT + TOTAL_NODE=$(($TOTAL_NODE+${#Clust3[@]})) + + elif [ ${CLUSTER[4]} -eq $INSUFFICIENT ]; + then + CLUSTER[4]=$CLIENT + TOTAL_NODE=$(($TOTAL_NODE+${#Clust4[@]})) + fi + fi + fi + j=$(($j+1)) +done; + +echo ${#Clust1[@]} ${#Clust2[@]} ${#Clust3[@]} ${#Clust4[@]} +echo ${CLUSTER[1]} ${CLUSTER[2]} ${CLUSTER[3]} ${CLUSTER[4]} + +t=1 +for state in ${CLUSTER[@]}; +do + m=0 + eval var=Clust${t}[@] + case $state in + $CLIENT) + for node in ${!var};do + echo $node >> mpd.hosts + m=$(($m+1)) + done + echo "Cluster $t is reserved for clients : $m nodes" + cnode="${cnode}${t}, " + nnode=$(($nnode + $m)) + ;; + $SERVER) + for node in ${!var};do + echo $node >> server.hosts + m=$(($m+1)) + done + echo "Cluster $t is reserved for servers : $m nodes" + snode="${snode}${t}, " + snnode=$(($snnode + $m)) + ;; + esac + t=$(($t+1)) +done + +echo "Summary : " +echo "Cluster(s) ${cnode:0:$((${#cnode}-2))} is(are) used for clients : ${nnode} nodes" +echo "$(sed -n '1p' mpd.hosts) is the first client node of the list" +echo "Cluster(s) ${snode:0:$((${#snode}-2))} is(are) used for servers : ${snnode} nodes" +echo "Server List :" +for destse in $(head -n $2 server.hosts);do +echo $destse +done + +pvfs2-genconfig /etc/pvfs2-fs.conf + +if [ $? -eq 0 ]; +then + +./launch_servers_pvfs2.sh $2 + +./launch_client_pvfs2.sh + +./mount_pvfs2_server.sh $2 +fi + +else + echo "Too few arguments : define_cluster_pvfs \$NUMBER_CLIENT \$NUMBER_SERVER" +fi diff --git a/omnetpp/Scripts/Grid5000/get_time_value.py b/omnetpp/Scripts/Grid5000/get_time_value.py new file mode 100644 index 0000000..2830d23 --- /dev/null +++ b/omnetpp/Scripts/Grid5000/get_time_value.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python + +import re +import csv +import glob +import os + +r = re.compile(ur'^read[ A-Za-z0-9\.]+(?!.*^read[ A-Za-z0-9\.]+)', re.MULTILINE | re.DOTALL) +w = re.compile(ur'^write[ A-Za-z0-9\.]+(?!.*^write[ A-Za-z0-9\.]+)', re.MULTILINE | re.DOTALL) +prefix="result_test" +suffix=".txt" +pathToResults="../../Results/" + +def getReadResult(lines): + """ + Get the time result for a read test with the benchmark IOR + fil: file with results of the test + """ + read=False + res = r.findall(lines) + time=0 + if len(res) != 0: + spl = res[0].split() + time = spl[5] + read=True + return time, read + +def getWriteResult(lines): + """ + Get the time result for a write test with the benchmark IOR + fil: file with results of the test + """ + write=False + res = w.findall(lines) + time=0 + if len(res) != 0: + spl = res[0].split() + time = spl[5] + write=True + return time, write + +nbfile=len(glob.glob(prefix+"*-1"+suffix))+1 +i=1 +k=1 +while i < nbfile: + #Get the result from the files + nbsubfile=len(glob.glob(prefix+str(k)+"-*"+suffix))+1 + resr=[] + resw=[] + if os.path.isfile(prefix+str(k)+"-"+"1"+suffix): + for j in range(1,nbsubfile): + with open(prefix+str(k)+"-"+str(j)+suffix) as fil: + lines = fil.read() + timer, read=getReadResult(lines) + if read: + resr.append(float(timer)) + + timew, write=getWriteResult(lines) + if write: + resw.append(float(timew)) + + #Calcul the average of the test number i + if read: + averR=(sum(resr)/float(len(resr))) + if write: + averW=(sum(resw)/float(len(resw))) + + #Some simulation has to be compare to the same real result + if k == 1: + l=[1,14,15] + elif k == 10: + l=[10,16] + else: + l=[k] + + for m in l: #Take the same result for the test 1, 14, 15 + if os.path.isfile(pathToResults+"result_"+str(m)+".csv"): + #Write on the existant files of results + with open(pathToResults+"result_"+str(m)+".csv","rb") as fil: + rcs = csv.reader(fil) + datas=list(rcs) + if len(datas[0]) == 5: + if read: + datas[0][2]="Result for read from real system" + datas[1][2]=averR + if write and not read: + datas[0][2]="Result for write from real system" + datas[1][2]=averW + elif write and read: + datas[0].insert(3,"Result for write from real system") + datas[1].insert(3,averW) + elif len(datas[0]) == 6: + if read: + datas[1][2]=averR + if write: + datas[1][3]=averW + elif len(datas[0]) == 4: + if read: + datas[0].insert(2,"Result for read from real system") + datas[1].insert(2,averR) + if write and not read: + datas[0].insert(2,"Result for write from real system") + datas[1].insert(2,averW) + elif write and read: + datas[0].insert(3,"Result for write from real system") + datas[1].insert(3,averW) + + with open(pathToResults+"result_"+str(m)+".csv","wb") as fil: + c = csv.writer(fil) + c.writerows(datas) + + print "File", k, "done" + i+=1 + k+=1 + + diff --git a/omnetpp/Scripts/Grid5000/launch_benchmark_tests.sh b/omnetpp/Scripts/Grid5000/launch_benchmark_tests.sh new file mode 100644 index 0000000..9639ce4 --- /dev/null +++ b/omnetpp/Scripts/Grid5000/launch_benchmark_tests.sh @@ -0,0 +1,222 @@ +#!/bin/bash + +#Launch the different tests with IOR with different parameters +ID=0 +SID=1 +PATH_TO_RESULT=Results/ +MPI_EXEC="mpirun" +MPI_OPTIONS_D="-machinefile mpd.hosts " +IOR_EXEC="ior" +IOR_OPTIONS_D="-Z -X 34 -k -a POSIX -i 1 -o /mnt/pvfs2/testFile " +PREFIX="result_test" +SUFFIX=".txt" +ITERATION=5 +NUM_SERVER=7 + +flushCache(){ + for dest in $(head -n $NUM_SERVER server.hosts); + do + ssh ${dest} sync + sleep 1 + ssh ${dest} "echo 3 | tee /proc/sys/vm/drop_caches" >/dev/null 2>&1 + done +} + +launchSimulation(){ + + if [ $WORD == "-I" ]; + then + ID=0 + elif [ $WORD != "-a" ]; + then + ID=$WORD + else + ID=$(($ID+1)) + fi + SID=1 + #In order to iterate the test + if [ "$#" -eq 4 ]; + then + ITE=$4 + else + ITE=1 + fi + + echo "" + echo $1 + echo "" + MPI_OPTIONS=${MPI_OPTIONS_D}$2 + IOR_OPTIONS=${IOR_OPTIONS_D}$3 + echo "Initialization of data on file system start" + ${MPI_EXEC} ${MPI_OPTIONS} ${IOR_EXEC} ${IOR_OPTIONS} -w >/dev/null 2>&1 + echo "Initialization of data on file system end" + VERBOSE="-v -v -v" + for i in $(seq 1 $ITE); + do + echo "##Benchmark $ID launched: Iteration = $SID##" + flushCache + ${MPI_EXEC} ${MPI_OPTIONS} ${IOR_EXEC} ${IOR_OPTIONS} ${VERBOSE} > ${PATH_TO_RESULT}${PREFIX}${ID}-${SID}${SUFFIX} + echo "##Benchmark $ID finished: Iteration = $SID##" + SID=$(($SID+1)) + VERBOSE="-v -v" + done + ssh $(head -n 1 mpd.hosts) rm /mnt/pvfs2/testFile* +} + +interactivemode(){ + correct="" + while [[ $correct != "y" && $correct != "Y" ]]; + do + correct="y" + echo "Give the MPICH options (see man mpiexec for valid options):[ ${MPI_OPTIONS_D}]" + read tmp + if [ ! -z $tmp ]; + then + MPI_OPTIONS_D=$tmp + fi + echo "Give the IOR options (see man ior for valid options):[ ${IOR_OPTIONS_D}]" + read tmp + if [ ! -z $tmp ]; + then + IOR_OPTIONS_D=$tmp + fi + echo "Give the number of iteration:[${ITERATION}]" + read tmp + if [ ! -z $tmp ]; + then + ITERATION=$tmp + fi + echo "Give the name of the file wich takes the results: [ ${PREFIX} ]" + read tmp + if [ ! -z $tmp ]; + then + PREFIX=$tmp + fi + echo "MPICH Options : "${MPI_OPTIONS_D} + echo "IOR Options : "${IOR_OPTIONS_D} + echo "Number of iteration: "${ITERATION} + echo "Name of result file: "${PREFIX} + echo "Is it ok?[Y/n]" + read tmp + if [ ! -z $tmp ]; + then + correct=$tmp + fi + done + echo "${MPI_EXEC} ${MPI_OPTIONS} ${IOR_EXEC} ${IOR_OPTIONS}" + launchSimulation "###Test with custom options###" "" "" $ITERATION +} + +for WORD in "$@"; +do + case $WORD in + --help | -h) + echo "Options:" + echo "-a : # Execute all tests" + echo "-I : # Interactive Mode, Custom your test" + echo "1 : # Default parameters : client = 32, server = 6, file-size = 2GB, stripe-size=64K, req-size=1MB, read=1, Odirect=0, File-per-proc" + echo "2 : # With client = 64" + echo "3 : # With ODIRECT = 1" + echo "4 : # With Write (read=0)" + echo "5 : # With req-size = 32 KB" + echo "6 : # With req-size = 128 KB" + echo "7 : # With req-size = 256 KB" + echo "8 : # With req-size = 8 MB" + echo "9 : # With req-size = 64 MB" + echo "10 : # Uniq Shared File" + echo "11 : # With file-size = 1 GB" + echo "12 : # With file-size = 512 MB" + echo "13 : # With Write and Uniq Shared File" + exit ;; + 1) + #With default parameters client = 32, server=6, file-size=2GB + #stripe-size=64K, req-size=1M, read=1 + launchSimulation "###Test with default paramaters###" "-n 32" "-N 32 -t 1m -b 2g -F -r" $ITERATION + shift ;; + 2) + #With client = 64 + launchSimulation "###Test with 64 clients###" "-n 64" "-N 64 -t 1m -b 2g -F -r" $ITERATION + shift ;; + 3) + #With ODIRECT=1 + launchSimulation "###Test with ODIRECT=1###" "-n 32" "-N 32 -t 1m -b 2g -F -r -B" $ITERATION + shift ;; + 4) + #With Write (read=0) + launchSimulation "###Test write files###" "-n 32" "-N 32 -t 1m -b 2g -F -w" $ITERATION + shift ;; + 5) + #With Stripe-Size = 32K + launchSimulation "###Test Requier Size = 32 KB###" "-n 32" "-N 32 -t 32k -b 2g -F -r" $ITERATION + shift ;; + 6) + #With Stripe-Size = 128K + launchSimulation "###Test Requier Size = 128 KB###" "-n 32" "-N 32 -t 128k -b 2g -F -r" $ITERATION + shift ;; + 7) + #With req-size = 256K + launchSimulation "###Test Requier Size = 256 K###" "-n 32" "-N 32 -t 256k -b 2g -F -r" $ITERATION + shift ;; + 8) + #With req-size=8MB + launchSimulation "###Test Requier Size = 8 MB###" "-n 32" "-N 32 -t 8m -b 2g -F -r" $ITERATION + shift;; + 9) + #With req-size=64MB + launchSimulation "###Test Requier Size = 64 MB###" "-n 32" "-N 32 -t 64m -b 2g -F -r" $ITERATION + shift;; + 10) + #Uniq Shared File + launchSimulation "###Test Uniq Shared File###" "-n 32" "-N 32 -t 1m -b 2g -r" $ITERATION + shift;; + 11) + # With file-size = 1 GB + launchSimulation "###Test with size of file = 1 GB###" "-n 32" "-N 32 -t 1m -b 1g -F -r" $ITERATION + shift ;; + 12) + # With file-size = 512 MB + launchSimulation "###Test with size of file = 512 MB###" "-n 32" "-N 32 -t 1m -b 512m -F -r" $ITERATION + shift ;; + 13) + #With Write and Uniq Shared File + launchSimulation "###Test write files and Uniq Shared File###" "-n 32" "-N 32 -t 1m -b 2g -w" $ITERATION + shift;; + -a) #All Simulations + #1 + launchSimulation "###Test with default paramaters###" "-n 32" "-N 32 -t 1m -b 2g -F -r" $ITERATION + #2 + launchSimulation "###Test with 64 clients###" "-n 64" "-N 64 -t 1m -b 2g -F -r" $ITERATION + #3 + launchSimulation "###Test with ODIRECT=1###" "-n 32" "-N 32 -t 1m -b 2g -F -r -B" $ITERATION + #4 + launchSimulation "###Test write files###" "-n 32" "-N 32 -t 1m -b 2g -F -w" $ITERATION + #5 + launchSimulation "###Test Requier Size = 32 KB###" "-n 32" "-N 32 -t 32k -b 2g -F -r" $ITERATION + #6 + launchSimulation "###Test Requier Size = 128 KB###" "-n 32" "-N 32 -t 128k -b 2g -F -r" $ITERATION + #7 + launchSimulation "###Test Requier Size = 256 K###" "-n 32" "-N 32 -t 256k -b 2g -F -r" $ITERATION + #8 + launchSimulation "###Test Requier Size = 8 MB###" "-n 32" "-N 32 -t 8m -b 2g -F -r" $ITERATION + #9 + launchSimulation "###Test Requier Size = 64 MB###" "-n 32" "-N 32 -t 64m -b 2g -F -r" $ITERATION + #10 + launchSimulation "###Test Uniq Shared File###" "-n 32" "-N 32 -t 1m -b 2g -r" $ITERATION + #11 + launchSimulation "###Test with size of file = 1 GB###" "-n 32" "-N 32 -t 1m -b 1g -F -r" $ITERATION + #12 + launchSimulation "###Test with size of file = 512 MB###" "-n 32" "-N 32 -t 1m -b 512m -F -r" $ITERATION + #13 + launchSimulation "###Test write files and Uniq Shared File###" "-n 32" "-N 32 -t 1m -b 2g -w" $ITERATION + exit ;; + -I) + #Launch Test with custom options + echo "###Interactive mode###" + interactivemode + echo "###END###" + exit;; + *) + echo "Invalid Numero of Test type -h or --help" + exit ;; + esac +done diff --git a/omnetpp/Scripts/Grid5000/launch_client_pvfs2.sh b/omnetpp/Scripts/Grid5000/launch_client_pvfs2.sh new file mode 100644 index 0000000..d231c98 --- /dev/null +++ b/omnetpp/Scripts/Grid5000/launch_client_pvfs2.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +#Copy the fstab file on each client and launch them +PATH_EXEC_CLIENT="pvfs-2.8.2/src/apps/kernel/linux" + + #if [ $1 -gt $2 ]; + #then + # end=$1 + # start=$2 + #else + # end=$2 + # start=$1 + #fi + if [ "$#" -eq 0 ]; + then + for dest in $(cat mpd.hosts);do + scp /etc/fstab ${dest}:/etc/ + ssh ${dest} ${PATH_EXEC_CLIENT}/pvfs2-client -p ${PATH_EXEC_CLIENT}/pvfs2-client-core + done + + nb=$(sed -n '$=' mpd.hosts) + mpdboot -n $nb -f mpd.hosts + mpdtrace | sort + fi + + diff --git a/omnetpp/Scripts/Grid5000/launch_servers_pvfs2.sh b/omnetpp/Scripts/Grid5000/launch_servers_pvfs2.sh new file mode 100644 index 0000000..689c1b8 --- /dev/null +++ b/omnetpp/Scripts/Grid5000/launch_servers_pvfs2.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +#Copy the config file on each server and launch them + + #if [ $1 -gt $2 ]; + #then + # end=$1 + # start=$2 + #else + # end=$2 + # start=$1 + #fi +for dest in $(head -n $1 server.hosts);do + scp /etc/pvfs2-fs.conf ${dest}:/etc/ + ssh ${dest} pvfs2-server /etc/pvfs2-fs.conf -f + ssh ${dest} pvfs2-server /etc/pvfs2-fs.conf + echo "tcp://${dest}:3334/pvfs2-fs /mnt/pvfs2 pvfs2 defaults,noauto 0 0" >> /etc/fstab +done + +pvfs2-ping -m /mnt/pvfs2 + + diff --git a/omnetpp/Scripts/Grid5000/mount_pvfs2_server.sh b/omnetpp/Scripts/Grid5000/mount_pvfs2_server.sh new file mode 100644 index 0000000..928a256 --- /dev/null +++ b/omnetpp/Scripts/Grid5000/mount_pvfs2_server.sh @@ -0,0 +1,17 @@ +#!/bin/sh + + #if [ $1 -gt $2 ]; + #then + # end=$1 + # start=$2 + #else + # end=$2 + # start=$1 + #fi + for destcl in $(cat mpd.hosts);do + for destse in $(head -n $1 server.hosts);do + ssh ${destcl} mount -t pvfs2 tcp://${destse}:3334/pvfs2-fs /mnt/pvfs2 + done + done + ssh $(head -n 1 mpd.hosts) mount | grep pvfs2 + diff --git a/omnetpp/Scripts/README b/omnetpp/Scripts/README new file mode 100644 index 0000000..745e8a7 --- /dev/null +++ b/omnetpp/Scripts/README @@ -0,0 +1,78 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# + +#### Launch_Simulations #### + +The goal of this script is to launch successively two versions of PFSSim simulator and stock the results in a file per version + +Firstly you have to verify the path of the two versions: +PATH_PFSSIM_MASTER= +PATH_PFSSIM_STAGE= + +This variables are in order to come back to the directory where is this script +They are necessary to a correct functioning +CMD_BACK_PFSSIM_MASTER= +CMD_BACK_PFSSIM_STAGE= + +In a terminal: launch_simulations -h to see the existing simulations + +Give in argument the list of the simulation : launch_simulations 5 8 7 4 +This example will execute the 5th simulation and then the 8th etc + +To execute all without give the list: launch_simulations -a + +You can change the name of the result files and the path where they will be save +PATH_TO_RESULT= +PREFIX= +The file will have this form: +${PATH_TO_RESULT}${PREFIX}${I}-${SID}_before.txt +${PATH_TO_RESULT}${PREFIX}${I}-${SID}_after.txt + +I is the ID of test. +SID is the number of the iteration. +One file per iteration per version of simulation. + +Each simulation can be iterate Nth times (default N=5): +ITERATION= + +Add a simulation: +A simply way to add your own test is the following + +-Add an entry in the switch with an integer (the ID of the test) +-Put launchSimulation "[NAME OF YOUR SIMULATION]" "[OPTIONS FOR gen_input.sh]" "-c [NAME OF CONFIGURATION IN .INI FILES]" +-Add to the help entry the number and a quick description of your simulation +-Add at the end of the switch in "-a" option the same line as in step two in order to launch it when you want all simulation one after the other. + +----------------------------------------------------------------------------------------------------------------------------- + +#### getTimeValue #### + +Python script to fetch the result previously generated. +It is formated to work only with a result of PFSSim. +It calculates the average of N iterations and put the result of two versions in csv file +It takes the time of execution too + +In a terminal: python getTimeValue.py + +The name of csv file will have this form : result_$I.csv +I is the same number as described previously + +You must change this following variables if you changed PREFIX: +prefix = + +Be sure that variable is the path where the results file of Launch_Simulations are stocked: +pathToResults= diff --git a/omnetpp/Scripts/getTimeValue.py b/omnetpp/Scripts/getTimeValue.py new file mode 100644 index 0000000..ef497fc --- /dev/null +++ b/omnetpp/Scripts/getTimeValue.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# GetTimeValue.py +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# +import re +import csv +import os +import glob + +p = re.compile(r"t=[0-9]+\.[0-9]+") +elapse = re.compile(ur'Elapsed: [0-9]+\.[0-9]+(?!.*Elapsed: [0-9]+\.[0-9]+)', re.DOTALL) +prefix = "res_sim"; +asuffix="_after"; +bsuffix="_before"; +extension = ".txt"; +pathToResults="simulation_traces/" + +nbfile=len(glob.glob(pathToResults+prefix+"*-1"+asuffix+extension))+1 +i=1 +k=1 +while i < nbfile: + if os.path.isfile(pathToResults+prefix+str(k)+"-1"+asuffix+extension) and os.path.isfile(pathToResults+prefix+str(k)+"-1"+bsuffix+extension): + #Get the result from the files + nbsubfile=len(glob.glob(pathToResults+prefix+str(k)+"-*"+asuffix+extension))+1 + resSa=[] + resSb=[] + resTa=[] + resTb=[] + for j in range(1,nbsubfile): + with open(pathToResults+prefix+str(k)+"-"+str(j)+asuffix+extension) as fil: + lines=fil.read(); + resa=p.findall(lines); + resSa.append(float(resa[0][2:])) + timea=elapse.findall(lines); + resTa.append(float(timea[0][9:])) + + with open(pathToResults+prefix+str(k)+"-"+str(j)+bsuffix+extension) as fil: + lines=fil.read(); + resb=p.findall(lines); + resSb.append(float(resb[0][2:])) + timeb=elapse.findall(lines); + resTb.append(float(timeb[0][9:])) + + datas=[] + averSA=(sum(resSa)/float(len(resSa))) + averSB=(sum(resSb)/float(len(resSb))) + averTA=(sum(resTa)/float(len(resTa))) + averTB=(sum(resTb)/float(len(resTb))) + + #Get the previous values if file exist + if os.path.isfile("result_"+str(k)+".csv"): + with open("result_"+str(k)+".csv","rb") as fil: + r = csv.reader(fil) + datas=list(r) + + with open("result_"+str(k)+".csv","wb") as fil: + c = csv.writer(fil) + if not datas or len(datas[0]) == 4: + #if file did not exist or the real system has not send its results, update the datas + c.writerow(["Simulation time before","Simulation time after","Execution Time before", "Execution Time after"]) + c.writerow([averSB,averSA,averTB,averTA]) + elif len(datas[0]) == 5: + #Update the datas in the correct columns + datas[1][0]=averSB + datas[1][1]=averSA + datas[1][3]=averTB + datas[1][4]=averTA + c.writerows(datas) + elif len(datas[0]) == 6: + #Update the datas in the correct columns + datas[1][0]=averSB + datas[1][1]=averSA + datas[1][4]=averTB + datas[1][5]=averTA + c.writerows(datas) + + print "File",k,"done" + i+=1 + k+=1 diff --git a/omnetpp/Scripts/launch_simulations.sh b/omnetpp/Scripts/launch_simulations.sh new file mode 100755 index 0000000..112d23b --- /dev/null +++ b/omnetpp/Scripts/launch_simulations.sh @@ -0,0 +1,238 @@ +#!/bin/bash + +#Launch the different simulation with different parameters +GEN_EXEC=./gen_exe.sh +GEN_INPUT=./gen_input.sh +CMD_BACK_PFSSIM_MASTER=../../ +CMD_BACK_PFSSIM_STAGE=../ +EXEC_PFSSIM='./PFSsim -u Cmdenv -r 0 omnetpp.ini' +PATH_PFSSIM_MASTER='./PFSsim-master/omnetpp/' +PATH_PFSSIM_STAGE='./PFSsim_stage/' +PATH_TO_RESULT=Results/simulation_traces/ +KB=1024 +MB=$((${KB}*${KB})) +GB=$((${KB}*${KB}*${KB})) +I=0 +SID=1 +ITERATION=5 +PREFIX=res_sim + +if [ $# -ne 0 -a "$1" != "-h" -a "$1" != "--help" ]; +then + #Rebuild the exe first + cd ${PATH_PFSSIM_MASTER} + ${GEN_EXEC} + cd $CMD_BACK_PFSSIM_MASTER + cd ${PATH_PFSSIM_STAGE} + ${GEN_EXEC} + cd $CMD_BACK_PFSSIM_STAGE +fi + +if [ $# -eq 0 ]; +then + echo "Execute launch_simulation --help (-h) to see options" +fi + +launchSimulation(){ + if [ $WORD == "-I" ]; + then + I=0 + elif [ $WORD != "-a" ]; + then + I=$WORD + else + I=$(($I+1)) + fi + echo "" + echo $1 #Show the name of the Simulation + echo "" + SID=1 + #In order to iterate the test + if [ "$#" -eq 4 ]; + then + ITERATION=$4 + fi + for i in $(seq 1 $ITERATION); + do + echo "##Simulation $I launched: Iteration = $SID##" + cd ${PATH_PFSSIM_MASTER} + ${GEN_INPUT} $2 #Generate the file as layout, traceFile, ext or disk + echo "##Launch software not modified##" + $EXEC_PFSSIM $3 > ${CMD_BACK_PFSSIM_MASTER}${PATH_TO_RESULT}${PREFIX}${I}-${SID}_before.txt + echo "##End of software not modified##" + cd $CMD_BACK_PFSSIM_MASTER + cd $PATH_PFSSIM_STAGE + ${GEN_INPUT} $2 + echo "##Launch software modified##" + $EXEC_PFSSIM $3 > ${CMD_BACK_PFSSIM_STAGE}${PATH_TO_RESULT}${PREFIX}${I}-${SID}_after.txt + echo "##End of software modified##" + cd $CMD_BACK_PFSSIM_STAGE + SID=$(($SID+1)) + echo "" + done +} + +interactivemode(){ + correct="" + while [[ $correct != "y" && $correct != "Y" ]]; + do + correct="y" + echo "Give the generation of input options (see gen_input --help for valid options):" + read tmp + if [ ! -z $tmp ]; + then + GEN_OPTIONS_D=$tmp + fi + echo "Give the name of the configuration (see .ini files for valid name):" + read tmp + if [ ! -z $tmp ]; + then + CONFIG_OPTIONS_D="-c $tmp" + fi + echo "Give the number of iteration:[5]" + read tmp + if [ ! -z $tmp ]; + then + ITERATION=$tmp + fi + echo "Give the name of the file wich takes the results: [ ${PREFIX} ]" + read tmp + if [ ! -z $tmp ]; + then + PREFIX=$tmp + fi + echo "gen_input Options : "${GEN_OPTIONS_D} + echo "Config Options : "${CONFIG_OPTIONS_D} + echo "Number of iteration: "${ITERATION} + echo "Name of result file: "${PREFIX} + echo "Is it ok?[Y/n]" + read tmp + if [ ! -z $tmp ]; + then + correct=$tmp + fi + done + echo "${GEN_INPUT} ${GEN_OPTIONS_D}" + echo "${EXEC_PFSSIM} ${CONFIG_OPTIONS_D}" + launchSimulation "###Simulation with custom options###" "${GEN_OPTIONS_D}" "${CONFIG_OPTIONS_D}" $ITERATION +} + + +for WORD in "$@"; +do + case $WORD in + --help | -h) + echo "Options:" + echo "-a : # Execute all simulations" + echo "-I : # Interactive Mode, Custom your test" + echo "1 : # Default parameters : client = 32, server = 6, file-size = 2GB, stripe-size=64K, req-size=1MB, read=1, Odirect=0, File-per-proc" + echo "2 : # With client = 64" + echo "3 : # With ODIRECT = 1" + echo "4 : # With Write (read=0)" + echo "5 : # With req-size = 32 KB" + echo "6 : # With req-size = 128 KB" + echo "7 : # With req-size = 256 KB" + echo "8 : # With req-size = 8 MB" + echo "9 : # With req-size = 64 MB" + echo "10 : # Unique Shared File" + echo "11 : # With file-size = 1 GB" + echo "12 : # With file-size = 512 MB" + echo "13 : # With Write and Uniq Shared File" + echo "14 : # With FIFO Scheduler Algorithm" + echo "15 : # With SFQ Scheduler Algorithm [Doesn't work in command line. Use GUI]" + echo "16 : # Unique Shared File and Read-ahead disabled" + exit ;; + 1) + #With default parameters client = 32, server=6, file-size=2GB + #stripe-size=64K, req-size=1M, read=1 + launchSimulation "###Simulation with default paramaters###" + shift ;; + 2) + #With client = 64 + launchSimulation "###Simulation with 64 clients###" --client=64 "-c Client64" + shift ;; + 3) + #With ODIRECT=1 + launchSimulation "###Simulation with ODIRECT=1###" "" "-c Odirect" + shift ;; + 4) + #With Write (read=0) + launchSimulation "###Simulation write files###" --read=0 "-c Write" + shift ;; + 5) + #With Stripe-Size = 32K + launchSimulation "###Simulation Requier Size = 32 KB###" --req-size=$(echo "32*$KB" | bc) "-c LittleReqSize" + shift ;; + 6) + #With Stripe-Size = 128K + launchSimulation "###Simulation Requier Size = 128 KB###" --req-size=$(echo "128*$KB" | bc) "-c LittleReqSize" + shift ;; + 7) + #With req-size = 256K + launchSimulation "###Simulation Requier Size = 256 K###" --req-size=$(echo "256*$KB" | bc) "-c LittleReqSize" + shift ;; + 8) + #With req-size=10MB + launchSimulation "###Simulation Requier Size = 8 MB###" --req-size=$(echo "8*$MB" | bc) + shift;; + 9) + #With req-size=50MB + launchSimulation "###Simulation Requier Size = 64 MB###" --req-size=$(echo "64*$MB" | bc) + shift;; + 10) + #Uniq Shared File + launchSimulation "###Simulation Unique Shared File###" --uniq-shared-file + shift;; + 11) + # With file-size = 1 GB + launchSimulation "###Simulation with size of file = 1 GB###" --file-size=$GB + shift ;; + 12) + # With file-size = 512 MB + launchSimulation "###Simulation with size of file = 512 MB###" --file-size=$(echo "512*$MB" | bc) + shift ;; + 13) + #With Write and Uniq Shared File + launchSimulation "###Simulation write files and Unique Shared File###" "--read=0 --uniq-shared-file" "-c Write" + shift;; + 14) + #With FIFO Scheduler Algorithm + launchSimulation "###Simulation FIFO Scheduler Algorithm###" "" "-c FIFO" + shift;; + 15) + #With SFQ Scheduler Algorithm + launchSimulation "###Simulation SFQ Scheduler Algorithm###" "" "-c SFQ" + shift;; + 16) + #Unique Shared File and Read-ahead disabled + launchSimulation "###Simulation Shared File and Read-ahead disabled###" "--uniq-shared-file" "-c NoRA" + shift;; + -a) #All Simulations + launchSimulation "###Simulation with default paramaters###" + launchSimulation "###Simulation with 64 clients###" --client=64 "-c Client64" + launchSimulation "###Simulation with ODIRECT=1###" "" "-c Odirect" + launchSimulation "###Simulation write files###" --read=0 "-c Write" + launchSimulation "###Simulation Requier Size = 32 KB###" --req-size=$(echo "32*$KB" | bc) "-c LittleReqSize" + launchSimulation "###Simulation Requier Size = 128 KB###" --req-size=$(echo "128*$KB" | bc) "-c LittleReqSize" + launchSimulation "###Simulation Requier Size = 256 KB###" --req-size=$(echo "256*$KB" | bc) "-c LittleReqSize" + launchSimulation "###Simulation Require Size = 8MB###" --req-size=$(echo "8*$MB" | bc) + launchSimulation "###Simulation Require Size = 64MB###" --req-size=$(echo "64*$MB" | bc) + launchSimulation "###Simulation Unique Shared File" --uniq-shared-file + launchSimulation "###Simulation with size of file = 1 GB" --file-size=$GB + launchSimulation "###Simulation with size of file = 512 MB" --file-size=$(echo "512*$MB" | bc) + launchSimulation "###Simulation write files and Unique Shared File###" "--read=0 --uniq-shared-file" "-c Write" + launchSimulation "###Simulation FIFO Scheduler Algorithm###" "" "-c FIFO" + launchSimulation "###Simulation Shared File and Read-ahead disabled###" "--uniq-shared-file" "-c NoRA" + #launchSimulation "###Simulation SFQ Scheduler Algorithm###" "" "-c SFQ" + exit ;; + -I)#Launch Test with custom options + echo "###Interactive mode###" + interactivemode + echo "###END###" + exit;; + + *) + echo "Invalid Numero of Simulation type -h or --help" + exit ;; + esac +done diff --git a/omnetpp/client/application/Application.cc b/omnetpp/client/application/Application.cc index 5f474a3..abb276d 100644 --- a/omnetpp/client/application/Application.cc +++ b/omnetpp/client/application/Application.cc @@ -13,13 +13,14 @@ Define_Module(Application); * Used to initialize the IDs for each application class. */ int Application::initID = 0; +int Application::numClients=0; int Application::activeApplications = 0; /* * Initialize the ID. */ Application::Application() { - myID = initID ++; + myID = (initID ++); } /* @@ -29,10 +30,18 @@ Application::Application() { void Application::initialize() { StreamersFactory streamersfactory; // For initialization of trace input files. - int count = par("trace_count").longValue(); + count = par("trace_count").longValue(); int traceDigits = par("trace_file_trace_index_digits").longValue(); int clientDigits = par("trace_file_client_index_digits").longValue(); + //In order to rebuild simulation and parse the corrects files + if(myID==0){ + numClients = par("numClients").longValue();//Parse only one time cause it's a static on the first call + } + if(myID >= numClients-1){ + initID=0; + } + string prefixBeforeClientID = par("trace_input_file_prefix_before_client_ID").stdstringValue(); string prefixAfterClientID = par("trace_input_file_prefix_after_client_ID").stdstringValue(); string postfix = par("trace_input_file_postfix").stdstringValue(); @@ -95,6 +104,10 @@ void Application::handleMessage(cMessage * message) { */ void Application::generateInitialTraces() { if (!active) { + //In order to rebuild the Network while a simulation is not finished + if(activeApplications >= numClients){ + activeApplications = 0; + } activeApplications ++; active = true; } @@ -131,11 +144,14 @@ void Application::readOneTrace(int id) { SimpleTrace trace; if(! traceInput->readTrace(id, &trace)) { // End of file. - if (active) { + count--; + if (count == 0) { + //cout << "Number of Application Active: #" << activeApplications << endl; activeApplications --; active = false; } if (activeApplications == 0) { + initID = 0; endSimulation(); // If all the input files meet EOF, end the simulation. } return; @@ -144,7 +160,7 @@ void Application::readOneTrace(int id) { // Create AppRequest. AppRequest * request = trace.createAppRequest(); request->setKind(TRACE_REQ); - + request->setName("TRACE_REQ"); // Schedule AppRequest. double sendTime; if (trace.getSync() == 0) { // Non-sync. @@ -191,6 +207,7 @@ void Application::sendSafe(AppRequest * request) { * Clean the memory. */ void Application::finish() { + if (traceInput != NULL) { delete traceInput; } diff --git a/omnetpp/client/application/Application.h b/omnetpp/client/application/Application.h index f7a74a0..8f4bc26 100644 --- a/omnetpp/client/application/Application.h +++ b/omnetpp/client/application/Application.h @@ -17,16 +17,19 @@ class Application : public cSimpleModule int myID; static int initID; + static int numClients; ITraceInputStreamer * traceInput; ITraceOutputStreamer * traceOutput; + int count; + // Time overhead. double traceProcessTime; inline void generateInitialTraces(); - inline void sendNewAppRequest(AppRequest * reqeust); - inline void handleFinishedTrace(AppRequest * requset); + inline void sendNewAppRequest(AppRequest * request); + inline void handleFinishedTrace(AppRequest * request); inline void readOneTrace(int id); inline void sendSafe(AppRequest * request); void finish(); diff --git a/omnetpp/client/pfsclient/PFSClient.cc b/omnetpp/client/pfsclient/PFSClient.cc index 69f5919..1418f31 100644 --- a/omnetpp/client/pfsclient/PFSClient.cc +++ b/omnetpp/client/pfsclient/PFSClient.cc @@ -8,7 +8,7 @@ Define_Module(PFSClient); int PFSClient::idInit = 0; - +int PFSClient::numClients=0; /* * Initialize the ID of this module. */ @@ -28,6 +28,14 @@ void PFSClient::initialize() { dataPacketProcessTime = par("data_packet_process_time").doubleValue(); metadataPacketProcessTime = par("metadata_packet_process_time").doubleValue(); + //In order to rebuild simulation and parse the corrects files + if(myID==0){ + numClients = par("numClients").longValue();//Parse only one time cause it's a static on the first call + } + if(myID >= numClients-1){ + idInit=0; + } + StreamersFactory streamersfactory; string outputMethod = par("data_packet_output_method").stdstringValue(); if(outputMethod.compare(streamersfactory.FILE_OUTPUT_SIGNITURE) == 0) { diff --git a/omnetpp/client/pfsclient/PFSClient.h b/omnetpp/client/pfsclient/PFSClient.h index b102ef3..b65d3b3 100644 --- a/omnetpp/client/pfsclient/PFSClient.h +++ b/omnetpp/client/pfsclient/PFSClient.h @@ -21,6 +21,7 @@ class PFSClient : public cSimpleModule { protected: int myID; static int idInit; + static int numClients; IPacketOutputStreamer * metadataPacketOutput; IPacketOutputStreamer * dataPacketOutput; diff --git a/omnetpp/client/pfsclient/strategy/PVFS2ClientStrategy.cc b/omnetpp/client/pfsclient/strategy/PVFS2ClientStrategy.cc index 0b9b81f..65ff0be 100644 --- a/omnetpp/client/pfsclient/strategy/PVFS2ClientStrategy.cc +++ b/omnetpp/client/pfsclient/strategy/PVFS2ClientStrategy.cc @@ -154,8 +154,10 @@ void PVFS2ClientStrategy::generateDataPacketRequests(int fileID, vectorsetID(requestID); gpkt->setClientID(myID); if (gpkt->getRead()) { + gpkt->setName("PFS_R_REQ"); gpkt->setKind(PFS_R_REQ); } else { + gpkt->setName("PFS_W_REQ"); gpkt->setKind(PFS_W_REQ); } @@ -251,6 +253,7 @@ void PVFS2ClientStrategy::processLastDataPacketResponse(gPacket * packet, vector } retRequest->setKind(TRACE_RESP); + retRequest->setName("TRACE_RESP"); packetlist->push_back(retRequest); } else if(ret == trace->MORE_TO_SEND){ // You have done the current window, schedule next packets. generateDataPacketRequests(packet->getFileId(), packetlist); // set up future event diff --git a/omnetpp/config/lfslayout/in/synthetic/gen.py b/omnetpp/config/lfslayout/in/synthetic/gen.py old mode 100755 new mode 100644 index a00d105..92deaec --- a/omnetpp/config/lfslayout/in/synthetic/gen.py +++ b/omnetpp/config/lfslayout/in/synthetic/gen.py @@ -1,5 +1,10 @@ import random import sys +from collections import namedtuple +import re + +ServerInfo = namedtuple("ServerInfo", "IDServer StripeSize Unit") +mat = lambda n, m: [[0 for j in range(0,m)] for i in range(0,n)] blocksize = 4096 @@ -11,7 +16,14 @@ servernum=int(sys.argv[1]) filenum=int(sys.argv[2]) -total=int(sys.argv[3]) / blocksize +totalfilesize=int(sys.argv[3]) +total=totalfilesize / blocksize + +StripeSize=mat(filenum,servernum) +Total=mat(filenum,servernum) + +size='' +KiloUnitConvertion=1024 #extsize=int(sys.argv[4]) # extent size of EXT3 #length = 12 # In EXT3, the first extent length is 12. print "Generating disk parameters. Server number: ", servernum, " File number: ", filenum, " Data File Size(in 4k block): ", total @@ -19,6 +31,61 @@ total +fil=open("../../../pfslayout/synthetic/even-dist/even-dist","r") + +#Parse the file even-dist to take the layout +#if the format of the file changes, change this +for i in range(0,filenum): + line = fil.readline().rstrip('\n\r')#erase the end of line marker + h=0 + #take the information inside the '[ ]' + for infoserver in re.findall(r"\[([^\]]*)\]*", line): + index = 1 + + IDServer=int(infoserver[0])#the first element is the IDServer + + #obtain the digits that compose the stripeSize + while (infoserver[index] != 'K') and (infoserver[index]!='k') and infoserver[index] != 'm' and infoserver[index] != 'M': + size += infoserver[index] + index+=1 + + unit=KiloUnitConvertion #To convert KB in B + + if(infoserver[index] == 'm' or infoserver[index] == 'M'): + unit*=KiloUnitConvertion #To convert MB in B + + #if size is empty, there is no stripesize for this file in this server + if size != ' ': + info=ServerInfo(IDServer,int(size),unit) + StripeSize[i][h]=info #push for this file the informations + else: + StripeSize[i][h]=0 + size=''#reset the variable + h+=1 + +fil.close() + +#For each file calcul the total data on each server +for i in range (0, filenum): + k=0; + totalfile=totalfilesize; + while totalfile > 0: + info=StripeSize[i][k] #Information for the file and the kth server + if info !=0 : + Total[i][info[0]] += info[1] + totalfile -=(info[1]*info[2]) + k+=1 + if k >= servernum: + k=0; + + for t in range (0,servernum): + info_unit=StripeSize[i][t] + if info_unit!=0: + Total[i][info_unit[0]] *=info_unit[2]#Convert in B the total size + #The last server have too many informations + if totalfile < 0: + Total[i][info[0]] +=totalfile + for n in range (0, servernum): if n < 10: name = name1 + str('00%(n)d' %{"n":n}) @@ -27,10 +94,13 @@ f=open(name,'w') offset = 1 for i in range (0, filenum): - f.write('%(fn)d:\n' %{"fn":i}) - acc = 0; - while acc < total: - length = 1024 - f.write('%(acc)d %(off)d %(len)d;\n' %{"acc":acc,"off":offset,"len":length}) - acc += length - offset += length+1 + total = Total[i][n]/blocksize + #If there are datas on the server we write the number of file + if total != 0: + f.write('%(fn)d:\n' %{"fn":i}) + acc = 0; + while acc < total: + length = 1024 + f.write('%(acc)d %(off)d %(len)d;\n' %{"acc":acc,"off":offset,"len":length}) + acc += length + offset += length+1 diff --git a/omnetpp/config/pfslayout/synthetic/even-dist/make-ed.py b/omnetpp/config/pfslayout/synthetic/even-dist/make-ed.py old mode 100755 new mode 100644 diff --git a/omnetpp/config/pfslayout/synthetic/uni-dist/make-ud.py b/omnetpp/config/pfslayout/synthetic/uni-dist/make-ud.py old mode 100755 new mode 100644 diff --git a/omnetpp/dserver/disk/Disk.cc b/omnetpp/dserver/disk/Disk.cc index 9a4f947..bc0e625 100644 --- a/omnetpp/dserver/disk/Disk.cc +++ b/omnetpp/dserver/disk/Disk.cc @@ -6,12 +6,21 @@ Define_Module(Disk); int Disk::idInit = 0; +int Disk::numDisk = 0; Disk::Disk() { } void Disk::initialize(){ - myID = idInit ++; + + //Parse only one time cause it's a static on the first call + if(idInit == 0){ + numDisk=par("numDservers").longValue();//Suppose that there is 1 Disk per Server, If not change the omnet.ini and parse the correct value and change the variable in Disk.ned + } + myID = idInit ++; + if(myID>=numDisk-1){ + idInit=0; + } diskSize = par("disk_size").longValue(); // zoneSize = diskSize / ZONECOUNT; @@ -157,11 +166,13 @@ void Disk::dispatchJobs(){ if(myID == 4) cout << " - Disk: Sequential" << endl; #endif - if(blki == BLKSIZECOUNT) + if(blki == BLKSIZECOUNT){ timespan = seqtime[r][blki-1]; - else + } + else{ timespan = (seqtime[r][blki]-seqtime[r][blki-1]) *(length-blksizes[blki-1])/(blksizes[blki]-blksizes[blki-1])+seqtime[r][blki-1]; + } // cout << r << " " << blki-1 << " " << seqtime[r][blki-1] << endl; @@ -198,6 +209,9 @@ void Disk::dispatchJobs(){ if(timespan < 0) PrintError::print("Disk - dispatchJobs", "timespan is zero or negative.", timespan); + /*if(myID == 5){ + cout << "Disk::dispatchJobs() timespan(ms) : " << timespan << endl; + }*/ scheduleAt(SIMTIME_DBL(simTime()) + timespan, req); } } @@ -209,6 +223,7 @@ void Disk::sendSafe(BlkRequest * req){ #define LAST_JUMP_THRESHOLD 180 #define JUMP_THRESHOLD 16 #define SEQ_RA_THRESHOLD 96 + bool Disk::checkReadahead(BlkRequest * req){ // If read-ahead is involved, don't read from the table as normal. // The read-ahead judge is simplified here, and it is not suitable to all disks. diff --git a/omnetpp/dserver/disk/Disk.h b/omnetpp/dserver/disk/Disk.h index e490044..e36c76d 100644 --- a/omnetpp/dserver/disk/Disk.h +++ b/omnetpp/dserver/disk/Disk.h @@ -33,6 +33,7 @@ class Disk : public cSimpleModule{ long ra_size; // Read-ahead at the disk drive level. A simple algorithm is implemented. If ra_size < 0, that means ra is disabled. int return_zero; // Return zero after every access. static int idInit; + static int numDisk; FILE * debugfp; diff --git a/omnetpp/dserver/diskcache/DiskCache.cc b/omnetpp/dserver/diskcache/DiskCache.cc index 74bb466..32999af 100644 --- a/omnetpp/dserver/diskcache/DiskCache.cc +++ b/omnetpp/dserver/diskcache/DiskCache.cc @@ -18,6 +18,7 @@ Define_Module(DiskCache); int DiskCache::idInit = 0; +int DiskCache::numDiskCache=0; // Register the internal event types: // CACHE_ACCESS: cache access notifier // DIRTY_PAGE_EXPIRE: background write back notifier @@ -276,7 +277,15 @@ void DiskCache::file_ra_state::update_flag_incache(long s, int length, bool hit) void DiskCache::initialize() { - myID = idInit ++; + //In order to be coherent with the error message when application is rebuilt + //Parse only one time cause it's a static on the first call + if(idInit==0){ + numDiskCache=par("numDservers").longValue();//Suppose that there is 1 DiskCache per Server, If not change the omnet.ini and parse the correct value and change the variable in DiskCache.ned + } + myID = idInit ++; + if(myID>=numDiskCache-1){ + idInit=0; + } // receive parameters from ini file. total_pages = par("total_pages").longValue(); total_usable_pages = par("usable_pages").longValue(); diff --git a/omnetpp/dserver/diskcache/DiskCache.h b/omnetpp/dserver/diskcache/DiskCache.h index 60ecde5..f87b24f 100644 --- a/omnetpp/dserver/diskcache/DiskCache.h +++ b/omnetpp/dserver/diskcache/DiskCache.h @@ -31,6 +31,7 @@ class DiskCache : public cSimpleModule protected: int myID; static int idInit; + static int numDiskCache; struct pr_t { // page range type. unit: page. int fileid; long start; diff --git a/omnetpp/dserver/dsd/DSD_M.cc b/omnetpp/dserver/dsd/DSD_M.cc index 3570d3a..1b97ea8 100644 --- a/omnetpp/dserver/dsd/DSD_M.cc +++ b/omnetpp/dserver/dsd/DSD_M.cc @@ -18,13 +18,22 @@ using namespace std; int DSD_M::idInit = 0; +int DSD_M::numDSD=0; Define_Module(DSD_M); DSD_M::DSD_M() { } void DSD_M::initialize(){ - myID = idInit ++; + //In order to be coherent with the number of server: 0 for server 0 etc... + //Parse only one time cause it's a static on the first call + if(idInit==0){ + numDSD=par("numDservers").longValue();//Suppose that there is 1 DSD per Server, If not change the omnet.ini and parse the correct value + } + myID = idInit ++; + if(myID>=numDSD-1){ + idInit=0; + } packet_size_limit = par("packet_size_limit").longValue(); write_data_proc_time = par("write_data_proc_time").doubleValue(); parallel_job_proc_time = par("parallel_job_proc_time").doubleValue(); @@ -38,7 +47,7 @@ void DSD_M::initialize(){ int max_subreq_size = par("max_subreq_size").longValue(); if(!strcmp(pfsName, "pvfs2")){ - dsd = new PVFS2DSD(myID, degree, max_subreq_size); + dsd = new PVFS2DSD(myID, degree, max_subreq_size); }else{ PrintError::print("DSD_M", string("Sorry, parallel file system type ")+pfsName+" is not supported."); deleteModule(); @@ -78,6 +87,7 @@ void DSD_M::handleMessage(cMessage * cmsg) { handleSelfWriteReq(gpkt); break; + case SELF_PFS_R_REQ: case SELF_PFS_W_DATA: case SELF_PFS_W_DATA_LAST: enqueueDispatchVFSReqs(gpkt); @@ -262,9 +272,9 @@ void DSD_M::enqueueDispatchVFSReqs(gPacket * gpkt) { void DSD_M::dispatchVFSReqs(){ gPacket * jobtodispatch = NULL; - while(1){ - jobtodispatch = dsd->dispatchNext(); - if(jobtodispatch != NULL){ + //While(1)...break replace with the condition of end of the "if" + while((jobtodispatch = dsd->dispatchNext())!=NULL){ + //if(jobtodispatch != NULL){ #ifdef DSD_DEBUG cout << "[" << SIMTIME_DBL(simTime()) << "] DSD_M#" << myID << ": dispatch Job #" << jobtodispatch->getID() << " off = " @@ -276,8 +286,8 @@ void DSD_M::dispatchVFSReqs(){ jobtodispatch->setDispatchtime(SIMTIME_DBL(simTime())); jobtodispatch->setODIRECT(O_DIRECT); sendToVFS(jobtodispatch); - }else - break; + //}else + //break; } } diff --git a/omnetpp/dserver/dsd/DSD_M.h b/omnetpp/dserver/dsd/DSD_M.h index 65af0ec..e7308e9 100644 --- a/omnetpp/dserver/dsd/DSD_M.h +++ b/omnetpp/dserver/dsd/DSD_M.h @@ -24,6 +24,7 @@ class DSD_M : public cSimpleModule{ protected: static int idInit; + static int numDSD; int myID; int packet_size_limit; double parallel_job_proc_time; diff --git a/omnetpp/dserver/dsd/PVFS2DSD.cc b/omnetpp/dserver/dsd/PVFS2DSD.cc index 37e4ea1..a003612 100644 --- a/omnetpp/dserver/dsd/PVFS2DSD.cc +++ b/omnetpp/dserver/dsd/PVFS2DSD.cc @@ -67,6 +67,7 @@ void PVFS2DSD::newReq(gPacket * gpkt){ // The last data sub-request. // We push the original request to the subreqQ. gpkt->setKind(LFILE_REQ); + gpkt->setName("LFILE_REQ"); gpkt->setLowoffset(newinfo->loff); // This is necessary because you may have changed it due to // object size limit. diff --git a/omnetpp/dserver/lfs/EXT3.cc b/omnetpp/dserver/lfs/EXT3.cc index 7954400..9cfd4be 100644 --- a/omnetpp/dserver/lfs/EXT3.cc +++ b/omnetpp/dserver/lfs/EXT3.cc @@ -94,7 +94,8 @@ BlkRequest * EXT3::dispatchNext(){ int fid = pagereq->getFileId(); - int extindex = findExtEntry(fid, br->start); // The index of the extent. + int extindex = findExtEntry(fid, br->start);// The index of the extent. + //cout << "EXT3::dispatchNext(): extindex = " << extindex << ", br->start = " << br->start << endl; if(extindex < 0){ return NULL; }else if(extindex == extentryNum[fid]){ // Not allocated yet. diff --git a/omnetpp/dserver/lfs/ILFS.cc b/omnetpp/dserver/lfs/ILFS.cc index 5d82dfa..f361031 100644 --- a/omnetpp/dserver/lfs/ILFS.cc +++ b/omnetpp/dserver/lfs/ILFS.cc @@ -16,7 +16,7 @@ #include "lfs/ILFS.h" ILFS::ILFS(int id, int deg, long long disksize, int pagesize, int blksize, const char * inpath, const char * outpath) { - myId = id; + myId = id; degree = deg; page_size = pagesize; blk_size = blksize; @@ -130,8 +130,9 @@ int ILFS::findExtEntry(int fid, long logiaddr){ return -1; } - if(logiaddr == extlist[fid][end].logistart + extlist[fid][end].length) // Should create a new entry. + if(logiaddr == extlist[fid][end].logistart + extlist[fid][end].length){ // Should create a new entry. return extentryNum[fid]; + } while(1){ middle = (start + end) >> 1; if(logiaddr < extlist[fid][middle].logistart){ diff --git a/omnetpp/dserver/lfs/LFS_M.cc b/omnetpp/dserver/lfs/LFS_M.cc index fc50b38..c8bc7e3 100644 --- a/omnetpp/dserver/lfs/LFS_M.cc +++ b/omnetpp/dserver/lfs/LFS_M.cc @@ -23,6 +23,7 @@ Define_Module(LFS_M); int LFS_M::idInit = 0; +int LFS_M::nbDisk = 0; LFS_M::LFS_M() { } @@ -43,8 +44,15 @@ void LFS_M::initialize(){ lfs = new EXT3(idInit, degree, disk_size, page_size, blk_size, inextpath, outextpath, new_ext_size, new_ext_gap); else PrintError::print("LFS_M", string("Sorry, file system type ")+fsName+" is not supported."); - idInit ++; + //In order to rebuild simulation and parse the correct files + //Parse only one time cause it's a static on the first call + if(idInit == 1){ + nbDisk = par("numDservers").longValue();//Suppose that there is 1 Disk per Server, If not change the omnet.ini and parse the correct value + } + if(idInit >= nbDisk){ + idInit = 0; + } } void LFS_M::handleMessage(cMessage * cmsg){ diff --git a/omnetpp/dserver/lfs/LFS_M.h b/omnetpp/dserver/lfs/LFS_M.h index e9ce82e..ce9e3d6 100644 --- a/omnetpp/dserver/lfs/LFS_M.h +++ b/omnetpp/dserver/lfs/LFS_M.h @@ -25,6 +25,7 @@ using namespace std; class LFS_M : public cSimpleModule{ protected: static int idInit; + static int nbDisk; ILFS * lfs; public: LFS_M(); diff --git a/omnetpp/dserver/vfs/VFS.cc b/omnetpp/dserver/vfs/VFS.cc index 578775a..ee6fe96 100644 --- a/omnetpp/dserver/vfs/VFS.cc +++ b/omnetpp/dserver/vfs/VFS.cc @@ -136,8 +136,9 @@ void VFS::dispatchPageReqs(){ if(pgreq == NULL) break; if(pgreq->getODIRECT()){ - sendToLFS(pgreq); - pgreq->setKind(BLK_REQ); + pgreq->setKind(BLK_REQ); + pgreq->setName("BLK_REQ"); + sendToLFS(pgreq); }else{ sendToDiskCache(pgreq); } diff --git a/omnetpp/gen_exe.sh b/omnetpp/gen_exe.sh old mode 100755 new mode 100644 diff --git a/omnetpp/gen_input.sh b/omnetpp/gen_input.sh old mode 100755 new mode 100644 index ff61447..e9f0b17 --- a/omnetpp/gen_input.sh +++ b/omnetpp/gen_input.sh @@ -3,11 +3,11 @@ CLT_NUM=16 TRC_PER_CLT=2 SVR_NUM=8 -FILE_NUM=$(echo "$CLT_NUM*$TRC_PER_CLT" | bc) FILE_SIZE=536870912 REQ_SIZE=1048576 READ_FLAG=1 STRIPE_SIZE=64K +FILE_PER_PROCESS=1 for WORD in "$@"; do @@ -22,17 +22,55 @@ do --help) echo "Options:" echo "--python-prefix= # Provide the path to the python binary directory." + echo "--client= # Provide the number of client" + echo "--trace-num= # Provide the number of trace per client" + echo "--server= # Provide the number of server" + echo "--file-size= # Provide the size of file (in byte)" + echo "--req-size= # Provide the size of each quantity of data asks by client in one time (in byte)" + echo "--read= # 0 for write file/1 read file" + echo "--stripe-size= # Provide the stripe-size : Don't forget the unit at the end : K for KB, M for MB" + echo "--uniq-shared-file= #Provide one file shared between clients" echo "--help # Print this information." exit ;; + --client=*) + CLT_NUM=${WORD:9} + shift ;; + --trace-num=*) + TRC_PER_CLT=${WORD:12} + shift ;; + --server=*) + SVR_NUM=${WORD:9} + shift ;; + --file-size=*) + FILE_SIZE=${WORD:12} + shift ;; + --req-size=*) + REQ_SIZE=${WORD:11} + shift ;; + --read=*) + READ_FLAG=${WORD:7} + shift ;; + --stripe-size=*) + STRIPE_SIZE=${WORD:14} + shift ;; + --uniq-shared-file) + FILE_PER_PROCESS=0 + shift ;; *) echo "Unrecognized argument: " $WORD exit ;; esac done +if [ $FILE_PER_PROCESS -eq 1 ]; +then + FILE_NUM=$(echo "$CLT_NUM*$TRC_PER_CLT" | bc) +else + FILE_NUM=1 +fi cd input/synthetic -${PYTHON_PREFIX}python ./gen.py $CLT_NUM $TRC_PER_CLT $FILE_SIZE $REQ_SIZE $READ_FLAG +${PYTHON_PREFIX}python ./gen.py $CLT_NUM $TRC_PER_CLT $FILE_SIZE $REQ_SIZE $READ_FLAG $FILE_PER_PROCESS cd ../.. cd config/pfslayout/synthetic/even-dist diff --git a/omnetpp/ini/io.ini b/omnetpp/ini/io.ini index 0241774..5437abb 100644 --- a/omnetpp/ini/io.ini +++ b/omnetpp/ini/io.ini @@ -1,7 +1,7 @@ ########################################################## -# -# The paths for all input and output files. -# +# # +# The paths for all input and output files. # +# # ########################################################## [General] diff --git a/omnetpp/ini/pfs.ini b/omnetpp/ini/pfs.ini index e772de1..79f496a 100644 --- a/omnetpp/ini/pfs.ini +++ b/omnetpp/ini/pfs.ini @@ -9,7 +9,6 @@ # Set PFS name to client and metadata server. **.c[*].pfsclient.pfs_client_signature = "PVFS2" **.ms.pfs_metadataserver_signature = "PVFS2" - **.c[*].pfsclient.packet_size_limit = 16384 **.c[*].pfsclient.small_io_size_threshold = 16384 **.c[*].pfsclient.max_transfer_window_size = 10485760 # 10MB window size diff --git a/omnetpp/input/synthetic/gen.py b/omnetpp/input/synthetic/gen.py old mode 100755 new mode 100644 index 8c9d59f..c28b637 --- a/omnetpp/input/synthetic/gen.py +++ b/omnetpp/input/synthetic/gen.py @@ -1,8 +1,8 @@ import random import sys -if (len(sys.argv) != 6): - print sys.argv[0], " " +if (len(sys.argv) != 7): + print sys.argv[0], " " sys.exit() read = int(sys.argv[5]) @@ -10,12 +10,13 @@ print "read value should be 1 or 0" sys.exit() -print "Generating input files. Number of clients:", sys.argv[1], " number of traces per client: ", sys.argv[2], " total size: ", sys.argv[3], " request size:", sys.argv[4], " read: ", sys.argv[5] +print "Generating input files. Number of clients:", sys.argv[1], " number of traces per client: ", sys.argv[2], " total size: ", sys.argv[3], " request size:", sys.argv[4], " read: ", sys.argv[5], " file-per-proc: ", sys.argv[6] nclient = int(sys.argv[1]) ntrace = int(sys.argv[2]) tsize = long(sys.argv[3]) size = long(sys.argv[4]) +file_per_process = int(sys.argv[6]) nline = int(tsize / size) time = 0 @@ -45,5 +46,6 @@ offset += size sync = 1 time = 0 - fid += 1 + if file_per_process == 1: + fid += 1 f.close() diff --git a/omnetpp/iostreamer/istreamer/PFSFileInputStreamer.cc b/omnetpp/iostreamer/istreamer/PFSFileInputStreamer.cc index bd755e3..580b99d 100644 --- a/omnetpp/iostreamer/istreamer/PFSFileInputStreamer.cc +++ b/omnetpp/iostreamer/istreamer/PFSFileInputStreamer.cc @@ -48,14 +48,18 @@ PFSFiles * PFSFileInputStreamer::readPFSFiles() { } if(line[i] == 'k' || line[i] == 'K'){ sep = true; - if(val == -1) // Useless label if there's no numeral part right before k. - continue; + if(val == -1){ // Useless label if there's no numeral part right before k. + i++; + continue; + } val = val * KiloUnitConvertion; } if(line[i] == 'm' || line[i] == 'M'){ sep = true; - if(val == -1) // Useless label if there's no numeral part right before m. - continue; + if(val == -1){ // Useless label if there's no numeral part right before m. + i++; + continue; + } val = val * KiloUnitConvertion * KiloUnitConvertion; } diff --git a/omnetpp/mserver/MetadataServer.cc b/omnetpp/mserver/MetadataServer.cc index 0c0fc66..34d483a 100644 --- a/omnetpp/mserver/MetadataServer.cc +++ b/omnetpp/mserver/MetadataServer.cc @@ -18,12 +18,20 @@ Define_Module(MetadataServer); int MetadataServer::initID = 0; +int MetadataServer::numMetaServer=0; void MetadataServer::initialize() { + //Parse only one time cause it's a static on the first call + if(initID == 0){ + numMetaServer = par("numMetaServer").longValue(); + } myID = initID; initID ++; - + //In order to rebuild simulation and keep the ID + if(initID >=numMetaServer){ + initID=0; + } metadataPacketProcessTime = par("metadata_proc_time").doubleValue(); dataPacketProcessTime = par("data_proc_time").doubleValue(); diff --git a/omnetpp/mserver/MetadataServer.h b/omnetpp/mserver/MetadataServer.h index 9dd350b..a128c95 100644 --- a/omnetpp/mserver/MetadataServer.h +++ b/omnetpp/mserver/MetadataServer.h @@ -21,6 +21,7 @@ class MetadataServer : public cSimpleModule protected: int myID; static int initID; + static int numMetaServer; PFSMetadataServerStrategy * pfsMetadataServerStrategy; diff --git a/omnetpp/ned/client/Application.ned b/omnetpp/ned/client/Application.ned index ae33257..6c476ab 100644 --- a/omnetpp/ned/client/Application.ned +++ b/omnetpp/ned/client/Application.ned @@ -20,6 +20,7 @@ simple Application string trace_output_file_postfix; int trace_count; + int numClients; int trace_file_trace_index_digits; int trace_file_client_index_digits; diff --git a/omnetpp/ned/client/PFSClient.ned b/omnetpp/ned/client/PFSClient.ned index 2c068c4..b654882 100644 --- a/omnetpp/ned/client/PFSClient.ned +++ b/omnetpp/ned/client/PFSClient.ned @@ -4,6 +4,7 @@ simple PFSClient { parameters: string pfs_client_signature; + int numClients; // Time overhead. double data_packet_process_time; diff --git a/omnetpp/ned/dataserver/DSD_M.ned b/omnetpp/ned/dataserver/DSD_M.ned index 70a1cdd..4186ae2 100644 --- a/omnetpp/ned/dataserver/DSD_M.ned +++ b/omnetpp/ned/dataserver/DSD_M.ned @@ -13,7 +13,7 @@ simple DSD_M int packet_size_limit; int degree; string pfsname; - + int numDservers; int O_DIRECT; // If set, the IO will go directly to the LFS. gates: inout eth; diff --git a/omnetpp/ned/dataserver/Disk.ned b/omnetpp/ned/dataserver/Disk.ned index 82793aa..233c507 100644 --- a/omnetpp/ned/dataserver/Disk.ned +++ b/omnetpp/ned/dataserver/Disk.ned @@ -9,6 +9,7 @@ simple Disk string disk_parm_path; int return_zero; double return_zero_period; + int numDservers; @display("i=device/disk"); gates: inout g; diff --git a/omnetpp/ned/dataserver/DiskCache.ned b/omnetpp/ned/dataserver/DiskCache.ned index 89a8bda..b37bae6 100644 --- a/omnetpp/ned/dataserver/DiskCache.ned +++ b/omnetpp/ned/dataserver/DiskCache.ned @@ -15,6 +15,7 @@ simple DiskCache{ int writeout_batch; // The number of pages to write back when the dirty_ratio is met. int diskread_batch; // The max number of pages to read each time. int disable_ra; // Read ahead can be shut off by tunning it to 1. + int numDservers; @display("i=device/memory"); gates: inout vfs; diff --git a/omnetpp/ned/dataserver/LFS_M.ned b/omnetpp/ned/dataserver/LFS_M.ned index 8795a4a..97d2f97 100644 --- a/omnetpp/ned/dataserver/LFS_M.ned +++ b/omnetpp/ned/dataserver/LFS_M.ned @@ -11,6 +11,7 @@ simple LFS_M { double disk_size; string ext_in_path_prefix; string ext_out_path_prefix; + int numDservers; @display("i=device/device"); gates: inout diskcache; diff --git a/omnetpp/ned/metadataserver/MetadataServer.ned b/omnetpp/ned/metadataserver/MetadataServer.ned index 36049e6..9d616c0 100644 --- a/omnetpp/ned/metadataserver/MetadataServer.ned +++ b/omnetpp/ned/metadataserver/MetadataServer.ned @@ -16,6 +16,8 @@ simple MetadataServer string pfs_input_file_prefix; string pfs_input_file_postfix; + int numMetaServer; + @display("i=device/mainframe"); bool sendInitialMessage = false; gates: diff --git a/omnetpp/ned/pfssim_1.ned b/omnetpp/ned/pfssim_1.ned index 8bd248f..3ca456b 100644 --- a/omnetpp/ned/pfssim_1.ned +++ b/omnetpp/ned/pfssim_1.ned @@ -12,6 +12,7 @@ network pfssim_1 int numClients; int numDservers; int numProxies; + int numMetaServer; types: channel Channel extends ned.DatarateChannel { diff --git a/omnetpp/ned/proxy/Proxy.ned b/omnetpp/ned/proxy/Proxy.ned index 4e01966..1c7fe4a 100644 --- a/omnetpp/ned/proxy/Proxy.ned +++ b/omnetpp/ned/proxy/Proxy.ned @@ -12,6 +12,7 @@ simple Proxy double newjob_proc_time; double finjob_proc_time; int numApps; + int numProxies; @display("i=device/server2"); bool sendInitialMessage = false; gates: diff --git a/omnetpp/omnetpp.ini b/omnetpp/omnetpp.ini index a53a719..1a60223 100644 --- a/omnetpp/omnetpp.ini +++ b/omnetpp/omnetpp.ini @@ -6,6 +6,7 @@ sim-time-limit = 500s **.numClients = 16 **.numDservers = 8 **.numProxies = 8 +**.numMetaServer = 1 **.proxy[*].numApps = 2 **.c[*].application.trace_count = 2 diff --git a/omnetpp/proxy/Proxy.cc b/omnetpp/proxy/Proxy.cc index 09194e1..5a06c28 100644 --- a/omnetpp/proxy/Proxy.cc +++ b/omnetpp/proxy/Proxy.cc @@ -5,13 +5,21 @@ Define_Module(Proxy); int Proxy::proxyID = 0; +int Proxy::numProxies=0; Proxy::Proxy() { } void Proxy::initialize(){ - myID = proxyID; - proxyID ++; + //In order to rebuild Network with the correct ID. + if(proxyID==0){//Parse only one time cause it's a static on the first call + numProxies=par("numProxies").longValue(); + } + myID = proxyID; + proxyID ++; + if(proxyID>=numProxies){ + proxyID=0; //The last call reset the proxyID + } algorithm = par("algorithm").stringValue(); const char * alg_param =par("alg_param").stringValue(); diff --git a/omnetpp/proxy/Proxy.h b/omnetpp/proxy/Proxy.h index 70bb262..5063688 100644 --- a/omnetpp/proxy/Proxy.h +++ b/omnetpp/proxy/Proxy.h @@ -25,6 +25,7 @@ class Proxy : public cSimpleModule{ protected: static int proxyID; + static int numProxies; int myID; const char * algorithm; int degree; diff --git a/omnetpp/router/Queue.cc b/omnetpp/router/Queue.cc index 2818049..662b619 100644 --- a/omnetpp/router/Queue.cc +++ b/omnetpp/router/Queue.cc @@ -41,16 +41,16 @@ void Queue::handleMessage(cMessage *msg){ else if(msg->arrivedOn("line$i")){ // from the outside send(msg,"out"); } - else{// from the Routing module - if (endTransmissionEvent->isScheduled()){ - // We are currently busy, so just queue up the packet. - queue->insert(msg); - } - else{ - // We are idle, so we can start transmitting right away. - startTransmitting(msg); - } - } + else{// from the Routing module + if (endTransmissionEvent->isScheduled()){ + // We are currently busy, so just queue up the packet. + queue->insert(msg); + } + else{ + // We are idle, so we can start transmitting right away. + startTransmitting(msg); + } + } } void Queue::finish(){ diff --git a/omnetpp/trace/WindowBasedTrace.cc b/omnetpp/trace/WindowBasedTrace.cc index e62fe1b..271090b 100644 --- a/omnetpp/trace/WindowBasedTrace.cc +++ b/omnetpp/trace/WindowBasedTrace.cc @@ -68,8 +68,11 @@ gPacket * WindowBasedTrace::getNextgPacketFromWindow(){ for(int i = 0; i < layout->getServerNum(); i ++){ if(dataSizeInWindow[i] > 0){ // Unsent packet = new gPacket(); + //cout << " The offset of the data stored on server "<< i <<" is : "<< dsoffsets[i] << endl; packet->setLowoffset(dsoffsets[i] % LOWOFFSET_RANGE); + //cout << " The lowoffset of the data stored on server "<< i <<" is : "<< dsoffsets[i] % LOWOFFSET_RANGE << endl; packet->setHighoffset(dsoffsets[i] / LOWOFFSET_RANGE); + //cout << " The lowoffset of the data stored on server "<< i <<" is : "<< dsoffsets[i] / LOWOFFSET_RANGE << endl; packet->setSize(dataSizeInWindow[i]); sentPktSize[i] = dataSizeInWindow[i]; packet->setRead(read); @@ -142,7 +145,6 @@ bool WindowBasedTrace::openNewWindow(){ // Understand it with setLayout method. Reduce the access size with the offset inside the access. firsttime = false; } - if(sizeInc < leftAggSize){ dataSizeInWindow[i] += sizeInc; leftAggSize -= sizeInc; @@ -198,7 +200,6 @@ gPacket * WindowBasedTrace::nextgPacket() { return NULL; } } - // All the packets from the current window are sent and received. if(! openNewWindow()) { return NULL; diff --git a/omnetpp/trace/WindowBasedTrace.h b/omnetpp/trace/WindowBasedTrace.h index 73d814c..bd8b0fd 100644 --- a/omnetpp/trace/WindowBasedTrace.h +++ b/omnetpp/trace/WindowBasedTrace.h @@ -26,9 +26,9 @@ // This class only represents one request from the client, it may be divided into multiple packets. class WindowBasedTrace : public ITrace { private: - const static int SW_SENT; // 0: The data request is sent. + const static int SW_SENT; // -2: The data request is sent. const static int SW_RECEIVED; // -1: For the server window: received the reply for this request. - const static int SW_NULL; // -2: This data server slot does not need to be accessed. + const static int SW_NULL; // 0: This data server slot does not need to be accessed. Layout * layout;