Archer:Simnow on Condor

From Grid-Appliance Wiki

Jump to: navigation, search

Contents

Pre-requisites

This tutorial assumes that you have gone through Archer:SimNow and are familiar with the Archer Express and Archer Global tutorials.

Introduction

To run a job in condor, you would have to use the non-GUI mode of SimNow (start it with the -c or --nogui option set). The simulator can be controlled externally through a scripting interface by issuing automation commands. These commands are directed toward either the shell, or toward any device that is part of the currently loaded BSD. A list of all the automation commands in SimNow can be found in Appendix A.7 of the SimNow Users Guide.

Here is a sample simulation job which shows the disassembly of the instructions executed by the processor and uses SimNow's code profiling facility to dump the five most frequently executing blocks.

Files used in the example

This condor job uses three files: condor_script, simnow_wrapper, simnow_commands.

  • Condor Submit File

This is the condor submit file. This file tells Condor which files to transfer before and after running a job, which binary to execute, and requirements for the machines that will run the job. Here is a template condor submit file for this simulation.

condor_script:

Universe = vanilla
Executable = simnow_wrapper.sh
Log = simnow.$(Cluster).$(Process).log
Output = simnow.$(Cluster).$(Process).out
Error = simnow.$(Cluster).$(Process).err
should_transfer_files = YES
when_to_transfer_output = ON_EXIT
transfer_input_files =  simnow_commands
transfer_output_files = screen_dump.out, disassembly.log.tgz
Requirements = Arch == "X86_64" && Target.CondorVersion != "$CondorVersion: 7.0.1 Feb 26 2008 BuildID: 76180 $"
queue

Note that "Requirements" field specifies that this job should be run only of 64-bit machines in the appliance pool. If your job needs more memory, you can also specify that using this field. For eg:

Requirements = (Arch == "X86_64" && Memory > 1500)
  • SimNow Wrapper Script

This is a wrapper script and is the first thing that is executed when a job submitted through Condor finds a destination host to run. There are many ways to create such a wrapper script, and this is dependent upon the application you are running. The following is a template using Bash that works with SimNow. This script runs using the simnow binaries, shared libraries, a hard disk image with Debian Linux installed and a bsd file with the saved state of the simulated machine which are hosted on a remote machine (C001001250)

simnow_wrapper.sh:

#!/bin/bash
ln -s /mnt/ganfs/C001001250/simnow-linux64-4.5.2pub/* .
export LD_LIBRARY_PATH=`pwd`/libs:`pwd`/linuxlibs:`pwd`/local_lib
./simnow -f ./bsds/melody_1p_64MB_debian.bsd -i ./Images -e simnow_commands -n -c -d > screen_dump.out 2> /dev/null
tar czf disassembly.log.tgz disassembly.log
  • SimNow Command File

This is a file containing the SimNow automation commands. It instructs simnow to do the simulations for 1 millisecond and log disassembly of the instructions executed by the processor model. It uses the sample cpu analyzer provided by SimNow (cpulogger.so) to do this. The cpulogger analyzer can take the following arguments:

-d (disassembly)
-s (state changes)
-i (I/O)
-m (memory)
-e (exceptions & interrupts)

Another sample analyzer provided is "revf_cache.so". One can also write the code and create analyzers for SimNow by implementing the Analyzer interface. Check the Analyzer Developer’s Guide in the "./devel/analyzers" directory of SimNow package for more details.

Once the simulation is done, the simnow_command script issues the dumpprofile command to display the five most frequently executed blocks in the simulation period. Note that profiling in the simulator has some limitations and features not present in most systems. The details are mentioned in section A.7.17.1 of SimNow Users Guide.

simnow_commands:

SetLogFile disassembly.log
SetLogFileEnabled 1
cpu.LoadAnalyzer cpulogger.so -d
LogConsoleEnabled
SetLogConsoleEnabled 0
RunTimeDuration 1000
Go
dumpprofile 5
Close
Wait
Exit

Submitting the condor job

  • In the appliance, create a folder containing the files by using the below commands:
tar -xzf /mnt/ganfs/C001001250/simnow_condor_example.tgz
cd simnow_condor_example
  • To submit the job:
condor_submit condor_script
  • To track the progress of the job:
condor_q
  • Note: it will take around 10-20 minutes for this job to finish (if there are resources immediately available). When the job finishes executing, you should see the screen_dump.out file for the output of the dumpprofile instruction. The disassembly of instructions is saved in compressed file: disassembly.log.tgz
tar xzf disassembly.log.tgz
more disassembly.log
more screen_dump.out
Personal tools