| 1 | '''Discarding land-only regions when using IO servers''' |
| 2 | |
| 3 | First a description of the ''problem'': |
| 4 | |
| 5 | When using stand-alone io servers (i.e. key_iomput is defined AND using_servers = .true. in xmlio_server.def) then |
| 6 | ocean processing regions are assigned to the available io servers in mpi rank order. For example, |
| 7 | consider a (jpni=8) x (jpnj=4) decomposition using 4 io servers. Each io server will be assigned 8 ocean regions |
| 8 | to collate output from. The 32 ocean regions are allocated mpi ranks 0 to 31 within the ocean communicator starting |
| 9 | with the bottom left-hand region with rank zero and proceeding left to right then bottom to top until the top right-hand region is assigned mpi rank 31. In this case ranks 0-7 are associated with the first io server; ranks 8-15 with the second etcetera. Each io server is therefore responsible for a complete horizontal strip of ocean regions and the output files produced are equivalent to those for a (jpni=1) x (jpnj=4) decomposition. |
| 10 | |
| 11 | |
| 12 | {{{ |
| 13 | ocean ranks: assigned io server: |
| 14 | 24 25 26 27 28 29 30 31 03 03 03 03 03 03 03 03 |
| 15 | 16 17 18 19 20 21 22 23 02 02 02 02 02 02 02 02 |
| 16 | 08 09 10 11 12 13 14 15 01 01 01 01 01 01 01 01 |
| 17 | 00 01 02 03 04 05 06 07 00 00 00 00 00 00 00 00 |
| 18 | Assignment of ocean regions to io servers for a 8x4 decomposition using 4 io servers |
| 19 | }}} |
| 20 | |
| 21 | The geographical region handled by each io server is determined by the minimum and maximum longitudes and latitudes of all the ocean regions assigned to it. Therefore, using a number of io servers which is not a multiple or integer factor of jpnj is not recommended. For example using 3 io servers with the 8x4 decomposition would lead to: |
| 22 | |
| 23 | |
| 24 | {{{ |
| 25 | ocean ranks: assigned io server: |
| 26 | 24 25 26 27 28 29 30 31 02 02 02 02 02 02 02 02 |
| 27 | 16 17 18 19 20 21 22 23 01 01 01 01 01 01 02 02 |
| 28 | 08 09 10 11 12 13 14 15 00 00 00 01 01 01 01 01 |
| 29 | 00 01 02 03 04 05 06 07 00 00 00 00 00 00 00 00 |
| 30 | Assignment of ocean regions to io servers for a 8x4 decomposition using 3 io servers |
| 31 | }}} |
| 32 | for which the bounding rectangular areas for each io server overlap. The code copes with this and no |
| 33 | data are lost but there is redundant storage used and more complex algorithms are required to stitch |
| 34 | together the io server files into global datasets. |
| 35 | |
| 36 | With a fully populated decomposition, this situation is easily avoided by ensuring that the number of |
| 37 | io servers is either a multiple of or an integer factor of jpnj. Thus for the 8x4 decomposition: 1,2,4,8,16 or 32 |
| 38 | are all valid choices (although 32 would be achieved more efficiently by not using stand-alone servers at all). |
| 39 | |
| 40 | Problems arise, however, when discarding land-only regions. In this case the mpi rank assigned to each ocean region is |
| 41 | no longer simply related to its geographical position. Take the following example where two land-only regions have |
| 42 | been discarded, resulting in 30 active regions: |
| 43 | |
| 44 | |
| 45 | {{{ |
| 46 | ocean ranks: assigned io server: |
| 47 | 22 23 24 25 26 27 28 29 02 03 03 03 03 03 03 03 |
| 48 | 14 15 16 17 18 19 20 21 01 01 02 02 02 02 02 02 |
| 49 | 07 08 ** 09 10 11 12 13 00 01 ** 01 01 01 01 01 |
| 50 | 00 01 02 ** 03 04 05 06 00 00 00 ** 00 00 00 00 |
| 51 | Assignment of ocean regions to io servers for a 8x4 decomposition with two land-only regions (**) using 4 io servers |
| 52 | }}} |
| 53 | |
| 54 | The elimination of land-only regions results in irregular areas assigned to io servers and, in general, this can not |
| 55 | be solved by a judicious choice of the number of io servers. |
| 56 | |
| 57 | '''The solution''' |
| 58 | |
| 59 | The solution provided by changeset [2462] and outlined in ticket #776 assigns ocean regions to io servers according |
| 60 | to the mpi rank they would have if land-only regions had not been discarded. This ensures that the general rule for |
| 61 | choosing a sensible number of io servers still applies. The only catch is that knowledge of the ocean region's "virtual" |
| 62 | rank can only be obtained after the mpi start-up phase by which time the assignment has already happened. |
| 63 | Starting a new decomposition is, therefore, a two step process. |
| 64 | The first run following any change in the decomposition will exit gracefully after producing the layout.dat file. The |
| 65 | layout.dat file now contains a new column containing the "virtual" rank of each processor. Subsequent runs of the same |
| 66 | code will use this information to assign ocean processes to io servers with results as intuitively expected. |