Browse Source

correctly link the numactl library and provide find-module for it

master
Constantin Fürst 1 year ago
parent
commit
741157c8bc
  1. 7
      benchmarks/CMakeLists.txt
  2. 43
      benchmarks/cmake/modules/FindNUMA.cmake

7
benchmarks/CMakeLists.txt

@ -1,15 +1,20 @@
cmake_minimum_required(VERSION 3.18) cmake_minimum_required(VERSION 3.18)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
project(dml-benchmark) project(dml-benchmark)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
include_directories("../../DML/include/") include_directories("../../DML/include/")
find_package(NUMA REQUIRED)
set(SOURCES main.cpp) set(SOURCES main.cpp)
add_executable(dml-benchmark ${SOURCES}) add_executable(dml-benchmark ${SOURCES})
target_link_libraries(dml-benchmark libdml.a ${CMAKE_DL_LIBS})
target_include_directories(dml-benchmark PRIVATE ${NUMA_INCLUDE_DIRS})
target_link_libraries(dml-benchmark PRIVATE libdml.a pthread ${CMAKE_DL_LIBS} ${NUMA_LIBRARY})
install(TARGETS dml-benchmark DESTINATION ${CMAKE_INSTALL_PREFIX}) install(TARGETS dml-benchmark DESTINATION ${CMAKE_INSTALL_PREFIX})

43
benchmarks/cmake/modules/FindNUMA.cmake

@ -0,0 +1,43 @@
# Module for locating libnuma
#
# Read-only variables:
# NUMA_FOUND
# Indicates that the library has been found.
#
# NUMA_INCLUDE_DIR
# Points to the libnuma include directory.
#
# NUMA_LIBRARY_DIR
# Points to the directory that contains the libraries.
# The content of this variable can be passed to link_directories.
#
# NUMA_LIBRARY
# Points to the libnuma that can be passed to target_link_libararies.
#
# Copyright (c) 2013-2020 MulticoreWare, Inc
include(FindPackageHandleStandardArgs)
find_path(NUMA_ROOT_DIR
NAMES include/numa.h
PATHS ENV NUMA_ROOT
DOC "NUMA root directory")
find_path(NUMA_INCLUDE_DIR
NAMES numa.h
HINTS ${NUMA_ROOT_DIR}
PATH_SUFFIXES include
DOC "NUMA include directory")
find_library(NUMA_LIBRARY
NAMES numa
HINTS ${NUMA_ROOT_DIR}
DOC "NUMA library")
if (NUMA_LIBRARY)
get_filename_component(NUMA_LIBRARY_DIR ${NUMA_LIBRARY} PATH)
endif()
mark_as_advanced(NUMA_INCLUDE_DIR NUMA_LIBRARY_DIR NUMA_LIBRARY)
find_package_handle_standard_args(NUMA REQUIRED_VARS NUMA_ROOT_DIR NUMA_INCLUDE_DIR NUMA_LIBRARY)
Loading…
Cancel
Save