Running CODES with DUMPI and Python translations
If you want to couple the use of DUMPI traces but write your own translation functions in Python, start by making sure Section III works.
Instead of providing a generator function in your Python script, provide translation functions. For example, a possible translation for MPI_Bcast would be:
import cortex
def MPI_Bcast(self, thread, **args):
dtype = args['datatype']
root = args['root']
comm = args['comm']
count = args['count']
print "MPI_Bcast called in Python, root = ", root
if not cortex.is_mpi_comm_world(comm):
print "Communicator is not MPI_COMM_WORLD, not translating"
return
if thread != root :
s = cortex.MPI_Status()
cortex.MPI_Recv(thread,count=count,datatype=dtype,source=root,tag=1234,comm=comm,status=s)
else :
size = cortex.world_size()
for i in range(size):
if i != thread:
cortex.MPI_Send(thread,count=count,datatype=dtype,dest=i,tag=1234,comm=comm)
Let's call this script MyTranslator.py.
Set up the DUMPI traces folder as explained in the previous pages of this tutorial. Then the following bash script should help you run your experiments:
#!/bin/sh
TRACE_DIR="traces/neurones"
TRACE_PFX="dumpi-2016.09.14.15.05.22-"
OUTPUT_DIR="results"
PYTHON_MOD=MyTranslator
CODES="$HOME/CODES/install/codes/bin/model-net-mpi-replay"
NUM_TRACES=`ls -l $TRACE_DIR/$TRACE_PFX* | wc -l`
PARAMS="--sync=1 \
--num_net_traces=$NUM_TRACES \
--workload_file=$TRACE_DIR/$TRACE_PFX \
--lp-io-dir=$OUTPUT_DIR \
--lp-io-use-suffix=1 \
--workload_type=dumpi \
--alloc_file=alloc.conf \
--cortex-file=$PYTHON_MOD"
CONFIG="config.conf"
$CODES $PARAMS -- $CONFIG