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() 56 #include "CommandLineArguments.hpp" 57 #include "PetscException.hpp" 58 #include "PetscSetupUtils.hpp" 62 #define _BACKWARD_BACKWARD_WARNING_H 1 //Cut out the strstream deprecated warning for now (gcc4.3) 63 #include <vtkVersion.h> 67 #include <sundials/sundials_config.h> 68 #if CHASTE_SUNDIALS_VERSION >= 20600 69 #if CHASTE_SUNDIALS_VERSION >= 30000 71 #define CHASTE_SUNDIALS_PACKAGE_VERSION SUNDIALS_VERSION 74 #include <boost/preprocessor/stringize.hpp> 75 #define CHASTE_SUNDIALS_PACKAGE_VERSION BOOST_PP_STRINGIZE(SUNDIALS_PACKAGE_VERSION) 76 #endif // SUNDIALS >= 3.0.0 78 #define CHASTE_SUNDIALS_PACKAGE_VERSION SUNDIALS_PACKAGE_VERSION 79 #endif // SUNDIALS >= 2.6.0 85 #include <xercesc/util/XercesVersion.hpp> 89 #ifdef CHASTE_PARMETIS_REQUIRED 90 #if PARMETIS_MAJOR_VERSION != CHASTE_PARMETIS_REQUIRED 91 #error "Wrong ParMETIS version found: " #CHASTE_PARMETIS_REQUIRED " requested but " #PARMETIS_MAJOR_VERSION " present" 115 PETSCEXCEPT(PetscInitialize(pArgc, pArgv, PETSC_NULL, PETSC_NULL));
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());
178 *out_file <<
"uname sysname = " 179 <<
"Microsoft Windows" << std::endl;
180 #define INFO_BUFFER_SIZE 32767 181 TCHAR info_buffer[INFO_BUFFER_SIZE];
182 DWORD buffer_char_count = INFO_BUFFER_SIZE;
183 if (!GetComputerName(info_buffer, &buffer_char_count))
184 *out_file <<
"uname nodename = " 185 <<
"Windows machine name is unknown" << std::endl;
187 *out_file <<
"uname nodename = " << info_buffer << std::endl;
189 OSVERSIONINFOEX os_info;
190 ZeroMemory(&os_info,
sizeof(OSVERSIONINFO));
191 os_info.dwOSVersionInfoSize =
sizeof(OSVERSIONINFO);
193 GetVersionEx((OSVERSIONINFO*)&os_info);
196 if (os_info.dwMajorVersion < 6)
198 *out_file <<
"uname release = " 199 <<
"Microsoft Windows Server 2003 R2 (or earlier)" << std::endl;
204 if (os_info.dwMajorVersion > 6)
206 *out_file <<
"uname release = " 207 <<
"Microsoft Windows (Later than Microsoft Windows 8)" << std::endl;
211 if (os_info.dwMinorVersion == 2)
213 if (os_info.wProductType == VER_NT_WORKSTATION)
214 *out_file <<
"uname release = " 215 <<
"Microsoft Windows 8" << std::endl;
217 *out_file <<
"uname release = " 218 <<
"Microsoft Windows Server 2012" << std::endl;
220 else if (os_info.dwMinorVersion == 1)
222 if (os_info.wProductType == VER_NT_WORKSTATION)
223 *out_file <<
"uname release = " 224 <<
"Microsoft Windows 7" << std::endl;
226 *out_file <<
"uname release = " 227 <<
"Microsoft Windows Server 2008 R2" << std::endl;
229 else if (os_info.dwMinorVersion == 0)
231 if (os_info.wProductType == VER_NT_WORKSTATION)
232 *out_file <<
"uname release = " 233 <<
"Microsoft Windows Server 2008" << std::endl;
235 *out_file <<
"uname release = " 236 <<
"Microsoft Windows Vista" << std::endl;
240 *out_file <<
"uname version = " << os_info.dwMajorVersion <<
"." << os_info.dwMinorVersion << std::endl;
244 SYSTEM_INFO sys_info;
245 GetSystemInfo(&sys_info);
246 switch (sys_info.wProcessorArchitecture)
248 case PROCESSOR_ARCHITECTURE_AMD64:
249 *out_file <<
"uname machine = " 250 <<
"x64 (AMD or Intel)" << std::endl;
252 case PROCESSOR_ARCHITECTURE_ARM:
253 *out_file <<
"uname machine = " 254 <<
"ARM" << std::endl;
256 case PROCESSOR_ARCHITECTURE_IA64:
257 *out_file <<
"uname machine = " 258 <<
"Intel Itanium-based" << std::endl;
260 case PROCESSOR_ARCHITECTURE_INTEL:
261 *out_file <<
"uname machine = " 262 <<
"x86" << std::endl;
264 case PROCESSOR_ARCHITECTURE_UNKNOWN:
265 *out_file <<
"uname machine = " 266 <<
"Unknown Architecture" << std::endl;
269 *out_file <<
"uname machine = " 270 <<
"Other Architecture. Code = " << sys_info.wProcessorArchitecture << std::endl;
274 *out_file <<
"\nInformation on number and type of processors:" << std::endl;
275 *out_file << sys_info.dwNumberOfProcessors;
276 *out_file <<
"\nInformation on processor caches, in the same order as above:" << std::endl;
277 *out_file <<
"Unknown" << std::endl;
280 MEMORYSTATUSEX mem_status;
281 mem_status.dwLength =
sizeof(mem_status);
282 GlobalMemoryStatusEx(&mem_status);
283 *out_file <<
"\nInformation on system memory:" << std::endl;
284 *out_file << mem_status.ullTotalPhys / 1024 <<
" kB" << std::endl;
286 struct utsname uts_info;
289 *out_file <<
"uname sysname = " << uts_info.sysname << std::endl
291 *out_file <<
"uname nodename = " << uts_info.nodename << std::endl
293 *out_file <<
"uname release = " << uts_info.release << std::endl
295 *out_file <<
"uname version = " << uts_info.version << std::endl
297 *out_file <<
"uname machine = " << uts_info.machine << std::endl
303 *out_file <<
"\nInformation on number and type processors, and cache and memory sizes (in bytes)\n";
304 system_info = popen(
"sysctl hw.ncpu hw.physicalcpu machdep.cpu.brand_string hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize hw.memsize",
"r");
305 while (fgets(buffer, 100, system_info) != NULL)
312 *out_file <<
"\nInformation on number and type of processors:\n";
313 system_info = popen(
"grep ^model.name /proc/cpuinfo",
"r");
314 while (fgets(buffer, 100, system_info) !=
nullptr)
320 *out_file <<
"\nInformation on processor caches, in the same order as above:\n";
321 system_info = popen(
"grep ^cache.size /proc/cpuinfo",
"r");
322 while (fgets(buffer, 100, system_info) !=
nullptr)
328 *out_file <<
"\nInformation on system memory:\n";
329 system_info = popen(
"grep ^MemTotal /proc/meminfo",
"r");
330 while (fgets(buffer, 100, system_info) !=
nullptr)
335 #endif //end of __APPLE__ not defined 336 #endif //end of _MSC_VER not defined 354 std::stringstream provenance_msg;
355 provenance_msg <<
"This version of Chaste was compiled on:\n";
358 *out_file << provenance_msg.str();
369 std::stringstream output;
370 output <<
"<ChasteBuildInfo>\n";
372 output <<
"\t<ProvenanceInfo>\n";
377 output <<
"\t\t<CurrentTime>" << ChasteGetCurrentTime() <<
"</CurrentTime>\n";
380 output <<
"\t\t<Projects>\n";
384 for (
const auto& r_project_version : r_projects_versions)
388 output <<
"\t\t\t<Project>" << std::endl;
389 output <<
"\t\t\t\t<Name>" << r_project_version.first <<
"</Name>" << std::endl;
390 output <<
"\t\t\t\t<Version>" << r_project_version.second <<
"</Version>" << std::endl;
391 output <<
"\t\t\t\t<Modified>" << r_projects_modified.at(r_project_version.first) <<
"</Modified>" << std::endl;
392 output <<
"\t\t\t</Project>" << std::endl;
396 output <<
"\t\t</Projects>\n";
398 output <<
"\t</ProvenanceInfo>\n";
400 output <<
"\t<Compiler>\n";
403 output <<
"\t</Compiler>\n";
405 output <<
"\t<Libraries>\n";
407 output <<
"\t\t<CompiledIn>\n";
408 output <<
"\t\t\t<PETSc>" << PETSC_VERSION_MAJOR <<
"." << PETSC_VERSION_MINOR <<
"." << PETSC_VERSION_SUBMINOR <<
"</PETSc>\n";
409 output <<
"\t\t\t<Boost>" << BOOST_VERSION / 100000 <<
"." << BOOST_VERSION / 100 % 1000 <<
"." << BOOST_VERSION % 100 <<
"</Boost>\n";
410 output <<
"\t\t\t<HDF5>" << H5_VERS_MAJOR <<
"." << H5_VERS_MINOR <<
"." << H5_VERS_RELEASE <<
"</HDF5>\n";
411 output <<
"\t\t\t<Parmetis>" << PARMETIS_MAJOR_VERSION <<
"." << PARMETIS_MINOR_VERSION;
412 #ifdef PARMETIS_SUBMINOR_VERSION // they only added this in v4.? !! 413 output <<
"." << PARMETIS_SUBMINOR_VERSION;
415 output <<
"</Parmetis>" << std::endl;
416 output <<
"\t\t</CompiledIn>\n";
418 output <<
"\t\t<Binaries>\n";
420 output <<
"\t\t</Binaries>\n";
422 output <<
"\t\t<Optional>\n";
424 output <<
"\t\t\t<SUNDIALS>" << CHASTE_SUNDIALS_PACKAGE_VERSION <<
"</SUNDIALS>";
425 #if CHASTE_SUNDIALS_VERSION < 30000 426 output <<
"<!-- includes Cvode of a different version number -->";
430 output <<
"\t\t\t<SUNDIALS>no</SUNDIALS>\n";
433 output <<
"\t\t\t<VTK>" << VTK_MAJOR_VERSION <<
"." << VTK_MINOR_VERSION <<
"</VTK>\n";
435 output <<
"\t\t\t<VTK>no</VTK>\n";
438 output <<
"\t\t\t<Xerces>" << XERCES_FULLVERSIONDOT <<
"</Xerces>\n";
440 output <<
"\t\t\t<Xerces>no</Xerces>\n";
442 output <<
"\t\t</Optional>\n";
444 output <<
"\t</Libraries>\n";
446 output <<
"</ChasteBuildInfo>" << std::endl;
447 rInfo = output.str();
468 std::cerr << rMessage << std::endl;
481 *out_file << rMessage << std::endl;
490 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()
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)
out_stream OpenOutputFile(const std::string &rFileName, std::ios_base::openmode mode=std::ios::out|std::ios::trunc) const
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)