Download pseudo source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
procedure main(argc, argv[])
  if argc = 3 then
    shared const overall_start = integer(argv[1])
    shared const overall_finish = integer(argv[2])

    shared const process_start = calculate_start(process_number \
      , overall_finish, process_count, overall_start)
    shared const process_finish = calculate_finish(process_number \
      , overall_finish, process_count, overall_start)
    shared const process_size = process_finish - process_start
    // E.g: hostname2:1: range [12, 20[ size 8
    print process_hostname, ':', process_number, ": range [", process_start
      , ", ", process_finish, "[ size ", process_size

    // ...
    declare thread_start := -1
    declare thread_finish := -1
    declare constant thread_size = thread_finish - thread_start
    // E.g: hostname2:1.1: range [15,18[ size 3
    print '\t', process_hostname, ':', process_number, '.', thread_number, \
      ": range [", thread_start, ", ",  thread_finish, "[ size ", thread_size
  end if
end procedure

function calculate_start(rank, end, workers, begin)
  // ...
end function

function calculate_finish(rank, end, workers, begin)
  return calculate_start(rank + 1, end, workers, begin)
end function