Quinoa all test code coverage report
Current view: top level - LoadBalance - LinearMap.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 2 2 100.0 %
Date: 2024-11-08 10:37:44 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 12 41.7 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/LoadBalance/LinearMap.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     Advanced Charm++ array creation with a map in a linear fashion
       9                 :            :   \details   Advanced Charm++ array creation refers to various ways arrays can
      10                 :            :      be created with the Charm++ runtime system. See
      11                 :            :      http://charm.cs.illinois.edu/manuals/html/charm++/manual.html, Sec.
      12                 :            :      Advanced Array Creation. This class does a simple linear distribution.
      13                 :            : 
      14                 :            :      Note that to help with performance, it is not advised to do heavy
      15                 :            :      computations in the overridden member functions, procNum() and
      16                 :            :      populateInitial(), since they can be potentially called many times. See
      17                 :            :      also this note on the inner workings of the Charm++ runtime system
      18                 :            :      regarding map objects and array element creation from long-time Charm++
      19                 :            :      developer, Eric Bohm, also at:
      20                 :            :      http://lists.cs.uiuc.edu/pipermail/charm/2015-May/002047.html
      21                 :            : 
      22                 :            :      _Procnum will be called to construct your chare, the first time a message
      23                 :            :      is sent to it from a node, and each time subsequent sends do not find a
      24                 :            :      precached location record for it. The latter event can occur when many
      25                 :            :      sends have pushed it out of cache, or after migration._
      26                 :            : 
      27                 :            :      _The potential global memory footprint of location management caching is
      28                 :            :      proportional to the total number of objects multiplied by the number of
      29                 :            :      nodes. Therefore, the runtime system keeps a finite number on each node.
      30                 :            :      At the limit, procnum could be called for nearly every message send,
      31                 :            :      therefore procnum should be designed to be inexpensive._
      32                 :            : 
      33                 :            :      The heavy portion of array element placement should therefore be done in
      34                 :            :      the constructor.
      35                 :            : */
      36                 :            : // *****************************************************************************
      37                 :            : #ifndef LinearMap_h
      38                 :            : #define LinearMap_h
      39                 :            : 
      40                 :            : #include "NoWarning/linearmap.decl.h"
      41                 :            : 
      42                 :            : #include "Exception.hpp"
      43                 :            : 
      44                 :            : namespace tk {
      45                 :            : 
      46                 :            : //! Charm++ array map for initial placement of array elements in linear fashion
      47                 :            : //! \details The map object is used by the Charm++ array manager to determine
      48                 :            : //!   the "home" PE of each element. The home PE is the PE upon which the array
      49                 :            : //!   element is initially placed, which will retain responsibility for
      50                 :            : //!   maintaining the location of the element.
      51                 :            : class LinearMap : public CkArrayMap {
      52                 :            : 
      53                 :            :   public:
      54                 :            :     //! Constructor
      55                 :            :     //! \param[in] nelem Total number of array elements
      56                 :        108 :     explicit LinearMap( int nelem ) :
      57 [ -  - ][ -  - ]:        108 :       m_chunksize( nelem > CkNumPes() ? nelem/CkNumPes() : 1 )
         [ -  - ][ +  - ]
         [ +  + ][ +  + ]
      58                 :            :     { Assert( nelem > 0, "Number of array elements must be positive" ); }
      59                 :            : 
      60                 :            :     //! \brief Return the home processor number for the array element for linear
      61                 :            :     //!   distribution
      62                 :            :     int procNum( int, const CkArrayIndex& idx ) override;
      63                 :            : 
      64                 :            :     //! Create initial set of array elements based on linear distribution
      65                 :            :     void populateInitial( int, CkArrayOptions& opt, void *msg, CkArrMgr *mgr )
      66                 :            :     override;
      67                 :            : 
      68                 :            :   private:
      69                 :            :     int m_chunksize;            //!< Number of array elements per PE
      70                 :            : };
      71                 :            : 
      72                 :            : } // tk::
      73                 :            : 
      74                 :            : #endif // LinearMap_h

Generated by: LCOV version 1.14