<commit_before>//----------------------------  multithread_info.cc  ----------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//----------------------------  multithread_info.cc  ----------------


#include <base/multithread_info.h>

#if defined(__linux__)
#  include <fstream>
#  include <string>
#endif

#if defined(__sun__)
#  include <unistd.h>
#endif




#ifdef DEAL_II_USE_MT

#if defined(__linux__)

unsigned int MultithreadInfo::get_n_cpus()
{
  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__)


unsigned int MultithreadInfo::get_n_cpus()
{
  return sysconf(_SC_NPROCESSORS_ONLN);
}


#else

// if you get to see this warning, then this can have two reasons: either
// because you fell through all of the above #if clauses and on your system
// the detection of processors is really not implemented, or you are using
// a compiler that does not understand the #warning directive, in which case
// you will see a report on the screen even if the detection of processors
// is implemented for your system. In the latter case, you need not worry
// about the warning (although it is acknowledged that it is annoying),
// otherwise you might want to consider implementing the missing feature
// and submitting it back to the authors of the library.
#warning Detection of Processors not supported on this OS<commit_msg>Added sysconf(_SC_NPROC_ONLN) call for SGI to determine the number of available processors when in multithread mode<commit_after>//----------------------------  multithread_info.cc  ----------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//----------------------------  multithread_info.cc  ----------------


#include <base/multithread_info.h>

#if defined(__linux__)
#  include <fstream>
#  include <string>
#endif

#if defined(__sun__)
#  include <unistd.h>
#endif

#if defined(__sgi__)
#  include <unistd.h>
#endif




#ifdef DEAL_II_USE_MT

#if defined(__linux__)

unsigned int MultithreadInfo::get_n_cpus()
{
  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__)


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);
}


#else

// if you get to see this warning, then this can have two reasons: either
// because you fell through all of the above #if clauses and on your system
// the detection of processors is really not implemented, or you are using
// a compiler that does not understand the #warning directive, in which case
// you will see a report on the screen even if the detection of processors
// is implemented for your system. In the latter case, you need not worry
// about the warning (although it is acknowledged that it is annoying),
// otherwise you might want to consider implementing the missing feature
// and submitting it back to the authors of the library.
#warning Detection of Processors not supported on this OS
{'fraction_non_alphanumeric': 0.1338181818181818, 'fraction_numerical': 0.010181818181818183, 'mean_word_length': 2.990328820116054, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2258078', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1200, 'n_words': 458}