ADIOS2
ADIOS2 copied to clipboard
fortran error code
Please try a simple change in this file: examples/hello/bpFWriteCRead/FReader.f90: sel_start = (/ 10, 2 /) instead of sel_start = (/ 0, 2 /)
and compile.
The bin/FReader expects to read the file written by bin/CppWriter
you can see the ierr is 0 from calls of: adios2_set_selection() adios2_get()
An error shall be returned from at least one of them.
Thanks,
- Junmin
Just following up on this old issue. This is a specific example of a situation where the reader requests data which has not been written and is therefore not available. My impression is that ADIOS has never returned an error in these situations. One might argue that in a simple situation (like this one, where the requested range isn't within the declared global dimensions of the variable) this isn't hard and we should throw an exception (which should then be caught and turned into an error in the C/Fortran bindings). But the general case of a Get() asking for data that isn't there is harder. It's not an error, for example, for an application to only write pieces of a global array, leaving some values in the virtual space unwritten. A Get() for that variable will not throw an error if your selection includes unwritten data partly because doing that check is expensive, particularly in N dimensions.
So, what would you like here? Throwing an error on set_selection does some checks now, at least checking to see that a selection is appropriate for that variable type, that the dimensionality of the selection is the same as that of the variable, etc. We could maybe do more checks there, and that would work for streaming engines (where you have to set the selection on every step, at which time we already know the geometry of the variable and can at least check against the global dimensions). But for file engines that support read random access, you'd really have to push off the check until Get(). We could detect the simple case that there can be no overlap between the written global size and the selection...
BTW, I think it also isn't an error to write outside the declared size of a global array, and some engines might consider that a feature and deliver that data if you ask for it (as above). There are probably a lot of these cases that might be considered erroneous that we don't actively search for...
When reading a variable , the dimensions are known from metadata, so I would prefer reporting error if the read selection is out of bound. How would reader know they are wrong?
And true, in some use cases, maybe it does not matter.
I am fine either way, as long as ADIOS is consistent across engines/APIs.
Well, the reading application is generally assumed to have queried the dimensions and formed its request appropriately, so anything would be just a backstop against incorrectly written applications. And for readRandomAccess, we don't know the dimensions until we know the timestep in question because it might change (and the step might not be set until afterwards). So, to do this it really has to happen in Get(). Not sure that can happen external to the engine, or if it would have to be implemented in each engine, but I imagine someone could take a look.
Time is tight, I am fine to leave it as is and close this issue.