Quinoa all test code coverage report
Current view: top level - UnitTest - MPIRunner.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 11 11 100.0 %
Date: 2024-04-29 14:59:56 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 20 32 62.5 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/UnitTest/MPIRunner.hpp
       4                 :            :   \copyright 2012-2015 J. Bakosi,
       5                 :            :              2016-2018 Los Alamos National Security, LLC.,
       6                 :            :              2019-2021 Triad National Security, LLC.
       7                 :            :              All rights reserved. See the LICENSE file for details.
       8                 :            :   \brief     Charm++ nodegroup to run MPI unit tests
       9                 :            :   \details   Charm++ nodegroup to run MPI unit tests.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : #ifndef MPIRunner_h
      13                 :            : #define MPIRunner_h
      14                 :            : 
      15                 :            : #include <string>
      16                 :            : 
      17                 :            : #include "NoWarning/tut.hpp"
      18                 :            : #include "NoWarning/mpirunner.decl.h"
      19                 :            : 
      20                 :            : namespace unittest {
      21                 :            : 
      22                 :            : extern tut::test_runner_singleton g_runner;
      23                 :            : extern int g_maxTestsInGroup;
      24                 :            : 
      25                 :            : //! Generic Charm++ nodegroup chare class for running MPI unit tests
      26                 :            : template< class Proxy >
      27                 :            : class MPIRunner : public CBase_MPIRunner< Proxy > {
      28                 :            : 
      29                 :            :   public:
      30                 :            :     //! Constrcutor: store host proxy
      31         [ +  - ]:         36 :     explicit MPIRunner( const Proxy& proxy ) : m_host(proxy) {}
      32                 :            : 
      33                 :            :     //! Fire up all tests in a test group
      34                 :        180 :     void rungroup( const std::string& groupname ) {
      35         [ +  + ]:      14580 :       for (int t=1; t<=g_maxTestsInGroup; ++t) {      
      36                 :      28800 :         tut::test_result tr;
      37                 :      14400 :         auto nd = CBase_MPIRunner< Proxy >::thisIndex;
      38                 :            :         // Invoke those MPI tests whose group name contains "MPISingle" from a
      39                 :            :         // single MPI rank only
      40         [ +  + ]:      14400 :         if (groupname.find("MPISingle") != std::string::npos) {
      41 [ +  + ][ +  - ]:      11520 :           if (CkNodeFirst(nd) == 0) g_runner.get().run_test( groupname, t, tr );
      42                 :            :         } else {
      43         [ +  - ]:       2880 :           g_runner.get().run_test( groupname, t, tr );
      44                 :            :         }
      45                 :            :         // Send result (only one)
      46         [ +  + ]:      14400 :         if (CkNodeFirst(nd) == 0) {
      47 [ +  - ][ +  - ]:       2400 :           m_host.evaluate( { tr.group, tr.name, std::to_string(tr.result),
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
                 [ -  - ]
      48                 :            :                              tr.message, tr.exception_typeid } );
      49                 :            :         }
      50                 :            :       }
      51                 :        180 :     }
      52                 :            : 
      53                 :            :   private:
      54                 :            :     Proxy m_host;       //!< Host proxy
      55                 :            : };
      56                 :            : 
      57                 :            : } // unittest::
      58                 :            : 
      59                 :            : #define CK_TEMPLATES_ONLY
      60                 :            : #include "NoWarning/mpirunner.def.h"
      61                 :            : #undef CK_TEMPLATES_ONLY
      62                 :            : 
      63                 :            : #endif // MPIRunner_h

Generated by: LCOV version 1.14