Open dqwu opened 3 months ago
Please note that this issue is not reproducible when the IO root is set to 0 (as specified by ioproc_start in the test code).
In a scenario involving 16 compute tasks, when IO tasks are designated as {1, 5, 9, 13}, the IO root is 1. For PnetCDF type operations, the IO root (rank 1) is responsible for actual write operations in pio_put_var and actual read operations in pio_get_var. However, for ADIOS type operations, IO tasks are not utilized. Instead, rank 0 performs the actual write for pio_put_var and the actual read for pio_get_var.
Within the function PIOc_get_vars_tc(), the IO root serves as the broadcast root:
MPI_Bcast(buf, num_elem * typelen, MPI_BYTE, ios->ioroot, ios->my_comm)
This only functions as expected for PnetCDF type operations, where the IO root retrieves the anticipated data for broadcasting.
Within a union communicator, IO tasks constitute a subset of compute tasks, wherein the rank of the IO root task may not necessarily be 0. For instance, in a scenario involving 16 compute tasks, IO tasks could be designated as {1, 5, 9, 13}.
Under these circumstances, pio_get_var retrieves inaccurate data specifically with ADIOS type (although it functions correctly with PnetCDF type).
[Steps to reproduce]
First, check out latest scorpio master branch.
Next, replace the content of examples/c/example1.c with the test code shown below.
Then, build scorpio and run example1.
Output is shown below.