FreeBSD/contrib/gcclibs/libgomp/config/linux/proc.c
/* At startup, determine the default number of threads.  It would seem
   this should be related to the number of cpus online.  */
At startup, determine the default number of threads.  It would seem
this should be related to the number of cpus online.
At startup determine the default number of threads . It would seem this should be related to the number of cpus online .
void
gomp_init_num_threads (void)
{
#ifdef HAVE_PTHREAD_AFFINITY_NP
  cpu_set_t cpuset;
  if (pthread_getaffinity_np (pthread_self (), sizeof (cpuset), &cpuset) == 0)
    {
      gomp_nthreads_var = cpuset_popcount (&cpuset);
      if (gomp_nthreads_var == 0)
	gomp_nthreads_var = 1;
      return;
    }
#endif
#ifdef _SC_NPROCESSORS_ONLN
  gomp_nthreads_var = sysconf (_SC_NPROCESSORS_ONLN);
#endif
}
void gomp_init_num_threads ( void ) { #ifdef HAVE_PTHREAD_AFFINITY_NP cpu_set_t cpuset ; if ( pthread_getaffinity_np ( pthread_self ( ) , sizeof ( cpuset ) , & cpuset ) == 0 ) { gomp_nthreads_var = cpuset_popcount ( & cpuset ) ; if ( gomp_nthreads_var == 0 ) gomp_nthreads_var = 1 ; return ; } #endif #ifdef _SC_NPROCESSORS_ONLN gomp_nthreads_var = sysconf ( _SC_NPROCESSORS_ONLN ) ; #endif }
At startup, determine the default number of threads.
At startup determine the default number of threads .
/* Count only the CPUs this process can use.  */