From 3185a89f1e407c342ec0befb8ad8ad6320761609 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Tue, 24 Nov 2026 20:45:42 -0800 Subject: [PATCH 1/4] print-native-flags: Stop testing flang types we know are broken LOCK_TYPE, NOTIFY_TYPE and (until recently) EVENT_TYPE are not yet PRIF compliant in flang, but the corresponding multi-image features are also not yet implemented in those flang versions, so this has no practical effect. Testing for things we know are not yet properly implemented just generates scary-looking error messages that might confuse end users, with no real benefit. --- app/print-native-flags.F90 | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/app/print-native-flags.F90 b/app/print-native-flags.F90 index 704f8b56..e15269a2 100644 --- a/app/print-native-flags.F90 +++ b/app/print-native-flags.F90 @@ -32,11 +32,7 @@ subroutine write_flags 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 + call set("-DIGNORE_FAILURES=2") ! type checks for team # elif __flang_major__ == 23 call set("-fcoarray") @@ -45,13 +41,8 @@ subroutine write_flags 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 # elif __flang_major__ >= 24 call set("-fcoarray") @@ -62,11 +53,7 @@ subroutine write_flags call yes("EVENT") call no("EVENT_QUERY") call no("LOCK") - call yes("LOCK_TYPE") call no("NOTIFY") - call yes("NOTIFY_TYPE") - - call set("-DIGNORE_FAILURES=4") ! type checks for notify, lock # endif #elif __LFORTRAN__ # if __LFORTRAN_MAJOR__ == 0 && __LFORTRAN_MINOR__ <= 63 From 4a3a8bfb653f19e6fb19548f7b3555ac5e68850b Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Tue, 1 Dec 2026 11:48:25 -0800 Subject: [PATCH 2/4] native-multi-image: Add coverage for IMAGE_STATUS, FAILED_IMAGES, STOPPED_IMAGES Also define all the image query knobs together --- app/native-multi-image.F90 | 83 +++++++++++++++++++++++++++++++++++--- app/print-native-flags.F90 | 8 ++++ 2 files changed, 85 insertions(+), 6 deletions(-) diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index b64db981..d783d919 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -19,6 +19,35 @@ #define HAVE_SYNC_IMAGES HAVE_SYNC #endif +#ifndef HAVE_IMAGE_QUERY +#define HAVE_IMAGE_QUERY 1 +#endif +! We silently assume/require 0-argument NUM_IMAGES and THIS_IMAGE +#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_IMAGE_STATUS +#define HAVE_IMAGE_STATUS HAVE_IMAGE_QUERY +#endif +#ifndef HAVE_IMAGE_STATUS_TEAM +#define HAVE_IMAGE_STATUS_TEAM ( HAVE_IMAGE_QUERY && HAVE_TEAM ) +#endif +#ifndef HAVE_FAILED_IMAGES +#define HAVE_FAILED_IMAGES HAVE_IMAGE_QUERY +#endif +#ifndef HAVE_FAILED_IMAGES_TEAM +#define HAVE_FAILED_IMAGES_TEAM ( HAVE_IMAGE_QUERY && HAVE_TEAM ) +#endif +#ifndef HAVE_STOPPED_IMAGES +#define HAVE_STOPPED_IMAGES HAVE_IMAGE_QUERY +#endif +#ifndef HAVE_STOPPED_IMAGES_TEAM +#define HAVE_STOPPED_IMAGES_TEAM ( HAVE_IMAGE_QUERY && HAVE_TEAM ) +#endif + #ifndef HAVE_COLLECTIVES #define HAVE_COLLECTIVES 1 #endif @@ -71,12 +100,6 @@ #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 @@ -454,6 +477,31 @@ program native_multi_image if (me /= peer) SYNC IMAGES([me, peer]) #endif +# if HAVE_IMAGE_STATUS + STATUS("Testing IMAGE_STATUS...") + CHECK_VALI(IMAGE_STATUS(1),0) + CHECK_VALI(IMAGE_STATUS(me),0) + CHECK_VALI(IMAGE_STATUS(ni),0) +# endif + +# if HAVE_FAILED_IMAGES + STATUS("Testing FAILED_IMAGES...") + block + integer, allocatable :: aa(:) + aa = FAILED_IMAGES() + CHECK_VALI(SIZE(aa),0) + end block +# endif + +# if HAVE_STOPPED_IMAGES + STATUS("Testing STOPPED_IMAGES...") + block + integer, allocatable :: aa(:) + aa = STOPPED_IMAGES() + CHECK_VALI(SIZE(aa),0) + end block +# endif + # if HAVE_CO_SUM STATUS("Testing CO_SUM...") i = me @@ -610,6 +658,29 @@ program native_multi_image CHECK_VALI(TEAM_NUMBER(TEAM=GET_TEAM(INITIAL_TEAM)),-1) # endif # endif +# if HAVE_IMAGE_STATUS_TEAM + CHECK_VALI(IMAGE_STATUS(1,subteam),0) + CHECK_VALI(IMAGE_STATUS(THIS_IMAGE(),TEAM=subteam),0) + CHECK_VALI(IMAGE_STATUS(NUM_IMAGES(),TEAM=subteam),0) +# endif +# if HAVE_FAILED_IMAGES_TEAM + block + integer, allocatable :: aa(:) + aa = FAILED_IMAGES() + CHECK_VALI(SIZE(aa),0) + aa = FAILED_IMAGES(subteam) + CHECK_VALI(SIZE(aa),0) + end block +# endif +# if HAVE_STOPPED_IMAGES_TEAM + block + integer, allocatable :: aa(:) + aa = STOPPED_IMAGES() + CHECK_VALI(SIZE(aa),0) + aa = STOPPED_IMAGES(subteam) + CHECK_VALI(SIZE(aa),0) + end block +# endif # endif END TEAM call sync_all diff --git a/app/print-native-flags.F90 b/app/print-native-flags.F90 index e15269a2..979c6d8f 100644 --- a/app/print-native-flags.F90 +++ b/app/print-native-flags.F90 @@ -26,6 +26,7 @@ subroutine write_flags call set("-fcoarray") call no("COARRAY") + call no("IMAGE_QUERY") ! issue #205953 call no("NUM_IMAGES_TEAM") @@ -36,6 +37,7 @@ subroutine write_flags # elif __flang_major__ == 23 call set("-fcoarray") + call no("IMAGE_QUERY") call no("COARRAY_INIT") call no("COARRAY_LOCAL_ACCESS") call no("PUTGET") @@ -46,6 +48,7 @@ subroutine write_flags # elif __flang_major__ >= 24 call set("-fcoarray") + call no("IMAGE_QUERY") call no("COARRAY_INIT") call no("COARRAY_LOCAL_ACCESS") call no("PUTGET") @@ -61,6 +64,7 @@ subroutine write_flags # else call set("--coarray=true") call set("--realloc-lhs-arrays") + call no("IMAGE_QUERY") call no("EVENT") call no("LOCK") call no("NOTIFY") @@ -118,6 +122,10 @@ subroutine write_flags !call set("-coarray=cosmp") ! set in Makefile call set("-DTYPES_PRIF_COMPLIANT=0") + call no("FAILED_IMAGES_TEAM") ! missing F2018 feature + call no("STOPPED_IMAGES_TEAM") ! missing F2018 feature + call no("IMAGE_STATUS_TEAM") ! missing F2018 feature + call no("NOTIFY") ! missing F2023 feature # endif #elif __GFORTRAN__ From 44ef4dc782b741a4ab7788ddad6830f1c08b67f1 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Wed, 2 Dec 2026 14:39:32 -0500 Subject: [PATCH 3/4] Apply suggestions from code review * Make the new _TEAM defines depend on the feature instead of HAVE_IMAGE_QUERY * Remove the duplicate zero-argument tests of {STOPPED,FAILED}_IMAGES inside the CHANGE TEAM Co-authored-by: Katherine Rasmussen --- app/native-multi-image.F90 | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index d783d919..acc516f0 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -22,7 +22,7 @@ #ifndef HAVE_IMAGE_QUERY #define HAVE_IMAGE_QUERY 1 #endif -! We silently assume/require 0-argument NUM_IMAGES and THIS_IMAGE +! We silently assume/require support for NUM_IMAGES and THIS_IMAGE with no arguments #ifndef HAVE_THIS_IMAGE_TEAM #define HAVE_THIS_IMAGE_TEAM HAVE_TEAM #endif @@ -33,19 +33,19 @@ #define HAVE_IMAGE_STATUS HAVE_IMAGE_QUERY #endif #ifndef HAVE_IMAGE_STATUS_TEAM -#define HAVE_IMAGE_STATUS_TEAM ( HAVE_IMAGE_QUERY && HAVE_TEAM ) +#define HAVE_IMAGE_STATUS_TEAM ( HAVE_IMAGE_STATUS && HAVE_TEAM ) #endif #ifndef HAVE_FAILED_IMAGES #define HAVE_FAILED_IMAGES HAVE_IMAGE_QUERY #endif #ifndef HAVE_FAILED_IMAGES_TEAM -#define HAVE_FAILED_IMAGES_TEAM ( HAVE_IMAGE_QUERY && HAVE_TEAM ) +#define HAVE_FAILED_IMAGES_TEAM ( HAVE_FAILED_IMAGES && HAVE_TEAM ) #endif #ifndef HAVE_STOPPED_IMAGES #define HAVE_STOPPED_IMAGES HAVE_IMAGE_QUERY #endif #ifndef HAVE_STOPPED_IMAGES_TEAM -#define HAVE_STOPPED_IMAGES_TEAM ( HAVE_IMAGE_QUERY && HAVE_TEAM ) +#define HAVE_STOPPED_IMAGES_TEAM ( HAVE_STOPPED_IMAGES && HAVE_TEAM ) #endif #ifndef HAVE_COLLECTIVES @@ -666,8 +666,6 @@ program native_multi_image # if HAVE_FAILED_IMAGES_TEAM block integer, allocatable :: aa(:) - aa = FAILED_IMAGES() - CHECK_VALI(SIZE(aa),0) aa = FAILED_IMAGES(subteam) CHECK_VALI(SIZE(aa),0) end block @@ -675,8 +673,6 @@ program native_multi_image # if HAVE_STOPPED_IMAGES_TEAM block integer, allocatable :: aa(:) - aa = STOPPED_IMAGES() - CHECK_VALI(SIZE(aa),0) aa = STOPPED_IMAGES(subteam) CHECK_VALI(SIZE(aa),0) end block From 7abc4dd3b3c7d4bec716b4de8bae62bb5dd02c3a Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Wed, 2 Dec 2026 12:24:03 -0800 Subject: [PATCH 4/4] native-multi-image: Workaround a CCE defect in coarray initialization An apparent CCE defect in the implementation of event coarray allocation was causing intermittent hangs within the subtest: "Testing event post / event wait (allocatable array)..." Based on a debugger it appears to be caused by a race between default initialization of event_type within coarray allocation on image 1, and event posts from other images. The standard mandates synchronization after ALLOCATE and before any subsequent statement so there should be no race possible here, but CCE does not appear to correctly enforce that. Adding a barrier (that should be redundant/superfluous) is sufficient to workaround the defect in testing. --- app/native-multi-image.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/native-multi-image.F90 b/app/native-multi-image.F90 index acc516f0..116a9fd6 100644 --- a/app/native-multi-image.F90 +++ b/app/native-multi-image.F90 @@ -868,6 +868,10 @@ program native_multi_image # if HAVE_EVENT_POST_WAIT_ARRAY STATUS("Testing event post / event wait (allocatable array)...") allocate(test_event_arr(4)[*]) +# ifdef _CRAYFTN + ! workaround an initialization race seen on CCE 21 + sync all +# endif if (THIS_IMAGE() == 1) then do i = 1, size(test_event_arr) event post (test_event_arr(i))