⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 copy_functions_heterogeneous.c

📁 MPI stands for the Message Passing Interface. Written by the MPI Forum (a large committee comprising
💻 C
📖 第 1 页 / 共 2 页
字号:
        MEMCPY( to, from, count * sizeof(char) );                        } else {                                                                    /* source or destination are non-contigous */                           for( i = 0; i < count; i++ ) {                                              MEMCPY( to, from, sizeof(char) );                                    to += to_extent;                                                        from += from_extent;                                                }                                                                   }                                                                       *advance = count * from_extent;    return count;                                                       }#define CXX_BOOL_COPY_LOOP(TYPE)                        \    for( i = 0; i < count; i++ ) {                      \        bool *to_real = (bool*) to;                     \        *to_real = *((TYPE*) from) == 0 ? false : true; \        to += to_extent;                                \        from += from_extent;                            \    }static int32_tcopy_cxx_bool_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,                            const char* from, uint32_t from_len, ptrdiff_t from_extent,                            char* to, uint32_t to_length, ptrdiff_t to_extent,                            uint32_t *advance){    uint32_t i;    /* fix up the from extent */    if ((pConvertor->remoteArch & OMPI_ARCH_BOOLISxx) !=         (ompi_mpi_local_arch & OMPI_ARCH_BOOLISxx)) {        switch (pConvertor->remoteArch & OMPI_ARCH_BOOLISxx) {        case OMPI_ARCH_BOOLIS8:            from_extent = 1;            break;        case OMPI_ARCH_BOOLIS16:            from_extent = 2;            break;        case OMPI_ARCH_BOOLIS32:            from_extent = 4;            break;        }    }    datatype_check( "bool", sizeof(bool), sizeof(bool), &count,                   from, from_len, from_extent,                   to, to_length, to_extent);    if ((to_extent != sizeof(bool) || from_extent != sizeof(bool)) ||        ((pConvertor->remoteArch & OMPI_ARCH_BOOLISxx) !=          (ompi_mpi_local_arch & OMPI_ARCH_BOOLISxx))) {        switch (pConvertor->remoteArch & OMPI_ARCH_BOOLISxx) {        case OMPI_ARCH_BOOLIS8:            CXX_BOOL_COPY_LOOP(int8_t);            break;        case OMPI_ARCH_BOOLIS16:            CXX_BOOL_COPY_LOOP(int16_t);            break;        case OMPI_ARCH_BOOLIS32:            CXX_BOOL_COPY_LOOP(int32_t);            break;        }    } else {        MEMCPY( to, from, count * sizeof(bool) );                        }    *advance = count * from_extent;    return count;}#define FORTRAN_LOGICAL_COPY_LOOP(TYPE)                                \    for( i = 0; i < count; i++ ) {                                     \        ompi_fortran_logical_t *to_real = (ompi_fortran_logical_t*) to; \        *to_real = *((TYPE*) from) == 0 ? 0 : OMPI_FORTRAN_VALUE_TRUE; \        to += to_extent;                                               \        from += from_extent;                                           \    }static int32_tcopy_fortran_logical_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,                            const char* from, uint32_t from_len, ptrdiff_t from_extent,                            char* to, uint32_t to_length, ptrdiff_t to_extent,                            uint32_t *advance){    uint32_t i;    /* fix up the from extent */    if ((pConvertor->remoteArch & OMPI_ARCH_LOGICALISxx) !=         (ompi_mpi_local_arch & OMPI_ARCH_LOGICALISxx)) {        switch (pConvertor->remoteArch & OMPI_ARCH_LOGICALISxx) {        case OMPI_ARCH_LOGICALIS8:            from_extent = 1;            break;        case OMPI_ARCH_LOGICALIS16:            from_extent = 2;            break;        case OMPI_ARCH_LOGICALIS32:            from_extent = 4;            break;        }    }    datatype_check( "logical", sizeof(ompi_fortran_logical_t),                     sizeof(ompi_fortran_logical_t), &count,                    from, from_len, from_extent,                    to, to_length, to_extent);    if ((to_extent != sizeof(ompi_fortran_logical_t) ||          from_extent != sizeof(ompi_fortran_logical_t)) ||        ((pConvertor->remoteArch & OMPI_ARCH_LOGICALISxx) !=          (ompi_mpi_local_arch & OMPI_ARCH_LOGICALISxx))) {        switch (pConvertor->remoteArch & OMPI_ARCH_LOGICALISxx) {        case OMPI_ARCH_LOGICALIS8:            FORTRAN_LOGICAL_COPY_LOOP(int8_t);            break;        case OMPI_ARCH_LOGICALIS16:            FORTRAN_LOGICAL_COPY_LOOP(int16_t);            break;        case OMPI_ARCH_LOGICALIS32:            FORTRAN_LOGICAL_COPY_LOOP(int32_t);            break;        }    } else {        MEMCPY( to, from, count * sizeof(ompi_fortran_logical_t) );                        }    *advance = count * from_extent;    return count;}COPY_TYPE_HETEROGENEOUS(short, short)COPY_TYPE_HETEROGENEOUS(int, int)COPY_TYPE_HETEROGENEOUS(long, long)COPY_TYPE_HETEROGENEOUS(long_long, long long)COPY_TYPE_HETEROGENEOUS(float, float)COPY_TYPE_HETEROGENEOUS(double, double)COPY_TYPE_HETEROGENEOUS(long_double, long double)COPY_COMPLEX_HETEROGENEOUS(float, float)COPY_COMPLEX_HETEROGENEOUS(double, double)COPY_COMPLEX_HETEROGENEOUS(long_double, long double)COPY_2TYPE_HETEROGENEOUS(float_int, float, int)COPY_2TYPE_HETEROGENEOUS(double_int, double, int)COPY_2TYPE_HETEROGENEOUS(long_double_int, long double, int)COPY_2TYPE_HETEROGENEOUS(long_int, long, int)COPY_2TYPE_HETEROGENEOUS(2int, int, int)COPY_2TYPE_HETEROGENEOUS(2float, float, float)COPY_2TYPE_HETEROGENEOUS(2double, double, double)COPY_TYPE_HETEROGENEOUS(wchar, wchar_t)COPY_2COMPLEX_HETEROGENEOUS(float, ompi_complex_float_t)COPY_2COMPLEX_HETEROGENEOUS(double, ompi_complex_double_t)/* table of predefined copy functions - one for each MPI type */conversion_fct_t ompi_ddt_heterogeneous_copy_functions[DT_MAX_PREDEFINED] = {   NULL,                      /* DT_LOOP                */   NULL,                      /* DT_END_LOOP            */   NULL,                      /* DT_LB                  */   NULL,                      /* DT_UB                  */   (conversion_fct_t) copy_char_heterogeneous,               /* DT_CHAR                */   (conversion_fct_t) copy_char_heterogeneous,               /* DT_CHARACTER           */   (conversion_fct_t) copy_char_heterogeneous,               /* DT_UNSIGNED_CHAR       */   (conversion_fct_t) copy_char_heterogeneous,               /* DT_SIGNED_CHAR         */   (conversion_fct_t) copy_char_heterogeneous,               /* DT_BYTE                */   (conversion_fct_t) copy_short_heterogeneous,              /* DT_SHORT               */   (conversion_fct_t) copy_short_heterogeneous,              /* DT_UNSIGNED_SHORT      */   (conversion_fct_t) copy_int_heterogeneous,                /* DT_INT                 */   (conversion_fct_t) copy_int_heterogeneous,                /* DT_UNSIGNED_INT        */   (conversion_fct_t) copy_long_heterogeneous,               /* DT_LONG                */   (conversion_fct_t) copy_long_heterogeneous,               /* DT_UNSIGNED_LONG       */   (conversion_fct_t) copy_long_long_heterogeneous,          /* DT_LONG_LONG_INT       */   (conversion_fct_t) copy_long_long_heterogeneous,          /* DT_UNSIGNED_LONG_LONG  */   (conversion_fct_t) copy_float_heterogeneous,              /* DT_FLOAT               */   (conversion_fct_t) copy_double_heterogeneous,             /* DT_DOUBLE              */   (conversion_fct_t) copy_long_double_heterogeneous,        /* DT_LONG_DOUBLE         */   NULL,                       /* DT_PACKED              */   (conversion_fct_t) copy_wchar_heterogeneous,              /* DT_WCHAR               */   (conversion_fct_t) copy_cxx_bool_heterogeneous,           /* DT_CXX_BOOL            */   (conversion_fct_t) copy_fortran_logical_heterogeneous,    /* DT_LOGIC               */   (conversion_fct_t) copy_int_heterogeneous,                /* DT_INTEGER             */   (conversion_fct_t) copy_float_heterogeneous,              /* DT_REAL                */   (conversion_fct_t) copy_double_heterogeneous,             /* DT_DBLPREC             */   (conversion_fct_t) copy_complex_float_heterogeneous,      /* DT_COMPLEX_FLOAT       */   (conversion_fct_t) copy_complex_double_heterogeneous,     /* DT_COMPLEX_DOUBLE      */   (conversion_fct_t) copy_complex_long_double_heterogeneous,/* DT_COMPLEX_LONG_DOUBLE */   (conversion_fct_t) copy_2int_heterogeneous,               /* DT_2INT                */   (conversion_fct_t) copy_2int_heterogeneous,               /* DT_2INTEGER            */   (conversion_fct_t) copy_2float_heterogeneous,             /* DT_2REAL               */   (conversion_fct_t) copy_2double_heterogeneous,            /* DT_2DBLPREC            */   (conversion_fct_t) copy_2complex_float_heterogeneous,     /* DT_2COMPLEX            */   (conversion_fct_t) copy_2complex_double_heterogeneous,    /* DT_2DOUBLE_COMPLEX     */   (conversion_fct_t) copy_float_int_heterogeneous,          /* DT_FLOAT_INT           */   (conversion_fct_t) copy_double_int_heterogeneous,         /* DT_DOUBLE_INT          */   (conversion_fct_t) copy_long_double_int_heterogeneous,    /* DT_LONG_DOUBLE_INT     */   (conversion_fct_t) copy_long_int_heterogeneous,           /* DT_LONG_INT            */   NULL,                       /* DT_SHORT_INT           */   NULL,                       /* DT_UNAVAILABLE         */};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -