-
Notifications
You must be signed in to change notification settings - Fork 17
Missing: Array of Parrays to Parray of Arrays #119
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
Comments
I see 2 possible solutions:
Both solutions are compatible |
The solution I now have is function to_parray_of_arrays(a::AbstractArray{<:MPIArray})
indices = linear_indices(first(a))
map(indices) do i
map(a) do aj
PartitionedArrays.getany(aj)
end
end
end
function to_parray_of_arrays(a::AbstractArray{<:DebugArray})
indices = linear_indices(first(a))
map(indices) do i
map(a) do aj
aj.items[i]
end
end
end My question was if you'd like this implemented in PartitionedArrays (since it is a generic use case) or not. |
Hi @JordiManyer I would go with this other option:
|
Hi @fverdugo, I think there is a functionality missing that could be useful in some cases. Again, I might be missing something but I haven't found an elegant way of dealing with it.
It involves converting an Array of PArrays to a PArray of Arrays. Consider the following example:
The current code works fine for
MPIArray
s, but not forDebugArray
s (sincegetany
always returns the first element). The old solution (commented) does not work anymore since there is no way to access a particular element in aDebugArray
/MPIArray
without getting an error/warning (even if it is safe to do so).I think the solution to this involves a new function (basically an analog to
tuple_of_arrays
) that specializes forDebugArray
andMPIArray
. Would that be something you would like to have inPartitionedArrays
?The text was updated successfully, but these errors were encountered: