Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tool and tests for binding threads according to a set of locations #361

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
34 changes: 33 additions & 1 deletion config/hwloc_internal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,34 @@ EOF
AC_CHECK_FUNCS([clock_gettime])
])

# Check for ptrace support
hwloc_have_ptrace=1
AC_CHECK_HEADERS([sys/ptrace.h],, [hwloc_have_ptrace=0])
AC_CHECK_FUNCS([ptrace],, [hwloc_have_ptrace=0])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include "sys/ptrace.h"
int main(void){
return ptrace(PTRACE_SEIZE,
-1,
0,
(void*)(PTRACE_O_TRACECLONE|PTRACE_O_TRACEFORK));
}
]])],, [hwloc_have_ptrace=0])
AM_CONDITIONAL([HWLOC_HAVE_PTRACE],[test $hwloc_have_ptrace -eq 1])
AC_DEFINE_UNQUOTED([HWLOC_HAVE_PTRACE], [$hwloc_have_ptrace], [Whether ptrace is present and supports PTRACE_SEIZE or not])

# Check if syscall gettid is available.
hwloc_have_sys_gettid=1
AC_CHECK_HEADERS([sys/syscall.h],, [hwloc_have_sys_gettid=0])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include "sys/syscall.h"
#ifndef SYS_gettid
#error "syscall SYS_gettid not found"
#endif
int main(void){ return syscall(SYS_gettid) > 0;}
]])],,[hwloc_have_sys_gettid=0])
AC_DEFINE_UNQUOTED([HWLOC_HAVE_SYS_GETTID], [$hwloc_have_sys_gettid], [Whether syscall header is present and SYS_gettid macro is defined or not])

# Only generate this if we're building the utilities
# Even the netloc library Makefile is here because
# we don't embed libnetloc yet, it's useless without tools
Expand Down Expand Up @@ -368,7 +396,11 @@ AC_DEFUN([HWLOC_SETUP_TESTS],[
###
EOF

AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes])
# Check thread support.
AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=1], [hwloc_have_pthread=0])
AC_DEFINE_UNQUOTED([HWLOC_HAVE_PTHREAD], [$hwloc_have_pthread], [Whether we have the pthread library or not])
AM_CONDITIONAL([HWLOC_HAVE_PTHREAD], [test $hwloc_have_pthread -eq 1]) AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes])
AC_OPENMP

HWLOC_PKG_CHECK_MODULES([NUMA], [numa], [numa_available], [numa.h],
[hwloc_have_linux_libnuma=yes],
Expand Down
2 changes: 0 additions & 2 deletions contrib/ci.inria.fr/Jenkinsfile-basic
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pipeline {
stash includes: "job-1-visualstudio.bat", name: 'script-msvc'
}
archiveArtifacts artifacts: tarballgz+","+tarballbz2+",doc/doxygen-doc/hwloc-a4.pdf", fingerprint: true, onlyIfSuccessful: true
deleteDir()
}
}
}
Expand All @@ -63,7 +62,6 @@ pipeline {
unstash 'script-unix-check'
sh 'chmod 755 job-1-check.sh && ./job-1-check.sh '+tarballgz
if (env.KEEP_WORKING_DIRECTORY != 'true')
deleteDir()
}
}
} else {
Expand Down
21 changes: 21 additions & 0 deletions utils/hwloc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,24 @@ endif HWLOC_HAVE_LINUX

distclean-local:
rm -f $(nodist_man_MANS)

# Build hwloc-thread-bind
if HWLOC_HAVE_PTRACE
if HWLOC_HAVE_PTHREAD
AM_LDFLAGS+=-lpthread
endif #HWLOC_HAVE_PHREAD
noinst_LTLIBRARIES+=libhwloc-thread-bind.la
libhwloc_thread_bind_la_SOURCES=hwloc-thread-bind-utils.c hwloc-thread-bind.h
LIBDADD=$(HWLOC_top_builddir)/hwloc/libhwloc.la

bin_PROGRAMS += hwloc-thread-bind
hwloc_thread_bind_SOURCES = \
hwloc-thread-bind.c \
hwloc-thread-bind.h
LDADD+=$(HWLOC_top_builddir)/hwloc/libhwloc.la
LDADD+=libhwloc-thread-bind.la
check_PROGRAMS=test-hwloc-thread-bind
if !HWLOC_HAVE_MINGW32
TESTS+=test-hwloc-thread-bind
endif #!HWLOC_HAVE_MINGW32
endif #HWLOC_HAVE_PTRACE
Loading