MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
get_nprocs.c File Reference
#include "mbconfig.h"
#include <unistd.h>
#include <ac/sys_sysinfo.h>
Include dependency graph for get_nprocs.c:

Go to the source code of this file.

Functions

int get_nprocs (void)
 
int get_nprocs_conf (void)
 

Function Documentation

int get_nprocs ( void  )

Definition at line 44 of file get_nprocs.c.

Referenced by InverseSolver::ReadData(), Solver::ReadData(), ReadLinSol(), and ReadRTParams().

45 {
46 #warning "pippero!!!"
47 #if defined(_SC_NPROCESSORS_ONLN)
48  /* POSIX.1. */
49  return sysconf(_SC_NPROCESSORS_ONLN);
50 #elif defined(_SC_NPROC_ONLN)
51  /* IRIX? POSIX? */
52  return sysconf(_SC_NPROC_ONLN);
53 #elif defined(_SC_CRAY_NCPU)
54  /* Cray? */
55  return sysconf(_SC_CRAY_NCPU);
56 #elif defined(HAVE_PSTAT_GETDYNAMIC)
57  /* HP-UX */
58  struct pst_dynamic psd;
59 
60  if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) != -1) {
61  return psd.psd_proc_cnt;
62  }
63 #else /* add more if known */
64 
65 #endif
66  /* we assume that there is at least one :) */
67  return 1;
68 }
int get_nprocs_conf ( void  )

Definition at line 76 of file get_nprocs.c.

77 {
78 #warning "pippero!!!"
79 #if defined(_SC_NPROCESSORS_CONF)
80  /* POSIX.1. */
81  return sysconf(_SC_NPROCESSORS_CONF);
82 #elif defined(_SC_NPROC_CONF)
83  /* IRIX? POSIX? */
84  return sysconf(_SC_NPROC_CONF);
85 #elif defined(HAVE_GET_NCPUS)
86  /* Cray? */
87  return get_ncpus();
88 #elif defined(HAVE_PSTAT_GETDYNAMIC)
89  /* HP-UX */
90  struct pst_dynamic psd;
91 
92  if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) != -1) {
93  return psd.psd_max_proc_cnt;
94  }
95 #else /* add more if known */
96 
97 #endif
98  /* we assume that there is at least one :) */
99  return 1;
100 }