36 #include "ExecutableSupport.hpp"
38 #include "Version.hpp"
45 #define GetCurrentTime() ChasteBuildInfo::GetCurrentTime()
46 #define ChasteGetCurrentTime() GetCurrentTime()
48 #include <sys/utsname.h>
49 #define ChasteGetCurrentTime() ChasteBuildInfo::GetCurrentTime()
54 #include <boost/foreach.hpp>
55 typedef std::pair<std::string, std::string> StringPair;
58 #include "CommandLineArguments.hpp"
60 #include "PetscException.hpp"
61 #include "PetscSetupUtils.hpp"
65 #define _BACKWARD_BACKWARD_WARNING_H 1 //Cut out the strstream deprecated warning for now (gcc4.3)
66 #include <vtkVersion.h>
70 #include <sundials/sundials_config.h>
71 #if CHASTE_SUNDIALS_VERSION >= 20600
72 #if CHASTE_SUNDIALS_VERSION >= 30000
74 #define CHASTE_SUNDIALS_PACKAGE_VERSION SUNDIALS_VERSION
77 #include <boost/preprocessor/stringize.hpp>
78 #define CHASTE_SUNDIALS_PACKAGE_VERSION BOOST_PP_STRINGIZE(SUNDIALS_PACKAGE_VERSION)
79 #endif // SUNDIALS >= 3.0.0
81 #define CHASTE_SUNDIALS_PACKAGE_VERSION SUNDIALS_PACKAGE_VERSION
82 #endif // SUNDIALS >= 2.6.0
88 #include <xercesc/util/XercesVersion.hpp>
92 #ifdef CHASTE_PARMETIS_REQUIRED
93 #if PARMETIS_MAJOR_VERSION != CHASTE_PARMETIS_REQUIRED
94 #error "Wrong ParMETIS version found: " #CHASTE_PARMETIS_REQUIRED " requested but " #PARMETIS_MAJOR_VERSION " present"
118 PETSCEXCEPT(PetscInitialize(pArgc, pArgv, PETSC_NULL, PETSC_NULL));
132 std::stringstream provenance_msg;
133 provenance_msg <<
"This version of Chaste was compiled on:\n";
143 std::cout << provenance_msg.str() << std::flush;
170 std::stringstream file_name;
172 out_stream out_file = out_file_handler.
OpenOutputFile(file_name.str());
181 *out_file <<
"uname sysname = "
182 <<
"Microsoft Windows" << std::endl;
183 #define INFO_BUFFER_SIZE 32767
184 TCHAR info_buffer[INFO_BUFFER_SIZE];
185 DWORD buffer_char_count = INFO_BUFFER_SIZE;
186 if (!GetComputerName(info_buffer, &buffer_char_count))
187 *out_file <<
"uname nodename = "
188 <<
"Windows machine name is unknown" << std::endl;
190 *out_file <<
"uname nodename = " << info_buffer << std::endl;
192 OSVERSIONINFOEX os_info;
193 ZeroMemory(&os_info,
sizeof(OSVERSIONINFO));
194 os_info.dwOSVersionInfoSize =
sizeof(OSVERSIONINFO);
196 GetVersionEx((OSVERSIONINFO*)&os_info);
199 if (os_info.dwMajorVersion < 6)
201 *out_file <<
"uname release = "
202 <<
"Microsoft Windows Server 2003 R2 (or earlier)" << std::endl;
207 if (os_info.dwMajorVersion > 6)
209 *out_file <<
"uname release = "
210 <<
"Microsoft Windows (Later than Microsoft Windows 8)" << std::endl;
214 if (os_info.dwMinorVersion == 2)
216 if (os_info.wProductType == VER_NT_WORKSTATION)
217 *out_file <<
"uname release = "
218 <<
"Microsoft Windows 8" << std::endl;
220 *out_file <<
"uname release = "
221 <<
"Microsoft Windows Server 2012" << std::endl;
223 else if (os_info.dwMinorVersion == 1)
225 if (os_info.wProductType == VER_NT_WORKSTATION)
226 *out_file <<
"uname release = "
227 <<
"Microsoft Windows 7" << std::endl;
229 *out_file <<
"uname release = "
230 <<
"Microsoft Windows Server 2008 R2" << std::endl;
232 else if (os_info.dwMinorVersion == 0)
234 if (os_info.wProductType == VER_NT_WORKSTATION)
235 *out_file <<
"uname release = "
236 <<
"Microsoft Windows Server 2008" << std::endl;
238 *out_file <<
"uname release = "
239 <<
"Microsoft Windows Vista" << std::endl;
243 *out_file <<
"uname version = " << os_info.dwMajorVersion <<
"." << os_info.dwMinorVersion << std::endl;
247 SYSTEM_INFO sys_info;
248 GetSystemInfo(&sys_info);
249 switch (sys_info.wProcessorArchitecture)
251 case PROCESSOR_ARCHITECTURE_AMD64:
252 *out_file <<
"uname machine = "
253 <<
"x64 (AMD or Intel)" << std::endl;
255 case PROCESSOR_ARCHITECTURE_ARM:
256 *out_file <<
"uname machine = "
257 <<
"ARM" << std::endl;
259 case PROCESSOR_ARCHITECTURE_IA64:
260 *out_file <<
"uname machine = "
261 <<
"Intel Itanium-based" << std::endl;
263 case PROCESSOR_ARCHITECTURE_INTEL:
264 *out_file <<
"uname machine = "
265 <<
"x86" << std::endl;
267 case PROCESSOR_ARCHITECTURE_UNKNOWN:
268 *out_file <<
"uname machine = "
269 <<
"Unknown Architecture" << std::endl;
272 *out_file <<
"uname machine = "
273 <<
"Other Architecture. Code = " << sys_info.wProcessorArchitecture << std::endl;
277 *out_file <<
"\nInformation on number and type of processors:" << std::endl;
278 *out_file << sys_info.dwNumberOfProcessors;
279 *out_file <<
"\nInformation on processor caches, in the same order as above:" << std::endl;
280 *out_file <<
"Unknown" << std::endl;
283 MEMORYSTATUSEX mem_status;
284 mem_status.dwLength =
sizeof(mem_status);
285 GlobalMemoryStatusEx(&mem_status);
286 *out_file <<
"\nInformation on system memory:" << std::endl;
287 *out_file << mem_status.ullTotalPhys / 1024 <<
" kB" << std::endl;
289 struct utsname uts_info;
292 *out_file <<
"uname sysname = " << uts_info.sysname << std::endl
294 *out_file <<
"uname nodename = " << uts_info.nodename << std::endl
296 *out_file <<
"uname release = " << uts_info.release << std::endl
298 *out_file <<
"uname version = " << uts_info.version << std::endl
300 *out_file <<
"uname machine = " << uts_info.machine << std::endl
306 *out_file <<
"\nInformation on number and type processors, and cache and memory sizes (in bytes)\n";
307 system_info = popen(
"sysctl hw.ncpu hw.physicalcpu machdep.cpu.brand_string hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize hw.memsize",
"r");
308 while (fgets(buffer, 100, system_info) != NULL)
315 *out_file <<
"\nInformation on number and type of processors:\n";
316 system_info = popen(
"grep ^model.name /proc/cpuinfo",
"r");
317 while (fgets(buffer, 100, system_info) !=
nullptr)
323 *out_file <<
"\nInformation on processor caches, in the same order as above:\n";
324 system_info = popen(
"grep ^cache.size /proc/cpuinfo",
"r");
325 while (fgets(buffer, 100, system_info) !=
nullptr)
331 *out_file <<
"\nInformation on system memory:\n";
332 system_info = popen(
"grep ^MemTotal /proc/meminfo",
"r");
333 while (fgets(buffer, 100, system_info) !=
nullptr)
338 #endif //end of __APPLE__ not defined
339 #endif //end of _MSC_VER not defined
357 std::stringstream provenance_msg;
358 provenance_msg <<
"This version of Chaste was compiled on:\n";
361 *out_file << provenance_msg.str();
372 std::stringstream output;
373 output <<
"<ChasteBuildInfo>\n";
375 output <<
"\t<ProvenanceInfo>\n";
380 output <<
"\t\t<CurrentTime>" << ChasteGetCurrentTime() <<
"</CurrentTime>\n";
382 output <<
"\t\t<Projects>\n";
389 output <<
"\t\t\t<Project>" << std::endl;
390 output <<
"\t\t\t\t<Name>" << r_project_version.first <<
"</Name>" << std::endl;
391 output <<
"\t\t\t\t<Version>" << r_project_version.second <<
"</Version>" << std::endl;
392 output <<
"\t\t\t\t<Modified>" << projects_modified[r_project_version.first] <<
"</Modified>" << std::endl;
393 output <<
"\t\t\t</Project>" << std::endl;
396 output <<
"\t\t</Projects>\n";
397 output <<
"\t</ProvenanceInfo>\n";
399 output <<
"\t<Compiler>\n";
402 output <<
"\t</Compiler>\n";
404 output <<
"\t<Libraries>\n";
406 output <<
"\t\t<CompiledIn>\n";
407 output <<
"\t\t\t<PETSc>" << PETSC_VERSION_MAJOR <<
"." << PETSC_VERSION_MINOR <<
"." << PETSC_VERSION_SUBMINOR <<
"</PETSc>\n";
408 output <<
"\t\t\t<Boost>" << BOOST_VERSION / 100000 <<
"." << BOOST_VERSION / 100 % 1000 <<
"." << BOOST_VERSION % 100 <<
"</Boost>\n";
409 output <<
"\t\t\t<HDF5>" << H5_VERS_MAJOR <<
"." << H5_VERS_MINOR <<
"." << H5_VERS_RELEASE <<
"</HDF5>\n";
410 output <<
"\t\t\t<Parmetis>" << PARMETIS_MAJOR_VERSION <<
"." << PARMETIS_MINOR_VERSION;
411 #ifdef PARMETIS_SUBMINOR_VERSION // they only added this in v4.? !!
412 output <<
"." << PARMETIS_SUBMINOR_VERSION;
414 output <<
"</Parmetis>" << std::endl;
415 output <<
"\t\t</CompiledIn>\n";
417 output <<
"\t\t<Binaries>\n";
419 output <<
"\t\t</Binaries>\n";
421 output <<
"\t\t<Optional>\n";
423 output <<
"\t\t\t<SUNDIALS>" << CHASTE_SUNDIALS_PACKAGE_VERSION <<
"</SUNDIALS>";
424 #if CHASTE_SUNDIALS_VERSION < 30000
425 output <<
"<!-- includes Cvode of a different version number -->";
429 output <<
"\t\t\t<SUNDIALS>no</SUNDIALS>\n";
432 output <<
"\t\t\t<VTK>" << VTK_MAJOR_VERSION <<
"." << VTK_MINOR_VERSION <<
"</VTK>\n";
434 output <<
"\t\t\t<VTK>no</VTK>\n";
437 output <<
"\t\t\t<Xerces>" << XERCES_FULLVERSIONDOT <<
"</Xerces>\n";
439 output <<
"\t\t\t<Xerces>no</Xerces>\n";
441 output <<
"\t\t</Optional>\n";
443 output <<
"\t</Libraries>\n";
445 output <<
"</ChasteBuildInfo>" << std::endl;
446 rInfo = output.str();
467 std::cerr << rMessage << std::endl;
480 *out_file << rMessage << std::endl;
489 std::cout << rMessage << std::endl
static void FinalizePetsc()
static std::string GetLicenceText()
static const char * GetCompilerType()
static const char * GetBuildInformation()
static const std::map< std::string, std::string > & rGetIfProjectsModified()
static bool IsAbsolutePath(const std::string &rPath)
static void Print(const std::string &rMessage)
static void CommonFinalize()
static const char * GetCompilerFlags()
static void ShowParallelLaunching()
static void WriteProvenanceInfoFile()
out_stream OpenOutputFile(const std::string &rFileName, std::ios_base::openmode mode=std::ios::out|std::ios::trunc) const
static const char * GetBuilderUnameInfo()
static const char * GetBuildTime()
static bool IsWorkingCopyModified()
static void PrintError(const std::string &rMessage, bool masterOnly=false)
static void StandardStartup(int *pArgc, char ***pArgv)
static const char * GetXsdVersion()
static FileFinder mOutputDirectory
static void InitializePetsc(int *pArgc, char ***pArgv)
static void GetBuildInfo(std::string &rInfo)
static CommandLineArguments * Instance()
static const char * GetCompilerVersion()
static void StartupWithoutShowingCopyright(int *pArgc, char ***pArgv)
virtual void SetPath(const std::string &rPath, RelativeTo::Value relativeTo)
static std::string GetVersionString()
static void ShowCopyright()
static void WriteMachineInfoFile(std::string fileBaseName)
static unsigned long long GetRevisionNumber()
static const std::map< std::string, std::string > & rGetProjectVersions()
static void SetOutputDirectory(const std::string &rOutputDirectory)