Write selectively in parallel

I want to write selectively in parallel, something like in the example:
but in fortran. In C processes that don’t write will write NULL data.
I have tried to use a pointer, which in the case that I don’t want to write I set it
arr => null().
However I receive an error:
Fortran runtime error: Pointer actual argument ‘arr’ is not associated
What is the proper way of doing it? Thank you!

Two options,

(1) if you don’t need to have all the processes access and write to the file, then split the communicator and open the file with only the processes that need to write the data.

(2) I’ve attached a Fortran program how to, for example, have all the processes < 2 write to a file, collective writes.


hyperslab_by_row-1.f90 (4.65 KB)