[MPICH2-dev] question about romio lock functions
    Ryzhykh, Alexey 
    alexey.ryzhykh at intel.com
       
    Thu Sep  8 03:47:19 CDT 2005
    
    
  
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/930ace9e/attachment.htm>
    
    
More information about the mpich2-dev
mailing list