LCOV - code coverage report
Current view: top level - lunchbox - mpi.h (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 1 1 100.0 %
Date: 2014-10-01 Functions: 1 1 100.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2014, Carlos Duelo <cduelo@cesvima.upm.es>
       3             :  *                     Stefan.Eilemann@epfl.ch
       4             :  *
       5             :  * This library is free software; you can redistribute it and/or modify it under
       6             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       7             :  * by the Free Software Foundation.
       8             :  *
       9             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      10             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      11             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      12             :  * details.
      13             :  *
      14             :  * You should have received a copy of the GNU Lesser General Public License
      15             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      16             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      17             :  */
      18             : 
      19             : #ifndef LUNCHBOX_MPI_H
      20             : #define LUNCHBOX_MPI_H
      21             : 
      22             : #include <lunchbox/api.h>
      23             : #include <boost/shared_ptr.hpp>
      24             : 
      25             : namespace lunchbox
      26             : {
      27             : namespace detail { class MPI; }
      28             : 
      29             : /** MPI functionality wrapper. */
      30           1 : class MPI
      31             : {
      32             : public:
      33             :     /**
      34             :      * Construct an MPI handler with command line arguments.
      35             :      *
      36             :      * Calls MPI_Init_thread requesting MPI_THREAD_MULTIPLE, unless MPI is
      37             :      * already initialized. Initialized the thread support to false depending on
      38             :      * the obtained thread support. Will signal not to support threads if MPI
      39             :      * was initialized externally.
      40             :      *
      41             :      * NOTE: Be aware that MPI_THREAD_MULTIPLE is only lightly tested and likely
      42             :      * still has some bugs. Please, refer the below links:
      43             :      * https://www.open-mpi.org/faq/?category=supported-systems#thread-support
      44             :      * https://www.open-mpi.org/doc/v1.4/man3/MPI_Init_thread.3.php
      45             :      *
      46             :      * @version 1.1.1
      47             :      */
      48             :     LUNCHBOX_API MPI( int& argc, char**& argv );
      49             : 
      50             :     /** Construct a new MPI handler.
      51             :      *
      52             :      * See argc, argv ctor for details.
      53             :      * @version 1.1.1
      54             :      */
      55             :     LUNCHBOX_API MPI();
      56             : 
      57             :     /**
      58             :      * Destruct this handler instance.
      59             :      *
      60             :      * Calls MPI_Finalize if it is the last copy of an instance which has
      61             :      * initialized MPI.
      62             :      *
      63             :      * @version 1.1.1
      64             :      */
      65             :     LUNCHBOX_API ~MPI();
      66             : 
      67             :     /* @return true if the MPI library has multithread
      68             :      * support, otherwise return false.
      69             :      * @version 1.1.1
      70             :      */
      71             :     LUNCHBOX_API bool supportsThreads() const;
      72             : 
      73             :     /** @return the rank of the process that calls it @version 1.1.1 */
      74             :     LUNCHBOX_API int getRank() const;
      75             : 
      76             :     /** @return the number of processes involved @version 1.1.1 */
      77             :     LUNCHBOX_API int getSize() const;
      78             : 
      79             : private:
      80             :     boost::shared_ptr< detail::MPI > _impl;
      81             : };
      82             : 
      83             : }
      84             : 
      85             : #endif // LUNCHBOX_MPI_H

Generated by: LCOV version 1.10