#include <deal.II/base/multithread_info.h>
-#if defined(__linux__)
-# include <fstream>
-# include <string>
-#endif
-
-#if defined(__sun__) || defined(__osf__) || defined(_AIX)
-# include <unistd.h>
-#endif
-
-#if defined(__sgi__)
+#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
*/
-# if defined(__linux__)
-
-unsigned int MultithreadInfo::get_n_cpus()
-{
- // on linux, we simply count the
- // number of lines listing
- // individual processors when
- // reading from /proc/cpuinfo
- std::ifstream cpuinfo;
- std::string search;
- unsigned int nCPU = 0;
-
- cpuinfo.open("/proc/cpuinfo");
-
- AssertThrow(cpuinfo,ExcProcNotPresent());
-
- while(cpuinfo)
- {
- cpuinfo >> search;
- if (search.find("processor") != std::string::npos)
- nCPU++;
- }
- cpuinfo.close();
-
- return nCPU;
-}
-
-# elif defined(__sun__) || defined(__osf__) || defined(_AIX)
+# if defined(__linux__) || defined(__sun__) || defined(__osf__) || defined(_AIX)
unsigned int MultithreadInfo::get_n_cpus()
{
return sysconf(_SC_NPROCESSORS_ONLN);
}
-
-# elif defined(__sgi__)
-
-unsigned int MultithreadInfo::get_n_cpus()
-{
- return sysconf(_SC_NPROC_ONLN);
-}
-
# elif defined(__MACH__) && defined(__APPLE__)
// This is only tested on a dual G5 2.5GHz running MacOSX 10.3.6
// and on an Intel Mac Book Pro.
return n_cpus;
}
-
# else
// If you get n_cpus=1 although you are on a multi-processor machine,