From 827b6921c7a5ca63d1df2a4667ea6bf82d68c09c Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Mon, 3 Aug 2026 09:43:47 -0700 Subject: [PATCH 01/21] Restore use of Ubuntu-24 flang-latest container This reverts 1952d8c7afdce2c47713bbfeb38444194064a049 --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a10351a3..4c9d74c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -108,8 +108,8 @@ jobs: - os: ubuntu-24.04 compiler: flang version: latest - #container: snowstep/llvm:ubuntu-24.04-latest - container: snowstep/llvm:debian-12-latest + container: snowstep/llvm:ubuntu-24.04-latest + #container: snowstep/llvm:debian-12-latest # https://hub.docker.com/r/phhargrove/llvm-flang/tags - os: ubuntu-24.04 @@ -238,8 +238,8 @@ jobs: compiler: flang version: latest network: udp - #container: snowstep/llvm:ubuntu-24.04-latest - container: snowstep/llvm:debian-12-latest + container: snowstep/llvm:ubuntu-24.04-latest + #container: snowstep/llvm:debian-12-latest container: image: ${{ matrix.container }} From 743114481bd7e2076a096eac3b56550797bc0870 Mon Sep 17 00:00:00 2001 From: bonachea Date: Wed, 29 Jul 2026 16:23:20 -0400 Subject: [PATCH 02/21] native-multi-image: Adjust testing for allocatable coarrays Add testing of allocatable coarrays in the main program Add new HAVE_ALLOC_COARRAY_CLEANUP flag to control auto-deallocation of allocatable coarrays at scope exit Add new HAVE_ALLOC_COARRAY_DEALLOC flag to control explicit deallocation of allocatable coarrays Factor old CHECK_ALLOC macro into more generic CHECK_VALL macro Update CI settings accordingly --- .github/workflows/build.yml | 6 +-- app/native-multi-image.F90 | 85 +++++++++++++++++++++++++++---------- 2 files changed, 65 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c9d74c1..e12032c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,7 +142,7 @@ jobs: version: latest container: ghcr.io/lfortran/lfortran:latest native_multi_image: true - FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_TEAM_TYPE -DHAVE_FORM_TEAM -DHAVE_SYNC_TEAM -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_EVENT=0 -DHAVE_LOCK_TYPE=0 -DHAVE_NOTIFY_TYPE=0 + FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_TEAM_TYPE -DHAVE_FORM_TEAM -DHAVE_SYNC_TEAM -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_EVENT=0 -DHAVE_LOCK_TYPE=0 -DHAVE_NOTIFY_TYPE=0 - os: ubuntu-22.04 compiler: lfortran @@ -361,9 +361,9 @@ jobs: fi if [ "${NATIVE_MULTI_IMAGE}" == true ] ; then if [[ $COMPILER_VERSION == latest ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" elif [[ $COMPILER_VERSION == 23 ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" else # $COMPILER_VERSION == 22 echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=8" >> "$GITHUB_ENV" fi diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index 0888efa3..95b3a171 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -68,6 +68,12 @@ #ifndef HAVE_ALLOC_COARRAY #define HAVE_ALLOC_COARRAY HAVE_COARRAY #endif +#ifndef HAVE_ALLOC_COARRAY_DEALLOC +#define HAVE_ALLOC_COARRAY_DEALLOC HAVE_ALLOC_COARRAY +#endif +#ifndef HAVE_ALLOC_COARRAY_CLEANUP +#define HAVE_ALLOC_COARRAY_CLEANUP HAVE_ALLOC_COARRAY +#endif #ifndef HAVE_SAVE_COARRAY #define HAVE_SAVE_COARRAY HAVE_COARRAY #endif @@ -145,6 +151,17 @@ fail_count = fail_count + 1 ; \ end if ; \ END BLOCK +#define CHECK_VALL(expr, expect) \ + BLOCK ; \ + use helpers ; \ + logical :: cvl_tmp ; \ + cvl_tmp = (expr) ; \ + if (cvl_tmp .neqv. (expect)) then ; \ + if (THIS_IMAGE() == 1) write(*,'(A,L)') __FILE__//":"//tostring(__LINE__)//": ERROR: " // \ + #expr // " = ", cvl_tmp ; \ + fail_count = fail_count + 1 ; \ + end if ; \ + END BLOCK #define COARRAY_INT_INIT_VALUE 123456789 #if HAVE_COARRAY_INIT @@ -290,6 +307,11 @@ program native_multi_image integer :: sca_int_2[2,*] COARRAY_INT_INIT integer :: sca_int_3[2,3,*] COARRAY_INT_INIT # endif +# if HAVE_ALLOC_COARRAY + integer, allocatable :: aca_int_1[:] + integer, allocatable :: aca_int_2[:,:] + integer, allocatable :: aca_int_3[:,:,:] +# endif # if HAVE_EVENT_TYPE type(event_type), target :: default_event[*] type(event_type) :: test_event[*] @@ -510,6 +532,36 @@ program native_multi_image CHECK_TYPE_COMPLIANCE(NOTIFY_TYPE, default_notify, .false., 64) # endif +# if HAVE_ALLOC_COARRAY + call status("Testing coarray allocation...") + CHECK_VALL(ALLOCATED(aca_int_1), .false.) + CHECK_VALL(ALLOCATED(aca_int_2), .false.) + CHECK_VALL(ALLOCATED(aca_int_3), .false.) + + allocate(aca_int_1[*]) + CHECK_VALL(ALLOCATED(aca_int_1), .true.) + +# if !__LFORTRAN__ + ! corank > 1 currently broken: lfortran#12370 + ! trailing lcobound not yet supported: lfortran#12371 + allocate(aca_int_2[10:11,*], aca_int_3[100:101,200:202,*]) + CHECK_VALL(ALLOCATED(aca_int_2), .true.) + CHECK_VALL(ALLOCATED(aca_int_3), .true.) +# endif + +# if HAVE_ALLOC_COARRAY_DEALLOC + call status("Testing coarray deallocation...") + deallocate(aca_int_1) + CHECK_VALL(ALLOCATED(aca_int_1), .false.) + +# if !__LFORTRAN__ + deallocate(aca_int_2, aca_int_3) + CHECK_VALL(ALLOCATED(aca_int_2), .false.) + CHECK_VALL(ALLOCATED(aca_int_3), .false.) +# endif +# endif +# endif + call sync_all call test_allocatable_coarray call test_allocatable_coarray @@ -545,43 +597,30 @@ program native_multi_image contains subroutine test_allocatable_coarray() -# if HAVE_ALLOC_COARRAY -# define CHECK_ALLOC(coarray, expect) \ - BLOCK ; \ - logical :: ca_a, ca_e ; \ - ca_a = ALLOCATED(coarray) ; \ - ca_e = (expect) ; \ - if (ca_a .neqv. ca_e) then ; \ - if (THIS_IMAGE() == 1) write(*,'(A)') __FILE__//":"//tostring(__LINE__)//": ERROR: " // \ - " ALLOCATED(" // #coarray // ") = " // MERGE("true ","false",ca_a) // \ - ", expected = " // MERGE("true ","false",ca_e) ; \ - fail_count = fail_count + 1 ; \ - end if ; \ - END BLOCK - +# if HAVE_ALLOC_COARRAY_CLEANUP implicit none logical, volatile, save :: once = .true. ! volatile is workaround for flang optimizer bug integer, allocatable :: aca_int_1[:] integer, allocatable :: aca_int_2[:,:] integer, save, allocatable :: aca_int_3[:,:,:] if (once) then - call status("Testing ALLOCATABLE coarrays...") + call status("Testing ALLOCATABLE coarray cleanup...") end if -# if VERBOSE +# if VERBOSE if (THIS_IMAGE() == 1) & write (*,*) once, "ENTRY:", ALLOCATED(aca_int_1), ALLOCATED(aca_int_2), ALLOCATED(aca_int_3) -# endif - CHECK_ALLOC(aca_int_1, .false.) - CHECK_ALLOC(aca_int_2, .false.) - CHECK_ALLOC(aca_int_3, .not. once) +# endif + CHECK_VALL(ALLOCATED(aca_int_1), .false.) + CHECK_VALL(ALLOCATED(aca_int_2), .false.) + CHECK_VALL(ALLOCATED(aca_int_3), .not. once) if (once) then ALLOCATE(aca_int_1[*]) ALLOCATE(aca_int_2[2,*]) ALLOCATE(aca_int_3[2,3,*]) - CHECK_ALLOC(aca_int_1, .true.) - CHECK_ALLOC(aca_int_2, .true.) - CHECK_ALLOC(aca_int_3, .true.) + CHECK_VALL(ALLOCATED(aca_int_1), .true.) + CHECK_VALL(ALLOCATED(aca_int_2), .true.) + CHECK_VALL(ALLOCATED(aca_int_3), .true.) end if # if VERBOSE if (THIS_IMAGE() == 1) & From 828cf3d17ea17d103a304d04fc6996cde64e3d2e Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sat, 1 Aug 2026 19:40:56 -0700 Subject: [PATCH 03/21] native-multi-image: Add initial coverage for intrinsic array coarrays --- .github/workflows/build.yml | 4 ++-- app/native-multi-image.F90 | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e12032c8..8883fec5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,14 +142,14 @@ jobs: version: latest container: ghcr.io/lfortran/lfortran:latest native_multi_image: true - FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_TEAM_TYPE -DHAVE_FORM_TEAM -DHAVE_SYNC_TEAM -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_EVENT=0 -DHAVE_LOCK_TYPE=0 -DHAVE_NOTIFY_TYPE=0 + FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_TEAM_TYPE -DHAVE_FORM_TEAM -DHAVE_SYNC_TEAM -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK_TYPE=0 -DHAVE_NOTIFY_TYPE=0 - os: ubuntu-22.04 compiler: lfortran version: 0.64 container: ghcr.io/lfortran/lfortran:v0.64.0 native_multi_image: true - FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_EVENT=0 -DHAVE_LOCK_TYPE=0 -DHAVE_NOTIFY_TYPE=0 + FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK_TYPE=0 -DHAVE_NOTIFY_TYPE=0 - os: ubuntu-22.04 compiler: lfortran diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index 95b3a171..186f6d86 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -65,6 +65,9 @@ #ifndef HAVE_MAIN_COARRAY #define HAVE_MAIN_COARRAY HAVE_COARRAY #endif +#ifndef HAVE_MAIN_COARRAY_ARRAY +#define HAVE_MAIN_COARRAY_ARRAY HAVE_COARRAY +#endif #ifndef HAVE_ALLOC_COARRAY #define HAVE_ALLOC_COARRAY HAVE_COARRAY #endif @@ -93,6 +96,9 @@ #ifndef HAVE_PUTGET_INTRINSIC_SCALAR #define HAVE_PUTGET_INTRINSIC_SCALAR HAVE_PUTGET #endif +#ifndef HAVE_PUTGET_INTRINSIC_ARRAY_CONTIG +#define HAVE_PUTGET_INTRINSIC_ARRAY_CONTIG HAVE_PUTGET +#endif ! coarray query intrinsics #ifndef HAVE_COARRAY_QUERY @@ -307,6 +313,11 @@ program native_multi_image integer :: sca_int_2[2,*] COARRAY_INT_INIT integer :: sca_int_3[2,3,*] COARRAY_INT_INIT # endif +# if HAVE_MAIN_COARRAY_ARRAY + integer :: sca_int100_1(100)[*] COARRAY_INT_INIT + integer :: sca_int100_2(100)[2,*] COARRAY_INT_INIT + integer :: sca_int100_3(100)[2,3,*] COARRAY_INT_INIT +# endif # if HAVE_ALLOC_COARRAY integer, allocatable :: aca_int_1[:] integer, allocatable :: aca_int_2[:,:] @@ -498,6 +509,32 @@ program native_multi_image end if # endif # endif +# if HAVE_MAIN_COARRAY_ARRAY +# if HAVE_COARRAY_INIT + call status("Testing main program array coarray initialization...") + CHECK_VALI(sca_int100_1(3), COARRAY_INT_INIT_VALUE) + CHECK_VALI(sca_int100_2(4), COARRAY_INT_INIT_VALUE) + CHECK_VALI(sca_int100_3(5), COARRAY_INT_INIT_VALUE) +# endif +# if HAVE_PUTGET_INTRINSIC_ARRAY_CONTIG + call status("Testing put/get intrinsic array (contiguous)...") + sca_int100_1 = THIS_IMAGE() + call sync_all + ia = sca_int100_1(10:12)[peer] ! get + if (any(ia /= peer)) then + write(*,'(A,3I,A,I3)') "FAIL: get sca_int100_1[peer] = ", ia, " expected = ", peer + fail_count = fail_count + 1 + end if + call sync_all + sca_int100_1(20:22)[peer] = THIS_IMAGE() ! put + call sync_all + ia = sca_int100_1(20:22) + if (any(ia /= peer)) then + write(*,'(A,3I,A,I3)') "FAIL: put to sca_int100_1 = ", ia, " expected = ", peer + fail_count = fail_count + 1 + end if +# endif +# endif # if HAVE_EVENT_TYPE CHECK_TYPE_COMPLIANCE(EVENT_TYPE, default_event, .false., 64) From 47e5e71ea1d4ea33dff4fea1767ad4e3c05b61d9 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 2 Aug 2026 17:01:12 -0700 Subject: [PATCH 04/21] native-multi-image: Fix conformance issues, add standalone support Add NAG stand-alone support to check for non-conforming vendor extensions, and fix a few such issues to ensure strict standards conformance. Add Gfortran stand-alone support, and a Makefile to drive both. Fix a critical barrier mismatch defect in test_module_coarray and test_save_extern_coarray Minor cosmetic cleanups --- .github/workflows/build.yml | 11 ++- app/Makefile | 33 +++++++++ app/native-multi-image.F90 | 139 ++++++++++++++++++++++-------------- 3 files changed, 126 insertions(+), 57 deletions(-) create mode 100644 app/Makefile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8883fec5..31c30c9c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -361,9 +361,9 @@ jobs: fi if [ "${NATIVE_MULTI_IMAGE}" == true ] ; then if [[ $COMPILER_VERSION == latest ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" elif [[ $COMPILER_VERSION == 23 ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" else # $COMPILER_VERSION == 22 echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=8" >> "$GITHUB_ENV" fi @@ -464,7 +464,7 @@ jobs: echo CAF_IMAGES=${CAF_IMAGES} ./run-fpm.sh run --verbose --example hello - - name: Run native multi-image test + - name: Run native multi-image test (with Caffeine) if: ${{ env.NATIVE_MULTI_IMAGE == 'true' }} run: | ./run-fpm.sh run --verbose 2>&1 | tee output @@ -473,6 +473,11 @@ jobs: ! grep -q "IEEE arithmetic exceptions signaled" output fi + - name: Run native multi-image test (stand-alone) + if: ${{ matrix.compiler == 'gfortran' && matrix.version >= '16' }} + run: | + make -C app gcc GFORTRAN=$FC + - name: Run unit tests run: | while (( CAF_IMAGES > 0 )); do diff --git a/app/Makefile b/app/Makefile new file mode 100644 index 00000000..70a2c939 --- /dev/null +++ b/app/Makefile @@ -0,0 +1,33 @@ +# This Makefile is for internal testing use only and not intended for end-users +# To run this test with Caffeine, please execute `./run-fpm.sh run` in the top-level directory + +FLAGS= + +COMMON_FLAGS=-DHAVE_MULTI_IMAGE -DTYPES_PRIF_COMPLIANT=0 + +NAG_FLAGS=$(COMMON_FLAGS) -DHAVE_NOTIFY_TYPE=0 +export NAGFORTRAN_NUM_IMAGES?=4 + +GCC_FLAGS=$(COMMON_FLAGS) -DHAVE_COARRAY -DHAVE_NOTIFY_TYPE=0 -DHAVE_IMAGE_INDEX_TEAM_NUMBER=0 -DHAVE_CO_MIN=0 -DHAVE_CO_MAX=0 +export GFORTRAN_NUM_IMAGES?=4 + +GFORTRAN=gfortran + +all: gcc + +nag: + $(GFORTRAN) -E $(NAG_FLAGS) $(FLAGS) \ + native-multi-image.F90 > native-multi-image.i.F90 + nagfor -coarray native-multi-image.i.F90 -o native-multi-image-nag + rm -f native-multi-image.i.F90 + ./native-multi-image-nag + +gcc: + $(GFORTRAN) -fcoarray=lib $(GCC_FLAGS) $(FLAGS) \ + native-multi-image.F90 -o native-multi-image-gcc -lcaf_shmem + ./native-multi-image-gcc + +clean: + rm -f *.mod *.i.F90 native-multi-image-nag native-multi-image-gcc + +.PHONY: nag gcc clean diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index 186f6d86..80cf13e6 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -35,7 +35,11 @@ #define HAVE_CO_BROADCAST HAVE_COLLECTIVES #endif +! TYPES_PRIF_COMPLIANT: ISO_FORTRAN_ENV multi-image types satisfy PRIF requirements ! TYPES_IMPORT_PRIF: compiler imports the real PRIF definition of ISO_FORTRAN_ENV types +#ifndef TYPES_PRIF_COMPLIANT +#define TYPES_PRIF_COMPLIANT 1 +#endif #ifndef TYPES_IMPORT_PRIF #define TYPES_IMPORT_PRIF 0 #endif @@ -113,6 +117,12 @@ #ifndef HAVE_IMAGE_INDEX #define HAVE_IMAGE_INDEX HAVE_COARRAY_QUERY #endif +#ifndef HAVE_IMAGE_INDEX_TEAM +#define HAVE_IMAGE_INDEX_TEAM HAVE_IMAGE_INDEX +#endif +#ifndef HAVE_IMAGE_INDEX_TEAM_NUMBER +#define HAVE_IMAGE_INDEX_TEAM_NUMBER HAVE_IMAGE_INDEX +#endif #ifndef HAVE_THIS_IMAGE_COARRAY #define HAVE_THIS_IMAGE_COARRAY HAVE_COARRAY_QUERY #endif @@ -139,32 +149,45 @@ #endif ! Helper macros +#ifndef CPP_STRINGIFY_SOURCE +# if defined(__GFORTRAN__) || defined(_CRAYFTN) || defined(NAGFOR) +# define CPP_STRINGIFY_SOURCE(x) "x" +# else +# define CPP_STRINGIFY_SOURCE(x) #x +# endif +#endif +#define STATUS(msg_expr) \ + BLOCK ; \ + character(len=:), allocatable :: stat_msg__ ; \ + stat_msg__ = msg_expr ; \ + call status(stat_msg__) ; \ + END BLOCK #define CHECK_TYPE_COMPLIANCE(subject_type, subject, is_team, min_size) \ BLOCK ; \ integer(c_int8_t), allocatable, target :: bytes(:) ; \ bytes = transfer(subject, bytes) ; \ - call check_type(#subject_type, is_team, min_size, \ + call check_type(CPP_STRINGIFY_SOURCE(subject_type), is_team, min_size, \ storage_size(subject)/8, bytes); \ END BLOCK +! check that an expression has a given integer value #define CHECK_VALI(expr, expect) \ BLOCK ; \ - use helpers ; \ integer :: cvi_tmp ; \ cvi_tmp = (expr) ; \ if (cvi_tmp /= (expect)) then ; \ - if (THIS_IMAGE() == 1) write(*,'(A,I)') __FILE__//":"//tostring(__LINE__)//": ERROR: " // \ - #expr // " = ", cvi_tmp ; \ + if (THIS_IMAGE() == 1) write(*,'(A,I0)') __FILE__//":"//tostring(__LINE__)//": ERROR: " // \ + CPP_STRINGIFY_SOURCE(expr) // " = ", cvi_tmp ; \ fail_count = fail_count + 1 ; \ end if ; \ END BLOCK +! check that an expression has a given logical value #define CHECK_VALL(expr, expect) \ BLOCK ; \ - use helpers ; \ logical :: cvl_tmp ; \ cvl_tmp = (expr) ; \ if (cvl_tmp .neqv. (expect)) then ; \ - if (THIS_IMAGE() == 1) write(*,'(A,L)') __FILE__//":"//tostring(__LINE__)//": ERROR: " // \ - #expr // " = ", cvl_tmp ; \ + if (THIS_IMAGE() == 1) write(*,'(A,L1)') __FILE__//":"//tostring(__LINE__)//": ERROR: " // \ + CPP_STRINGIFY_SOURCE(expr) // " = ", cvl_tmp ; \ fail_count = fail_count + 1 ; \ end if ; \ END BLOCK @@ -229,7 +252,7 @@ subroutine test_save_extern_coarray() if (once) then once = .false. - call status("Testing external SAVE coarrays...") + if (THIS_IMAGE() == 1) write(*,'(A)') "Testing external SAVE coarrays..." # if HAVE_COARRAY_LOCAL_ACCESS # if HAVE_COARRAY_INIT CHECK_VALI(esc_int_1, COARRAY_INT_INIT_VALUE) @@ -268,7 +291,7 @@ subroutine test_module_coarray() if (once) then once = .false. - call status("Testing module SAVE coarrays...") + if (THIS_IMAGE() == 1) write(*,'(A)') "Testing module SAVE coarrays..." # if HAVE_COARRAY_LOCAL_ACCESS # if HAVE_COARRAY_INIT CHECK_VALI(msc_int_1, COARRAY_INT_INIT_VALUE) @@ -338,7 +361,7 @@ program native_multi_image ni = NUM_IMAGES() peer = MIN(IEOR(me-1,1)+1, ni) - write(*,'(A,I1,A,I1,A)') "Hello, world! From image ", me, " of ", ni, " images" + write(*,'(A,I0,A,I0,A)') "Hello, world! From image ", me, " of ", ni, " images" # if SET_EXCEPTIONS block @@ -351,17 +374,17 @@ program native_multi_image # endif # if HAVE_SYNC_ALL - call status("Testing SYNC ALL...") + STATUS("Testing SYNC ALL...") call sync_all # endif # if HAVE_SYNC_MEMORY - call status("Testing SYNC MEMORY...") + STATUS("Testing SYNC MEMORY...") SYNC MEMORY # endif # if HAVE_SYNC_IMAGES - call status("Testing SYNC IMAGES...") + STATUS("Testing SYNC IMAGES...") SYNC IMAGES(*) SYNC IMAGES(peer) SYNC IMAGES([peer]) @@ -373,14 +396,14 @@ program native_multi_image c = "hello" ca = c # if HAVE_CO_SUM - call status("Testing CO_SUM...") + STATUS("Testing CO_SUM...") call CO_SUM(i) call CO_SUM(i,1) call CO_SUM(ia) call CO_SUM(ia,1) # endif # if HAVE_CO_MIN - call status("Testing CO_MIN...") + STATUS("Testing CO_MIN...") call CO_MIN(i) call CO_MIN(i,1) call CO_MIN(ia) @@ -391,7 +414,7 @@ program native_multi_image call CO_MIN(ca,1) # endif # if HAVE_CO_MAX - call status("Testing CO_MAX...") + STATUS("Testing CO_MAX...") call CO_MAX(i) call CO_MAX(i,1) call CO_MAX(ia) @@ -402,7 +425,7 @@ program native_multi_image call CO_MAX(ca,1) # endif # if HAVE_CO_BROADCAST - call status("Testing CO_BROADCAST...") + STATUS("Testing CO_BROADCAST...") call CO_BROADCAST(i,1) call CO_BROADCAST(ia,1) call CO_BROADCAST(c,1) @@ -413,39 +436,39 @@ program native_multi_image CHECK_TYPE_COMPLIANCE(TEAM_TYPE, default_team, .true., 0) # endif # if HAVE_TEAM_QUERIES - call status("Testing team queries...") + STATUS("Testing team queries...") subteam = GET_TEAM(CURRENT_TEAM) subteam = GET_TEAM(INITIAL_TEAM) subteam = GET_TEAM() - write(*,'(A,I3)') "Initial team number is ", TEAM_NUMBER() + CHECK_VALI(TEAM_NUMBER(), -1) # endif # if HAVE_FORM_TEAM - call status("Testing FORM TEAM...") + STATUS("Testing FORM TEAM...") team_id = merge(1, 2, me <= (ni+1)/2) FORM TEAM(team_id, subteam) # endif # if HAVE_SYNC_TEAM - call status("Testing SYNC TEAM...") + STATUS("Testing SYNC TEAM...") SYNC TEAM(subteam) # endif # if HAVE_CHANGE_TEAM - call status("Testing CHANGE TEAM...") + STATUS("Testing CHANGE TEAM...") CHANGE TEAM(subteam) - write(*,'(A,I3,A,I3,A,I3)') 'Inside CHANGE TEAM construct: ', THIS_IMAGE(), ' of ', NUM_IMAGES(), ' in team number ', TEAM_NUMBER() + write(*,'(I3,A,I3,A,I3,A,I3)') me, ': Inside CHANGE TEAM construct: ', THIS_IMAGE(), ' of ', NUM_IMAGES(), ' in team number ', TEAM_NUMBER() END TEAM call sync_all - write(*,'(A,I3)') "After END TEAM statement, TEAM_NUMBER() is ", TEAM_NUMBER() + CHECK_VALI(TEAM_NUMBER(), -1) # endif # if HAVE_MAIN_COARRAY # if HAVE_COARRAY_INIT - call status("Testing main program coarray initialization...") + STATUS("Testing main program coarray initialization...") CHECK_VALI(sca_int_1, COARRAY_INT_INIT_VALUE) CHECK_VALI(sca_int_2, COARRAY_INT_INIT_VALUE) CHECK_VALI(sca_int_3, COARRAY_INT_INIT_VALUE) # endif # if HAVE_COBOUND - call status("Testing LCOBOUND/UCOBOUND...") + STATUS("Testing LCOBOUND/UCOBOUND...") if (THIS_IMAGE() == 1) then ! Note output is affected by llvm-project issue #207858 write(*,'(A,2I3)') "lcobound(sca_int_2) = ", LCOBOUND(sca_int_2) @@ -454,35 +477,39 @@ program native_multi_image write(*,'(A,3I3)') "ucobound(sca_int_3) = ", UCOBOUND(sca_int_3) write(*,'(A,I3)') "lcobound(sca_int_3, dim=2) = ", LCOBOUND(sca_int_3, dim=2) write(*,'(A,I3)') "ucobound(sca_int_3, dim=2) = ", UCOBOUND(sca_int_3, dim=2) - write(*,'(A,I3)') "lcobound(sca_int_3, dim=2, kind=8) = ", LCOBOUND(sca_int_3, dim=2, kind=8) - write(*,'(A,I3)') "ucobound(sca_int_3, dim=2, kind=8) = ", UCOBOUND(sca_int_3, dim=2, kind=8) + write(*,'(A,I3)') "lcobound(sca_int_3, dim=2, kind=int64) = ", LCOBOUND(sca_int_3, dim=2, kind=int64) + write(*,'(A,I3)') "ucobound(sca_int_3, dim=2, kind=int64) = ", UCOBOUND(sca_int_3, dim=2, kind=int64) end if # endif # if HAVE_COSHAPE - call status("Testing COSHAPE...") + STATUS("Testing COSHAPE...") if (THIS_IMAGE() == 1) then ! Note output is affected by llvm-project issue #207858 write(*,'(A,3I3)') "coshape(sca_int_3) = ", COSHAPE(sca_int_3) - write(*,'(A,3I3)') "coshape(sca_int_3, kind=8) = ", COSHAPE(sca_int_3, kind=8) + write(*,'(A,3I3)') "coshape(sca_int_3, kind=int64) = ", COSHAPE(sca_int_3, kind=int64) end if # endif # if HAVE_IMAGE_INDEX - call status("Testing IMAGE_INDEX...") + STATUS("Testing IMAGE_INDEX...") if (THIS_IMAGE() == 1) then write(*,'(A,I3)') "image_index(sca_int_1, [1]) = ", IMAGE_INDEX(sca_int_1, [1]) write(*,'(A,I3)') "image_index(sca_int_2, [1,1]) = ", IMAGE_INDEX(sca_int_2, [1,1]) write(*,'(A,I3)') "image_index(sca_int_3, [1,1,1]) = ", IMAGE_INDEX(sca_int_3, [1,1,1]) # if HAVE_TEAM +# if HAVE_IMAGE_INDEX_TEAM_NUMBER write(*,'(A,I3)') "image_index(sca_int_1, [1], team_number=-1) = ", IMAGE_INDEX(sca_int_1, [1], TEAM_NUMBER=-1) write(*,'(A,I3)') "image_index(sca_int_3, [1,1,1], team_number=-1) = ", IMAGE_INDEX(sca_int_3, [1,1,1], TEAM_NUMBER=-1) - ! disabled for llvm-project issue #205953 - !write(*,'(A,I3)') "image_index(sca_int_1, [1], get_team()) = ", IMAGE_INDEX(sca_int_1, [1], GET_TEAM()) - !write(*,'(A,I3)') "image_index(sca_int_3, [1,1,1], get_team()) = ", IMAGE_INDEX(sca_int_3, [1,1,1], GET_TEAM()) +# endif +# if HAVE_IMAGE_INDEX_TEAM + ! affected by llvm-project issue #205953 + write(*,'(A,I3)') "image_index(sca_int_1, [1], get_team()) = ", IMAGE_INDEX(sca_int_1, [1], GET_TEAM()) + write(*,'(A,I3)') "image_index(sca_int_3, [1,1,1], get_team()) = ", IMAGE_INDEX(sca_int_3, [1,1,1], GET_TEAM()) +# endif # endif end if # endif # if HAVE_THIS_IMAGE_COARRAY - call status("Testing THIS_IMAGE(coarray)...") + STATUS("Testing THIS_IMAGE(coarray)...") if (THIS_IMAGE() == NUM_IMAGES()) then write(*,'(A,I3)') "this_image(sca_int_1) = ", THIS_IMAGE(sca_int_1) write(*,'(A,2I3)') "this_image(sca_int_2) = ", THIS_IMAGE(sca_int_2) @@ -491,7 +518,7 @@ program native_multi_image end if # endif # if HAVE_PUTGET_INTRINSIC_SCALAR - call status("Testing put/get intrinsic scalar...") + STATUS("Testing put/get intrinsic scalar...") sca_int_1 = THIS_IMAGE() call sync_all i = sca_int_1[peer] ! get @@ -511,18 +538,18 @@ program native_multi_image # endif # if HAVE_MAIN_COARRAY_ARRAY # if HAVE_COARRAY_INIT - call status("Testing main program array coarray initialization...") + STATUS("Testing main program array coarray initialization...") CHECK_VALI(sca_int100_1(3), COARRAY_INT_INIT_VALUE) CHECK_VALI(sca_int100_2(4), COARRAY_INT_INIT_VALUE) CHECK_VALI(sca_int100_3(5), COARRAY_INT_INIT_VALUE) # endif # if HAVE_PUTGET_INTRINSIC_ARRAY_CONTIG - call status("Testing put/get intrinsic array (contiguous)...") + STATUS("Testing put/get intrinsic array (contiguous)...") sca_int100_1 = THIS_IMAGE() call sync_all ia = sca_int100_1(10:12)[peer] ! get if (any(ia /= peer)) then - write(*,'(A,3I,A,I3)') "FAIL: get sca_int100_1[peer] = ", ia, " expected = ", peer + write(*,'(A,3I0,A,I3)') "FAIL: get sca_int100_1[peer] = ", ia, " expected = ", peer fail_count = fail_count + 1 end if call sync_all @@ -530,7 +557,7 @@ program native_multi_image call sync_all ia = sca_int100_1(20:22) if (any(ia /= peer)) then - write(*,'(A,3I,A,I3)') "FAIL: put to sca_int100_1 = ", ia, " expected = ", peer + write(*,'(A,3I0,A,I3)') "FAIL: put to sca_int100_1 = ", ia, " expected = ", peer fail_count = fail_count + 1 end if # endif @@ -541,7 +568,7 @@ program native_multi_image # endif # if HAVE_EVENT_QUERY - call status("Testing event_query...") + STATUS("Testing event_query...") i = 666 call EVENT_QUERY(test_event, i) if (i /= 0) then @@ -551,7 +578,7 @@ program native_multi_image # endif # if HAVE_EVENT_POST_WAIT - call status("Testing event post / event wait...") + STATUS("Testing event post / event wait...") if (THIS_IMAGE() == 1) then !event post (test_event) ! currently broken event post (test_event[1]) @@ -570,7 +597,7 @@ program native_multi_image # endif # if HAVE_ALLOC_COARRAY - call status("Testing coarray allocation...") + STATUS("Testing coarray allocation...") CHECK_VALL(ALLOCATED(aca_int_1), .false.) CHECK_VALL(ALLOCATED(aca_int_2), .false.) CHECK_VALL(ALLOCATED(aca_int_3), .false.) @@ -587,7 +614,7 @@ program native_multi_image # endif # if HAVE_ALLOC_COARRAY_DEALLOC - call status("Testing coarray deallocation...") + STATUS("Testing coarray deallocation...") deallocate(aca_int_1) CHECK_VALL(ALLOCATED(aca_int_1), .false.) @@ -616,18 +643,18 @@ program native_multi_image end if call sync_all - write(*,'(A,I1,A,I1,A)') "Goodbye from image ", me, " of ", ni, " images" + write(*,'(A,I0,A,I0,A)') "Goodbye from image ", me, " of ", ni, " images" ! explicit flush for now until we have multi-image stop support call flush_all call sync_all if (fail_count > 0) then - call status("ERROR: "//tostring(fail_count)//" tests FAILED.") + STATUS("ERROR: "//tostring(fail_count)//" tests FAILED.") else - call status("All tests passed.") + STATUS("All tests passed.") end if #if IGNORE_FAILURES - call status("WARNING: Ignoring "//tostring(IGNORE_FAILURES)//" failures.") + STATUS("WARNING: Ignoring "//tostring(IGNORE_FAILURES)//" failures.") fail_count = MAX(0, fail_count - IGNORE_FAILURES) #endif stop fail_count @@ -641,7 +668,7 @@ subroutine test_allocatable_coarray() integer, allocatable :: aca_int_2[:,:] integer, save, allocatable :: aca_int_3[:,:,:] if (once) then - call status("Testing ALLOCATABLE coarray cleanup...") + STATUS("Testing ALLOCATABLE coarray cleanup...") end if # if VERBOSE if (THIS_IMAGE() == 1) & @@ -679,10 +706,13 @@ subroutine check_type(type_name, is_team, min_size, subject_size, default_bytes) integer, parameter :: reference_size = storage_size(dummy_team_type_var)/8 # endif - call status("Testing " // type_name // "...") + STATUS("Testing " // type_name // "...") if (subject_size /= size(default_bytes)) ERROR STOP "INTERNAL ERROR: representation size mismatch" + if (TYPES_PRIF_COMPLIANT == 0) then + STATUS(" (validation skipped)") + else if (is_team) then # if HAVE_TEAM_TYPE ! check size, should be an exact match @@ -692,7 +722,7 @@ subroutine check_type(type_name, is_team, min_size, subject_size, default_bytes) diag = "FAIL (should be exactly " // tostring(reference_size) // " bytes)" fail_count = fail_count + 1 end if - call status(" Size of " // type_name // ": " // tostring(subject_size) // " bytes ==> " // diag) + STATUS(" Size of " // type_name // ": " // tostring(subject_size) // " bytes ==> " // diag) ! check default initialization dummy_team_type_var = transfer(team_var, dummy_team_type_var) @@ -702,7 +732,7 @@ subroutine check_type(type_name, is_team, min_size, subject_size, default_bytes) diag = "FAIL (not default-initialized to null(): " // hexdump(default_bytes)// ")" fail_count = fail_count + 1 end if - call status(" Default init of " // type_name // " ==> " // diag) + STATUS(" Default init of " // type_name // " ==> " // diag) # endif else # if TYPES_IMPORT_PRIF @@ -716,7 +746,7 @@ subroutine check_type(type_name, is_team, min_size, subject_size, default_bytes) fail_count = fail_count + 1 end if # endif - call status(" Size of " // type_name // ": " // tostring(subject_size) // " bytes ==> " // diag) + STATUS(" Size of " // type_name // ": " // tostring(subject_size) // " bytes ==> " // diag) ! check default initialization if (all(default_bytes == 0)) then @@ -726,8 +756,9 @@ subroutine check_type(type_name, is_team, min_size, subject_size, default_bytes) hexdump(default_bytes) // ")" fail_count = fail_count + 1 end if - call status(" Default init of " // type_name // " ==> " // diag) + STATUS(" Default init of " // type_name // " ==> " // diag) end if + end if end subroutine end program #else From e551dbae1b463cb456b0fa2abd85250a2317973b Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 2 Aug 2026 18:37:23 -0700 Subject: [PATCH 05/21] native-multi-image: Enable HAVE_COARRAY by default Enable HAVE_COARRAY by default, so that all multi-image features are enabled by default with HAVE_MULTI_IMAGE. Also deploy forward-looking HAVE_LOCK and HAVE_NOTIFY knobs that default to HAVE_COARRAY and control the relevant type. Adjust CI settings accordingly. --- .github/workflows/build.yml | 10 +++++----- app/Makefile | 4 ++-- app/native-multi-image.F90 | 12 +++++++++--- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 31c30c9c..c92ccf32 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,14 +142,14 @@ jobs: version: latest container: ghcr.io/lfortran/lfortran:latest native_multi_image: true - FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_TEAM_TYPE -DHAVE_FORM_TEAM -DHAVE_SYNC_TEAM -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK_TYPE=0 -DHAVE_NOTIFY_TYPE=0 + FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_TEAM_TYPE -DHAVE_FORM_TEAM -DHAVE_SYNC_TEAM -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK=0 -DHAVE_NOTIFY=0 - os: ubuntu-22.04 compiler: lfortran version: 0.64 container: ghcr.io/lfortran/lfortran:v0.64.0 native_multi_image: true - FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK_TYPE=0 -DHAVE_NOTIFY_TYPE=0 + FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_ALLOC_COARRAY=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK=0 -DHAVE_NOTIFY=0 - os: ubuntu-22.04 compiler: lfortran @@ -361,11 +361,11 @@ jobs: fi if [ "${NATIVE_MULTI_IMAGE}" == true ] ; then if [[ $COMPILER_VERSION == latest ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" elif [[ $COMPILER_VERSION == 23 ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" else # $COMPILER_VERSION == 22 - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_EVENT_TYPE -DIGNORE_FAILURES=8" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=8" >> "$GITHUB_ENV" fi fi diff --git a/app/Makefile b/app/Makefile index 70a2c939..57bd9300 100644 --- a/app/Makefile +++ b/app/Makefile @@ -5,10 +5,10 @@ FLAGS= COMMON_FLAGS=-DHAVE_MULTI_IMAGE -DTYPES_PRIF_COMPLIANT=0 -NAG_FLAGS=$(COMMON_FLAGS) -DHAVE_NOTIFY_TYPE=0 +NAG_FLAGS=$(COMMON_FLAGS) -DHAVE_NOTIFY=0 export NAGFORTRAN_NUM_IMAGES?=4 -GCC_FLAGS=$(COMMON_FLAGS) -DHAVE_COARRAY -DHAVE_NOTIFY_TYPE=0 -DHAVE_IMAGE_INDEX_TEAM_NUMBER=0 -DHAVE_CO_MIN=0 -DHAVE_CO_MAX=0 +GCC_FLAGS=$(COMMON_FLAGS) -DHAVE_NOTIFY=0 -DHAVE_IMAGE_INDEX_TEAM_NUMBER=0 -DHAVE_CO_MIN=0 -DHAVE_CO_MAX=0 export GFORTRAN_NUM_IMAGES?=4 GFORTRAN=gfortran diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index 80cf13e6..ec605a09 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -64,7 +64,7 @@ #endif #ifndef HAVE_COARRAY -#define HAVE_COARRAY 0 +#define HAVE_COARRAY 1 #endif #ifndef HAVE_MAIN_COARRAY #define HAVE_MAIN_COARRAY HAVE_COARRAY @@ -140,12 +140,18 @@ #define HAVE_EVENT_QUERY HAVE_EVENT #endif +#ifndef HAVE_LOCK +#define HAVE_LOCK HAVE_COARRAY +#endif #ifndef HAVE_LOCK_TYPE -#define HAVE_LOCK_TYPE 1 +#define HAVE_LOCK_TYPE HAVE_LOCK #endif +#ifndef HAVE_NOTIFY +#define HAVE_NOTIFY HAVE_COARRAY +#endif #ifndef HAVE_NOTIFY_TYPE -#define HAVE_NOTIFY_TYPE 1 +#define HAVE_NOTIFY_TYPE HAVE_NOTIFY #endif ! Helper macros From 02c58c5c04b464ed06ea9cc1886c71aa7921f5ce Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Mon, 3 Aug 2026 13:04:03 -0700 Subject: [PATCH 06/21] native-multi-image: strengthen checks for coarray queries Replace/augment unchecked console output with programmatic checks --- app/native-multi-image.F90 | 105 ++++++++++++++++++++++++++++--------- 1 file changed, 81 insertions(+), 24 deletions(-) diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index ec605a09..f485c8e7 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -176,9 +176,9 @@ storage_size(subject)/8, bytes); \ END BLOCK ! check that an expression has a given integer value -#define CHECK_VALI(expr, expect) \ +#define CHECK_VALIK(expr, expect, kind) \ BLOCK ; \ - integer :: cvi_tmp ; \ + integer kind :: cvi_tmp ; \ cvi_tmp = (expr) ; \ if (cvi_tmp /= (expect)) then ; \ if (THIS_IMAGE() == 1) write(*,'(A,I0)') __FILE__//":"//tostring(__LINE__)//": ERROR: " // \ @@ -186,6 +186,8 @@ fail_count = fail_count + 1 ; \ end if ; \ END BLOCK +#define CHECK_VALI(expr, expect) CHECK_VALIK(expr, expect, ) +#define CHECK_VALI64(expr, expect) CHECK_VALIK(expr, expect, (int64)) ! check that an expression has a given logical value #define CHECK_VALL(expr, expect) \ BLOCK ; \ @@ -197,6 +199,7 @@ fail_count = fail_count + 1 ; \ end if ; \ END BLOCK +#define CHECK_ASSERT(expr) CHECK_VALL((expr), .true.) #define COARRAY_INT_INIT_VALUE 123456789 #if HAVE_COARRAY_INIT @@ -220,6 +223,12 @@ function tostring(int) result(res) res = trim(adjustl(str)) end function + function element(intarr, idx) result(res) + integer, intent(in) :: intarr(*), idx + integer :: res + res = intarr(idx) + end function + function hexdump(arr) result(res) integer(c_int8_t), intent(in) :: arr(:) character(len=:), allocatable :: res @@ -461,6 +470,12 @@ program native_multi_image STATUS("Testing CHANGE TEAM...") CHANGE TEAM(subteam) write(*,'(I3,A,I3,A,I3,A,I3)') me, ': Inside CHANGE TEAM construct: ', THIS_IMAGE(), ' of ', NUM_IMAGES(), ' in team number ', TEAM_NUMBER() +# if !(__flang_major__ == 22 && __flang_minor__ == 1 && __flang_patchlevel__ < 3) /* avoid llvm #171048 */ + CHECK_ASSERT(THIS_IMAGE() >= 1) + CHECK_ASSERT(THIS_IMAGE() <= NUM_IMAGES()) + CHECK_ASSERT(NUM_IMAGES() <= (ni+1)/2) + CHECK_VALI(TEAM_NUMBER(), team_id) +# endif END TEAM call sync_all CHECK_VALI(TEAM_NUMBER(), -1) @@ -476,51 +491,93 @@ program native_multi_image # if HAVE_COBOUND STATUS("Testing LCOBOUND/UCOBOUND...") if (THIS_IMAGE() == 1) then - ! Note output is affected by llvm-project issue #207858 write(*,'(A,2I3)') "lcobound(sca_int_2) = ", LCOBOUND(sca_int_2) write(*,'(A,2I3)') "ucobound(sca_int_2) = ", UCOBOUND(sca_int_2) write(*,'(A,3I3)') "lcobound(sca_int_3) = ", LCOBOUND(sca_int_3) write(*,'(A,3I3)') "ucobound(sca_int_3) = ", UCOBOUND(sca_int_3) - write(*,'(A,I3)') "lcobound(sca_int_3, dim=2) = ", LCOBOUND(sca_int_3, dim=2) - write(*,'(A,I3)') "ucobound(sca_int_3, dim=2) = ", UCOBOUND(sca_int_3, dim=2) - write(*,'(A,I3)') "lcobound(sca_int_3, dim=2, kind=int64) = ", LCOBOUND(sca_int_3, dim=2, kind=int64) - write(*,'(A,I3)') "ucobound(sca_int_3, dim=2, kind=int64) = ", UCOBOUND(sca_int_3, dim=2, kind=int64) end if + block + integer :: co3(3) + integer(int64) :: co3_64(3) + CHECK_ASSERT(all(LCOBOUND(sca_int_3) == 1)) + CHECK_ASSERT(all(LCOBOUND(sca_int_3, kind=int64) == 1_int64)) + co3 = UCOBOUND(sca_int_3) + co3_64 = UCOBOUND(sca_int_3, kind=int64) + CHECK_ASSERT(all(co3(1:2) == [2,3])) + CHECK_ASSERT(co3(3) >= 1) + CHECK_ASSERT(all(co3_64(1:2) == [2_int64,3_int64])) + CHECK_ASSERT(co3_64(3) >= 1_int64) + end block + CHECK_VALI(LCOBOUND(sca_int_2, dim=1), 1) + CHECK_VALI(UCOBOUND(sca_int_2, dim=1), 2) + CHECK_VALI(LCOBOUND(sca_int_3, dim=1), 1) + CHECK_VALI(LCOBOUND(sca_int_3, dim=2), 1) + CHECK_VALI(LCOBOUND(sca_int_3, dim=3), 1) + CHECK_VALI(UCOBOUND(sca_int_3, dim=1), 2) + CHECK_VALI(UCOBOUND(sca_int_3, dim=2), 3) + CHECK_VALI64(LCOBOUND(sca_int_3, dim=2, kind=int64), 1) + CHECK_VALI64(UCOBOUND(sca_int_3, dim=2, kind=int64), 3) # endif # if HAVE_COSHAPE STATUS("Testing COSHAPE...") if (THIS_IMAGE() == 1) then - ! Note output is affected by llvm-project issue #207858 write(*,'(A,3I3)') "coshape(sca_int_3) = ", COSHAPE(sca_int_3) - write(*,'(A,3I3)') "coshape(sca_int_3, kind=int64) = ", COSHAPE(sca_int_3, kind=int64) end if + block + integer :: co3(3) + integer(int64) :: co3_64(3) + co3 = COSHAPE(sca_int_3) + co3_64 = COSHAPE(sca_int_3, kind=int64) + CHECK_ASSERT(all(co3(1:2) == [2,3])) + CHECK_ASSERT(co3(3) >= 1) + CHECK_ASSERT(all(co3_64(1:2) == [2_int64,3_int64])) + CHECK_ASSERT(co3_64(3) >= 1_int64) + end block # endif # if HAVE_IMAGE_INDEX STATUS("Testing IMAGE_INDEX...") - if (THIS_IMAGE() == 1) then - write(*,'(A,I3)') "image_index(sca_int_1, [1]) = ", IMAGE_INDEX(sca_int_1, [1]) - write(*,'(A,I3)') "image_index(sca_int_2, [1,1]) = ", IMAGE_INDEX(sca_int_2, [1,1]) - write(*,'(A,I3)') "image_index(sca_int_3, [1,1,1]) = ", IMAGE_INDEX(sca_int_3, [1,1,1]) -# if HAVE_TEAM + CHECK_VALI(IMAGE_INDEX(sca_int_1, [1]), 1) + CHECK_VALI(IMAGE_INDEX(sca_int_1, [ni]), ni) + CHECK_VALI(IMAGE_INDEX(sca_int_2, [1,1]), 1) + CHECK_VALI(IMAGE_INDEX(sca_int_3, [1,1,1]), 1) +# if HAVE_TEAM # if HAVE_IMAGE_INDEX_TEAM_NUMBER - write(*,'(A,I3)') "image_index(sca_int_1, [1], team_number=-1) = ", IMAGE_INDEX(sca_int_1, [1], TEAM_NUMBER=-1) - write(*,'(A,I3)') "image_index(sca_int_3, [1,1,1], team_number=-1) = ", IMAGE_INDEX(sca_int_3, [1,1,1], TEAM_NUMBER=-1) + CHECK_VALI(IMAGE_INDEX(sca_int_1, [1], team_number=-1), 1) + CHECK_VALI(IMAGE_INDEX(sca_int_1, [ni], team_number=-1), ni) + CHECK_VALI(IMAGE_INDEX(sca_int_2, [1,1], team_number=-1), 1) + CHECK_VALI(IMAGE_INDEX(sca_int_3, [1,1,1], team_number=-1), 1) # endif # if HAVE_IMAGE_INDEX_TEAM - ! affected by llvm-project issue #205953 - write(*,'(A,I3)') "image_index(sca_int_1, [1], get_team()) = ", IMAGE_INDEX(sca_int_1, [1], GET_TEAM()) - write(*,'(A,I3)') "image_index(sca_int_3, [1,1,1], get_team()) = ", IMAGE_INDEX(sca_int_3, [1,1,1], GET_TEAM()) + ! affected by llvm-project issue #205953 + CHECK_VALI(IMAGE_INDEX(sca_int_1, [1], GET_TEAM()), 1) +# ifndef __GFORTRAN__ + ! ICE's gfortran 16: + CHECK_VALI(IMAGE_INDEX(sca_int_1, [ni], GET_TEAM()), ni) +# endif + CHECK_VALI(IMAGE_INDEX(sca_int_2, [1,1], GET_TEAM()), 1) + CHECK_VALI(IMAGE_INDEX(sca_int_3, [1,1,1], GET_TEAM()), 1) # endif # endif - end if # endif # if HAVE_THIS_IMAGE_COARRAY STATUS("Testing THIS_IMAGE(coarray)...") if (THIS_IMAGE() == NUM_IMAGES()) then - write(*,'(A,I3)') "this_image(sca_int_1) = ", THIS_IMAGE(sca_int_1) - write(*,'(A,2I3)') "this_image(sca_int_2) = ", THIS_IMAGE(sca_int_2) - write(*,'(A,3I3)') "this_image(sca_int_3) = ", THIS_IMAGE(sca_int_3) - write(*,'(A,I3)') "this_image(sca_int_3, dim=2) = ", THIS_IMAGE(sca_int_3, dim=2) + write(*,'(I3,A,I3)') me, ": this_image(sca_int_1) = ", THIS_IMAGE(sca_int_1) + write(*,'(I3,A,2I3)') me, ": this_image(sca_int_2) = ", THIS_IMAGE(sca_int_2) + write(*,'(I3,A,3I3)') me, ": this_image(sca_int_3) = ", THIS_IMAGE(sca_int_3) + end if + CHECK_VALI(element(THIS_IMAGE(sca_int_1),1), THIS_IMAGE()) + CHECK_VALI(THIS_IMAGE(sca_int_3, dim=1), element(THIS_IMAGE(sca_int_3),1)) + CHECK_VALI(THIS_IMAGE(sca_int_3, dim=2), element(THIS_IMAGE(sca_int_3),2)) + CHECK_VALI(THIS_IMAGE(sca_int_3, dim=3), element(THIS_IMAGE(sca_int_3),3)) + if (THIS_IMAGE() == 1) then + CHECK_ASSERT(all(THIS_IMAGE(sca_int_2) == 1)) + CHECK_ASSERT(all(THIS_IMAGE(sca_int_3) == 1)) + else + CHECK_ASSERT(all(THIS_IMAGE(sca_int_2) >= 1)) + CHECK_ASSERT(all(THIS_IMAGE(sca_int_3) >= 1)) + CHECK_ASSERT(any(THIS_IMAGE(sca_int_2) > 1)) + CHECK_ASSERT(any(THIS_IMAGE(sca_int_3) > 1)) end if # endif # if HAVE_PUTGET_INTRINSIC_SCALAR From 5f134e1185ca481ed69334c465bb55e4aa869607 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Mon, 3 Aug 2026 15:09:08 -0700 Subject: [PATCH 07/21] native-multi-image: Add basic validation of collective results --- app/native-multi-image.F90 | 57 +++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index f485c8e7..8d1a06d2 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -215,12 +215,25 @@ module helpers public integer :: fail_count = 0 contains - function tostring(int) result(res) - integer :: int - character(len=128) :: str + function tostring(int, width) result(res) + integer, intent(in) :: int + integer, intent(in), optional :: width character(len=:), allocatable :: res - write(str, *) int - res = trim(adjustl(str)) + integer :: w + if (present(width)) then + w = width + block + character(len=w) :: str + write(str, *) int + res = adjustr(str) + end block + else + block + character(len=128) :: str + write(str, *) int + res = trim(adjustl(str)) + end block + end if end function function element(intarr, idx) result(res) @@ -340,7 +353,7 @@ program native_multi_image end type integer :: me, ni, peer, i, ia(3) - character(len=5) :: c, ca(3) + character(len=10) :: c, ca(3) # if HAVE_TEAM_TYPE integer :: team_id type(TEAM_TYPE) :: subteam @@ -406,45 +419,69 @@ program native_multi_image if (me /= peer) SYNC IMAGES([me, peer]) #endif - i = me - ia = me - c = "hello" - ca = c # if HAVE_CO_SUM STATUS("Testing CO_SUM...") + i = me + ia = me call CO_SUM(i) + CHECK_VALI(i,ni*(ni+1)/2) call CO_SUM(i,1) call CO_SUM(ia) + CHECK_ASSERT(all(ia == ni*(ni+1)/2)) call CO_SUM(ia,1) # endif # if HAVE_CO_MIN STATUS("Testing CO_MIN...") + i = 100*me + ia = i call CO_MIN(i) + CHECK_VALI(i,100) call CO_MIN(i,1) call CO_MIN(ia) + CHECK_ASSERT(all(ia == 100)) call CO_MIN(ia,1) + c = tostring(100*me, len(c)) + ca = c call CO_MIN(c) + CHECK_ASSERT(c == tostring(100, len(c))) call CO_MIN(c,1) call CO_MIN(ca) + CHECK_ASSERT(all(ca == tostring(100, len(c)))) call CO_MIN(ca,1) # endif # if HAVE_CO_MAX STATUS("Testing CO_MAX...") + i = 10*me + ia = i call CO_MAX(i) + CHECK_VALI(i,10*ni) call CO_MAX(i,1) call CO_MAX(ia) + CHECK_ASSERT(all(ia == 10*ni)) call CO_MAX(ia,1) + c = tostring(10*me, len(c)) + ca = c call CO_MAX(c) + CHECK_ASSERT(c == tostring(10*ni, len(c))) call CO_MAX(c,1) call CO_MAX(ca) + CHECK_ASSERT(all(ca == tostring(10*ni, len(c)))) call CO_MAX(ca,1) # endif # if HAVE_CO_BROADCAST STATUS("Testing CO_BROADCAST...") + i = me*1000 + ia = i call CO_BROADCAST(i,1) + CHECK_VALI(i,1000) call CO_BROADCAST(ia,1) + CHECK_ASSERT(all(ia == 1000)) + c = "hello" + ca = c call CO_BROADCAST(c,1) + CHECK_ASSERT(c == 'hello') call CO_BROADCAST(ca,1) + CHECK_ASSERT(all(ca == 'hello')) # endif # if HAVE_TEAM_TYPE From 50681e48da094342dd2bc96d7c1cc0f9acbe0fde Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Mon, 3 Aug 2026 17:10:27 -0700 Subject: [PATCH 08/21] native-multi-image: Decompose TEAM_QUERIES --- app/native-multi-image.F90 | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index 8d1a06d2..0062addc 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -50,8 +50,11 @@ #ifndef HAVE_TEAM_TYPE #define HAVE_TEAM_TYPE HAVE_TEAM #endif -#ifndef HAVE_TEAM_QUERIES -#define HAVE_TEAM_QUERIES HAVE_TEAM +#ifndef HAVE_GET_TEAM +#define HAVE_GET_TEAM HAVE_TEAM +#endif +#ifndef HAVE_TEAM_NUMBER +#define HAVE_TEAM_NUMBER HAVE_TEAM #endif #ifndef HAVE_FORM_TEAM #define HAVE_FORM_TEAM HAVE_TEAM @@ -487,11 +490,14 @@ program native_multi_image # if HAVE_TEAM_TYPE CHECK_TYPE_COMPLIANCE(TEAM_TYPE, default_team, .true., 0) # endif -# if HAVE_TEAM_QUERIES - STATUS("Testing team queries...") +# if HAVE_GET_TEAM + STATUS("Testing GET_TEAM...") subteam = GET_TEAM(CURRENT_TEAM) subteam = GET_TEAM(INITIAL_TEAM) subteam = GET_TEAM() +# endif +# if HAVE_TEAM_NUMBER + STATUS("Testing TEAM_NUMBER...") CHECK_VALI(TEAM_NUMBER(), -1) # endif # if HAVE_FORM_TEAM @@ -506,16 +512,20 @@ program native_multi_image # if HAVE_CHANGE_TEAM STATUS("Testing CHANGE TEAM...") CHANGE TEAM(subteam) - write(*,'(I3,A,I3,A,I3,A,I3)') me, ': Inside CHANGE TEAM construct: ', THIS_IMAGE(), ' of ', NUM_IMAGES(), ' in team number ', TEAM_NUMBER() + write(*,'(I3,A,I3,A,I3,A,I3)') me, ': Inside CHANGE TEAM construct: ', THIS_IMAGE(), ' of ', NUM_IMAGES(), ' in team number ', team_id # if !(__flang_major__ == 22 && __flang_minor__ == 1 && __flang_patchlevel__ < 3) /* avoid llvm #171048 */ CHECK_ASSERT(THIS_IMAGE() >= 1) CHECK_ASSERT(THIS_IMAGE() <= NUM_IMAGES()) CHECK_ASSERT(NUM_IMAGES() <= (ni+1)/2) - CHECK_VALI(TEAM_NUMBER(), team_id) +# if HAVE_TEAM_NUMBER + CHECK_VALI(TEAM_NUMBER(), team_id) +# endif # endif END TEAM call sync_all - CHECK_VALI(TEAM_NUMBER(), -1) +# if HAVE_TEAM_NUMBER + CHECK_VALI(TEAM_NUMBER(), -1) +# endif # endif # if HAVE_MAIN_COARRAY @@ -584,7 +594,7 @@ program native_multi_image CHECK_VALI(IMAGE_INDEX(sca_int_2, [1,1], team_number=-1), 1) CHECK_VALI(IMAGE_INDEX(sca_int_3, [1,1,1], team_number=-1), 1) # endif -# if HAVE_IMAGE_INDEX_TEAM +# if HAVE_IMAGE_INDEX_TEAM && HAVE_GET_TEAM ! affected by llvm-project issue #205953 CHECK_VALI(IMAGE_INDEX(sca_int_1, [1], GET_TEAM()), 1) # ifndef __GFORTRAN__ From f14f88f3ef9ee9e60fbc6139b48709046eba1566 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Mon, 3 Aug 2026 17:12:18 -0700 Subject: [PATCH 09/21] CI: Add CHANGE TEAM coverage for lfortran-latest --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c92ccf32..4da21ad9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,7 +142,7 @@ jobs: version: latest container: ghcr.io/lfortran/lfortran:latest native_multi_image: true - FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_TEAM_TYPE -DHAVE_FORM_TEAM -DHAVE_SYNC_TEAM -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK=0 -DHAVE_NOTIFY=0 + FFLAGS: --coarray=true -DHAVE_TEAM_NUMBER=0 -DHAVE_GET_TEAM=0 -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK=0 -DHAVE_NOTIFY=0 - os: ubuntu-22.04 compiler: lfortran From 5b7745b7ec53c89d172e1f4f13b2dfa0744cc4b7 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Wed, 5 Aug 2026 16:39:38 -0700 Subject: [PATCH 10/21] native-multi-image: Add coverage for TEAM= in several intrinsics Coverage for: * THIS_IMAGE(TEAM=) * NUM_IMAGES(TEAM=) * TEAM_NUMBER(TEAM=) --- .github/workflows/build.yml | 8 ++++---- app/Makefile | 2 +- app/native-multi-image.F90 | 30 ++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4da21ad9..4e725bf9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,7 +142,7 @@ jobs: version: latest container: ghcr.io/lfortran/lfortran:latest native_multi_image: true - FFLAGS: --coarray=true -DHAVE_TEAM_NUMBER=0 -DHAVE_GET_TEAM=0 -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK=0 -DHAVE_NOTIFY=0 + FFLAGS: --coarray=true -DHAVE_TEAM_NUMBER=0 -DHAVE_GET_TEAM=0 -DHAVE_THIS_IMAGE_TEAM=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK=0 -DHAVE_NOTIFY=0 - os: ubuntu-22.04 compiler: lfortran @@ -361,11 +361,11 @@ jobs: fi if [ "${NATIVE_MULTI_IMAGE}" == true ] ; then if [[ $COMPILER_VERSION == latest ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_THIS_IMAGE_TEAM=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_TEAM_NUMBER_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" elif [[ $COMPILER_VERSION == 23 ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_THIS_IMAGE_TEAM=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_TEAM_NUMBER_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" else # $COMPILER_VERSION == 22 - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=8" >> "$GITHUB_ENV" + echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY=0 -DHAVE_THIS_IMAGE_TEAM=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_TEAM_NUMBER_TEAM=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=8" >> "$GITHUB_ENV" fi fi diff --git a/app/Makefile b/app/Makefile index 57bd9300..f1039fc1 100644 --- a/app/Makefile +++ b/app/Makefile @@ -8,7 +8,7 @@ COMMON_FLAGS=-DHAVE_MULTI_IMAGE -DTYPES_PRIF_COMPLIANT=0 NAG_FLAGS=$(COMMON_FLAGS) -DHAVE_NOTIFY=0 export NAGFORTRAN_NUM_IMAGES?=4 -GCC_FLAGS=$(COMMON_FLAGS) -DHAVE_NOTIFY=0 -DHAVE_IMAGE_INDEX_TEAM_NUMBER=0 -DHAVE_CO_MIN=0 -DHAVE_CO_MAX=0 +GCC_FLAGS=$(COMMON_FLAGS) -DHAVE_NOTIFY=0 -DHAVE_IMAGE_INDEX_TEAM_NUMBER=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_CO_MIN=0 -DHAVE_CO_MAX=0 export GFORTRAN_NUM_IMAGES?=4 GFORTRAN=gfortran diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index 0062addc..4a689b17 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -56,6 +56,9 @@ #ifndef HAVE_TEAM_NUMBER #define HAVE_TEAM_NUMBER HAVE_TEAM #endif +#ifndef HAVE_TEAM_NUMBER_TEAM +#define HAVE_TEAM_NUMBER_TEAM HAVE_TEAM_NUMBER +#endif #ifndef HAVE_FORM_TEAM #define HAVE_FORM_TEAM HAVE_TEAM #endif @@ -65,6 +68,12 @@ #ifndef HAVE_CHANGE_TEAM #define HAVE_CHANGE_TEAM HAVE_TEAM #endif +#ifndef HAVE_THIS_IMAGE_TEAM +#define HAVE_THIS_IMAGE_TEAM HAVE_TEAM +#endif +#ifndef HAVE_NUM_IMAGES_TEAM +#define HAVE_NUM_IMAGES_TEAM HAVE_TEAM +#endif #ifndef HAVE_COARRAY #define HAVE_COARRAY 1 @@ -520,6 +529,27 @@ program native_multi_image # if HAVE_TEAM_NUMBER CHECK_VALI(TEAM_NUMBER(), team_id) # endif +# if HAVE_THIS_IMAGE_TEAM + CHECK_VALI(THIS_IMAGE(subteam),THIS_IMAGE()) +# if HAVE_GET_TEAM + CHECK_VALI(THIS_IMAGE(GET_TEAM()),THIS_IMAGE()) + CHECK_VALI(THIS_IMAGE(TEAM=GET_TEAM(INITIAL_TEAM)),me) +# endif +# endif +# if HAVE_NUM_IMAGES_TEAM + CHECK_VALI(NUM_IMAGES(subteam),NUM_IMAGES()) +# if HAVE_GET_TEAM + CHECK_VALI(NUM_IMAGES(GET_TEAM()),NUM_IMAGES()) + CHECK_VALI(NUM_IMAGES(TEAM=GET_TEAM(INITIAL_TEAM)),ni) +# endif +# endif +# if HAVE_TEAM_NUMBER_TEAM + CHECK_VALI(TEAM_NUMBER(subteam),team_id) +# if HAVE_GET_TEAM + CHECK_VALI(TEAM_NUMBER(GET_TEAM()),team_id) + CHECK_VALI(TEAM_NUMBER(TEAM=GET_TEAM(INITIAL_TEAM)),-1) +# endif +# endif # endif END TEAM call sync_all From a8e0a2e4bd10ee474a38ec0760b2be12ed36ffaf Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Wed, 5 Aug 2026 20:43:49 -0700 Subject: [PATCH 11/21] print-native-flags: New program to factor the native test flag computation --- app/Makefile | 38 ++++++---- app/print-native-flags.F90 | 149 +++++++++++++++++++++++++++++++++++++ 2 files changed, 172 insertions(+), 15 deletions(-) create mode 100644 app/print-native-flags.F90 diff --git a/app/Makefile b/app/Makefile index f1039fc1..ffe25fdb 100644 --- a/app/Makefile +++ b/app/Makefile @@ -1,31 +1,39 @@ # This Makefile is for internal testing use only and not intended for end-users # To run this test with Caffeine, please execute `./run-fpm.sh run` in the top-level directory -FLAGS= - -COMMON_FLAGS=-DHAVE_MULTI_IMAGE -DTYPES_PRIF_COMPLIANT=0 - -NAG_FLAGS=$(COMMON_FLAGS) -DHAVE_NOTIFY=0 +# overridable settings export NAGFORTRAN_NUM_IMAGES?=4 - -GCC_FLAGS=$(COMMON_FLAGS) -DHAVE_NOTIFY=0 -DHAVE_IMAGE_INDEX_TEAM_NUMBER=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_CO_MIN=0 -DHAVE_CO_MAX=0 export GFORTRAN_NUM_IMAGES?=4 - +FLAGS= +NATIVE_FLAGS=$$($(MAKE) --no-print-directory print-flags FC=$$FC) GFORTRAN=gfortran +# ---------------------------------------------------------------- + all: gcc +print-flags: + @$$FC print-native-flags.F90 -o print-native-flags + @./print-native-flags -s + @rm -f print-native-flags + nag: - $(GFORTRAN) -E $(NAG_FLAGS) $(FLAGS) \ - native-multi-image.F90 > native-multi-image.i.F90 - nagfor -coarray native-multi-image.i.F90 -o native-multi-image-nag - rm -f native-multi-image.i.F90 - ./native-multi-image-nag + @set -x ; \ + export FC=nagfor ; \ + export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ + $(GFORTRAN) -E -DNAGFOR $$NATIVE_FLAGS $(FLAGS) \ + native-multi-image.F90 > native-multi-image.i.F90 && \ + $$FC -u -g -coarray native-multi-image.i.F90 -o native-multi-image-nag + @rm -f native-multi-image.i.F90 + env NAGFORTRAN_NUM_IMAGES=$(NAGFORTRAN_NUM_IMAGES) ./native-multi-image-nag gcc: - $(GFORTRAN) -fcoarray=lib $(GCC_FLAGS) $(FLAGS) \ + @set -x ; \ + export FC=$(GFORTRAN) ; \ + export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ + $$FC -g -fcoarray=lib $$NATIVE_FLAGS $(FLAGS) \ native-multi-image.F90 -o native-multi-image-gcc -lcaf_shmem - ./native-multi-image-gcc + env GFORTRAN_NUM_IMAGES=$(GFORTRAN_NUM_IMAGES) ./native-multi-image-gcc clean: rm -f *.mod *.i.F90 native-multi-image-nag native-multi-image-gcc diff --git a/app/print-native-flags.F90 b/app/print-native-flags.F90 new file mode 100644 index 00000000..05e1c2fc --- /dev/null +++ b/app/print-native-flags.F90 @@ -0,0 +1,149 @@ +program print_native_flags + use iso_fortran_env + implicit none + + character(:), allocatable :: flags + logical :: stand_alone + +#if VERBOSE + write(error_unit,'(A,A)') "COMPILER_VERSION=", COMPILER_VERSION() + write(error_unit,'(A,A)') "COMPILER_OPTIONS=", COMPILER_OPTIONS() +#endif + + stand_alone = COMMAND_ARGUMENT_COUNT() > 0 + + call write_flags + +contains +subroutine write_flags +#if __flang__ +# if __flang_major__ == 22 + call set("-fcoarray") + + call no("COARRAY") + + ! issue #205953 + call no("NUM_IMAGES_TEAM") + call no("THIS_IMAGE_TEAM") + call no("TEAM_NUMBER_TEAM") + + call yes("EVENT_TYPE") + call yes("LOCK_TYPE") + call yes("NOTIFY_TYPE") + + call set("-DIGNORE_FAILURES=8") ! type checks for event, notify, lock, team +# elif __flang_major__ >= 23 + call set("-fcoarray") + + call no("ALLOC_COARRAY_CLEANUP") + call no("ALLOC_COARRAY_DEALLOC") + call no("COARRAY_INIT") + call no("COARRAY_LOCAL_ACCESS") + call no("PUTGET") + + ! issue #205953 + call no("IMAGE_INDEX_TEAM") + call no("NUM_IMAGES_TEAM") + call no("THIS_IMAGE_TEAM") + call no("TEAM_NUMBER_TEAM") + + call no("EVENT") + call yes("EVENT_TYPE") + call no("LOCK") + call yes("LOCK_TYPE") + call no("NOTIFY") + call yes("NOTIFY_TYPE") + + call set("-DIGNORE_FAILURES=6") ! type checks for event, notify, lock +# endif +#elif __LFORTRAN__ +# if __LFORTRAN_MAJOR__ == 0 && __LFORTRAN_MINOR__ <= 63 + ! no multi-image support +# elif __LFORTRAN_MAJOR__ > 0 || \ + (__LFORTRAN_MAJOR__ == 0 && __LFORTRAN_MINOR__ >= 64 ) + if (INDEX(COMPILER_VERSION(), 'version 0.64') /= 0 .and. & + INDEX(COMPILER_VERSION(), '-g') == 0) then + ! LFortran release 0.64 + call set("--coarray=true") + + call no("TEAM") + + call no("ALLOC_COARRAY") + call no("COARRAY_QUERY") + call no("PUTGET_INTRINSIC_ARRAY_CONTIG") + + call no("EVENT") + call no("LOCK") + call no("NOTIFY") + else + ! LFortran git snapshot or newer, assume latest we know about + call set("--coarray=true") + + call no("GET_TEAM") + call no("NUM_IMAGES_TEAM") + call no("THIS_IMAGE_TEAM") + call no("TEAM_NUMBER") + + call no("ALLOC_COARRAY_CLEANUP") + call no("COARRAY_QUERY") + call yes("COBOUND") + call no("PUTGET_INTRINSIC_ARRAY_CONTIG") + + call no("EVENT") + call no("LOCK") + call no("NOTIFY") + end if +# endif +#elif NAGFOR + if (.not. stand_alone) return +# if __NAG_COMPILER_RELEASE >= 72 + ! __NAG_COMPILER_BUILD contains build number + !call set("-coarray=cosmp") + call set("-DTYPES_PRIF_COMPLIANT=0") + + call no("NOTIFY") +# endif +#elif __GFORTRAN__ + if (.not. stand_alone) return +# if __GNUC__ >= 16 + !call set("-fcoarray=lib") + call set("-DTYPES_PRIF_COMPLIANT=0") + + call no("NOTIFY") + call no("IMAGE_INDEX_TEAM_NUMBER") + call no("NUM_IMAGES_TEAM") + call no("CO_MIN") + call no("CO_MAX") +# endif +#elif _CRAYFTN +#endif + + if (allocated(flags)) write(*,'(A)') flags +end subroutine +subroutine yes(flag) + character(*), intent(in) :: flag + call define(flag, .true.) +end subroutine +subroutine no(flag) + character(*), intent(in) :: flag + call define(flag, .false.) +end subroutine +subroutine define(flag,val) + character(*), intent(in) :: flag + logical, intent(in) :: val + character(:), allocatable :: tmp + if (INDEX(flag,"HAVE") > 0 .or. INDEX(flag,"-D") > 0) error stop flag + tmp = "-DHAVE_" + tmp = tmp // flag + if (.not. val) tmp = tmp // "=0" + call set(tmp) +end subroutine +subroutine set(flag) + character(*), intent(in) :: flag + if (.not. allocated(flags)) then + flags = "-DHAVE_MULTI_IMAGE" + end if + flags = flags // " " // flag +end subroutine + +end program From 4fa2b085e0e2439f45d61f64198d8bfbc3c459bd Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Thu, 6 Aug 2026 11:24:53 -0700 Subject: [PATCH 12/21] native-multi-image: Add preliminary stand-alone support for CCE Other minor cleanups --- app/Makefile | 24 +++++++++++++++++------- app/native-multi-image.F90 | 21 ++++++++------------- app/print-native-flags.F90 | 25 +++++++++++++++++++------ 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/app/Makefile b/app/Makefile index ffe25fdb..7ac266c4 100644 --- a/app/Makefile +++ b/app/Makefile @@ -2,8 +2,9 @@ # To run this test with Caffeine, please execute `./run-fpm.sh run` in the top-level directory # overridable settings -export NAGFORTRAN_NUM_IMAGES?=4 -export GFORTRAN_NUM_IMAGES?=4 +NUM_IMAGES?=4 +NAGFORTRAN_NUM_IMAGES?=$(NUM_IMAGES) +GFORTRAN_NUM_IMAGES?=$(NUM_IMAGES) FLAGS= NATIVE_FLAGS=$$($(MAKE) --no-print-directory print-flags FC=$$FC) GFORTRAN=gfortran @@ -17,6 +18,14 @@ print-flags: @./print-native-flags -s @rm -f print-native-flags +gcc: + @set -x ; \ + export FC=$(GFORTRAN) ; \ + export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ + $$FC -g -fcoarray=lib $$NATIVE_FLAGS $(FLAGS) \ + native-multi-image.F90 -o native-multi-image-gcc -lcaf_shmem + env GFORTRAN_NUM_IMAGES=$(GFORTRAN_NUM_IMAGES) ./native-multi-image-gcc + nag: @set -x ; \ export FC=nagfor ; \ @@ -27,13 +36,14 @@ nag: @rm -f native-multi-image.i.F90 env NAGFORTRAN_NUM_IMAGES=$(NAGFORTRAN_NUM_IMAGES) ./native-multi-image-nag -gcc: +cce: @set -x ; \ - export FC=$(GFORTRAN) ; \ + export FC=ftn ; \ export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ - $$FC -g -fcoarray=lib $$NATIVE_FLAGS $(FLAGS) \ - native-multi-image.F90 -o native-multi-image-gcc -lcaf_shmem - env GFORTRAN_NUM_IMAGES=$(GFORTRAN_NUM_IMAGES) ./native-multi-image-gcc + $$FC -g -hcaf -O0 $$NATIVE_FLAGS $(FLAGS) \ + native-multi-image.F90 -o native-multi-image-cray + ./native-multi-image-cray + srun -n $(NUM_IMAGES) ./native-multi-image-cray clean: rm -f *.mod *.i.F90 native-multi-image-nag native-multi-image-gcc diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index 4a689b17..0cdc2b17 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -177,6 +177,7 @@ #define STATUS(msg_expr) \ BLOCK ; \ character(len=:), allocatable :: stat_msg__ ; \ + allocate(character(0) :: stat_msg__) ; \ stat_msg__ = msg_expr ; \ call status(stat_msg__) ; \ END BLOCK @@ -231,20 +232,14 @@ function tostring(int, width) result(res) integer, intent(in) :: int integer, intent(in), optional :: width character(len=:), allocatable :: res - integer :: w if (present(width)) then - w = width - block - character(len=w) :: str - write(str, *) int - res = adjustr(str) - end block + allocate(character(width) :: res) + write(res, '(I0)') int + res = adjustr(res) else - block - character(len=128) :: str - write(str, *) int - res = trim(adjustl(str)) - end block + allocate(character(128) :: res) + write(res, '(I0)') int + res = trim(adjustl(res)) end if end function @@ -312,7 +307,6 @@ subroutine test_save_extern_coarray() end subroutine module coarrays - use helpers implicit none # if HAVE_MODULE_COARRAY @@ -326,6 +320,7 @@ module coarrays contains subroutine test_module_coarray() # if HAVE_MODULE_COARRAY + use helpers implicit none logical, save :: once = .true. diff --git a/app/print-native-flags.F90 b/app/print-native-flags.F90 index 05e1c2fc..73447235 100644 --- a/app/print-native-flags.F90 +++ b/app/print-native-flags.F90 @@ -101,7 +101,7 @@ subroutine write_flags !call set("-coarray=cosmp") call set("-DTYPES_PRIF_COMPLIANT=0") - call no("NOTIFY") + call no("NOTIFY") ! missing F2023 feature # endif #elif __GFORTRAN__ if (.not. stand_alone) return @@ -109,13 +109,24 @@ subroutine write_flags !call set("-fcoarray=lib") call set("-DTYPES_PRIF_COMPLIANT=0") - call no("NOTIFY") - call no("IMAGE_INDEX_TEAM_NUMBER") - call no("NUM_IMAGES_TEAM") - call no("CO_MIN") - call no("CO_MAX") + call no("NOTIFY") ! missing F2023 feature + call no("IMAGE_INDEX_TEAM_NUMBER") ! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126777 + call no("NUM_IMAGES_TEAM") ! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126781 + call no("CO_MIN") ! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126776 + call no("CO_MAX") ! CO_MIN/CO_MAX(character) runtime crash # endif #elif _CRAYFTN + if (.not. stand_alone) return + ! More details in _RELEASE_MINOR, _RELEASE_PATCHLEVEL, _RELEASE_STRING +# if _RELEASE_MAJOR >= 18 + !call set("-hcaf") +# if _RELEASE_MAJOR < 19 + call no("NOTIFY") ! missing F2023 feature +# endif + call set("-DTYPES_PRIF_COMPLIANT=0") + call no("COSHAPE") ! missing F2018 feature + call set("-DIGNORE_FAILURES=2") ! CO_MIN(character) get wrong answer with > 9 images +# endif #endif if (allocated(flags)) write(*,'(A)') flags @@ -133,6 +144,7 @@ subroutine define(flag,val) logical, intent(in) :: val character(:), allocatable :: tmp if (INDEX(flag,"HAVE") > 0 .or. INDEX(flag,"-D") > 0) error stop flag + allocate(character(0) :: tmp) tmp = "-DHAVE_" tmp = tmp // flag if (.not. val) tmp = tmp // "=0" @@ -141,6 +153,7 @@ subroutine define(flag,val) subroutine set(flag) character(*), intent(in) :: flag if (.not. allocated(flags)) then + allocate(character(0) :: flags) flags = "-DHAVE_MULTI_IMAGE" end if flags = flags // " " // flag From 1e4c2ea5837001f8bfcbc026860f94d3f2596b8f Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Thu, 6 Aug 2026 15:24:14 -0700 Subject: [PATCH 13/21] native-multi-image: Add preliminary stand-alone support for Intel Misc cleanups --- app/Makefile | 24 +++++++++++++++-------- app/native-multi-image.F90 | 40 +++++++++++++++++++++++++------------- app/print-native-flags.F90 | 12 ++++++++++++ 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/app/Makefile b/app/Makefile index 7ac266c4..48d9326d 100644 --- a/app/Makefile +++ b/app/Makefile @@ -3,14 +3,14 @@ # overridable settings NUM_IMAGES?=4 -NAGFORTRAN_NUM_IMAGES?=$(NUM_IMAGES) -GFORTRAN_NUM_IMAGES?=$(NUM_IMAGES) FLAGS= NATIVE_FLAGS=$$($(MAKE) --no-print-directory print-flags FC=$$FC) GFORTRAN=gfortran # ---------------------------------------------------------------- +SHELL = bash + all: gcc print-flags: @@ -24,7 +24,7 @@ gcc: export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ $$FC -g -fcoarray=lib $$NATIVE_FLAGS $(FLAGS) \ native-multi-image.F90 -o native-multi-image-gcc -lcaf_shmem - env GFORTRAN_NUM_IMAGES=$(GFORTRAN_NUM_IMAGES) ./native-multi-image-gcc + env GFORTRAN_NUM_IMAGES=$(NUM_IMAGES) ./native-multi-image-gcc nag: @set -x ; \ @@ -34,18 +34,26 @@ nag: native-multi-image.F90 > native-multi-image.i.F90 && \ $$FC -u -g -coarray native-multi-image.i.F90 -o native-multi-image-nag @rm -f native-multi-image.i.F90 - env NAGFORTRAN_NUM_IMAGES=$(NAGFORTRAN_NUM_IMAGES) ./native-multi-image-nag + env NAGFORTRAN_NUM_IMAGES=$(NUM_IMAGES) ./native-multi-image-nag cce: @set -x ; \ export FC=ftn ; \ export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ $$FC -g -hcaf -O0 $$NATIVE_FLAGS $(FLAGS) \ - native-multi-image.F90 -o native-multi-image-cray - ./native-multi-image-cray - srun -n $(NUM_IMAGES) ./native-multi-image-cray + native-multi-image.F90 -o native-multi-image-cce + ./native-multi-image-cce + srun -n $(NUM_IMAGES) ./native-multi-image-cce + +intel: + @set -x ; \ + export FC=ifx ; \ + export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ + $$FC -g -coarray -O0 $$NATIVE_FLAGS $(FLAGS) \ + native-multi-image.F90 -o native-multi-image-intel + env FOR_COARRAY_NUM_IMAGES=$(NUM_IMAGES) ./native-multi-image-intel clean: - rm -f *.mod *.i.F90 native-multi-image-nag native-multi-image-gcc + rm -f *.mod *.i.F90 native-multi-image-{gcc,nag,cce,intel} .PHONY: nag gcc clean diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index 0cdc2b17..d14b0ee5 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -361,9 +361,11 @@ program native_multi_image integer :: me, ni, peer, i, ia(3) character(len=10) :: c, ca(3) -# if HAVE_TEAM_TYPE +# if HAVE_TEAM integer :: team_id type(TEAM_TYPE) :: subteam +# endif +# if HAVE_TEAM_TYPE type(TEAM_TYPE) :: default_team # endif # if HAVE_MAIN_COARRAY @@ -439,40 +441,52 @@ program native_multi_image # endif # if HAVE_CO_MIN STATUS("Testing CO_MIN...") - i = 100*me + i = 10*(ni-me+1) ia = i call CO_MIN(i) - CHECK_VALI(i,100) + CHECK_VALI(i,10) call CO_MIN(i,1) call CO_MIN(ia) - CHECK_ASSERT(all(ia == 100)) + CHECK_ASSERT(all(ia == 10)) call CO_MIN(ia,1) - c = tostring(100*me, len(c)) + c = tostring(10*(ni-me+1), len(c)) ca = c +# if VERBOSE + write(*,'(I3,A,A)') THIS_IMAGE(), ": BEFORE CO_MIN(CHARACTER): ", c +# endif call CO_MIN(c) - CHECK_ASSERT(c == tostring(100, len(c))) +# if VERBOSE + write(*,'(I3,A,A)') THIS_IMAGE(), ": AFTER CO_MIN(CHARACTER): ", c +# endif + CHECK_ASSERT(c == tostring(10, len(c))) call CO_MIN(c,1) call CO_MIN(ca) - CHECK_ASSERT(all(ca == tostring(100, len(c)))) + CHECK_ASSERT(all(ca == tostring(10, len(c)))) call CO_MIN(ca,1) # endif # if HAVE_CO_MAX STATUS("Testing CO_MAX...") - i = 10*me + i = 100*me ia = i call CO_MAX(i) - CHECK_VALI(i,10*ni) + CHECK_VALI(i,100*ni) call CO_MAX(i,1) call CO_MAX(ia) - CHECK_ASSERT(all(ia == 10*ni)) + CHECK_ASSERT(all(ia == 100*ni)) call CO_MAX(ia,1) - c = tostring(10*me, len(c)) + c = tostring(100*me, len(c)) ca = c +# if VERBOSE + write(*,'(I3,A,A)') THIS_IMAGE(), ": BEFORE CO_MAX(CHARACTER): ", c +# endif call CO_MAX(c) - CHECK_ASSERT(c == tostring(10*ni, len(c))) +# if VERBOSE + write(*,'(I3,A,A)') THIS_IMAGE(), ": AFTER CO_MAX(CHARACTER): ", c +# endif + CHECK_ASSERT(c == tostring(100*ni, len(c))) call CO_MAX(c,1) call CO_MAX(ca) - CHECK_ASSERT(all(ca == tostring(10*ni, len(c)))) + CHECK_ASSERT(all(ca == tostring(100*ni, len(c)))) call CO_MAX(ca,1) # endif # if HAVE_CO_BROADCAST diff --git a/app/print-native-flags.F90 b/app/print-native-flags.F90 index 73447235..494a6fa6 100644 --- a/app/print-native-flags.F90 +++ b/app/print-native-flags.F90 @@ -127,6 +127,18 @@ subroutine write_flags call no("COSHAPE") ! missing F2018 feature call set("-DIGNORE_FAILURES=2") ! CO_MIN(character) get wrong answer with > 9 images # endif +#elif __INTEL_COMPILER + if (.not. stand_alone) return +# if __INTEL_COMPILER >= 20250302 + !call set("-coarray") + call set("-DTYPES_PRIF_COMPLIANT=0") + + call no("NOTIFY") ! missing F2023 feature + call no("FORM_TEAM") ! runtime errors on FORM TEAM + call no("CHANGE_TEAM") ! runtime errors on FORM TEAM + call no("TEAM_TYPE") ! avoid runtime errors from CHECK_TYPE_COMPLIANCE + call set("-DIGNORE_FAILURES=4") ! CO_MIN/CO_MAX(character) get the wrong answer at runtime (no change) +# endif #endif if (allocated(flags)) write(*,'(A)') flags From 5f86826543547c31cc5690dcf5be19056d487042 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sat, 8 Aug 2026 22:13:32 -0700 Subject: [PATCH 14/21] native-multi-image: Adjust HAVE_ALLOC_COARRAY for LFortran lfortran#12370 + lfortran#12371 were fixed in https://github.com/lfortran/lfortran/pull/12405, merged after release 0.64 --- app/native-multi-image.F90 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index d14b0ee5..20f0d7c2 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -754,25 +754,19 @@ program native_multi_image allocate(aca_int_1[*]) CHECK_VALL(ALLOCATED(aca_int_1), .true.) -# if !__LFORTRAN__ - ! corank > 1 currently broken: lfortran#12370 - ! trailing lcobound not yet supported: lfortran#12371 allocate(aca_int_2[10:11,*], aca_int_3[100:101,200:202,*]) CHECK_VALL(ALLOCATED(aca_int_2), .true.) CHECK_VALL(ALLOCATED(aca_int_3), .true.) -# endif # if HAVE_ALLOC_COARRAY_DEALLOC STATUS("Testing coarray deallocation...") deallocate(aca_int_1) CHECK_VALL(ALLOCATED(aca_int_1), .false.) -# if !__LFORTRAN__ deallocate(aca_int_2, aca_int_3) CHECK_VALL(ALLOCATED(aca_int_2), .false.) CHECK_VALL(ALLOCATED(aca_int_3), .false.) # endif -# endif # endif call sync_all From d37d373ecf20f059cdb7521209a1ca2d72ebca32 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 9 Aug 2026 14:41:36 -0700 Subject: [PATCH 15/21] fpm.toml: Disable auto-executables This is to allow print-native-flags.F90 to live in the app/ directory, without it being slurped in by `fpm run` as a target --- manifest/fpm.toml.template | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifest/fpm.toml.template b/manifest/fpm.toml.template index 3dd2af8a..0a4b8828 100644 --- a/manifest/fpm.toml.template +++ b/manifest/fpm.toml.template @@ -12,4 +12,10 @@ julienne = {git = "https://github.com/berkeleylab/julienne.git", tag = "4.1.0"} [install] library = true +[[executable]] +name = "native-multi-image" +source-dir = "app" +main = "native-multi-image.F90" + [build] +auto-executables = false From a147aa5bd8b08b41b288dea5bc55cf55e1ea4e71 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 9 Aug 2026 14:53:41 -0700 Subject: [PATCH 16/21] Use print-native-flags to automatically set native flags for supported compilers --- .github/workflows/build.yml | 25 +++---------------------- app/print-native-flags.F90 | 2 +- install.sh | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e725bf9..8d0b4962 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -141,15 +141,11 @@ jobs: compiler: lfortran version: latest container: ghcr.io/lfortran/lfortran:latest - native_multi_image: true - FFLAGS: --coarray=true -DHAVE_TEAM_NUMBER=0 -DHAVE_GET_TEAM=0 -DHAVE_THIS_IMAGE_TEAM=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_COBOUND -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK=0 -DHAVE_NOTIFY=0 - os: ubuntu-22.04 compiler: lfortran version: 0.64 container: ghcr.io/lfortran/lfortran:v0.64.0 - native_multi_image: true - FFLAGS: --coarray=true -DHAVE_TEAM=0 -DHAVE_ALLOC_COARRAY=0 -DHAVE_COARRAY_QUERY=0 -DHAVE_PUTGET_INTRINSIC_ARRAY_CONTIG=0 -DHAVE_EVENT=0 -DHAVE_LOCK=0 -DHAVE_NOTIFY=0 - os: ubuntu-22.04 compiler: lfortran @@ -247,9 +243,6 @@ jobs: env: COMPILER_VERSION: ${{ matrix.version || needs.setup.outputs.BREW_FLANG_VERSION }} - NATIVE_MULTI_IMAGE: ${{ matrix.native_multi_image || - ( matrix.compiler == 'flang' && ( ! matrix.version || matrix.version >= 22 || matrix.version == 'latest' ) ) - }} FFLAGS: ${{ matrix.FFLAGS }} ${{ inputs.fflags }} CFLAGS: ${{ matrix.CFLAGS }} ${{ inputs.cflags }} PREFIX: install @@ -359,15 +352,6 @@ jobs: echo "CC=clang" >> "$GITHUB_ENV" echo "CXX=clang++" >> "$GITHUB_ENV" fi - if [ "${NATIVE_MULTI_IMAGE}" == true ] ; then - if [[ $COMPILER_VERSION == latest ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_THIS_IMAGE_TEAM=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_TEAM_NUMBER_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" - elif [[ $COMPILER_VERSION == 23 ]] ; then - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_ALLOC_COARRAY_CLEANUP=0 -DHAVE_ALLOC_COARRAY_DEALLOC=0 -DHAVE_COARRAY_INIT=0 -DHAVE_COARRAY_LOCAL_ACCESS=0 -DHAVE_IMAGE_INDEX_TEAM=0 -DHAVE_THIS_IMAGE_TEAM=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_TEAM_NUMBER_TEAM=0 -DHAVE_PUTGET=0 -DHAVE_EVENT=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=6" >> "$GITHUB_ENV" - else # $COMPILER_VERSION == 22 - echo "FFLAGS=$FFLAGS -fcoarray -DHAVE_COARRAY=0 -DHAVE_THIS_IMAGE_TEAM=0 -DHAVE_NUM_IMAGES_TEAM=0 -DHAVE_TEAM_NUMBER_TEAM=0 -DHAVE_EVENT_TYPE -DHAVE_LOCK_TYPE -DHAVE_NOTIFY_TYPE -DIGNORE_FAILURES=8" >> "$GITHUB_ENV" - fi - fi - name: Setup lfortran dependencies and variables if: ${{ matrix.compiler == 'lfortran' }} @@ -399,12 +383,6 @@ jobs: if test "${{ matrix.network }}" = "udp"; then echo "GASNET_SUPERNODE_MAXSIZE=1" >> "$GITHUB_ENV" fi - # Turn some knobs for a compiler that natively uses PRIF for multi-image features: - # HAVE_MULTI_IMAGE : controls app/native-multi-image and prif_init testing - # HAVE_MULTI_IMAGE_SUPPORT : force-enable Julienne's multi-image support - if [ "${NATIVE_MULTI_IMAGE}" == true ] ; then - echo "FFLAGS=$FFLAGS -DHAVE_MULTI_IMAGE -DHAVE_MULTI_IMAGE_SUPPORT" >> "$GITHUB_ENV" - fi - name: Set Workflow Dispatch Environment if: github.event_name == 'workflow_dispatch' @@ -451,6 +429,9 @@ jobs: eval echo "$var=\$$var"; done ./install.sh --prefix=${PREFIX} ${NETWORK_ARG} --verbose \ ${{ inputs.install_args }} ${{ matrix.install_filter }} + if ! grep -q 'NATIVEFLAGS=""' run-fpm.sh ; then + echo "NATIVE_MULTI_IMAGE=true" >> "$GITHUB_ENV" + fi ########################################################################## # Caffeine Testing diff --git a/app/print-native-flags.F90 b/app/print-native-flags.F90 index 494a6fa6..ed4fbfd4 100644 --- a/app/print-native-flags.F90 +++ b/app/print-native-flags.F90 @@ -1,5 +1,5 @@ program print_native_flags - use iso_fortran_env + use iso_fortran_env, only: COMPILER_VERSION, COMPILER_OPTIONS implicit none character(:), allocatable :: flags diff --git a/install.sh b/install.sh index e9a256d5..6ee507d3 100755 --- a/install.sh +++ b/install.sh @@ -571,7 +571,9 @@ cat << EOF > $RUN_FPM_SH FPM="${FPM}" FC="`$PKG_CONFIG caffeine --variable=CAFFEINE_FPM_FC`" CC="`$PKG_CONFIG caffeine --variable=CAFFEINE_FPM_CC`" -FFLAGS="$compiler_flag" +NATIVEFLAGS="" +RAWFLAGS="$compiler_flag" +FFLAGS="\$NATIVEFLAGS \$RAWFLAGS" CFLAGS="`$PKG_CONFIG caffeine --variable=CAFFEINE_FPM_CFLAGS`" LDFLAGS="`$PKG_CONFIG caffeine --variable=CAFFEINE_FPM_LDFLAGS`" FPM_DRIVER=\${FPM_DRIVER:-\`realpath \$0\`} @@ -595,6 +597,15 @@ elif echo "build test run install" | grep -w -q -e "\$fpm_sub_cmd" ; then --c-flag "\$CFLAGS" \\ --link-flag "\$LDFLAGS" \\ "\$@" +elif echo "set-native" | grep -w -q -e "\$fpm_sub_cmd" ; then + set -e + cmd="\$FC \$RAWFLAGS app/print-native-flags.F90 -o build/print-native-flags $APPEND_LDFLAGS" + eval \$cmd || (set -x ; eval \$cmd) + NATIVEFLAGS="\`build/print-native-flags\`" + rm -f build/print-native-flags + sed -i.bak 's/^NATIVEFLAGS=.*\$/NATIVEFLAGS="'"\$NATIVEFLAGS"'"/' \$FPM_DRIVER + rm -f \$FPM_DRIVER.bak + echo NATIVEFLAGS=\"\$NATIVEFLAGS\" elif echo "info" | grep -w -q -e "\$fpm_sub_cmd" ; then LINE=-------------------------------------------------- SRCDIR=\$(dirname \$FPM_DRIVER) @@ -656,6 +667,8 @@ chmod u+x $RUN_FPM_SH # for backwards-compatibility of instructions/scripting: ( cd build && ln -f -s ../$RUN_FPM_SH run-fpm.sh ) +./$RUN_FPM_SH set-native + ./$RUN_FPM_SH build $VERBOSE || \ ( set +x echo "Defect reporting information:" From f25e5ac49df64c2e57437223463e20476e05d092 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 9 Aug 2026 19:34:52 -0700 Subject: [PATCH 17/21] CI: issues 205953 and 214080 have been fixed in flang-latest --- app/print-native-flags.F90 | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/print-native-flags.F90 b/app/print-native-flags.F90 index ed4fbfd4..6d35f75f 100644 --- a/app/print-native-flags.F90 +++ b/app/print-native-flags.F90 @@ -32,15 +32,17 @@ subroutine write_flags call yes("NOTIFY_TYPE") call set("-DIGNORE_FAILURES=8") ! type checks for event, notify, lock, team -# elif __flang_major__ >= 23 +# elif __flang_major__ == 23 call set("-fcoarray") - call no("ALLOC_COARRAY_CLEANUP") - call no("ALLOC_COARRAY_DEALLOC") call no("COARRAY_INIT") call no("COARRAY_LOCAL_ACCESS") call no("PUTGET") + ! issue #214080 + call no("ALLOC_COARRAY_CLEANUP") + call no("ALLOC_COARRAY_DEALLOC") + ! issue #205953 call no("IMAGE_INDEX_TEAM") call no("NUM_IMAGES_TEAM") @@ -54,6 +56,21 @@ subroutine write_flags call no("NOTIFY") call yes("NOTIFY_TYPE") + call set("-DIGNORE_FAILURES=6") ! type checks for event, notify, lock +# elif __flang_major__ >= 24 + call set("-fcoarray") + + call no("COARRAY_INIT") + call no("COARRAY_LOCAL_ACCESS") + call no("PUTGET") + + call no("EVENT") + call yes("EVENT_TYPE") + call no("LOCK") + call yes("LOCK_TYPE") + call no("NOTIFY") + call yes("NOTIFY_TYPE") + call set("-DIGNORE_FAILURES=6") ! type checks for event, notify, lock # endif #elif __LFORTRAN__ From 97fb7a59f1554e75fcc6f017de8d5cc69fa09fdd Mon Sep 17 00:00:00 2001 From: bonachea Date: Mon, 10 Aug 2026 17:38:31 -0400 Subject: [PATCH 18/21] app/Makefile: Add command-line override for FC --- app/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Makefile b/app/Makefile index 48d9326d..8e8d4f7d 100644 --- a/app/Makefile +++ b/app/Makefile @@ -6,6 +6,7 @@ NUM_IMAGES?=4 FLAGS= NATIVE_FLAGS=$$($(MAKE) --no-print-directory print-flags FC=$$FC) GFORTRAN=gfortran +FC_FORCE= # ---------------------------------------------------------------- @@ -20,7 +21,7 @@ print-flags: gcc: @set -x ; \ - export FC=$(GFORTRAN) ; \ + export FC=$(if $(FC_FORCE),$(FC_FORCE),$(GFORTRAN)) ; \ export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ $$FC -g -fcoarray=lib $$NATIVE_FLAGS $(FLAGS) \ native-multi-image.F90 -o native-multi-image-gcc -lcaf_shmem @@ -28,7 +29,7 @@ gcc: nag: @set -x ; \ - export FC=nagfor ; \ + export FC=$(if $(FC_FORCE),$(FC_FORCE),nagfor) ; \ export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ $(GFORTRAN) -E -DNAGFOR $$NATIVE_FLAGS $(FLAGS) \ native-multi-image.F90 > native-multi-image.i.F90 && \ @@ -38,7 +39,7 @@ nag: cce: @set -x ; \ - export FC=ftn ; \ + export FC=$(if $(FC_FORCE),$(FC_FORCE),ftn) ; \ export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ $$FC -g -hcaf -O0 $$NATIVE_FLAGS $(FLAGS) \ native-multi-image.F90 -o native-multi-image-cce @@ -47,7 +48,7 @@ cce: intel: @set -x ; \ - export FC=ifx ; \ + export FC=$(if $(FC_FORCE),$(FC_FORCE),ifx) ; \ export NATIVE_FLAGS="$(NATIVE_FLAGS)" && \ $$FC -g -coarray -O0 $$NATIVE_FLAGS $(FLAGS) \ native-multi-image.F90 -o native-multi-image-intel From b0f2b664af36d017a02f8eb5c127da45fd911816 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Tue, 11 Aug 2026 13:05:38 -0700 Subject: [PATCH 19/21] CI: Ensure we catch failures of native-image-test --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d0b4962..429e97a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -449,6 +449,7 @@ jobs: if: ${{ env.NATIVE_MULTI_IMAGE == 'true' }} run: | ./run-fpm.sh run --verbose 2>&1 | tee output + test ${PIPESTATUS[0]} = 0 if [[ "${{ matrix.network }}" != "udp" ]] ; then # ignore intermittent INEXACT exceptions from AMUDP at exit time ! grep -q "IEEE arithmetic exceptions signaled" output From 6fc1e06fb4014ac77abe6e00698de934cff17c74 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Wed, 12 Aug 2026 11:52:57 -0700 Subject: [PATCH 20/21] CI: Update flang-latest to 23.1.0-RC3 This includes fixes to LLVM issues 214080 and 205953 --- .github/workflows/build.yml | 4 ++-- app/print-native-flags.F90 | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 429e97a2..41c8031f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -115,7 +115,7 @@ jobs: - os: ubuntu-24.04 compiler: flang version: 23 - container: phhargrove/llvm-flang:23.1.0_rc2-latest + container: phhargrove/llvm-flang:23.1.0_rc3-latest - os: ubuntu-24.04 compiler: flang version: 22 @@ -229,7 +229,7 @@ jobs: compiler: flang version: 23 network: udp - container: phhargrove/llvm-flang:23.1.0_rc2-latest + container: phhargrove/llvm-flang:23.1.0_rc3-latest - os: ubuntu-24.04 compiler: flang version: latest diff --git a/app/print-native-flags.F90 b/app/print-native-flags.F90 index 6d35f75f..aee9f7b1 100644 --- a/app/print-native-flags.F90 +++ b/app/print-native-flags.F90 @@ -39,16 +39,6 @@ subroutine write_flags call no("COARRAY_LOCAL_ACCESS") call no("PUTGET") - ! issue #214080 - call no("ALLOC_COARRAY_CLEANUP") - call no("ALLOC_COARRAY_DEALLOC") - - ! issue #205953 - call no("IMAGE_INDEX_TEAM") - call no("NUM_IMAGES_TEAM") - call no("THIS_IMAGE_TEAM") - call no("TEAM_NUMBER_TEAM") - call no("EVENT") call yes("EVENT_TYPE") call no("LOCK") From f6f3b3e7b36334e4c807d99760ed3add65382b41 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Wed, 12 Aug 2026 20:22:25 -0700 Subject: [PATCH 21/21] CI: Add coverage for LFortran COSHAPE --- app/print-native-flags.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/print-native-flags.F90 b/app/print-native-flags.F90 index aee9f7b1..1480b470 100644 --- a/app/print-native-flags.F90 +++ b/app/print-native-flags.F90 @@ -92,8 +92,8 @@ subroutine write_flags call no("TEAM_NUMBER") call no("ALLOC_COARRAY_CLEANUP") - call no("COARRAY_QUERY") - call yes("COBOUND") + call no("IMAGE_INDEX") + call no("THIS_IMAGE_COARRAY") call no("PUTGET_INTRINSIC_ARRAY_CONTIG") call no("EVENT")