ompi/request: implement MPI Generalized request extensions
so latest ROM-IO can be used with Open MPI. Note this first and naive implementation does not use the wait_fn callback. Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
1e5404873f
Коммит
383f23bf35
@ -17,7 +17,7 @@ dnl Copyright (c) 2009-2018 Los Alamos National Security, LLC. All rights
|
||||
dnl reserved.
|
||||
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||
dnl Copyright (c) 2013 Intel, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
dnl Copyright (c) 2015-2018 Research Organization for Information Science
|
||||
dnl and Technology (RIST). All rights reserved.
|
||||
dnl
|
||||
dnl $COPYRIGHT$
|
||||
@ -212,6 +212,21 @@ AC_DEFINE_UNQUOTED([OMPI_ENABLE_MPI1_COMPAT], [$ompi_mpi1_support], [whether we
|
||||
AC_SUBST([OMPI_ENABLE_MPI1_COMPAT], [$ompi_mpi1_support])
|
||||
AM_CONDITIONAL([OMPI_ENABLE_MPI1_COMPAT],[test $ompi_mpi1_support = 1])
|
||||
|
||||
AC_ARG_ENABLE([grequest-extensions],
|
||||
[AC_HELP_STRING([--enable-grequest-extensions],
|
||||
[Enable support for Grequest extensions (default: disabled)])])
|
||||
|
||||
if test "x$enable_grequest_extensions" = "xyes" ; then
|
||||
ompi_grequest_extensions=1
|
||||
else
|
||||
ompi_grequest_extensions=0
|
||||
fi
|
||||
|
||||
|
||||
AC_DEFINE_UNQUOTED([OMPI_ENABLE_GREQUEST_EXTENSIONS], [$ompi_grequest_extensions], [whether we support Grequest extensions])
|
||||
AC_SUBST([OMPI_ENABLE_GREQUEST_EXTENSIONS], [$ompi_grequest_extensions])
|
||||
AM_CONDITIONAL([OMPI_ENABLE_GREQUEST_EXTENSIONS],[test $ompi_grequest_extensions = 1])
|
||||
|
||||
#
|
||||
# Do we want to disable MPI parameter checking at run-time?
|
||||
#
|
||||
|
@ -17,7 +17,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2011-2013 INRIA. All rights reserved.
|
||||
* Copyright (c) 2015 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
* Copyright (c) 2015-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -139,6 +139,9 @@
|
||||
/* Whether in include MPI-1 compatibility */
|
||||
#undef OMPI_ENABLE_MPI1_COMPAT
|
||||
|
||||
/* Whether we support Grequest extensions */
|
||||
#undef OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
|
||||
/* Whether we have float _Complex or not */
|
||||
#undef HAVE_FLOAT__COMPLEX
|
||||
|
||||
@ -406,6 +409,12 @@ typedef int (MPI_Grequest_query_function)(void *, MPI_Status *);
|
||||
typedef int (MPI_Grequest_free_function)(void *);
|
||||
typedef int (MPI_Grequest_cancel_function)(void *, int);
|
||||
|
||||
#if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
typedef int (MPIX_Grequest_poll_function)(void *, MPI_Status *);
|
||||
typedef int (MPIX_Grequest_wait_function)(int, void **, double, MPI_Status *);
|
||||
typedef int MPIX_Grequest_class;
|
||||
#endif /* OMPI_ENABLE_GREQUEST_EXTENSIONS */
|
||||
|
||||
#if !OMPI_OMIT_MPI1_COMPAT_DECLS
|
||||
/*
|
||||
* Removed typedefs. These will be deleted in a future Open MPI release.
|
||||
@ -1496,6 +1505,23 @@ OMPI_DECLSPEC int MPI_Grequest_start(MPI_Grequest_query_function *query_fn,
|
||||
MPI_Grequest_free_function *free_fn,
|
||||
MPI_Grequest_cancel_function *cancel_fn,
|
||||
void *extra_state, MPI_Request *request);
|
||||
#if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
OMPI_DECLSPEC int MPIX_Grequest_start(MPI_Grequest_query_function *query_fn,
|
||||
MPI_Grequest_free_function *free_fn,
|
||||
MPI_Grequest_cancel_function *cancel_fn,
|
||||
MPIX_Grequest_poll_function *poll_fn,
|
||||
void *extra_state,
|
||||
MPI_Request *request);
|
||||
OMPI_DECLSPEC int MPIX_Grequest_class_create(MPI_Grequest_query_function *query_fn,
|
||||
MPI_Grequest_free_function *free_fn,
|
||||
MPI_Grequest_cancel_function *cancel_fn,
|
||||
MPIX_Grequest_poll_function *poll_fn,
|
||||
MPIX_Grequest_wait_function *wait_fn,
|
||||
MPIX_Grequest_class *greq_class);
|
||||
OMPI_DECLSPEC int MPIX_Grequest_class_allocate(MPIX_Grequest_class greq_class,
|
||||
void *extra_state,
|
||||
MPI_Request *request);
|
||||
#endif /* OMPI_ENABLE_GREQUEST_EXTENSIONS */
|
||||
OMPI_DECLSPEC MPI_Fint MPI_Group_c2f(MPI_Group group);
|
||||
OMPI_DECLSPEC int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result);
|
||||
OMPI_DECLSPEC int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
|
||||
@ -2157,6 +2183,23 @@ OMPI_DECLSPEC int PMPI_Grequest_start(MPI_Grequest_query_function *query_fn,
|
||||
MPI_Grequest_free_function *free_fn,
|
||||
MPI_Grequest_cancel_function *cancel_fn,
|
||||
void *extra_state, MPI_Request *request);
|
||||
#if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
OMPI_DECLSPEC int PMPIX_Grequest_start(MPI_Grequest_query_function *query_fn,
|
||||
MPI_Grequest_free_function *free_fn,
|
||||
MPI_Grequest_cancel_function *cancel_fn,
|
||||
MPIX_Grequest_poll_function *poll_fn,
|
||||
void *extra_state,
|
||||
MPI_Request *request);
|
||||
OMPI_DECLSPEC int PMPIX_Grequest_class_create(MPI_Grequest_query_function *query_fn,
|
||||
MPI_Grequest_free_function *free_fn,
|
||||
MPI_Grequest_cancel_function *cancel_fn,
|
||||
MPIX_Grequest_poll_function *poll_fn,
|
||||
MPIX_Grequest_wait_function *wait_fn,
|
||||
MPIX_Grequest_class *greq_class);
|
||||
OMPI_DECLSPEC int PMPIX_Grequest_class_allocate(MPIX_Grequest_class greq_class,
|
||||
void *extra_state,
|
||||
MPI_Request *request);
|
||||
#endif /* OMPI_ENABLE_GREQUEST_EXTENSIONS */
|
||||
OMPI_DECLSPEC MPI_Fint PMPI_Group_c2f(MPI_Group group);
|
||||
OMPI_DECLSPEC int PMPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result);
|
||||
OMPI_DECLSPEC int PMPI_Group_difference(MPI_Group group1, MPI_Group group2,
|
||||
|
@ -15,7 +15,7 @@
|
||||
# Copyright (c) 2012-2013 Inria. All rights reserved.
|
||||
# Copyright (c) 2013-2018 Los Alamos National Security, LLC. All rights
|
||||
# reserved.
|
||||
# Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
# Copyright (c) 2015-2018 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
@ -431,6 +431,13 @@ libmpi_c_mpi_la_SOURCES = \
|
||||
win_unlock_all.c \
|
||||
win_wait.c
|
||||
|
||||
if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
libmpi_c_mpi_la_SOURCES += \
|
||||
grequestx_class_allocate.c \
|
||||
grequestx_class_create.c \
|
||||
grequestx_start.c
|
||||
endif
|
||||
|
||||
if OMPI_ENABLE_MPI1_COMPAT
|
||||
libmpi_c_mpi_la_SOURCES += \
|
||||
address.c \
|
||||
|
48
ompi/mpi/c/grequestx_class_allocate.c
Обычный файл
48
ompi/mpi/c/grequestx_class_allocate.c
Обычный файл
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#include "ompi_config.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/runtime/params.h"
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/errhandler/errhandler.h"
|
||||
#include "ompi/request/grequestx.h"
|
||||
|
||||
#if OMPI_BUILD_MPI_PROFILING
|
||||
#if OPAL_HAVE_WEAK_SYMBOLS
|
||||
#pragma weak MPIX_Grequest_class_allocate = PMPIX_Grequest_class_allocate
|
||||
#endif
|
||||
#define MPIX_Grequest_class_allocate PMPIX_Grequest_class_allocate
|
||||
#endif
|
||||
|
||||
static const char FUNC_NAME[] = "MPIX_Grequest_class_allocate";
|
||||
|
||||
|
||||
int MPIX_Grequest_class_allocate(MPIX_Grequest_class greq_class,
|
||||
void *extra_state,
|
||||
MPI_Request *request)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (NULL == request) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_REQUEST,
|
||||
FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
OPAL_CR_ENTER_LIBRARY();
|
||||
|
||||
rc = ompi_grequestx_class_allocate(greq_class, extra_state, request);
|
||||
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||
}
|
||||
|
51
ompi/mpi/c/grequestx_class_create.c
Обычный файл
51
ompi/mpi/c/grequestx_class_create.c
Обычный файл
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#include "ompi_config.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/runtime/params.h"
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/errhandler/errhandler.h"
|
||||
#include "ompi/request/grequestx.h"
|
||||
|
||||
#if OMPI_BUILD_MPI_PROFILING
|
||||
#if OPAL_HAVE_WEAK_SYMBOLS
|
||||
#pragma weak MPIX_Grequest_class_create = PMPIX_Grequest_class_create
|
||||
#endif
|
||||
#define MPIX_Grequest_class_create PMPIX_Grequest_class_create
|
||||
#endif
|
||||
|
||||
static const char FUNC_NAME[] = "MPIX_Grequest_class_create";
|
||||
|
||||
|
||||
int MPIX_Grequest_class_create(MPI_Grequest_query_function *query_fn,
|
||||
MPI_Grequest_free_function *free_fn,
|
||||
MPI_Grequest_cancel_function *cancel_fn,
|
||||
MPIX_Grequest_poll_function *poll_fn,
|
||||
MPIX_Grequest_wait_function *wait_fn,
|
||||
MPIX_Grequest_class *greq_class)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (NULL == greq_class) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_REQUEST,
|
||||
FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
OPAL_CR_ENTER_LIBRARY();
|
||||
|
||||
rc = ompi_grequestx_class_create(query_fn,free_fn,cancel_fn,poll_fn,wait_fn,greq_class);
|
||||
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||
}
|
||||
|
50
ompi/mpi/c/grequestx_start.c
Обычный файл
50
ompi/mpi/c/grequestx_start.c
Обычный файл
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#include "ompi_config.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/runtime/params.h"
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/errhandler/errhandler.h"
|
||||
#include "ompi/request/grequestx.h"
|
||||
|
||||
#if OMPI_BUILD_MPI_PROFILING
|
||||
#if OPAL_HAVE_WEAK_SYMBOLS
|
||||
#pragma weak MPIX_Grequest_start = PMPIX_Grequest_start
|
||||
#endif
|
||||
#define MPIX_Grequest_start PMPIX_Grequest_start
|
||||
#endif
|
||||
|
||||
static const char FUNC_NAME[] = "MPIX_Grequest_start";
|
||||
|
||||
|
||||
int MPIX_Grequest_start(MPI_Grequest_query_function *query_fn,
|
||||
MPI_Grequest_free_function *free_fn,
|
||||
MPI_Grequest_cancel_function *cancel_fn,
|
||||
MPIX_Grequest_poll_function *poll_fn,
|
||||
void *extra_state, MPI_Request *request)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (NULL == request) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_REQUEST,
|
||||
FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
OPAL_CR_ENTER_LIBRARY();
|
||||
|
||||
rc = ompi_grequestx_start(query_fn,free_fn,cancel_fn,poll_fn,extra_state,request);
|
||||
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
# Copyright (c) 2012-2013 Inria. All rights reserved.
|
||||
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||
# reserved.
|
||||
# Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
# Copyright (c) 2015-2018 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
@ -411,6 +411,13 @@ nodist_libmpi_c_pmpi_la_SOURCES = \
|
||||
pwin_unlock_all.c \
|
||||
pwin_wait.c
|
||||
|
||||
if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
nodist_libmpi_c_pmpi_la_SOURCES += \
|
||||
pgrequestx_class_allocate.c \
|
||||
pgrequestx_class_create.c \
|
||||
pgrequestx_start.c
|
||||
endif
|
||||
|
||||
if OMPI_ENABLE_MPI1_COMPAT
|
||||
nodist_libmpi_c_pmpi_la_SOURCES += \
|
||||
paddress.c \
|
||||
|
@ -11,6 +11,8 @@
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
# Copyright (c) 2018 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
@ -26,8 +28,18 @@ headers += \
|
||||
request/request.h \
|
||||
request/request_dbg.h
|
||||
|
||||
if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
headers += \
|
||||
request/grequestx.h
|
||||
endif
|
||||
|
||||
lib@OMPI_LIBMPI_NAME@_la_SOURCES += \
|
||||
request/grequest.c \
|
||||
request/request.c \
|
||||
request/req_test.c \
|
||||
request/req_wait.c
|
||||
|
||||
if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
lib@OMPI_LIBMPI_NAME@_la_SOURCES += \
|
||||
request/grequestx.c
|
||||
endif
|
||||
|
@ -10,6 +10,8 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -44,6 +46,15 @@ typedef void (MPI_F_Grequest_cancel_function)(MPI_Aint *extra_state,
|
||||
ompi_fortran_logical_t *complete,
|
||||
MPI_Fint *ierr);
|
||||
|
||||
#if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
/**
|
||||
* Fortran type for generalized request query function
|
||||
*/
|
||||
typedef void (MPIX_F_Grequest_poll_function)(MPI_Aint *extra_state,
|
||||
MPI_Fint *status,
|
||||
MPI_Fint *ierr);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Union for query function for use in ompi_grequest_t
|
||||
*/
|
||||
@ -68,6 +79,16 @@ typedef union {
|
||||
MPI_F_Grequest_cancel_function* f_cancel;
|
||||
} MPI_Grequest_cancel_fct_t;
|
||||
|
||||
#if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
/**
|
||||
* Union for poll function for use in ompi_grequestx_t
|
||||
*/
|
||||
typedef union {
|
||||
MPIX_Grequest_poll_function* c_poll;
|
||||
MPIX_F_Grequest_poll_function* f_poll;
|
||||
} MPIX_Grequest_poll_fct_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Main structure for MPI generalized requests
|
||||
*/
|
||||
@ -76,6 +97,9 @@ struct ompi_grequest_t {
|
||||
MPI_Grequest_query_fct_t greq_query;
|
||||
MPI_Grequest_free_fct_t greq_free;
|
||||
MPI_Grequest_cancel_fct_t greq_cancel;
|
||||
#if OMPI_ENABLE_GREQUEST_EXTENSIONS
|
||||
MPIX_Grequest_poll_fct_t greq_poll;
|
||||
#endif
|
||||
void *greq_state;
|
||||
bool greq_funcs_are_c;
|
||||
};
|
||||
|
143
ompi/request/grequestx.c
Обычный файл
143
ompi/request/grequestx.c
Обычный файл
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2016 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/request/grequest.h"
|
||||
#include "ompi/mpi/fortran/base/fint_2_int.h"
|
||||
#include "ompi/request/grequestx.h"
|
||||
|
||||
static bool requests_initialized = false;
|
||||
static opal_list_t requests;
|
||||
static int32_t active_requests = 0;
|
||||
static bool in_progress = false;
|
||||
static opal_mutex_t lock;
|
||||
|
||||
static int grequestx_progress(void) {
|
||||
ompi_grequest_t *request, *next;
|
||||
|
||||
OPAL_THREAD_LOCK(&lock);
|
||||
if (!in_progress) {
|
||||
in_progress = true;
|
||||
|
||||
OPAL_LIST_FOREACH_SAFE(request, next, &requests, ompi_grequest_t) {
|
||||
MPI_Status status;
|
||||
OPAL_THREAD_UNLOCK(&lock);
|
||||
request->greq_poll.c_poll(request->greq_state, &status);
|
||||
if (REQUEST_COMPLETE(&request->greq_base)) {
|
||||
OPAL_THREAD_LOCK(&lock);
|
||||
opal_list_remove_item(&requests, &request->greq_base.super.super);
|
||||
OPAL_THREAD_UNLOCK(&lock);
|
||||
}
|
||||
OPAL_THREAD_LOCK(&lock);
|
||||
}
|
||||
}
|
||||
OPAL_THREAD_UNLOCK(&lock);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int ompi_grequestx_start(
|
||||
MPI_Grequest_query_function *gquery_fn,
|
||||
MPI_Grequest_free_function *gfree_fn,
|
||||
MPI_Grequest_cancel_function *gcancel_fn,
|
||||
MPIX_Grequest_poll_function *gpoll_fn,
|
||||
void* extra_state,
|
||||
ompi_request_t** request)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = ompi_grequest_start(gquery_fn, gfree_fn, gcancel_fn, extra_state, request);
|
||||
if (OMPI_SUCCESS != rc) {
|
||||
return rc;
|
||||
}
|
||||
((ompi_grequest_t *)*request)->greq_poll.c_poll = gpoll_fn;
|
||||
|
||||
if (!requests_initialized) {
|
||||
OBJ_CONSTRUCT(&requests, opal_list_t);
|
||||
OBJ_CONSTRUCT(&lock, opal_mutex_t);
|
||||
requests_initialized = true;
|
||||
}
|
||||
|
||||
OPAL_THREAD_LOCK(&lock);
|
||||
opal_list_append(&requests, &((*request)->super.super));
|
||||
OPAL_THREAD_UNLOCK(&lock);
|
||||
int32_t tmp = OPAL_THREAD_ADD_FETCH32(&active_requests, 1);
|
||||
if (1 == tmp) {
|
||||
opal_progress_register(grequestx_progress);
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
struct ompi_grequestx_class {
|
||||
opal_object_t super;
|
||||
MPI_Grequest_query_function *gquery_fn;
|
||||
MPI_Grequest_free_function *gfree_fn;
|
||||
MPI_Grequest_cancel_function *gcancel_fn;
|
||||
MPIX_Grequest_poll_function *gpoll_fn;
|
||||
MPIX_Grequest_wait_function *gwait_fn;
|
||||
} ;
|
||||
|
||||
typedef struct ompi_grequestx_class ompi_grequestx_class;
|
||||
|
||||
static int next_class = 0;
|
||||
|
||||
static OBJ_CLASS_INSTANCE(ompi_grequestx_class, opal_object_t, NULL, NULL);
|
||||
|
||||
static opal_pointer_array_t classes;
|
||||
|
||||
int ompi_grequestx_class_create(
|
||||
MPI_Grequest_query_function *gquery_fn,
|
||||
MPI_Grequest_free_function *gfree_fn,
|
||||
MPI_Grequest_cancel_function *gcancel_fn,
|
||||
MPIX_Grequest_poll_function *gpoll_fn,
|
||||
MPIX_Grequest_wait_function *gwait_fn,
|
||||
MPIX_Grequest_class *greq_class)
|
||||
{
|
||||
ompi_grequestx_class * class = OBJ_NEW(ompi_grequestx_class);
|
||||
class->gquery_fn = gquery_fn;
|
||||
class->gfree_fn = gfree_fn;
|
||||
class->gcancel_fn = gcancel_fn;
|
||||
class->gpoll_fn = gpoll_fn;
|
||||
class->gwait_fn = gwait_fn;
|
||||
|
||||
if (0 == next_class) {
|
||||
OBJ_CONSTRUCT(&classes, opal_pointer_array_t);
|
||||
}
|
||||
opal_pointer_array_add(&classes, class);
|
||||
next_class ++;
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int ompi_grequestx_class_allocate(
|
||||
MPIX_Grequest_class greq_class,
|
||||
void *extra_state,
|
||||
ompi_request_t **request)
|
||||
{
|
||||
ompi_grequestx_class *class = opal_pointer_array_get_item(&classes, greq_class);
|
||||
ompi_grequestx_start(class->gquery_fn, class->gfree_fn, class->gcancel_fn, class->gpoll_fn, extra_state, request);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
54
ompi/request/grequestx.h
Обычный файл
54
ompi/request/grequestx.h
Обычный файл
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef OMPI_GEN_REQUESTX_H
|
||||
#define OMPI_GEN_REQUESTX_H
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "ompi/request/grequest.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/**
|
||||
* Start a generalized request (back end for MPIX_GREQUEST_START)
|
||||
*/
|
||||
OMPI_DECLSPEC int ompi_grequestx_start(
|
||||
MPI_Grequest_query_function *gquery,
|
||||
MPI_Grequest_free_function *gfree,
|
||||
MPI_Grequest_cancel_function *gcancel,
|
||||
MPIX_Grequest_poll_function *gpoll,
|
||||
void* gstate,
|
||||
ompi_request_t** request);
|
||||
|
||||
OMPI_DECLSPEC int ompi_grequestx_class_create(
|
||||
MPI_Grequest_query_function *gquery,
|
||||
MPI_Grequest_free_function *gfree,
|
||||
MPI_Grequest_cancel_function *gcancel,
|
||||
MPIX_Grequest_poll_function *gpoll,
|
||||
MPIX_Grequest_wait_function *gwait,
|
||||
MPIX_Grequest_class *greq_class);
|
||||
|
||||
OMPI_DECLSPEC int ompi_grequestx_class_allocate(
|
||||
MPIX_Grequest_class greq_class,
|
||||
void *extra_state,
|
||||
ompi_request_t **request);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче
Block a user