- get rid of a warning about an unused variable
- return MPI_ERR_OTHER instead of MPI_SUCCESS for the functions that are not yet implemented - add another field to the mca_io_ompio_file_t structure to point back to the ompi_file_t structure. This commit was SVN r26908.
Этот коммит содержится в:
родитель
6285f7d8c0
Коммит
66c5a80dfd
@ -120,8 +120,9 @@ typedef struct mca_io_ompio_access_array_t{
|
||||
struct mca_io_ompio_file_t {
|
||||
/* General parameters */
|
||||
int fd;
|
||||
struct ompi_file_t *f_fh; /* pointer back to the file_t structure */
|
||||
OMPI_MPI_OFFSET_TYPE f_offset; /* byte offset of current position */
|
||||
OMPI_MPI_OFFSET_TYPE f_disp; /* file_view displacement */
|
||||
OMPI_MPI_OFFSET_TYPE f_disp; /* file_view displacement */
|
||||
int f_rank;
|
||||
int f_size;
|
||||
int f_amode;
|
||||
|
@ -62,9 +62,10 @@ mca_io_ompio_file_open (ompi_communicator_t *comm,
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
data->ompio_fh.f_fh = fh;
|
||||
data->ompio_fh.f_iov_type = MPI_DATATYPE_NULL;
|
||||
data->ompio_fh.f_rank = ompi_comm_rank (fh->f_comm);
|
||||
data->ompio_fh.f_size = ompi_comm_size (fh->f_comm);
|
||||
data->ompio_fh.f_rank = ompi_comm_rank (fh->f_comm);
|
||||
data->ompio_fh.f_size = ompi_comm_size (fh->f_comm);
|
||||
remote_arch = opal_local_arch;
|
||||
data->ompio_fh.f_convertor = opal_convertor_create (remote_arch, 0);
|
||||
|
||||
@ -581,11 +582,7 @@ mca_io_ompio_file_seek_shared (ompi_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE offset,
|
||||
int whence)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -594,10 +591,6 @@ int
|
||||
mca_io_ompio_file_get_position_shared (ompi_file_t *fh,
|
||||
OMPI_MPI_OFFSET_TYPE * offset)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
@ -375,11 +375,7 @@ mca_io_ompio_file_iread (ompi_file_t *fh,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_request_t **request)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -391,11 +387,7 @@ mca_io_ompio_file_iread_at (ompi_file_t *fh,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_request_t **request)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -406,11 +398,7 @@ mca_io_ompio_file_read_shared (ompi_file_t *fh,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t * status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -421,11 +409,7 @@ mca_io_ompio_file_iread_shared (ompi_file_t *fh,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_request_t **request)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -436,11 +420,7 @@ mca_io_ompio_file_read_ordered (ompi_file_t *fh,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t * status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -450,11 +430,7 @@ mca_io_ompio_file_read_ordered_begin (ompi_file_t *fh,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -463,10 +439,6 @@ mca_io_ompio_file_read_ordered_end (ompi_file_t *fh,
|
||||
void *buf,
|
||||
ompi_status_public_t * status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
@ -371,165 +371,7 @@ mca_io_ompio_file_iwrite (ompi_file_t *fp,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_request_t **request)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
mca_io_ompio_file_t *fh;
|
||||
size_t total_bytes_written = 0; /* total bytes that have been written*/
|
||||
size_t bytes_to_write_in_cycle = 0; /* left to be written in a cycle*/
|
||||
size_t bytes_per_cycle = 0; /* total written in each cycle by each process*/
|
||||
int index = 0;
|
||||
int cycles = 0;
|
||||
|
||||
uint32_t iov_count = 0;
|
||||
struct iovec *decoded_iov = NULL;
|
||||
|
||||
size_t max_data = 0;
|
||||
int i = 0; /* index into the decoded iovec of the buffer */
|
||||
int j = 0; /* index into the file vie iovec */
|
||||
int k = 0; /* index into the io_array */
|
||||
size_t sum_previous_counts = 0;
|
||||
size_t sum_previous_length = 0;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fp->f_io_selected_data;
|
||||
fh = &data->ompio_fh;
|
||||
|
||||
ompi_io_ompio_decode_datatype (fh,
|
||||
datatype,
|
||||
count,
|
||||
buf,
|
||||
&max_data,
|
||||
&decoded_iov,
|
||||
&iov_count);
|
||||
|
||||
bytes_per_cycle = max_data;
|
||||
cycles = ceil((float)max_data/bytes_per_cycle);
|
||||
|
||||
#if 0
|
||||
printf ("Bytes per Cycle: %d Cycles: %d\n",bytes_per_cycle, cycles);
|
||||
#endif
|
||||
|
||||
sum_previous_length = fh->f_position_in_file_view;
|
||||
j = fh->f_index_in_file_view;
|
||||
|
||||
for (index = 0; index < cycles; index++) {
|
||||
OPAL_PTRDIFF_TYPE disp;
|
||||
int block = 1;
|
||||
|
||||
k = 0;
|
||||
if ((index == cycles-1) && (max_data % bytes_per_cycle)) {
|
||||
bytes_to_write_in_cycle = max_data % bytes_per_cycle;
|
||||
}
|
||||
else {
|
||||
bytes_to_write_in_cycle = bytes_per_cycle;
|
||||
}
|
||||
|
||||
fh->f_io_array = (mca_io_ompio_io_array_t *)malloc
|
||||
(OMPIO_IOVEC_INITIAL_SIZE * sizeof (mca_io_ompio_io_array_t));
|
||||
if (NULL == fh->f_io_array) {
|
||||
opal_output(1, "OUT OF MEMORY\n");
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
while (bytes_to_write_in_cycle) {
|
||||
/* reallocate if needed */
|
||||
if (OMPIO_IOVEC_INITIAL_SIZE*block <= k) {
|
||||
block ++;
|
||||
fh->f_io_array = (mca_io_ompio_io_array_t *)realloc
|
||||
(fh->f_io_array, OMPIO_IOVEC_INITIAL_SIZE *
|
||||
block * sizeof (mca_io_ompio_io_array_t));
|
||||
if (NULL == fh->f_io_array) {
|
||||
opal_output(1, "OUT OF MEMORY\n");
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
if (decoded_iov[i].iov_len -
|
||||
(total_bytes_written - sum_previous_counts) <= 0) {
|
||||
sum_previous_counts += decoded_iov[i].iov_len;
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
disp = (OPAL_PTRDIFF_TYPE)decoded_iov[i].iov_base +
|
||||
(total_bytes_written - sum_previous_counts);
|
||||
fh->f_io_array[k].memory_address = (IOVBASE_TYPE *)disp;
|
||||
|
||||
if (decoded_iov[i].iov_len -
|
||||
(total_bytes_written - sum_previous_counts) >=
|
||||
bytes_to_write_in_cycle) {
|
||||
fh->f_io_array[k].length = bytes_to_write_in_cycle;
|
||||
}
|
||||
else {
|
||||
fh->f_io_array[k].length = decoded_iov[i].iov_len -
|
||||
(total_bytes_written - sum_previous_counts);
|
||||
}
|
||||
if (! (fh->f_flags & OMPIO_CONTIGUOUS_FVIEW)) {
|
||||
if (fh->f_decoded_iov[j].iov_len -
|
||||
(fh->f_total_bytes - sum_previous_length) <= 0) {
|
||||
sum_previous_length += fh->f_decoded_iov[j].iov_len;
|
||||
j = j + 1;
|
||||
if (j == (int)fh->f_iov_count) {
|
||||
j = 0;
|
||||
sum_previous_length = 0;
|
||||
fh->f_offset += fh->f_view_extent;
|
||||
fh->f_position_in_file_view = sum_previous_length;
|
||||
fh->f_index_in_file_view = j;
|
||||
fh->f_total_bytes = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
disp = (OPAL_PTRDIFF_TYPE)fh->f_decoded_iov[j].iov_base +
|
||||
(fh->f_total_bytes - sum_previous_length);
|
||||
fh->f_io_array[k].offset = (IOVBASE_TYPE *)(disp + fh->f_offset);
|
||||
|
||||
if (! (fh->f_flags & OMPIO_CONTIGUOUS_FVIEW)) {
|
||||
if (fh->f_decoded_iov[j].iov_len -
|
||||
(fh->f_total_bytes - sum_previous_length)
|
||||
< fh->f_io_array[k].length) {
|
||||
fh->f_io_array[k].length = fh->f_decoded_iov[j].iov_len -
|
||||
(fh->f_total_bytes - sum_previous_length);
|
||||
}
|
||||
}
|
||||
|
||||
total_bytes_written += fh->f_io_array[k].length;
|
||||
fh->f_total_bytes += fh->f_io_array[k].length;
|
||||
bytes_to_write_in_cycle -= fh->f_io_array[k].length;
|
||||
k = k + 1;
|
||||
}
|
||||
fh->f_position_in_file_view = sum_previous_length;
|
||||
fh->f_index_in_file_view = j;
|
||||
fh->f_num_of_io_entries = k;
|
||||
|
||||
#if 0
|
||||
if (fh->f_rank == 0) {
|
||||
int d;
|
||||
printf("*************************** %d\n", fh->f_num_of_io_entries);
|
||||
|
||||
for (d=0 ; d<fh->f_num_of_io_entries ; d++) {
|
||||
printf(" ADDRESS: %p OFFSET: %p LENGTH: %d\n",
|
||||
fh->f_io_array[d].memory_address,
|
||||
fh->f_io_array[d].offset,
|
||||
fh->f_io_array[d].length);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fh->f_num_of_io_entries) {
|
||||
fh->f_fbtl->fbtl_ipwritev (fh, NULL, request);
|
||||
}
|
||||
|
||||
fh->f_num_of_io_entries = 0;
|
||||
if (NULL != fh->f_io_array) {
|
||||
free (fh->f_io_array);
|
||||
fh->f_io_array = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != decoded_iov) {
|
||||
free (decoded_iov);
|
||||
decoded_iov = NULL;
|
||||
}
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -563,11 +405,7 @@ mca_io_ompio_file_write_shared (ompi_file_t *fh,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t * status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -578,11 +416,7 @@ mca_io_ompio_file_iwrite_shared (ompi_file_t *fh,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_request_t **request)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -593,11 +427,7 @@ mca_io_ompio_file_write_ordered (ompi_file_t *fh,
|
||||
struct ompi_datatype_t *datatype,
|
||||
ompi_status_public_t * status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -607,11 +437,7 @@ mca_io_ompio_file_write_ordered_begin (ompi_file_t *fh,
|
||||
int count,
|
||||
struct ompi_datatype_t *datatype)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -620,10 +446,6 @@ mca_io_ompio_file_write_ordered_end (ompi_file_t *fh,
|
||||
void *buf,
|
||||
ompi_status_public_t *status)
|
||||
{
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_io_ompio_data_t *data;
|
||||
|
||||
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
|
||||
|
||||
int ret = MPI_ERR_OTHER;
|
||||
return ret;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user