Since these are allocatable arrays and hence have a F90 array descriptor which contains the bounds information, you shouldn’t need to pass this information. Are you encountering an error?
Hi Mat,
I didn’t have a runtime error. But in CPU, suppose the memory address is
arr_J[0] at address 100
arr_J[1] at address 101
if I don’t pass the dimension explicitly to the function, say
function foo(arr_J)
real, dimension(:) :: arr_J
arr_J(1) = 10
end function
the first element of the zero-based allocated array arr_J(1) will be interpreted as location 100. So, I don’t know how it works with GPU data.
UPDATE: The above fact maybe wrong. Please correct me! Based on your answer, it means that the dimension information is kept with ‘allocatable’ array, so it doesn’t matter if we pass the explicit dimension information or not to the function that use this ‘allocatable’ array?