This is the simplest parallel file I/O for ASCII files, where every process reads or writes to a unique 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) + ".txt"
open_file(filename)
write_ascii_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) + ".txt"
open_file(filename)
read_ascii_data_from_file(data, filename)
close_file(filename)