diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5dfc5bdfb..8d67e6f91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,13 +107,11 @@ jobs: compiler: flang label: Homebrew brew_via_install: 1 - install_filter: '2>&1 | perl -pe "$LINUXBREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0' - os: ubuntu-26.04-arm label: Homebrew compiler: flang brew_via_install: 1 - install_filter: '2>&1 | perl -pe "$LINUXBREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0' # https://hub.docker.com/r/snowstep/llvm/tags - os: ubuntu-24.04 @@ -197,24 +195,12 @@ jobs: container: ghcr.io/lfortran/lfortran:v0.67.0 # --- PRIF-old coverage --- - - os: ubuntu-24.04 - compiler: flang - version: 21 - label: PRIF-0.5 - FFLAGS: -DFORCE_PRIF_0_5 - container: phhargrove/llvm-flang:21.1.0-latest - - os: ubuntu-24.04 - compiler: flang - version: 21 - label: PRIF-0.6 - FFLAGS: -DFORCE_PRIF_0_6 - container: phhargrove/llvm-flang:21.1.0-latest - - os: ubuntu-24.04 - compiler: flang - version: 21 - label: PRIF-0.7 - FFLAGS: -DFORCE_PRIF_0_7 - container: phhargrove/llvm-flang:21.1.0-latest + # - os: ubuntu-24.04 + # compiler: flang + # version: 23 + # label: PRIF-0.8 + # FFLAGS: -DFORCE_PRIF_0_8 + # container: phhargrove/llvm-flang:23.1.0-latest # --- udp coverage for selected configs --- - os: macos-26 @@ -306,8 +292,10 @@ jobs: GASNET_SPAWNFN: L GASNET_MASTERIP: 127.0.0.1 CAF_IMAGES: 8 - BREW_WARNING_FILTER: 's/^[[:punct:]]*warning[[:punct:]]*(You are using macOS)/warn: \1/i' - LINUXBREW_WARNING_FILTER: 's/^[[:punct:]]*warning[[:punct:]]*(Landlock)/warn: \1/i' + BREW_WARNING_FILTER: 's/^[[:punct:]]+warning[[:punct:]]+/warning: /i' + INSTALL_FILTER: ${{ matrix.brew_via_install && + '2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0' || + '' }} INSTALL_VARS: FC CC CXX FFLAGS CPPFLAGS CFLAGS CXXFLAGS LDFLAGS LIBS GASNET_CONFIGURE_ARGS FPM CMAKE MAKE PKG_CONFIG steps: @@ -357,7 +345,7 @@ jobs: env CI=1 ./install-homebrew.sh HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" retry ${HOMEBREW_PREFIX}/bin/brew install -v gcc@${COMPILER_VERSION} binutils \ - 2>&1 | perl -pe "$LINUXBREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0 + 2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0 ls -al ${HOMEBREW_PREFIX}/bin echo "PATH=${HOMEBREW_PREFIX}/bin:${PATH}" >> "$GITHUB_ENV" : Homebrew GCC@15 needs binutils 2.44+ @@ -373,7 +361,8 @@ jobs: if: ${{ contains(matrix.os, 'macos') && !matrix.macports }} run: | # silence Homebrew tap trust warnings: - (set +e ; brew untap -f aws/tap hashicorp/tap 2>&1 | perl -pe 's/^::*//;s/^##*//' ; brew trust azure/bicep ; echo ) + (set +e ; brew untap -f aws/tap hashicorp/tap ; brew trust azure/bicep ; echo ) \ + 2>&1 | perl -pe "$BREW_WARNING_FILTER" # set some Homebrew knobs to accelerate installation # but only when we are not simulating the user environment brew-via-install workflow if [[ -z "${{ matrix.brew_via_install }}" ]] ; then @@ -390,7 +379,8 @@ jobs: - name: Install macOS Dependencies (Homebrew) if: ${{ contains(matrix.os, 'macos') && !matrix.macports && !matrix.brew_via_install }} run: | - retry brew update + retry brew update \ + 2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0 # fpm binary distribution for macOS requires gfortran shared libraries from gcc@12 retry brew install gcc@12 \ 2>&1 | perl -pe "$BREW_WARNING_FILTER" ; test ${PIPESTATUS[0]} = 0 @@ -567,7 +557,7 @@ jobs: run: | (set +x ; for var in ${{ env.INSTALL_VARS }} ; do eval echo "$var=\$$var"; done) ./install.sh ${CONFIGURE_ARGS} ${NETWORK_ARG} \ - ${{ inputs.install_args }} ${{ matrix.install_filter }} + ${{ inputs.install_args }} ${{ env.INSTALL_FILTER }} if ! grep -q 'NATIVEFLAGS=""' run-fpm.sh ; then echo "NATIVE_MULTI_IMAGE=true" >> "$GITHUB_ENV" fi @@ -655,7 +645,7 @@ jobs: rm -Rf build install/lib/libcaffeine* install/lib/pkgconfig/caffeine* (set +x ; for var in ${{ env.INSTALL_VARS }} ; do eval echo "$var=\$$var"; done) ./install.sh ${CONFIGURE_ARGS} ${NETWORK_ARG} --enable-threads \ - ${{ inputs.install_args }} ${{ matrix.install_filter }} + ${{ inputs.install_args }} ${{ env.INSTALL_FILTER }} ./run-fpm.sh test --verbose -- ${{ inputs.julienne_args }} ./install/bin/ident ./install/lib/libcaffeine.a | tee output test ${PIPESTATUS[0]} = 0 && grep -q "CaffeineAssertions" output @@ -668,7 +658,7 @@ jobs: (set +e ; rm -f $(type -P fpm) ) (set +x ; for var in ${{ env.INSTALL_VARS }} ; do eval echo "$var=\$$var"; done) ./install.sh ${CONFIGURE_ARGS} ${NETWORK_ARG} --enable-cmake \ - ${{ inputs.install_args }} ${{ matrix.install_filter }} + ${{ inputs.install_args }} ${{ env.INSTALL_FILTER }} ./run-fpm.sh info ./install/bin/ident ./install/lib/libcaffeine.a | tee output test ${PIPESTATUS[0]} = 0 && grep -q "CaffeineAssertions" output diff --git a/include/caffeine-version.h b/include/caffeine-version.h index b8ac85169..487f01782 100644 --- a/include/caffeine-version.h +++ b/include/caffeine-version.h @@ -22,11 +22,11 @@ #endif #define CAF_PRIF_VERSION_MAJOR 0 #if FORCE_PRIF_0_5 -# define CAF_PRIF_VERSION_MINOR 5 +# error FORCE_PRIF_0_5 is not supported #elif FORCE_PRIF_0_6 -# define CAF_PRIF_VERSION_MINOR 6 +# error FORCE_PRIF_0_6 is not supported #elif FORCE_PRIF_0_7 -# define CAF_PRIF_VERSION_MINOR 7 +# error FORCE_PRIF_0_7 is not supported #elif FORCE_PRIF_0_8 # define CAF_PRIF_VERSION_MINOR 8 #else diff --git a/src/caffeine/alias_s.F90 b/src/caffeine/alias_s.F90 index 101293bf2..608bc398a 100644 --- a/src/caffeine/alias_s.F90 +++ b/src/caffeine/alias_s.F90 @@ -33,10 +33,8 @@ ! start with a copy of the source descriptor allocate(alias_cdp, source=cdp) -# if CAF_PRIF_VERSION >= 6 - alias_cdp%coarray_data = & - as_c_ptr(as_int(alias_cdp%coarray_data) + data_pointer_offset) -# endif + alias_cdp%coarray_data = & + as_c_ptr(as_int(alias_cdp%coarray_data) + data_pointer_offset) ! apply provided cobounds alias_cdp%corank = corank diff --git a/src/caffeine/allocation_s.F90 b/src/caffeine/allocation_s.F90 index 4b6416b05..e82781be3 100644 --- a/src/caffeine/allocation_s.F90 +++ b/src/caffeine/allocation_s.F90 @@ -17,21 +17,12 @@ contains module subroutine prif_allocate_coarray(lcobounds, ucobounds, size_in_bytes, & -# if CAF_PRIF_VERSION >= 8 - final_proc, & -# else - final_func, & -# endif - coarray_handle, allocated_memory, stat, errmsg, errmsg_alloc) + final_proc, coarray_handle, allocated_memory, stat, errmsg, errmsg_alloc) implicit none ! redundant redeclaration of arguments here is a GCC 13..15 bug workaround: integer(c_int64_t), dimension(:), intent(in) :: lcobounds, ucobounds integer(c_size_t), intent(in) :: size_in_bytes -# if CAF_PRIF_VERSION >= 8 procedure(prif_coarray_cleanup_interface), pointer, intent(in) :: final_proc -# else - type(c_funptr), intent(in) :: final_func -# endif type(prif_coarray_handle), intent(out) :: coarray_handle type(c_ptr), intent(out) :: allocated_memory integer(c_int), intent(out), optional :: stat @@ -94,6 +85,8 @@ module subroutine prif_allocate_coarray(lcobounds, ucobounds, size_in_bytes, & call caf_establish_child_heap end if return + else if (present(stat)) then + stat = 0 end if if (me /= 1) whole_block = as_c_ptr(current_team%info%heap_start + block_offset) @@ -118,15 +111,13 @@ module subroutine prif_allocate_coarray(lcobounds, ucobounds, size_in_bytes, & end block cdp%corank = corank cdp%coarray_size = size_in_bytes -# if CAF_PRIF_VERSION >= 8 - if (associated(final_proc)) then - cdp%final_proc = CAF_C_FUNLOC_PROCPTR(final_proc) - else - cdp%final_proc = c_null_funptr - end if -# else - cdp%final_proc = final_func -# endif + + if (associated(final_proc)) then + cdp%final_proc = CAF_C_FUNLOC_PROCPTR(final_proc) + else + cdp%final_proc = c_null_funptr + end if + cdp%lcobounds(1:corank) = lcobounds cdp%ucobounds(1:corank-1) = ucobounds(1:corank-1) call compute_coshape_epp(lcobounds, ucobounds, cdp%coshape_epp(1:corank)) @@ -161,6 +152,7 @@ module subroutine prif_allocate_coarray(lcobounds, ucobounds, size_in_bytes, & call report_error(PRIF_STAT_OUT_OF_MEMORY, out_of_memory_message(size_in_bytes, .false.), & stat, errmsg, errmsg_alloc) else + if (present(stat)) stat = 0 # if CAF_POISON block ! The allocated memory is uninitialized, but often happens to be zero which can hide problems. @@ -209,33 +201,15 @@ function pad(str) result(s) end function end function -#if CAF_PRIF_VERSION <= 6 - module procedure prif_deallocate_coarray -#else module procedure prif_deallocate_coarray call prif_deallocate_coarrays([coarray_handle], stat, errmsg, errmsg_alloc) end procedure + module procedure prif_deallocate_coarrays -#endif integer :: i, num_handles type(prif_coarray_handle), target :: coarray_handle type(prif_coarray_descriptor), pointer :: cdp -# if CAF_PRIF_VERSION >= 8 - procedure(prif_coarray_cleanup_interface), pointer :: coarray_cleanup -# else - abstract interface - subroutine coarray_cleanup_i(handle, stat, errmsg) bind(C) - import c_char, c_int, prif_coarray_handle - implicit none - type(prif_coarray_handle), pointer, intent(in) :: handle - integer(c_int), intent(out) :: stat - character(kind=c_char,len=:), intent(out), allocatable :: errmsg - end subroutine - end interface - procedure(coarray_cleanup_i), pointer :: coarray_cleanup - integer(c_int) :: local_stat - character(len=:), allocatable :: local_errmsg -# endif + procedure(prif_coarray_cleanup_interface), pointer :: coarray_cleanup call_assert(prif_init_called_previously) call prif_sync_all ! Need to ensure we don't deallocate anything till everyone gets here @@ -254,20 +228,7 @@ subroutine coarray_cleanup_i(handle, stat, errmsg) bind(C) cdp => handle_to_cdp(coarray_handle) if (c_associated(cdp%final_proc)) then call c_f_procpointer(cdp%final_proc, coarray_cleanup) -# if CAF_PRIF_VERSION >= 8 call coarray_cleanup(coarray_handle) -# else - call coarray_cleanup(coarray_handle, local_stat, local_errmsg) - call prif_co_max(local_stat) ! Need to be sure it didn't fail on any images - if (local_stat /= 0) then - if (.not. allocated(local_errmsg)) then ! provide a default errmsg - local_errmsg = "coarray_cleanup finalization callback failed" - end if - call report_error(local_stat, local_errmsg, & - stat, errmsg, errmsg_alloc) - return ! NOTE: We no longer have guarantees that coarrays are in consistent state - end if -# endif end if end do diff --git a/src/caffeine/sync_stmt_s.F90 b/src/caffeine/sync_stmt_s.F90 index 7feb0409b..7d0fcca39 100644 --- a/src/caffeine/sync_stmt_s.F90 +++ b/src/caffeine/sync_stmt_s.F90 @@ -41,12 +41,8 @@ ! ALLOCATE( si_evt(NUM_IMAGES()) ) type(prif_event_type) :: dummy_event type(c_ptr) :: allocated_memory -# if CAF_PRIF_VERSION >= 8 - procedure(prif_coarray_cleanup_interface), pointer :: null_final_proc - null_final_proc => NULL() -# else - type(c_funptr), parameter :: null_final_proc = c_null_funptr -# endif + procedure(prif_coarray_cleanup_interface), pointer :: null_final_proc + null_final_proc => NULL() associate(num_imgs => initial_team%num_images) diff --git a/src/caffeine/teams_s.F90 b/src/caffeine/teams_s.F90 index 2f1d6a7b5..aa203e0b2 100644 --- a/src/caffeine/teams_s.F90 +++ b/src/caffeine/teams_s.F90 @@ -63,12 +63,7 @@ call c_f_pointer(cdp%next_handle, cdp) end do teams_coarrays(num_coarrays_in_team)%info = c_loc(cdp) -#if CAF_PRIF_VERSION <= 6 - call prif_deallocate_coarray & -#else - call prif_deallocate_coarrays & -#endif - (teams_coarrays, stat, errmsg, errmsg_alloc) + call prif_deallocate_coarrays(teams_coarrays, stat, errmsg, errmsg_alloc) nullify(current_team%info%coarrays) else ! child team sync required by F23 11.1.5.2, diff --git a/src/caffeine/unit_test_parameters_m.F90 b/src/caffeine/unit_test_parameters_m.F90 index 4fc73a5aa..d8a0e8a13 100644 --- a/src/caffeine/unit_test_parameters_m.F90 +++ b/src/caffeine/unit_test_parameters_m.F90 @@ -6,9 +6,7 @@ module unit_test_parameters_m use, intrinsic :: iso_c_binding, only: c_int, c_funptr, c_null_funptr use prif, only: prif_sync_all, prif_this_image_no_coarray -#if CAF_PRIF_VERSION >= 8 use prif, only: prif_coarray_cleanup_interface -#endif !! Define values and utilities for consistent use throughout the test suite implicit none @@ -20,21 +18,15 @@ module unit_test_parameters_m character(len=:), allocatable :: subjob_prefix character(len=:), allocatable :: fpm_driver -#if CAF_PRIF_VERSION >= 8 procedure(prif_coarray_cleanup_interface), pointer :: null_final_proc => NULL() -#else - type(c_funptr) :: null_final_proc = c_null_funptr -#endif contains -#if CAF_PRIF_VERSION >= 8 function final_proc_usher(fp) result(res) procedure(prif_coarray_cleanup_interface) :: fp procedure(prif_coarray_cleanup_interface), pointer :: res res => fp end function -#endif ! Retrieve an environment parameter or its default value subroutine getenv_withdefault(key, default, result) diff --git a/src/prif.F90 b/src/prif.F90 index 87e3b23c3..15360021e 100644 --- a/src/prif.F90 +++ b/src/prif.F90 @@ -36,14 +36,8 @@ module prif public :: prif_register_stop_callback, prif_stop_callback_interface public :: prif_stop, prif_error_stop, prif_fail_image public :: prif_allocate_coarray, prif_allocate, prif_deallocate -#if CAF_PRIF_VERSION >= 8 public :: prif_coarray_cleanup_interface -#endif -#if CAF_PRIF_VERSION <= 6 - public :: prif_deallocate_coarray -#else public :: prif_deallocate_coarray, prif_deallocate_coarrays -#endif public :: prif_put, prif_put_indirect, prif_get, prif_get_indirect, prif_put_with_notify, prif_put_with_notify_indirect public :: prif_put_indirect_with_notify, prif_put_indirect_with_notify_indirect public :: prif_get_strided, prif_get_strided_indirect, prif_put_strided, prif_put_strided_indirect @@ -180,13 +174,11 @@ subroutine prif_operation_wrapper_interface(arg1, arg2_and_out, count, cdata) bi type(c_ptr), intent(in), value :: cdata end subroutine -# if CAF_PRIF_VERSION >= 8 subroutine prif_coarray_cleanup_interface(handle) bind(C) import :: prif_coarray_handle implicit none type(prif_coarray_handle), value, intent(in) :: handle end subroutine -# endif end interface interface @@ -220,21 +212,12 @@ module subroutine prif_fail_image() end subroutine module subroutine prif_allocate_coarray( & - lcobounds, ucobounds, size_in_bytes, & -# if CAF_PRIF_VERSION >= 8 - final_proc, & -# else - final_func, & -# endif + lcobounds, ucobounds, size_in_bytes, final_proc, & coarray_handle, allocated_memory, stat, errmsg, errmsg_alloc) implicit none integer(c_int64_t), dimension(:), intent(in) :: lcobounds, ucobounds integer(c_size_t), intent(in) :: size_in_bytes -# if CAF_PRIF_VERSION >= 8 procedure(prif_coarray_cleanup_interface), pointer, intent(in) :: final_proc -# else - type(c_funptr), intent(in) :: final_func -# endif type(prif_coarray_handle), intent(out) :: coarray_handle type(c_ptr), intent(out) :: allocated_memory integer(c_int), intent(out), optional :: stat @@ -251,15 +234,6 @@ module subroutine prif_allocate(size_in_bytes, allocated_memory, stat, errmsg, e character(len=:), intent(inout), allocatable, optional :: errmsg_alloc end subroutine -#if CAF_PRIF_VERSION <= 6 - module subroutine prif_deallocate_coarray(coarray_handles, stat, errmsg, errmsg_alloc) - implicit none - type(prif_coarray_handle), intent(in) :: coarray_handles(:) - integer(c_int), intent(out), optional :: stat - character(len=*), intent(inout), optional :: errmsg - character(len=:), intent(inout), allocatable, optional :: errmsg_alloc - end subroutine -#else module subroutine prif_deallocate_coarray(coarray_handle, stat, errmsg, errmsg_alloc) implicit none type(prif_coarray_handle), intent(in) :: coarray_handle @@ -267,6 +241,7 @@ module subroutine prif_deallocate_coarray(coarray_handle, stat, errmsg, errmsg_a character(len=*), intent(inout), optional :: errmsg character(len=:), intent(inout), allocatable, optional :: errmsg_alloc end subroutine + module subroutine prif_deallocate_coarrays(coarray_handles, stat, errmsg, errmsg_alloc) implicit none type(prif_coarray_handle), intent(in) :: coarray_handles(:) @@ -274,7 +249,6 @@ module subroutine prif_deallocate_coarrays(coarray_handles, stat, errmsg, errmsg character(len=*), intent(inout), optional :: errmsg character(len=:), intent(inout), allocatable, optional :: errmsg_alloc end subroutine -#endif module subroutine prif_deallocate(mem, stat, errmsg, errmsg_alloc) implicit none @@ -530,17 +504,12 @@ module subroutine prif_put_strided_indirect_with_notify_indirect( & end subroutine module subroutine prif_alias_create(source_handle, alias_lcobounds, alias_ucobounds, & -# if CAF_PRIF_VERSION >= 6 - data_pointer_offset, & -# endif - alias_handle) + data_pointer_offset, alias_handle) implicit none type(prif_coarray_handle), intent(in) :: source_handle integer(c_int64_t), intent(in) :: alias_lcobounds(:) integer(c_int64_t), intent(in) :: alias_ucobounds(:) -# if CAF_PRIF_VERSION >= 6 integer(c_size_t), intent(in) :: data_pointer_offset -# endif type(prif_coarray_handle), intent(out) :: alias_handle end subroutine diff --git a/test/prif_allocate_test.F90 b/test/prif_allocate_test.F90 index e65e27c5c..611a6d46e 100644 --- a/test/prif_allocate_test.F90 +++ b/test/prif_allocate_test.F90 @@ -27,19 +27,13 @@ module prif_allocate_test_m integer(kind=c_int), bind(c), target :: ff_count type(prif_coarray_handle) :: ff_handle type(test_diagnosis_t) :: ff_diag -#if CAF_PRIF_VERSION < 8 - logical :: ff_force_fail = .false. - character(len=*), parameter :: ff_err = "test error message" -#endif -#if CAF_PRIF_VERSION >= 8 interface subroutine coarray_cleanup_simple_c(handle) bind(C) import prif_coarray_handle type(prif_coarray_handle), value, intent(in) :: handle end subroutine end interface -#endif contains @@ -78,6 +72,7 @@ function check_allocate_integer_scalar_coarray_with_corank1() result(diag) type(c_ptr) :: allocated_memory integer, pointer :: local_slice integer(c_size_t) :: data_size, query_size + integer(c_int) :: stat diag = .true. @@ -86,10 +81,11 @@ function check_allocate_integer_scalar_coarray_with_corank1() result(diag) ALSO(.not. associated(local_slice)) data_size = storage_size(dummy_element)/8 + stat = -111 call prif_allocate_coarray( & [integer(c_int64_t) :: 1], [integer(c_int64_t) :: ], data_size, null_final_proc, & - coarray_handle, allocated_memory) - + coarray_handle, allocated_memory, stat) + ALSO(stat .equalsExpected. 0) call c_f_pointer(allocated_memory, local_slice) ALSO(associated(local_slice)) @@ -111,7 +107,9 @@ function check_allocate_integer_scalar_coarray_with_corank1() result(diag) end do end block - call prif_deallocate_coarray(coarray_handle) + stat = -222 + call prif_deallocate_coarray(coarray_handle, stat) + ALSO(stat .equalsExpected. 0) end function @@ -145,7 +143,6 @@ function check_final_proc() result(retdiag) call prif_deallocate_coarray(ff_handle) ALSO(ff_count .equalsExpected. 1) -# if CAF_PRIF_VERSION >= 8 ! final_proc written in C call prif_allocate_coarray( & [integer(c_int64_t) :: 1], [integer(c_int64_t) :: ], & @@ -163,86 +160,17 @@ function check_final_proc() result(retdiag) call prif_deallocate_coarray(ff_handle) ALSO(ff_count .equalsExpected. 3) -# else - block - integer(c_int) :: stat - character(len=len(ff_err)) :: errmsg - character(len=:), allocatable :: errmsg_alloc - - ! CAF_PRIF_VERSION < 8 - ! final_func that errors on first three deallocations - ff_count = 0 - call prif_allocate_coarray( & - [integer(c_int64_t) :: 1], [integer(c_int64_t) :: ], & - data_size, final_proc(coarray_cleanup_first_error), & - ff_handle, allocated_memory) - ALSO(ff_count .equalsExpected. 0) - - call prif_deallocate_coarray3(ff_handle, stat, errmsg=errmsg) - ALSO(ff_count .equalsExpected. 1) - ALSO(stat .equalsExpected. 10) - ALSO(errmsg .equalsExpected. ff_err) - - call prif_deallocate_coarrays3([ff_handle], stat, errmsg_alloc=errmsg_alloc) - ALSO(ff_count .equalsExpected. 2) - ALSO(stat .equalsExpected. 20) - ALSO(errmsg_alloc .equalsExpected. ff_err) - deallocate(errmsg_alloc) - - if (me == num_imgs) then ! test non-single-valued failure - ff_force_fail = .true. - end if - call prif_deallocate_coarray3(ff_handle, stat, errmsg_alloc=errmsg_alloc) - ALSO(ff_count .equalsExpected. 3) - ALSO(stat .equalsExpected. 30) - ALSO(errmsg_alloc .equalsExpected. ff_err) - deallocate(errmsg_alloc) - ff_force_fail = .false. - - call prif_deallocate_coarray3(ff_handle, stat, errmsg_alloc=errmsg_alloc) - ALSO(ff_count .equalsExpected. 4) - ALSO(stat .equalsExpected. 0) - ALSO(.not. allocated(errmsg_alloc)) - end block -# endif retdiag = diag end function -#if CAF_PRIF_VERSION < 8 - subroutine coarray_cleanup_simple(handle , stat, errmsg) bind(C) - type(prif_coarray_handle), pointer, intent(in) :: handle - integer(c_int), intent(out) :: stat - character(kind=c_char,len=:), intent(out), allocatable :: errmsg -#else subroutine coarray_cleanup_simple(handle) bind(C) type(prif_coarray_handle), value, intent(in) :: handle -#endif ALSO(assert_aliased(handle, ff_handle)) ff_count = ff_count + 1 -# if CAF_PRIF_VERSION < 8 - stat = 0 -# endif end subroutine -#if CAF_PRIF_VERSION < 8 - subroutine coarray_cleanup_first_error(handle , stat, errmsg) bind(C) - type(prif_coarray_handle), pointer, intent(in) :: handle - integer(c_int), intent(out) :: stat - character(kind=c_char,len=:), intent(out), allocatable :: errmsg - - ALSO(assert_aliased(handle, ff_handle)) - - ff_count = ff_count + 1 - errmsg = ff_err - if (ff_count <= 2 .or. ff_force_fail) then - stat = 10 * ff_count - else - stat = 0 - end if - end subroutine -#endif # undef diag function check_allocate_non_symmetric() result(diag) @@ -250,14 +178,21 @@ function check_allocate_non_symmetric() result(diag) type(c_ptr) :: allocated_memory integer(c_int), pointer :: local_slice + integer(c_int) :: stat + + diag = .true. - call prif_allocate(c_sizeof(local_slice), allocated_memory) + stat = -111 + call prif_allocate(c_sizeof(local_slice), allocated_memory, stat) + ALSO(stat .equalsExpected. 0) call c_f_pointer(allocated_memory, local_slice) local_slice = 42 - diag = local_slice .equalsExpected. 42 + ALSO(local_slice .equalsExpected. 42) - call prif_deallocate(c_loc(local_slice)) + stat = -222 + call prif_deallocate(c_loc(local_slice), stat) + ALSO(stat .equalsExpected. 0) end function ! returns (p + off) @@ -365,37 +300,30 @@ function check_allocate_integer_array_coarray_with_corank2() result(diag) end block block ! check aliasing creation -# if CAF_PRIF_VERSION <= 5 -# define data_pointer_offset -# else -# define data_pointer_offset 0_c_size_t, -# endif integer i, j integer, parameter :: lim = 10 type(prif_coarray_handle) :: a(lim) a(1) = coarray_handle do i=2, lim call prif_alias_create(a(i-1), [integer(c_int64_t) :: i-5], [integer(c_int64_t) :: i-5 + num_imgs], & - data_pointer_offset a(i)) + 0_c_size_t, a(i)) ALSO(assert_aliased(a(i-1), a(i))) do j = i+1,lim call prif_alias_create(a(i), [integer(c_int64_t) :: i, j-5], [integer(c_int64_t) :: j], & - data_pointer_offset a(j)) + 0_c_size_t, a(j)) ALSO(assert_aliased(a(i), a(j))) ALSO(assert_aliased(a(j), coarray_handle)) end do -# if CAF_PRIF_VERSION >= 6 - ! test PRIF 0.6 data_pointer_offset - block - type(prif_coarray_handle) :: b - integer(c_size_t) :: off - off = i - call prif_alias_create(a(i), [integer(c_int64_t) :: i], [integer(c_int64_t) :: ], & - off, b) - ALSO(assert_aliased(a(i), b, off)) - call prif_alias_destroy(b) - end block -# endif + ! test PRIF data_pointer_offset + block + type(prif_coarray_handle) :: b + integer(c_size_t) :: off + off = i + call prif_alias_create(a(i), [integer(c_int64_t) :: i], [integer(c_int64_t) :: ], & + off, b) + ALSO(assert_aliased(a(i), b, off)) + call prif_alias_destroy(b) + end block do j = i+1,lim call prif_alias_destroy(a(j)) end do diff --git a/test/prif_teams_test.F90 b/test/prif_teams_test.F90 index 997343438..040d5560f 100644 --- a/test/prif_teams_test.F90 +++ b/test/prif_teams_test.F90 @@ -240,21 +240,10 @@ function check_teams() result(diag) end function -# if CAF_PRIF_VERSION < 8 - subroutine coarray_cleanup(handle, stat, errmsg) bind(C) - type(prif_coarray_handle), value, intent(in) :: handle - integer(c_int), intent(out) :: stat - character(kind=c_char, len=:), intent(out), allocatable :: errmsg - - cleanup_count = cleanup_count + 1 - stat = 0 - end subroutine -# else subroutine coarray_cleanup(handle) bind(C) type(prif_coarray_handle), value, intent(in) :: handle cleanup_count = cleanup_count + 1 end subroutine -# endif end module prif_teams_test_m diff --git a/test/test-uses-alloc.F90 b/test/test-uses-alloc.F90 index 12dcd301d..a83ae7541 100644 --- a/test/test-uses-alloc.F90 +++ b/test/test-uses-alloc.F90 @@ -10,34 +10,18 @@ use prif, only : & prif_allocate_coarray, & + prif_deallocate_coarray, prif_deallocate_coarrays, & prif_allocate, prif_deallocate, & prif_coarray_handle -#if !defined(CAF_PRIF_VERSION) || CAF_PRIF_VERSION >= 7 - ! PRIF 0.7+ deallocate - use prif, only : prif_deallocate_coarray, prif_deallocate_coarrays -# define prif_deallocate_coarray3 prif_deallocate_coarray -# define prif_deallocate_coarrays3 prif_deallocate_coarrays -#else - ! emulate PRIF 0.7 deallocate with older interfaces - use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray -# define prif_deallocate_coarray(h) prif_deallocate_coarray_([h]) -# define prif_deallocate_coarrays(arr) prif_deallocate_coarray_(arr) -# define prif_deallocate_coarray3(h,a2,a3) prif_deallocate_coarray_([h],a2,a3) -# define prif_deallocate_coarrays3(arr,a2,a3) prif_deallocate_coarray_(arr,a2,a3) -#endif ! final func support use unit_test_parameters_m, only: null_final_proc -#if !defined(CAF_PRIF_VERSION) || CAF_PRIF_VERSION >= 8 use unit_test_parameters_m, only: final_proc_usher -# if HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY -# define final_proc(proc) proc -# else -# define final_proc(proc) final_proc_usher(proc) -# endif +#if HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY +# define final_proc(proc) proc #else -# define final_proc(proc) c_funloc(proc) +# define final_proc(proc) final_proc_usher(proc) #endif use, intrinsic :: iso_c_binding, only: &