Simulation vs Emulation

Many times I can see these two different terms being used the other way around in articles. Simulation (προσομοίωση) is the process of modelling an event or process in a virtual environment. The model is aware that is being simulated and is different that the real one. It is used to represent the actual model/object. Emulation (εξομοίωση) on the other hand, is the process of creating the desired environment for an application, or an object in general, to act like being in the expected environment. For instance, a standard i386 Linux OS can be emulated on a i386 virtual machine that runs on PPC hardware. Emulation mimics what is excepted by the targeted object. The LHC can be simulated in a computer model. The first moments of the big bang will be emulated within the physical accelerator. Particles are not aware where they are physically.

Simple and very basic PBS/Torque emulator

PBS (Portable Batch System) is one of the common batch systems used across clusters. Unfortunately, proprietary piece of software. There used to be an open source version, OpenPBS which has been forked to Torque. Torque can be installed and configured to perform the basic operations within 15-20 minutes. Although, for evaluation purposes, I have wrote a *very simple* emulator for PBS/Torque. All it provides is three scripts:

qsub -> submitting a job
qstat -> displaying job list
qdel -> removing job(s)

A virtual job can be submitted, without need of proper PBS or Torque-like submission script and other parameters. The parameters each script is accepting are:

qsub – single virtual job: qsub test
– qstat – either username to list jobs of a user or none to list all jobs: qstat foobar
– qdel – single or list of job IDs to remove: qdel 1234 5678

Download: pbs-emu-0.1.tar.gz

Ποιότητα και συνθήκες κάνουν τη διαφορά

Μακρυά από τη μιζέρια της νεο-ελληνικής πραγματικότητας, προ-κρίσης όσο και κατά τη διάρκεια αλλά και την μετά…

Από τον Όλυμπο στο Έβερεστ – http://www.anevenontas.gr/news/mountain/189-apo-ton-olimpo-sto-everest

Ναυτίλος – Εξερευνήσεις στις Ελληνικές Θάλασσες – http://www.explorenautilus.com

Speedup and efficiency shell calculator

The following script can be used to calculate the speedup and efficiency of a parallel code when compared to its serial version. Pretty much straight forward process. This script can be used either individually or as part of another script to automate the process of generating the required results. It accepts three arguments: 1) serial execution time 2) parallel execution time 3) number of processors.

./SEcalc.sh <serial> <parallel> <procs>

Script:

############################################################################
# Copyright (C) 2011  Panagiotis Kritikakos <panoskrt@gmail.com>           #
#                                                                          #
#    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 3 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, see <http://www.gnu.org/licenses/>. #
############################################################################

#!/bin/bash

if [ "$#" -eq "3" ]; then
   runtime1proc=$1
   runtimeNproc=$2
   totalprocs=$3
   speedup=`echo "${runtime1proc}/${runtimeNproc}" | bc -l`;
   efficiency=`echo "${speedup}/${totalprocs}" | bc -l`;

   printf "\n Total processors: ${totalprocs}\n\n";
   printf " Runtime for serial code: ${runtime1proc}\n Runtime for parallel code: \
   ${runtimeNproc}\n\n";
   printf " Speedup: ${speedup}\n Efficiency: ${efficiency}\n\n";
else
   printf "\n Usage: SEcalc.sh   \n\n";
   printf " SEcalc.sh 0.350 0.494 2\n\n";
fi

OpenNebula DHCP leases – automatic lease discovery

OpenNebula uses a network template file that lists all the available IPs within a specific network that can be given to the Virtual Machines on an OpenNebula deployment. The template can define more details such as gateway, resolves, network class and so on. In our case, we just need a list of available leases for the VMs to pick up. The following script automates the process of getting listed all the available IPs within the network range of the bridged interface of the OpenNebula host machine, starting from checking the first IP after that of the bridged interface.

############################################################################
# Copyright (C) 2011  Panagiotis Kritikakos <pkritika@epcc.ed.ac.uk>       #
#                                                                          #
#    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 3 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, see <http://www.gnu.org/licenses/>. #
############################################################################

#!/bin/bash

if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
 echo
 echo " This script will generate the appropriate leases for the Open Nebula Virtual
         Machines."
 echo " It will generate leases that for unused IPs that map to the bridged interface."
 echo
 echo " The default bridge interface is br0. If you want to change this, pass another
        interface as an argument."
  echo
  exit
fi

if [ "$1" == "" ]; then
  BRIDGE=br0
else
  BRIDGE=$1
fi

IPADDR=`ifconfig $BRIDGE | grep "inet addr" | awk {'print $2'} | sed s/addr:*//g`
BCAST=`ifconfig $BRIDGE | grep "inet addr" | awk {'print $3'} | sed s/Bcast:*//g`
MASK=`ifconfig $BRIDGE | grep "inet addr" | awk {'print $4'} | sed s/Mask:*//g`
if [ -e /etc/debian_version ]; then
  NETWORK=`ipcalc -n $IPADDR $MASK | grep Network | awk {'print $2'} | sed 's/\./ /g' \
| awk {'print $1"."$2"."$3'}`
else
  NETWORK=`ipcalc -n $IPADDR $MASK | sed s/NETWORK=*//g | sed 's/\./ /g' | \
awk {'print $1"."$2"."$3'}`
fi

IPOCT=`ifconfig $BRIDGE | grep "inet addr" | awk {'print $2'} | sed s/addr:*//g | \
sed 's/\./ /g' | awk {'print $4'}`
BCASTOCT=`ifconfig $BRIDGE | grep "inet addr" | awk {'print $3'} | sed s/Bcast:*//g | \
sed 's/\./ /g' | awk {'print $4'}`

hostMin=$(($IPOCT + 1))
hostMax=$(($BCASTOCT - 2))
totalIP=$(($hostMax - $hostMin))

echo
echo " $(($totalIP + 1)) IPs will be checked for availability.
       That might take some time..."
iter=1

ONNET_FILE=hpce2_network.net

printf 'NAME = "HPCE2"\n' > $ONNET_FILE
printf 'TYPE = FIXED\n\n' >> $ONNET_FILE
printf "BRIDGE = ${BRIDGE}\n" >> $ONNET_FILE
echo
for LEASE in `seq $hostMin $hostMax`
do
  echo -n $iter " "
  ping -c 1 ${NETWORK}.$LEASE -W 1 > /dev/null;
  if [ $? -ne 0 ]; then
    printf 'LEASES = [ IP=''"'$NETWORK.$LEASE'"''] \n' >> $ONNET_FILE
  fi
  let iter++
done
echo
echo