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

Clean Up Cmake Code For Finding Hwloc #334

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions include/qthread_innards.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

#include <pthread.h>

#ifdef USE_HWLOC
#include <hwloc.h>
#if (HWLOC_API_VERSION < 0x00010000)
#error HWLOC version unrecognized
#endif
#endif

/* Internal Headers */
#include "qt_asserts.h"
#include "qt_atomics.h"
Expand Down
10 changes: 7 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(QTHREADS_HASHMAP hashmap CACHE STRING "Which hashmap implementation to use.
set(QTHREADS_DICT_TYPE shavit CACHE STRING "Which dictionary implementation to use. Valid values are \"shavit\", \"trie\", and \"simple\".")
set(QTHREADS_TIMER_TYPE gettimeofday CACHE STRING "Which timer implementation to use. Valid values are \"clock_gettime\", \"mach\", \"gettimeofday\", and \"gethrtime\".")
set(QTHREADS_CONTEXT_SWAP_IMPL fastcontext CACHE STRING "Which context swap implementation to use. Valid values are \"system\" and \"fastcontext\".")
set(HWLOC_INSTALL_DIR /usr/local CACHE PATH "Install path for hwloc library")

set(QTHREADS_SOURCES
cacheline.c
Expand Down Expand Up @@ -75,10 +76,13 @@ target_include_directories(qthread
set_target_properties(qthread PROPERTIES C_VISIBILITY_PRESET hidden)
target_link_libraries(qthread PUBLIC Threads::Threads)
if ("${QTHREADS_TOPOLOGY}" STREQUAL "hwloc" OR "${QTHREADS_TOPOLOGY}" STREQUAL "binders")
# TODO: pull this out into a simple module file so we can just do find_package instead.
find_library(HWLOC_LIBRARY NAMES hwloc PATH_SUFFIXES lib lib64)
find_path(HWLOC_INCLUDE_DIR NAMES hwloc.h HINTS ${HWLOC_INSTALL_DIR} PATH_SUFFIXES include)
target_include_directories(qthread PRIVATE ${HWLOC_INCLUDE_DIR})
find_library(HWLOC_LIBRARY
NAMES hwloc libhwloc
HINTS ${HWLOC_INSTALL_DIR}
PATH_SUFFIXES lib lib64 lib32)
target_link_libraries(qthread PUBLIC "${HWLOC_LIBRARY}")
target_compile_definitions(qthread PRIVATE USE_HWLOC)
if ("${QTHREADS_TOPOLOGY}" STREQUAL "hwloc")
target_compile_definitions(qthread PRIVATE USE_HWLOC_MEM_AFFINITY)
endif()
Expand Down
4 changes: 4 additions & 0 deletions src/affinity/binders.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

#include <hwloc.h>

#if (HWLOC_API_VERSION < 0x00020000)
#error HWLOC version unrecognized
#endif

#include "qt_affinity.h"
#include "qt_alloc.h"
#include "qt_envariables.h"
Expand Down
4 changes: 4 additions & 0 deletions src/affinity/hwloc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include <hwloc.h>

#if (HWLOC_API_VERSION < 0x00020000)
#error HWLOC version unrecognized
#endif

#include "qt_affinity.h"
#include "qt_alloc.h"
#include "qt_asserts.h" /* for qassert() */
Expand Down
4 changes: 1 addition & 3 deletions src/qthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -1809,9 +1809,7 @@ void API_FUNC qthread_yield_(int k) { /*{{{ */
}
} /*}}} */

void API_FUNC qthread_flushsc(void){
/*{{{*/
} /*}}}*/
void API_FUNC qthread_flushsc(void) {}

/***********************************************
* FORKING *
Expand Down
Loading