Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support CFI non-contiguous array arguments #23

Open
jeffhammond opened this issue Dec 4, 2022 · 1 comment
Open

support CFI non-contiguous array arguments #23

jeffhammond opened this issue Dec 4, 2022 · 1 comment
Assignees

Comments

@jeffhammond
Copy link
Owner

We need to implement non-contiguous support in CFI.

https://github.com/jeffhammond/vapaa/blob/main/tests/test_vector_noncontig.F90#L34 tests this.

@jeffhammond jeffhammond self-assigned this Dec 4, 2022
@jeffhammond jeffhammond changed the title support CFI non-contigu support CFI non-contiguous array arguments Dec 4, 2022
@jeffhammond
Copy link
Owner Author

There are at least 3 cases to consider, where we assume the buffer is a non-contiguous subarray.

Vector case

The datatype argument corresponds to an element of the array or is a contiguous datatype AND the total number of elements expressed by (count,datatype) evenly divides the buffer.

Easy example:

integer, dimension(4,4) :: A
call MPI_Bcast(A(1:3,1:3), 9, MPI_INTEGER, 0, MPI_COMM_WORLD)

Hard example:

integer, dimension(4,4) :: A
call MPI_Bcast(A(1:3,1:3), 6, MPI_INTEGER, 0, MPI_COMM_WORLD)

The latter works, because the count works out to an even multiple of the dimensions up to the last one. We can still use vector datatypes here.

Indexed case

The datatype argument corresponds to an element of the array or is a contiguous datatype but the total number of elements expressed by (count,datatype) does not evenly divide the buffer.

Example:

integer, dimension(4,4) :: A
call MPI_Bcast(A(1:3,1:3), 7, MPI_INTEGER, 0, MPI_COMM_WORLD)

This one is hard, because we need to use an indexed type to express subblocks of different sizes.

Doubly non-contiguous case

The datatype argument is a non-contiguous derived datatype.

Example:

integer :: A(100)
type(MPI_Datatype) :: v
call MPI_Type_vector(25,1,2,MPI_INTEGER,v)
call MPI_Type_commit(v)
call MPI_Bcast( A(2:100:2), 1, v, 0, MPI_COMM_WORLD)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant