Skip to content

Commit

Permalink
Merge pull request #105 from Adrian-Diaz/Adrian's-Branch
Browse files Browse the repository at this point in the history
Tpetra wrapper update
  • Loading branch information
Adrian-Diaz authored Dec 19, 2024
2 parents 84525bd + c641e37 commit 2d7b591
Show file tree
Hide file tree
Showing 31 changed files with 14,159 additions and 368 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,20 @@ if(Matar_ENABLE_KOKKOS)
if("${Matar_KOKKOS_PACKAGE}" STREQUAL "Trilinos")
find_package(Trilinos REQUIRED)
add_definitions(-DTRILINOS_INTERFACE=1)
elseif(Matar_ENABLE_TRILINOS)
find_package(Trilinos REQUIRED)
add_definitions(-DTRILINOS_INTERFACE=1)
else()
find_package(Kokkos REQUIRED)
endif()
if (Matar_ENABLE_MPI)
find_package(MPI REQUIRED)
add_definitions(-DHAVE_MPI=1)
target_link_libraries(matar INTERFACE Kokkos::kokkos MPI::MPI_CXX)
if(Matar_ENABLE_TRILINOS)
target_link_libraries(matar INTERFACE Trilinos::all_selected_libs MPI::MPI_CXX)
else()
target_link_libraries(matar INTERFACE Kokkos::kokkos MPI::MPI_CXX)
endif()
else()
target_link_libraries(matar INTERFACE Kokkos::kokkos)
endif()
Expand Down
70 changes: 62 additions & 8 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ if (NOT TARGET distclean)
INCLUDE(../cmake/Modules/TargetDistclean.cmake OPTIONAL)
endif (NOT TARGET distclean)

find_package(Matar REQUIRED)
set(LINKING_LIBRARIES matar)

find_package(Matar REQUIRED)
if (MPI)
find_package(MPI REQUIRED)
add_definitions(-DHAVE_MPI=1)
Expand All @@ -36,9 +36,43 @@ if (NOT KOKKOS)
endif()

if (KOKKOS)
find_package(Kokkos REQUIRED) #new
if (Matar_ENABLE_TRILINOS)
find_package(Trilinos REQUIRED) #new
# Assume if the CXX compiler exists, the rest do too.
if (EXISTS ${Trilinos_CXX_COMPILER})
set(CMAKE_CXX_COMPILER ${Trilinos_CXX_COMPILER})
set(CMAKE_C_COMPILER ${Trilinos_C_COMPILER})
set(CMAKE_Fortran_COMPILER ${Trilinos_Fortran_COMPILER})
endif()
if(NOT DISTRIBUTION)
# Make sure to use same compilers and flags as Trilinos
set(CMAKE_CXX_FLAGS "${Trilinos_CXX_COMPILER_FLAGS} ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${Trilinos_C_COMPILER_FLAGS} ${CMAKE_C_FLAGS}")
set(CMAKE_Fortran_FLAGS "${Trilinos_Fortran_COMPILER_FLAGS} ${CMAKE_Fortran_FLAGS}")
endif()

message("\nFound Trilinos! Here are the details: ")
message(" Trilinos_DIR = ${Trilinos_DIR}")
message(" Trilinos_VERSION = ${Trilinos_VERSION}")
message(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}")
message(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}")
message(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}")
message(" Trilinos_LIBRARY_DIRS = ${Trilinos_LIBRARY_DIRS}")
message(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}")
message(" Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}")
message(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}")
message(" Trilinos_TPL_LIBRARY_DIRS = ${Trilinos_TPL_LIBRARY_DIRS}")
message(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}")
message("End of Trilinos details\n")

include_directories(${Trilinos_INCLUDE_DIRS} ${Trilinos_TPL_INCLUDE_DIRS})
list(APPEND LINKING_LIBRARIES Trilinos::all_selected_libs)
add_definitions(-DTRILINOS_INTERFACE=1)
else()
find_package(Kokkos REQUIRED) #new
list(APPEND LINKING_LIBRARIES Kokkos::kokkos)
endif()

list(APPEND LINKING_LIBRARIES Kokkos::kokkos)

add_definitions(-DHAVE_KOKKOS=1)

Expand Down Expand Up @@ -76,11 +110,36 @@ if (KOKKOS)
add_executable(annkokkos ann_kokkos.cpp)
target_link_libraries(annkokkos ${LINKING_LIBRARIES})

add_executable(annkokkos_compare ann_kokkos_compare.cpp)
target_link_libraries(annkokkos_compare ${LINKING_LIBRARIES})

if (Matar_ENABLE_TRILINOS)
add_executable(anndistributed ann_distributed.cpp)
target_link_libraries(anndistributed ${LINKING_LIBRARIES})

add_executable(anndistributed_crs ann_distributed_crs.cpp)
target_link_libraries(anndistributed_crs ${LINKING_LIBRARIES})

add_executable(test_tpetra_farray test_tpetra_farray.cpp)
target_link_libraries(test_tpetra_farray ${LINKING_LIBRARIES})

add_executable(test_tpetra_carray test_tpetra_carray.cpp)
target_link_libraries(test_tpetra_carray ${LINKING_LIBRARIES})

add_executable(test_tpetra_mesh test_tpetra_mesh.cpp)
target_link_libraries(test_tpetra_mesh ${LINKING_LIBRARIES})
endif()

if (OPENMP)
add_executable(parallel_hello_world parallel_hello_world.cpp)
target_link_libraries(parallel_hello_world ${LINKING_LIBRARIES})
endif()

if (MPI)
include_directories(laplaceMPI)
add_subdirectory(laplaceMPI)
endif()

endif()

### HIP Linking error, will add back in after fixed
Expand Down Expand Up @@ -114,11 +173,6 @@ add_subdirectory(sparsetests)
include_directories(test_rocm)
add_subdirectory(test_rocm)

if (MPI)
include_directories(laplaceMPI)
add_subdirectory(laplaceMPI)
endif()

#include_directories(phaseField/srcKokkosVerbose)
#add_subdirectory(phaseField/srcKokkosVerbose)

Expand Down
Loading

0 comments on commit 2d7b591

Please sign in to comment.