From 71bbd6d7c6686d8497610e3be8e2307ade4be9ed Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Thu, 18 May 2023 20:17:47 +0200 Subject: [PATCH] Add variants with nodes --- CMakeLists.txt | 4 ++++ src/heat/mpi/CMakeLists.txt | 31 +++++++++++++++++++++++-------- src/heat/smp/CMakeLists.txt | 31 +++++++++++++++++++++++-------- 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3764be..be5ac3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,5 +90,9 @@ cmake_policy(SET CMP0074 NEW) endif() find_package(MPI) find_package(Nanos6) +find_package(Nodes) add_subdirectory(src) + +include(FeatureSummary) +feature_summary(WHAT ALL) diff --git a/src/heat/mpi/CMakeLists.txt b/src/heat/mpi/CMakeLists.txt index fe30700..28e51de 100644 --- a/src/heat/mpi/CMakeLists.txt +++ b/src/heat/mpi/CMakeLists.txt @@ -2,19 +2,34 @@ if(NOT MPI_FOUND) return() endif() +add_library(heat_mpi_common STATIC main.c utils.c) +target_link_libraries(heat_mpi_common PUBLIC heat_common MPI::MPI_C) + macro(mk_heat_mpi NAME SOURCE) - add_executable(${NAME} ${SOURCE} main.c utils.c) - target_link_libraries(${NAME} PRIVATE heat_common MPI::MPI_C) + add_executable(${NAME} ${SOURCE}) + target_link_libraries(${NAME} PRIVATE heat_mpi_common) install(TARGETS ${NAME} RUNTIME DESTINATION bin) endmacro() mk_heat_mpi(heat_mpi solver_mpi.c) mk_heat_mpi(heat_mpi_nbuffer solver_mpi_nbuffer.c) -macro(mk_heat_mpi_oss NAME SOURCE) - mk_heat_mpi(${NAME} ${SOURCE}) - target_link_libraries(${NAME} PRIVATE Nanos6::wrapper) -endmacro() +if(NANOS6_FOUND) + macro(mk_heat_mpi_nanos6 NAME SOURCE) + mk_heat_mpi(${NAME} ${SOURCE}) + target_link_libraries(${NAME} PRIVATE Nanos6::wrapper) + endmacro() -mk_heat_mpi_oss(heat_mpi_ompss2_forkjoin solver_mpi_ompss2_forkjoin.c) -mk_heat_mpi_oss(heat_mpi_ompss2_tasks solver_mpi_ompss2_tasks.c) + mk_heat_mpi_nanos6(heat_mpi_nanos6_forkjoin solver_mpi_ompss2_forkjoin.c) + mk_heat_mpi_nanos6(heat_mpi_nanos6_tasks solver_mpi_ompss2_tasks.c) +endif() + +if(NODES_FOUND) + macro(mk_heat_mpi_nodes NAME SOURCE) + mk_heat_mpi(${NAME} ${SOURCE}) + target_link_libraries(${NAME} PRIVATE Nodes::wrapper) + endmacro() + + mk_heat_mpi_nodes(heat_mpi_nodes_forkjoin solver_mpi_ompss2_forkjoin.c) + mk_heat_mpi_nodes(heat_mpi_nodes_tasks solver_mpi_ompss2_tasks.c) +endif() diff --git a/src/heat/smp/CMakeLists.txt b/src/heat/smp/CMakeLists.txt index 0e3130b..b52f3f3 100644 --- a/src/heat/smp/CMakeLists.txt +++ b/src/heat/smp/CMakeLists.txt @@ -1,10 +1,25 @@ -add_executable(heat_seq main.c solver_seq.c) -target_link_libraries(heat_seq PUBLIC heat_common) +add_library(heat_seq_common STATIC main.c) +target_link_libraries(heat_seq_common PUBLIC heat_common) -add_executable(heat_ompss2 main.c solver_ompss2.c) -target_link_libraries(heat_ompss2 PRIVATE heat_common - Nanos6::wrapper) +add_executable(heat_seq solver_seq.c) +target_link_libraries(heat_seq PUBLIC heat_seq_common) -add_executable(heat_ompss2_residual main.c solver_ompss2_residual.c) -target_link_libraries(heat_ompss2_residual PRIVATE heat_common - Nanos6::wrapper) +if(NANOS6_FOUND) + macro(mk_heat_nanos6 NAME SOURCE) + add_executable(${NAME} ${SOURCE}) + target_link_libraries(${NAME} PRIVATE heat_seq_common Nanos6::wrapper) + install(TARGETS ${NAME} RUNTIME DESTINATION bin) + endmacro() + mk_heat_nanos6(heat_nanos6 solver_ompss2.c) + mk_heat_nanos6(heat_nanos6_residual solver_ompss2_residual.c) +endif() + +if(NODES_FOUND) + macro(mk_heat_nodes NAME SOURCE) + add_executable(${NAME} ${SOURCE}) + target_link_libraries(${NAME} PRIVATE heat_seq_common Nodes::wrapper) + install(TARGETS ${NAME} RUNTIME DESTINATION bin) + endmacro() + mk_heat_nodes(heat_nodes solver_ompss2.c) + mk_heat_nodes(heat_nodes_residual solver_ompss2_residual.c) +endif()