-
Notifications
You must be signed in to change notification settings - Fork 31
Description
I'm having a bit of a look at examples/nemo/eg5
while on the train today.
I wanted to look where we are w.r.t PSyKE and generic code extraction, including driver generation and execution.
The first (clear issue), was that the default ExtractTrans doesn't do any driver generation.
This was a relatively easy change to get something, as I just added an apply
method and used the ExtractDriverCreator from domain.common
to add a _driver_creator
to the ExtractNode
.
This gave me some output, which was mostly ok. There are a few corrections required:
- The output Fortran gives programs like
program tra_adv.F90_tra_advr1
, which are not allowed program names. - The filename of the open output doesn't match, it has
call extract_psy_data%OpenReadModuleRegion('tra_adv.F90', 'tra_adv-r1')
instead ofcall extract_psy_data%OpenReadModuleRegion('tra_adv, 'tra_adv-r1')
. - The wp kind isn't defined, so I had to manually add
integer, parameter :: wp = 8
to compile the code.
To compile, I only managed to get this by hand, but I used:
gfortran driver-tra_adv.F90-tra_adv-r0.f90 ../../../lib/extract/binary/generic/psy_data_base.o -I/home/aidan/PSyclone/lib/extract/binary/generic -L/home/aidan/PSyclone/lib/extract/binary/generic /home/aidan/PSyclone/lib/extract/binary/generic/compare_variables_mod.o /home/aidan/PSyclone/lib/extract/binary/read_kernel_data_mod.o -I/home/aidan/PSyclone/lib/extract/binary -L/home/aidan/PSyclone/lib/extract/binary -o r0.exe
I had to manually build the extract library without MPI on my laptop
and got an r0.exe.
Running this r0.exe gave me this output:
(base-env) aidan@DIN-43888:~/PSyclone/examples/nemo/eg5$ ./r0.exe
Variable max_abs max_rel l2_diff l2_cos identical #rel<1E-9 #rel<1E-6 #rel<1E-3
ji .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .1000000E+01 .0000000E+00 .0000000E+00 .0000000E+00
jj .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .1000000E+01 .0000000E+00 .0000000E+00 .0000000E+00
jk .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .1000000E+01 .0000000E+00 .0000000E+00 .0000000E+00
mydomain .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .5000000E+03 .0000000E+00 .0000000E+00 .0000000E+00
pun .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .5000000E+03 .0000000E+00 .0000000E+00 .0000000E+00
pvn .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .5000000E+03 .0000000E+00 .0000000E+00 .0000000E+00
pwn .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .5000000E+03 .0000000E+00 .0000000E+00 .0000000E+00
tmask .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .5000000E+03 .0000000E+00 .0000000E+00 .0000000E+00
tsn .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .5000000E+03 .0000000E+00 .0000000E+00 .0000000E+00
umask .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .5000000E+03 .0000000E+00 .0000000E+00 .0000000E+00
vmask .0000000E+00 .0000000E+00 .0000000E+00 .1000000E+01 .5000000E+03 .0000000E+00 .0000000E+00 .0000000E+00
which I suspect is what I want to see (@hiker I assume this is an expected "correct" output?).
This is with the tra_adv example, which is a very easy example I think (no structures, just arrays of INTEGER and REAL), so we'd need to potentially expand to support custom types later - I'm not sure how the extraction library works so I have no comment on how to do that.
I guess the good news is that this doesn't need much to get this example working probably:
- Extend
ExtractTrans
to support generating the driver(s). - Fix the issues highlighted above.
- Fix up the example to be able to build and run the drivers (and summarise the results?).
Once we have that, we could extend it to make a tutorial explaining a process to build KGOs, and how to create a script to validate "correctness" of code modifications (but at a kernel by kernel level as opposed to just a correct/incorrect result).