访问MPI_数据类型的id
我尝试使用PMPI包装器来记录一些函数参数,例如MPI_Send的参数。我需要记录它们,然后我可以用它们重建所有这些参数的内容 MPI_发送的包装器如下所示:访问MPI_数据类型的id,mpi,openmpi,Mpi,Openmpi,我尝试使用PMPI包装器来记录一些函数参数,例如MPI_Send的参数。我需要记录它们,然后我可以用它们重建所有这些参数的内容 MPI_发送的包装器如下所示: /* ================== C Wrappers for MPI_Send ================== */ _EXTERN_C_ int PMPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Com
/* ================== C Wrappers for MPI_Send ================== */
_EXTERN_C_ int PMPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm);
_EXTERN_C_ int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
int _wrap_py_return_val = 0;
do_wrap_send_series((char *)"MPI_Send", buf, count, datatype, dest, tag, comm);
_wrap_py_return_val = PMPI_Send(buf, count, datatype, dest, tag, comm);
return _wrap_py_return_val;
}
问题是我无法记录指针的值并在以后使用它。指针在不同的运行中可能不同
至少MPI\U数据类型是指针类型,如果我错了,请纠正我
如何确定MPI_数据类型是指针类型:Compile,mpicc
警告(在x86_64上):
struct ompi_数据类型的定义为:
struct ompi_datatype_t {
opal_datatype_t super; /**< Base opal_datatype_t superclass */
/* --- cacheline 5 boundary (320 bytes) was 32 bytes ago --- */
int32_t id; /**< OMPI-layers unique id of the type */
int32_t d_f_to_c_index; /**< Fortran index for this datatype */
struct opal_hash_table_t *d_keyhash; /**< Attribute fields */
void* args; /**< Data description for the user */
void* packed_description; /**< Packed description of the datatype */
uint64_t pml_data; /**< PML-specific information */
/* --- cacheline 6 boundary (384 bytes) --- */
char name[MPI_MAX_OBJECT_NAME];/**< Externally visible name */
/* --- cacheline 7 boundary (448 bytes) --- */
/* size: 448, cachelines: 7, members: 7 */
};
typedef struct ompi_datatype_t ompi_datatype_t;
ompi
应该是内部数据结构。有什么办法可以实现我的目标吗
生成PMPI包装的工具:一般来说,
MPI_数据类型
是一个不透明的处理程序,所以您不能做出任何假设,尤其是如果您的包装应该是可移植的
MPI_数据类型
确实是openmpi中的一个指针,但它是MPICH iirc中的一个数字
(旧版)Fortran使用integer来引用数据类型,因此一个选项是使用以下子例程
MPI\u Fint MPI\u Type\u c2f(MPI\u数据类型数据类型)代码>
MPI\u数据类型MPI\u类型f2c(MPI\u Fint数据类型)代码>
MPI\u数据类型
和MPI\u Fint
之间进行转换(除非使用8字节的Fortran整数构建开放式MPI,否则为int
)
,如果要在运行之间比较数据类型,您可能需要考虑这些子程序
int-MPI\u-Type\u-set\u-name(MPI\u数据类型,const-char*Type\u-name)代码>
int-MPI\u-Type\u-get\u-name(MPI\u数据类型,char*Type\u-name,int*resultlen)代码>
因此,您不必担心竞争条件,也不必更改应用程序创建派生数据类型的顺序。一般来说,
MPI_数据类型
是一个不透明的处理程序,因此您无法做出任何假设,特别是如果您的包装器应该是可移植的
MPI_数据类型
确实是openmpi中的一个指针,但它是MPICH iirc中的一个数字
(旧版)Fortran使用integer来引用数据类型,因此一个选项是使用以下子例程
MPI\u Fint MPI\u Type\u c2f(MPI\u数据类型数据类型)代码>
MPI\u数据类型MPI\u类型f2c(MPI\u Fint数据类型)代码>
MPI\u数据类型
和MPI\u Fint
之间进行转换(除非使用8字节的Fortran整数构建开放式MPI,否则为int
)
,如果要在运行之间比较数据类型,您可能需要考虑这些子程序
int-MPI\u-Type\u-set\u-name(MPI\u数据类型,const-char*Type\u-name)代码>
int-MPI\u-Type\u-get\u-name(MPI\u数据类型,char*Type\u-name,int*resultlen)代码>
struct ompi_datatype_t {
opal_datatype_t super; /**< Base opal_datatype_t superclass */
/* --- cacheline 5 boundary (320 bytes) was 32 bytes ago --- */
int32_t id; /**< OMPI-layers unique id of the type */
int32_t d_f_to_c_index; /**< Fortran index for this datatype */
struct opal_hash_table_t *d_keyhash; /**< Attribute fields */
void* args; /**< Data description for the user */
void* packed_description; /**< Packed description of the datatype */
uint64_t pml_data; /**< PML-specific information */
/* --- cacheline 6 boundary (384 bytes) --- */
char name[MPI_MAX_OBJECT_NAME];/**< Externally visible name */
/* --- cacheline 7 boundary (448 bytes) --- */
/* size: 448, cachelines: 7, members: 7 */
};
typedef struct ompi_datatype_t ompi_datatype_t;
error: dereferencing pointer to incomplete type ‘struct ompi_datatype_t’