From ea6f3d10881b97fb92860944c8d1c3c1b730299e Mon Sep 17 00:00:00 2001 From: Cagatay Sonmez Date: Mon, 26 Nov 2018 01:50:47 -0700 Subject: [PATCH] scripts to compile sample_app3 are added --- scripts/sample_app3/compile.sh | 4 ++ scripts/sample_app3/run_scenarios.sh | 59 ++++++++++++++++++++++++++++ scripts/sample_app3/runner.sh | 18 +++++++++ scripts/sample_app3/simulation.list | 1 + 4 files changed, 82 insertions(+) create mode 100755 scripts/sample_app3/compile.sh create mode 100755 scripts/sample_app3/run_scenarios.sh create mode 100755 scripts/sample_app3/runner.sh create mode 100644 scripts/sample_app3/simulation.list diff --git a/scripts/sample_app3/compile.sh b/scripts/sample_app3/compile.sh new file mode 100755 index 0000000..cfb470c --- /dev/null +++ b/scripts/sample_app3/compile.sh @@ -0,0 +1,4 @@ +#!/bin/sh +rm -rf ../../bin +mkdir ../../bin +javac -classpath "../../lib/cloudsim-4.0.jar:../../lib/commons-math3-3.6.1.jar:../../lib/colt.jar" -sourcepath ../../src ../../src/edu/boun/edgecloudsim/applications/sample_app3/MainApp.java -d ../../bin diff --git a/scripts/sample_app3/run_scenarios.sh b/scripts/sample_app3/run_scenarios.sh new file mode 100755 index 0000000..c770335 --- /dev/null +++ b/scripts/sample_app3/run_scenarios.sh @@ -0,0 +1,59 @@ +#!/bin/bash +if [ "$#" -ne 2 ]; then + echo "Missing arguments! Please provide number of parallel processes and number of iterations." + echo "Usage: '$0 4 10'" + exit 1 +fi + +re='^[0-9]+$' +if ! [[ $1 =~ $re ]] ; then + echo "$1 is not an integer! Please provide number of parallel processes." + echo "Usage: '$0 4 10'" + exit 1 +fi + +if ! [[ $2 =~ $re ]] ; then + echo "$1 is not an integer! Please provide number of iterations." + echo "Usage: '$0 4 10'" + exit 1 +fi + +script_root_path="$(dirname "$(readlink -f "$0")")" +root_out_folder=${script_root_path}/output +num_of_processes=$1 +iterationNumber=$2 +process_counter=0 + +date=$(date '+%d-%m-%Y_%H-%M') +simulation_out_folder=${root_out_folder}/${date} +mkdir -p $simulation_out_folder + +simulations=$(cat ${script_root_path}/simulation.list) + +rm -rf ${script_root_path}/tmp_runner* + +for sim_args in $simulations +do + scenario_name=$(echo $sim_args | cut -d ';' -f1) + edge_devices_file=$(echo $sim_args | cut -d ';' -f2) + applications_file=$(echo $sim_args | cut -d ';' -f3) + for (( i=1; i<=$iterationNumber; i++ )) + do + process_id=$(($process_counter % $num_of_processes)) + process_counter=$(($process_counter + 1)) + + echo "${script_root_path}/runner.sh $simulation_out_folder $scenario_name $edge_devices_file $applications_file ${i}" >> "${simulation_out_folder}/tmp_runner${process_id}.sh" + done +done + +#num_of_cores=$(grep -c ^processor /proc/cpuinfo) + +for (( i=0; i<$num_of_processes; i++ )) +do + chmod +x ${simulation_out_folder}/tmp_runner${i}.sh + ${simulation_out_folder}/tmp_runner${i}.sh & + +# pid=$! +# cpu=$(($i % $num_of_cores)) +# taskset -cp $cpu,$cpu $pid +done diff --git a/scripts/sample_app3/runner.sh b/scripts/sample_app3/runner.sh new file mode 100755 index 0000000..e0b5368 --- /dev/null +++ b/scripts/sample_app3/runner.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +script_root_path="$(dirname "$(readlink -f "$0")")" +simulation_out_folder=$1 +scenario_name=$2 +edge_devices_file=$3 +applications_file=$4 +iteration_number=$5 + +scenario_out_folder=${simulation_out_folder}/${scenario_name}/ite${iteration_number} +scenario_conf_file=${script_root_path}/config/${scenario_name}.properties +scenario_edge_devices_file=${script_root_path}/config/${edge_devices_file} +scenario_applications_file=${script_root_path}/config/${applications_file} + +mkdir -p $scenario_out_folder +java -classpath '../../bin:../../lib/cloudsim-4.0.jar:../../lib/commons-math3-3.6.1.jar:../../lib/colt.jar' edu.boun.edgecloudsim.applications.sample_app3.MainApp $scenario_conf_file $scenario_edge_devices_file $scenario_applications_file $scenario_out_folder $iteration_number > ${scenario_out_folder}.log +tar -czf ${scenario_out_folder}.tar.gz -C $simulation_out_folder/${scenario_name} ite${iteration_number} +rm -rf $scenario_out_folder diff --git a/scripts/sample_app3/simulation.list b/scripts/sample_app3/simulation.list new file mode 100644 index 0000000..3a4122a --- /dev/null +++ b/scripts/sample_app3/simulation.list @@ -0,0 +1 @@ +default_config;edge_devices.xml;applications.xml \ No newline at end of file