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 trace files for applications that pass correctness 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 with 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 and Collector contains 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

Build a simulator library as follows:

  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 line to change the compiler:

    SIMCOMP = icc

  2. To build the examples of simulator libraries, 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 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 of a particular trace file

Note

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

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

Examples

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

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

In this example, duration of all collective operations is 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

A simulator stores all time values in ticks. To convert ticks to seconds, use the _clockResolution coefficient.

Note

When you have trouble with trace file, run it through the Intel Trace Analyzer and Collector correctness checker before filling a bug report.

See Also

CPF Simulator API