Are multidimensional array assignment and array-valued functions still restrictions for OpenACC

Hi,

I am wondering whether multidimensional array assignment 

and array-valued functions are still restrictions for OpenACC, if using Fortran. For the mult-idimensional array assignment, does the number of dimensions of the multi-dimensional array need to be specified? For the array-valued functions, is the result from the function call stored in a temporary array and subsequently assigned to the array specified on the left-hand side of the statement? Also, are Fortran intrinsic functions (such as matmul) that have array-valued results supported within OpenACC kernels? Should I still tranform array-valued functions into subroutines with intent(out), if the second restriction exists? Thanks!

Best,

Hi weich97,

Can you provide more context or an example? Array syntax using multidimensional array assignment has been around for many years, but without understand what scenario you’re meaning, it difficult to offer suggestions. Here’s a very simple example:

% cat test.f90
program test
        real :: array(2, 2)
        array = 1.
        !$acc kernels
        array = 10.0
        !$acc end kernels
        print *, array
endprogram
% nvfortran -acc -Minfo=accel test.f90; a.out
test:
      4, Generating implicit copyout(array(:,:)) [if not already present]
      5, Loop is parallelizable
         Generating Tesla code
          5,   ! blockidx%x threadidx%x auto-collapsed
             !$acc loop gang, vector(32) collapse(2) ! blockidx%x threadidx%x
    10.00000        10.00000        10.00000        10.00000

As for array-valued functions returning array, it’s not a code pattern that I’ve seen often and not sure what our current status is. Can you provide an example of what you’re looking for?

In general, I try to avoid cases which would trigger a compiler generated temp array, especially if needs to be allocated. This can cause a severe performance penalty. So in general, I’d say it’s most likely better to pass in the array rather have it be returned.

-Mat