Use the following directory structure and coding practices to organize your AI Engine-ML projects to provide clarity and reuse:
- Include all adaptive data flow (ADF) graph class definitions (all ADF graphs
derived from graph class
adf::graph), in a header file.Multiple ADF graph definitions can be in the same header file. Include the class header file in the
mainapplication file where the actual top-level graph is declared in the file scope. - Ensure there are no dependencies on the order that the header files are included. All header files must be self-contained and include all the other header files that they need.
- Ensure there are no file-scoped variables or data-structure definitions in
the graph header files. Declare definitions (including
static) in a separate source file. Ensure the source file can be identified in theheaderproperty of the kernel where they are referenced (see Lookup Tables). - Only one source file is allowed to be specified as kernel source via
adf::source. When sub-functions are defined as a library in separate source files (for example,util.hppandutil.cpp), the workaround is as follows:- Include all the library source files in a header file (for
example,
lib.hpp):#pragma once #include <util.hpp> #include <util.cpp> - Include the header file
lib.hppin the kernel source file.
- Include all the library source files in a header file (for
example,