Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests #7

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/[email protected]
with:
repository: kokkos/kokkos
ref: 3.1.00
ref: 3.2.01
path: kokkos
- name: Build kokkos
working-directory: kokkos
Expand Down
20 changes: 19 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# project settings
cmake_minimum_required(VERSION 3.12)

project(AFE LANGUAGES CXX)
project(CFE LANGUAGES CXX)

include(GNUInstallDirs)

Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions advanced_examples/01_parallel_for/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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)
4 changes: 2 additions & 2 deletions advanced_examples/02_push/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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)
4 changes: 2 additions & 2 deletions advanced_examples/03_scatter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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)
27 changes: 14 additions & 13 deletions advanced_examples/04_unmanaged_aosoa/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
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"))
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()

target_link_libraries(ForParallelForUnmanaged Cabana::cabanacore ${MPI_Fortran_LIBRARIES})
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)
link_directories(${MPI_Fortran_LIBRARIES})
2 changes: 1 addition & 1 deletion tutorial/01_hello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions tutorial/02_tuple/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions tutorial/03_struct_of_arrays/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions tutorial/04_aosoa/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 3 additions & 1 deletion tutorial/05_parallel_for/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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"))
Expand All @@ -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()
8 changes: 5 additions & 3 deletions tutorial/06_kokkos_parallel_for/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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()