This is the simplest parallel file I/O for binary files, each process reads or writes to its own file, i.e. the number of processes equals the number of files. This may be disadvantageous for some situations, e.g. for checkpointing if needing to restart a computation on a different number of processes.
The following pseudo-code shows the process for writing data.
get_my_process_id(proc_id)
filename = "file" + to_string(proc_id) + ".bin"
open_file(filename)
write_binary_data_to_file(data, filename)
close_file(filename)
The process is reversed when reading data from file, as follows.
get_my_process_id(proc_id)
filename = "file" + to_string(proc_id) + ".bin"
open_file(filename)
read_binary_data_from_file(data, filename)
close_file(filename)