diff --git a/README.md b/README.md index fba05c2..47f1204 100644 --- a/README.md +++ b/README.md @@ -253,18 +253,18 @@ You have to use events for that, you will modify both the C and YAML file. ```bash diff ex5.h5dump <(h5dump ex5*.h5) ``` - - ### Ex6. Simplifying the code As you can notice, the %PDI code is quite redundant. In this exercise, you will use `::PDI_expose` and `::PDI_multi_expose` to simplify the code while keeping the exact same behaviour. For once, there is no need to modify the YAML file here, you only need to modify -the C file in this exercise. +the C file. Moreover, This exercise will be launched in sequential to facilitate the comparison between logs. * Examine the source code, compile it and run it. +\remark At the end of the iteration loop, a new event `finalization` is added. + There are lots of matched `::PDI_share`/`::PDI_reclaim` in the code. * Replace these by `::PDI_expose` that is the exact equivalent of a @@ -276,13 +276,17 @@ This case is however handled by `::PDI_multi_expose` call that exposes all data, then triggers an event and finally does all the reclaim in reverse order. * Replace the remaining `::PDI_share`/`::PDI_reclaim` by `::PDI_expose`s and - `::PDI_multi_expose`s and ensure that your code keeps the exact same behaviour - by comparing its trace to `ex6.log` (only the lines matching `[Trace-plugin]` - have been kept). You can easily check if the files are the same by running: + `::PDI_multi_expose`s and ensure that your code keeps the exact same behaviour as in previous exercise by comparing its trace to `ex6.log` + (only the lines matching `[Trace-plugin]` have been kept). Using the previous section [Execution with storage of the log](#execution-with-storage-of-the-log), + run this exercise in saving the output log in the `ex6.result.log`. + After that you can easily check if the files are the same by running: ```bash diff ex6.log <(grep Trace-plugin ex6.result.log) ``` +In summary:\n + 1. `::PDI_expose` is equivalent to `::PDI_share` + `::PDI_reclaim` \n + 2. `::PDI_multi_expose` is equivalent to `::PDI_share` + `::PDI_event` + `::PDI_reclaim`\n ### Ex7. Writing a selection diff --git a/ex6.c b/ex6.c index 020071b..5b6f6f3 100644 --- a/ex6.c +++ b/ex6.c @@ -29,7 +29,6 @@ #include #include -// load the PDI header #include /// size of the local data as [HEIGHT, WIDTH] including ghosts & boundary constants @@ -44,13 +43,32 @@ int pcoord[2]; /// the alpha coefficient used in the computation double alpha; +double L=1.0; +double source1[4]={0.4, 0.4, 0.2, 100}; +double source2[4]={0.7, 0.8, 0.1, 200}; + /** Initialize the data all to 0 except for the left border (XX==0) initialized to 1 million * \param[out] dat the local data to initialize */ void init(double dat[dsize[0]][dsize[1]]) { for (int yy=0; yy> data becoming available in the store: ii -[PDI][Trace-plugin] *** info: <<= data stop being available in the store: ii [PDI][Trace-plugin] *** info: =>> data becoming available in the store: pcoord [PDI][Trace-plugin] *** info: <<= data stop being available in the store: pcoord [PDI][Trace-plugin] *** info: =>> data becoming available in the store: dsize [PDI][Trace-plugin] *** info: <<= data stop being available in the store: dsize [PDI][Trace-plugin] *** info: =>> data becoming available in the store: psize [PDI][Trace-plugin] *** info: <<= data stop being available in the store: psize +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: main_field +[PDI][Trace-plugin] *** info: !!! named event: loop +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: main_field +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: main_field +[PDI][Trace-plugin] *** info: !!! named event: loop +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: main_field +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: ii [PDI][Trace-plugin] *** info: =>> data becoming available in the store: main_field +[PDI][Trace-plugin] *** info: !!! named event: loop [PDI][Trace-plugin] *** info: <<= data stop being available in the store: main_field +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: main_field +[PDI][Trace-plugin] *** info: !!! named event: loop +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: main_field +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: main_field +[PDI][Trace-plugin] *** info: !!! named event: loop +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: main_field +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: main_field +[PDI][Trace-plugin] *** info: !!! named event: loop +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: main_field +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: ii +[PDI][Trace-plugin] *** info: =>> data becoming available in the store: main_field +[PDI][Trace-plugin] *** info: !!! named event: loop +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: main_field +[PDI][Trace-plugin] *** info: <<= data stop being available in the store: ii [PDI][Trace-plugin] *** info: =>> data becoming available in the store: ii [PDI][Trace-plugin] *** info: =>> data becoming available in the store: main_field [PDI][Trace-plugin] *** info: !!! named event: loop diff --git a/ex6.yml b/ex6.yml index fb85810..3c3622e 100644 --- a/ex6.yml +++ b/ex6.yml @@ -16,3 +16,14 @@ pdi: plugins: trace: logging: { pattern: '[PDI][%n-plugin] *** %l: %v' } + decl_hdf5: + - file: ex5-meta${pcoord[0]}x${pcoord[1]}.h5 + write: [ dsize, psize ] + - file: ex5-data${pcoord[0]}x${pcoord[1]}.h5 + on_event: loop + when: '$ii>0 & $ii<3' + write: + ii: + dataset: 'iter${ii}/ii' + main_field: + dataset: 'iter${ii}/main_field' diff --git a/solutions/ex6.c b/solutions/ex6.c index 1272adc..7e3aa02 100644 --- a/solutions/ex6.c +++ b/solutions/ex6.c @@ -29,7 +29,6 @@ #include #include -// load the PDI header #include /// size of the local data as [HEIGHT, WIDTH] including ghosts & boundary constants @@ -44,13 +43,32 @@ int pcoord[2]; /// the alpha coefficient used in the computation double alpha; +double L=1.0; +double source1[4]={0.4, 0.4, 0.2, 100}; +double source2[4]={0.7, 0.8, 0.1, 200}; + /** Initialize the data all to 0 except for the left border (XX==0) initialized to 1 million * \param[out] dat the local data to initialize */ void init(double dat[dsize[0]][dsize[1]]) { for (int yy=0; yy