File indexing completed on 2023-05-28 05:10:54 UTC
view on githubraw file Latest commit b4daa243 on 2023-05-28 03:53:22 UTC
b4daa24319 Shre*0001 /*
0002 ##########################################################
0003 # This file is part of the AdjoinableMPI library #
0004 # released under the MIT License. #
0005 # The full COPYRIGHT notice can be found in the top #
0006 # level directory of the AdjoinableMPI distribution. #
0007 ##########################################################
0008
0009 #ifndef _AMPI_WINDOW_H_
0010 #define _AMPI_WINDOW_H_
0011
0012 /**
0013 * \file
0014 * \ingroup UserInterfaceHeaders
0015 * The windows in the AMPI context need to be used to track extra information
0016 * simlilarly to the requests. Each window has a stack that is used to trace the
0017 * one-sided communication. We do not resort to the ampi tape since the
0018 * structures differ.
0019 */
0020
0021 #include <stddef.h>
0022 #include "ampi/userIF/libConfig.h"
0023 /**
0024 * \def Number of traced communications in a stack chunk
0025 */
0026 #define AMPI_WINDOW_STACK_CHUNK_SIZE 1000
0027 /*
0028 * @{
0029 * \name Structures and functions related to the tracing of one-sided
0030 * communication.
0031 */
0032
0033 typedef struct {
0034 void *origin_addr;
0035 int origin_count;
0036 MPI_Datatype origin_datatype;
0037 int target_rank;
0038 MPI_Aint target_disp;
0039 int target_count;
0040 MPI_Datatype target_datatype;
0041 void *adjointTempBuf;
0042 void *adjointBuf;
0043 int adjointCount;
0044 void *idx;
0045 } AMPI_WinRequest;
0046
0047 typedef struct {
0048 AMPI_WinRequest *v;
0049 int top;
0050 size_t size;
0051 MPI_Aint num_reqs;
0052 } AMPI_Win_stack;
0053
0054
0055 void AMPI_WIN_STACK_push(AMPI_Win_stack *s, AMPI_WinRequest req);
0056 AMPI_WinRequest AMPI_WIN_STACK_pop(AMPI_Win_stack *s);
0057 void AMPI_WIN_STACK_stack_init(AMPI_Win_stack *s);
0058 void AMPI_WIN_STACK_destroy(AMPI_Win_stack *s);
0059 int AMPI_WIN_STACK_full(AMPI_Win_stack *s);
0060 void AMPI_WIN_STACK_expand(AMPI_Win_stack *s);
0061 void AMPI_WIN_STACK_shrink(AMPI_Win_stack *s);
0062 int AMPI_WIN_STACK_empty(AMPI_Win_stack *s);
0063
0064
0065
0066 /**
0067 * AMPI_Win augmented with extra information
0068 */
0069 typedef struct {
0070 void **map; /**< The mapped window for interleaved types */
0071 void *base; /**< The base of the original window */
0072 void *idx; /**< Tape indices for the adjoint computation */
0073 MPI_Aint size; /**< Size of the window */
0074 AMPI_Win_stack *req_stack; /**< Bookkeeping of the executed one-sided communications */
0075 MPI_Win **plainWindow; /**< original MPI_Win */
0076 int num_reqs;
0077 MPI_Comm comm;
0078 MPI_Aint disp;
0079 } AMPI_Win;
0080
0081
0082 /**
0083 * Synchronzation of the window
0084 */
0085 void AMPI_WIN_sync(AMPI_Win win);
0086 /** @} */
0087
0088
0089 #endif