Custom Plug-in Framework

The Custom Plug-in Framework (CPF) enables you to write your own simulators using the provided API. For example, Ideal Interconnect Simulator (IIS) is implemented using this framework. Custom developed simulators can interact with trace files from the Intel® Trace Analyzer and can model any condition you can think of. 

CPF implementation works with traces that were obtained from applications that pass correctly message checking. To use CPF, install Intel® compilers on the systems where you are building your simulator and where you are running CPF.

Usage Instructions

Use the CLI option --icpf to process your trace files through a specific simulator library. You can use the following command line:

$ traceanalyzer --cli --icpf [options] <tracefile> --simulator <simulator library>

where <tracefile> is the name of your trace file, <simulator library> is the name of your simulator.

Developing Simulators

Intel® Trace Analyzer includes examples of the simulator. You can customize the examples of the simulator library to create your own simulator.

The examples are located in: <trace_analyzer_install_dir>/examples/icpf

Use the following files in this directory:

Building a Simulator Library

To build a simulator library, do the following:

  1. Set up your development environment. If you use a non Intel® compiler, modify the Makefile for Linux* OS or Makefile_win for Windows* OS in the simulator development directory. To modify a Makefile, open the Makefile with any text editor and edit the following lines to change the compiler:

    Makefile:

    SIMCOMP = icc

  2. To build the examples of simulator libraries, you can use the following commands:

Writing your Simulator

Before beginning simulator development, you need to understand the virtual class that is inherited by a simulator. 

The CustomPluginFramework.h header file connects between the Intel Trace Analyzer source and other tools such as simulators.  This file contains the following information:

  1. data structures that are passed to the API

  2. public virtual functions that are called by CPF

  3. private functions that can be called by any simulator help/aid with simulator development

  4. private members that provide a simulator with access to certain aspects about a particular trace 

Note

If you change the file, you will not be able to plug a simulator into the API. 

You can create your simulator filling virtual functions in h_devsim.cpp (or your .cpp file if you have renamed it). 

Examples

In this example, durations of all non-blocking sending MPI events in trace file become zero time.

 virtual void ProcessNonBlockingSend( FuncEventInfo * _event_, P2PInfo * _message_ ) 
{
   _event_->_endTime = _event_->_startTime;
}	

In this example, durations of all collective operations are doubled.

virtual void ProcessCollOp( CollOpInfo * _collop_ ) 
{
   //Traverse vector of CollOpInfo
   for( U4 k = 0; k < _collop_->_threads->count(); k++) 
   {
      (*(_collop_->_threads))[k]->_endTime += ( (*(_collop_->_threads))[k]->_endTime - (*(_collop_->_threads))[k]->_startTime );
   }
}

If you need to add more inline functions for your simulator, add them only to h_devsim.cpp or your .cpp file. Do not modify the h_custompluginframework.h header file.

Note

When modifying end time, ensure that the end time you change is never less than the start time. 

Note

All values of time are stored in a simulator in ticks instead of in seconds. To convert ticks in seconds, use _clockResolution coefficient.  

Note

When you have trouble with trace, it is suggested that you run the trace through Intel Trace Analyzer and Collector message checker before filling a bug report.

See Also

CPF Simulator API