Skip to content

codes cortex python gen

Matthieu Dorier edited this page Dec 16, 2016 · 2 revisions

Running CODES with a Python workload generator

This section assumes you have installed CODES with Cortex and Python enabled, as described here. If you want to generate the MPI events from a Python script instead of reading them from a DUMPI trace, do as follows.

Preparing configuration files

Follow the same procedure as here (don't use the bash script to generate the allocation file since you don't have traces to work with. Generate the allocation file manually.)

Prepare a Python script to generate the MPI events

An example of such a script:

import cortex

def GenerateEvents(thread):
   print "Generating events for rank ",thread
   if thread == 0:
       cortex.MPI_Send(thread,count=1,datatype=4,dest=1,tag=1234,comm=2)
   if thread == 1:
       cortex.MPI_Recv(thread,count=1,datatype=4,source=0,tag=1234,comm=2,status=cortex.MPI_Status())

Call this script MyGenerator.py.

Run your experiment

The following script should help you automatize the run:

#!/bin/sh

PYTHON_MOD=MyGenerator
PYTHON_GEN=GenerateEvents
OUTPUT_DIR="results"

CODES="$HOME/CODES/install/codes/bin/model-net-mpi-replay"
NUM_RANKS=2

PARAMS="--sync=1 \
        --num_net_traces=$NUM_RANKS \
        --workload_file=none \
        --lp-io-dir=$OUTPUT_DIR \
        --lp-io-use-suffix=1 \
        --workload_type=dumpi \
        --alloc_file=alloc.conf" \
        --cortex-file=$PYTHON_MOD \
        --cortex-gen=$PYTHON_GEN

CONFIG="config.conf"

$CODES $PARAMS -- $CONFIG
Clone this wiki locally