Tpetra Matrix/Vector Services Version of the Day
Protected Attributes
Tpetra::MpiPlatform< Node > Class Template Reference

Implementation of the Platform concept for MPI-based platforms. More...

#include <Tpetra_MpiPlatform.hpp>

Inheritance diagram for Tpetra::MpiPlatform< Node >:
Inheritance graph
[legend]

List of all members.

Public Types

Typedefs
typedef Node NodeType
 Kokkos Node type; the template parameter of this class.

Public Member Functions

Constructors and destructor
 MpiPlatform (const Teuchos::RCP< NodeType > &node)
 Constructor that accepts a Kokkos Node.
 MpiPlatform (int *argc, char ***argv, const Teuchos::RCP< NodeType > &node)
 Constructor that accepts the same arguments as MPI_Init(), plus a Kokkos Node.
 MpiPlatform (const Teuchos::RCP< NodeType > &node, const Teuchos::RCP< const Teuchos::OpaqueWrapper< MPI_Comm > > &rawMpiComm)
 Constructor that accepts a Kokkos Node and a wrapped MPI communicator.
 MpiPlatform (int *argc, char ***argv, const Teuchos::RCP< NodeType > &node, const Teuchos::RCP< const Teuchos::OpaqueWrapper< MPI_Comm > > &rawMpiComm)
 Constructor that accepts the same arguments as MPI_Init(), plus a Kokkos Node and a wrapped MPI communicator.
 MpiPlatform (const Teuchos::RCP< NodeType > &node, MPI_Comm rawMpiComm)
 Constructor that accepts a Kokkos Node and a raw MPI communicator.
 MpiPlatform (int *argc, char ***argv, const Teuchos::RCP< NodeType > &node, MPI_Comm rawMpiComm)
 Constructor that accepts the same arguments as MPI_Init(), plus a Kokkos Node and a raw MPI communicator.
virtual ~MpiPlatform ()
 Destructor (virtual for memory safety of derived classes).
Methods to access the communicator and Kokkos Node.
Teuchos::RCP< const
Teuchos::Comm< int > > 
getComm () const
 The Teuchos::Comm instance with which this object was created.
Teuchos::RCP< NodeTypegetNode () const
 The default Kokkos Node instance.

Protected Attributes

Teuchos::RCP< const
Teuchos::Comm< int > > 
comm_
 Teuchos::Comm object instantiated for the platform.
Teuchos::RCP< NodeTypenode_
 Kokkos Node object instantiated for the platform.

Detailed Description

template<class Node>
class Tpetra::MpiPlatform< Node >

Implementation of the Platform concept for MPI-based platforms.

MpiPlatform specialization for KokkosClassic::DefaultNode::DefaultNodeType.

Warning:
This class will be DEPRECATED, in favor of the initialize() functions in Tpetra_Core.hpp. Please use those functions for safe, consistent initialization of MPI and Kokkos, on which Tpetra depends. If you must use this class, please prefer the constructors that take argc and argv. Those constructors will call initialize() for you.

MpiPlatform is an implementation of Tpetra's Platform concept. Classes implementing the Platform concept are templated on the Kokkos Node type. They have at least the following public interface:

 // This is not a real class; it just illustrates the concept.
 template<class Node>
 class Platform {
 public:
   typedef Node NodeType;
   explicit Platform (const RCP<Node>& node);
   RCP<const Comm<int> > getComm() const;
   RCP<Node> getNode() const;
 };

MpiPlatform also has a constructor that accepts an MPI communicator, over which the application using the platform should perform communication. The default communicator is MPI_COMM_WORLD. MpiPlatform is only available if Trilinos was built with MPI.

Note:
KokkosClassic::DefaultNode::DefaultNodeType is a typedef, and may have a different type, depending on Trilinos' build options. For example, it may be KokkosClassic::SerialNode if Trilinos was built without a threading library, or KokkosClassic::TPINode if Trilinos was built with Pthreads.

Definition at line 84 of file Tpetra_MpiPlatform.hpp.


Member Typedef Documentation

template<class Node>
typedef Node Tpetra::MpiPlatform< Node >::NodeType

Kokkos Node type; the template parameter of this class.

Definition at line 90 of file Tpetra_MpiPlatform.hpp.


Constructor & Destructor Documentation

template<class Node>
Tpetra::MpiPlatform< Node >::MpiPlatform ( const Teuchos::RCP< NodeType > &  node) [inline, explicit]

Constructor that accepts a Kokkos Node.

This version of the constructor uses MPI_COMM_WORLD as the communicator. It is declared "explicit" to forbid silent conversions via assignment from the Node instance to an MpiPlatform.

Parameters:
node[in/out] The Kokkos Node instance. If null, this class will create a Node with default parameters, at some time no later than during the first call to getNode().

Definition at line 106 of file Tpetra_MpiPlatform.hpp.

template<class Node>
Tpetra::MpiPlatform< Node >::MpiPlatform ( int *  argc,
char ***  argv,
const Teuchos::RCP< NodeType > &  node 
) [inline]

Constructor that accepts the same arguments as MPI_Init(), plus a Kokkos Node.

This version of the constructor uses MPI_COMM_WORLD as the default communicator.

Parameters:
argc[in/out] First argument of MPI_Init().
argv[in/out] Second argument of MPI_Init().
node[in/out] The Kokkos Node instance. If null, this class will create a Node with default parameters, at some time no later than during the first call to getNode().

Definition at line 133 of file Tpetra_MpiPlatform.hpp.

template<class Node>
Tpetra::MpiPlatform< Node >::MpiPlatform ( const Teuchos::RCP< NodeType > &  node,
const Teuchos::RCP< const Teuchos::OpaqueWrapper< MPI_Comm > > &  rawMpiComm 
) [inline]

Constructor that accepts a Kokkos Node and a wrapped MPI communicator.

This version of the constructor accepts an arbitrary MPI communicator. It requires that you first wrap the MPI communicator in a Teuchos::OpaqueWrapper. This is helpful if you want to "free" the communicator automatically after use.

If you just have a raw MPI_Comm and you want to be responsible for freeing it after use, use the constructor version that takes a raw MPI_Comm. Otherwise, see the documentation of Teuchos::OpaqueWrapper to learn how to wrap an MPI_Comm and how to set the wrapper to free the communicator automatically after use.

Parameters:
node[in/out] The Kokkos Node instance. If null, this class will create a Node with default parameters, at some time no later than during the first call to getNode().
rawMpiComm[in] The MPI communicator, wrapped in a Teuchos::OpaqueWrapper.

Definition at line 169 of file Tpetra_MpiPlatform.hpp.

template<class Node>
Tpetra::MpiPlatform< Node >::MpiPlatform ( int *  argc,
char ***  argv,
const Teuchos::RCP< NodeType > &  node,
const Teuchos::RCP< const Teuchos::OpaqueWrapper< MPI_Comm > > &  rawMpiComm 
) [inline]

Constructor that accepts the same arguments as MPI_Init(), plus a Kokkos Node and a wrapped MPI communicator.

This version of the constructor accepts an arbitrary MPI communicator. It requires that you first wrap the MPI communicator in a Teuchos::OpaqueWrapper. This is helpful if you want to "free" the communicator automatically after use.

If you just have a raw MPI_Comm and you want to be responsible for freeing it after use, use the constructor version that takes a raw MPI_Comm. Otherwise, see the documentation of Teuchos::OpaqueWrapper to learn how to wrap an MPI_Comm and how to set the wrapper to free the communicator automatically after use.

Parameters:
argc[in/out] First argument of MPI_Init().
argv[in/out] Second argument of MPI_Init().
node[in/out] The Kokkos Node instance. If null, this class will create a Node with default parameters, at some time no later than during the first call to getNode().
rawMpiComm[in] The MPI communicator, wrapped in a Teuchos::OpaqueWrapper.

Definition at line 213 of file Tpetra_MpiPlatform.hpp.

template<class Node>
Tpetra::MpiPlatform< Node >::MpiPlatform ( const Teuchos::RCP< NodeType > &  node,
MPI_Comm  rawMpiComm 
) [inline]

Constructor that accepts a Kokkos Node and a raw MPI communicator.

This version of the constructor accepts an arbitrary "raw" (not wrapped) MPI communicator. You are responsible for freeing the MPI communicator after use, if necessary.

Parameters:
node[in/out] The Kokkos Node instance. If null, this class will create a Node with default parameters, at some time no later than during the first call to getNode().
rawMpiComm[in] The "raw" (not wrapped) MPI communicator.

Definition at line 259 of file Tpetra_MpiPlatform.hpp.

template<class Node>
Tpetra::MpiPlatform< Node >::MpiPlatform ( int *  argc,
char ***  argv,
const Teuchos::RCP< NodeType > &  node,
MPI_Comm  rawMpiComm 
) [inline]

Constructor that accepts the same arguments as MPI_Init(), plus a Kokkos Node and a raw MPI communicator.

This version of the constructor accepts an arbitrary "raw" (not wrapped) MPI communicator. You are responsible for freeing the MPI communicator after use, if necessary.

Parameters:
argc[in/out] First argument of MPI_Init().
argv[in/out] Second argument of MPI_Init().
node[in/out] The Kokkos Node instance. If null, this class will create a Node with default parameters, at some time no later than during the first call to getNode().
rawMpiComm[in] The "raw" (not wrapped) MPI communicator.

Definition at line 284 of file Tpetra_MpiPlatform.hpp.

template<class Node>
virtual Tpetra::MpiPlatform< Node >::~MpiPlatform ( ) [inline, virtual]

Destructor (virtual for memory safety of derived classes).

Definition at line 302 of file Tpetra_MpiPlatform.hpp.


Member Function Documentation

template<class Node>
Teuchos::RCP<const Teuchos::Comm<int> > Tpetra::MpiPlatform< Node >::getComm ( ) const [inline]

The Teuchos::Comm instance with which this object was created.

Definition at line 309 of file Tpetra_MpiPlatform.hpp.

template<class Node>
Teuchos::RCP<NodeType> Tpetra::MpiPlatform< Node >::getNode ( ) const [inline]

The default Kokkos Node instance.

If a constructor was called with a nonnull Node instance, this just returns that instance. Otherwise, this method returns a Node set up with default parameters. It only initializes that Node once, no matter how many times this method is called.

Definition at line 324 of file Tpetra_MpiPlatform.hpp.


Member Data Documentation

template<class Node>
Teuchos::RCP<const Teuchos::Comm<int> > Tpetra::MpiPlatform< Node >::comm_ [protected]

Teuchos::Comm object instantiated for the platform.

Definition at line 353 of file Tpetra_MpiPlatform.hpp.

template<class Node>
Teuchos::RCP<NodeType> Tpetra::MpiPlatform< Node >::node_ [protected]

Kokkos Node object instantiated for the platform.

Definition at line 355 of file Tpetra_MpiPlatform.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines