Only the main process writes the sample cache under data-parallel (#1271)
Under an accelerate data-parallel launch every rank holds the full gathered
results and wrote the same parquet cache file concurrently, corrupting it and
making subsequent loads fail. Write the cache only on the main process and add
a barrier so the other ranks wait for that write before reading. Add a
regression test.
Fixes #1102