ecmwf-ifs / ectrans

Global spherical harmonics transforms library underpinning the IFS
Apache License 2.0
15 stars 30 forks source link

Unifying cpu/external and gpu/external #96

Open samhatfield opened 2 months ago

samhatfield commented 2 months ago

I'm thinking ahead to after when redgreen-optimized is merged into develop. After this merge, src/trans will have this structure (ext: external, int: internal):

                    src/trans
                   /         \
                  /           \
                cpu           gpu
              /     \        /   \
             /       \      /     \
           ext       int  ext     int

cpu/internal and gpu/internal are of course substantially different, and probably not worth trying to combine at this stage (same for algor etc., not shown). But there is a lot of overlap between cpu/external and gpu/external so I'm wondering if we can somehow combine these two to make

                    src/trans
                   /    |   \
                  /     |    \
                 /      |     \
                /       |      \
              ext    cpu_int  gpu_int

In the relevant CMakeLists.txt, we would just have to modify the source file lists for the trans_cpu and trans_gpu libraries.

Here's a breakdown of the differences in every file between cpu/external and gpu/external:

So most files are basically the same already, and only two or three would require some thought. Seems like an obvious way to reduce the complexity and code volumn of the library.