-
Notifications
You must be signed in to change notification settings - Fork 16
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
Partitioned multidimensional arrays (generalize PVector into PArray) #97
Comments
Yes, this is in the scope definitively and multidimensional stencil computations are already supported via PVector with n_per_dir = (10,10,10)
np_per_dir = (2,3,2)
ghost_per_dir = (true,true,true)
periodic_per_dir = (false,true,true)
ranks = LinearIndices(n_per_dir)
index_partition = uniform_partition(ranks,np_per_dir,n_per_dir,ghost_per_dir,periodic_per_dir)
v = pzeros(index_partition) The Pvector v is the 1d version of a 10x10x10 multidimensional array split in 2x3x2 parts with ghost in all directions and periodic boundaries (influences the definition of ghost) in the 2nd and 3rd axis. |
Note that you might need a ghost layer of thickness more than 1 for higher-order finite-difference stencils. Yes, I was indeed thinking of matrix-free and explicit methods. |
Generalizing the thickness of the ghost layer should be very easy. I think it is as easy as changing the hardcoded PartitionedArrays.jl/src/p_range.jl Line 702 in 3349755
If I am not wrong, this would allow using |
Hi~, I changed the "start-=1 and stop+=1" to "start-=2 and stop+=2" in the local_range function. This change works in the uniform_partition function but failed in the consistent! function. |
Hi @ZhangFengshun this looks promising, but we do not want to hard code 2 as the thickness of the ghost layer. Instead we want to use the value of variable 'ghost' already available in these functions. Now 'ghost' is assumed to be a bool, but we want to generalise it to an arbitrary integer. Feel free to propose the required changes. |
Done in #173 |
For parallel stencil computations (e.g. finite-difference methods), it would be nice to have partitioned multidimensional arrays, with support for arbitrary thickness "ghost" overlap regions (so that you could loop over just the interior of each partition and the ghost regions would handle the stencil boundaries).
Not sure whether that is in scope for this package, or if it is something that should be implemented in another package on top of
PVector
?It would be nice to at least broaden
PVector
toPArray
(withPVector
as an alias forPArray{1}
) — same machinery, just multidimensional arrays as storage and either arrays of linear indices or arrays ofCartesianIndex
for theindex_partition
. Matrix-free stencil support could then be implemented in an add-on package.The text was updated successfully, but these errors were encountered: