This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Co-Array with OpenACC


Now that GCC has both co-array and openacc host_data support I decided
to try out whether it can handle both together.

Below you'll find a simple code that does some stuff inside a loop and
then I do a single data exchange. I put it inside host_data assuming
that there's some mpi exchange happening underneath which presumably
works with host_data according to Nvidia.

Unfortunately it does not work. Is it possible that this could be fixed?


program acc_coarray

    use iso_c_binding
    use openacc

    implicit none

    integer(c_int) :: ngpus

    integer(c_int), parameter :: N = 1000

    real(c_double) :: x(N)[*], y(N)[*], z(N)[*]
    integer(c_int) :: i, b, nprocs

    b = this_image()
    call acc_set_device_num(b, acc_device_nvidia)

    !$acc enter data create(x, y, z)

    !$acc kernels
    do i = 1, N
        x(i) = i*i
        y(i) = i + y(i-1)

        z(i) = b*x(i) + y(i)
    end do
    !$acc end kernels

    !$acc host_data use_device(z)
    z(1)[1] = z(1)[2]
    !$acc end host_data

    sync all()

    !$acc update self(z)

    !$acc exit data delete(x, y, z)

    if (this_image() .eq. 1) then
        do i = 1, num_images()
            write(*, *) "Values on process ", i
            write(*, *) z(1:4)[i]
        end do
    end if


end program acc_coarray


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]