TIMPI
timpi_version.C
Go to the documentation of this file.
1 // The TIMPI Message-Passing Parallelism Library.
2 // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 #include "timpi/timpi_version.h"
19 
20 #include <iostream>
21 #include <sstream>
22 
23 namespace TIMPI
24 {
25 
27  {
28  std::cout << timpi_version_string() << std::flush;
29  }
30 
31  std::string timpi_version_string()
32  {
33  std::ostringstream oss;
34 
35  oss << "--------------------------------------------------------" << std::endl;
36  oss << "TIMPI Package: Version = " << TIMPI_LIB_VERSION;
37  oss << " (" << get_timpi_version() << ")" << std::endl << std::endl;
38 
39  oss << TIMPI_LIB_RELEASE << std::endl << std::endl;
40 
41  oss << "Build Date = " << TIMPI_BUILD_DATE << std::endl;
42  oss << "Build Host = " << TIMPI_BUILD_HOST << std::endl;
43  oss << "Build User = " << TIMPI_BUILD_USER << std::endl;
44  oss << "Build Arch = " << TIMPI_BUILD_ARCH << std::endl;
45  oss << "Build Rev = " << TIMPI_BUILD_VERSION << std::endl << std::endl;
46 
47  oss << "C++ Config = " << TIMPI_CXX << " " << TIMPI_CXXFLAGS << std::endl;
48  oss << "--------------------------------------------------------" << std::endl;
49 
50  return oss.str();
51  }
52 
54  {
55  /* Note: return format follows the versioning convention xx.yy.zz where
56 
57  xx = major version number
58  yy = minor version number
59  zz = micro version number
60 
61  For example:
62  v. 0.23 -> 002300 = 2300
63  v 0.23.1 -> 002301 = 2301
64  v. 10.23.2 -> 102302 */
65 
66  int major_version = 0;
67  int minor_version = 0;
68  int micro_version = 0;
69 
70 #ifdef TIMPI_MAJOR_VERSION
71  major_version = TIMPI_MAJOR_VERSION;
72 #endif
73 
74 #ifdef TIMPI_MINOR_VERSION
75  minor_version = TIMPI_MINOR_VERSION;
76 #endif
77 
78 #ifdef TIMPI_MICRO_VERSION
79  micro_version = TIMPI_MICRO_VERSION;
80 #endif
81 
82  return major_version*10000 + minor_version*100 + micro_version;
83  }
84 
85 } // end namespace TIMPI
std::string timpi_version_string()
Definition: timpi_version.C:31
void timpi_version_stdout()
Definition: timpi_version.C:26
int get_timpi_version()
Definition: timpi_version.C:53