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"
55#define _BACKWARD_BACKWARD_WARNING_H 1
56#include <vtkVersion.h>
60#include <sundials/sundials_config.h>
61#if CHASTE_SUNDIALS_VERSION >= 20600
62#if CHASTE_SUNDIALS_VERSION >= 30000
64#define CHASTE_SUNDIALS_PACKAGE_VERSION SUNDIALS_VERSION
67#include <boost/preprocessor/stringize.hpp>
68#define CHASTE_SUNDIALS_PACKAGE_VERSION BOOST_PP_STRINGIZE(SUNDIALS_PACKAGE_VERSION)
71#define CHASTE_SUNDIALS_PACKAGE_VERSION SUNDIALS_PACKAGE_VERSION
78#include <xercesc/util/XercesVersion.hpp>
82#ifdef CHASTE_PARMETIS_REQUIRED
83#ifdef PARMETIS_MAJOR_VERSION
84#if PARMETIS_MAJOR_VERSION != CHASTE_PARMETIS_REQUIRED
85#error "Wrong ParMETIS version found: " #CHASTE_PARMETIS_REQUIRED " requested but " #PARMETIS_MAJOR_VERSION " present"
90#ifndef PARMETIS_MAJOR_VERSION
92#include <scotch/ptscotch.h>
129 std::stringstream provenance_msg;
130 provenance_msg <<
"This version of Chaste was compiled on:\n";
140 std::cout << provenance_msg.str() << std::flush;
167 std::stringstream file_name;
169 out_stream out_file = out_file_handler.
OpenOutputFile(file_name.str());
174 struct utsname uts_info;
177 *out_file <<
"uname sysname = " << uts_info.sysname << std::endl
179 *out_file <<
"uname nodename = " << uts_info.nodename << std::endl
181 *out_file <<
"uname release = " << uts_info.release << std::endl
183 *out_file <<
"uname version = " << uts_info.version << std::endl
185 *out_file <<
"uname machine = " << uts_info.machine << std::endl
191 *out_file <<
"\nInformation on number and type processors, and cache and memory sizes (in bytes)\n";
192 system_info = popen(
"sysctl hw.ncpu hw.physicalcpu machdep.cpu.brand_string hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize hw.memsize",
"r");
193 while (fgets(buffer, 100, system_info) != NULL)
200 *out_file <<
"\nInformation on number and type of processors:\n";
201 system_info = popen(
"grep ^model.name /proc/cpuinfo",
"r");
202 while (fgets(buffer, 100, system_info) !=
nullptr)
208 *out_file <<
"\nInformation on processor caches, in the same order as above:\n";
209 system_info = popen(
"grep ^cache.size /proc/cpuinfo",
"r");
210 while (fgets(buffer, 100, system_info) !=
nullptr)
216 *out_file <<
"\nInformation on system memory:\n";
217 system_info = popen(
"grep ^MemTotal /proc/meminfo",
"r");
218 while (fgets(buffer, 100, system_info) !=
nullptr)
241 std::stringstream provenance_msg;
242 provenance_msg <<
"This version of Chaste was compiled on:\n";
245 *out_file << provenance_msg.str();
256 std::stringstream output;
257 output <<
"<ChasteBuildInfo>\n";
259 output <<
"\t<ProvenanceInfo>\n";
264 output <<
"\t\t<CurrentTime>" << ChasteGetCurrentTime() <<
"</CurrentTime>\n";
268 output <<
"\t\t<Projects>\n";
272 for (
const auto& r_project_version : r_projects_versions)
276 output <<
"\t\t\t<Project>" << std::endl;
277 output <<
"\t\t\t\t<Name>" << r_project_version.first <<
"</Name>" << std::endl;
278 output <<
"\t\t\t\t<Version>" << r_project_version.second <<
"</Version>" << std::endl;
279 output <<
"\t\t\t\t<Modified>" << r_projects_modified.at(r_project_version.first) <<
"</Modified>" << std::endl;
280 output <<
"\t\t\t</Project>" << std::endl;
284 output <<
"\t\t</Projects>\n";
286 output <<
"\t</ProvenanceInfo>\n";
288 output <<
"\t<Compiler>\n";
291 output <<
"\t</Compiler>\n";
293 output <<
"\t<Libraries>\n";
295 output <<
"\t\t<CompiledIn>\n";
296 output <<
"\t\t\t<PETSc>" << PETSC_VERSION_MAJOR <<
"." << PETSC_VERSION_MINOR <<
"." << PETSC_VERSION_SUBMINOR <<
"</PETSc>\n";
297 output <<
"\t\t\t<Boost>" << BOOST_VERSION / 100000 <<
"." << BOOST_VERSION / 100 % 1000 <<
"." << BOOST_VERSION % 100 <<
"</Boost>\n";
298 output <<
"\t\t\t<HDF5>" << H5_VERS_MAJOR <<
"." << H5_VERS_MINOR <<
"." << H5_VERS_RELEASE <<
"</HDF5>\n";
299#ifdef PARMETIS_MAJOR_VERSION
300 output <<
"\t\t\t<Parmetis>" << PARMETIS_MAJOR_VERSION <<
"." << PARMETIS_MINOR_VERSION;
301#ifdef PARMETIS_SUBMINOR_VERSION
302 output <<
"." << PARMETIS_SUBMINOR_VERSION;
304 output <<
"</Parmetis>" << std::endl;
307 output <<
"\t\t\t<Parmetis>[NONE]</Parmetis>" << std::endl;
308 output <<
"\t\t\t<PT-Scotch>" << SCOTCH_VERSION<<
"."<<SCOTCH_RELEASE<<
"."<<SCOTCH_PATCHLEVEL<<
"</PT-Scotch>"<< std::endl;
311 output <<
"\t\t</CompiledIn>\n";
313 output <<
"\t\t<Binaries>\n";
315 output <<
"\t\t</Binaries>\n";
317 output <<
"\t\t<Optional>\n";
319 output <<
"\t\t\t<SUNDIALS>" << CHASTE_SUNDIALS_PACKAGE_VERSION <<
"</SUNDIALS>";
320#if CHASTE_SUNDIALS_VERSION < 30000
321 output <<
"<!-- includes Cvode of a different version number -->";
325 output <<
"\t\t\t<SUNDIALS>no</SUNDIALS>\n";
328 output <<
"\t\t\t<VTK>" << VTK_MAJOR_VERSION <<
"." << VTK_MINOR_VERSION <<
"</VTK>\n";
330 output <<
"\t\t\t<VTK>no</VTK>\n";
333 output <<
"\t\t\t<Xerces>" << XERCES_FULLVERSIONDOT <<
"</Xerces>\n";
335 output <<
"\t\t\t<Xerces>no</Xerces>\n";
337 output <<
"\t\t</Optional>\n";
339 output <<
"\t</Libraries>\n";
343 output <<
"</ChasteBuildInfo>" << std::endl;
344 rInfo = output.str();
365 std::cerr << rMessage << std::endl;
378 *out_file << rMessage << std::endl;
387 std::cout << rMessage << std::endl
static const std::map< std::string, std::string > & rGetIfProjectsModified()
static unsigned long long GetRevisionNumber()
static const char * GetBuilderUnameInfo()
static const char * GetCompilerFlags()
static const char * GetBuildTime()
static std::string GetChasteCodegenVersion()
static std::string GetVersionString()
static const char * GetBuildInformation()
static const std::map< std::string, std::string > & rGetProjectVersions()
static bool IsWorkingCopyModified()
static const char * GetCompilerVersion()
static const char * GetCompilerType()
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()