|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* (C) 2001 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifndef DATATYPE_H_INCLUDED
|
|
Packit Service |
c5cf8c |
#define DATATYPE_H_INCLUDED
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpiimpl.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Definitions private to the datatype code */
|
|
Packit Service |
c5cf8c |
extern int MPIR_Datatype_init(void);
|
|
Packit Service |
c5cf8c |
extern int MPIR_Datatype_builtin_fillin(void);
|
|
Packit Service |
c5cf8c |
extern int MPIR_Datatype_init_names(void);
|
|
Packit Service |
c5cf8c |
extern void MPIR_Datatype_iscontig(MPI_Datatype, int *);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* LB/UB calculation helper macros */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPII_DATATYPE_CONTIG_LB_UB()
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* Determines the new LB and UB for a block of old types given the
|
|
Packit Service |
c5cf8c |
* old type's LB, UB, and extent, and a count of these types in the
|
|
Packit Service |
c5cf8c |
* block.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* Note: if the displacement is non-zero, the MPII_DATATYPE_BLOCK_LB_UB()
|
|
Packit Service |
c5cf8c |
* should be used instead (see below).
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#define MPII_DATATYPE_CONTIG_LB_UB(cnt_, \
|
|
Packit Service |
c5cf8c |
old_lb_, \
|
|
Packit Service |
c5cf8c |
old_ub_, \
|
|
Packit Service |
c5cf8c |
old_extent_, \
|
|
Packit Service |
c5cf8c |
lb_, \
|
|
Packit Service |
c5cf8c |
ub_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
if (cnt_ == 0) { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_; \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
else if (old_ub_ >= old_lb_) { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_; \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_ + (old_extent_) * (cnt_ - 1); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
else /* negative extent */ { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_ + (old_extent_) * (cnt_ - 1); \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPII_DATATYPE_VECTOR_LB_UB()
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* Determines the new LB and UB for a vector of blocks of old types
|
|
Packit Service |
c5cf8c |
* given the old type's LB, UB, and extent, and a count, stride, and
|
|
Packit Service |
c5cf8c |
* blocklen describing the vectorization.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#define MPII_DATATYPE_VECTOR_LB_UB(cnt_, \
|
|
Packit Service |
c5cf8c |
stride_, \
|
|
Packit Service |
c5cf8c |
blklen_, \
|
|
Packit Service |
c5cf8c |
old_lb_, \
|
|
Packit Service |
c5cf8c |
old_ub_, \
|
|
Packit Service |
c5cf8c |
old_extent_, \
|
|
Packit Service |
c5cf8c |
lb_, \
|
|
Packit Service |
c5cf8c |
ub_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
if (cnt_ == 0 || blklen_ == 0) { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_; \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
else if (stride_ >= 0 && (old_extent_) >= 0) { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_; \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_ + (old_extent_) * ((blklen_) - 1) + \
|
|
Packit Service |
c5cf8c |
(stride_) * ((cnt_) - 1); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
else if (stride_ < 0 && (old_extent_) >= 0) { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_ + (stride_) * ((cnt_) - 1); \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_ + (old_extent_) * ((blklen_) - 1); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
else if (stride_ >= 0 && (old_extent_) < 0) { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_ + (old_extent_) * ((blklen_) - 1); \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_ + (stride_) * ((cnt_) - 1); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
else { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_ + (old_extent_) * ((blklen_) - 1) + \
|
|
Packit Service |
c5cf8c |
(stride_) * ((cnt_) - 1); \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_; \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* MPII_DATATYPE_BLOCK_LB_UB()
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* Determines the new LB and UB for a block of old types given the LB,
|
|
Packit Service |
c5cf8c |
* UB, and extent of the old type as well as a new displacement and count
|
|
Packit Service |
c5cf8c |
* of types.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* Note: we need the extent here in addition to the lb and ub because the
|
|
Packit Service |
c5cf8c |
* extent might have some padding in it that we need to take into account.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#define MPII_DATATYPE_BLOCK_LB_UB(cnt_, \
|
|
Packit Service |
c5cf8c |
disp_, \
|
|
Packit Service |
c5cf8c |
old_lb_, \
|
|
Packit Service |
c5cf8c |
old_ub_, \
|
|
Packit Service |
c5cf8c |
old_extent_, \
|
|
Packit Service |
c5cf8c |
lb_, \
|
|
Packit Service |
c5cf8c |
ub_) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
if (cnt_ == 0) { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_ + (disp_); \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_ + (disp_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
else if (old_ub_ >= old_lb_) { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_ + (disp_); \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_ + (disp_) + (old_extent_) * ((cnt_) - 1); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
else /* negative extent */ { \
|
|
Packit Service |
c5cf8c |
lb_ = old_lb_ + (disp_) + (old_extent_) * ((cnt_) - 1); \
|
|
Packit Service |
c5cf8c |
ub_ = old_ub_ + (disp_); \
|
|
Packit Service |
c5cf8c |
} \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* internal debugging functions */
|
|
Packit Service |
c5cf8c |
void MPII_Datatype_printf(MPI_Datatype type, int depth, MPI_Aint displacement, int blocklength,
|
|
Packit Service |
c5cf8c |
int header);
|
|
Packit Service |
c5cf8c |
void MPII_Dataloop_dot_printf(MPIR_Dataloop * loop_p, int depth, int header);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
void MPII_Datatype_get_contents_ints(MPIR_Datatype_contents * cp, int *user_ints);
|
|
Packit Service |
c5cf8c |
void MPII_Datatype_get_contents_aints(MPIR_Datatype_contents * cp, MPI_Aint * user_aints);
|
|
Packit Service |
c5cf8c |
void MPII_Datatype_get_contents_types(MPIR_Datatype_contents * cp, MPI_Datatype * user_types);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif /* DATATYPE_H_INCLUDED */
|