Commit a3ea80f6 authored by Cianciosa, Mark's avatar Cianciosa, Mark
Browse files

Fix some doxygen warnings and add basic documentation pages.

parent 15e8ab0f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -310,6 +310,7 @@ if (DOXYGEN_FOUND)
    set (DOXYGEN_PROJECT_NAME "Graph Framework")
    set (DOXYGEN_EXCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/LLVM ${CMAKE_CURRENT_SOURCE_DIR}/build)
    set (DOXYGEN_GENERATE_TREEVIEW YES)
    set (DOXYGEN_USE_MATHJAX YES)

    doxygen_add_docs (doc)
endif ()
+1 −1
Original line number Diff line number Diff line
@@ -1127,7 +1127,7 @@ extern "C" {
///
///  @param[in] c   The graph C context.
///  @param[in] arg The left opperand.
///  @returns sin(arg)
///  @returns cos(arg)
//------------------------------------------------------------------------------
    graph_node graph_cos(STRUCT_TAG graph_c_context *c,
                         graph_node arg) {
+14 −0
Original line number Diff line number Diff line
@@ -10,6 +10,16 @@
#include <stdint.h>
#include <stdbool.h>

//------------------------------------------------------------------------------
///  @def START_GPU
///  Starts a Cocoa auto release pool when using the metal backend. No opt
///  otherwise.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
///  @def END_GPU
///  Ends a Cocoa auto release pool when using the metal backend. No opt
///  otherwise.
//------------------------------------------------------------------------------
#ifdef USE_METAL
#define START_GPU @autoreleasepool {
#define END_GPU }
@@ -18,6 +28,10 @@
#define END_GPU
#endif

//------------------------------------------------------------------------------
///  @def STRUCT_TAG
///  C++ mode needs to tag a graph_c_context as a struct.
//------------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#define STRUCT_TAG
+213 −0
Original line number Diff line number Diff line
/*!
 * @page build_system Build System
 * @brief Overview of the Cmake based build system for the graph_framework.
 * @tableofcontents
 *
 * @section build_system_introduction Introduction
 * This page details the <a href="http://www.cmake.org">cmake</a> based build
 * system.
 *
 * Documentation if divided into two parts.
 * * User documention.
 * * Developer documentation.
 *
 * @section build_system_user User Guide
 * The following section is for users of framework.
 *
 * @subsection build_system_user_dependencies Dependencies
 * The graph_framwork requires three requires external dependencies and one
 * optional dependency. <a href="https://llvm.org">LLVM</a> is another
 * dependency that is used for generating CPU code. However this is
 * automatically obtained via the build system. The graph_frame is written using
 * the C++20 standard. The C interface using C17 and the fortran interface using
 * Fortran 2008.
 *
 * @subsubsection build_system_user_dependencies_required Required
 * * <a href="http://www.cmake.org">cmake</a> version greater than 3.21.
 * * <a href="https://www.unidata.ucar.edu">NetCDF-C</a> library.
 * * <a href="https://www.python.org">Python</a> 3 environment.
 *
 * @subsubsection build_system_user_dependencies_optional Optional
 * * <a href="https://www.doxygen.nl/index.html">Doxygen</a> for generating this documentation.
 *
 * @subsection build_system_clone Obtaining the code
 * The framework code itself be obtained from the
 * <a href="https://github.com/ORNL-Fusion/graph_framework">graph_framework</a>
 * Github repository.
 * @code
 git clone https://github.com/ORNL-Fusion/graph_framework.git
 @endcode
 * Source will be downloaded into a <tt>graph_framework</tt> directory
 * unless a different directory is explicitly used.
 *
 * @subsection build_system_gen Generating the build system
 * After the repository is cloned, create a <tt>build</tt> directory in the
 * top level source directory and change into that directory.
 * @code
 mkdir build
 cd build
 @endcode
 * There are two ways to run cmake. From the command line the build system can
 * generated by using the <tt>cmake</tt> command with options set using the
 * the <tt>-D</tt> option. As an exampole.
 * @code
 cmake -DOPTION_NAME=OPTION_VALUE ../
 @endcode
 * Where <tt>../</tt> points to the source directory containing the top
 * level <tt>CMakeLists.txt</tt> file.
 *
 * The recommended method is to use the interatice <tt>ccmake</tt> command
 * instead.
 * @code
 ccmake ../
 @endcode
 * Note options can still be set from the command line using the
 * <tt>-D</tt> option.
 *
 * @subsubsection build_system_user_options Build system Options
 * Initally, there will be no options. Along the botton, there are several
 * command. Use the 'c' command to start the configuation process. Once
 * configured several options will apear. During this process cmake is cloning
 * the LLVM repository. So this step may take some time initally. Mode of the
 * are various options for configuing LLVM and can be ignored. The important
 * options are listed below.
 *
 * * <tt>CMAKE_BUILD_TYPE</tt> Switch between <tt>Release</tt>, <tt>Debug</tt>, <tt>MinSizeRel</tt>, <tt>RelWithDebInfo</tt>
 * * <tt>USE_VERBOSE</tt> Show verbose information about compute kernels.
 * * <tt>BUILD_C_BINDING</tt> Generate the C langauge interface.
 * * <tt>BUILD_Fortran_BINDING</tt> Generate the Fortran language interface.
 * * <tt>USE_METAL</tt> Enable the <a href="https://developer.apple.com/metal/">Metal</a> backend (macOS only).
 * * <tt>USE_CUDA</tt> Enable the <a href="https://developer.nvidia.com/cuda-zone">Cuda</a> backend (Linux only).
 * * <tt>USE_HIP</tt> Enable the <a href="https://www.amd.com/en/products/software/rocm.html">Hip</a> backend (Linux only, Hip branch).
 * * <tt>USE_SSH</tt> Use ssh for git instead of html.
 *
 * <b>NOTE:</b>macOS uses will need to change the default option for
 * <tt>CMAKE_CXX_COMPILER</tt> to <tt>clang++</tt>. This is due to the way the
 * build systems determines default include directories for system libraries.
 * This can be accomplished using the advacned options using the <tt>t</tt>
 * command or setting this via the command line.
 * @code
 cmake -DCMAKE_CXX_COMPILER=clang++ ../
 @endcode
 *
 * Every time an option is changed, or a new option is available, you need to
 * use the configure <tt>c</tt> command for changes to take affect. Once all
 * options are set, the a generate <tt>g</tt> options will appear. Using this
 * option will build a make file.
 *
 * @subsubsection build_system_trouble_shooting Trouble Shooting.
 * Some times, cmake will fail to locate the NetCDF library if it is not
 * installed in a standard path. In these cases you can use the
 * <tt>CMAKE_PREFIX_PATH</tt> to define the install location of the NetCDF
 * library. For instance if the netcdf library is installed in
 * <tt>/foo/bar/lib</tt> the prefix path should be set to <tt>/foo/bar</tt>.
 *
 * @subsection build_system_build Building the code.
 * Once the build system is successfully generated a Makefile will appear. The
 * code can be build using the
 * @code
 make
 @endcode
 * command. Note that due build system first starts by pulling the latest
 * of LLVM. The build system then has to build LLVM first which can take a
 * while. It is recommended to use a limited parallel build.
 * @code
 make -j10
 @endcode
 * The <tt>-j<i>num_processes</i></tt> option determines number of parallel
 * instances to run. The build products will be found in assocated build
 * directories in the <tt>build</tt> directory.
 *
 * A list of individual components which can be build can be identified using
 * @code
 make -h
 @endcode
 *
 * @subsection build_system_test Running unit tests.
 * Units tests can be run using the command.
 * @code
 make test ARGS=-j10
 @endcode
 * Like the parallel build the <tt>-j<i>num_processes</i></tt> option determines
 * number of parallel instances to run.
 *
 * @section build_system_dev Developer Guide
 * This section covers information for developers of the framework itself.
 *
 * @subsection build_system_macros Macro Definitions
 * The build system defines some macros for defining targets, configuring debug
 * options, and configuing external dependences.
 *
 * @subsubsection build_system_targets Tool targets.
 *
 * <hr>
 * <tt>add_tool_target(target lang)</tt>\n\n
 * Define a tool target.\n\n
 * <b>Parameters</b>\n
 *      <tt>[in] <b>target</b></tt> The name of the target.\n
 *      <tt>[in] <b>lang</b></tt>   File extention for the target (c, cpp, f90).\n\n
 * Target assumes there is a source file defined as <tt>target.lang</tt>. For
 * instance a C++ source file named <tt>foo.cpp</tt> is configures as
 * @code
 add_tool_target(foo cpp)
 @endcode
 * This will generate a build target called <tt>xfoo</tt>.
 *
 * <hr>
 * <tt>add_test_target(target lang)</tt>\n\n
 * Define a test target.\n\n
 * <b>Parameters</b>\n
 *      <tt>[in] <b>target</b></tt> The name of the target.\n
 *      <tt>[in] <b>lang</b></tt>   File extention for the target (c, cpp, f90).\n\n
 * The aguments are the same as <tt>add_tool_target</tt>. This also adds the
 * target as a unit test.
 * <hr>
 *
 * @subsubsection build_system_sanitizer Sanatizer flags
 *
 * <hr>
 * <tt>register_sanitizer_option(name)</tt>\n\n
 * Register a sanitizer option.\n\n
 * <b>Parameters</b>\n
 *      <tt>[in] <b>name</b></tt> The name of the sanitizer flags.\n\n
 * This add new for using the <tt>SANITIZE_<i>NAME</i></tt> cmake option and
 * add <tt>-fsanitize=<i>name</i></tt> to the command line arguments.
 * <hr>
 *
 * @subsubsection build_system_project Register an external project
 *
 * <hr>
 * <tt>register_project(reg_name dir url default_tag sub_dir)</tt>\n\n
 * Register an external project.\n\n
 * <b>Parameters</b>\n
 *      <tt>[in] <b>reg_name</b></tt>    Name for the registered project.\n
 *      <tt>[in] <b>dir</b></tt>         Name directory to clone the project to.\n
 *      <tt>[in] <b>url</b></tt>         URL for the repository.\n
 *      <tt>[in] <b>default_tag</b></tt> Default tag for to pull from.\n
 *      <tt>[in] <b>sub_dir</b></tt>     Subdirectory to locate the project source code.\n\n
 * This function clones a external project into the directory defined by
 * <tt>dir</tt>. This also adds a new build option for
 * <tt>BUILD_TAG_<i>DIR</i></tt>. The URL must have the format of
 * @code
 ${URL_PROTO}domain.com${URL_SEP}remining/url
 @endcode
 * <hr>
 *
 * @subsection build_system_debug Debugging
 * In addition to the standard build options there are several debugging options
 * that can be enabled.
 *
 * @subsubsection build_system_dev_options Build system Options
 * * <tt>USE_PCH</tt> Use precomiled headers during computation. Most users should keep this on.
 * * <tt>SAVE_KERNEL_SOURCE</tt> Option to dump the generated compute kernel source code to disk.
 * * <tt>USE_INPUT_CACHE</tt> Option to cache registers for the kernel arguments.
 * * <tt>USE_CONSTANT_CACHE</tt> Option to use registers to cache constant values otherwise constanst are inlined.
 * * <tt>SHOW_USE_COUNT</tt> Generates information on the number of times a register is used.
 * * <tt>USE_INDEX_CACHE</tt> Option to use registers to cache array indicies.
 * * <tt>SANITIZE_ADDRESS</tt> Use address sanitizer debugging option.
 * * <tt>SANITIZE_LEAK</tt> Use leak sanitizer debugging option.
 * * <tt>SANITIZE_MEMORY</tt> Use memory sanitizer debugging option.
 * * <tt>SANITIZE_THREAD</tt> Use thread sanitizer debugging option.
 * * <tt>SANITIZE_UNDEFINED</tt> Use undefined sanitizer debugging option.
 * * <tt>SANITIZE_FLOAT-DIVIDE-BY-ZERO</tt> Use float-divide-by-zero sanitizer debugging option.
 */

graph_docs/general.dox

0 → 100644
+30 −0
Original line number Diff line number Diff line
/*!
 * @page general_concepts General Concepts
 * @tableofcontents
 * @section introduction Introduction
 * This page documents general concepts of the graph_framework.
 *
 * @section general_concepts_definitions Definitions.
 * * <b>leaf_node</b>            A leaf on the graph.
 * * <b>graph</b>                A data stucture connecting leaf nodes.
 * * <b>reduce</b>               A tranformation of the graph to remove leaf_nodes.
 * * <b>auto differentiation</b> A tranformation of the graph build derivatives.
 * * <b>compiler</b>             A tool for translating from one language to another.
 * * <b>JIT</b>                  Just-in-time compile.
 * * <b>kernel</b>               A code function that runs on a batch of data.
 * * <b>pre_item</b>             A kernel to run before running the main kernels.
 * * <b>work_iten</b>            A instance of kernel.
 * * <b>converge_item</b>        A kernel that is run until a convergence test is met.
 * * <b>workflow</b>             A series of work items.
 * * <b>backend</b>              The device the kernel is run on.
 *
 * @section general_concepts_graph Graph
 * The graph_framework operates by building tree structure of math operations.
 * In tree form it is easy to traverse nodes in the graph. Take the example of
 * equation of line.
 * @f{equation}{y=mx + b@f}
 * This equation consists of five leaf nodes. The ends of the tree are clasified
 * as either variables @f$x@f$ or constants @f$m,b@f$. These leaf_nodes are
 * connected by leaf nodes for multiply and additon operations. The ouptut
 * @f$ y@f$ represents the entire graph of operations.
 */
Loading