1
1

add initial support for non-blocking read and write operations.

This commit was SVN r32571.
Этот коммит содержится в:
Edgar Gabriel 2014-08-22 01:34:19 +00:00
родитель aec5cd08bd
Коммит 9987135da0
9 изменённых файлов: 196 добавлений и 46 удалений

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2008-2014 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -32,6 +32,7 @@
BEGIN_C_DECLS
struct mca_io_ompio_file_t;
struct mca_ompio_request_t;
/*
* Macro for use in components that are of type coll
@ -129,6 +130,8 @@ typedef size_t (*mca_fbtl_base_module_ipwritev_fn_t)
(struct mca_io_ompio_file_t *file,
int *sorted,
ompi_request_t **request);
typedef bool (*mca_fbtl_base_module_progress_fn_t)
( struct mca_ompio_request_t *request);
/*
* ***********************************************************************
@ -149,11 +152,7 @@ struct mca_fbtl_base_module_1_0_0_t {
mca_fbtl_base_module_ipreadv_fn_t fbtl_ipreadv;
mca_fbtl_base_module_pwritev_fn_t fbtl_pwritev;
mca_fbtl_base_module_ipwritev_fn_t fbtl_ipwritev;
/*
mca_fbtl_base_module_test_fn_t fbtl_test;
mca_fbtl_base_module_wait_fn_t fbtl_wait;
mca_fbtl_base_module_progress_fn_t fbtl_progress;
*/
};
typedef struct mca_fbtl_base_module_1_0_0_t mca_fbtl_base_module_1_0_0_t;
typedef mca_fbtl_base_module_1_0_0_t mca_fbtl_base_module_t;

Просмотреть файл

@ -34,12 +34,13 @@
* *******************************************************************
*/
static mca_fbtl_base_module_1_0_0_t plfs = {
mca_fbtl_plfs_module_init, /* initalise after being selected */
mca_fbtl_plfs_module_init, /* initalise after being selected */
mca_fbtl_plfs_module_finalize, /* close a module on a communicator */
mca_fbtl_plfs_preadv,
mca_fbtl_plfs_ipreadv,
mca_fbtl_plfs_pwritev,
mca_fbtl_plfs_ipwritev
mca_fbtl_plfs_preadv, /* blocking read */
NULL, /* non-blocking read */
mca_fbtl_plfs_pwritev, /* blocking write */
NULL, /* non-blocking write */
NULL /* module specific progress */
};
/*
* *******************************************************************

Просмотреть файл

@ -34,12 +34,13 @@
* *******************************************************************
*/
static mca_fbtl_base_module_1_0_0_t posix = {
mca_fbtl_posix_module_init, /* initalise after being selected */
mca_fbtl_posix_module_init, /* initalise after being selected */
mca_fbtl_posix_module_finalize, /* close a module on a communicator */
mca_fbtl_posix_preadv,
mca_fbtl_posix_ipreadv,
mca_fbtl_posix_pwritev,
mca_fbtl_posix_ipwritev
mca_fbtl_posix_preadv, /* blocking read */
NULL, /* non-blocking read */
mca_fbtl_posix_pwritev, /* blocking write */
NULL, /* non-blocking write */
NULL /* module specific progress */
};
/*
* *******************************************************************

Просмотреть файл

@ -34,12 +34,13 @@
* *******************************************************************
*/
static mca_fbtl_base_module_1_0_0_t pvfs2 = {
mca_fbtl_pvfs2_module_init, /* initalise after being selected */
mca_fbtl_pvfs2_module_init, /* initalise after being selected */
mca_fbtl_pvfs2_module_finalize, /* close a module on a communicator */
mca_fbtl_pvfs2_preadv,
mca_fbtl_pvfs2_ipreadv,
mca_fbtl_pvfs2_pwritev,
mca_fbtl_pvfs2_ipwritev
mca_fbtl_pvfs2_preadv, /* blocking read */
NULL, /* non-blocking read */
mca_fbtl_pvfs2_pwritev, /* blocking write */
NULL, /* non-blocking write */
NULL /* module specific progress */
};
/*
* *******************************************************************

Просмотреть файл

@ -51,4 +51,5 @@ sources = \
io_ompio_file_open.c \
io_ompio_file_write.c \
io_ompio_file_read.c \
io_ompio_request.c \
io_ompio_nbc.c

Просмотреть файл

@ -30,7 +30,9 @@
#include "ompi/mca/fbtl/base/base.h"
#include "io_ompio.h"
#include "io_ompio_request.h"
#include "math.h"
#include <unistd.h>
/* Read and write routines are split into two interfaces.
** The
@ -215,6 +217,17 @@ int ompio_io_ompio_file_iread (mca_io_ompio_file_t *fh,
ompi_request_t **request)
{
int ret = OMPI_SUCCESS;
mca_ompio_request_t *ompio_req=NULL;
ompio_req = OBJ_NEW(mca_ompio_request_t);
ompio_req->req_type = MCA_OMPIO_REQUEST_READ;
if ( 0 == count ) {
ompi_request_complete (&ompio_req->req_ompi, 0);
ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS;
ompio_req->req_ompi.req_status._ucount = 0;
return OMPI_SUCCESS;
}
if ( NULL != fh->f_fbtl->fbtl_ipreadv ) {
// This fbtl has support for non-blocking operations
@ -227,13 +240,6 @@ int ompio_io_ompio_file_iread (mca_io_ompio_file_t *fh,
int i = 0; /* index into the decoded iovec of the buffer */
int j = 0; /* index into the file vie iovec */
if ( 0 == count ) {
// if ( MPI_STATUS_IGNORE != status ) {
// status->_ucount = 0;
// }
// return ret;
}
ompi_io_ompio_decode_datatype (fh,
datatype,
count,
@ -270,16 +276,18 @@ int ompio_io_ompio_file_iread (mca_io_ompio_file_t *fh,
free (decoded_iov);
decoded_iov = NULL;
}
// if ( MPI_STATUS_IGNORE != status ) {
// status->_ucount = max_data;
// }
}
else {
// This fbtl does not support non-blocking operations
ompio_io_ompio_file_read (fh, buf, count, datatype, MPI_STATUS_IGNORE);
ompi_status_public_t status;
ret = ompio_io_ompio_file_read (fh, buf, count, datatype, &status);
ompi_request_complete (&ompio_req->req_ompi, 0);
ompio_req->req_ompi.req_status.MPI_ERROR = ret;
ompio_req->req_ompi.req_status._ucount = status._ucount;
}
*request = (ompi_request_t *) ompio_req;
return ret;
}

Просмотреть файл

@ -32,6 +32,7 @@
#include "ompi/mca/sharedfp/base/base.h"
#include "io_ompio.h"
#include "io_ompio_request.h"
#include "math.h"
#include <unistd.h>
@ -206,9 +207,20 @@ int ompio_io_ompio_file_iwrite (mca_io_ompio_file_t *fh,
ompi_request_t **request)
{
int ret = OMPI_SUCCESS;
mca_ompio_request_t *ompio_req=NULL;
ompio_req = OBJ_NEW(mca_ompio_request_t);
ompio_req->req_type = MCA_OMPIO_REQUEST_WRITE;
if ( 0 == count ) {
ompi_request_complete (&ompio_req->req_ompi, 0);
ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS;
ompio_req->req_ompi.req_status._ucount = 0;
return OMPI_SUCCESS;
}
if ( NULL != fh->f_fbtl->fbtl_ipwritev ) {
// This fbtl has support for non-blocking operations
/* This fbtl has support for non-blocking operations */
uint32_t iov_count = 0;
struct iovec *decoded_iov = NULL;
@ -217,13 +229,6 @@ int ompio_io_ompio_file_iwrite (mca_io_ompio_file_t *fh,
int i = 0; /* index into the decoded iovec of the buffer */
int j = 0; /* index into the file vie iovec */
if ( 0 == count ) {
// if ( MPI_STATUS_IGNORE != status ) {
// status->_ucount = 0;
// }
return ret;
}
ompi_io_ompio_decode_datatype (fh,
datatype,
count,
@ -258,17 +263,18 @@ int ompio_io_ompio_file_iwrite (mca_io_ompio_file_t *fh,
free (decoded_iov);
decoded_iov = NULL;
}
//if ( MPI_STATUS_IGNORE != status ) {
// status->_ucount = max_data;
// }
}
else {
// This fbtl does not support non-blocking write operations
ret = ompio_io_ompio_file_write(fh,buf,count,datatype,MPI_STATUS_IGNORE);
ompi_status_public_t status;
ret = ompio_io_ompio_file_write(fh,buf,count,datatype, &status);
ompi_request_complete (&ompio_req->req_ompi, 0);
ompio_req->req_ompi.req_status.MPI_ERROR = ret;
ompio_req->req_ompi.req_status._ucount = status._ucount;
}
*request = (ompi_request_t *) ompio_req;
return ret;
}

66
ompi/mca/io/ompio/io_ompio_request.c Обычный файл
Просмотреть файл

@ -0,0 +1,66 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 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) 2008-2014 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "io_ompio_request.h"
static void mca_io_ompio_request_construct(mca_ompio_request_t* req);
static void mca_io_ompio_request_destruct(mca_ompio_request_t *req);
static int mca_io_ompio_request_free ( struct ompi_request_t **req)
{
mca_ompio_request_t *ompio_req = ( mca_ompio_request_t *)*req;
opal_list_remove_item (&mca_io_ompio_pending_requests, &ompio_req->req_item);
OBJ_RELEASE (*req);
return OMPI_SUCCESS;
}
static int mca_io_ompio_request_cancel ( struct ompi_request_t *req, int flag)
{
return OMPI_SUCCESS;
}
OBJ_CLASS_INSTANCE(mca_ompio_request_t, ompi_request_t,
mca_io_ompio_request_construct,
mca_io_ompio_request_destruct);
void mca_io_ompio_request_construct(mca_ompio_request_t* req)
{
OMPI_REQUEST_INIT (&(req->req_ompi), false );
req->req_ompi.req_free = mca_io_ompio_request_free;
req->req_ompi.req_cancel = mca_io_ompio_request_cancel;
req->req_data = NULL;
req->req_progress_fn = NULL;
OBJ_CONSTRUCT(&req->req_item, opal_list_item_t);
opal_list_append (&mca_io_ompio_pending_requests, &req->req_item);
return;
}
void mca_io_ompio_request_destruct(mca_ompio_request_t* req)
{
OMPI_REQUEST_FINI ( &(req->req_ompi));
OBJ_DESTRUCT (&req->req_item);
if ( NULL != req->req_data ) {
free (req->req_data);
}
return;
}

67
ompi/mca/io/ompio/io_ompio_request.h Обычный файл
Просмотреть файл

@ -0,0 +1,67 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 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) 2008-2014 University of Houston. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_IO_OMPIO_REQUEST_H
#define MCA_IO_OMPIO_REQUEST_H
#include "ompi_config.h"
#include "ompi/request/request.h"
#include "ompi/mca/fbtl/fbtl.h"
#include "io_ompio.h"
BEGIN_C_DECLS
extern opal_list_t mca_io_ompio_pending_requests;
/**
* Type of request.
*/
typedef enum {
MCA_OMPIO_REQUEST_WRITE,
MCA_OMPIO_REQUEST_READ,
MCA_OMPIO_REQUEST_WRITE_ALL,
MCA_OMPIO_REQUEST_READ_ALL,
} mca_ompio_request_type_t;
/**
* Main structure for OMPIO requests
*/
struct mca_ompio_request_t {
ompi_request_t req_ompi;
mca_ompio_request_type_t req_type;
void *req_data;
opal_list_item_t req_item;
mca_fbtl_base_module_progress_fn_t *req_progress_fn;
};
typedef struct mca_ompio_request_t mca_ompio_request_t;
OBJ_CLASS_DECLARATION(mca_ompio_request_t);
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
#define GET_OMPIO_REQ_FROMM_ITEM(ITEM) container_of((ITEM), mca_ompio_request_t, req_item)
END_C_DECLS
#endif /* MCA_IO_OMPIO_REQUEST_H */