MPIHelper.h File Reference

File and macros to enable conditional compilation of MPI code so that PEACE can be built with and without MPI. More...

#include "config.h"
#include "Utilities.h"
#include <mpi.h>
Include dependency graph for MPIHelper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MPI_GET_RANK()   MPI::COMM_WORLD.Get_rank()
 A simple, convenience macro to conditionally call MPI::COMM_WORLD.Get_rank().
#define MPI_GET_SIZE()   MPI::COMM_WORLD.Get_size()
 A simple, convenience macro to conditionally call MPI::COMM_WORLD.Get_size().
#define MPI_STATUS   MPI::Status
 A simple, convenience macro to conditionally provide a suitable definition for MPI::Status data structure depending on whether MPI is available (or not).
#define MPI_TYPE_INT   MPI::INT
 Macro to map MPI_TYPE_INT to MPI::INT (if MPI is enabled) or 0 if MPI is unavailable.
#define MPI_TYPE_CHAR   MPI::CHAR
 Macro to map MPI_TYPE_CHAR to MPI::CHAR (if MPI is enabled) or 0 if MPI is unavailable.
#define MPI_INIT(argc, argv)   MPI::Init(argc, argv)
 Macro to map MPI_INIT to MPI::Init (if MPI is enabled) or an empty method call if MPI is unavailable.
#define MPI_FINALIZE()   MPI::Finalize()
 Macro to map MPI_FINALIZE to MPI::Finalize (if MPI is enabled) or an empty method call if MPI is unavailable.
#define MPI_WTIME   MPI::Wtime
 Macro to map MPI_WTIME to MPI::Wtime (if MPI is enabled) or to a suitable OS-independent implementation for Wtime.
#define MPI_CODE(x)   x
 Macro to work around warnings about unused MPI variables or conditionally compile-out MPI code.

Detailed Description

File and macros to enable conditional compilation of MPI code so that PEACE can be built with and without MPI.

This header file has been introduced to permit PEACE to compile with and without the presence of MPI. The code is designed in such a way to enable the use of MPI without hurting the readability and development of PEACE.

Definition in file MPIHelper.h.


Define Documentation

#define MPI_CODE (  )     x

Macro to work around warnings about unused MPI variables or conditionally compile-out MPI code.

This macro provides a convenient, conditionally defined macro to conditionally compile-out MPI related code when MPI is disabled.

This macro can be used as shown below:

    #include "MPIHelper.h"

    int main(int argc, char *argv[]) {
        // ... some code goes here ..
    MPI_CODE({
        MPI_STATUS msgInfo;
            MPI_PROBE(sourceRank, REPOPULATE_REQUEST, msgInfo);
        });
        // ... more code goes here ..
    }

Definition at line 359 of file MPIHelper.h.

Referenced by MSTClusterMaker::computeNextESTidx(), MSTClusterMaker::estAdded(), MSTClusterMaker::managerUpdateCaches(), MSTClusterMaker::populateCache(), and MSTClusterMaker::worker().

 
#define MPI_FINALIZE (  )     MPI::Finalize()

Macro to map MPI_FINALIZE to MPI::Finalize (if MPI is enabled) or an empty method call if MPI is unavailable.

This macro provides a convenient, conditionally defined macro to refer to MPI::Finalize method. If MPI is available, then MPI_FINALIZE defaults to MPI::Init. On the other hand, if MPI is disabled then this macro simply reduces to a blank method.

This macro can be used as shown below:

    #include "MPIHelper.h"

    int main(int argc, char *argv[]) {
        // ... some code goes here ..
    MPI_INIT(argc, argv);
        // ... more code goes here ..
    }

Definition at line 295 of file MPIHelper.h.

Referenced by main().

 
#define MPI_GET_RANK (  )     MPI::COMM_WORLD.Get_rank()

A simple, convenience macro to conditionally call MPI::COMM_WORLD.Get_rank().

This macro provides a convenient wrapper around MPI's MPI::COMM_WORD.Get_rank() method to conditionally use it. If MPI is available/enabled, this macro reduces to calling the actual Get_rank() method. However, if MPI is not available, this macro reduces to the constant 0 (one) making it appear as if there is only one process to work with.

This macro can be used as shown below:

    #include "MPIHelper.h"

    void someMethod() {
        // ... some code goes here ..
    int myRank = MPI_GET_RANK();
        // ... more code goes here ..
    }

Definition at line 89 of file MPIHelper.h.

Referenced by FilterChain::allToAllBroadcast(), applyFilters(), PMSTClusterMaker::computeNextESTidx(), PMSTClusterMaker::displayStats(), MSTClusterMaker::displayStats(), PMSTClusterMaker::estAdded(), PMSTClusterMaker::getOwnedESTidx(), MSTClusterMaker::getOwnedESTidx(), FilterChain::getOwnedESTidx(), PMSTClusterMaker::getOwnedPartition(), PMSTClusterMaker::getOwnerProcess(), ESTAnalyzer::loadFASTAFile(), main(), PMSTClusterMaker::makeClusters(), PMSTClusterMaker::manager(), PMSTClusterMaker::managerUpdateCaches(), TransMSTClusterMaker::populateCache(), PMSTClusterMaker::populateCache(), MSTClusterMaker::populateCache(), MSTClusterMaker::populateMST(), and PMSTClusterMaker::sendToWorkers().

 
#define MPI_GET_SIZE (  )     MPI::COMM_WORLD.Get_size()

A simple, convenience macro to conditionally call MPI::COMM_WORLD.Get_size().

This macro provides a convenient wrapper around MPI's MPI::COMM_WORD.Get_size() method to conditionally use it. If MPI is available/enabled, this macro reduces to calling the actual Get_size() method. However, if MPI is not available, this macro reduces to the constant 1 (one) making it appear as if there is only one process to work with.

This macro can be used as shown below:

    #include "MPIHelper.h"

    void someMethod() {
        // ... some code goes here ..
    int WorkerCount = MPI_GET_SIZE();
        // ... more code goes here ..
    }

Definition at line 123 of file MPIHelper.h.

Referenced by FilterChain::allToAllBroadcast(), FilterChain::applyFilters(), MSTClusterMaker::computeNextESTidx(), MSTClusterMaker::estAdded(), MSTClusterMaker::getOwnedESTidx(), FilterChain::getOwnedESTidx(), PMSTClusterMaker::getOwnedPartition(), MSTClusterMaker::getOwnerProcess(), PMSTClusterMaker::makeClusters(), PMSTClusterMaker::mergeManager(), TransMSTClusterMaker::populateCache(), MSTClusterMaker::populateCache(), and MSTClusterMaker::sendToWorkers().

#define MPI_INIT ( argc,
argv   )     MPI::Init(argc, argv)

Macro to map MPI_INIT to MPI::Init (if MPI is enabled) or an empty method call if MPI is unavailable.

This macro provides a convenient, conditionally defined macro to refer to MPI::Init method. If MPI is available, then MPI_INIT defaults to MPI::Init. On the other hand, if MPI is disabled then this macro simply reduces to a blank method.

This macro can be used as shown below:

    #include "MPIHelper.h"

    int main(int argc, char *argv[]) {
        // ... some code goes here ..
    MPI_INIT(argc, argv);
        // ... more code goes here ..
    }

Definition at line 265 of file MPIHelper.h.

Referenced by main().

#define MPI_STATUS   MPI::Status

A simple, convenience macro to conditionally provide a suitable definition for MPI::Status data structure depending on whether MPI is available (or not).

This macro provides a convenient mechanism to work with MPI::Status data structure. If MPI is available, then it defaults to MPI::Status. On the other hand, if MPI is disabled then this macro provides a suitable definition so that the core code base does not get cluttered with unnecessary logic.

This macro can be used as shown below:

    #include "MPIHelper.h"

    void someMethod() {
        // ... some code goes here ..
    MPI_STATUS msgInfo;
        MPI_PROBE(sourceRank, REPOPULATE_REQUEST, msgInfo);
        // ... more code goes here ..
    }

Definition at line 166 of file MPIHelper.h.

Referenced by PMSTClusterMaker::estAdded(), MSTClusterMaker::estAdded(), PMSTClusterMaker::mergeManager(), TransMSTClusterMaker::populateCache(), PMSTClusterMaker::populateCache(), MSTClusterMaker::populateCache(), PMSTClusterMaker::worker(), and MSTClusterMaker::worker().

#define MPI_TYPE_CHAR   MPI::CHAR

Macro to map MPI_TYPE_CHAR to MPI::CHAR (if MPI is enabled) or 0 if MPI is unavailable.

This macro provides a convenient, conditionally defined macro to refer to MPI::CHAR enumerated constant. If MPI is available, then MPI_TYPE_CHAR defaults to MPI::CHAR. On the other hand, if MPI is disabled then this macro simply reduces to 0.

This macro can be used as shown below:

    #include "MPIHelper.h"

    void someMethod() {
        // ... some code goes here ..
    MPI_STATUS msgInfo;
        MPI_PROBE(sourceRank, REPOPULATE_REQUEST, msgInfo);
        const int dataSize = msgInfo.Get_count(MPI_TYPE_CHAR);
        // ... more code goes here ..
    }

Definition at line 235 of file MPIHelper.h.

Referenced by PMSTClusterMaker::mergeManager(), PMSTClusterMaker::mergeWorker(), TransMSTClusterMaker::populateCache(), PMSTClusterMaker::populateCache(), and MSTClusterMaker::populateCache().

#define MPI_TYPE_INT   MPI::INT

Macro to map MPI_TYPE_INT to MPI::INT (if MPI is enabled) or 0 if MPI is unavailable.

This macro provides a convenient, conditionally defined macro to refer to MPI::INT enumerated constant. If MPI is available, then MPI_TYPE_INT defaults to MPI::INT. On the other hand, if MPI is disabled then this macro simply reduces to 0.

This macro can be used as shown below:

    #include "MPIHelper.h"

    void someMethod() {
        // ... some code goes here ..
    MPI_STATUS msgInfo;
        MPI_PROBE(sourceRank, REPOPULATE_REQUEST, msgInfo);
        const int dataSize = msgInfo.Get_count(MPI_TYPE_INT);
        // ... more code goes here ..
    }

Definition at line 203 of file MPIHelper.h.

Referenced by PMSTClusterMaker::computeNextESTidx(), MSTClusterMaker::computeNextESTidx(), PMSTClusterMaker::estAdded(), MSTClusterMaker::estAdded(), PMSTClusterMaker::makeClusters(), PMSTClusterMaker::managerUpdateCaches(), MSTClusterMaker::managerUpdateCaches(), PMSTClusterMaker::populateCache(), MSTClusterMaker::populateCache(), PMSTClusterMaker::sendToWorkers(), MSTClusterMaker::sendToWorkers(), PMSTClusterMaker::worker(), and MSTClusterMaker::worker().

#define MPI_WTIME   MPI::Wtime

Macro to map MPI_WTIME to MPI::Wtime (if MPI is enabled) or to a suitable OS-independent implementation for Wtime.

This macro provides a convenient, conditionally defined macro to refer to MPI::Wtime method. If MPI is available, then MPI_WTIME defaults to MPI::Wtime. On the other hand, if MPI is disabled then this macro simply reduces to a suitable OS-independent method call.

This macro can be used as shown below:

    #include "MPIHelper.h"

    int main(int argc, char *argv[]) {
        // ... some code goes here ..
    const double startTime = MPI::Wtime();
        // ... more code goes here ..
    const double elapsedTime = (MPI::Wtime() - startTime) * 1000.0;
    }

Definition at line 327 of file MPIHelper.h.

Referenced by InteractiveConsole::analyze(), InteractiveConsole::initialize(), and InteractiveConsole::printStats().


Generated on 19 Mar 2010 for PEACE by  doxygen 1.6.1