Parallel File I/O (serial-ascii)

Version's name: Parallel File I/O (serial-ascii) ; a version of the Parallel File I/O program.
Repository: [home] and version downloads: [.zip] [.tar.gz] [.tar.bz2] [.tar]
Patterns and behaviours: Implemented best practices: Parallel library file I/O · Parallel multi-file I/O ·

The following pseudo-code shows the structure of the file I/O when writing data to file. Data held in array data on each process is written to a single file by process 0. Process 0 opens the file, saves its data, and then sequentially receives and saves data from other processes.

get_my_process_id(proc_id)
get_number_of_processes(n_proc)

if proc_id == 0
   filename = "file.txt"
   open_file(filename)
   write_ascii_data_to_file(data, filename)

   for proc = 1, n_proc-1
      receive_data(data, proc) 
      write_ascii_data_to_file(data, filename)
   end for
   
   close_file(filename)
else
   send_data(data, 0) 
end if

The process is reversed when reading data from file, as follows.

get_my_process_id(proc_id)
get_number_of_processes(n_proc)

if proc_id == 0
   filename = "file.txt"
   open_file(filename)
   read_ascii_data_from_file(data, filename)

   for proc = 1, n_proc-1
      read_ascii_data_from_file(data, filename)
      send_data(data, proc) 
   end for
   
   close_file(filename)
else
   receive_data(data, 0) 
end if
The following experiments have been registered: