add the protective lock around read and write operations in ompio
Этот коммит содержится в:
родитель
065b93600d
Коммит
41ed4a28d2
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user