1
1

cleanup of the fbtl interfaces: remove the *sorted optimization flag, since it

was not used anyway in the last two years. Simplifies the code significantly.

This commit was SVN r32602.
Этот коммит содержится в:
Edgar Gabriel 2014-08-25 18:04:24 +00:00
родитель 9b95de1b62
Коммит 52eac0146d
24 изменённых файлов: 521 добавлений и 1330 удалений

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

@ -117,18 +117,14 @@ typedef int (*mca_fbtl_base_module_finalize_1_0_0_fn_t)
typedef size_t (*mca_fbtl_base_module_preadv_fn_t)
(struct mca_io_ompio_file_t *file,
int *sorted);
(struct mca_io_ompio_file_t *file );
typedef size_t (*mca_fbtl_base_module_pwritev_fn_t)
(struct mca_io_ompio_file_t *file,
int *sorted);
(struct mca_io_ompio_file_t *file );
typedef size_t (*mca_fbtl_base_module_ipreadv_fn_t)
(struct mca_io_ompio_file_t *file,
int *sorted,
ompi_request_t **request);
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);

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

@ -46,15 +46,11 @@ OMPI_MODULE_DECLSPEC extern mca_fbtl_base_component_2_0_0_t mca_fbtl_plfs_compon
* ******************************************************************
*/
size_t mca_fbtl_plfs_preadv (mca_io_ompio_file_t *file,
int *sorted);
size_t mca_fbtl_plfs_pwritev (mca_io_ompio_file_t *file,
int *sorted);
size_t mca_fbtl_plfs_preadv (mca_io_ompio_file_t *file );
size_t mca_fbtl_plfs_pwritev (mca_io_ompio_file_t *file );
size_t mca_fbtl_plfs_ipreadv (mca_io_ompio_file_t *file,
int *sorted,
ompi_request_t **request);
size_t mca_fbtl_plfs_ipwritev (mca_io_ompio_file_t *file,
int *sorted,
ompi_request_t **request);
/*

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

@ -25,9 +25,7 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_plfs_ipreadv (mca_io_ompio_file_t *file,
int *sorted,
size_t mca_fbtl_plfs_ipreadv (mca_io_ompio_file_t *file,
ompi_request_t **request)
{
printf ("PLFS IPREADV\n");

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

@ -25,9 +25,7 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_plfs_ipwritev (mca_io_ompio_file_t *fh,
int *sorted,
size_t mca_fbtl_plfs_ipwritev (mca_io_ompio_file_t *fh,
ompi_request_t **request)
{
printf ("PLFS IPWRITEV\n");

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

@ -25,9 +25,7 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_plfs_preadv (mca_io_ompio_file_t *fh,
int *sorted)
size_t mca_fbtl_plfs_preadv (mca_io_ompio_file_t *fh )
{
Plfs_fd *pfd = NULL;
@ -50,79 +48,6 @@ mca_fbtl_plfs_preadv (mca_io_ompio_file_t *fh,
return OMPI_ERR_OUT_OF_RESOURCE;
}
if (NULL != sorted) {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (0 == iov_count) {
iov[iov_count].iov_base = fh->f_io_array[sorted[i]].memory_address;
iov[iov_count].iov_len = fh->f_io_array[sorted[i]].length;
iov_offset = (OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i]].offset;
iov_count ++;
}
if (OMPIO_IOVEC_INITIAL_SIZE*block <= iov_count) {
block ++;
iov = (struct iovec *)realloc
(iov, OMPIO_IOVEC_INITIAL_SIZE * block *
sizeof(struct iovec));
if (NULL == iov) {
opal_output(1, "OUT OF MEMORY\n");
return OMPI_ERR_OUT_OF_RESOURCE;
}
}
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i]].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[sorted[i]].length) ==
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i+1]].offset) {
iov[iov_count].iov_base =
fh->f_io_array[sorted[i+1]].memory_address;
iov[iov_count].iov_len = fh->f_io_array[sorted[i+1]].length;
iov_count ++;
continue;
}
}
// Find the total number of bytes to be read.
size_t bytes = 0;
for (int i = 0; i < iov_count; ++i) {
bytes += iov[i].iov_len;
}
// Allocate a temporary buffer to hold the data
char *buffer;
buffer = (char *) malloc (bytes);
if (buffer == NULL) {
return OMPI_ERROR;
}
// Read the data
ssize_t bytes_read;
plfs_ret = plfs_read( pfd, buffer, bytes, iov_offset, &bytes_read );
if (PLFS_SUCCESS != plfs_ret) {
opal_output(0, "fbtl_plfs_preadv: Error in plfs_read:\n%s\n", strplfserr(plfs_ret));
return OMPI_ERROR;
}
if (bytes_read < 0)
return OMPI_ERROR;
// Copy the data from BUFFER into the memory specified by IOV
bytes = bytes_read;
for (int i = 0; i < iov_count; ++i) {
size_t copy = MIN (iov[i].iov_len, bytes);
(void) memcpy ((void *) iov[i].iov_base, (void *) buffer, copy);
buffer += copy;
bytes -= copy;
if (bytes == 0) {
break;
}
}
iov_count = 0;
}
}
else {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (0 == iov_count) {
iov[iov_count].iov_base = fh->f_io_array[i].memory_address;
@ -191,7 +116,6 @@ mca_fbtl_plfs_preadv (mca_io_ompio_file_t *fh,
}
iov_count = 0;
}
}
if (NULL != iov) {
free (iov);
iov = NULL;

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

@ -26,9 +26,7 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_plfs_pwritev (mca_io_ompio_file_t *fh,
int *sorted)
size_t mca_fbtl_plfs_pwritev (mca_io_ompio_file_t *fh )
{
Plfs_fd *pfd = NULL;
plfs_error_t plfs_ret;
@ -50,76 +48,6 @@ mca_fbtl_plfs_pwritev (mca_io_ompio_file_t *fh,
return OMPI_ERR_OUT_OF_RESOURCE;
}
if (NULL != sorted) {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (0 == iov_count) {
iov[iov_count].iov_base = fh->f_io_array[sorted[i]].memory_address;
iov[iov_count].iov_len = fh->f_io_array[sorted[i]].length;
iov_offset = (OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i]].offset;
iov_count ++;
}
if (OMPIO_IOVEC_INITIAL_SIZE*block <= iov_count) {
block ++;
iov = (struct iovec *)realloc
(iov, OMPIO_IOVEC_INITIAL_SIZE * block *
sizeof(struct iovec));
if (NULL == iov) {
opal_output(1, "OUT OF MEMORY\n");
return OMPI_ERR_OUT_OF_RESOURCE;
}
}
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i]].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[sorted[i]].length) ==
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i+1]].offset) {
iov[iov_count].iov_base =
fh->f_io_array[sorted[i+1]].memory_address;
iov[iov_count].iov_len = fh->f_io_array[sorted[i+1]].length;
iov_count ++;
continue;
}
}
// Find the total number of bytes to be written.
size_t bytes = 0;
for (int i = 0; i < iov_count; ++i) {
bytes += iov[i].iov_len;
}
// Allocate a temporary buffer to hold the data
char *buffer;
buffer = (char *) malloc (bytes);
if (buffer == NULL) {
return OMPI_ERROR;
}
// Copy the data into BUFFER.
size_t to_copy = bytes;
char *bp = buffer;
for (int i = 0; i < iov_count; ++i) {
size_t copy = MIN (iov[i].iov_len, to_copy);
bp = mempcpy ((void *) bp, (void *) iov[i].iov_base, copy);
to_copy -= copy;
if (to_copy == 0)
break;
}
// Write the data
ssize_t bytes_written;
plfs_ret = plfs_write( pfd, buffer, bytes, iov_offset, 0, &bytes_written );
if (PLFS_SUCCESS != plfs_ret) {
opal_output(0, "fbtl_plfs_pwritev: Error in plfs_write:\n%s\n", strplfserr(plfs_ret));
return OMPI_ERROR;
}
iov_count = 0;
}
}
else {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (0 == iov_count) {
iov[iov_count].iov_base = fh->f_io_array[i].memory_address;
@ -186,7 +114,6 @@ mca_fbtl_plfs_pwritev (mca_io_ompio_file_t *fh,
}
iov_count = 0;
}
}
if (NULL != iov) {
free (iov);

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

@ -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
@ -45,15 +45,11 @@ OMPI_MODULE_DECLSPEC extern mca_fbtl_base_component_2_0_0_t mca_fbtl_posix_compo
* ******************************************************************
*/
size_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *file,
int *sorted);
size_t mca_fbtl_posix_pwritev (mca_io_ompio_file_t *file,
int *sorted);
size_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *file );
size_t mca_fbtl_posix_pwritev (mca_io_ompio_file_t *file );
size_t mca_fbtl_posix_ipreadv (mca_io_ompio_file_t *file,
int *sorted,
ompi_request_t **request);
size_t mca_fbtl_posix_ipwritev (mca_io_ompio_file_t *file,
int *sorted,
ompi_request_t **request);
/*

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

@ -25,9 +25,7 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_posix_ipreadv (mca_io_ompio_file_t *file,
int *sorted,
size_t mca_fbtl_posix_ipreadv (mca_io_ompio_file_t *file,
ompi_request_t **request)
{
printf ("POSIX IPREADV\n");

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

@ -27,9 +27,7 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_posix_ipwritev (mca_io_ompio_file_t *fh,
int *sorted,
size_t mca_fbtl_posix_ipwritev (mca_io_ompio_file_t *fh,
ompi_request_t **request)
{
int i;
@ -48,77 +46,6 @@ mca_fbtl_posix_ipwritev (mca_io_ompio_file_t *fh,
return OMPI_ERR_OUT_OF_RESOURCE;
}
if (NULL != sorted) {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i]].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[sorted[i]].length) ==
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i+1]].offset) {
if (!merge) {
merge_offset = (OMPI_MPI_OFFSET_TYPE) (intptr_t)
fh->f_io_array[sorted[i]].offset;
merge_length = fh->f_io_array[sorted[i]].length;
}
merge_length += fh->f_io_array[sorted[i+1]].length;
merge++;
continue;
}
}
if (merge) {
merge_buf = malloc (merge_length);
if (NULL == merge_buf) {
opal_output(1, "OUT OF MEMORY\n");
return OMPI_ERR_OUT_OF_RESOURCE;
}
k = 0;
while (merge >= 0) {
memcpy (merge_buf + k,
fh->f_io_array[sorted[i-merge]].memory_address,
fh->f_io_array[sorted[i-merge]].length);
k += fh->f_io_array[sorted[i-merge]].length;
merge --;
}
aiocbp[num_req].aio_offset = merge_offset;
aiocbp[num_req].aio_buf = merge_buf;
aiocbp[num_req].aio_nbytes = merge_length;
aiocbp[num_req].aio_fildes = fh->fd;
aiocbp[num_req].aio_reqprio = 0;
aiocbp[num_req].aio_sigevent.sigev_notify = SIGEV_NONE;
if (-1 == aio_write(&aiocbp[num_req])) {
perror("aio_write() error");
return OMPI_ERROR;
}
merge = 0;
merge_offset = 0;
merge_length = 0;
if (NULL != merge_buf) {
free (merge_buf);
merge_buf = NULL;
}
}
else {
aiocbp[num_req].aio_offset = (OMPI_MPI_OFFSET_TYPE)(intptr_t)
fh->f_io_array[sorted[i]].offset;
aiocbp[num_req].aio_buf =
fh->f_io_array[sorted[i]].memory_address;
aiocbp[num_req].aio_nbytes = fh->f_io_array[sorted[i]].length;
aiocbp[num_req].aio_fildes = fh->fd;
aiocbp[num_req].aio_reqprio = 0;
aiocbp[num_req].aio_sigevent.sigev_notify = SIGEV_NONE;
if (-1 == aio_write(&aiocbp[num_req])) {
perror("aio_write() error");
return OMPI_ERROR;
}
}
num_req ++;
}
}
else {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset +
@ -184,14 +111,6 @@ mca_fbtl_posix_ipwritev (mca_io_ompio_file_t *fh,
}
num_req ++;
}
}
/*
ompi_grequest_start (mca_fbtl_aio_query_fn,
mca_fbtl_aio_free_fn,
mca_fbtl_aio_cancel_fn,
mca_fbtl_aio_poll_fn,
mca_fbtl_aio_wait_fn,
request);
*/
return OMPI_SUCCESS;
}

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

@ -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
@ -25,34 +25,18 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh,
int *sorted)
size_t mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh )
{
/*int *fp = NULL;*/
int i, block=1;
struct iovec *iov = NULL;
int iov_count = 0;
OMPI_MPI_OFFSET_TYPE iov_offset = 0;
#if 0
int k;
int merge = 0;
char *merge_buf = NULL;
size_t merge_length = 0;
OMPI_MPI_OFFSET_TYPE merge_offset = 0;
#endif
if (NULL == fh->f_io_array) {
return OMPI_ERROR;
}
/*
fp = (int *)fh->fd;
if (0 == *fp)
{
return OMPI_ERROR;
}
*/
#if 1
iov = (struct iovec *) malloc
(OMPIO_IOVEC_INITIAL_SIZE * sizeof (struct iovec));
if (NULL == iov) {
@ -60,53 +44,6 @@ mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh,
return OMPI_ERR_OUT_OF_RESOURCE;
}
if (NULL != sorted) {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (0 == iov_count) {
iov[iov_count].iov_base = fh->f_io_array[sorted[i]].memory_address;
iov[iov_count].iov_len = fh->f_io_array[sorted[i]].length;
iov_offset = (OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i]].offset;
iov_count ++;
}
if (OMPIO_IOVEC_INITIAL_SIZE*block <= iov_count) {
block ++;
iov = (struct iovec *)realloc
(iov, OMPIO_IOVEC_INITIAL_SIZE * block *
sizeof(struct iovec));
if (NULL == iov) {
opal_output(1, "OUT OF MEMORY\n");
return OMPI_ERR_OUT_OF_RESOURCE;
}
}
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i]].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[sorted[i]].length) ==
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i+1]].offset) {
iov[iov_count].iov_base =
fh->f_io_array[sorted[i+1]].memory_address;
iov[iov_count].iov_len = fh->f_io_array[sorted[i+1]].length;
iov_count ++;
continue;
}
}
if (-1 == lseek (fh->fd, iov_offset, SEEK_SET)) {
perror ("fseek");
return OMPI_ERROR;
}
if (-1 == readv (fh->fd, iov, iov_count)) {
perror ("readv");
return OMPI_ERROR;
}
else {
iov_count = 0;
}
}
}
else {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (0 == iov_count) {
iov[iov_count].iov_base = fh->f_io_array[i].memory_address;
@ -150,118 +87,11 @@ mca_fbtl_posix_preadv (mca_io_ompio_file_t *fh,
iov_count = 0;
}
}
}
if (NULL != iov) {
free (iov);
iov = NULL;
}
#endif
#if 0
if (NULL != sorted) {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[sorted[i]].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[sorted[i]].length) ==
(OMPI_MPI_OFFSET_TYPE)fh->f_io_array[sorted[i+1]].offset) {
if (!merge) {
merge_offset = (OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[sorted[i]].offset;
merge_length = fh->f_io_array[sorted[i]].length;
}
merge_length += fh->f_io_array[sorted[i+1]].length;
merge++;
continue;
}
}
if (merge) {
merge_buf = malloc (merge_length);
if (-1 == pread(fh->fd,
merge_buf,
merge_length,
merge_offset)) {
perror("pread() error");
return OMPI_ERROR;
}
k = 0;
while (merge >= 0) {
memcpy (fh->f_io_array[sorted[i-merge]].memory_address,
merge_buf + k,
fh->f_io_array[sorted[i-merge]].length);
k += fh->f_io_array[sorted[i-merge]].length;
merge --;
}
merge = 0;
merge_offset = 0;
merge_length = 0;
if (NULL != merge_buf) {
free (merge_buf);
merge_buf = NULL;
}
}
else {
if (-1 == pread(fh->fd,
fh->f_io_array[sorted[i]].memory_address,
fh->f_io_array[sorted[i]].length,
(OMPI_MPI_OFFSET_TYPE)fh->f_io_array[sorted[i]].offset)) {
perror("pread() error");
return OMPI_ERROR;
}
}
}
}
else {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[i].length) ==
(OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i+1].offset) {
if (!merge) {
merge_offset = (OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[i].offset;
merge_length = fh->f_io_array[i].length;
}
merge_length += fh->f_io_array[i+1].length;
merge++;
continue;
}
}
if (merge) {
merge_buf = malloc (merge_length);
if (-1 == pread(fh->fd,
merge_buf,
merge_length,
merge_offset)) {
perror("pread() error");
return OMPI_ERROR;
}
k = 0;
while (merge >= 0) {
memcpy (fh->f_io_array[i-merge].memory_address,
merge_buf + k,
fh->f_io_array[i-merge].length);
k += fh->f_io_array[i-merge].length;
merge --;
}
merge = 0;
merge_offset = 0;
merge_length = 0;
if (NULL != merge_buf) {
free (merge_buf);
merge_buf = NULL;
}
}
else {
if (-1 == pread(fh->fd,
fh->f_io_array[i].memory_address,
fh->f_io_array[i].length,
(OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i].offset)) {
perror("pread() error");
return OMPI_ERROR;
}
}
}
}
#endif
return OMPI_SUCCESS;
}

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

@ -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
@ -27,34 +27,17 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_posix_pwritev (mca_io_ompio_file_t *fh,
int *sorted)
size_t mca_fbtl_posix_pwritev (mca_io_ompio_file_t *fh )
{
/*int *fp = NULL;*/
int i, block = 1;
struct iovec *iov = NULL;
int iov_count = 0;
OMPI_MPI_OFFSET_TYPE iov_offset = 0;
#if 0
int merge = 0;
size_t k;
char *merge_buf = NULL;
size_t merge_length = 0;
OMPI_MPI_OFFSET_TYPE merge_offset = 0;
#endif
if (NULL == fh->f_io_array) {
return OMPI_ERROR;
}
/*
fp = (int *)fh->fd;
if (0 == *fp)
{
return OMPI_ERROR;
}
*/
#if 1
iov = (struct iovec *) malloc
(OMPIO_IOVEC_INITIAL_SIZE * sizeof (struct iovec));
@ -63,52 +46,6 @@ mca_fbtl_posix_pwritev (mca_io_ompio_file_t *fh,
return OMPI_ERR_OUT_OF_RESOURCE;
}
if (NULL != sorted) {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (0 == iov_count) {
iov[iov_count].iov_base = fh->f_io_array[sorted[i]].memory_address;
iov[iov_count].iov_len = fh->f_io_array[sorted[i]].length;
iov_offset = (OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i]].offset;
iov_count ++;
}
if (OMPIO_IOVEC_INITIAL_SIZE*block <= iov_count) {
block ++;
iov = (struct iovec *)realloc
(iov, OMPIO_IOVEC_INITIAL_SIZE * block *
sizeof(struct iovec));
if (NULL == iov) {
opal_output(1, "OUT OF MEMORY\n");
return OMPI_ERR_OUT_OF_RESOURCE;
}
}
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i]].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[sorted[i]].length) ==
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[sorted[i+1]].offset) {
iov[iov_count].iov_base =
fh->f_io_array[sorted[i+1]].memory_address;
iov[iov_count].iov_len = fh->f_io_array[sorted[i+1]].length;
iov_count ++;
continue;
}
}
if (-1 == lseek (fh->fd, iov_offset, SEEK_SET)) {
perror ("lseek");
return OMPI_ERROR;
}
if (-1 == writev (fh->fd, iov, iov_count)) {
perror ("writev");
return OMPI_ERROR;
}
iov_count = 0;
}
}
else {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (0 == iov_count) {
iov[iov_count].iov_base = fh->f_io_array[i].memory_address;
@ -162,137 +99,11 @@ mca_fbtl_posix_pwritev (mca_io_ompio_file_t *fh,
}
iov_count = 0;
}
}
if (NULL != iov) {
free (iov);
iov = NULL;
}
#endif
#if 0
if (NULL != sorted) {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[sorted[i]].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[sorted[i]].length) ==
(OMPI_MPI_OFFSET_TYPE)fh->f_io_array[sorted[i+1]].offset) {
if (!merge) {
merge_offset = (OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[sorted[i]].offset;
merge_length = fh->f_io_array[sorted[i]].length;
}
merge_length += fh->f_io_array[sorted[i+1]].length;
merge++;
continue;
}
}
/*
printf ("RANK: %d Entries: %d MERGE: %d \n", fh->f_rank,fh->f_num_of_io_entries,merge);
if (merge)
printf ("Merge size: %d\n",merge_length);
else
printf ("entry size: %d\n",fh->f_io_array[sorted[i]].length);
sleep(5);
*/
if (merge) {
merge_buf = malloc (merge_length);
k = 0;
while (merge >= 0) {
memcpy (merge_buf + k,
fh->f_io_array[sorted[i-merge]].memory_address,
fh->f_io_array[sorted[i-merge]].length);
k += fh->f_io_array[sorted[i-merge]].length;
merge --;
}
if (-1 == pwrite(fh->fd,
merge_buf,
merge_length, merge_offset)) {
perror("write() error");
return OMPI_ERROR;
}
merge = 0;
merge_offset = 0;
merge_length = 0;
if (NULL != merge_buf) {
free (merge_buf);
merge_buf = NULL;
}
}
else {
if (-1 == pwrite(fh->fd,
fh->f_io_array[sorted[i]].memory_address,
fh->f_io_array[sorted[i]].length,
(OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[sorted[i]].offset)) {
perror("pwrite() error");
return OMPI_ERROR;
}
}
}
}
else {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[i].length) ==
(OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i+1].offset) {
if (!merge) {
merge_offset = (OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[i].offset;
merge_length = fh->f_io_array[i].length;
}
merge_length += fh->f_io_array[i+1].length;
merge++;
continue;
}
}
/*
printf ("RANK: %d Entries: %d MERGE: %d \n", fh->f_rank,fh->f_num_of_io_entries,merge);
if (merge)
printf ("Merge size: %d\n",merge_length);
else
printf ("entry size: %d\n",fh->f_io_array[i].length);
sleep(2);
*/
if (merge) {
merge_buf = malloc (merge_length);
k = 0;
while (merge >= 0) {
memcpy (merge_buf + k,
fh->f_io_array[i-merge].memory_address,
fh->f_io_array[i-merge].length);
k += fh->f_io_array[i-merge].length;
merge --;
}
if (-1 == pwrite(fh->fd,
merge_buf,
merge_length,
merge_offset)) {
perror("write() error");
return OMPI_ERROR;
}
merge = 0;
merge_offset = 0;
merge_length = 0;
if (NULL != merge_buf) {
free (merge_buf);
merge_buf = NULL;
}
}
else {
if (-1 == pwrite(fh->fd,
fh->f_io_array[i].memory_address,
fh->f_io_array[i].length,
(OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[i].offset)) {
perror("pwrite() error");
return OMPI_ERROR;
}
}
}
}
#endif
return OMPI_SUCCESS;
}

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

@ -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
@ -57,14 +57,12 @@ OMPI_MODULE_DECLSPEC extern mca_fbtl_base_component_2_0_0_t mca_fbtl_pvfs2_compo
* ******************************************************************
*/
size_t mca_fbtl_pvfs2_preadv (mca_io_ompio_file_t *file,
int *sorted);
size_t mca_fbtl_pvfs2_pwritev (mca_io_ompio_file_t *file,
int *sorted);
size_t mca_fbtl_pvfs2_preadv (mca_io_ompio_file_t *file);
size_t mca_fbtl_pvfs2_pwritev (mca_io_ompio_file_t *file);
size_t mca_fbtl_pvfs2_ipreadv (mca_io_ompio_file_t *file,
int *sorted, ompi_request_t **request);
ompi_request_t **request);
size_t mca_fbtl_pvfs2_ipwritev (mca_io_ompio_file_t *file,
int *sorted, ompi_request_t **request);
omp_request_t **request);
/*
* ******************************************************************

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

@ -25,9 +25,8 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_pvfs2_ipreadv (mca_io_ompio_file_t *file,
int *sorted, ompi_request_t **request)
size_t mca_fbtl_pvfs2_ipreadv (mca_io_ompio_file_t *file,
ompi_request_t **request)
{
printf ("PVFS2 IPREADV\n");
return OMPI_SUCCESS;

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

@ -25,9 +25,8 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_pvfs2_ipwritev (mca_io_ompio_file_t *file,
int *sorted, ompi_request_t **request)
size_t mca_fbtl_pvfs2_ipwritev (mca_io_ompio_file_t *file,
ompi_request_t **request)
{
printf ("PVFS2 IPWRITEV\n");
return OMPI_SUCCESS;

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

@ -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
@ -30,9 +30,7 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_pvfs2_preadv (mca_io_ompio_file_t *fh,
int *sorted)
size_t mca_fbtl_pvfs2_preadv (mca_io_ompio_file_t *fh)
{
int i;
int ret;
@ -52,99 +50,6 @@ mca_fbtl_pvfs2_preadv (mca_io_ompio_file_t *fh,
return OMPI_ERROR;
}
if (NULL != sorted) {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[sorted[i]].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[sorted[i]].length) ==
(OMPI_MPI_OFFSET_TYPE)fh->f_io_array[sorted[i+1]].offset) {
if (!merge) {
merge_offset = (OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[sorted[i]].offset;
merge_length = fh->f_io_array[sorted[i]].length;
}
merge_length += fh->f_io_array[sorted[i+1]].length;
merge++;
continue;
}
}
if (merge) {
merge_buf = malloc (merge_length);
ret = PVFS_Request_contiguous (merge_length,
PVFS_BYTE,
&mem_req);
if (ret != 0) {
perror("PVFS_Request_contiguous() error");
return OMPI_ERROR;
}
ret = PVFS_Request_contiguous (merge_length,
PVFS_BYTE,
&file_req);
if (ret != 0) {
perror("PVFS_Request_contiguous() error");
return OMPI_ERROR;
}
ret = PVFS_sys_read(pvfs2_fs->object_ref,
file_req,
merge_offset,
merge_buf,
mem_req,
&(pvfs2_fs->credentials),
&resp_io);
if (ret != 0) {
perror("PVFS_sys_write() error");
return OMPI_ERROR;
}
k = 0;
while (merge >= 0) {
memcpy (fh->f_io_array[sorted[i-merge]].memory_address,
merge_buf + k,
fh->f_io_array[sorted[i-merge]].length);
k += fh->f_io_array[sorted[i-merge]].length;
merge --;
}
merge = 0;
merge_offset = 0;
merge_length = 0;
if (NULL != merge_buf) {
free (merge_buf);
merge_buf = NULL;
}
}
else {
ret = PVFS_Request_contiguous (fh->f_io_array[sorted[i]].length,
PVFS_BYTE,
&mem_req);
if (ret != 0) {
perror("PVFS_Request_contiguous() error");
return OMPI_ERROR;
}
ret = PVFS_Request_contiguous (fh->f_io_array[sorted[i]].length,
PVFS_BYTE,
&file_req);
if (ret != 0) {
perror("PVFS_Request_contiguous() error");
return OMPI_ERROR;
}
ret = PVFS_sys_read(pvfs2_fs->object_ref,
file_req,
(OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[sorted[i]].offset,
fh->f_io_array[sorted[i]].memory_address,
mem_req,
&(pvfs2_fs->credentials),
&resp_io);
if (ret != 0) {
perror("PVFS_sys_write() error");
return OMPI_ERROR;
}
}
}
}
else {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i].offset +
@ -234,6 +139,6 @@ mca_fbtl_pvfs2_preadv (mca_io_ompio_file_t *fh,
}
}
}
}
return OMPI_SUCCESS;
}

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

@ -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
@ -31,9 +31,7 @@
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
size_t
mca_fbtl_pvfs2_pwritev (mca_io_ompio_file_t *fh,
int *sorted)
size_t mca_fbtl_pvfs2_pwritev (mca_io_ompio_file_t *fh )
{
int i;
int merge = 0;
@ -53,107 +51,6 @@ mca_fbtl_pvfs2_pwritev (mca_io_ompio_file_t *fh,
return OMPI_ERROR;
}
if (NULL != sorted) {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[sorted[i]].offset +
(OPAL_PTRDIFF_TYPE)fh->f_io_array[sorted[i]].length) ==
(OMPI_MPI_OFFSET_TYPE)fh->f_io_array[sorted[i+1]].offset) {
if (!merge) {
merge_offset = (OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[sorted[i]].offset;
merge_length = fh->f_io_array[sorted[i]].length;
}
merge_length += fh->f_io_array[sorted[i+1]].length;
merge++;
continue;
}
}
/*
printf ("RANK: %d Entries: %d MERGE: %d \n", fh->f_rank,fh->f_num_of_io_entries,merge);
if (merge)
printf ("Merge size: %d\n",merge_length);
else
printf ("entry size: %d\n",fh->f_io_array[sorted[i]].length);
sleep(5);
*/
if (merge) {
merge_buf = malloc (merge_length);
k = 0;
while (merge >= 0) {
memcpy (merge_buf + k,
fh->f_io_array[sorted[i-merge]].memory_address,
fh->f_io_array[sorted[i-merge]].length);
k += fh->f_io_array[sorted[i-merge]].length;
merge --;
}
ret = PVFS_Request_contiguous (merge_length,
PVFS_BYTE,
&mem_req);
if (ret != 0) {
perror("PVFS_Request_contiguous() error");
return OMPI_ERROR;
}
ret = PVFS_Request_contiguous (merge_length,
PVFS_BYTE,
&file_req);
if (ret != 0) {
perror("PVFS_Request_contiguous() error");
return OMPI_ERROR;
}
ret = PVFS_sys_write (pvfs2_fs->object_ref,
file_req,
merge_offset,
merge_buf,
mem_req,
&(pvfs2_fs->credentials),
&resp_io);
if (ret != 0) {
perror("PVFS_sys_write() error");
return OMPI_ERROR;
}
merge = 0;
merge_offset = 0;
merge_length = 0;
if (NULL != merge_buf) {
free (merge_buf);
merge_buf = NULL;
}
}
else {
ret = PVFS_Request_contiguous (fh->f_io_array[sorted[i]].length,
PVFS_BYTE,
&mem_req);
if (ret != 0) {
perror("PVFS_Request_contiguous() error");
return OMPI_ERROR;
}
ret = PVFS_Request_contiguous (fh->f_io_array[sorted[i]].length,
PVFS_BYTE,
&file_req);
if (ret != 0) {
perror("PVFS_Request_contiguous() error");
return OMPI_ERROR;
}
ret = PVFS_sys_write (pvfs2_fs->object_ref,
file_req,
(OMPI_MPI_OFFSET_TYPE)
fh->f_io_array[sorted[i]].offset,
fh->f_io_array[sorted[i]].memory_address,
mem_req,
&(pvfs2_fs->credentials),
&resp_io);
if (ret != 0) {
perror("PVFS_sys_write() error");
return OMPI_ERROR;
}
}
}
}
else {
for (i=0 ; i<fh->f_num_of_io_entries ; i++) {
if (fh->f_num_of_io_entries != i+1) {
if (((OMPI_MPI_OFFSET_TYPE)fh->f_io_array[i].offset +
@ -251,6 +148,6 @@ mca_fbtl_pvfs2_pwritev (mca_io_ompio_file_t *fh,
}
}
}
}
return OMPI_SUCCESS;
}

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

@ -617,7 +617,7 @@
#endif
if (fh->f_num_of_io_entries) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh, NULL)) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh)) {
opal_output (1, "READ FAILED\n");
ret = OMPI_ERROR;
goto exit;

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

@ -926,7 +926,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
if (fh->f_num_of_io_entries) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_pwritev (fh, NULL)) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_pwritev (fh)) {
opal_output (1, "WRITE FAILED\n");
ret = OMPI_ERROR;
goto exit;

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

@ -687,7 +687,7 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh,
#endif
if (fh->f_num_of_io_entries) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh, NULL)) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh)) {
opal_output (1, "READ FAILED\n");
ret = OMPI_ERROR;
goto exit;

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

@ -849,7 +849,7 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh,
#endif
if (fh->f_num_of_io_entries) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_pwritev (fh, NULL)) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_pwritev (fh)) {
opal_output (1, "WRITE FAILED\n");
ret = OMPI_ERROR;
goto exit;

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

@ -706,7 +706,7 @@ static int two_phase_read_and_exch(mca_io_ompio_file_t *fh,
fh->f_num_of_io_entries = 1;
if (fh->f_num_of_io_entries){
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh, NULL)) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh)) {
opal_output(1, "READ FAILED\n");
return OMPI_ERROR;
}

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

@ -809,7 +809,7 @@ static int two_phase_exch_and_write(mca_io_ompio_file_t *fh,
#endif
if (fh->f_num_of_io_entries){
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_pwritev (fh, NULL)) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_pwritev (fh)) {
opal_output(1, "WRITE FAILED\n");
return OMPI_ERROR;
}
@ -1050,7 +1050,7 @@ static int two_phase_exchage_data(mca_io_ompio_file_t *fh,
fh->f_io_array[0].length = size;
fh->f_io_array[0].memory_address = write_buf;
if (fh->f_num_of_io_entries){
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh, NULL)) {
if (OMPI_SUCCESS != fh->f_fbtl->fbtl_preadv (fh)) {
opal_output(1, "READ FAILED\n");
return OMPI_ERROR;
}

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

@ -128,7 +128,7 @@ int ompio_io_ompio_file_read (mca_io_ompio_file_t *fh,
&total_bytes_read);
if (fh->f_num_of_io_entries) {
fh->f_fbtl->fbtl_preadv (fh, NULL);
fh->f_fbtl->fbtl_preadv (fh);
}
fh->f_num_of_io_entries = 0;
@ -263,7 +263,7 @@ int ompio_io_ompio_file_iread (mca_io_ompio_file_t *fh,
&total_bytes_read);
if (fh->f_num_of_io_entries) {
fh->f_fbtl->fbtl_ipreadv (fh, NULL, request);
fh->f_fbtl->fbtl_ipreadv (fh, request);
}
fh->f_num_of_io_entries = 0;

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

@ -123,7 +123,7 @@ int ompio_io_ompio_file_write (mca_io_ompio_file_t *fh,
&total_bytes_written);
if (fh->f_num_of_io_entries) {
fh->f_fbtl->fbtl_pwritev (fh, NULL);
fh->f_fbtl->fbtl_pwritev (fh);
}
fh->f_num_of_io_entries = 0;
@ -251,7 +251,7 @@ int ompio_io_ompio_file_iwrite (mca_io_ompio_file_t *fh,
&total_bytes_written);
if (fh->f_num_of_io_entries) {
fh->f_fbtl->fbtl_ipwritev (fh, NULL, request);
fh->f_fbtl->fbtl_ipwritev (fh, request);
}
fh->f_num_of_io_entries = 0;