我正在调用MPI函数MPI_Group_range_incl
。这是它的签名:
int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
MPI_Group *newgroup)
我很困惑如何传递ranges[][3]
参数。以下是我实施的代码。它编译并正常工作,但提供编译时警告:
warning: passing argument 3 of 'MPI_Group_range_incl' from incompatible pointer type [enabled by default]
int errCode = MPI_Group_range_incl(existingGroup, n, (int**)nativeOneDimRanges, &newGroup);
mpi.h:989:5: note: expected 'int (*)[3]' but argument is of type 'int **'
我如何打电话:
int oneDimRangesLen;
jint *nativeOneDimRanges;
jboolean isCopy = JNI_TRUE;
MPI_Group newGroup;
oneDimRangesLen = (*env)->GetArrayLength(env,oneDimRanges);
nativeOneDimRanges = (*env)->GetIntArrayElements(env, oneDimRanges,
&isCopy);
MPI_Group existingGroup = (MPI_Group)
((*env)->GetLongField(env, thisObject ,GrouphandleID));
int errCode = MPI_Group_range_incl(existingGroup, n, (int**)nativeOneDimRanges, &newGroup);
...
more code....
...
请注意
jintArray oneDimRanges
来自JVM的一维int数组,但它实际上包含函数MPI_Group_range_incl
所需的信息,步长为3.所以它工作正常,但我只是想摆脱警告。有什么帮助吗?