-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fpp macros to support automatic location info generation
- Loading branch information
Showing
57 changed files
with
1,215 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
CMakeLists.txt | ||
meson.build | ||
meson.options | ||
*.fypp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
LICENSE | ||
include/ | ||
include/fortuno_coarray.fpp | ||
src/ | ||
src/fortuno.f90 | ||
src/fortuno/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
CMakeLists.txt | ||
meson.build | ||
meson.options | ||
*.fypp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
LICENSE | ||
include/ | ||
include/fortuno_mpi.fpp | ||
src/ | ||
src/fortuno.f90 | ||
src/fortuno/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
CMakeLists.txt | ||
meson.build | ||
meson.options | ||
*.fypp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
LICENSE | ||
include/ | ||
include/fortuno_serial.fpp | ||
src/ | ||
src/fortuno.f90 | ||
src/fortuno/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This file is part of Fortuno. | ||
# Licensed under the BSD-2-Clause Plus Patent license. | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
list(APPEND CMAKE_MESSAGE_CONTEXT CoarrayFpp) | ||
|
||
add_library(fortuno_example_coarray_fpp_mylib) | ||
set_target_properties( | ||
fortuno_example_coarray_fpp_mylib PROPERTIES | ||
OUTPUT_NAME mylib | ||
) | ||
target_sources( | ||
fortuno_example_coarray_fpp_mylib PRIVATE | ||
mylib.f90 | ||
) | ||
fortuno_add_coarray_build_flags(fortuno_example_coarray_fpp_mylib) | ||
|
||
add_executable(fortuno_example_coarray_fpp_testapp) | ||
set_target_properties( | ||
fortuno_example_coarray_fpp_testapp PROPERTIES | ||
OUTPUT_NAME testapp | ||
) | ||
target_sources( | ||
fortuno_example_coarray_fpp_testapp PRIVATE | ||
test_simple_fpp.F90 | ||
testapp.f90 | ||
) | ||
target_link_libraries( | ||
fortuno_example_coarray_fpp_testapp PRIVATE | ||
fortuno_example_coarray_fpp_mylib | ||
Fortuno::fortuno_coarray | ||
) | ||
fortuno_add_coarray_build_flags(fortuno_example_coarray_fpp_testapp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This file is part of Fortuno. | ||
# Licensed under the BSD-2-Clause Plus Patent license. | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
example_mylib_fpp_lib = library( | ||
'mylib', | ||
sources: ['mylib.f90'], | ||
install: false, | ||
fortran_args: fflags_coarray, | ||
link_args: ldflags_coarray, | ||
) | ||
example_mylib_fpp_dep = declare_dependency( | ||
link_with: example_mylib_fpp_lib, | ||
) | ||
|
||
example_testapp_exe = executable( | ||
'testapp', | ||
sources: [ | ||
'test_simple_fpp.F90', | ||
'testapp.f90', | ||
], | ||
dependencies: [example_mylib_fpp_dep, fortuno_coarray_dep], | ||
install: false, | ||
fortran_args: fflags_coarray, | ||
link_args: ldflags_coarray, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
! This file is part of Fortuno. | ||
! Licensed under the BSD-2-Clause Plus Patent license. | ||
! SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
!> Demo module/library to be tested | ||
module mylib | ||
implicit none | ||
|
||
private | ||
public :: broadcast | ||
|
||
contains | ||
|
||
|
||
!> Broadcasts a scalar integer. | ||
subroutine broadcast(buffer, source) | ||
|
||
!> Buffer to broadcast | ||
integer, intent(inout) :: buffer | ||
|
||
!> Source image | ||
integer, intent(in) :: source | ||
|
||
integer :: stat | ||
|
||
call co_broadcast(buffer, source) | ||
|
||
end subroutine broadcast | ||
|
||
end module mylib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
! This file is part of Fortuno. | ||
! Licensed under the BSD-2-Clause Plus Patent license. | ||
! SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
#include "fortuno_coarray.fpp" | ||
|
||
module test_simple_fpp | ||
use mylib, only : broadcast | ||
use fortuno_coarray, only : as_char, test => coa_pure_case_item, context => coa_context,& | ||
& is_equal, test_list | ||
implicit none | ||
|
||
contains | ||
|
||
|
||
!> Returns the tests from this module | ||
function tests() | ||
type(test_list) :: tests | ||
|
||
tests = test_list([& | ||
test("broadcast", test_broadcast)& | ||
]) | ||
|
||
end function tests | ||
|
||
|
||
!> Broadcast test with collective communication | ||
subroutine test_broadcast(ctx) | ||
class(context), intent(inout) :: ctx | ||
|
||
integer, parameter :: sourceimg = 1, sourceval = 100, otherval = -1 | ||
integer :: buffer | ||
|
||
character(:), allocatable :: msg | ||
|
||
! GIVEN source rank contains a different integer value as all other ranks | ||
if (this_image() == sourceimg) then | ||
buffer = sourceval | ||
else | ||
buffer = otherval | ||
end if | ||
|
||
! WHEN source rank broadcasts its value | ||
call broadcast(buffer, sourceimg) | ||
|
||
! Make every third rank fail for demonstration purposes | ||
if (mod(this_image() - 1, 3) == 2) then | ||
buffer = sourceval + 1 | ||
msg = "Failing on image " // as_char(this_image()) // " on purpose" | ||
end if | ||
|
||
! THEN each rank must contain source rank's value | ||
CHECK_MSG(ctx, is_equal(buffer, sourceval), msg) | ||
|
||
end subroutine test_broadcast | ||
|
||
end module test_simple_fpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
! This file is part of Fortuno. | ||
! Licensed under the BSD-2-Clause Plus Patent license. | ||
! SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
!> Test app, collecting and executing the tests | ||
program testapp | ||
use fortuno_coarray, only : execute_coa_cmd_app | ||
use test_simple_fpp, only : tests | ||
implicit none | ||
|
||
call execute_coa_cmd_app(tests()) | ||
|
||
end program testapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This file is part of Fortuno. | ||
# Licensed under the BSD-2-Clause Plus Patent license. | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
list(APPEND CMAKE_MESSAGE_CONTEXT MpiFpp) | ||
|
||
add_library(fortuno_example_mpi_fpp_mylib) | ||
set_target_properties( | ||
fortuno_example_mpi_fpp_mylib PROPERTIES | ||
OUTPUT_NAME mylib | ||
) | ||
target_sources( | ||
fortuno_example_mpi_fpp_mylib PRIVATE | ||
mylib.f90 | ||
) | ||
target_link_libraries(fortuno_example_mpi_fpp_mylib PRIVATE MPI::MPI_Fortran) | ||
|
||
add_executable(fortuno_example_mpi_fpp_testapp) | ||
set_target_properties( | ||
fortuno_example_mpi_fpp_testapp PROPERTIES | ||
OUTPUT_NAME testapp | ||
) | ||
target_sources( | ||
fortuno_example_mpi_fpp_testapp PRIVATE | ||
test_simple_fpp.F90 | ||
testapp.f90 | ||
) | ||
target_link_libraries( | ||
fortuno_example_mpi_fpp_testapp | ||
PRIVATE | ||
fortuno_example_mpi_fpp_mylib | ||
Fortuno::fortuno_mpi | ||
MPI::MPI_Fortran | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This file is part of Fortuno. | ||
# Licensed under the BSD-2-Clause Plus Patent license. | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
example_mylib_fpp_lib = library( | ||
'mylib', | ||
sources: ['mylib.f90'], | ||
dependencies: [mpi_fortran_dep], | ||
install: false, | ||
) | ||
example_mylib_fpp_dep = declare_dependency( | ||
link_with: example_mylib_fpp_lib, | ||
) | ||
|
||
example_testapp_exe = executable( | ||
'testapp', | ||
sources: [ | ||
'test_simple_fpp.F90', | ||
'testapp.f90', | ||
], | ||
dependencies: [example_mylib_fpp_dep, fortuno_mpi_dep], | ||
install: false, | ||
) |
Oops, something went wrong.