Skip to content
Snippets Groups Projects
Select Git revision
  • 7c07a5811a50782b78597278bd429e79f938b784
  • main default protected
  • mobile_subs_conn
  • prototype
4 results

AccountCard.js

Blame
  • fmpi_mpi.h 5.84 KiB
    // SPDX-License-Identifier: 0BSD
    /*!
     * @file
     * @license{
     * BSD Zero Clause License
     *
     * Copyright (c) 2022 by Raphael Bach
     *
     * Permission to use, copy, modify, and/or distribute this software for any
     * purpose with or without fee is hereby granted.
     *
     * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
     * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
     * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
     * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
     * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
     * PERFORMANCE OF THIS SOFTWARE.
     * }
     */
    /*==============================================================================
        GUARD
    ==============================================================================*/
    #ifndef FMPI_MPI_H_20211219234201
    #define FMPI_MPI_H_20211219234201
    /*==============================================================================
        INCLUDE
    ==============================================================================*/
    // External
    #include <mpi.h> // MPI_MAX_PROCESSOR_NAME
    // Internal
    #include "fmpi_error.h"
    /*==============================================================================
        STRUCT
    ==============================================================================*/
    /*------------------------------------------------------------------------------
        fmpi_mpi_ctx
    ------------------------------------------------------------------------------*/
    /**
     * TODO
     *
     * @example{
     *  TODO
     * }
     */
    typedef struct fmpi_mpi_ctx {
        int rank; //!< TODO
        int size; //!< TODO
        char cpu_name[MPI_MAX_PROCESSOR_NAME]; //!< TODO
        int cpu_name_length; //!< TODO
        int root; //!< TODO
        int futhark_err_class; //!< TODO
        int futhark_err_code; //!< TODO
        struct fmpi_error_handler err_handler; //!< TODO
    } fmpi_mpi_ctx;
    /*==============================================================================
        PUBLIC FUNCTION
    ==============================================================================*/
    /*------------------------------------------------------------------------------
        fmpi_mpi_init()
    ------------------------------------------------------------------------------*/
    /**
     * TODO
     *
     * @param[in] argc : TODO
     * @param[in] argv : TODO
     * @param[in] err_handler : TODO
     *
     * @return
     * - @success: TODO
     * - @failure: TODO
     *
     * @warning TODO
     *
     * @example{
     *  TODO
     * }
     */
    struct fmpi_mpi_ctx * fmpi_mpi_init(
        int * argc, char ** argv[], struct fmpi_error_handler err_handler
    );
    /*------------------------------------------------------------------------------
        fmpi_mpi_exit()
    ------------------------------------------------------------------------------*/
    /**
     * TODO
     *
     * @param[in] ctx : TODO
     *
     * @return
     * - @success: TODO
     * - @failure: TODO
     *
     * @warning TODO
     *
     * @example{
     *  TODO
     * }
     */
    int fmpi_mpi_exit(struct fmpi_mpi_ctx ** ctx);
    /*------------------------------------------------------------------------------
        fmpi_mpi_is_root()
    ------------------------------------------------------------------------------*/
    /**
     * TODO
     *
     * @param[in] ctx : TODO
     *
     * @return
     * - @success: TODO
     * - @failure: TODO
     *
     * @warning TODO
     *
     * @example{
     *  TODO
     * }
     */
    _Bool fmpi_mpi_is_root(const struct fmpi_mpi_ctx * ctx);
    /*------------------------------------------------------------------------------
        fmpi_mpi_check_error()
    ------------------------------------------------------------------------------*/
    /**
     * TODO
     *
     * @param[in] ctx : TODO
     * @param[in] err_id : TODO
     * @param[in] func : TODO
     *
     * @return
     * - @success: TODO
     * - @failure: TODO
     *
     * @warning TODO
     *
     * @example{
     *  TODO
     * }
     */
    _Bool fmpi_mpi_check_error(
        const struct fmpi_mpi_ctx * ctx, int err_id, const char * func
    );
    /*------------------------------------------------------------------------------
        fmpi_mpi_ctx_print()
    ------------------------------------------------------------------------------*/
    /**
     * TODO
     *
     * @param[in] ctx : TODO
     *
     * @return
     * - @success: TODO
     * - @failure: TODO
     *
     * @warning TODO
     *
     * @example{
     *  TODO
     * }
     */
    void fmpi_mpi_ctx_print(const struct fmpi_mpi_ctx * ctx);
    /*------------------------------------------------------------------------------
        fmpi_mpi_world_rank()
    ------------------------------------------------------------------------------*/
    /**
     * TODO
     */
    int fmpi_mpi_world_rank(const struct fmpi_mpi_ctx * ctx);
    /*------------------------------------------------------------------------------
        fmpi_mpi_finalized()
    ------------------------------------------------------------------------------*/
    /**
     * Checks if `MPI_Finalize()` has been called.
     *
     * @param[in] ctx : A pointer to a fmpi_mpi_ctx.
     *
     * @return
     * - `true` if `MPI_Finalize()` has been called.
     * - `false` if `MPI_Finalize()` has not been called.
     *
     * @example{
     *  TODO
     * }
     */
    _Bool fmpi_mpi_finalized(const struct fmpi_mpi_ctx * ctx);
    /*------------------------------------------------------------------------------
        fmpi_mpi_abort()
    ------------------------------------------------------------------------------*/
    /**
     * Aborts MPI execution environment.
     *
     * @param[in] ctx : A pointer to a fmpi_mpi_ctx.
     *
     * @warning
     * - \b [UB] \p{ctx} must not be `NULL`.
     *
     * @example{
     *  TODO
     * }
     */
    void fmpi_mpi_abort(const struct fmpi_mpi_ctx * ctx);
    /*------------------------------------------------------------------------------
        fmpi_mpi_world_barrier()
    ------------------------------------------------------------------------------*/
    int fmpi_mpi_world_barrier(const struct fmpi_mpi_ctx * ctx);
    /*==============================================================================
        GUARD
    ==============================================================================*/
    #endif // FMPI_MPI_H_20211219234201