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

Unit test with Julienne #133

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 26 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 Sep 6, 2024
66e4b6d
fix(co_reduce): correctly set character ptr length
rouson Sep 6, 2024
8aeb5ea
fix(install.sh): if flang, add assumed-rank flags
rouson Sep 6, 2024
2f8f71e
Apply suggestions from code review
rouson Sep 6, 2024
0426d7a
test(collectives): work around flang bugs
rouson Sep 6, 2024
d2791d2
build(fpm): switch to debug builds
rouson Sep 6, 2024
886baa3
refac(c_f_string): use non-concurrent do
rouson Sep 6, 2024
d261701
test: replace veggies dependency with julienne
rouson Sep 7, 2024
b5326dd
fix(prif_allocate_test): .f90->.F90 to preprocess
rouson Sep 8, 2024
7ab646e
test(prif_init): fix test desc in gfortran code
rouson Sep 8, 2024
c3b2279
test(num_images): add refactored passing test
rouson Sep 8, 2024
5faf190
test(this_image): add refactored passing test
rouson Sep 8, 2024
0779145
test(prif_num_images_test): fix typo
rouson Sep 8, 2024
878f0d0
test(prif_allocate): better test subject text
rouson Sep 8, 2024
0be5de7
WIP: add failing error stop test
rouson Sep 8, 2024
094c780
WIP: add failing prif_stop test
rouson Sep 8, 2024
c9cd812
WIP: disable stop/error-stop tests
rouson Sep 8, 2024
dc922bd
test(co_broadcast): add passing test
rouson Sep 8, 2024
e8f92ff
test(prif_num_images): fix typo
rouson Sep 8, 2024
d961d2e
test(prif_co_broadcast): fix typo in gfortran code
rouson Sep 8, 2024
d95ab4a
test(main): run stop/error-stop tests
rouson Sep 8, 2024
027ca56
feat(prif): leverage selected_logical_kind support
rouson Sep 8, 2024
cdf2590
test(teams): add passing test
rouson Sep 8, 2024
05fdb05
WIP: add prif_image_index test - fails with flang
rouson Sep 8, 2024
1ce9151
chore(prif_image_index): whitespace edits
rouson Sep 8, 2024
c560785
WIP: add prif_co_min test - fails with flang
rouson Sep 8, 2024
a0c9812
WIP: add prif_com_ax test - fails with flang
rouson Sep 8, 2024
c60ab05
Apply suggestions from code review
rouson Sep 8, 2024
b09efc5
build(preprocess): define feature-macro values
rouson Sep 8, 2024
fc31b13
fix(prif): .f90 -> .F90 for preprocessing
rouson Sep 8, 2024
abb3c55
Revert "build(preprocess): define feature-macro values"
rouson Sep 8, 2024
d8dc653
Revert "Apply suggestions from code review "
rouson Sep 8, 2024
4007eb7
chore(include): language feature macros in 1 file
rouson Sep 8, 2024
83d73e4
chore(language-support): rm unused macro
rouson Sep 8, 2024
4239bc2
chore(prif.F90): reversing mistaken rename
rouson Sep 8, 2024
6689839
chore(prif): extension rename (retrying)
rouson Sep 8, 2024
e384e2e
build(include): rm indents to support gfortran
rouson Sep 8, 2024
0350e69
build: fix preprocessor macros
rouson Sep 8, 2024
519c707
test(co_m{in,ax}): fix gfortran workaround blocks
rouson Sep 9, 2024
e555dc8
WIP: add co_reduce test - fails with flang
rouson Sep 9, 2024
36d6213
WIP: add prif_co_sum test - fails with flang
rouson Sep 9, 2024
6466fb5
refac(test/main): reorganize declarations
rouson Sep 9, 2024
a746520
WIP: add prif_rma test -- fails with flang
rouson Sep 9, 2024
80796fd
fix(test/main): call caffeine for error termination
rouson Sep 10, 2024
0c74e9d
fix(error_stop_test): add cmdstatus arg
rouson Sep 11, 2024
1a7f302
WIP: one prif_stop test now passes.
rouson Sep 11, 2024
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
9 changes: 9 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,21 @@ EOF

exit_if_pkg_config_pc_file_missing "caffeine"

compiler_version=$($FPM_FC --version)
if [[ $compiler_version == *llvm* ]]; then
compiler_flag="-mmlir -allow-assumed-rank -g -Ofast"
else
compiler_flag="-g -O3"
fi

RUN_FPM_SH="build/run-fpm.sh"
cat << EOF > $RUN_FPM_SH
#!/bin/sh
#-- DO NOT EDIT -- created by caffeine/install.sh
fpm_sub_cmd=\$1; shift
"${FPM}" "\$fpm_sub_cmd" \\
--profile debug \\
--flag "$compiler_flag" \\
--compiler "`$PKG_CONFIG caffeine --variable=CAFFEINE_FPM_FC`" \\
--c-compiler "`$PKG_CONFIG caffeine --variable=CAFFEINE_FPM_CC`" \\
--c-flag "`$PKG_CONFIG caffeine --variable=CAFFEINE_FPM_CFLAGS`" \\
Expand Down
3 changes: 1 addition & 2 deletions manifest/fpm.toml.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ maintainer = "rouson@lbl.gov"
copyright = "2021-2024 UC Regents"

[dev-dependencies]
veggies = {git = "https://gitlab.com/everythingfunctional/veggies", tag = "v1.1.2"}
iso_varying_string = {git = "https://gitlab.com/everythingfunctional/iso_varying_string.git", tag = "v3.0.4"}
julienne = {git = "https://github.com/berkeleylab/julienne", tag = "1.3.0"}

[build]
22 changes: 10 additions & 12 deletions src/caffeine/collective_subroutines/co_reduce_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -259,28 +259,26 @@ subroutine Coll_ReduceSub_c_char(arg1, arg2_and_out, count, cdata) bind(C)
integer(c_size_t), value :: count !! Operand count
type(c_ptr), value :: cdata !! Client data

character(kind=c_char, len=:), allocatable, target :: prototype(:)
character(kind=c_char, len=:), pointer :: lhs(:)=>null(), rhs_and_result(:)=>null()
integer(c_int), pointer :: arglen=>null()

associate(c_associated_args => [c_associated(arg1), c_associated(arg2_and_out), c_associated(cdata)])
call assert(all(c_associated_args), "Coll_ReduceSub_c_char: all(c_associated_args)")
end associate

call c_f_pointer(cdata, arglen)
allocate(character(kind=c_char, len=arglen) :: prototype(count))
lhs => prototype ! set string length
rhs_and_result => prototype ! set string length
block
character(kind=c_char, len=arglen), pointer :: lhs(:)=>null(), rhs_and_result(:)=>null()

call c_f_pointer(arg1, lhs, [count])
call c_f_pointer(arg2_and_out, rhs_and_result, [count])
call c_f_pointer(arg1, lhs, [count])
call c_f_pointer(arg2_and_out, rhs_and_result, [count])

block
integer(c_size_t) i
block
integer(c_size_t) i

do i=1, count
rhs_and_result(i) = char_op(lhs(i), rhs_and_result(i))
end do
do i=1, count
rhs_and_result(i) = char_op(lhs(i), rhs_and_result(i))
end do
end block
end block

end subroutine
Expand Down
6 changes: 3 additions & 3 deletions src/caffeine/program_termination_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ subroutine prif_stop_integer(stop_code)
!! synchronize, stop the executing image, and provide the stop_code, or 0 if not present, as the process exit status
integer, intent(in), optional :: stop_code

sync all
call prif_sync_all()

!write(output_unit, *) "caf_stop: stop code '", stop_code, "'"
write(output_unit, *) stop_code
Expand All @@ -39,7 +39,7 @@ subroutine prif_stop_character(stop_code)
!! synchronize, stop the executing image, and provide the stop_code as the process exit status
character(len=*), intent(in) :: stop_code

sync all
call prif_sync_all()

write(output_unit, *) "caf_stop: stop code '" // stop_code // "'"
flush output_unit
Expand Down Expand Up @@ -145,7 +145,7 @@ pure function c_f_string(c_string, length) result(f_string)
character(len=length) :: f_string

integer :: i
do concurrent (i = 1:length)
do i = 1,length
f_string(i:i) = c_string(i)
end do
end function
Expand Down
14 changes: 10 additions & 4 deletions src/prif.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
! Copyright (c), The Regents of the University of California
! Terms of use are as specified in LICENSE.txt

#ifndef __GFORTRAN__
#define NO_SELECTED_LOGICAL_KIND
#endif
rouson marked this conversation as resolved.
Show resolved Hide resolved

module prif

use iso_c_binding, only: c_int, c_bool, c_intptr_t, c_intmax_t, c_ptr, c_funptr, c_size_t, c_ptrdiff_t, c_null_ptr
Expand Down Expand Up @@ -42,11 +47,12 @@ module prif
integer(c_int), parameter, public :: PRIF_VERSION_MINOR = 4

integer(c_int), parameter, public :: PRIF_ATOMIC_INT_KIND = selected_int_kind(18)
! gfortran-14 doesn't currently support the intrinsic selected_logical_kind
! The following commented-out definition is the desired definition and should replace
! the temporary definition when possible
! integer(c_int), parameter, public :: PRIF_ATOMIC_LOGICAL_KIND = selected_logical_kind(32)

#ifndef NO_SELECTED_LOGICAL_KIND
integer(c_int), parameter, public :: PRIF_ATOMIC_LOGICAL_KIND = selected_logical_kind(32)
#else
rouson marked this conversation as resolved.
Show resolved Hide resolved
integer(c_int), parameter, public :: PRIF_ATOMIC_LOGICAL_KIND = PRIF_ATOMIC_INT_KIND
#endif

integer(c_int), parameter, public :: &
PRIF_CURRENT_TEAM = 101, &
Expand Down
42 changes: 0 additions & 42 deletions test/a00_caffeinate_test.f90

This file was deleted.

80 changes: 0 additions & 80 deletions test/caf_allocate_test.f90

This file was deleted.

68 changes: 0 additions & 68 deletions test/caf_co_broadcast_test.f90

This file was deleted.

Loading
Loading