diff --git a/CMakeLists.txt b/CMakeLists.txt index fa5450aa..60d82727 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ option( USE_OCC "(not supported) compile with OpenCascade geometry kernel" O option( USE_JPEG "enable snapshots using library libjpeg" OFF ) option( USE_MPEG "enable video recording with FFmpeg, uses libavcodec" OFF ) option( USE_CGNS "enable CGNS file read/write support" OFF ) +option( USE_NUMA "compile with NUMA-aware code") option( INTEL_MIC "cross compile for intel xeon phi") option( INSTALL_PROFILES "install environment variable settings to /etc/profile.d" OFF ) option( USE_CCACHE "use ccache") diff --git a/cmake/NetgenConfig.cmake.in b/cmake/NetgenConfig.cmake.in index 70206689..54f88ac3 100644 --- a/cmake/NetgenConfig.cmake.in +++ b/cmake/NetgenConfig.cmake.in @@ -27,6 +27,7 @@ set(NETGEN_METIS_LIBRARY "@METIS_LIBRARY@") set(NETGEN_MKL_LIBRARIES "@MKL_LIBRARIES@") set(NETGEN_MPI_CXX_INCLUDE_PATH "@MPI_CXX_INCLUDE_PATH@") set(NETGEN_MPI_CXX_LIBRARIES "@MPI_CXX_LIBRARIES@") +set(NETGEN_NUMA_LIBRARY "@NUMA_LIBRARY@") set(NETGEN_OCC_INCLUDE_DIR "@OCC_INCLUDE_DIR@") set(NETGEN_OCC_LIBRARIES_BIN "@OCC_LIBRARIES_BIN@") set(NETGEN_OCC_LIBRARIES "@OCC_LIBRARIES@") @@ -56,6 +57,7 @@ set(NETGEN_INTEL_MIC @INTEL_MIC@) set(NETGEN_INSTALL_PROFILES @INSTALL_PROFILES@) set(NETGEN_USE_CCACHE @USE_CCACHE@) set(NETGEN_USE_NATIVE_ARCH @USE_NATIVE_ARCH@) +set(NETGEN_USE_NUMA @USE_NUMA@) set(NETGEN_PYTHON_RPATH "@NETGEN_PYTHON_RPATH@") set(NETGEN_RPATH_TOKEN "@NG_RPATH_TOKEN@") diff --git a/libsrc/core/CMakeLists.txt b/libsrc/core/CMakeLists.txt index cb5eb36c..8a36ba13 100644 --- a/libsrc/core/CMakeLists.txt +++ b/libsrc/core/CMakeLists.txt @@ -51,6 +51,12 @@ if(USE_SPDLOG) endif(DEBUG_LOG) endif(USE_SPDLOG) +if(USE_NUMA) + find_library(NUMA_LIBRARY libnuma.so) + target_compile_definitions(ngcore PUBLIC USE_NUMA) + target_link_libraries(ngcore PRIVATE ${NUMA_LIBRARY}) +endif(USE_NUMA) + install(TARGETS ngcore DESTINATION ${NG_INSTALL_DIR} COMPONENT netgen) target_link_libraries(ngcore PUBLIC netgen_mpi PRIVATE netgen_python ${CMAKE_THREAD_LIBS_INIT}) diff --git a/libsrc/core/taskmanager.hpp b/libsrc/core/taskmanager.hpp index 4ba656c3..d9239be9 100644 --- a/libsrc/core/taskmanager.hpp +++ b/libsrc/core/taskmanager.hpp @@ -17,6 +17,12 @@ #include "paje_trace.hpp" #include "profiler.hpp" +#ifdef USE_NUMA +#include +#include +#endif + + namespace ngcore { using std::atomic;