Add CMake module to find Nodes
This commit is contained in:
parent
5efab69386
commit
ce3a71e602
@ -1,3 +1,15 @@
|
||||
# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Searchs for libnodes and checks if the -fompss-2=libnodes flag is supported in
|
||||
# the compiler.
|
||||
#
|
||||
# Sets the variable NODES_FOUND when libnodes is found and NODES_FLAG_SUPPORTED
|
||||
# when the -fompss-2=libnodes flag is supported.
|
||||
#
|
||||
# The target Nodes::nodes is defined when both checks are passed, and includes a
|
||||
# rule to add the compile and link time flags.
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(DEFINED ENV{NODES_HOME})
|
||||
@ -6,16 +18,30 @@ else()
|
||||
message(STATUS "NODES_HOME not set, refusing to search")
|
||||
endif()
|
||||
|
||||
find_library(NODES_LIBRARY NAMES nanos6 PATHS "${NODES_HOME}/lib" NO_DEFAULT_PATH)
|
||||
find_file(NODES_WRAPPER NAMES nanos6-main-wrapper.o PATHS "${NODES_HOME}/lib" NO_DEFAULT_PATH)
|
||||
find_path(NODES_INCLUDE_DIR nanos6.h PATHS "${NODES_HOME}/include" NO_DEFAULT_PATH)
|
||||
find_library(NODES_LIBRARY NAMES nodes PATHS "${NODES_HOME}/lib" NO_DEFAULT_PATH)
|
||||
find_path(NODES_INCLUDE_DIR nodes.h PATHS "${NODES_HOME}/include" NO_DEFAULT_PATH)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(Nodes DEFAULT_MSG
|
||||
NODES_LIBRARY NODES_INCLUDE_DIR NODES_WRAPPER)
|
||||
NODES_LIBRARY NODES_INCLUDE_DIR)
|
||||
|
||||
if(NOT NODES_FOUND)
|
||||
message(STATUS "Cannot find NODES library")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Also ensure the compiler supports libnodes
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
set(NODES_FLAG "-fompss-2=libnodes")
|
||||
# Also set the linker flags, as otherwise the check will fail due to undefined
|
||||
# symbols in the final program.
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "${NODES_FLAG}")
|
||||
check_c_compiler_flag("${NODES_FLAG}" NODES_FLAG_SUPPORTED)
|
||||
|
||||
if(NOT NODES_FLAG_SUPPORTED)
|
||||
message(STATUS "Compiler doesn't support ${NODES_FLAG} flag")
|
||||
return()
|
||||
endif()
|
||||
|
||||
@ -24,12 +50,6 @@ if(NOT TARGET Nodes::nodes)
|
||||
set_target_properties(Nodes::nodes PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${NODES_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION ${NODES_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET Nodes::wrapper)
|
||||
add_library(Nodes::wrapper STATIC IMPORTED)
|
||||
set_target_properties(Nodes::wrapper PROPERTIES
|
||||
IMPORTED_LOCATION ${NODES_WRAPPER})
|
||||
target_compile_options(Nodes::wrapper INTERFACE "-fompss-2")
|
||||
target_link_libraries(Nodes::wrapper INTERFACE Nodes::nodes)
|
||||
target_compile_options(Nodes::nodes INTERFACE "${NODES_FLAG}")
|
||||
target_link_options(Nodes::nodes INTERFACE "${NODES_FLAG}")
|
||||
endif()
|
||||
|
@ -1,7 +1,7 @@
|
||||
The heat benchmark solves the steady heat equation in a regular grid of NxM
|
||||
elements using an iterative solver.
|
||||
|
||||
The solver is either the Gauss-Seidel or Successive-over-relaxation with a wiven
|
||||
The solver is either the Gauss-Seidel or Successive-over-relaxation with a given
|
||||
relaxation parameter (--relax).
|
||||
|
||||
In every iteration the relative error of the solution is computed by using the
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static char *progname = "b6_runner";
|
||||
static char *progname = "bench6";
|
||||
|
||||
struct sampling {
|
||||
int nmax;
|
||||
@ -164,6 +164,34 @@ sample(char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
parse_options(struct options *options, int argc, char *argv[])
|
||||
{
|
||||
/* Default options */
|
||||
options->ndrift_samples = 1;
|
||||
options->nsamples = 100;
|
||||
options->verbose = 0;
|
||||
options->drift_wait = 5;
|
||||
options->outpath = "ovni/clock-offsets.txt";
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt(argc, argv, "hl")) != -1) {
|
||||
switch (opt) {
|
||||
case 'l':
|
||||
list();
|
||||
break;
|
||||
case 'h':
|
||||
default: /* '?' */
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
fprintf(stderr, "error: unexpected extra arguments\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user