scripts to compile sample_app3 are added

This commit is contained in:
Cagatay Sonmez 2018-11-26 01:50:47 -07:00
parent 95edf172fe
commit ea6f3d1088
4 changed files with 82 additions and 0 deletions

4
scripts/sample_app3/compile.sh Executable file
View File

@ -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

View File

@ -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

18
scripts/sample_app3/runner.sh Executable file
View File

@ -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

View File

@ -0,0 +1 @@
default_config;edge_devices.xml;applications.xml