Skip to content

Commit

Permalink
Added naming scheme information to dev guide
Browse files Browse the repository at this point in the history
  • Loading branch information
Wesley Kwiecinski committed Jul 22, 2024
1 parent c830def commit 6aa7359
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
32 changes: 30 additions & 2 deletions tools/milhoja_pypkg/docs/source/developers_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,31 @@ name of the item, followed by the suffix '_d'.

Code Generation Interface
-------------------------
.. autoclass:: milhoja.TileWrapperGenerator_cpp

Code Generation classes contained inside of the code generation interface follow
a loose naming pattern that determines what language and device the code is generated
for. The general format is as follows:

`[object]_[device]_[language]`

Where the `[object]` is the type of object being generated, either `DataPacket`
or `TileWrapper`. The `[device]` is the device that the generated code will run
on, either `cpu` for running on the cpu, or the tpye of offloading to use if the
gpu is being used. Finally, the `[language]` is the language that the code is
generated for. For example, `TaskFunctionC2FGenerator_OpenACC_F` is a class
for generating the C2F layer for TaskFunctions, with code that runs on the GPU
with OpenACC offloading, generated for fortran code.

Since this is just a 'loose' rule, there are a few exceptions to this. TileWrappers
are only used on CPUs, so there is no need to specify the device. TileWrappers are
also compatible with both Fortran & C++ Task Functions without extra modifications.
DataPackets are designed in a similar way, however, the generated code is not necessarily
compatible with both C++ and Fortran Task Functions. The last exceptions are the
`DataPacketModGenerator` and the `TileWrapperModGenerator`, which exist to generate
fortran module interface files for use with the TaskFunction, therefore there is
no need to specify the language or offloading / device inside of the file name.

.. autoclass:: milhoja.TileWrapperGenerator
:members:
.. autoclass:: milhoja.TileWrapperModGenerator
:members:
Expand All @@ -392,5 +416,9 @@ Code Generation Interface
:members:
.. autoclass:: milhoja.TaskFunctionC2FGenerator_cpu_F
:members:
.. autoclass:: milhoja.TaskFunctionC2FGenerator_OpenACC_F
:members:
.. autoclass:: milhoja.TaskFunctionCpp2CGenerator_cpu_F
:members:
:members:
.. autoclass:: milhoja.TaskFunctionCpp2CGenerator_OpenACC_F
:members:
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class TaskFunctionC2FGenerator_OpenACC_F(AbcCodeGenerator):
* Jared mentioned that this and the cpp2c layers should probably
be separated out from the data packet generator class and moved
over into generate_task_function.
"""

def __init__(self, tf_spec, indent, logger):
Expand Down

0 comments on commit 6aa7359

Please sign in to comment.