Skip to content

Commit 2d7b591

Browse files
authored
Merge pull request #105 from Adrian-Diaz/Adrian's-Branch
Tpetra wrapper update
2 parents 84525bd + c641e37 commit 2d7b591

31 files changed

+14159
-368
lines changed

CMakeLists.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,20 @@ if(Matar_ENABLE_KOKKOS)
5555
if("${Matar_KOKKOS_PACKAGE}" STREQUAL "Trilinos")
5656
find_package(Trilinos REQUIRED)
5757
add_definitions(-DTRILINOS_INTERFACE=1)
58+
elseif(Matar_ENABLE_TRILINOS)
59+
find_package(Trilinos REQUIRED)
60+
add_definitions(-DTRILINOS_INTERFACE=1)
5861
else()
5962
find_package(Kokkos REQUIRED)
6063
endif()
6164
if (Matar_ENABLE_MPI)
6265
find_package(MPI REQUIRED)
6366
add_definitions(-DHAVE_MPI=1)
64-
target_link_libraries(matar INTERFACE Kokkos::kokkos MPI::MPI_CXX)
67+
if(Matar_ENABLE_TRILINOS)
68+
target_link_libraries(matar INTERFACE Trilinos::all_selected_libs MPI::MPI_CXX)
69+
else()
70+
target_link_libraries(matar INTERFACE Kokkos::kokkos MPI::MPI_CXX)
71+
endif()
6572
else()
6673
target_link_libraries(matar INTERFACE Kokkos::kokkos)
6774
endif()

examples/CMakeLists.txt

+62-8
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ if (NOT TARGET distclean)
1010
INCLUDE(../cmake/Modules/TargetDistclean.cmake OPTIONAL)
1111
endif (NOT TARGET distclean)
1212

13+
find_package(Matar REQUIRED)
1314
set(LINKING_LIBRARIES matar)
1415

15-
find_package(Matar REQUIRED)
1616
if (MPI)
1717
find_package(MPI REQUIRED)
1818
add_definitions(-DHAVE_MPI=1)
@@ -36,9 +36,43 @@ if (NOT KOKKOS)
3636
endif()
3737

3838
if (KOKKOS)
39-
find_package(Kokkos REQUIRED) #new
39+
if (Matar_ENABLE_TRILINOS)
40+
find_package(Trilinos REQUIRED) #new
41+
# Assume if the CXX compiler exists, the rest do too.
42+
if (EXISTS ${Trilinos_CXX_COMPILER})
43+
set(CMAKE_CXX_COMPILER ${Trilinos_CXX_COMPILER})
44+
set(CMAKE_C_COMPILER ${Trilinos_C_COMPILER})
45+
set(CMAKE_Fortran_COMPILER ${Trilinos_Fortran_COMPILER})
46+
endif()
47+
if(NOT DISTRIBUTION)
48+
# Make sure to use same compilers and flags as Trilinos
49+
set(CMAKE_CXX_FLAGS "${Trilinos_CXX_COMPILER_FLAGS} ${CMAKE_CXX_FLAGS}")
50+
set(CMAKE_C_FLAGS "${Trilinos_C_COMPILER_FLAGS} ${CMAKE_C_FLAGS}")
51+
set(CMAKE_Fortran_FLAGS "${Trilinos_Fortran_COMPILER_FLAGS} ${CMAKE_Fortran_FLAGS}")
52+
endif()
53+
54+
message("\nFound Trilinos! Here are the details: ")
55+
message(" Trilinos_DIR = ${Trilinos_DIR}")
56+
message(" Trilinos_VERSION = ${Trilinos_VERSION}")
57+
message(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}")
58+
message(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}")
59+
message(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}")
60+
message(" Trilinos_LIBRARY_DIRS = ${Trilinos_LIBRARY_DIRS}")
61+
message(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}")
62+
message(" Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}")
63+
message(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}")
64+
message(" Trilinos_TPL_LIBRARY_DIRS = ${Trilinos_TPL_LIBRARY_DIRS}")
65+
message(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}")
66+
message("End of Trilinos details\n")
67+
68+
include_directories(${Trilinos_INCLUDE_DIRS} ${Trilinos_TPL_INCLUDE_DIRS})
69+
list(APPEND LINKING_LIBRARIES Trilinos::all_selected_libs)
70+
add_definitions(-DTRILINOS_INTERFACE=1)
71+
else()
72+
find_package(Kokkos REQUIRED) #new
73+
list(APPEND LINKING_LIBRARIES Kokkos::kokkos)
74+
endif()
4075

41-
list(APPEND LINKING_LIBRARIES Kokkos::kokkos)
4276

4377
add_definitions(-DHAVE_KOKKOS=1)
4478

@@ -76,11 +110,36 @@ if (KOKKOS)
76110
add_executable(annkokkos ann_kokkos.cpp)
77111
target_link_libraries(annkokkos ${LINKING_LIBRARIES})
78112

113+
add_executable(annkokkos_compare ann_kokkos_compare.cpp)
114+
target_link_libraries(annkokkos_compare ${LINKING_LIBRARIES})
115+
116+
if (Matar_ENABLE_TRILINOS)
117+
add_executable(anndistributed ann_distributed.cpp)
118+
target_link_libraries(anndistributed ${LINKING_LIBRARIES})
119+
120+
add_executable(anndistributed_crs ann_distributed_crs.cpp)
121+
target_link_libraries(anndistributed_crs ${LINKING_LIBRARIES})
122+
123+
add_executable(test_tpetra_farray test_tpetra_farray.cpp)
124+
target_link_libraries(test_tpetra_farray ${LINKING_LIBRARIES})
125+
126+
add_executable(test_tpetra_carray test_tpetra_carray.cpp)
127+
target_link_libraries(test_tpetra_carray ${LINKING_LIBRARIES})
128+
129+
add_executable(test_tpetra_mesh test_tpetra_mesh.cpp)
130+
target_link_libraries(test_tpetra_mesh ${LINKING_LIBRARIES})
131+
endif()
132+
79133
if (OPENMP)
80134
add_executable(parallel_hello_world parallel_hello_world.cpp)
81135
target_link_libraries(parallel_hello_world ${LINKING_LIBRARIES})
82136
endif()
83137

138+
if (MPI)
139+
include_directories(laplaceMPI)
140+
add_subdirectory(laplaceMPI)
141+
endif()
142+
84143
endif()
85144

86145
### HIP Linking error, will add back in after fixed
@@ -114,11 +173,6 @@ add_subdirectory(sparsetests)
114173
include_directories(test_rocm)
115174
add_subdirectory(test_rocm)
116175

117-
if (MPI)
118-
include_directories(laplaceMPI)
119-
add_subdirectory(laplaceMPI)
120-
endif()
121-
122176
#include_directories(phaseField/srcKokkosVerbose)
123177
#add_subdirectory(phaseField/srcKokkosVerbose)
124178

0 commit comments

Comments
 (0)