Skip to content

Commit

Permalink
only link to oomph header
Browse files Browse the repository at this point in the history
  • Loading branch information
boeschf committed Dec 20, 2021
1 parent ecd518e commit 9fb21e5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 52 deletions.
18 changes: 14 additions & 4 deletions cmake/ghex_oomph.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,16 @@ if (GHEX_TRANSPORT_BACKEND STREQUAL "LIBFABRIC")
set(OOMPH_WITH_MPI OFF CACHE INTERNAL "") # Forces the value
set(OOMPH_WITH_UCX OFF CACHE INTERNAL "") # Forces the value
set(OOMPH_WITH_LIBFABRIC ON CACHE INTERNAL "") # Forces the value
target_link_libraries(ghex PUBLIC oomph::libfabric)
elseif (GHEX_TRANSPORT_BACKEND STREQUAL "UCX")
set(OOMPH_WITH_MPI OFF CACHE INTERNAL "") # Forces the value
set(OOMPH_WITH_UCX ON CACHE INTERNAL "") # Forces the value
set(OOMPH_WITH_LIBFABRIC OFF CACHE INTERNAL "") # Forces the value
target_link_libraries(ghex PUBLIC oomph::ucx)
else()
set(OOMPH_WITH_MPI ON CACHE INTERNAL "") # Forces the value
set(OOMPH_WITH_UCX OFF CACHE INTERNAL "") # Forces the value
set(OOMPH_WITH_LIBFABRIC OFF CACHE INTERNAL "") # Forces the value
target_link_libraries(ghex PUBLIC oomph::mpi)
endif()

if (GHEX_USE_GPU)
set(OOMPH_USE_GPU ON CACHE INTERNAL "") # Forces the value
if (ghex_gpu_mode STREQUAL "hip")
Expand All @@ -49,3 +46,16 @@ endif()

FetchContent_MakeAvailable(oomph)
set(_oomph_already_fetched ON CACHE INTERNAL "")

target_link_libraries(ghex INTERFACE oomph::oomph)

function(ghex_link_to_oomph target)
if (GHEX_TRANSPORT_BACKEND STREQUAL "LIBFABRIC")
target_link_libraries(${target} PRIVATE oomph::libfabric)
elseif (GHEX_TRANSPORT_BACKEND STREQUAL "UCX")
target_link_libraries(${target} PRIVATE oomph::ucx)
else()
target_link_libraries(${target} PRIVATE oomph::mpi)
endif()
endfunction()

2 changes: 2 additions & 0 deletions cmake/ghex_reg_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function(ghex_reg_test t_)
add_executable(${t} $<TARGET_OBJECTS:${t_}_obj>)
target_link_libraries(${t} PRIVATE gtest_main)
target_link_libraries(${t} PRIVATE ghex)
ghex_link_to_oomph(${t})
# workaround for clang+openmp
target_link_libraries(${t} PRIVATE $<$<CXX_COMPILER_ID:Clang>:$<LINK_ONLY:-fopenmp=libomp>>)
add_test(
Expand All @@ -33,6 +34,7 @@ function(ghex_reg_parallel_test t_ n mt)
target_link_libraries(${t} PRIVATE gtest_main_mpi)
endif()
target_link_libraries(${t} PRIVATE ghex)
ghex_link_to_oomph(${t})
# workaround for clang+openmp
target_link_libraries(${t} PRIVATE $<$<CXX_COMPILER_ID:Clang>:$<LINK_ONLY:-fopenmp=libomp>>)
add_test(
Expand Down
48 changes: 0 additions & 48 deletions test/bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,51 +1,3 @@
if (GHEX_BUILD_FORTRAN)
add_subdirectory(fhex)
endif()
#find_package(OpenMP REQUIRED)
#set(_tests test_f_context test_f_communicator test_f_message test_f_barrier test_f_send_recv_ft test_f_send_multi test_f_send_recv_cb)
#
#foreach (_t ${_tests})
# add_executable(${_t} ${_t}.f90)
# target_include_directories(${_t} PRIVATE ${CMAKE_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/bindings/fhex)
# target_link_libraries(${_t} PRIVATE fhex OpenMP::OpenMP_Fortran)
# add_test(
# NAME ${_t}.fort
# COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${_t}> ${MPIEXEC_POSTFLAGS}
# )
#endforeach ()
#
#set(_tests_np6 test_f_cubed_sphere_os)
#
#foreach (_t ${_tests_np6})
# add_executable(${_t} ${_t}.f90)
# target_include_directories(${_t} PRIVATE ${CMAKE_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/bindings/fhex)
# target_link_libraries(${_t} PRIVATE fhex)
# add_test(
# NAME ${_t}.fort
# COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 6 ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${_t}> ${MPIEXEC_POSTFLAGS}
# )
#endforeach ()
#
##problem with this test TODO fix segfault
#set(_tests_np24 test_f_cubed_sphere)
#foreach (_t ${_tests_np24})
# add_executable(${_t} ${_t}.f90)
# target_include_directories(${_t} PRIVATE ${CMAKE_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/bindings/fhex)
# target_link_libraries(${_t} PRIVATE fhex)
# add_test(
# NAME ${_t}.fort
# COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 24 ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${_t}> ${MPIEXEC_POSTFLAGS}
# )
#endforeach ()
#
#set(_tests_bench test_f_structured)
#
#foreach (_t ${_tests_bench})
# add_executable(${_t} ${_t}.f90)
# target_include_directories(${_t} PRIVATE ${CMAKE_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/bindings/fhex)
# target_link_libraries(${_t} PRIVATE fhex)
# add_test(
# NAME ${_t}.fort
# COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 8 ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${_t}> 64 10 1 8 ${MPIEXEC_POSTFLAGS}
# )
#endforeach ()
1 change: 1 addition & 0 deletions test/bindings/fhex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function(ghex_reg_parallel_test_f t n)
if (GHEX_FORTRAN_OPENMP)
target_link_libraries(${t} PRIVATE OpenMP::OpenMP_Fortran)
endif()
ghex_link_to_oomph(${t})
## workaround for clang+openmp
#target_link_libraries(${t} PRIVATE $<$<CXX_COMPILER_ID:Clang>:$<LINK_ONLY:-fopenmp=libomp>>)
add_test(
Expand Down

0 comments on commit 9fb21e5

Please sign in to comment.