Line data Source code
1 1 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : /// \file 5 : /// Defines functions that provide low-level system information such as number 6 : /// of nodes and processors. When working with distributed objects, one should 7 : /// use the corresponding functions in Parallel/Info.hpp instead of the 8 : /// low-level functions here. 9 : 10 : #pragma once 11 : 12 : #include <string> 13 : 14 : namespace sys { 15 : /*! 16 : * \ingroup UtilitiesGroup 17 : * \brief Number of processing elements. 18 : */ 19 1 : int number_of_procs(); 20 : 21 : /*! 22 : * \ingroup UtilitiesGroup 23 : * \brief %Index of my processing element. 24 : */ 25 1 : int my_proc(); 26 : 27 : /*! 28 : * \ingroup UtilitiesGroup 29 : * \brief Number of nodes. 30 : */ 31 1 : int number_of_nodes(); 32 : 33 : /*! 34 : * \ingroup UtilitiesGroup 35 : * \brief %Index of my node. 36 : */ 37 1 : int my_node(); 38 : 39 : /*! 40 : * \ingroup UtilitiesGroup 41 : * \brief Number of processing elements on the given node. 42 : */ 43 1 : int procs_on_node(int node_index); 44 : 45 : /*! 46 : * \ingroup UtilitiesGroup 47 : * \brief The local index of my processing element on my node. 48 : * This is in the interval 0, ..., procs_on_node(my_node()) - 1. 49 : */ 50 1 : int my_local_rank(); 51 : 52 : /*! 53 : * \ingroup UtilitiesGroup 54 : * \brief %Index of first processing element on the given node. 55 : */ 56 1 : int first_proc_on_node(int node_index); 57 : 58 : /*! 59 : * \ingroup UtilitiesGroup 60 : * \brief %Index of the node for the given processing element. 61 : */ 62 1 : int node_of(int proc_index); 63 : 64 : /*! 65 : * \ingroup UtilitiesGroup 66 : * \brief The local index for the given processing element on its node. 67 : */ 68 1 : int local_rank_of(int proc_index); 69 : 70 : /*! 71 : * \ingroup UtilitiesGroup 72 : * \brief The elapsed wall time in seconds. 73 : */ 74 1 : double wall_time(); 75 : 76 : /// @{ 77 : /// \ingroup UtilitiesGroup 78 : /// \brief Format the wall time in DD-HH:MM:SS format. 79 : /// 80 : /// If the walltime is shorter than a day, omit the `DD-` part. 81 1 : std::string pretty_wall_time(double total_seconds); 82 : 83 1 : std::string pretty_wall_time(); 84 : /// @} 85 : } // namespace sys