xt_redist.h 7.18 KB
 Moritz Hanke committed Nov 09, 2012 1 2 3 4 5 /** * @file xt_redist.h * @brief redistribution of data * * contains declaration the redistribution data structure, which  Thomas Jahns committed Jan 08, 2013 6  * is derived from one or more xt_xmaps  Moritz Hanke committed Nov 09, 2012 7  *  Thomas Jahns committed Feb 08, 2016 8  * @copyright Copyright (C) 2016 Jörg Behrens  Moritz Hanke committed Nov 09, 2012 9 10 11 12 13 14 15 16 17 18 19 20  * Moritz Hanke * Thomas Jahns * * @author Jörg Behrens * Moritz Hanke * Thomas Jahns */ /* * Keywords: * Maintainer: Jörg Behrens * Moritz Hanke * Thomas Jahns  Moritz Hanke committed Sep 30, 2015 21  * URL: https://doc.redmine.dkrz.de/yaxt/html/  Moritz Hanke committed Nov 09, 2012 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50  * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the DKRZ GmbH nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */  Moritz Hanke committed May 08, 2012 51 52 53 #ifndef XT_REDIST_H #define XT_REDIST_H  Thomas Jahns committed Jul 28, 2014 54 55 56 57 #ifdef HAVE_CONFIG_H #include #endif  58 59 #include  Thomas Jahns committed Oct 30, 2012 60 #include "xt/xt_core.h"  Moritz Hanke committed Mar 13, 2018 61 #include "xt/xt_request.h"  Moritz Hanke committed May 08, 2012 62   Moritz Hanke committed Sep 08, 2017 63 64 65 struct Xt_redist_msg { int rank;  Thomas Jahns committed Mar 10, 2020 66 67 68 #if SIZEOF_MPI_DATATYPE == 2 * SIZEOF_INT int padding; #endif  Moritz Hanke committed Sep 08, 2017 69 70 71  MPI_Datatype datatype; };  Moritz Hanke committed Feb 09, 2016 72 73 74 75 /** * \example test_redist_common.c */  Thomas Jahns committed Feb 08, 2016 76 77 78 79 80 81 82 /** * redist copy constructor * * @param[in,out] redist redistribution structure */ Xt_redist xt_redist_copy(Xt_redist redist);  Moritz Hanke committed May 08, 2012 83 84 85 86 87 88 89 90 /** * destructor * * @param[in,out] redist redistribution structure */ void xt_redist_delete(Xt_redist redist); /**  Thomas Jahns committed Sep 20, 2013 91  * synchronous redistribution of data  Moritz Hanke committed May 08, 2012 92  *  Moritz Hanke committed Jul 01, 2014 93 94 95 96 97 98  * @param[in] redist redistribution structure * @param[in] num_arrays number of base addresses in src_data and dst_data * @param[in] src_data array containing the addresses of the first * elements of the input data * @param[in,out] dst_data array containing the addresses of the first * elements of the output data  Thomas Jahns committed May 06, 2015 99 100 101  * * @remark The above implies that NULL or any other invalid pointer * must not be used in either @a src_data or @a dst_data.  Moritz Hanke committed Apr 09, 2018 102 103  * @par See Also * \ref correct_addresses  Moritz Hanke committed May 08, 2012 104  */  Moritz Hanke committed Aug 12, 2013 105 void xt_redist_s_exchange(Xt_redist redist, int num_arrays,  Thomas Jahns committed Feb 04, 2014 106  const void **src_data, void **dst_data);  Moritz Hanke committed May 08, 2012 107   Moritz Hanke committed Mar 13, 2018 108 109 110 111 112 113 114 115 116 /** * asynchronous redistribution of data * * @param[in] redist redistribution structure * @param[in] num_arrays number of base addresses in src_data and dst_data * @param[in] src_data array containing the addresses of the first * elements of the input data * @param[in,out] dst_data array containing the addresses of the first * elements of the output data  Thomas Jahns committed Apr 06, 2018 117 118  * @param[out] request pointer to a request object that can be used to complete * an asynchronous exchange  Moritz Hanke committed Mar 13, 2018 119 120 121  * * @remark The above implies that NULL or any other invalid pointer * must not be used in either @a src_data or @a dst_data.  Moritz Hanke committed Apr 09, 2018 122 123  * @par See Also * \ref correct_addresses  Moritz Hanke committed Mar 13, 2018 124  */  Thomas Jahns committed Apr 06, 2018 125 126 127 void xt_redist_a_exchange(Xt_redist redist, int num_arrays, const void **src_data, void **dst_data, Xt_request *request);  Moritz Hanke committed Mar 13, 2018 128   Joerg Behrens committed Aug 21, 2012 129 /**  Thomas Jahns committed Sep 20, 2013 130  * synchronous redistribution of data - single array case  Joerg Behrens committed Aug 21, 2012 131  *  Moritz Hanke committed Jul 01, 2014 132 133 134  * @param[in] redist redistribution structure * @param[in] src_data address of the first element of the input data * @param[in,out] dst_data address of the first element of the output data  Thomas Jahns committed May 06, 2015 135 136 137  * * @remark The above implies that NULL or any other invalid pointer * must not be used in either @a src_data or @a dst_data.  Joerg Behrens committed Aug 21, 2012 138  */  Thomas Jahns committed Feb 04, 2014 139 void xt_redist_s_exchange1(Xt_redist redist, const void *src_data, void *dst_data);  Joerg Behrens committed Aug 21, 2012 140   Moritz Hanke committed Mar 13, 2018 141 142 143 144 145 146 /** * asynchronous redistribution of data - single array case * * @param[in] redist redistribution structure * @param[in] src_data address of the first element of the input data * @param[in,out] dst_data address of the first element of the output data  Thomas Jahns committed Apr 06, 2018 147 148  * @param[out] request pointer to a request object that can be used to complete * an asynchronous exchange  Moritz Hanke committed Mar 13, 2018 149 150 151 152  * * @remark The above implies that NULL or any other invalid pointer * must not be used in either @a src_data or @a dst_data. */  Thomas Jahns committed Apr 06, 2018 153 154 void xt_redist_a_exchange1(Xt_redist redist, const void *src_data, void *dst_data, Xt_request *request);  Moritz Hanke committed Mar 13, 2018 155   156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 /** * gets the number of messages send from the local process in an exchange * operation * * @param[in] redist redistribution structure * @return number of messages sent in the exchange operation */ int xt_redist_get_num_send_msg(Xt_redist redist); /** * gets the number of messages received by the local process in an exchange * operation * * @param[in] redist redistribution structure * @return number of messages received in the exchange operation */ int xt_redist_get_num_recv_msg(Xt_redist redist);  174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 /** * gets a copy of the MPI_Datatype used for the data of the send operation with * the given rank * * @param[in] redist redistribution structure * @param[in] rank MPI rank * \return MPI_Datatype for the data of the send operation with the given rank * * \remarks returns MPI_DATATYPE_NULL if there is no send operation with the given rank */ MPI_Datatype xt_redist_get_send_MPI_Datatype(Xt_redist redist, int rank); /** * gets a copy of the MPI_Datatype used for the data of the recv operation with * the given rank * * @param[in] redist redistribution structure * @param[in] rank MPI rank * \return MPI_Datatype for the data of the recv operation with the given rank * * \remarks returns MPI_DATATYPE_NULL if there is no recv operation with the given rank */ MPI_Datatype xt_redist_get_recv_MPI_Datatype(Xt_redist redist, int rank);  Moritz Hanke committed Mar 14, 2013 198 199 200 201 202 203 204 /** * returns a MPI communicator, which the redistribution is based on * @param[in] redist redistribution structure * \return MPI communicator, which the redistribution is based on */ MPI_Comm xt_redist_get_MPI_Comm(Xt_redist redist);  Moritz Hanke committed May 08, 2012 205 #endif // XT_REDIST_H  Thomas Jahns committed Feb 08, 2016 206   Thomas Jahns committed Feb 08, 2016 207 208 209 210 211 212 213 214 215 /* * Local Variables: * c-basic-offset: 2 * coding: utf-8 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */