36#include "ExecutableSupport.hpp"
42#include <sys/utsname.h>
43#define ChasteGetCurrentTime() ChasteBuildInfo::GetCurrentTime()
49#include "CommandLineArguments.hpp"
50#include "PetscException.hpp"
51#include "PetscSetupUtils.hpp"
54#define _BACKWARD_BACKWARD_WARNING_H 1
55#include <vtkVersion.h>
57#include <sundials/sundials_config.h>
60#include <xercesc/util/XercesVersion.hpp>
63#ifdef CHASTE_PARMETIS_REQUIRED
64#ifdef PARMETIS_MAJOR_VERSION
65#if PARMETIS_MAJOR_VERSION != CHASTE_PARMETIS_REQUIRED
66#error "Wrong ParMETIS version found: " #CHASTE_PARMETIS_REQUIRED " requested but " #PARMETIS_MAJOR_VERSION " present"
71#ifndef PARMETIS_MAJOR_VERSION
73#include <scotch/ptscotch.h>
110 std::stringstream provenance_msg;
111 provenance_msg <<
"This version of Chaste was compiled on:\n";
121 std::cout << provenance_msg.str() << std::flush;
148 std::stringstream file_name;
150 out_stream out_file = out_file_handler.
OpenOutputFile(file_name.str());
155 struct utsname uts_info;
158 *out_file <<
"uname sysname = " << uts_info.sysname << std::endl
160 *out_file <<
"uname nodename = " << uts_info.nodename << std::endl
162 *out_file <<
"uname release = " << uts_info.release << std::endl
164 *out_file <<
"uname version = " << uts_info.version << std::endl
166 *out_file <<
"uname machine = " << uts_info.machine << std::endl
172 *out_file <<
"\nInformation on number and type processors, and cache and memory sizes (in bytes)\n";
173 system_info = popen(
"sysctl hw.ncpu hw.physicalcpu machdep.cpu.brand_string hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize hw.memsize",
"r");
174 while (fgets(buffer, 100, system_info) != NULL)
181 *out_file <<
"\nInformation on number and type of processors:\n";
182 system_info = popen(
"grep ^model.name /proc/cpuinfo",
"r");
183 while (fgets(buffer, 100, system_info) !=
nullptr)
189 *out_file <<
"\nInformation on processor caches, in the same order as above:\n";
190 system_info = popen(
"grep ^cache.size /proc/cpuinfo",
"r");
191 while (fgets(buffer, 100, system_info) !=
nullptr)
197 *out_file <<
"\nInformation on system memory:\n";
198 system_info = popen(
"grep ^MemTotal /proc/meminfo",
"r");
199 while (fgets(buffer, 100, system_info) !=
nullptr)
222 std::stringstream provenance_msg;
223 provenance_msg <<
"This version of Chaste was compiled on:\n";
226 *out_file << provenance_msg.str();
237 std::stringstream output;
238 output <<
"<ChasteBuildInfo>\n";
240 output <<
"\t<ProvenanceInfo>\n";
246 output <<
"\t\t<CurrentTime>" << ChasteGetCurrentTime() <<
"</CurrentTime>\n";
250 output <<
"\t\t<Projects>\n";
256 output <<
"\t\t\t<Project>" << std::endl;
257 output <<
"\t\t\t\t<Name>" << r_project.first <<
"</Name>" << std::endl;
258 output <<
"\t\t\t\t<Revision>" << r_project.second.rGetCommit() <<
"</Revision>" << std::endl;
259 output <<
"\t\t\t\t<IsWorkingCopyModified>" << (r_project.second.IsModified() ?
"True" :
"False") <<
"</IsWorkingCopyModified>" << std::endl;
260 output <<
"\t\t\t</Project>" << std::endl;
264 output <<
"\t\t</Projects>\n";
266 output <<
"\t</ProvenanceInfo>\n";
268 output <<
"\t<Compiler>\n";
271 output <<
"\t</Compiler>\n";
273 output <<
"\t<Libraries>\n";
275 output <<
"\t\t<CompiledIn>\n";
276 output <<
"\t\t\t<Boost>" << BOOST_VERSION / 100000 <<
"." << BOOST_VERSION / 100 % 1000 <<
"." << BOOST_VERSION % 100 <<
"</Boost>\n";
277 output <<
"\t\t\t<HDF5>" << H5_VERS_MAJOR <<
"." << H5_VERS_MINOR <<
"." << H5_VERS_RELEASE <<
"</HDF5>\n";
280#ifdef PARMETIS_MAJOR_VERSION
281 output <<
"\t\t\t<Parmetis>" << PARMETIS_MAJOR_VERSION <<
"." << PARMETIS_MINOR_VERSION;
282#ifdef PARMETIS_SUBMINOR_VERSION
283 output <<
"." << PARMETIS_SUBMINOR_VERSION;
285 output <<
"</Parmetis>" << std::endl;
288 output <<
"\t\t\t<Parmetis>[NONE]</Parmetis>" << std::endl;
289 output <<
"\t\t\t<PT-Scotch>" << SCOTCH_VERSION<<
"."<<SCOTCH_RELEASE<<
"."<<SCOTCH_PATCHLEVEL<<
"</PT-Scotch>"<< std::endl;
291 output <<
"\t\t\t<PETSc>" << PETSC_VERSION_MAJOR <<
"." << PETSC_VERSION_MINOR <<
"." << PETSC_VERSION_SUBMINOR <<
"</PETSc>\n";
292 output <<
"\t\t\t<SUNDIALS>" << SUNDIALS_VERSION <<
"</SUNDIALS>\n";
293 output <<
"\t\t\t<VTK>" << VTK_MAJOR_VERSION <<
"." << VTK_MINOR_VERSION <<
"</VTK>\n";
294 output <<
"\t\t\t<Xerces>" << XERCES_FULLVERSIONDOT <<
"</Xerces>\n";
296 output <<
"\t\t</CompiledIn>\n";
298 output <<
"\t\t<Binaries>\n";
300 output <<
"\t\t</Binaries>\n";
302 output <<
"\t</Libraries>\n";
306 output <<
"</ChasteBuildInfo>" << std::endl;
307 rInfo = output.str();
328 std::cerr << rMessage << std::endl;
341 *out_file << rMessage << std::endl;
350 std::cout << rMessage << std::endl
static const char * GetBuilderUnameInfo()
static const char * GetCompilerFlags()
static SourceRevision GetChasteRevision()
static const char * GetBuildTime()
static std::string GetChasteCodegenVersion()
static std::string GetVersionString()
static const char * GetBuildInformation()
static const char * GetCompilerVersion()
static const char * GetCompilerType()
static std::map< std::string, SourceRevision > GetProjectRevisions()
static const char * GetXsdVersion()
static std::string GetLicenceText()
static CommandLineArguments * Instance()
static void Print(const std::string &rMessage)
static void SetOutputDirectory(const std::string &rOutputDirectory)
static void GetBuildInfo(std::string &rInfo)
static void WriteMachineInfoFile(std::string fileBaseName)
static void ShowParallelLaunching()
static void ShowCopyright()
static FileFinder mOutputDirectory
static void StartupWithoutShowingCopyright(int *pArgc, char ***pArgv)
static void StandardStartup(int *pArgc, char ***pArgv)
static void FinalizePetsc()
static void WriteProvenanceInfoFile()
static void PrintError(const std::string &rMessage, bool masterOnly=false)
static void InitializePetsc(int *pArgc, char ***pArgv)
static bool IsAbsolutePath(const std::string &rPath)
virtual void SetPath(const std::string &rPath, RelativeTo::Value relativeTo)
static std::string GetChasteTestOutputDirectory()
out_stream OpenOutputFile(const std::string &rFileName, std::ios_base::openmode mode=std::ios::out|std::ios::trunc) const
static void CommonFinalize()
const std::string & rGetCommit() const
std::string GetShortCommit() const