From a93c2fc9ae452d4d5781adb546a4c3f50d08de46 Mon Sep 17 00:00:00 2001 From: Sam <6740307+streeve@users.noreply.github.com> Date: Tue, 28 Jul 2020 19:06:09 -0700 Subject: [PATCH 1/6] Add gtest --- CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4488f0..e93aa8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # project settings cmake_minimum_required(VERSION 3.12) -project(AFE LANGUAGES CXX) +project(CFE LANGUAGES CXX) include(GNUInstallDirs) @@ -10,6 +10,24 @@ set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11 +# Download and unpack googletest at configure time +include(FetchContent) +FetchContent_Declare( + googletest + URL https://github.com/google/googletest/archive/release-1.10.0.tar.gz +) +FetchContent_GetProperties(googletest) +if(NOT googletest_POPULATED) + FetchContent_Populate(googletest) + add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) +endif() + +# Prevent GoogleTest from overriding our compiler/linker options +# when building with Visual Studio +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + +enable_testing() + # find dependencies find_package(Cabana REQUIRED) From 3bbfb2008aa321811fc85237db8171751bdafe21 Mon Sep 17 00:00:00 2001 From: Sam <6740307+streeve@users.noreply.github.com> Date: Tue, 28 Jul 2020 23:25:55 -0700 Subject: [PATCH 2/6] Remove deprecated Cabana variables --- advanced_examples/01_parallel_for/CMakeLists.txt | 2 +- advanced_examples/02_push/CMakeLists.txt | 2 +- advanced_examples/03_scatter/CMakeLists.txt | 2 +- advanced_examples/04_unmanaged_aosoa/CMakeLists.txt | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/advanced_examples/01_parallel_for/CMakeLists.txt b/advanced_examples/01_parallel_for/CMakeLists.txt index a81814e..306319d 100644 --- a/advanced_examples/01_parallel_for/CMakeLists.txt +++ b/advanced_examples/01_parallel_for/CMakeLists.txt @@ -1,4 +1,4 @@ -if( Cabana_ENABLE_Cuda ) +if( Kokkos_ENABLE_CUDA ) if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI") add_definitions(-DSIMD_SIZE=1 -DVEC_LEN=32 -DUSE_GPU=1) set(MPI_Fortran_COMPILE_FLAGS "-r -ta=tesla:cuda9.0 -Minfo=accel -Mcuda=cuda9.0") diff --git a/advanced_examples/02_push/CMakeLists.txt b/advanced_examples/02_push/CMakeLists.txt index 7252321..183d3c6 100644 --- a/advanced_examples/02_push/CMakeLists.txt +++ b/advanced_examples/02_push/CMakeLists.txt @@ -1,4 +1,4 @@ -if( Cabana_ENABLE_Cuda ) +if( Kokkos_ENABLE_CUDA ) if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI") add_definitions(-DSIMD_SIZE=1 -DVEC_LEN=32 -DUSE_GPU=1) set(MPI_Fortran_COMPILE_FLAGS "-r -ta=tesla:cuda9.0 -Minfo=accel -Mcuda=cuda9.0") diff --git a/advanced_examples/03_scatter/CMakeLists.txt b/advanced_examples/03_scatter/CMakeLists.txt index ab6fb86..6c80fde 100644 --- a/advanced_examples/03_scatter/CMakeLists.txt +++ b/advanced_examples/03_scatter/CMakeLists.txt @@ -1,4 +1,4 @@ -if( Cabana_ENABLE_Cuda ) +if( Kokkos_ENABLE_CUDA ) if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI") add_definitions(-DSIMD_SIZE=1 -DVEC_LEN=32 -DUSE_GPU=1) set(MPI_Fortran_COMPILE_FLAGS "-r -ta=tesla:cuda9.0 -Minfo=accel -Mcuda=cuda9.0") diff --git a/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt b/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt index e1d3e55..da97bb0 100644 --- a/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt +++ b/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt @@ -8,29 +8,29 @@ link_directories(${MPI_Fortran_LIBRARIES}) message(${CMAKE_Fortran_COMPILER_ID}) if (("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI") AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) - if( Cabana_ENABLE_Cuda ) + if( Kokkos_ENABLE_CUDA ) target_compile_definitions(ForParallelForUnmanaged PUBLIC -DUSE_GPU=1) set(CMAKE_Fortran_FLAGS "-ta=tesla:cuda9.0 -Minfo=accel -Mcuda=cuda9.0") set(CMAKE_CXX_FLAGS "--relocatable-device-code=true") - elseif( Cabana_ENABLE_OpenMP ) + elseif( Kokkos_ENABLE_OPENMP ) target_compile_definitions(ForParallelForUnmanaged PUBLIC -DUSE_GPU=0) set(CMAKE_Fortran_FLAGS "-ta=multicore -mp") - elseif( Cabana_ENABLE_Serial ) + elseif( Kokkos_ENABLE_SERIAL ) target_compile_definitions(ForParallelForUnmanaged PUBLIC -DUSE_GPU=0) set(CMAKE_Fortran_FLAGS "-ta=host") endif() set(CMAKE_EXE_LINKER_FLAGS "-pgc++libs") else() - if( Cabana_ENABLE_Cuda ) + if( Kokkos_ENABLE_CUDA ) message("Only PGI is supported for compiling fortran cuda code. Right now we only accept building with PGI for both CXX and Fortran to avoid mixing compiler families.\n Skip.") return() - elseif( Cabana_ENABLE_OpenMP ) + elseif( Kokkos_ENABLE_OPENMP ) target_compile_definitions(ForParallelForUnmanaged PUBLIC -DUSE_GPU=0) set(CMAKE_Fortran_FLAGS "-fopenmp") - elseif( Cabana_ENABLE_Serial ) + elseif( Kokkos_ENABLE_SERIAL ) target_compile_definitions(ForParallelForUnmanaged PUBLIC -DUSE_GPU=0) endif() endif() From de5a06a91cb8c9400c5ad5172c7ea4003ff5b45b Mon Sep 17 00:00:00 2001 From: Sam <6740307+streeve@users.noreply.github.com> Date: Wed, 29 Jul 2020 18:09:06 -0700 Subject: [PATCH 3/6] Abort first --- .../04_unmanaged_aosoa/CMakeLists.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt b/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt index da97bb0..7710523 100644 --- a/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt +++ b/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt @@ -1,10 +1,4 @@ add_executable(ForParallelForUnmanaged Fortran_main.F90 Fortran_kernels.F90 parallel_for_example.cpp) -target_link_libraries(ForParallelForUnmanaged Cabana::cabanacore ${MPI_Fortran_LIBRARIES}) -add_test(NAME Fortran_advance_example_04 COMMAND ForParallelForUnmanaged) -set_property(TARGET ForParallelForUnmanaged PROPERTY LINKER_LANGUAGE Fortran) -add_definitions(${MPI_Fortran_COMPILE_FLAGS}) -include_directories(${MPI_Fortran_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR}/../Fortran_features) -link_directories(${MPI_Fortran_LIBRARIES}) message(${CMAKE_Fortran_COMPILER_ID}) if (("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI") AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) @@ -19,7 +13,7 @@ if (("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI") AND ("${CMAKE_CXX_COMPILER_I target_compile_definitions(ForParallelForUnmanaged PUBLIC -DUSE_GPU=0) set(CMAKE_Fortran_FLAGS "-ta=host") endif() - + set(CMAKE_EXE_LINKER_FLAGS "-pgc++libs") else() if( Kokkos_ENABLE_CUDA ) @@ -34,3 +28,10 @@ else() target_compile_definitions(ForParallelForUnmanaged PUBLIC -DUSE_GPU=0) endif() endif() + +target_link_libraries(ForParallelForUnmanaged Cabana::cabanacore ${MPI_Fortran_LIBRARIES}) +add_test(NAME Fortran_advance_example_04 COMMAND ForParallelForUnmanaged) +set_property(TARGET ForParallelForUnmanaged PROPERTY LINKER_LANGUAGE Fortran) +add_definitions(${MPI_Fortran_COMPILE_FLAGS}) +include_directories(${MPI_Fortran_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR}/../Fortran_features) +link_directories(${MPI_Fortran_LIBRARIES}) From 82f87f69e2510b4c824f6ebfab6991438db0e559 Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Mon, 3 Aug 2020 22:34:04 -0400 Subject: [PATCH 4/6] Only warn for Cuda --- tutorial/05_parallel_for/CMakeLists.txt | 2 ++ tutorial/06_kokkos_parallel_for/CMakeLists.txt | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tutorial/05_parallel_for/CMakeLists.txt b/tutorial/05_parallel_for/CMakeLists.txt index 40d402c..3ec9a27 100644 --- a/tutorial/05_parallel_for/CMakeLists.txt +++ b/tutorial/05_parallel_for/CMakeLists.txt @@ -22,8 +22,10 @@ if (("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI") AND ("${CMAKE_CXX_COMPILER_I target_link_options(ForParallelFor "-pgc++libs") endif() else() + if( Kokkos_ENABLE_CUDA ) message("Only PGI is supported for compiling fortran cuda code. Right now we only accept building with PGI for both CXX and Fortran to avoid mixing compiler families.\n Skip.") return() + endif() endif() diff --git a/tutorial/06_kokkos_parallel_for/CMakeLists.txt b/tutorial/06_kokkos_parallel_for/CMakeLists.txt index 17d5787..66737aa 100644 --- a/tutorial/06_kokkos_parallel_for/CMakeLists.txt +++ b/tutorial/06_kokkos_parallel_for/CMakeLists.txt @@ -23,6 +23,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI") endif() else() - message("Only PGI is supported for compiling fortran cuda code.\n Skip.") - return() + if( Kokkos_ENABLE_CUDA ) + message("Only PGI is supported for compiling fortran cuda code.\n Skip.") + return() + endif() endif() From 1c74e5f73782deddfec7bfead9ac20958841d323 Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Mon, 3 Aug 2020 22:52:07 -0400 Subject: [PATCH 5/6] Update test names --- advanced_examples/01_parallel_for/CMakeLists.txt | 2 +- advanced_examples/02_push/CMakeLists.txt | 2 +- advanced_examples/03_scatter/CMakeLists.txt | 2 +- advanced_examples/04_unmanaged_aosoa/CMakeLists.txt | 2 +- tutorial/01_hello_world/CMakeLists.txt | 2 +- tutorial/02_tuple/CMakeLists.txt | 6 +++--- tutorial/03_struct_of_arrays/CMakeLists.txt | 6 +++--- tutorial/04_aosoa/CMakeLists.txt | 6 +++--- tutorial/05_parallel_for/CMakeLists.txt | 2 +- tutorial/06_kokkos_parallel_for/CMakeLists.txt | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/advanced_examples/01_parallel_for/CMakeLists.txt b/advanced_examples/01_parallel_for/CMakeLists.txt index 306319d..c293e95 100644 --- a/advanced_examples/01_parallel_for/CMakeLists.txt +++ b/advanced_examples/01_parallel_for/CMakeLists.txt @@ -24,5 +24,5 @@ set_target_properties(AdvForParallelFor PROPERTIES COMPILE_FLAGS "${MPI_Fortran_ set_target_properties(AdvForParallelFor PROPERTIES LINK_FLAGS "${MPI_Fortran_LINK_FLAGS}") target_link_libraries(AdvForParallelFor Cabana::cabanacore ${MPI_Fortran_LIBRARIES} kokkos_fortran_wrappers) -add_test(NAME Fortran_advanced_example_01 COMMAND AdvForParallelFor) +add_test(NAME Fortran_AdvEx_01_ParFor COMMAND AdvForParallelFor) set_property(TARGET AdvForParallelFor PROPERTY LINKER_LANGUAGE Fortran) diff --git a/advanced_examples/02_push/CMakeLists.txt b/advanced_examples/02_push/CMakeLists.txt index 183d3c6..03a3c66 100644 --- a/advanced_examples/02_push/CMakeLists.txt +++ b/advanced_examples/02_push/CMakeLists.txt @@ -25,5 +25,5 @@ set_target_properties(AdvForPush PROPERTIES COMPILE_FLAGS "${MPI_Fortran_COMPILE set_target_properties(AdvForPush PROPERTIES LINK_FLAGS "${MPI_Fortran_LINK_FLAGS}") target_link_libraries(AdvForPush Cabana::cabanacore ${MPI_Fortran_LIBRARIES} kokkos_fortran_wrappers) -add_test(NAME Fortran_advanced_example_02 COMMAND AdvForPush) +add_test(NAME Fortran_AdvEx_02_Push COMMAND AdvForPush) set_property(TARGET AdvForPush PROPERTY LINKER_LANGUAGE Fortran) diff --git a/advanced_examples/03_scatter/CMakeLists.txt b/advanced_examples/03_scatter/CMakeLists.txt index 6c80fde..00f6f2b 100644 --- a/advanced_examples/03_scatter/CMakeLists.txt +++ b/advanced_examples/03_scatter/CMakeLists.txt @@ -25,5 +25,5 @@ set_target_properties(AdvForScatter PROPERTIES COMPILE_FLAGS "${MPI_Fortran_COMP set_target_properties(AdvForScatter PROPERTIES LINK_FLAGS "${MPI_Fortran_LINK_FLAGS}") target_link_libraries(AdvForScatter Cabana::cabanacore ${MPI_Fortran_LIBRARIES} kokkos_fortran_wrappers) -add_test(NAME Fortran_advanced_example_03 COMMAND AdvForScatter) +add_test(NAME Fortran_AdvEx_03_Scatter COMMAND AdvForScatter) set_property(TARGET AdvForScatter PROPERTY LINKER_LANGUAGE Fortran) diff --git a/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt b/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt index 7710523..6e7f52f 100644 --- a/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt +++ b/advanced_examples/04_unmanaged_aosoa/CMakeLists.txt @@ -30,7 +30,7 @@ else() endif() target_link_libraries(ForParallelForUnmanaged Cabana::cabanacore ${MPI_Fortran_LIBRARIES}) -add_test(NAME Fortran_advance_example_04 COMMAND ForParallelForUnmanaged) +add_test(NAME Fortran_AdvEx_04_Unmanaged COMMAND ForParallelForUnmanaged) set_property(TARGET ForParallelForUnmanaged PROPERTY LINKER_LANGUAGE Fortran) add_definitions(${MPI_Fortran_COMPILE_FLAGS}) include_directories(${MPI_Fortran_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR}/../Fortran_features) diff --git a/tutorial/01_hello_world/CMakeLists.txt b/tutorial/01_hello_world/CMakeLists.txt index 81f8a04..0ae30e1 100644 --- a/tutorial/01_hello_world/CMakeLists.txt +++ b/tutorial/01_hello_world/CMakeLists.txt @@ -1,3 +1,3 @@ add_executable(ForHelloWorld main.cpp hello_world.f90) target_link_libraries(ForHelloWorld Cabana::cabanacore) -add_test(NAME Fortran_tutorial_01 COMMAND ForHelloWorld) +add_test(NAME Fortran_Tutorial_01_HelloWorld COMMAND ForHelloWorld) diff --git a/tutorial/02_tuple/CMakeLists.txt b/tutorial/02_tuple/CMakeLists.txt index 2f5c6dc..a8c153d 100644 --- a/tutorial/02_tuple/CMakeLists.txt +++ b/tutorial/02_tuple/CMakeLists.txt @@ -1,3 +1,3 @@ - add_executable(ForTuple main.cpp tuple_example.f90) - target_link_libraries(ForTuple Cabana::cabanacore) - add_test(NAME Fortran_tutorial_02 COMMAND ForTuple) +add_executable(ForTuple main.cpp tuple_example.f90) +target_link_libraries(ForTuple Cabana::cabanacore) +add_test(NAME Fortran_Tutorial_02_Tuple COMMAND ForTuple) diff --git a/tutorial/03_struct_of_arrays/CMakeLists.txt b/tutorial/03_struct_of_arrays/CMakeLists.txt index 5f8e7ab..a9c4734 100644 --- a/tutorial/03_struct_of_arrays/CMakeLists.txt +++ b/tutorial/03_struct_of_arrays/CMakeLists.txt @@ -1,3 +1,3 @@ - add_executable(ForStructOfArrays main.cpp soa_example.F90) - target_link_libraries(ForStructOfArrays Cabana::cabanacore) - add_test(NAME Fortran_tutorial_03 COMMAND ForStructOfArrays) +add_executable(ForStructOfArrays main.cpp soa_example.F90) +target_link_libraries(ForStructOfArrays Cabana::cabanacore) +add_test(NAME Fortran_Tutorial_03_SoA COMMAND ForStructOfArrays) diff --git a/tutorial/04_aosoa/CMakeLists.txt b/tutorial/04_aosoa/CMakeLists.txt index 9b580c7..fe65e72 100644 --- a/tutorial/04_aosoa/CMakeLists.txt +++ b/tutorial/04_aosoa/CMakeLists.txt @@ -1,3 +1,3 @@ - add_executable(ForArrayOfStructsOfArrays main.cpp aosoa_example.F90) - target_link_libraries(ForArrayOfStructsOfArrays Cabana::cabanacore) - add_test(NAME Fortran_tutorial_04 COMMAND ForArrayOfStructsOfArrays) +add_executable(ForArrayOfStructsOfArrays main.cpp aosoa_example.F90) +target_link_libraries(ForArrayOfStructsOfArrays Cabana::cabanacore) +add_test(NAME Fortran_Tutorial_04_AoSoA COMMAND ForArrayOfStructsOfArrays) diff --git a/tutorial/05_parallel_for/CMakeLists.txt b/tutorial/05_parallel_for/CMakeLists.txt index 3ec9a27..72c0c1f 100644 --- a/tutorial/05_parallel_for/CMakeLists.txt +++ b/tutorial/05_parallel_for/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(ForParallelFor Fortran_main.f90 Fortran_kernels.F90 parallel_for_example.cpp) target_link_libraries(ForParallelFor Cabana::cabanacore) -add_test(NAME Fortran_tutorial_05 COMMAND ForParallelFor) +add_test(NAME Fortran_Tutorial_05_ParFor COMMAND ForParallelFor) set_property(TARGET ForParallelFor PROPERTY LINKER_LANGUAGE CXX) if (("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI") AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")) diff --git a/tutorial/06_kokkos_parallel_for/CMakeLists.txt b/tutorial/06_kokkos_parallel_for/CMakeLists.txt index 66737aa..6942912 100644 --- a/tutorial/06_kokkos_parallel_for/CMakeLists.txt +++ b/tutorial/06_kokkos_parallel_for/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(ForKKParallelFor Fortran_main.f90 Fortran_kernel.F90 hello_world.cpp) target_link_libraries(ForKKParallelFor Cabana::cabanacore) -add_test(NAME Fortran_tutorial_06 COMMAND ForKKParallelFor) +add_test(NAME Fortran_Tutorial_06_KParFor COMMAND ForKKParallelFor) set_property(TARGET ForKKParallelFor PROPERTY LINKER_LANGUAGE CXX) if(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI") From 52412dedacdad9eb3cef3a6138a6c7e2147ba51a Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Mon, 17 May 2021 17:44:22 -0400 Subject: [PATCH 6/6] Update Kokkos to 3.2 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e421575..fe76292 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -22,7 +22,7 @@ jobs: uses: actions/checkout@v2.2.0 with: repository: kokkos/kokkos - ref: 3.1.00 + ref: 3.2.01 path: kokkos - name: Build kokkos working-directory: kokkos