More fortran wrappers, and a little bit of help code.
Reviewed: Tim Woodall This commit was SVN r1477.
Этот коммит содержится в:
родитель
99e268b9ff
Коммит
108fe10084
@ -6,6 +6,9 @@
|
||||
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "request/request.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Request_c2f = PMPI_Request_c2f
|
||||
@ -16,5 +19,20 @@
|
||||
#endif
|
||||
|
||||
MPI_Fint MPI_Request_c2f(MPI_Request request) {
|
||||
return (MPI_Fint)0;
|
||||
/* local variables */
|
||||
ompi_request_t *request_c;
|
||||
|
||||
/* error checking */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
/* check for MPI_REQUEST_NULL */
|
||||
if( (NULL == request) ) {
|
||||
return (MPI_Fint)
|
||||
OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_REQUEST,
|
||||
"MPI_Request_c2f");
|
||||
}
|
||||
}
|
||||
|
||||
request_c=(ompi_request_t *)request;
|
||||
|
||||
return (MPI_Fint) (request_c->req_f_to_c_index) ;
|
||||
}
|
||||
|
@ -6,6 +6,9 @@
|
||||
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "request/request.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Request_f2c = PMPI_Request_f2c
|
||||
@ -16,5 +19,26 @@
|
||||
#endif
|
||||
|
||||
MPI_Request MPI_Request_f2c(MPI_Fint request) {
|
||||
return (MPI_Request)0;
|
||||
/* local variables */
|
||||
ompi_request_t *request_c;
|
||||
size_t request_index;
|
||||
|
||||
request_index = (size_t) request;
|
||||
|
||||
/* Error checks */
|
||||
if (MPI_PARAM_CHECK) {
|
||||
if (0 > request_index) {
|
||||
(void)OMPI_ERRHANDLER_INVOKE( MPI_COMM_WORLD, MPI_ERR_REQUEST,
|
||||
"MPI_Request_f2c");
|
||||
}
|
||||
}
|
||||
if (request_index >= ompi_req_f_to_c_table->size) {
|
||||
(void) OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_REQUEST,
|
||||
"MPI_Request_f2c - II");
|
||||
return MPI_REQUEST_NULL;
|
||||
}
|
||||
|
||||
request_c = ompi_req_f_to_c_table->addr[request_index];
|
||||
|
||||
return (MPI_Request) request_c;
|
||||
}
|
||||
|
@ -3,16 +3,36 @@
|
||||
*/
|
||||
|
||||
#include "request/request.h"
|
||||
#include "include/constants.h"
|
||||
|
||||
/*
|
||||
* Table for Fortran <-> C Request handle conversion
|
||||
*/
|
||||
ompi_pointer_array_t *ompi_req_f_to_c_table;
|
||||
ompi_pointer_array_t ompi_req_table;
|
||||
|
||||
static void ompi_request_construct(ompi_request_t* req)
|
||||
{
|
||||
int ret_val;
|
||||
|
||||
/* assign entry in fortran <-> c translation array */
|
||||
ret_val = ompi_pointer_array_add(ompi_req_f_to_c_table, req);
|
||||
req->req_f_to_c_index = ret_val;
|
||||
|
||||
req->req_state = OMPI_REQUEST_INVALID;
|
||||
}
|
||||
|
||||
|
||||
static void ompi_request_destruct(ompi_request_t* req)
|
||||
{
|
||||
/* reset the ompi_req_f_to_c_table entry - make sure that the
|
||||
* entry is in the table */
|
||||
if (NULL != ompi_pointer_array_get_item(ompi_req_f_to_c_table,
|
||||
req->req_f_to_c_index)) {
|
||||
ompi_pointer_array_set_item(ompi_req_f_to_c_table,
|
||||
req->req_f_to_c_index, NULL);
|
||||
}
|
||||
|
||||
req->req_state = OMPI_REQUEST_INVALID;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "mpi.h"
|
||||
#include "class/ompi_list.h"
|
||||
#include "class/ompi_pointer_array.h"
|
||||
|
||||
|
||||
OBJ_CLASS_DECLARATION(ompi_request_t);
|
||||
@ -29,6 +30,7 @@ struct ompi_request_t {
|
||||
ompi_list_item_t super;
|
||||
ompi_request_type_t req_type;
|
||||
volatile int req_state;
|
||||
int req_f_to_c_index; /**< index in Fortran <-> C translation array */
|
||||
};
|
||||
typedef struct ompi_request_t ompi_request_t;
|
||||
|
||||
@ -36,6 +38,7 @@ typedef struct ompi_request_t ompi_request_t;
|
||||
#define OMPI_REQUEST_INIT(request) \
|
||||
do { \
|
||||
(request)->req_state = OMPI_REQUEST_INACTIVE; \
|
||||
(request)->req_f_to_c_index = 0; \
|
||||
} while(0);
|
||||
|
||||
#define OMPI_REQUEST_FINI(request) \
|
||||
@ -43,6 +46,10 @@ typedef struct ompi_request_t ompi_request_t;
|
||||
(request)->req_state = OMPI_REQUEST_INVALID; \
|
||||
} while(0);
|
||||
|
||||
/**
|
||||
* Table for Fortran <-> C request handle conversion
|
||||
*/
|
||||
extern ompi_pointer_array_t *ompi_req_f_to_c_table;
|
||||
|
||||
#endif
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user