[MPICH2-dev] question about romio lock functions
Rajeev Thakur
thakur at mcs.anl.gov
Thu Sep 8 11:32:54 CDT 2005
Alexey,
Yes, I think it is ok to add that check. For independent reads
and writes, a 0-byte read/write should return success immediately at the MPI
level itself, as we check for that case. For collective reads/writes, we go
further and carry out the operation because we don't know what other
processes may be doing.
Rajeev
_____
From: owner-mpich2-dev at mcs.anl.gov [mailto:owner-mpich2-dev at mcs.anl.gov] On
Behalf Of Ryzhykh, Alexey
Sent: Thursday, September 08, 2005 3:47 AM
To: mpich2-dev at mcs.anl.gov
Cc: Supalov, Alexander; Voronov, German
Subject: [MPICH2-dev] question about romio lock functions
Hi,
I am working at Intel Parallel System & Applications group.
We have a problem with benchmarks for MPI I/O functions for data write
functions MPI_File_write_* when zero length buffer is passed to them.
We see a very long delay in fcnt() function, sometimes it takes several
hours. We used mpich2-1.02 built for ch3:sock. The delay appears because
of following call of fcnt() in ADIO_Set_lock:
int ADIOI_Set_lock(FDTYPE fd, int cmd, int type, ADIO_Offset offset, int
whence,
ADIO_Offset len)
{
int err, error_code;
struct flock lock;
/* Depending on the compiler flags and options, struct flock
may not be defined with types that are the same size as
ADIO_Offsets. */
/* FIXME: This is a temporary hack until we use flock64 where
available. It also doesn't fix the broken Solaris header sys/types.h
header file, which declars off_t as a UNION ! Configure tests to
see if the off64_t is a union if large file support is requested;
if so, it does not select large file support.
*/
#ifdef NEEDS_INT_CAST_WITH_FLOCK
lock.l_type = type;
lock.l_start = (int)offset;
lock.l_whence = whence;
lock.l_len = (int)len;
#else
lock.l_type = type;
lock.l_whence = whence;
lock.l_start = offset;
lock.l_len = len;
#endif
do {
err = fcntl(fd, cmd, &lock);
} while (err && (errno == EINTR));
.........
When zero length buffer is passed to MPI_File_write_*() the field
lock.l_len is assigned to zero as well.
In this case the whole file is locked but there is no reason to do that.
Linux man says:
"Specifying 0 for l_len has the special meaning: lock all bytes starting at
the location
specified by l_whence and l_start through to the end of file, no matter
how large the file
grows."
May be there is a reason to add the check of zero len at the beginning of
ADIOI_Set_lock like below:
if( len == 0) return MPI_SUCCESS;
In this case the observed delay is not happened.
I went through mpich2-1.02 romio sources and did not find explicit call of
ADIOI_Set_lock with zero length.
So I assume there are no hindrances to add the check of zero length.
What do you think about this idea?
With best regards,
--
Alexey Ryzhykh
Intel Sarov,
Russia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mcs.anl.gov/mailman/private/mpich2-dev/attachments/20050908/cc57c7a7/attachment.htm>
More information about the mpich2-dev
mailing list