[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] core-count: A new program to count the number of cpu cores
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] core-count: A new program to count the number of cpu cores |
Date: |
Sun, 01 Nov 2009 23:16:24 +0000 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Bruno Haible wrote:
>
> Here is a proposed change to the gnulib 'nproc' module. It will
> require changes (simplification) on Giuseppe's side, of course.
Wow, this is great stuff Bruno, thanks!
> *** lib/nproc.c.orig 2009-11-01 14:55:37.000000000 +0100
> --- lib/nproc.c 2009-11-01 14:54:52.000000000 +0100
> + if (query == NPROC_CURRENT_OVERRIDABLE)
> + {
> + /* Test the environment variable OMP_NUM_THREADS, recognized also by
> all
> + programs that are based on OpenMP. The OpenMP spec says that the
> + value assigned to the environment variable "may have leading and
> + trailing white space". */
> + const char *envvalue = getenv ("OMP_NUM_THREADS");
> +
> + if (envvalue != NULL)
> + {
> + while (*envvalue != '\0' && c_isspace (*envvalue))
> + envvalue++;
A pedantic comment. Could one instead assume strtoul() skips leading whitespace?
> + #if HAVE_PTHREAD_AFFINITY_NP && defined __GLIBC__ && 0
> + #elif HAVE_PTHREAD_AFFINITY_NP && defined __NetBSD__ && 0
If you put the "0" first then vim at least will highlight
the section as a comment.
> *** m4/nproc.m4.orig 2009-11-01 14:55:37.000000000 +0100
> --- m4/nproc.m4 2009-11-01 14:31:13.000000000 +0100
> ! AC_CHECK_FUNCS([sched_getaffinity sched_getaffinity_np \
> ! pstat_getdynamic sysmp sysctl])
> ])
Will this result it a compile failure on glibc-2.3.[23]
where sched_getaffinity() has a different prototype?
If so it might be nice to not define HAVE_SCHED_GETAFFINITY
in that case, or maybe it's not worth worrying about?
thanks again,
Pádraig.
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Pádraig Brady, 2009/11/01
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Bruno Haible, 2009/11/01
- Re: [PATCH] core-count: A new program to count the number of cpu cores,
Pádraig Brady <=
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Bruno Haible, 2009/11/04
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Giuseppe Scrivano, 2009/11/04
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Paolo Bonzini, 2009/11/04
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Pádraig Brady, 2009/11/04
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Giuseppe Scrivano, 2009/11/04
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Pádraig Brady, 2009/11/05
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Giuseppe Scrivano, 2009/11/05
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Pádraig Brady, 2009/11/05
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Erik Auerswald, 2009/11/05