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;
57 #include "CommandLineArguments.hpp"
60 #include "PetscSetupUtils.hpp"
61 #include "PetscException.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));
117 #define COVERAGE_IGNORE
120 #undef COVERAGE_IGNORE
127 std::stringstream provenance_msg;
128 provenance_msg <<
"This version of Chaste was compiled on:\n";
138 std::cout << provenance_msg.str() << std::flush;
158 #define COVERAGE_IGNORE
161 #undef COVERAGE_IGNORE
164 std::stringstream file_name;
166 out_stream out_file = out_file_handler.
OpenOutputFile(file_name.str());
174 *out_file <<
"uname sysname = " <<
"Microsoft Windows" << std::endl;
175 #define INFO_BUFFER_SIZE 32767
176 TCHAR info_buffer[INFO_BUFFER_SIZE];
177 DWORD buffer_char_count = INFO_BUFFER_SIZE;
178 if(!GetComputerName(info_buffer, &buffer_char_count))
179 *out_file <<
"uname nodename = " <<
"Windows machine name is unknown" << std::endl;
181 *out_file <<
"uname nodename = " << info_buffer << std::endl;
183 OSVERSIONINFOEX os_info;
184 ZeroMemory(&os_info,
sizeof(OSVERSIONINFO));
185 os_info.dwOSVersionInfoSize =
sizeof(OSVERSIONINFO);
187 GetVersionEx((OSVERSIONINFO*) &os_info);
190 if(os_info.dwMajorVersion < 6)
192 *out_file <<
"uname release = " <<
"Microsoft Windows Server 2003 R2 (or earlier)" << std::endl;
196 if(os_info.dwMajorVersion > 6)
198 *out_file <<
"uname release = " <<
"Microsoft Windows (Later than Microsoft Windows 8)" << std::endl;
202 if(os_info.dwMinorVersion == 2)
204 if(os_info.wProductType == VER_NT_WORKSTATION)
205 *out_file <<
"uname release = " <<
"Microsoft Windows 8" << std::endl;
207 *out_file <<
"uname release = " <<
"Microsoft Windows Server 2012" << std::endl;
209 else if(os_info.dwMinorVersion == 1)
211 if(os_info.wProductType == VER_NT_WORKSTATION)
212 *out_file <<
"uname release = " <<
"Microsoft Windows 7" << std::endl;
214 *out_file <<
"uname release = " <<
"Microsoft Windows Server 2008 R2" << std::endl;
216 else if(os_info.dwMinorVersion == 0)
218 if(os_info.wProductType == VER_NT_WORKSTATION)
219 *out_file <<
"uname release = " <<
"Microsoft Windows Server 2008" << std::endl;
221 *out_file <<
"uname release = " <<
"Microsoft Windows Vista" << std::endl;
225 *out_file <<
"uname version = " << os_info.dwMajorVersion <<
"." << os_info.dwMinorVersion << std::endl;
229 SYSTEM_INFO sys_info;
230 GetSystemInfo(&sys_info);
231 switch (sys_info.wProcessorArchitecture)
233 case PROCESSOR_ARCHITECTURE_AMD64:
234 *out_file <<
"uname machine = " <<
"x64 (AMD or Intel)" << std::endl;
236 case PROCESSOR_ARCHITECTURE_ARM:
237 *out_file <<
"uname machine = " <<
"ARM" << std::endl;
239 case PROCESSOR_ARCHITECTURE_IA64:
240 *out_file <<
"uname machine = " <<
"Intel Itanium-based" << std::endl;
242 case PROCESSOR_ARCHITECTURE_INTEL:
243 *out_file <<
"uname machine = " <<
"x86" << std::endl;
245 case PROCESSOR_ARCHITECTURE_UNKNOWN:
246 *out_file <<
"uname machine = " <<
"Unknown Architecture" << std::endl;
249 *out_file <<
"uname machine = " <<
"Other Architecture. Code = " << sys_info.wProcessorArchitecture << std::endl;
253 *out_file <<
"\nInformation on number and type of processors:" << std::endl;
254 *out_file << sys_info.dwNumberOfProcessors;
255 *out_file <<
"\nInformation on processor caches, in the same order as above:" << std::endl;
256 *out_file <<
"Unknown" << std::endl;
259 MEMORYSTATUSEX mem_status;
260 mem_status.dwLength =
sizeof (mem_status);
261 GlobalMemoryStatusEx (&mem_status);
262 *out_file <<
"\nInformation on system memory:" << std::endl;
263 *out_file << mem_status.ullTotalPhys/1024 <<
" kB" << std::endl;
265 struct utsname uts_info;
268 *out_file <<
"uname sysname = " << uts_info.sysname << std::endl << std::flush;
269 *out_file <<
"uname nodename = " << uts_info.nodename << std::endl << std::flush;
270 *out_file <<
"uname release = " << uts_info.release << std::endl << std::flush;
271 *out_file <<
"uname version = " << uts_info.version << std::endl << std::flush;
272 *out_file <<
"uname machine = " << uts_info.machine << std::endl << std::flush;
277 *out_file <<
"\nInformation on number and type processors, and cache and memory sizes (in bytes)\n";
278 system_info = popen(
"sysctl hw.ncpu hw.physicalcpu machdep.cpu.brand_string hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize hw.memsize",
"r");
279 while ( fgets(buffer, 100, system_info) != NULL )
286 *out_file <<
"\nInformation on number and type of processors:\n";
287 system_info = popen(
"grep ^model.name /proc/cpuinfo",
"r");
288 while ( fgets(buffer, 100, system_info) != NULL )
294 *out_file <<
"\nInformation on processor caches, in the same order as above:\n";
295 system_info = popen(
"grep ^cache.size /proc/cpuinfo",
"r");
296 while ( fgets(buffer, 100, system_info) != NULL )
302 *out_file <<
"\nInformation on system memory:\n";
303 system_info = popen(
"grep ^MemTotal /proc/meminfo",
"r");
304 while ( fgets(buffer, 100, system_info) != NULL )
309 #endif //end of __APPLE__ not defined
310 #endif //end of _MSC_VER not defined
319 #define COVERAGE_IGNORE
322 #undef COVERAGE_IGNORE
328 std::stringstream provenance_msg;
329 provenance_msg <<
"This version of Chaste was compiled on:\n";
332 *out_file << provenance_msg.str();
343 std::stringstream output;
344 output <<
"<ChasteBuildInfo>\n";
346 output <<
"\t<ProvenanceInfo>\n";
351 output <<
"\t\t<CurrentTime>"<< ChasteGetCurrentTime() <<
"</CurrentTime>\n";
353 output <<
"\t\t<Projects>\n";
356 #define COVERAGE_IGNORE
358 output<<
"\t\t\t<Name>" << r_project_version.first <<
"</Name><Version>"
359 << r_project_version.second <<
"</Version>\n";
360 #undef COVERAGE_IGNORE
362 output <<
"\t\t</Projects>\n";
363 output <<
"\t</ProvenanceInfo>\n";
365 output <<
"\t<Compiler>\n";
368 output <<
"\t</Compiler>\n";
370 output <<
"\t<Libraries>\n";
372 output <<
"\t\t<CompiledIn>\n";
373 output <<
"\t\t\t<PETSc>" << PETSC_VERSION_MAJOR <<
"." << PETSC_VERSION_MINOR <<
"." << PETSC_VERSION_SUBMINOR <<
"</PETSc>\n";
374 output <<
"\t\t\t<Boost>" << BOOST_VERSION / 100000 <<
"." << BOOST_VERSION / 100 % 1000 <<
"." << BOOST_VERSION % 100 <<
"</Boost>\n";
375 output <<
"\t\t\t<HDF5>" << H5_VERS_MAJOR <<
"." << H5_VERS_MINOR <<
"." << H5_VERS_RELEASE <<
"</HDF5>\n";
376 output <<
"\t\t\t<Parmetis>" << PARMETIS_MAJOR_VERSION <<
"." << PARMETIS_MINOR_VERSION;
377 #ifdef PARMETIS_SUBMINOR_VERSION // they only added this in v4.? !!
378 output <<
"." << PARMETIS_SUBMINOR_VERSION;
380 output <<
"</Parmetis>" << std::endl;
381 output <<
"\t\t</CompiledIn>\n";
383 output <<
"\t\t<Binaries>\n";
385 output <<
"\t\t</Binaries>\n";
387 output <<
"\t\t<Optional>\n";
389 output <<
"\t\t\t<SUNDIALS>" << CHASTE_SUNDIALS_PACKAGE_VERSION <<
"</SUNDIALS> <!-- includes Cvode of a different version number --> \n";
391 output <<
"\t\t\t<SUNDIALS>no</SUNDIALS>\n";
394 output <<
"\t\t\t<VTK>" << VTK_MAJOR_VERSION <<
"." << VTK_MINOR_VERSION <<
"</VTK>\n";
396 output <<
"\t\t\t<VTK>no</VTK>\n";
399 output <<
"\t\t\t<Xerces>" << XERCES_FULLVERSIONDOT <<
"</Xerces>\n";
401 output <<
"\t\t\t<Xerces>no</Xerces>\n";
403 output <<
"\t\t</Optional>\n";
405 output <<
"\t</Libraries>\n";
407 output <<
"</ChasteBuildInfo>" << std::endl;
408 rInfo = output.str();
423 std::cerr << rMessage << std::endl;
429 #define COVERAGE_IGNORE
432 #undef COVERAGE_IGNORE
436 *out_file << rMessage << std::endl;
445 std::cout << rMessage << std::endl << std::flush;
static void FinalizePetsc()
static std::string GetLicenceText()
static const char * GetCompilerType()
static const char * GetBuildInformation()
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 unsigned GetRevisionNumber()
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()
virtual void SetPath(const std::string &rPath, RelativeTo::Value relativeTo)
static std::string GetVersionString()
static void ShowCopyright()
static void WriteMachineInfoFile(std::string fileBaseName)
static const std::map< std::string, std::string > & rGetProjectVersions()
static void SetOutputDirectory(const std::string &rOutputDirectory)