-
Notifications
You must be signed in to change notification settings - Fork 7
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
Unit test with Julienne #133
Draft
rouson
wants to merge
46
commits into
main
Choose a base branch
from
switch-to-julienne
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
b11575d
fix(sync_all): call prif_sync_all
rouson 66e4b6d
fix(co_reduce): correctly set character ptr length
rouson 8aeb5ea
fix(install.sh): if flang, add assumed-rank flags
rouson 2f8f71e
Apply suggestions from code review
rouson 0426d7a
test(collectives): work around flang bugs
rouson d2791d2
build(fpm): switch to debug builds
rouson 886baa3
refac(c_f_string): use non-concurrent do
rouson d261701
test: replace veggies dependency with julienne
rouson b5326dd
fix(prif_allocate_test): .f90->.F90 to preprocess
rouson 7ab646e
test(prif_init): fix test desc in gfortran code
rouson c3b2279
test(num_images): add refactored passing test
rouson 5faf190
test(this_image): add refactored passing test
rouson 0779145
test(prif_num_images_test): fix typo
rouson 878f0d0
test(prif_allocate): better test subject text
rouson 0be5de7
WIP: add failing error stop test
rouson 094c780
WIP: add failing prif_stop test
rouson c9cd812
WIP: disable stop/error-stop tests
rouson dc922bd
test(co_broadcast): add passing test
rouson e8f92ff
test(prif_num_images): fix typo
rouson d961d2e
test(prif_co_broadcast): fix typo in gfortran code
rouson d95ab4a
test(main): run stop/error-stop tests
rouson 027ca56
feat(prif): leverage selected_logical_kind support
rouson cdf2590
test(teams): add passing test
rouson 05fdb05
WIP: add prif_image_index test - fails with flang
rouson 1ce9151
chore(prif_image_index): whitespace edits
rouson c560785
WIP: add prif_co_min test - fails with flang
rouson a0c9812
WIP: add prif_com_ax test - fails with flang
rouson c60ab05
Apply suggestions from code review
rouson b09efc5
build(preprocess): define feature-macro values
rouson fc31b13
fix(prif): .f90 -> .F90 for preprocessing
rouson abb3c55
Revert "build(preprocess): define feature-macro values"
rouson d8dc653
Revert "Apply suggestions from code review
"
rouson 4007eb7
chore(include): language feature macros in 1 file
rouson 83d73e4
chore(language-support): rm unused macro
rouson 4239bc2
chore(prif.F90): reversing mistaken rename
rouson 6689839
chore(prif): extension rename (retrying)
rouson e384e2e
build(include): rm indents to support gfortran
rouson 0350e69
build: fix preprocessor macros
rouson 519c707
test(co_m{in,ax}): fix gfortran workaround blocks
rouson e555dc8
WIP: add co_reduce test - fails with flang
rouson 36d6213
WIP: add prif_co_sum test - fails with flang
rouson 6466fb5
refac(test/main): reorganize declarations
rouson a746520
WIP: add prif_rma test -- fails with flang
rouson 80796fd
fix(test/main): call caffeine for error termination
rouson 0c74e9d
fix(error_stop_test): add cmdstatus arg
rouson 1a7f302
WIP: one prif_stop test now passes.
rouson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
program error_stop_character_code | ||
use iso_c_binding, only: c_bool | ||
use prif, only : prif_init, prif_error_stop, prif_stop | ||
use unit_test_parameters_m, only : unexpected_error_stop, expected_error_stop, unexpected_stop | ||
implicit none | ||
|
||
integer :: init_exit_code | ||
|
||
call prif_init(init_exit_code) | ||
if (init_exit_code /= 0) call prif_error_stop(.false._c_bool, unexpected_error_stop) | ||
! prif_error_stop_test.f90 should report a test failure if the above line invoikes prif_error_stop | ||
|
||
call prif_error_stop(.false._c_bool, " ") | ||
! prif_error_stop_test.f90 should report a passing test if the above prif_error_stop call succeeds | ||
|
||
call prif_stop(.false._c_bool, unexpected_stop) | ||
! prif_error_stop_test.f90 should report a passing test if the above prif_stop call executes | ||
end program |
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,18 @@ | ||
program error_stop_with_integer_code | ||
use iso_c_binding, only: c_bool | ||
use prif, only : prif_init, prif_error_stop, prif_stop | ||
use unit_test_parameters_m, only : unexpected_error_stop, expected_error_stop, unexpected_stop | ||
implicit none | ||
|
||
integer :: init_exit_code | ||
|
||
call prif_init(init_exit_code) | ||
if (init_exit_code /= 0) call prif_error_stop(.false._c_bool, unexpected_error_stop) | ||
! prif_error_stop_test.f90 should report a test failure if the above line invoikes prif_error_stop | ||
|
||
call prif_error_stop(.false._c_bool, expected_error_stop) | ||
! prif_error_stop_test.f90 should report a passing test if the above prif_error_stop call succeeds | ||
|
||
call prif_stop(.false._c_bool, unexpected_stop) | ||
! prif_error_stop_test.f90 should report a passing test if the above prif_stop call executes | ||
end program |
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,14 +1,18 @@ | ||
program stop_with_no_code | ||
program stop_with_integer_code | ||
use iso_c_binding, only: c_bool | ||
use prif, only : prif_init, prif_stop | ||
use prif, only : prif_init, prif_error_stop, prif_stop | ||
use unit_test_parameters_m, only : unexpected_error_stop, expected_stop, unexpected_stop | ||
implicit none | ||
|
||
integer :: init_exit_code | ||
|
||
call prif_init(init_exit_code) | ||
if (init_exit_code /= 0) error stop "caffeinate returned a non-zero exit_code" | ||
if (init_exit_code /= 0) call prif_error_stop(.false._c_bool, unexpected_error_stop) | ||
! prif_stop_test.f90 should report a test failure if the above line invoikes prif_error_stop | ||
|
||
call prif_stop(.false._c_bool, 1) | ||
call prif_stop(.false._c_bool, expected_stop) | ||
! prif_stop_test.f90 should report a passing test if the above prif_error_stop call succeeds | ||
|
||
stop 2 ! caffeine/test/zzz_finalization_test.f90 reports a failure if this line runs | ||
end program | ||
call prif_stop(.false._c_bool, unexpected_stop) | ||
! prif_stop_test.f90 should report a test failure if the above prif_stop call executes | ||
end program |
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 @@ | ||
! Copyright (c), The Regents of the University of California | ||
! Terms of use are as specified in LICENSE.txt | ||
|
||
#ifndef HAVE_SELECTED_LOGICAL_KIND | ||
! Define whether the compiler supports standard intrinsic function selected_logical_kind(), | ||
! a feature introduced in Fortran 2023 clause 16.9.182. | ||
#if defined(_CRAYFTN) || defined(NAGFOR) || defined(__flang__) | ||
#define HAVE_SELECTED_LOGICAL_KIND 1 | ||
#else | ||
#define HAVE_SELECTED_LOGICAL_KIND 0 | ||
#endif | ||
#endif | ||
|
||
#ifndef HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY | ||
! Define whether the compiler supports associating a procedure pointer dummy argument with an | ||
! actual argument that is a valid target for the pointer dummy in a procedure assignment, a | ||
! feature introduced in Fortran 2008 and described in Fortran 2023 clause 15.5.2.10 paragraph 5. | ||
#if defined(_CRAYFTN) || defined(__INTEL_COMPILER) || defined(NAGFOR) || defined(__flang__) | ||
#define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 1 | ||
#else | ||
#define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 0 | ||
#endif | ||
#endif |
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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
! Copyright (c), The Regents of the University of California | ||
! Terms of use are as specified in LICENSE.txt | ||
|
||
module unit_test_parameters_m | ||
!! Define values for use in the test suite, including example | ||
!! programs that the test suite builds and runs. | ||
implicit none | ||
|
||
enum, bind(C) | ||
enumerator :: expected_error_stop=99, unexpected_error_stop, expected_stop, unexpected_stop | ||
end enum | ||
end module |
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,106 @@ | ||
! Copyright (c) 2024, The Regents of the University of California and Sourcery Institute | ||
! Terms of use are as specified in LICENSE.txt | ||
|
||
program main | ||
!! Test the Caffeine implementation of the Parallel Runtime Interface for Fortran (PRIF) | ||
use julienne_m, only : command_line_t, GitHub_CI | ||
use prif, only : & | ||
prif_this_image_no_coarray & | ||
,prif_sync_all & | ||
,prif_error_stop & | ||
,prif_stop | ||
use prif_allocate_test_m, only : prif_allocate_test_t | ||
use prif_co_broadcast_test_m, only : prif_co_broadcast_test_t | ||
use prif_co_max_test_m, only : prif_co_max_test_t | ||
use prif_co_min_test_m, only : prif_co_min_test_t | ||
use prif_co_reduce_test_m, only : prif_co_reduce_test_t | ||
use prif_co_sum_test_m, only : prif_co_sum_test_t | ||
use prif_error_stop_test_m, only : prif_error_stop_test_t | ||
use prif_image_index_test_m, only : prif_image_index_test_t | ||
use prif_init_test_m, only : prif_init_test_t | ||
use prif_num_images_test_m, only : prif_num_images_test_t | ||
use prif_rma_test_m, only : prif_rma_test_t | ||
use prif_stop_test_m, only : prif_stop_test_t | ||
use prif_teams_test_m, only : prif_teams_test_t | ||
use prif_this_image_test_m, only : prif_this_image_test_t | ||
implicit none | ||
|
||
integer :: passes=0, tests=0 | ||
integer me | ||
|
||
call stop_and_print_usage_info_if_help_requested | ||
call run_tests_and_report(passes, tests) | ||
call prif_this_image_no_coarray(this_image=me) | ||
|
||
if (me==1) print *, new_line(''), "_________ In total, ",passes," of ",tests, " tests pass. _________" | ||
call prif_sync_all | ||
if (passes /= tests) call prif_error_stop(quiet=.false.) ! PRIF sec 5.2 requires the client to | ||
!call prif_stop(quiet=.true.) ! eventually call prif_error_stop or prif_stop | ||
|
||
contains | ||
|
||
subroutine stop_and_print_usage_info_if_help_requested | ||
type(command_line_t) command_line | ||
|
||
character(len=*), parameter :: usage = & | ||
new_line('') // new_line('') // & | ||
'Usage: fpm test -- [--help] | [--contains <substring>]' // & | ||
new_line('') // new_line('') // & | ||
'where square brackets ([]) denote optional arguments, a pipe (|) separates alternative arguments,' // new_line('') // & | ||
'angular brackets (<>) denote a user-provided value, and passing a substring limits execution to' // new_line('') // & | ||
'the tests with test subjects or test descriptions containing the user-specified substring.' // new_line('') | ||
|
||
if (command_line%argument_present([character(len=len("--help"))::"--help","-h"])) stop usage | ||
|
||
end subroutine | ||
|
||
subroutine run_tests_and_report(passes, tests) | ||
integer, intent(inout) :: passes, tests | ||
|
||
type(prif_allocate_test_t) prif_allocate_test | ||
type(prif_co_broadcast_test_t) prif_co_broadcast_test | ||
type(prif_co_max_test_t) prif_co_max_test | ||
type(prif_co_min_test_t) prif_co_min_test | ||
type(prif_co_reduce_test_t) prif_co_reduce_test | ||
type(prif_co_sum_test_t) prif_co_sum_test | ||
type(prif_error_stop_test_t) prif_error_stop_test | ||
type(prif_image_index_test_t) prif_image_index_test | ||
type(prif_init_test_t) prif_init_test | ||
type(prif_num_images_test_t) prif_num_images_test | ||
type(prif_rma_test_t) prif_rma_test | ||
type(prif_stop_test_t) prif_stop_test | ||
type(prif_teams_test_t) prif_teams_test | ||
type(prif_this_image_test_t) prif_this_image_test | ||
|
||
call prif_init_test%report(passes, tests) | ||
call prif_allocate_test%report(passes, tests) | ||
call prif_num_images_test%report(passes, tests) | ||
call prif_this_image_test%report(passes, tests) | ||
call prif_co_broadcast_test%report(passes, tests) | ||
call prif_teams_test%report(passes, tests) | ||
call prif_stop_test%report(passes, tests) | ||
#ifdef __flang__ | ||
print * | ||
print *,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" | ||
print * | ||
print *,"LLVM Flang detected. Skipping tests that crash:" | ||
print *," - prif_co_max_test" | ||
print *," - prif_co_min_test" | ||
print *," - prif_co_reduce_test" | ||
print *," - prif_co_sum_test" | ||
print *," - prif_image_index_test" | ||
print * | ||
print *,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" | ||
#else | ||
call prif_image_index_test%report(passes, tests) | ||
call prif_error_stop_test%report(passes, tests) | ||
call prif_co_max_test%report(passes, tests) | ||
call prif_co_min_test%report(passes, tests) | ||
call prif_co_reduce_test%report(passes, tests) | ||
call prif_co_sum_test%report(passes, tests) | ||
call prif_rma_test%report(passes, tests) | ||
#endif | ||
|
||
end subroutine run_tests_and_report | ||
|
||
end program |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like it doesn't belong in the main library. I'd suggest instead making another fpm project in this repo, i.e.
fpm new --lib caffeine-test-helpers
, putting this in there, and then specifying that just the tests and those examples depend on it. I.e.