-
Notifications
You must be signed in to change notification settings - Fork 42
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
Gather scatter #52
base: develop
Are you sure you want to change the base?
Gather scatter #52
Conversation
Hello Willem, I have looked at the slicer function which is nice for people working with views a of known rank, but I cannot see how I could use it to reduce a view with N dimensions to a list of views of dimension 1. I have to do that recursively, but I cannot write code such as :
because I need to handle a view of an arbitrary rank, and the code above deals with views of rank 4 only. Hence I thought I could create a function which removes a dimension to a view, whatever its dimension : Please look at dropDimension (arrayViewHelpers.h) and reconsider this point, or tell me how to address my basic need which is to create a list of views of dimension 1 from a view of any rank. Philippe |
Hello again, This is the code you wrote :
In this case, the fastest varying dimension is Is it reasonable to make this assumption or not ? Philippe |
Hello again, What you ask for :
Looks very feasible to me with what I propose. In fact the ioFieldDescriptor lets the user distribute the fields in any possible way. It would be possible to choose a target processor for any of the Philippe |
You are completely right about the slicing :) I was considering this as well after I wrote my reply, but still wondered if it could be useful or were aware. It will be good to have. This will mess up perhaps the API of gather/scatter which expects an ArrayView. Perhaps that can be templated to accept both LocalView and ArrayView. |
I have to admit that I had not this in mind at all :
I do not think it happens in ARPEGE/IFS for grid-point fields, only for spectral data we do stuff like that; but spectral data requires a slightly different treatment. Achieving something like that is probably possible, I need to think about it. It is clear we would need to specify for each field which dimension is the grid index. In any case, I think the assumption I suggested to make (ie contiguous field dimension) would not resist it. Philippe |
Hello Willem, I can make this code work :
It is sufficient that the user explicitly states which dimension is the grid index; then I can drop all other dimensions while reducing the view to a list of 1D views. Same thing for NPROMA/NGPBLKS dimensions; I can easily add a blocking dimension. Note that fields without NPROMA (that is with a dimension 1:NGPTOT) are just a special case (single block, NPROMA=NGPTOT). To be more explicit, the ioFieldDesc objects are essentially this :
ioFieldDesc objects therefore hold a chunk of field data and associated metadata (for fields with a level, the _ind member would hold the level index). I do not know a lot about the difference between ArrayView and LocalView, but I am pretty sure we can sort out the problem using templates. I have also made this assumption :
This simplifies things (I do not need a functionspace anymore, but only the distribution object). I would like you to comment on that. You also address the issue of metadata. These are small and of unpredictable size; therefore, it would be better not to pack them with field data, but rather distribute them using an allgather. The situation would be different for an IO server but we can see that later. Please also keep in mind that we are breaking the MPI standard (packing double/long data as bytes); but this allows much more flexibility. |
|
I will provide some tests/examples with NPROMA/NGPBLKS and NGPTOT/NFLEVG. It will take a few days. |
Thank you Philippe, having this functionality will be really great. |
Hello Willem, I have added two new test cases (I use Fortran order to describe them) :
Both of them are included in test_gatherscatter.cc. Please look at them and see whether you find that sensible. There are other points we should sort out :
Regards, Philippe |
…cal-64 to develop * commit 'b26965ddfd3c31feecb07578de61ae20a2742d2d': ATLAS-317 Prevent integer overflows if ATLAS_BITS_LOCAL=64 ATLAS-317 Support ATLAS_BITS_LOCAL=64 in tests
This is a proposal for improving the current gather/scatter methods.
Some minor modifications have to be applied to Atlas :
I have assumed that for a distributed field, jloc1 < jloc2 <=> jglo1 < jglo2, jglo being the global indice, and jloc the local indice (on the current task), but I can do without this assumption.
The proposal, although not finalized yet, makes it possible :
The proposal includes two new features (these should be implemented as new methods for views) :
These templates are included in this file : arrayViewHelpers.h, and make it possible to recursively build a list of views of type atlas::array::ArrayView<byte,2> from any view (any type, any rank). The first dimension of atlas::array::ArrayView<byte,2> is the fastest varying dimension of the original view, and the second has a length which corresponds to the type size.
The GatherScatter class handles only atlas::array::ArrayView<byte,2> views, which makes the code quite simple, as all type and rank issues have already been resolved. This could be even simpler is we could assume that the fastest varying dimension of Atlas fields had a stride ==1 (this should be always the case); in this case, we could restrict ourselves to atlas::array::ArrayView<byte,1> views.
Some further possible improvements :