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]

Re: Co-Array with OpenACC


On 09/23/2016 07:25 AM, Vikram Singh wrote:
> 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?

Not at the moment. We're trying to keep make gcc comply with OpenACC
2.0a. As it stands right now, there's already some incompatibility with
gcc's implementation with other compiler vendors because not everyone
interprets the spec the same (e.g. some compilers don't enforce the
nested acc loop restrictions for the gang, worker, vector and seq
clauses). So, for the sake of future compatibility, it's would probably
be best to wait until the OpenACC committee addresses that issue before
we add support for it.

> 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

In general, gcc/gfortran has weak support for acc kernels. For better
performance it is recommended that you use acc parallel instead.

Cesar


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