Reputation: 13
I am currently using Arrayfire to speed up a Fortran CFD solver. The way we implement Fortran arrays means that a 2 dimensional Fortran array is represented by (N,M,1) rather than just (N,M), allowing allocatable arrays to deal with either 2 or 3 dimensional arguments. However, when one of these is copied to the device to become an Arrayfire Array, it seems to automatically be given the dimensions (N,M) rather than (N,M,1). This is leading to dimension mismatches when the array is copied back to the host.
Is there any way to change this behaviour? It would be rather tricky to rewrite the majority of the solver to treat 2 dimensional arrays differently.
Here is a testcase which displays this behaviour:
program testcase
use arrayfire
implicit none
real,dimension(4,4,1) :: a = 5.0
real,dimension(:,:,:),allocatable :: b
type(array) ARR1
ARR1 = a
b=ARR1
end program testcase
I have also asked this on the Arrayfire forums but was just wondering if anybody else had came across this as an issue.
EDIT: This is no longer a problem as only the test cases were being performed with 2D arrays.
Thanks, Harry
Upvotes: 0
Views: 175
Reputation: 5893
(Answered in the comments and edits. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
This is no longer a problem as only the test cases were being performed with 2D arrays.
Upvotes: 1