Updates for fortran bindings
This commit was SVN r3350.
Этот коммит содержится в:
родитель
df3c0da4af
Коммит
93e09fbfa9
@ -52,9 +52,9 @@ void mpi_get_count_f(MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_
|
||||
MPI_Status c_status;
|
||||
OMPI_SINGLE_NAME_DECL(count);
|
||||
|
||||
*ierr = MPI_Status_f2c(status, &c_status);
|
||||
*ierr = OMPI_INT_2_FINT(MPI_Status_f2c(status, &c_status));
|
||||
|
||||
if (MPI_SUCCESS == *ierr) {
|
||||
if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
|
||||
*ierr = OMPI_INT_2_FINT(MPI_Get_count(&c_status, c_type,
|
||||
OMPI_SINGLE_NAME_CONVERT(count)));
|
||||
OMPI_SINGLE_INT_2_FINT(count);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mpi.h"
|
||||
#include "request/request.h"
|
||||
#include "mpi/f77/bindings.h"
|
||||
#include "mpi/f77/constants.h"
|
||||
|
||||
@ -60,8 +61,8 @@ void mpi_test_f(MPI_Fint *request, MPI_Fint *flag,
|
||||
|
||||
OMPI_SINGLE_INT_2_FINT(flag);
|
||||
|
||||
if ( (MPI_SUCCESS == *ierr) && (NULL == c_req) ) {
|
||||
*request = 0;
|
||||
if ( (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) && (NULL == c_req) ) {
|
||||
*request = OMPI_INT_2_FINT(MPI_REQUEST_NULL->req_f_to_c_index);
|
||||
if (!OMPI_IS_FORTRAN_STATUS_IGNORE(status)) {
|
||||
MPI_Status_c2f(&c_status, status);
|
||||
}
|
||||
|
@ -58,28 +58,35 @@ void mpi_testall_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *flag,
|
||||
MPI_Request *c_req;
|
||||
MPI_Status *c_status;
|
||||
int i;
|
||||
OMPI_SINGLE_NAME_DECL(flag);
|
||||
|
||||
c_req = malloc(*count * (sizeof(MPI_Request) + sizeof(MPI_Status)));
|
||||
c_req = malloc(OMPI_FINT_2_INT(*count) *
|
||||
(sizeof(MPI_Request) + sizeof(MPI_Status)));
|
||||
if (NULL == c_req){
|
||||
*ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM,
|
||||
FUNC_NAME);
|
||||
*ierr = OMPI_INT_2_FINT(OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
|
||||
MPI_ERR_NO_MEM,
|
||||
FUNC_NAME));
|
||||
return;
|
||||
}
|
||||
c_status = (MPI_Status*) (c_req + *count);
|
||||
for (i = 0; i < *count; i++) {
|
||||
c_status = (MPI_Status*) (c_req + OMPI_FINT_2_INT(*count));
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
|
||||
c_req[i] = MPI_Request_f2c(array_of_requests[i]);
|
||||
}
|
||||
|
||||
*ierr = MPI_Testall(*count, c_req, flag, c_status);
|
||||
*ierr = OMPI_INT_2_FINT(MPI_Testall(OMPI_FINT_2_INT(*count), c_req,
|
||||
OMPI_SINGLE_NAME_CONVERT(flag),
|
||||
c_status));
|
||||
|
||||
if (MPI_SUCCESS == *ierr && 1 == *flag) {
|
||||
for (i = 0; i < *count; i++) {
|
||||
if (MPI_SUCCESS == OMPI_INT_2_FINT(*ierr) &&
|
||||
1 == *(OMPI_SINGLE_NAME_CONVERT(flag))) {
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
|
||||
if (NULL == c_req[i]) {
|
||||
array_of_requests[i] = 0;
|
||||
array_of_requests[i] =
|
||||
OMPI_INT_2_FINT(MPI_REQUEST_NULL->req_f_to_c_index);
|
||||
}
|
||||
if (!OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses) &&
|
||||
!OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
|
||||
MPI_Status_c2f(&c_status[i], &array_of_statuses[i]);
|
||||
MPI_Status_c2f(&c_status[i], &array_of_statuses[i * 4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,29 +58,38 @@ void mpi_testany_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *index
|
||||
MPI_Request *c_req;
|
||||
MPI_Status c_status;
|
||||
int i;
|
||||
OMPI_SINGLE_NAME_DECL(flag);
|
||||
OMPI_SINGLE_NAME_DECL(index);
|
||||
|
||||
c_req = malloc(*count * sizeof(MPI_Request));
|
||||
c_req = malloc(OMPI_FINT_2_INT(*count) * sizeof(MPI_Request));
|
||||
if (c_req == NULL) {
|
||||
*ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM,
|
||||
FUNC_NAME);
|
||||
*ierr = OMPI_INT_2_FINT(OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
|
||||
MPI_ERR_NO_MEM,
|
||||
FUNC_NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < *count; i++) {
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
|
||||
c_req[i] = MPI_Request_f2c(array_of_requests[i]);
|
||||
}
|
||||
|
||||
*ierr = MPI_Testany(*count, c_req, index, flag, &c_status);
|
||||
*ierr = OMPI_INT_2_FINT(MPI_Testany(OMPI_FINT_2_INT(*count), c_req,
|
||||
OMPI_SINGLE_NAME_CONVERT(index),
|
||||
OMPI_SINGLE_NAME_CONVERT(flag),
|
||||
&c_status));
|
||||
|
||||
if (MPI_SUCCESS == *ierr) {
|
||||
if (MPI_UNDEFINED != *index) {
|
||||
*index += 1;
|
||||
array_of_requests[*index] = 0;
|
||||
if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
|
||||
|
||||
/* Increment index by one for fortran conventions */
|
||||
|
||||
if (MPI_UNDEFINED != *(OMPI_SINGLE_NAME_CONVERT(index))) {
|
||||
array_of_requests[*(OMPI_SINGLE_NAME_CONVERT(index))] =
|
||||
OMPI_INT_2_FINT(MPI_REQUEST_NULL->req_f_to_c_index);
|
||||
++(OMPI_SINGLE_NAME_CONVERT(index));
|
||||
}
|
||||
if (!OMPI_IS_FORTRAN_STATUS_IGNORE(status)) {
|
||||
MPI_Status_c2f(&c_status, status);
|
||||
}
|
||||
}
|
||||
|
||||
free(c_req);
|
||||
}
|
||||
|
@ -57,49 +57,49 @@ void mpi_testsome_f(MPI_Fint *incount, MPI_Fint *array_of_requests,
|
||||
MPI_Fint *outcount, MPI_Fint *array_of_indices,
|
||||
MPI_Fint *array_of_statuses, MPI_Fint *ierr)
|
||||
{
|
||||
int c_err;
|
||||
MPI_Request *c_req;
|
||||
MPI_Status *c_status;
|
||||
int i;
|
||||
OMPI_SINGLE_NAME_DECL(outcount);
|
||||
OMPI_ARRAY_NAME_DECL(array_of_indices);
|
||||
|
||||
c_req = malloc(*incount * (sizeof(MPI_Request) + sizeof(MPI_Status)));
|
||||
c_req = malloc(OMPI_FINT_2_INT(*incount) *
|
||||
(sizeof(MPI_Request) + sizeof(MPI_Status)));
|
||||
if (NULL == c_req) {
|
||||
c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM,
|
||||
FUNC_NAME);
|
||||
*ierr = OMPI_INT_2_FINT(c_err);
|
||||
*ierr = OMPI_INT_2_FINT(OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
|
||||
MPI_ERR_NO_MEM,
|
||||
FUNC_NAME));
|
||||
return;
|
||||
}
|
||||
c_status = (MPI_Status*) c_req + *incount;
|
||||
c_status = (MPI_Status*) (c_req + OMPI_FINT_2_INT(*incount));
|
||||
|
||||
for (i = 0; i < *incount; i++) {
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*incount); ++i) {
|
||||
c_req[i] = MPI_Request_f2c(array_of_requests[i]);
|
||||
}
|
||||
|
||||
OMPI_ARRAY_FINT_2_INT_ALLOC(array_of_indices, *incount);
|
||||
OMPI_ARRAY_FINT_2_INT_ALLOC(array_of_indices, OMPI_FINT_2_INT(*incount));
|
||||
*ierr = OMPI_INT_2_FINT(MPI_Testsome(OMPI_FINT_2_INT(*incount), c_req,
|
||||
OMPI_SINGLE_NAME_CONVERT(outcount),
|
||||
OMPI_ARRAY_NAME_CONVERT(array_of_indices),
|
||||
c_status));
|
||||
OMPI_SINGLE_NAME_CONVERT(outcount),
|
||||
OMPI_ARRAY_NAME_CONVERT(array_of_indices),
|
||||
c_status));
|
||||
|
||||
OMPI_SINGLE_INT_2_FINT(outcount);
|
||||
OMPI_ARRAY_INT_2_FINT(array_of_indices, *incount);
|
||||
OMPI_ARRAY_INT_2_FINT(array_of_indices, OMPI_FINT_2_INT(*incount));
|
||||
|
||||
if (MPI_SUCCESS == *ierr) {
|
||||
if (MPI_UNDEFINED != *outcount) {
|
||||
for (i = 0; i < *outcount; i++) {
|
||||
array_of_indices[i] += 1;
|
||||
if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
|
||||
if (MPI_UNDEFINED != OMPI_FINT_2_INT(*outcount)) {
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*outcount); ++i) {
|
||||
++(OMPI_FINT_2_INT(array_of_indices[i]));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < *outcount; i++) {
|
||||
array_of_requests[array_of_indices[i]] = 0;
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*outcount); ++i) {
|
||||
array_of_requests[OMPI_FINT_2_INT(array_of_indices[i])] =
|
||||
OMPI_INT_2_FINT(MPI_REQUEST_NULL->req_f_to_c_index);
|
||||
if (!OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses) &&
|
||||
!OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
|
||||
MPI_Status_c2f(&c_status[i], &array_of_statuses[i]);
|
||||
MPI_Status_c2f(&c_status[i], &array_of_statuses[i * 4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(c_req);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mpi.h"
|
||||
#include "request/request.h"
|
||||
#include "mpi/f77/bindings.h"
|
||||
#include "mpi/f77/constants.h"
|
||||
|
||||
@ -54,8 +55,8 @@ void mpi_wait_f(MPI_Fint *request, MPI_Fint *status, MPI_Fint *ierr)
|
||||
|
||||
*ierr = OMPI_INT_2_FINT(MPI_Wait(&c_req, &c_status));
|
||||
|
||||
if (MPI_SUCCESS == *ierr) {
|
||||
*request = 0;
|
||||
if (MPI_SUCCESS == OMPI_INT_2_FINT(*ierr)) {
|
||||
*request = OMPI_INT_2_FINT(MPI_REQUEST_NULL->req_f_to_c_index);
|
||||
if (!OMPI_IS_FORTRAN_STATUS_IGNORE(status)) {
|
||||
MPI_Status_c2f(&c_status, status);
|
||||
}
|
||||
|
@ -60,29 +60,32 @@ void mpi_waitall_f(MPI_Fint *count, MPI_Fint *array_of_requests,
|
||||
MPI_Status *c_status;
|
||||
int i;
|
||||
|
||||
c_req = malloc(*count * (sizeof(MPI_Request) + sizeof(MPI_Status)));
|
||||
c_req = malloc(OMPI_FINT_2_INT(*count) *
|
||||
(sizeof(MPI_Request) + sizeof(MPI_Status)));
|
||||
if (NULL == c_req) {
|
||||
*ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM,
|
||||
FUNC_NAME);
|
||||
*ierr = OMPI_FINT_2_INT(OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
|
||||
MPI_ERR_NO_MEM,
|
||||
FUNC_NAME));
|
||||
return;
|
||||
}
|
||||
c_status = (MPI_Status*) c_req + *count;
|
||||
c_status = (MPI_Status*) (c_req + OMPI_FINT_2_INT(*count));
|
||||
|
||||
for (i = 0; i < *count; i++) {
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
|
||||
c_req[i] = MPI_Request_f2c(array_of_requests[i]);
|
||||
}
|
||||
|
||||
*ierr = OMPI_INT_2_FINT(MPI_Waitall(OMPI_FINT_2_INT(*count),
|
||||
c_req, c_status));
|
||||
|
||||
if (MPI_SUCCESS == *ierr) {
|
||||
for (i = 0; i < *count; i++) {
|
||||
if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
|
||||
if (NULL == c_req[i]) {
|
||||
array_of_requests[i] = 0;
|
||||
array_of_requests[i] =
|
||||
OMPI_INT_2_FINT(MPI_REQUEST_NULL->req_f_to_c_index);
|
||||
}
|
||||
if (!OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses) &&
|
||||
!OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
|
||||
MPI_Status_c2f( &c_status[i], &array_of_statuses[i]);
|
||||
MPI_Status_c2f( &c_status[i], &array_of_statuses[i * 4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ void mpi_waitany_f(MPI_Fint *count, MPI_Fint *array_of_requests,
|
||||
int i, c_err;
|
||||
OMPI_SINGLE_NAME_DECL(index);
|
||||
|
||||
c_req = malloc(*count * sizeof(MPI_Request));
|
||||
c_req = malloc(OMPI_FINT_2_INT(*count) * sizeof(MPI_Request));
|
||||
if (NULL == c_req) {
|
||||
c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM,
|
||||
FUNC_NAME);
|
||||
@ -69,22 +69,22 @@ void mpi_waitany_f(MPI_Fint *count, MPI_Fint *array_of_requests,
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < *count; i++) {
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
|
||||
c_req[i] = MPI_Request_f2c(array_of_requests[i]);
|
||||
}
|
||||
|
||||
*ierr = OMPI_INT_2_FINT(MPI_Waitany(OMPI_FINT_2_INT(*count), c_req,
|
||||
OMPI_SINGLE_NAME_CONVERT(index),
|
||||
&c_status));
|
||||
OMPI_SINGLE_NAME_CONVERT(index),
|
||||
&c_status));
|
||||
|
||||
if (MPI_SUCCESS == *ierr) {
|
||||
OMPI_SINGLE_INT_2_FINT(index);
|
||||
if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
|
||||
|
||||
/* Increment index by one for fortran conventions */
|
||||
|
||||
if (MPI_UNDEFINED != *index) {
|
||||
*index += 1;
|
||||
array_of_requests[*index] = 0;
|
||||
if (MPI_UNDEFINED != *(OMPI_SINGLE_NAME_CONVERT(index))) {
|
||||
array_of_requests[*(OMPI_SINGLE_NAME_CONVERT(index))] =
|
||||
OMPI_INT_2_FINT(MPI_REQUEST_NULL->req_f_to_c_index);
|
||||
++(*(OMPI_SINGLE_NAME_CONVERT(index)));
|
||||
}
|
||||
if (!OMPI_IS_FORTRAN_STATUS_IGNORE(status)) {
|
||||
MPI_Status_c2f(&c_status, status);
|
||||
|
@ -63,43 +63,45 @@ void mpi_waitsome_f(MPI_Fint *incount, MPI_Fint *array_of_requests,
|
||||
OMPI_SINGLE_NAME_DECL(outcount);
|
||||
OMPI_ARRAY_NAME_DECL(array_of_indices);
|
||||
|
||||
c_req = malloc(*incount * (sizeof(MPI_Request) + sizeof(MPI_Status)));
|
||||
c_req = malloc(OMPI_FINT_2_INT(*incount) *
|
||||
(sizeof(MPI_Request) + sizeof(MPI_Status)));
|
||||
if (NULL == c_req) {
|
||||
*ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM,
|
||||
FUNC_NAME);
|
||||
return;
|
||||
*ierr = OMPI_INT_2_FINT(OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
|
||||
MPI_ERR_NO_MEM,
|
||||
FUNC_NAME));
|
||||
return;
|
||||
}
|
||||
c_status = (MPI_Status*) c_req + *incount;
|
||||
c_status = (MPI_Status*) (c_req + OMPI_FINT_2_INT(*incount));
|
||||
|
||||
for (i = 0; i < *incount; i++) {
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*incount); ++i) {
|
||||
c_req[i] = MPI_Request_f2c(array_of_requests[i]);
|
||||
}
|
||||
|
||||
OMPI_ARRAY_FINT_2_INT_ALLOC(array_of_indices, *incount);
|
||||
*ierr = OMPI_INT_2_FINT(MPI_Waitsome(OMPI_FINT_2_INT(*incount), c_req,
|
||||
OMPI_SINGLE_NAME_CONVERT(outcount),
|
||||
OMPI_ARRAY_NAME_CONVERT(array_of_indices),
|
||||
c_status));
|
||||
OMPI_SINGLE_NAME_CONVERT(outcount),
|
||||
OMPI_ARRAY_NAME_CONVERT(array_of_indices),
|
||||
c_status));
|
||||
|
||||
if (MPI_SUCCESS == *ierr) {
|
||||
if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
|
||||
OMPI_SINGLE_INT_2_FINT(outcount);
|
||||
OMPI_ARRAY_INT_2_FINT(array_of_indices, *incount);
|
||||
|
||||
/* Increment indexes by one for fortran conventions */
|
||||
|
||||
if (MPI_UNDEFINED != *outcount) {
|
||||
for (i = 0; i < *outcount; i++) {
|
||||
array_of_indices[i] += 1;
|
||||
if (MPI_UNDEFINED != OMPI_FINT_2_INT(*outcount)) {
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*outcount); ++i) {
|
||||
++(OMPI_FINT_2_INT(array_of_indices[i]));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < *incount; i++) {
|
||||
array_of_requests[array_of_indices[i]] = 0;
|
||||
for (i = 0; i < OMPI_FINT_2_INT(*incount); ++i) {
|
||||
array_of_requests[array_of_indices[i]] =
|
||||
OMPI_INT_2_FINT(MPI_REQUEST_NULL->req_f_to_c_index);
|
||||
if (!OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses) &&
|
||||
!OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
|
||||
MPI_Status_c2f(&c_status[i], &array_of_statuses[i]);
|
||||
MPI_Status_c2f(&c_status[i], &array_of_statuses[i * 4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(c_req);
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user