From: wolf Date: Mon, 29 Nov 2004 17:34:56 +0000 (+0000) Subject: Detect multiple CPUs on Apple OS X. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bd789ee9b2cc87daf781457582e0d41a46f4da1;p=dealii-svn.git Detect multiple CPUs on Apple OS X. git-svn-id: https://svn.dealii.org/trunk@9811 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/source/multithread_info.cc b/deal.II/base/source/multithread_info.cc index 0fb165aa12..7b6b3b3d17 100644 --- a/deal.II/base/source/multithread_info.cc +++ b/deal.II/base/source/multithread_info.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -27,8 +27,10 @@ # include #endif - - +#if defined(__MACH__) && defined(__ppc__) && defined(__APPLE__) +# include +# include +#endif #if DEAL_II_USE_MT == 1 @@ -82,6 +84,25 @@ unsigned int MultithreadInfo::get_n_cpus() return sysconf(_SC_NPROC_ONLN); } +# elif defined(__MACH__) && defined(__ppc__) && defined(__APPLE__) +// This is only tested on a dual G5 2.5GHz running MacOSX 10.3.6 +// and gcc version 3.3 20030304 (Apple Computer, Inc. build 1666) +// If it doesnt work please contact the mailinglist. +unsigned int MultithreadInfo::get_n_cpus() +{ + int mib[2]; + int n_cpus; + size_t len; + + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + len = sizeof(n_cpus); + sysctl(mib, 2, &n_cpus, &len, NULL, 0); + + return n_cpus; +} + + # else // If you get n_cpus=1 although you are on a multi-processor machine, diff --git a/deal.II/doc/news/c-5.0.html b/deal.II/doc/news/c-5.0.html index cc3dc159d4..b1b33a42d8 100644 --- a/deal.II/doc/news/c-5.0.html +++ b/deal.II/doc/news/c-5.0.html @@ -122,18 +122,27 @@ inconvenience this causes.
  1. -

    New: The - TableHandler::write_tex now accepts the additional boolean - argument with_header which is set to - true by default and tells the function whether to add the latex - header and footer (i.e. the \documentclass{...}, - \begin{document} and \end{document} stuff) to the table.
    - In addition to this, there are two new members in the above class: - TableHandler::tex_set_table_caption and - TableHandler::tex_set_table_label to - add a caption and a label to the tex generated table. -
    (Luca Heltai 2004/10/29) -

    +
  2. + New: The MultithreadInfo class now also detects multiple + processors on Mac OS X. +
    + (Helmut Müller 2004/11/29) +

    + +
  3. + New: The + TableHandler::write_tex now accepts the additional boolean + argument with_header which is set to + true by default and tells the function whether to add the latex + header and footer (i.e. the \documentclass{...}, + \begin{document} and \end{document} stuff) to the table.
    + In addition to this, there are two new members in the above class: + TableHandler::tex_set_table_caption and + TableHandler::tex_set_table_label to + add a caption and a label to the tex generated table. +
    + (Luca Heltai 2004/10/29) +

  4. Fixed: