1
1

Merge pull request #2014 from edgargabriel/topic/mt-io

Topic/mt io
Этот коммит содержится в:
Edgar Gabriel 2016-08-26 08:54:45 -05:00 коммит произвёл GitHub
родитель 9ae51a09f2 1ba03d38ec
Коммит b5c757e82c
4 изменённых файлов: 121 добавлений и 8 удалений

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

@ -50,6 +50,11 @@ int mca_io_ompio_file_open (ompi_communicator_t *comm,
mca_io_ompio_data_t *data=NULL;
bool use_sharedfp = true;
/* No locking required for file_open according to my understanding
There is virtually no way on how to reach this point from multiple
threads simultaniously
*/
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
if ( NULL == data ) {
return OMPI_ERR_OUT_OF_RESOURCE;
@ -58,7 +63,9 @@ int mca_io_ompio_file_open (ompi_communicator_t *comm,
/*save pointer back to the file_t structure */
data->ompio_fh.f_fh = fh;
/* No lock required for file_open even in multi-threaded scenarios,
since only one collective operation per communicator
is allowed anyway */
ret = mca_common_ompio_file_open(comm,filename,amode,info,&data->ompio_fh,use_sharedfp);
if ( OMPI_SUCCESS == ret ) {
@ -82,6 +89,10 @@ int mca_io_ompio_file_close (ompi_file_t *fh)
/* structure has already been freed, this is an erroneous call to file_close */
return ret;
}
/* No locking required for file_close according to my understanding.
Multiple threads closing the same file handle at the same time
is a clear user error.
*/
ret = mca_common_ompio_file_close(&data->ompio_fh);
if ( NULL != data ) {
@ -96,6 +107,10 @@ int mca_io_ompio_file_delete (const char *filename,
{
int ret = OMPI_SUCCESS;
/* No locking required for file_delete according to my understanding.
One thread will succeed, the other ones silently ignore the
error that the file is already deleted.
*/
ret = unlink(filename);
if (0 > ret && ENOENT != errno ) {
@ -117,6 +132,7 @@ int mca_io_ompio_file_preallocate (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
tmp = diskspace;
ret = data->ompio_fh.f_comm->c_coll.coll_bcast (&tmp,
@ -126,19 +142,23 @@ int mca_io_ompio_file_preallocate (ompi_file_t *fh,
data->ompio_fh.f_comm,
data->ompio_fh.f_comm->c_coll.coll_bcast_module);
if ( OMPI_SUCCESS != ret ) {
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_ERROR;
}
if (tmp != diskspace) {
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_ERROR;
}
ret = data->ompio_fh.f_fs->fs_file_get_size (&data->ompio_fh,
&current_size);
if ( OMPI_SUCCESS != ret ) {
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_ERROR;
}
if ( current_size > diskspace ) {
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_SUCCESS;
}
@ -174,11 +194,11 @@ int mca_io_ompio_file_preallocate (ompi_file_t *fh,
if (len > size-written) {
len = size - written;
}
ret = mca_io_ompio_file_read (fh, buf, len, MPI_BYTE, status);
ret = mca_common_ompio_file_read (&data->ompio_fh, buf, len, MPI_BYTE, status);
if (ret != OMPI_SUCCESS) {
goto exit;
}
ret = mca_io_ompio_file_write (fh, buf, len, MPI_BYTE, status);
ret = mca_common_ompio_file_write (&data->ompio_fh, buf, len, MPI_BYTE, status);
if (ret != OMPI_SUCCESS) {
goto exit;
}
@ -195,7 +215,7 @@ int mca_io_ompio_file_preallocate (ompi_file_t *fh,
if (len > diskspace-written) {
len = diskspace - written;
}
ret = mca_io_ompio_file_write (fh, buf, len, MPI_BYTE, status);
ret = mca_common_ompio_file_write (&data->ompio_fh, buf, len, MPI_BYTE, status);
if (ret != OMPI_SUCCESS) {
goto exit;
}
@ -215,6 +235,7 @@ exit:
if ( diskspace > current_size ) {
data->ompio_fh.f_fs->fs_file_set_size (&data->ompio_fh, diskspace);
}
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -229,7 +250,7 @@ int mca_io_ompio_file_set_size (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
tmp = size;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = data->ompio_fh.f_comm->c_coll.coll_bcast (&tmp,
1,
OMPI_OFFSET_DATATYPE,
@ -238,17 +259,20 @@ int mca_io_ompio_file_set_size (ompi_file_t *fh,
data->ompio_fh.f_comm->c_coll.coll_bcast_module);
if ( OMPI_SUCCESS != ret ) {
opal_output(1, ",mca_io_ompio_file_set_size: error in bcast\n");
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
if (tmp != size) {
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_ERROR;
}
ret = data->ompio_fh.f_fs->fs_file_set_size (&data->ompio_fh, size);
if ( OMPI_SUCCESS != ret ) {
opal_output(1, ",mca_io_ompio_file_set_size: error in fs->set_size\n");
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -256,8 +280,10 @@ int mca_io_ompio_file_set_size (ompi_file_t *fh,
data->ompio_fh.f_comm->c_coll.coll_barrier_module);
if ( OMPI_SUCCESS != ret ) {
opal_output(1, ",mca_io_ompio_file_set_size: error in barrier\n");
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -269,7 +295,9 @@ int mca_io_ompio_file_get_size (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_get_size(&data->ompio_fh,size);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -281,6 +309,8 @@ int mca_io_ompio_file_get_amode (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
/* No lock necessary in this case, amode is set in file_open, and
not modified later on*/
*amode = data->ompio_fh.f_amode;
return OMPI_SUCCESS;
@ -340,6 +370,7 @@ int mca_io_ompio_file_set_atomicity (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
if (flag) {
flag = 1;
}
@ -354,10 +385,12 @@ int mca_io_ompio_file_set_atomicity (ompi_file_t *fh,
data->ompio_fh.f_comm->c_coll.coll_bcast_module);
if (tmp != flag) {
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_ERROR;
}
data->ompio_fh.f_atomicity = flag;
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_SUCCESS;
}
@ -369,7 +402,9 @@ int mca_io_ompio_file_get_atomicity (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
*flag = data->ompio_fh.f_atomicity;
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_SUCCESS;
}
@ -381,7 +416,9 @@ int mca_io_ompio_file_sync (ompi_file_t *fh)
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = data->ompio_fh.f_fs->fs_file_sync (&data->ompio_fh);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -397,11 +434,13 @@ int mca_io_ompio_file_seek (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
offset = off * data->ompio_fh.f_etype_size;
switch(whence) {
case MPI_SEEK_SET:
if (offset < 0) {
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_ERROR;
}
break;
@ -409,6 +448,7 @@ int mca_io_ompio_file_seek (ompi_file_t *fh,
offset += data->ompio_fh.f_position_in_file_view;
offset += data->ompio_fh.f_disp;
if (offset < 0) {
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_ERROR;
}
break;
@ -417,15 +457,19 @@ int mca_io_ompio_file_seek (ompi_file_t *fh,
&temp_offset);
offset += temp_offset;
if (offset < 0 || OMPI_SUCCESS != ret) {
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_ERROR;
}
break;
default:
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_ERROR;
}
ret = mca_common_ompio_set_explicit_offset (&data->ompio_fh,
offset/data->ompio_fh.f_etype_size);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -439,7 +483,9 @@ int mca_io_ompio_file_get_position (ompi_file_t *fd,
data = (mca_io_ompio_data_t *) fd->f_io_selected_data;
fh = &data->ompio_fh;
OPAL_THREAD_UNLOCK(&fd->f_mutex);
ret = mca_common_ompio_file_get_position (fh, offset);
OPAL_THREAD_UNLOCK(&fd->f_mutex);
return ret;
}
@ -455,6 +501,7 @@ int mca_io_ompio_file_get_byte_offset (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
temp_offset = data->ompio_fh.f_view_extent *
(offset*data->ompio_fh.f_etype_size / data->ompio_fh.f_view_size);
@ -481,6 +528,7 @@ int mca_io_ompio_file_get_byte_offset (ompi_file_t *fh,
*disp = data->ompio_fh.f_disp + temp_offset +
(OMPI_MPI_OFFSET_TYPE)(intptr_t)data->ompio_fh.f_decoded_iov[index].iov_base + k;
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return OMPI_SUCCESS;
}
@ -503,7 +551,10 @@ int mca_io_ompio_file_seek_shared (ompi_file_t *fp,
opal_output(0, "No shared file pointer component found for this communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = shared_fp_base_module->sharedfp_seek(fh,offset,whence);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -526,8 +577,10 @@ int mca_io_ompio_file_get_position_shared (ompi_file_t *fp,
opal_output(0, "No shared file pointer component found for this communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = shared_fp_base_module->sharedfp_get_position(fh,offset);
*offset = *offset / fh->f_etype_size;
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}

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

@ -59,7 +59,9 @@ int mca_io_ompio_file_read (ompi_file_t *fp,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fp->f_io_selected_data;
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = mca_common_ompio_file_read(&data->ompio_fh,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -75,7 +77,9 @@ int mca_io_ompio_file_read_at (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_read_at(&data->ompio_fh, offset,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -90,7 +94,9 @@ int mca_io_ompio_file_iread (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_iread(&data->ompio_fh,buf,count,datatype,request);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -107,7 +113,9 @@ int mca_io_ompio_file_iread_at (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_iread_at(&data->ompio_fh,offset,buf,count,datatype,request);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -126,12 +134,14 @@ int mca_io_ompio_file_read_all (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = data->ompio_fh.
f_fcoll->fcoll_file_read_all (&data->ompio_fh,
buf,
count,
datatype,
status);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
if ( MPI_STATUS_IGNORE != status ) {
size_t size;
@ -155,6 +165,7 @@ int mca_io_ompio_file_iread_all (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
fp = &data->ompio_fh;
OPAL_THREAD_LOCK(&fh->f_mutex);
if ( NULL != fp->f_fcoll->fcoll_file_iread_all ) {
ret = fp->f_fcoll->fcoll_file_iread_all (&data->ompio_fh,
buf,
@ -168,6 +179,7 @@ int mca_io_ompio_file_iread_all (ompi_file_t *fh,
individual non-blocking I/O operations. */
ret = mca_common_ompio_file_iread ( fp, buf, count, datatype, request );
}
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -184,7 +196,9 @@ int mca_io_ompio_file_read_at_all (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_read_at_all(&data->ompio_fh,offset,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -200,7 +214,9 @@ int mca_io_ompio_file_iread_at_all (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_iread_at_all ( &data->ompio_fh, offset, buf, count, datatype, request );
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -228,7 +244,9 @@ int mca_io_ompio_file_read_shared (ompi_file_t *fp,
opal_output(0, "No shared file pointer component found for the given communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = shared_fp_base_module->sharedfp_read(fh,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -253,7 +271,9 @@ int mca_io_ompio_file_iread_shared (ompi_file_t *fh,
opal_output(0, "No shared file pointer component found for the given communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = shared_fp_base_module->sharedfp_iread(ompio_fh,buf,count,datatype,request);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -278,8 +298,9 @@ int mca_io_ompio_file_read_ordered (ompi_file_t *fh,
opal_output(0, "No shared file pointer component found for the given communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = shared_fp_base_module->sharedfp_read_ordered(ompio_fh,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -302,7 +323,9 @@ int mca_io_ompio_file_read_ordered_begin (ompi_file_t *fh,
opal_output(0, "No shared file pointer component found for the given communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = shared_fp_base_module->sharedfp_read_ordered_begin(ompio_fh,buf,count,datatype);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -325,7 +348,9 @@ int mca_io_ompio_file_read_ordered_end (ompi_file_t *fh,
opal_output(0, "No shared file pointer component found for the given communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = shared_fp_base_module->sharedfp_read_ordered_end(ompio_fh,buf,status);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -348,6 +373,7 @@ int mca_io_ompio_file_read_all_begin (ompi_file_t *fh,
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
return MPI_ERR_OTHER;
}
/* No need for locking fh->f_mutex, that is done in file_iread_all */
ret = mca_io_ompio_file_iread_all ( fh, buf, count, datatype, &fp->f_split_coll_req );
fp->f_split_coll_in_use = true;
@ -387,7 +413,9 @@ int mca_io_ompio_file_read_at_all_begin (ompi_file_t *fh,
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
return MPI_ERR_REQUEST;
}
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_iread_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req );
OPAL_THREAD_UNLOCK(&fh->f_mutex);
fp->f_split_coll_in_use = true;
return ret;
}

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

@ -71,6 +71,8 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp,
file pointer, once for the shared file pointer (if it is existent)
*/
fh = &data->ompio_fh;
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = mca_common_ompio_set_view(fh, disp, etype, filetype, datarep, info);
if ( NULL != fh->f_sharedfp_data) {
@ -78,6 +80,7 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp,
ret = mca_common_ompio_set_view(sh, disp, etype, filetype, datarep, info);
}
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -93,10 +96,12 @@ int mca_io_ompio_file_get_view (struct ompi_file_t *fp,
data = (mca_io_ompio_data_t *) fp->f_io_selected_data;
fh = &data->ompio_fh;
OPAL_THREAD_LOCK(&fp->f_mutex);
*disp = fh->f_disp;
datatype_duplicate (fh->f_etype, etype);
datatype_duplicate (fh->f_orig_filetype, filetype);
strcpy (datarep, fh->f_datarep);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return OMPI_SUCCESS;
}

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

@ -66,8 +66,9 @@ int mca_io_ompio_file_write (ompi_file_t *fp,
data = (mca_io_ompio_data_t *) fp->f_io_selected_data;
fh = &data->ompio_fh;
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = mca_common_ompio_file_write(fh,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -83,7 +84,9 @@ int mca_io_ompio_file_write_at (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_write_at (&data->ompio_fh, offset,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -98,7 +101,9 @@ int mca_io_ompio_file_iwrite (ompi_file_t *fp,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fp->f_io_selected_data;
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = mca_common_ompio_file_iwrite(&data->ompio_fh,buf,count,datatype,request);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -115,7 +120,9 @@ int mca_io_ompio_file_iwrite_at (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_iwrite_at(&data->ompio_fh,offset,buf,count,datatype,request);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -135,13 +142,14 @@ int mca_io_ompio_file_write_all (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = data->ompio_fh.
f_fcoll->fcoll_file_write_all (&data->ompio_fh,
buf,
count,
datatype,
status);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
if ( MPI_STATUS_IGNORE != status ) {
size_t size;
@ -163,7 +171,9 @@ int mca_io_ompio_file_write_at_all (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_write_at_all(&data->ompio_fh,offset,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -181,6 +191,7 @@ int mca_io_ompio_file_iwrite_all (ompi_file_t *fh,
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
fp = &data->ompio_fh;
OPAL_THREAD_LOCK(&fh->f_mutex);
if ( NULL != fp->f_fcoll->fcoll_file_iwrite_all ) {
ret = fp->f_fcoll->fcoll_file_iwrite_all (&data->ompio_fh,
buf,
@ -194,6 +205,7 @@ int mca_io_ompio_file_iwrite_all (ompi_file_t *fh,
individual non-blocking I/O operations. */
ret = mca_common_ompio_file_iwrite ( fp, buf, count, datatype, request );
}
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -210,7 +222,9 @@ int mca_io_ompio_file_iwrite_at_all (ompi_file_t *fh,
mca_io_ompio_data_t *data;
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_iwrite_at_all ( &data->ompio_fh, offset, buf, count, datatype, request );
OPAL_THREAD_UNLOCK(&fh->f_mutex);
return ret;
}
@ -239,7 +253,9 @@ int mca_io_ompio_file_write_shared (ompi_file_t *fp,
opal_output(0, "No shared file pointer component found for this communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = shared_fp_base_module->sharedfp_write(fh,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -264,7 +280,9 @@ int mca_io_ompio_file_iwrite_shared (ompi_file_t *fp,
opal_output(0, "No shared file pointer component found for this communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = shared_fp_base_module->sharedfp_iwrite(fh,buf,count,datatype,request);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -289,7 +307,9 @@ int mca_io_ompio_file_write_ordered (ompi_file_t *fp,
opal_output(0,"No shared file pointer component found for this communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = shared_fp_base_module->sharedfp_write_ordered(fh,buf,count,datatype,status);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -313,7 +333,9 @@ int mca_io_ompio_file_write_ordered_begin (ompi_file_t *fp,
opal_output(0, "No shared file pointer component found for this communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = shared_fp_base_module->sharedfp_write_ordered_begin(fh,buf,count,datatype);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -336,7 +358,9 @@ int mca_io_ompio_file_write_ordered_end (ompi_file_t *fp,
opal_output(0, "No shared file pointer component found for this communicator. Can not execute\n");
return OMPI_ERROR;
}
OPAL_THREAD_LOCK(&fp->f_mutex);
ret = shared_fp_base_module->sharedfp_write_ordered_end(fh,buf,status);
OPAL_THREAD_UNLOCK(&fp->f_mutex);
return ret;
}
@ -359,6 +383,7 @@ int mca_io_ompio_file_write_all_begin (ompi_file_t *fh,
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
return MPI_ERR_OTHER;
}
/* No need for locking fh->f_mutex, that is done in file_iwrite_all */
ret = mca_io_ompio_file_iwrite_all ( fh, buf, count, datatype, &fp->f_split_coll_req );
fp->f_split_coll_in_use = true;
@ -400,7 +425,9 @@ int mca_io_ompio_file_write_at_all_begin (ompi_file_t *fh,
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
return MPI_ERR_REQUEST;
}
OPAL_THREAD_LOCK(&fh->f_mutex);
ret = mca_common_ompio_file_iwrite_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req );
OPAL_THREAD_UNLOCK(&fh->f_mutex);
fp->f_split_coll_in_use = true;
return ret;