re PR other/58996 (build failure in libcilkrts)
Fix for PR other/58996. +2014-01-20 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR other/58996 + * configure.ac: Added a check for pthread affinity support. + * runtime/os-unix.c: Likewise. + * configure: Regenerate. + From-SVN: r206846
This commit is contained in:
parent
eee0e4879f
commit
ef132d593e
@ -1,3 +1,10 @@
|
|||||||
|
2014-01-20 Balaji V. Iyer <balaji.v.iyer@intel.com>
|
||||||
|
|
||||||
|
PR other/58996
|
||||||
|
* configure.ac: Added a check for pthread affinity support.
|
||||||
|
* runtime/os-unix.c: Likewise.
|
||||||
|
* configure: Regenerate.
|
||||||
|
|
||||||
2014-01-09 Balaji V. Iyer <balaji.v.iyer@intel.com>
|
2014-01-09 Balaji V. Iyer <balaji.v.iyer@intel.com>
|
||||||
|
|
||||||
bootstrap/59094
|
bootstrap/59094
|
||||||
|
32
libcilkrts/configure
vendored
32
libcilkrts/configure
vendored
@ -14420,6 +14420,38 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Check for pthread_{,attr_}[sg]etaffinity_np.
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#include <pthread.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
cpu_set_t cpuset;
|
||||||
|
pthread_attr_t attr;
|
||||||
|
pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
|
||||||
|
if (CPU_ISSET (0, &cpuset))
|
||||||
|
CPU_SET (1, &cpuset);
|
||||||
|
else
|
||||||
|
CPU_ZERO (&cpuset);
|
||||||
|
pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
|
||||||
|
pthread_attr_init (&attr);
|
||||||
|
pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
|
||||||
|
pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_PTHREAD_AFFINITY_NP 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
|
||||||
|
|
||||||
# Must be last
|
# Must be last
|
||||||
cat >confcache <<\_ACEOF
|
cat >confcache <<\_ACEOF
|
||||||
# This file is a shell script that caches the results of configure
|
# This file is a shell script that caches the results of configure
|
||||||
|
@ -164,5 +164,25 @@ AC_SUBST(toolexeclibdir)
|
|||||||
|
|
||||||
AC_SUBST(lt_cv_dlopen_libs)
|
AC_SUBST(lt_cv_dlopen_libs)
|
||||||
|
|
||||||
|
# Check for pthread_{,attr_}[sg]etaffinity_np.
|
||||||
|
AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[#define _GNU_SOURCE
|
||||||
|
#include <pthread.h>],
|
||||||
|
[cpu_set_t cpuset;
|
||||||
|
pthread_attr_t attr;
|
||||||
|
pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
|
||||||
|
if (CPU_ISSET (0, &cpuset))
|
||||||
|
CPU_SET (1, &cpuset);
|
||||||
|
else
|
||||||
|
CPU_ZERO (&cpuset);
|
||||||
|
pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
|
||||||
|
pthread_attr_init (&attr);
|
||||||
|
pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
|
||||||
|
pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);])],
|
||||||
|
AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1,
|
||||||
|
[ Define if pthread_{,attr_}{g,s}etaffinity_np is supported.]))
|
||||||
|
|
||||||
|
|
||||||
# Must be last
|
# Must be last
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
@ -311,6 +311,10 @@ static pid_t linux_gettid(void)
|
|||||||
*/
|
*/
|
||||||
static int linux_get_affinity_count (int tid)
|
static int linux_get_affinity_count (int tid)
|
||||||
{
|
{
|
||||||
|
#if !defined HAVE_PTHREAD_AFFINITY_NP
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
|
||||||
cpu_set_t process_mask;
|
cpu_set_t process_mask;
|
||||||
|
|
||||||
// Extract the thread affinity mask
|
// Extract the thread affinity mask
|
||||||
@ -337,6 +341,7 @@ static int linux_get_affinity_count (int tid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return available_procs;
|
return available_procs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user