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 73 #include <boost/preprocessor/stringize.hpp> 74 #define CHASTE_SUNDIALS_PACKAGE_VERSION BOOST_PP_STRINGIZE(SUNDIALS_PACKAGE_VERSION) 76 #define CHASTE_SUNDIALS_PACKAGE_VERSION SUNDIALS_PACKAGE_VERSION 77 #endif // SUNDIALS >= 2.6.0 83 #include <xercesc/util/XercesVersion.hpp> 87 #ifdef CHASTE_PARMETIS_REQUIRED 88 #if PARMETIS_MAJOR_VERSION != CHASTE_PARMETIS_REQUIRED 89 #error "Wrong ParMETIS version found: " #CHASTE_PARMETIS_REQUIRED " requested but " #PARMETIS_MAJOR_VERSION " present" 113 PETSCEXCEPT(PetscInitialize(pArgc, pArgv, PETSC_NULL, PETSC_NULL));
127 std::stringstream provenance_msg;
128 provenance_msg <<
"This version of Chaste was compiled on:\n";
138 std::cout << provenance_msg.str() << std::flush;
165 std::stringstream file_name;
167 out_stream out_file = out_file_handler.
OpenOutputFile(file_name.str());
176 *out_file <<
"uname sysname = " 177 <<
"Microsoft Windows" << std::endl;
178 #define INFO_BUFFER_SIZE 32767 179 TCHAR info_buffer[INFO_BUFFER_SIZE];
180 DWORD buffer_char_count = INFO_BUFFER_SIZE;
181 if (!GetComputerName(info_buffer, &buffer_char_count))
182 *out_file <<
"uname nodename = " 183 <<
"Windows machine name is unknown" << std::endl;
185 *out_file <<
"uname nodename = " << info_buffer << std::endl;
187 OSVERSIONINFOEX os_info;
188 ZeroMemory(&os_info,
sizeof(OSVERSIONINFO));
189 os_info.dwOSVersionInfoSize =
sizeof(OSVERSIONINFO);
191 GetVersionEx((OSVERSIONINFO*)&os_info);
194 if (os_info.dwMajorVersion < 6)
196 *out_file <<
"uname release = " 197 <<
"Microsoft Windows Server 2003 R2 (or earlier)" << std::endl;
202 if (os_info.dwMajorVersion > 6)
204 *out_file <<
"uname release = " 205 <<
"Microsoft Windows (Later than Microsoft Windows 8)" << std::endl;
209 if (os_info.dwMinorVersion == 2)
211 if (os_info.wProductType == VER_NT_WORKSTATION)
212 *out_file <<
"uname release = " 213 <<
"Microsoft Windows 8" << std::endl;
215 *out_file <<
"uname release = " 216 <<
"Microsoft Windows Server 2012" << std::endl;
218 else if (os_info.dwMinorVersion == 1)
220 if (os_info.wProductType == VER_NT_WORKSTATION)
221 *out_file <<
"uname release = " 222 <<
"Microsoft Windows 7" << std::endl;
224 *out_file <<
"uname release = " 225 <<
"Microsoft Windows Server 2008 R2" << std::endl;
227 else if (os_info.dwMinorVersion == 0)
229 if (os_info.wProductType == VER_NT_WORKSTATION)
230 *out_file <<
"uname release = " 231 <<
"Microsoft Windows Server 2008" << std::endl;
233 *out_file <<
"uname release = " 234 <<
"Microsoft Windows Vista" << std::endl;
238 *out_file <<
"uname version = " << os_info.dwMajorVersion <<
"." << os_info.dwMinorVersion << std::endl;
242 SYSTEM_INFO sys_info;
243 GetSystemInfo(&sys_info);
244 switch (sys_info.wProcessorArchitecture)
246 case PROCESSOR_ARCHITECTURE_AMD64:
247 *out_file <<
"uname machine = " 248 <<
"x64 (AMD or Intel)" << std::endl;
250 case PROCESSOR_ARCHITECTURE_ARM:
251 *out_file <<
"uname machine = " 252 <<
"ARM" << std::endl;
254 case PROCESSOR_ARCHITECTURE_IA64:
255 *out_file <<
"uname machine = " 256 <<
"Intel Itanium-based" << std::endl;
258 case PROCESSOR_ARCHITECTURE_INTEL:
259 *out_file <<
"uname machine = " 260 <<
"x86" << std::endl;
262 case PROCESSOR_ARCHITECTURE_UNKNOWN:
263 *out_file <<
"uname machine = " 264 <<
"Unknown Architecture" << std::endl;
267 *out_file <<
"uname machine = " 268 <<
"Other Architecture. Code = " << sys_info.wProcessorArchitecture << std::endl;
272 *out_file <<
"\nInformation on number and type of processors:" << std::endl;
273 *out_file << sys_info.dwNumberOfProcessors;
274 *out_file <<
"\nInformation on processor caches, in the same order as above:" << std::endl;
275 *out_file <<
"Unknown" << std::endl;
278 MEMORYSTATUSEX mem_status;
279 mem_status.dwLength =
sizeof(mem_status);
280 GlobalMemoryStatusEx(&mem_status);
281 *out_file <<
"\nInformation on system memory:" << std::endl;
282 *out_file << mem_status.ullTotalPhys / 1024 <<
" kB" << std::endl;
284 struct utsname uts_info;
287 *out_file <<
"uname sysname = " << uts_info.sysname << std::endl
289 *out_file <<
"uname nodename = " << uts_info.nodename << std::endl
291 *out_file <<
"uname release = " << uts_info.release << std::endl
293 *out_file <<
"uname version = " << uts_info.version << std::endl
295 *out_file <<
"uname machine = " << uts_info.machine << std::endl
301 *out_file <<
"\nInformation on number and type processors, and cache and memory sizes (in bytes)\n";
302 system_info = popen(
"sysctl hw.ncpu hw.physicalcpu machdep.cpu.brand_string hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize hw.memsize",
"r");
303 while (fgets(buffer, 100, system_info) != NULL)
310 *out_file <<
"\nInformation on number and type of processors:\n";
311 system_info = popen(
"grep ^model.name /proc/cpuinfo",
"r");
312 while (fgets(buffer, 100, system_info) !=
nullptr)
318 *out_file <<
"\nInformation on processor caches, in the same order as above:\n";
319 system_info = popen(
"grep ^cache.size /proc/cpuinfo",
"r");
320 while (fgets(buffer, 100, system_info) !=
nullptr)
326 *out_file <<
"\nInformation on system memory:\n";
327 system_info = popen(
"grep ^MemTotal /proc/meminfo",
"r");
328 while (fgets(buffer, 100, system_info) !=
nullptr)
333 #endif //end of __APPLE__ not defined 334 #endif //end of _MSC_VER not defined 352 std::stringstream provenance_msg;
353 provenance_msg <<
"This version of Chaste was compiled on:\n";
356 *out_file << provenance_msg.str();
367 std::stringstream output;
368 output <<
"<ChasteBuildInfo>\n";
370 output <<
"\t<ProvenanceInfo>\n";
375 output <<
"\t\t<CurrentTime>" << ChasteGetCurrentTime() <<
"</CurrentTime>\n";
377 output <<
"\t\t<Projects>\n";
384 output <<
"\t\t\t<Project>" << std::endl;
385 output <<
"\t\t\t\t<Name>" << r_project_version.first <<
"</Name>" << std::endl;
386 output <<
"\t\t\t\t<Version>" << r_project_version.second <<
"</Version>" << std::endl;
387 output <<
"\t\t\t\t<Modified>" << projects_modified[r_project_version.first] <<
"</Modified>" << std::endl;
388 output <<
"\t\t\t</Project>" << std::endl;
391 output <<
"\t\t</Projects>\n";
392 output <<
"\t</ProvenanceInfo>\n";
394 output <<
"\t<Compiler>\n";
397 output <<
"\t</Compiler>\n";
399 output <<
"\t<Libraries>\n";
401 output <<
"\t\t<CompiledIn>\n";
402 output <<
"\t\t\t<PETSc>" << PETSC_VERSION_MAJOR <<
"." << PETSC_VERSION_MINOR <<
"." << PETSC_VERSION_SUBMINOR <<
"</PETSc>\n";
403 output <<
"\t\t\t<Boost>" << BOOST_VERSION / 100000 <<
"." << BOOST_VERSION / 100 % 1000 <<
"." << BOOST_VERSION % 100 <<
"</Boost>\n";
404 output <<
"\t\t\t<HDF5>" << H5_VERS_MAJOR <<
"." << H5_VERS_MINOR <<
"." << H5_VERS_RELEASE <<
"</HDF5>\n";
405 output <<
"\t\t\t<Parmetis>" << PARMETIS_MAJOR_VERSION <<
"." << PARMETIS_MINOR_VERSION;
406 #ifdef PARMETIS_SUBMINOR_VERSION // they only added this in v4.? !! 407 output <<
"." << PARMETIS_SUBMINOR_VERSION;
409 output <<
"</Parmetis>" << std::endl;
410 output <<
"\t\t</CompiledIn>\n";
412 output <<
"\t\t<Binaries>\n";
414 output <<
"\t\t</Binaries>\n";
416 output <<
"\t\t<Optional>\n";
418 output <<
"\t\t\t<SUNDIALS>" << CHASTE_SUNDIALS_PACKAGE_VERSION <<
"</SUNDIALS> <!-- includes Cvode of a different version number --> \n";
420 output <<
"\t\t\t<SUNDIALS>no</SUNDIALS>\n";
423 output <<
"\t\t\t<VTK>" << VTK_MAJOR_VERSION <<
"." << VTK_MINOR_VERSION <<
"</VTK>\n";
425 output <<
"\t\t\t<VTK>no</VTK>\n";
428 output <<
"\t\t\t<Xerces>" << XERCES_FULLVERSIONDOT <<
"</Xerces>\n";
430 output <<
"\t\t\t<Xerces>no</Xerces>\n";
432 output <<
"\t\t</Optional>\n";
434 output <<
"\t</Libraries>\n";
436 output <<
"</ChasteBuildInfo>" << std::endl;
437 rInfo = output.str();
458 std::cerr << rMessage << std::endl;
471 *out_file << rMessage << std::endl;
480 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)