Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
compiler: flang
version: latest
container: snowstep/llvm:ubuntu-24.04-latest
FFLAGS: -DHAVE_COARRAY

# https://hub.docker.com/r/phhargrove/llvm-flang/tags
- os: ubuntu-24.04
Expand Down Expand Up @@ -200,6 +201,7 @@ jobs:
version: latest
network: udp
container: snowstep/llvm:ubuntu-24.04-latest
FFLAGS: -DHAVE_COARRAY

container:
image: ${{ matrix.container }}
Expand Down
39 changes: 39 additions & 0 deletions app/native-multi-image.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ program native_multi_image
#ifndef HAVE_SYNC_IMAGES
#define HAVE_SYNC_IMAGES HAVE_SYNC
#endif

#ifndef HAVE_COLLECTIVES
#define HAVE_COLLECTIVES 1
#endif
Expand All @@ -35,8 +36,19 @@ program native_multi_image
#ifndef HAVE_CO_BROADCAST
#define HAVE_CO_BROADCAST HAVE_COLLECTIVES
#endif

#ifndef HAVE_TEAM
#define HAVE_TEAM 1
#endif

#ifndef HAVE_COARRAY
#define HAVE_COARRAY 0
#endif
#ifndef HAVE_MAIN_COARRAY
#define HAVE_MAIN_COARRAY HAVE_COARRAY
#endif
#ifndef HAVE_ALLOC_COARRAY
#define HAVE_ALLOC_COARRAY HAVE_COARRAY
#endif

USE, INTRINSIC :: ISO_FORTRAN_ENV
Expand All @@ -46,6 +58,11 @@ program native_multi_image
integer :: team_id
type(TEAM_TYPE) :: subteam, res
# endif
# if HAVE_MAIN_COARRAY
integer :: sca_int_1[*]
integer :: sca_int_2[2,*]
integer :: sca_int_3[2,3,*]
# endif

me = THIS_IMAGE()
ni = NUM_IMAGES()
Expand Down Expand Up @@ -126,6 +143,10 @@ program native_multi_image
write(*,'(A,I3)') "After END TEAM statement, TEAM_NUMBER() is ", TEAM_NUMBER()
# endif

call sync_all
call test_allocatable_coarray
call test_allocatable_coarray

call sync_all
write(*,'(A,I1,A,I1,A)') "Goodbye from image ", me, " of ", ni, " images"

Expand Down Expand Up @@ -153,6 +174,24 @@ subroutine status(str)
call sync_all
end subroutine

subroutine test_allocatable_coarray()
# if HAVE_ALLOC_COARRAY
logical, save :: once = .true.
integer, allocatable :: aca_int_1[:]
integer, allocatable :: aca_int_2[:,:]
integer, save, allocatable :: aca_int_3[:,:,:]
if (once) then
once = .false.
call status("Testing ALLOCATABLE coarrays...")
print *, ALLOCATED(aca_int_1), ALLOCATED(aca_int_2), ALLOCATED(aca_int_3)
ALLOCATE(aca_int_1[*])
ALLOCATE(aca_int_2[2,*])
ALLOCATE(aca_int_3[2,3,*])
end if
print *, ALLOCATED(aca_int_1), ALLOCATED(aca_int_2), ALLOCATED(aca_int_3)
# endif
end subroutine

#else
stop "Native multi-image test disabled"
#endif
Expand Down