1
1

* update ROMIO with the version from MPICH 1.2.7p1, marked as version

2005-06-09

This commit was SVN r8300.
Этот коммит содержится в:
Brian Barrett 2005-11-29 01:41:53 +00:00
родитель 682615dafe
Коммит 8b9a539986
592 изменённых файлов: 23633 добавлений и 19099 удалений

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

@ -20,8 +20,6 @@
# MCA_io_romio_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_io_romio_CONFIG],[
io_romio_LIBS="$LIBS"
AC_ARG_ENABLE([io-romio],
[AC_HELP_STRING([--disable-io-romio],
[Disable the ROMIO MPI-IO component])])
@ -51,19 +49,27 @@ AC_DEFUN([MCA_io_romio_CONFIG],[
AS_IF([test -n "$prefix" -a "$prefix" != "NONE"],
[io_romio_prefix_arg="--prefix=$prefix"],
[io_romio_prefix_arg=])
io_romio_flags="CFLAGS="'"'"$CFLAGS"'"'" CPPFLAGS="'"'"$CPPFLAGS"'"'" FFLAGS="'"'"$FFLAGS"'"'" LDFLAGS="'"'"$LSFLAGS"'"'" --$io_romio_shared-shared --$io_romio_static-static $io_romio_flags $io_romio_prefix_arg"
AC_CHECK_LIB(aio, main)
io_romio_flags="CFLAGS="'"'"$CFLAGS"'"'" CPPFLAGS="'"'"$CPPFLAGS"'"'" FFLAGS="'"'"$FFLAGS"'"'" LDFLAGS="'"'"$LSFLAGS"'"'" --$io_romio_shared-shared --$io_romio_static-static $io_romio_flags $io_romio_prefix_arg --with-mpi=open_mpi"
ompi_show_subtitle "Configuring ROMIO distribution"
OMPI_CONFIG_SUBDIR([ompi/mca/io/romio/romio],
[$io_romio_flags],
[io_romio_happy=1], [io_romio_happy=0])
# grab the libraries list from ROMIO. We don't
# need this for building the component, as libtool
# will figure that part out. But we do need it for
# the wrapper settings
io_romio_save_LIBS="$LIBS"
LIBS=
. ompi/mca/io/romio/romio/localdefs
io_romio_LIBS="$LIBS"
LIBS="$io_romio_save_LIBS"
AS_IF([test "$io_romio_happy" = "1"],
[echo "ROMIO distribution configured successfully"
io_romio_WRAPPER_EXTRA_LIBS="$io_romio_LIBS"
$1],
[LIBS="$io_romio_LIBS"
AC_MSG_WARN([ROMIO distribution did not configure successfully])
[AC_MSG_WARN([ROMIO distribution did not configure successfully])
$2])])])
])

55
ompi/mca/io/romio/romio/.codingcheck Обычный файл
Просмотреть файл

@ -0,0 +1,55 @@
# Here are names that at least at one point were used within ROMIO.
# We should look at these and decide which we wish to allow and which
# should be replaced with something more ROMIO-specific.
%romioDefines = ( 'ROMIO_[A-Za-z0-9_]+' => romio,
'PROFILE' => romio,
'PRINT_ERR_MSG' => romio,
'HPUX' => romio,
'SPPUX'=> romio,
'SX4'=> romio,
'AIO_SUN'=> romio,
'AIO_HANDLE_IN_AIOCB'=> romio,
'NO_FD_IN_AIOCB'=> romio,
'NO_AIO'=> romio,
'AIO_PRIORITY_DEFAULT'=> romio,
'AIO_SIGNOTIFY_NONE'=> romio,
'MPISGI'=> romio,
'CRAY'=> romio,
'PARAGON'=> romio,
'FREEBSD'=> romio,
'LINUX'=> romio,
'tflops'=> romio,
'NFS'=> romio,
'XFS'=> romio,
'CB_CONFIG_LIST_DEBUG'=> romio,
'SFS'=> romio,
'HFS'=> romio,
'UFS'=> romio,
'PVFS_.+' => romio,
'MPI_hpux'=> romio,
'FORTRANCAPS'=> romio,
'MPILAM'=> romio,
'NEEDS_ADIOCB_T'=> romio,
'AGG_DEBUG'=> romio,
'SOLARIS'=> romio,
'IRIX'=> romio,
'AIX'=> romio,
'DEC'=> romio,
'NEEDS_MPI_TEST'=> romio,
'PFS'=> romio,
'PIOFS'=> romio,
'MPICH'=> romio,
'MPICH2' => romio,
'MPI_OFFSET_IS_INT'=> romio,
'MPI_COMBINER_NAMED'=> romio,
'_UNICOS'=> romio,
'MPIHP'=> romio,
);
# Only invoke this function if the function is defined (in case the
# user removed the cpp defines check with -rmchecks=cppdefines)
if (defined(&PushDefinesNames)) {
&PushDefinesNames( "romioDefines", "tree", "add" );
}
1;

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

@ -28,6 +28,8 @@ libromio_dist_la_SOURCES =
libromio_dist_la_LIBADD = \
adio/libadio.la \
mpi-io/libmpi-io.la \
$(MCA_io_romio_STATIC_LTLIBS)
mpi-io/glue/openmpi/libglue.la \
$(MCA_io_romio_STATIC_LTLIBS) \
@ROMIO_LIBLIST@
libromio_dist_la_DEPENDENCIES = \
$(libromio_dist_la_LIBADD)

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

@ -1,8 +1,112 @@
ROMIO: A High-Performance, Portable MPI-IO Implementation
Version 1.2.4, May 2002
Version 2005-06-09
Major Changes in this Version:
Major Changes in this version:
------------------------------
* Fixed performance problems with the darray and subarray datatypes
when using MPICH2.
* Better support for building against existing MPICH and MPICH2 versions.
When building against an existing MPICH installation, use the
"--with-mpi=mpich" option to ROMIO configure. For MPICH2, use the
"--with-mpi=mpich2" option. These will allow ROMIO to take advantage
of internal features of these implementations.
* Deprecation of SFS, HFS, and PIOFS implementations.
These are no longer actively supported, although the code will continue
to be distributed for now.
* Initial support for the Panasas PanFS filesystem.
PanFS allows users to specify the layout of a file at file-creation time.
Layout information includes the number of StorageBlades (SB)
across which the data is stored, the number of SBs across which a
parity stripe is written, and the number of consecutive stripes that
are placed on the same set of SBs. The panfs_layout_* hints are only
used if supplied at file-creation time.
panfs_layout_type - Specifies the layout of a file:
2 = RAID0
3 = RAID5 Parity Stripes
panfs_layout_stripe_unit - The size of the stripe unit in bytes
panfs_layout_total_num_comps - The total number of StorageBlades a file
is striped across.
panfs_layout_parity_stripe_width - If the layout type is RAID5 Parity
Stripes, this hint specifies the
number of StorageBlades in a parity
stripe.
panfs_layout_parity_stripe_depth - If the layout type is RAID5 Parity
Stripes, this hint specifies the
number of contiguous parity stripes written
across the same set of SBs.
panfs_layout_visit_policy - If the layout type is RAID5 Parity Stripes,
the policy used to determine the parity
stripe a given file offset is written to:
1 = Round Robin
PanFS supports the "concurrent write" (CW) mode, where groups of cooperating
clients can disable the PanFS consistency mechanisms and use their own
consistency protocol. Clients participating in concurrent write mode use
application specific information to improve performance while maintaining
file consistency. All clients accessing the file(s) must enable concurrent
write mode. If any client does not enable concurrent write mode, then the
PanFS consistency protocol will be invoked. Once a file is opened in CW mode
on a machine, attempts to open a file in non-CW mode will fail with
EACCES. If a file is already opened in non-CW mode, attempts to open
the file in CW mode will fail with EACCES. The following hint is
used to enable concurrent write mode.
panfs_concurrent_write - If set to 1 at file open time, the file
is opened using the PanFS concurrent write
mode flag. Concurrent write mode is not a
persistent attribute of the file.
Below is an example PanFS layout using the following parameters:
- panfs_layout_type = 3
- panfs_layout_total_num_comps = 100
- panfs_layout_parity_stripe_width = 10
- panfs_layout_parity_stripe_depth = 8
- panfs_layout_visit_policy = 1
Parity Stripe Group 1 Parity Stripe Group 2 . . . Parity Stripe Group 10
---------------------- ---------------------- --------------------
SB1 SB2 ... SB10 SB11 SB12 ... SB20 ... SB91 SB92 ... SB100
----------------------- ----------------------- ---------------------
D1 D2 ... D10 D91 D92 ... D100 D181 D182 ... D190
D11 D12 D20 D101 D102 D110 D191 D192 D193
D21 D22 D30 . . . . . .
D31 D32 D40
D41 D42 D50
D51 D52 D60
D61 D62 D70
D71 D72 D80
D81 D82 D90 D171 D172 D180 D261 D262 D270
D271 D272 D273 . . . . . .
...
* Initial support for the Globus GridFTP filesystem. Work contributed by Troy
Baer (troy@osc.edu).
Major Changes in Version 1.2.5:
------------------------------
* Initial support for MPICH-2
* fix for a bug in which ROMIO would get confused for some permutations
of the aggregator list
* direct io on IRIX's XFS should work now
* fixed an issue with the Fortran bindings that would cause them to fail
when some compilers tried to build them.
* Initial support for deferred opens
Major Changes in Version 1.2.4:
------------------------------
* Added section describing ROMIO MPI_FILE_SYNC and MPI_FILE_CLOSE behavior to
User's Guide
@ -246,10 +350,11 @@ Using ROMIO on NFS
To use ROMIO on NFS, file locking with fcntl must work correctly on
the NFS installation. On some installations, fcntl locks don't work.
To get them to work, you need to use Version 3 of NFS and
have the system administrator mount the NFS file system with the
"noac" option (no attribute caching). Turning off attribute caching
may reduce performance, but it is necessary for correct behavior.
To get them to work, you need to use Version 3 of NFS, ensure that the
lockd daemon is running on all the machines, and have the system
administrator mount the NFS file system with the "noac" option (no
attribute caching). Turning off attribute caching may reduce
performance, but it is necessary for correct behavior.
The following are some instructions we received from Ian Wells of HP
for setting the noac option on NFS. We have not tried them

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

@ -7,20 +7,6 @@ dnl
dnl Get the format of Fortran names. Uses F77, FFLAGS, and sets WDEF.
dnl If the test fails, sets NOF77 to 1, HAVE_FORTRAN to 0.
dnl
dnl Open MPI changes to this file:
dnl
dnl Removed definitions for:
dnl - AC_PROG_ECH_N
dnl - AC_FD_MSG
dnl - AC_MSG_CHECKING
dnl - AC_MSG
dnl - AC_CHECKING
dnl - AC_MSG_WARN
dnl - AC_MSG_RESULT
dnl - AC_TRY_LINK
dnl
dnl Changed all function defintions from "define(name...)" to
dnl "AC_DEFUN([name]...")
dnl
AC_DEFUN([PAC_GET_FORTNAMES],[
rm -f confftest.f confftest.o
@ -33,23 +19,25 @@ AC_DEFUN([PAC_GET_FORTNAMES],[
EOF
$F77 $FFLAGS -c confftest.f > /dev/null 2>&1
if test ! -s confftest.o ; then
print_error "Unable to test Fortran compiler"
print_error "(compiling a test program failed to produce an "
print_error "object file)."
AC_MSG_WARN([Unable to test Fortran compiler. Compiling a test
program failed to produce an object file])
NOF77=1
elif test -z "$FORTRANNAMES" ; then
if test $arch_CRAY ; then
# MAC OS X (and probably FreeBSD need strings - (not strings -a)
# Cray doesn't accept -a ...
nameform1=`strings confftest.o | grep mpir_init_fop_ | head -1`
nameform2=`strings confftest.o | grep MPIR_INIT_FOP | head -1`
nameform3=`strings confftest.o | grep mpir_init_fop | head -1`
nameform4=`strings confftest.o | grep mpir_init_fop__ | head -1`
else
nameform1=`strings -a confftest.o | grep mpir_init_fop_ | head -1`
nameform2=`strings -a confftest.o | grep MPIR_INIT_FOP | head -1`
nameform3=`strings -a confftest.o | grep mpir_init_fop | head -1`
nameform4=`strings -a confftest.o | grep mpir_init_fop__ | head -1`
fi
allstrings="-a"
if test $arch_CRAY ; then
allstrings=""
elif strings - confftest.o < /dev/null >/dev/null 2>&1 ; then
allstrings="-"
elif strings -a confftest.o < /dev/null >/dev/null 2>&1 ; then
allstrings="-a"
fi
nameform1=`strings $allstrings confftest.o | grep mpir_init_fop_ | head -n 1`
nameform2=`strings $allstrings confftest.o | grep MPIR_INIT_FOP | head -n 1`
nameform3=`strings $allstrings confftest.o | grep mpir_init_fop | head -n 1`
nameform4=`strings $allstrings confftest.o | grep mpir_init_fop__ | head -n 1`
rm -f confftest.f confftest.o
if test -n "$nameform4" ; then
echo "Fortran externals are lower case and have two trailing underscores"
@ -65,145 +53,19 @@ EOF
echo "Fortran externals are lower case"
FORTRANNAMES="FORTRANNOUNDERSCORE"
else
print_error "Unable to determine the form of Fortran external names"
print_error "Make sure that the compiler $F77 can be run on this system"
print_error "Turning off Fortran (-nof77 being assumed)."
AC_MSG_WARN([Unable to determine the form of Fortran external names.
Make sure that the compiler $F77 can be run on this system.
Turning off Fortran (-nof77 being assumed)])
NOF77=1
fi
fi
if test -n "$FORTRANNAMES" ; then
WDEF="-D$FORTRANNAMES"
fi
rm -f confftest.f confftest.o
])dnl
dnl
dnl
dnl
dnl PAC_GETWD(varname [, filename ] )
dnl
dnl This is from the aclocal.m4 of MPICH.
dnl Set varname to current directory. Use filename (relative to current
dnl directory) if provided to double check.
dnl
dnl Need a way to use "automounter fix" for this.
dnl
AC_DEFUN([PAC_GETWD],[
$1=$PWD
if test "${$1}" != "" -a -d "${$1}" ; then
if test -r ${$1}/.foo$$ ; then
/bin/rm -f ${$1}/.foo$$
/bin/rm -f .foo$$
fi
if test -r ${$1}/.foo$$ -o -r .foo$$ ; then
$1=
else
echo "test" > ${$1}/.foo$$
if test ! -r .foo$$ ; then
/bin/rm -f ${$1}/.foo$$
$1=
else
/bin/rm -f ${$1}/.foo$$
fi
fi
fi
if test "${$1}" = "" ; then
$1=`pwd | sed -e 's%/tmp_mnt/%/%g'`
fi
dnl
dnl First, test the PWD is sensible
ifelse($2,,,
if test ! -r ${$1}/$2 ; then
dnl PWD must be messed up
$1=`pwd`
if test ! -r ${$1}/$2 ; then
print_error "Cannot determine the root directory!"
exit 1
fi
$1=`pwd | sed -e 's%/tmp_mnt/%/%g'`
if test ! -d ${$1} ; then
print_error "Warning: your default path uses the automounter; this may"
print_error "cause some problems if you use other NFS-connected systems.
"
$1=`pwd`
fi
fi)
if test -z "${$1}" ; then
$1=`pwd | sed -e 's%/tmp_mnt/%/%g'`
if test ! -d ${$1} ; then
print_error "Warning: your default path uses the automounter; this may"
print_error "cause some problems if you use other NFS-connected systems.
"
$1=`pwd`
fi
fi
])
dnl
dnl
dnl PAC_GET_TYPE_SIZE(typename,var_for_size)
dnl
dnl sets var_for_size to the size. Ignores if the size cannot be determined
dnl (see aclocal.m4 in MPICH)
dnl
AC_DEFUN([PAC_GET_TYPE_SIZE],
[Pac_name="$1"
Pac_varname=`echo "$Pac_name" | sed -e 's/ /_/g' -e 's/\*/star/g'`
eval Pac_testval=\$"${Pac_varname}_len"
if test -z "$Pac_testval" ; then
changequote(<<,>>)
define(<<AC_TYPE_NAME>>,translit(CROSS_SIZEOF_$1,[a-z *],[A-Z_P]))dnl
changequote([,])
eval Pac_testval=\$"AC_TYPE_NAME"
fi
if test -n "$Pac_testval" ; then
Pac_CV_NAME=$Pac_testval
else
AC_MSG_CHECKING([for size of $1])
dnl Check for existing size or for CROSS_SIZEOF_name
/bin/rm -f conftestval
AC_TEST_PROGRAM([#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[]) {
FILE *f=fopen("conftestval","w");
if (!f) exit(1);
fprintf( f, "%ld\n", sizeof($1));
exit(0);
}],Pac_CV_NAME=`cat conftestval`,Pac_CV_NAME="")
/bin/rm -f conftestval
if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then
AC_MSG_RESULT($Pac_CV_NAME)
eval ${Pac_varname}_len=$Pac_CV_NAME
else
AC_MSG_RESULT(unavailable)
fi
fi
$2=$Pac_CV_NAME
])dnl
dnl
dnl
dnl
AC_DEFUN([PAC_INT_LT_POINTER],[
if test -z "$intsize" ; then
PAC_GET_TYPE_SIZE(int,intsize)
fi
if test -z "$pointersize" ; then
PAC_GET_TYPE_SIZE(void *,pointersize)
fi
AC_MSG_CHECKING([for int large enough for pointers])
if test -n "$pointersize" -a -n "$intsize" ; then
if test $pointersize -le $intsize ; then
AC_MSG_RESULT(yes)
else
AC_DEFINE(INT_LT_POINTER,,[Define if int smaller than pointer])
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(cannot determine; assuming it is;)
echo "use '-intsize' and '-ptrsize' to indicate otherwise"
fi
])dnl
dnl
dnl
AC_DEFUN([PAC_GET_SPECIAL_SYSTEM_INFO],[
define(PAC_GET_SPECIAL_SYSTEM_INFO,[
#
if test -n "$arch_IRIX"; then
AC_MSG_CHECKING(for IRIX OS version)
@ -212,21 +74,25 @@ if test -n "$arch_IRIX"; then
dnl For example
dnl IRIX_5_4400 (IRIX 5.x, using MIPS 4400)
osversion=`uname -r | sed 's/\..*//'`
dnl Note that we need to allow brackets here, so we briefly turn off
dnl the macro quotes
changequote(,)dnl
dnl Get the second field (looking for 6.1)
osvminor=`uname -r | sed 's/[[]0-9[]]\.\([[]0-9[]]*\)\..*/\1/'`
osvminor=`uname -r | sed 's/[0-9]\.\([0-9]*\)\..*/\1/'`
changequote([,])dnl
AC_MSG_RESULT($osversion)
dnl Get SGI processor count by quick hack
AC_MSG_CHECKING(for IRIX cpucount)
cpucount=`hinv | grep '[[]0-9[]]* [[]0-9[]]* MHZ IP[[]0-9[]]* Proc' | cut -f 1 -d' '`
changequote(,)dnl
cpucount=`hinv | grep '[0-9]* [0-9]* MHZ IP[0-9]* Proc' | cut -f 1 -d' '`
if test "$cpucount" = "" ; then
cpucount=`hinv | grep 'Processor [[]0-9[]]*:' | wc -l | sed -e 's/ //g'`
cpucount=`hinv | grep 'Processor [0-9]*:' | wc -l | sed -e 's/ //g'`
fi
changequote([,])dnl
if test "$cpucount" = "" ; then
print_error "Could not determine cpucount."
print_error "Please send "
AC_MSG_RESULT([Could not determine cpucount. Please send])
hinv
print_error "to romio-maint@mcs.anl.gov"
exit 1
AC_MSG_ERROR([to romio-maint@mcs.anl.gov])
fi
AC_MSG_RESULT($cpucount)
dnl
@ -236,23 +102,19 @@ if test -n "$arch_IRIX"; then
dnl -comm=shared
cputype=`hinv -t cpu | tail -1 | cut -f 3 -d' '`
if test -z "$cputype" ; then
print_error "Could not get cputype from hinv -t cpu command."
print_error "Please send "
AC_MSG_RESULT([Could not get cputype from hinv -t cpu command. Please send])
hinv -t cpu 2>&1
hinv -t cpu | cut -f 3 -d' ' 2>&1
print_error "to romio-maint@mcs.anl.gov"
exit 1
AC_MSG_ERROR([to romio-maint@mcs.anl.gov])
fi
AC_MSG_RESULT($cputype)
dnl echo "checking for osversion and cputype"
dnl cputype may contain R4400, R2000A/R3000, or something else.
dnl We may eventually need to look at it.
if test -z "$osversion" ; then
print_error "Could not determine OS version. Please send"
print_error " "
AC_MSG_RESULT([Could not determine OS version. Please send])
uname -a
print_error "to romio-maint@mcs.anl.gov"
exit 1
AC_MSG_ERROR([to romio-maint@mcs.anl.gov])
elif test $osversion = 4 ; then
true
elif test $osversion = 5 ; then
@ -260,14 +122,12 @@ if test -n "$arch_IRIX"; then
elif test $osversion = 6 ; then
true
else
print_error "Could not recognize the version of IRIX (got $osversion)"
print_error "ROMIO knows about versions 4, 5 and 6; the version being"
print_error "returned from uname -r is $osversion."
print_error "Please send"
AC_MSG_RESULT([Could not recognize the version of IRIX (got $osversion).
ROMIO knows about versions 4, 5 and 6; the version being returned from
uname -r is $osversion. Please send])
uname -a 2>&1
hinv 2>&1
print_error "to romio-maint@mcs.anl.gov"
exit 1
AC_MSG_ERROR([to romio-maint@mcs.anl.gov])
fi
AC_MSG_CHECKING(for cputype)
OLD_ARCH=IRIX
@ -286,15 +146,12 @@ if test -n "$arch_IRIX"; then
10000);;
12000);;
*)
print_error "Unexpected IRIX/MIPS chipset $cputype. Please send the output"
print_error " "
AC_MSG_WARN([Unexpected IRIX/MIPS chipset $cputype. Please send the output])
uname -a 2>&1
hinv 2>&1
print_error " "
print_error "to romio-maint@mcs.anl.gov"
print_error "ROMIO will continue and assume that the cputype is"
print_error "compatible with a MIPS 4400 processor."
print_error " "
AC_MSG_WARN([to romio-maint@mcs.anl.gov
ROMIO will continue and assume that the cputype is
compatible with a MIPS 4400 processor.])
cputype=4400
;;
esac
@ -305,55 +162,7 @@ fi
])dnl
dnl
dnl
dnl On an SGI check whether to link 32 bit objects or 64 bit objects
dnl for the MPI-2 datatype accessor functions
dnl
AC_DEFUN([PAC_CHECK_SGI_3264],[
AC_MSG_CHECKING(for 32-bit or 64-bit objects)
cat <<EOF >bittest.c
main()
{
int i;
i = 0;
}
EOF
$CC $CFLAGS -c bittest.c > /dev/null 2>&1
if test $MIPS = 4 ; then
testlink='$CC $CFLAGS -o bittest bittest.o adio/sgi/mpi2/mips4.64/get_contents.o $MPI_LIB >/dev/null 2>&1'
if eval $testlink ; then
BITS=64
else
testlink='$CC $CFLAGS -o bittest bittest.o adio/sgi/mpi2/mips4.32/get_contents.o $MPI_LIB >/dev/null 2>&1'
if eval $testlink ; then
BITS=32
else
echo "Error: Can't link with either 32-bit or 64-bit"
echo "Send email to romio-maint@mcs.anl.gov"
exit 1
fi
fi
else
testlink='$CC $CFLAGS -o bittest bittest.o adio/sgi/mpi2/mips3.64/get_contents.o $MPI_LIB >/dev/null 2>&1'
if eval $testlink ; then
BITS=64
else
testlink='$CC $CFLAGS -o bittest bittest.o adio/sgi/mpi2/mips3.32/get_contents.o $MPI_LIB >/dev/null 2>&1'
if eval $testlink ; then
BITS=32
else
echo "Error: Can't link with either 32-bit or 64-bit"
echo "Send email to romio-maint@mcs.anl.gov"
exit 1
fi
fi
fi
rm -f bittest*
AC_MSG_RESULT($BITS bit)
])
dnl
dnl
dnl
AC_DEFUN([PAC_TEST_MPI],[
define(PAC_TEST_MPI,[
AC_MSG_CHECKING(if a simple MPI program compiles and links)
rm -f mpitest.c
cat > mpitest.c <<EOF
@ -367,12 +176,10 @@ EOF
rm -f conftest
$CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
if test ! -x conftest ; then
echo " "
print_error "Unable to compile a simple MPI program"
print_error "Use the -mpi, -mpiincdir, and -mpilib options to configure to specify the"
print_error "MPI implementation, the include path for mpi.h, and the MPI library to link"
rm -f conftest mpitest.c
exit 1
AC_MSG_ERROR([Unable to compile a simple MPI program.
Use environment variables to provide the location of MPI libraries and
include directories])
else
rm -f conftest mpitest.c
fi
@ -381,7 +188,7 @@ AC_MSG_RESULT(yes)
dnl
dnl
dnl
AC_DEFUN([PAC_NEEDS_FINT],[
define(PAC_NEEDS_FINT,[
AC_MSG_CHECKING(if MPI_Fint is defined in the MPI implementation)
cat > mpitest1.c <<EOF
#include "mpi.h"
@ -405,23 +212,7 @@ EOF
fi
])dnl
dnl
dnl
dnl
AC_DEFUN([PAC_LONG_64],[
if test -z "$longsize" ; then
PAC_GET_TYPE_SIZE(long,longsize)
fi
if test -n "$longsize" ; then
if test $longsize = 8 ; then
AC_DEFINE(HAVE_LONG_64,,[Define if long is 64 bits])
fi
else
echo "assuming size of long is NOT 8 bytes; use '-longsize' to indicate otherwise"
fi
])dnl
dnl
dnl
AC_DEFUN([PAC_MPI_LONG_LONG_INT],[
define(PAC_MPI_LONG_LONG_INT,[
AC_MSG_CHECKING(if MPI_LONG_LONG_INT is defined in mpi.h)
rm -f mpitest.c
cat > mpitest.c <<EOF
@ -445,79 +236,9 @@ EOF
rm -f conftest mpitest.c
])dnl
dnl
dnl Check that the compile accepts ANSI prototypes.
dnl PAC_CHECK_CC_PROTOTYPES()
dnl
AC_DEFUN([PAC_CHECK_CC_PROTOTYPES],[
AC_MSG_CHECKING(that the compiler $CC accepts ANSI prototypes)
AC_COMPILE_CHECK(,[int f(double a){return 0;}],,eval "ac_cv_ccworks=yes",eval "ac_cv_ccworks=no")
AC_MSG_RESULT($ac_cv_ccworks)
if test $ac_cv_ccworks = "yes" ; then
AC_DEFINE(HAVE_PROTOTYPES,,[Define if C compiler supports prototypes])
fi
])dnl
dnl
dnl
dnl PAC_TEST_LONG_LONG()
dnl
dnl tests if the compiler prints long long correctly and whether to use
dnl %ld or %lld. Called from within PAC_LONG_LONG_64.
dnl
AC_DEFUN([PAC_TEST_LONG_LONG],
[AC_MSG_CHECKING([if the compiler prints long longs correctly with %lld])
rm -f conftestll
AC_TEST_PROGRAM([#include <stdio.h>
main() {
long long i=8;
FILE *f=fopen("conftestll","w");
if (!f) exit(1);
fprintf( f, "%lld\n", i);
exit(0);
}],Pac_CV_NAME=`cat conftestll`,Pac_CV_NAME="")
rm -f conftestll
if test "$Pac_CV_NAME" = 8 ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LONG_LONG_64,,[Define if have 64 bit long long])
DEFINE_MPI_OFFSET="typedef long long MPI_Offset;"
FORTRAN_MPI_OFFSET="integer*8"
echo "defining MPI_Offset as long long in C and integer*8 in Fortran"
LL="\%lld"
else
AC_MSG_RESULT(no)
AC_MSG_CHECKING([if the compiler prints long longs correctly with %ld])
AC_TEST_PROGRAM([#include <stdio.h>
main() {
long long i=8;
FILE *f=fopen("conftestll","w");
if (!f) exit(1);
fprintf( f, "%ld\n", i);
exit(0);
}],Pac_CV_NAME=`cat conftestll`,Pac_CV_NAME="")
rm -f conftestll
if test "$Pac_CV_NAME" = 8 ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LONG_LONG_64,,[Define if long long is 64 bits])
DEFINE_MPI_OFFSET="typedef long long MPI_Offset;"
FORTRAN_MPI_OFFSET="integer*8"
echo "defining MPI_Offset as long long in C and integer*8 in Fortran"
LL="\%ld"
else
AC_MSG_RESULT(no!!)
echo "the compiler doesn't print long longs correctly!"
echo "defining MPI_Offset as long in C and integer in Fortran"
DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
FORTRAN_MPI_OFFSET="integer"
LL="\%ld"
MPI_OFFSET_KIND1="!"
MPI_OFFSET_KIND2="!"
fi
fi
])dnl
dnl
dnl
dnl PAC_LONG_LONG_64: check if there is a 64-bit long long
dnl
AC_DEFUN([PAC_LONG_LONG_64],[
define(PAC_LONG_LONG_64,[
if test -n "$longlongsize" ; then
if test "$longlongsize" = 8 ; then
echo "defining MPI_Offset as long long in C and integer*8 in Fortran"
@ -589,7 +310,7 @@ fi
])dnl
dnl
dnl
AC_DEFUN([PAC_MPI_INFO],[
define(PAC_MPI_INFO,[
AC_MSG_CHECKING(if MPI_Info functions are defined in the MPI implementation)
rm -f mpitest.c
cat > mpitest.c <<EOF
@ -606,7 +327,7 @@ EOF
$CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
if test -x conftest ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MPI_INFO,,[Define if MPI_Info available])
AC_DEFINE(HAVE_MPI_INFO,1,[Define if MPI_Info available])
HAVE_MPI_INFO="#define HAVE_MPI_INFO"
MPI_FINFO1="!"
MPI_FINFO2="!"
@ -624,7 +345,7 @@ EOF
])dnl
dnl
dnl
AC_DEFUN([PAC_MPI_DARRAY_SUBARRAY],[
define(PAC_MPI_DARRAY_SUBARRAY,[
AC_MSG_CHECKING(if darray and subarray constructors are defined in the MPI implementation)
rm -f mpitest.c
cat > mpitest.c <<EOF
@ -667,8 +388,8 @@ EOF
])dnl
dnl
dnl
AC_DEFUN([PAC_CHECK_MPI_SGI_INFO_NULL],[
AC_MSG_CHECKING(if MPI_INFO_NULL is defined in mpi.h)
define(PAC_CHECK_MPI_SGI_INFO_NULL,[
AC_MSG_CHECKING([if MPI_INFO_NULL is defined in mpi.h])
rm -f mpitest.c
cat > mpitest.c <<EOF
#include "mpi.h"
@ -691,7 +412,7 @@ EOF
dnl
dnl
dnl
AC_DEFUN([PAC_CHECK_MPIOF_H],[
define(PAC_CHECK_MPIOF_H,[
AC_MSG_CHECKING(if mpiof.h is included in mpif.h)
rm -f mpitest.f
cat > mpitest.f <<EOF
@ -717,7 +438,7 @@ dnl
dnl
dnl check if pread64 is defined in IRIX. needed on IRIX 6.5
dnl
AC_DEFUN([PAC_HAVE_PREAD64],[
define(PAC_HAVE_PREAD64,[
AC_MSG_CHECKING(if pread64 is defined)
rm -f conftest.c
cat > conftest.c <<EOF
@ -741,7 +462,7 @@ rm -f conftest conftest.c
])dnl
dnl
dnl
AC_DEFUN([PAC_TEST_MPI_SGI_type_is_contig],[
define(PAC_TEST_MPI_SGI_type_is_contig,[
AC_MSG_CHECKING(if MPI_SGI_type_is_contig is defined)
rm -f mpitest.c
cat > mpitest.c <<EOF
@ -769,7 +490,7 @@ EOF
dnl
dnl
dnl
AC_DEFUN([PAC_TEST_MPI_COMBINERS],[
define(PAC_TEST_MPI_COMBINERS,[
AC_MSG_CHECKING(if MPI-2 combiners are defined in mpi.h)
rm -f mpitest.c
cat > mpitest.c <<EOF
@ -799,14 +520,43 @@ dnl PAC_MPI_OFFSET_KIND()
dnl
dnl tries to determine the Fortran 90 kind parameter for 8-byte integers
dnl
AC_DEFUN([PAC_MPI_OFFSET_KIND],
[AC_MSG_CHECKING([for Fortran 90 KIND parameter for 8-byte integers])
rm -f kind.f kind.o kind
cat <<EOF > kind.f
define(PAC_MPI_OFFSET_KIND,
[rm -f conftest*
# Determine the extension for Fortran 90 files (not all compilers accept
# .f and not all accept .f90)
if test -z "$ac_f90ext" ; then
if test -z "$F90" ; then
AC_CHECK_PROGS(F90,f90 xlf90 pgf90 ifort epcf90 f95 fort xlf95 lf95 pathf90 g95 fc ifc efc)
fi
AC_MSG_CHECKING([for extension for Fortran 90 programs])
ac_f90ext="f90"
ac_f90compile='${F90-f90} -c $F90FLAGS conftest.$ac_f90ext 1>&AC_FD_CC'
cat > conftest.$ac_f90ext <<EOF
program conftest
end
EOF
if AC_TRY_EVAL(ac_f90compile) ; then
AC_MSG_RESULT([f90])
else
rm -f conftest*
ac_f90ext="f"
cat > conftest.$ac_f90ext <<EOF
program conftest
end
EOF
if AC_TRY_EVAL(ac_f90compile) ; then
AC_MSG_RESULT([f])
else
AC_MSG_RESULT([unknown!])
fi
fi
fi
AC_MSG_CHECKING([for Fortran 90 KIND parameter for 8-byte integers])
cat <<EOF > conftest.$ac_f90ext
program main
integer i
i = selected_int_kind(16)
open(8, file="k.out", form="formatted")
open(8, file="conftest.out", form="formatted")
write (8,*) i
close(8)
stop
@ -816,13 +566,13 @@ if test -z "$F90" ; then
F90=f90
fi
KINDVAL=""
if $F90 -o kind kind.f >/dev/null 2>&1 ; then
./kind >/dev/null 2>&1
if test -s k.out ; then
KINDVAL=`cat k.out`
if $F90 -o conftest conftest.$ac_f90ext >/dev/null 2>&1 ; then
./conftest >/dev/null 2>&1
if test -s conftest.out ; then
KINDVAL=`cat conftest.out`
fi
fi
rm -f kind k.out kind.f kind.o k.out
rm -f conftest*
if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then
AC_MSG_RESULT($KINDVAL)
MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND"
@ -833,7 +583,7 @@ fi
])dnl
dnl
dnl
AC_DEFUN([PAC_TEST_MPI_HAVE_OFFSET_KIND],[
define(PAC_TEST_MPI_HAVE_OFFSET_KIND,[
AC_MSG_CHECKING(if MPI_OFFSET_KIND is defined in mpif.h)
rm -f mpitest.f
cat > mpitest.f <<EOF
@ -861,7 +611,7 @@ dnl
dnl PAC_GET_XFS_MEMALIGN
dnl
dnl
AC_DEFUN([PAC_GET_XFS_MEMALIGN],
define(PAC_GET_XFS_MEMALIGN,
[AC_MSG_CHECKING([for memory alignment needed for direct I/O])
/bin/rm -f memalignval
/bin/rm -f /tmp/romio_tmp.bin
@ -890,6 +640,7 @@ else
fi
])dnl
dnl
dnl
dnl Look for a style of VPATH. Known forms are
dnl VPATH = .:dir
@ -899,7 +650,7 @@ dnl Defines VPATH or .PATH with . $(srcdir)
dnl Requires that vpath work with implicit targets
dnl NEED TO DO: Check that $< works on explicit targets.
dnl
AC_DEFUN([PAC_MAKE_VPATH],[
define(PAC_MAKE_VPATH,[
AC_SUBST(VPATH)
AC_MSG_CHECKING(for virtual path format)
rm -rf conftest*
@ -936,48 +687,7 @@ fi
rm -rf conftest*
])dnl
dnl
dnl
dnl There is a bug in AC_PREPARE that sets the srcdir incorrectly (it
dnl is correct in configure, but it puts an absolute path into config.status,
dnl which is a big problem for scripts like mpireconfig that are wrappers
dnl around config.status). The bug is in not recognizing that ./ and .//
dnl are the same directory as . (in fact, ./[/]* is the same).
dnl
AC_DEFUN([PAC_FIXUP_SRCDIR],[
# Find the source files, if location was not specified.
if test "$srcdirdefaulted" = "yes" ; then
srcdir=""
# Try the directory containing this script, then `..'.
prog=[$]0
changequote(,)dnl
confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
# Remove all trailing /'s
confdir=`echo $confdir|sed 's%[/*]$%%'`
changequote([,])dnl
test "X$confdir" = "X$prog" && confdir=.
srcdir=$confdir
if test ! -r $srcdir/$unique_file; then
srcdir=..
fi
fi
if test ! -r $srcdir/$unique_file; then
if test x$srcdirdefaulted = xyes; then
echo "configure: Cannot find sources in \`${confdir}' or \`..'." 1>&2
else
echo "configure: Cannot find sources in \`${srcdir}'." 1>&2
fi
exit 1
fi
# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
# (and preserve ./ and .//)
# But we can't avoid them for `..', to make subdirectories work.
case $srcdir in
.|./|.//|/*|~*) ;;
*) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
esac
])
dnl
AC_DEFUN([PAC_HAVE_MOUNT_NFS],[
define(PAC_HAVE_MOUNT_NFS,[
AC_MSG_CHECKING([if MOUNT_NFS is defined in the include files])
rm -f conftest.c
cat > conftest.c <<EOF
@ -992,8 +702,10 @@ EOF
$CC $USER_CFLAGS -o conftest conftest.c > /dev/null 2>&1
if test -x conftest ; then
AC_MSG_RESULT(yes)
ROMIO_HAVE_MOUNT_NFS=1
AC_DEFINE(HAVE_MOUNT_NFS,,[Define if MOUNT_NFS defined])
else
ROMIO_HAVE_MOUNT_NFS=0
AC_MSG_RESULT(no)
fi
rm -f conftest conftest.c
@ -1004,7 +716,7 @@ dnl PAC_MPI_OFFSET_KIND_4BYTE()
dnl
dnl tries to determine the Fortran 90 kind parameter for 4-byte integers
dnl
AC_DEFUN([PAC_MPI_OFFSET_KIND_4BYTE],
define(PAC_MPI_OFFSET_KIND_4BYTE,
[AC_MSG_CHECKING([for Fortran 90 KIND parameter for 4-byte integers])
rm -f kind.f kind.o kind
cat <<EOF > kind.f
@ -1038,7 +750,7 @@ fi
])dnl
dnl
dnl
AC_DEFUN([PAC_FUNC_STRERROR],[
define(PAC_FUNC_STRERROR,[
AC_MSG_CHECKING([for strerror()])
rm -f conftest.c
cat > conftest.c <<EOF
@ -1079,68 +791,7 @@ changequote([,])
rm -f conftest conftest.c
])dnl
dnl
dnl
dnl
AC_DEFUN([PAC_C_INLINE],[
AC_MSG_CHECKING([for inline])
if eval "test \"`echo '$''{'pac_cv_c_inline'+set}'`\" = set"; then
AC_MSG_RESULT([(cached)])
else
AC_COMPILE_CHECK(,[inline int a( int b ){return b+1;}],[int a;],
pac_cv_c_inline="yes",pac_cv_c_inline="no")
fi
AC_MSG_RESULT($pac_cv_c_inline)
if test "$pac_cv_c_inline" = "no" ; then
AC_DEFINE(inline,,[Define if inline is not supported])
fi
])dnl
dnl
dnl PAC_CHECK_HEADER(HEADER-FILE, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND],
dnl PRE-REQ-HEADERS )
dnl
dnl BUG: AIX 4.1 can't handle a \055 (octal for -) in a tr string (sometimes;
dnl it works from the shell but not within a file)
dnl I've removed that and hoped that no header will include a - in the
dnl name
dnl
dnl This can fail if the header needs OTHER headers for the compile
dnl to succeed. Those headers should be specified in the "pre-req-headers"
dnl For example
dnl PAC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H),,
dnl [#include <sys/types.h>])
dnl
AC_DEFUN([PAC_CHECK_HEADER],dnl
[dnl Do the transliteration at runtime so arg 1 can be a shell variable.
changequote(,)dnl
ac_safe=`echo "$1" | tr '[a-z]./' '[A-Z]__'`
changequote([,])dnl
AC_MSG_CHECKING([for $1])
dnl AC_CACHE_VAL(ac_cv_header_$ac_safe,[dnl
AC_COMPILE_CHECK(,[$4]
[#include <$1>],main();,eval "ac_cv_header_$ac_safe=yes",
eval "ac_cv_header_$ac_safe=no")dnl])dnl
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
ifelse([$3], , , [$3
])dnl
fi
])dnl
dnl
dnl PAC_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
AC_DEFUN([PAC_CHECK_HEADERS],[for ac_hdr in $1
do
PAC_CHECK_HEADER($ac_hdr,
[changequote(, )dnl
ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
changequote([, ])dnl
AC_DEFINE($ac_tr_hdr) $2], $3)dnl
done
])dnl
dnl
AC_DEFUN([PAC_TEST_MPIR_STATUS_SET_BYTES],[
define(PAC_TEST_MPIR_STATUS_SET_BYTES,[
AC_MSG_CHECKING(if MPIR_Status_set_bytes is defined)
rm -f mpitest.c
cat > mpitest.c <<EOF
@ -1166,7 +817,172 @@ EOF
fi
rm -f conftest mpitest.c
])dnl
define(PAC_TEST_MPI_GREQUEST,[
AC_MSG_CHECKING(support for generalized requests)
rm -f mpitest.c
cat > mpitest.c <<EOF
#include "mpi.h"
#include "stdio.h"
main(int argc, char **argv)
{
MPI_Request request;
MPI_Init(&argc, &argv);
MPI_Grequest_start(NULL, NULL, NULL, NULL, &request);
MPI_Finalize();
}
EOF
rm -f conftest
$CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
if test -x conftest ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MPI_GREQUEST,,[Define if generalized requests avaliable])
else
AC_MSG_RESULT(no)
fi
rm -f conftest mpitest.c
])dnl
dnl
dnl/*D
dnl PAC_FUNC_NEEDS_DECL - Set NEEDS_<funcname>_DECL if a declaration is needed
dnl
dnl Synopsis:
dnl PAC_FUNC_NEEDS_DECL(headerfiles,funcname)
dnl
dnl Output Effect:
dnl Sets 'NEEDS_<funcname>_DECL' if 'funcname' is not declared by the
dnl headerfiles.
dnl
dnl Approach:
dnl Try to compile a program with the function, but passed with an incorrect
dnl calling sequence. If the compilation fails, then the declaration
dnl is provided within the header files. If the compilation succeeds,
dnl the declaration is required.
dnl
dnl We use a 'double' as the first argument to try and catch varargs
dnl routines that may use an int or pointer as the first argument.
dnl
dnl D*/
AC_DEFUN([PAC_FUNC_NEEDS_DECL],[
AC_CACHE_CHECK([whether $2 needs a declaration],
[pac_cv_func_decl_$2],[
AC_TRY_COMPILE([$1],[int a=$2(1.0,27,1.0,"foo");],
pac_cv_func_decl_$2=yes,pac_cv_func_decl_$2=no)])
if test "$pac_cv_func_decl_$2" = "yes" ; then
changequote(<<,>>)dnl
define(<<PAC_FUNC_NAME>>, translit(NEEDS_$2_DECL, [a-z *], [A-Z__]))dnl
changequote([, ])dnl
AC_DEFINE_UNQUOTED(PAC_FUNC_NAME,1,[Define if $2 needs a declaration])
undefine([PAC_FUNC_NAME])
fi
])dnl
dnl
dnl/*D
dnl PAC_C_RESTRICT - Check if C supports restrict
dnl
dnl Synopsis:
dnl PAC_C_RESTRICT
dnl
dnl Output Effect:
dnl Defines 'restrict' if some version of restrict is supported; otherwise
dnl defines 'restrict' as empty. This allows you to include 'restrict' in
dnl declarations in the same way that 'AC_C_CONST' allows you to use 'const'
dnl in declarations even when the C compiler does not support 'const'
dnl
dnl Note that some compilers accept restrict only with additional options.
dnl DEC/Compaq/HP Alpha Unix (Tru64 etc.) -accept restrict_keyword
dnl
dnl D*/
AC_DEFUN([PAC_C_RESTRICT],[
AC_CACHE_CHECK([for restrict],
[pac_cv_c_restrict],[
AC_TRY_COMPILE(,[int * restrict a;],pac_cv_c_restrict="restrict",
pac_cv_c_restrict="no")
if test "$pac_cv_c_restrict" = "no" ; then
AC_TRY_COMPILE(,[int * _Restrict a;],pac_cv_c_restrict="_Restrict",
pac_cv_c_restrict="no")
fi
if test "$pac_cv_c_restrict" = "no" ; then
AC_TRY_COMPILE(,[int * __restrict a;],pac_cv_c_restrict="__restrict",
pac_cv_c_restrict="no")
fi
])
if test "$pac_cv_c_restrict" = "no" ; then
restrict_val=""
elif test "$pac_cv_c_restrict" != "restrict" ; then
restrict_val=$pac_cv_c_restrict
fi
if test "$restrict_val" != "restrict" ; then
AC_DEFINE_UNQUOTED(restrict,$restrict_val,[if C does not support restrict])
fi
])dnl
dnl
dnl
dnl
dnl This is a replacement for AC_PROG_CC that does not prefer gcc and
dnl that does not mess with CFLAGS. See acspecific.m4 for the original defn.
dnl
dnl/*D
dnl PAC_PROG_CC - Find a working C compiler
dnl
dnl Synopsis:
dnl PAC_PROG_CC
dnl
dnl Output Effect:
dnl Sets the variable CC if it is not already set
dnl
dnl Notes:
dnl Unlike AC_PROG_CC, this does not prefer gcc and does not set CFLAGS.
dnl It does check that the compiler can compile a simple C program.
dnl It also sets the variable GCC to yes if the compiler is gcc. It does
dnl not yet check for some special options needed in particular for
dnl parallel computers, such as -Tcray-t3e, or special options to get
dnl full ANSI/ISO C, such as -Aa for HP.
dnl
dnl D*/
dnl 2.52 doesn't have AC_PROG_CC_GNU
ifdef([AC_PROG_CC_GNU],,[AC_DEFUN([AC_PROG_CC_GNU],)])
AC_DEFUN([PAC_PROG_CC],[
AC_PROVIDE([AC_PROG_CC])
AC_CHECK_PROGS([CC, cc xlC xlc pgcc icc gcc])
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
PAC_PROG_CC_WORKS
AC_PROG_CC_GNU
if test "$ac_cv_prog_gcc" = yes; then
GCC=yes
else
GCC=
fi
])
dnl
dnl
dnl PAC_C_GNU_ATTRIBUTE - See if the GCC __attribute__ specifier is allow.
dnl Use the following
dnl #ifndef HAVE_GCC_ATTRIBUTE
dnl #define __attribute__(a)
dnl #endif
dnl If *not*, define __attribute__(a) as null
dnl
dnl We start by requiring Gcc. Some other compilers accept __attribute__
dnl but generate warning messages, or have different interpretations
dnl (which seems to make __attribute__ just as bad as #pragma)
dnl For example, the Intel icc compiler accepts __attribute__ and
dnl __attribute__((pure)) but generates warnings for __attribute__((format...))
dnl
AC_DEFUN([PAC_C_GNU_ATTRIBUTE],[
AC_REQUIRE([AC_PROG_CC])
if test "$ac_cv_prog_gcc" = "yes" ; then
AC_CACHE_CHECK([whether __attribute__ allowed],
pac_cv_gnu_attr_pure,[
AC_TRY_COMPILE([int foo(int) __attribute__ ((pure));],[int a;],
pac_cv_gnu_attr_pure=yes,pac_cv_gnu_attr_pure=no)])
AC_CACHE_CHECK([whether __attribute__((format)) allowed],
pac_cv_gnu_attr_format,[
AC_TRY_COMPILE([int foo(char *,...) __attribute__ ((format(printf,1,2)));],[int a;],
pac_cv_gnu_attr_format=yes,pac_cv_gnu_attr_format=no)])
if test "$pac_cv_gnu_attr_pure" = "yes" -a "$pac_cv_gnu_attr_format" = "yes" ; then
AC_DEFINE(HAVE_GCC_ATTRIBUTE,1,[Define if GNU __attribute__ is supported])
fi
fi
])
dnl

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

@ -20,6 +20,14 @@ include $(top_ompi_srcdir)/config/Makefile.options
# Conditionals whether to build each subdir or not
if BUILD_GRIDFTP
GRIDFTP_DIR = ad_gridftp
GRIDFTP_LIB = ad_gridftp/libadio_gridftp.la
else
GRIDFTP_DIR =
GRIDFTP_LIB =
endif
if BUILD_HFS
HFS_DIR = ad_hfs
HFS_LIB = ad_hfs/libadio_hfs.la
@ -45,6 +53,14 @@ endif
#NTFS_LIB =
#endif
if BUILD_PANFS
PANFS_DIR = ad_panfs
PANFS_LIB = ad_panfs/libadio_panfs.la
else
PANFS_DIR =
PANFS_LIB =
endif
if BUILD_PFS
PFS_DIR = ad_pfs
PFS_LIB = ad_pfs/libadio_pfs.la
@ -69,6 +85,14 @@ PVFS_DIR =
PVFS_LIB =
endif
if BUILD_PVFS2
PVFS2_DIR = ad_pvfs2
PVFS2_LIB = ad_pvfs2/libadio_pvfs2.la
else
PVFS2_DIR =
PVFS2_LIB =
endif
if BUILD_SFS
SFS_DIR = ad_sfs
SFS_LIB = ad_sfs/libadio_sfs.la
@ -102,11 +126,12 @@ XFS_LIB =
endif
SUBDIRS = common include \
$(HFS_DIR) $(NFS_DIR) $(NTFS_DIR) $(PFS_DIR) $(PIOFS_DIR) \
$(PVFS_DIR) $(SFS_DIR) $(TESTFS_DIR) $(UFS_DIR) $(XFS_DIR)
$(GRIDFTP_DIR) $(HFS_DIR) $(NFS_DIR) $(NTFS_DIR) $(PANFS_DIR) \
$(PFS_DIR) $(PIOFS_DIR) $(PVFS_DIR) $(PVFS2_DIR) $(SFS_DIR) \
$(TESTFS_DIR) $(UFS_DIR) $(XFS_DIR)
DIST_SUBDIRS = common include \
ad_hfs ad_nfs ad_ntfs ad_pfs ad_piofs ad_pvfs \
ad_sfs ad_testfs ad_ufs ad_xfs
ad_gridftp ad_hfs ad_nfs ad_ntfs ad_panfs ad_pfs ad_piofs ad_pvfs \
ad_pvfs2 ad_sfs ad_testfs ad_ufs ad_xfs
# Library
noinst_LTLIBRARIES = libadio.la

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

@ -0,0 +1,67 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_ompi_srcdir)/config/Makefile.options
AM_CPPFLAGS = \
-DOMPI_BUILDING=1 \
-I$(top_ompi_srcdir) \
-I$(top_ompi_srcdir)/include \
-I$(top_ompi_builddir)/include \
-I$(top_ompi_srcdir)/opal \
-I$(top_ompi_srcdir)/opal/include \
-I$(top_ompi_srcdir)/orte \
-I$(top_ompi_srcdir)/orte/include \
-I$(top_ompi_srcdir)/ompi \
-I$(top_ompi_srcdir)/ompi/include \
-I$(top_srcdir)/adio/include
# It is unfortunately necessary to make all the filenames in the ROMIO
# distribtion confrom to the MCA prefix name rule -- there is at least
# one or two filename conflicts that potentially create problems when
# merging everything into onelibmpi.
# In developer's copies, we have the real ROMIO files, and sym links
# are made. In distribution tarballs, the sym-linked files turn into
# real files and the original filenames do not appear.
noinst_LTLIBRARIES = libadio_gridftp.la
libadio_gridftp_la_SOURCES = \
io_romio_ad_gridftp.c \
ad_gridftp.h \
io_romio_ad_gridftp_close.c \
io_romio_ad_gridftp_delete.c \
io_romio_ad_gridftp_fcntl.c \
io_romio_ad_gridftp_flush.c \
io_romio_ad_gridftp_hints.c \
io_romio_ad_gridftp_open.c \
io_romio_ad_gridftp_read.c \
io_romio_ad_gridftp_resize.c \
io_romio_ad_gridftp_write.c \
io_romio_globus_routines.c
#
# Sym link the sources to conform to the MCA prefix name rule
#
dir=$(top_srcdir)/adio/ad_gridftp
$(libadio_gridftp_la_SOURCES):
if test ! -r $@ ; then \
pname=`echo $@ | cut -b '10-'` ; \
rm -f $@; \
ln -s $(dir)/$$pname $@ ; \
fi

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

@ -0,0 +1,36 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_gridftp.h"
/* adioi.h has the ADIOI_Fns_struct define */
#include "adioi.h"
struct ADIOI_Fns_struct ADIO_GRIDFTP_operations = {
ADIOI_GRIDFTP_Open, /* Open */
ADIOI_GRIDFTP_ReadContig, /* ReadContig */
ADIOI_GRIDFTP_WriteContig, /* WriteContig */
ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */
ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */
ADIOI_GEN_SeekIndividual, /* SeekIndividual */
ADIOI_GRIDFTP_Fcntl, /* Fcntl */
ADIOI_GRIDFTP_SetInfo, /* SetInfo */
ADIOI_GRIDFTP_ReadStrided, /* ReadStrided */
ADIOI_GRIDFTP_WriteStrided, /* WriteStrided */
ADIOI_GRIDFTP_Close, /* Close */
ADIOI_FAKE_IreadContig, /* IreadContig */
ADIOI_FAKE_IwriteContig, /* IwriteContig */
ADIOI_FAKE_IODone, /* ReadDone */
ADIOI_FAKE_IODone, /* WriteDone */
ADIOI_FAKE_IOComplete, /* ReadComplete */
ADIOI_FAKE_IOComplete, /* WriteComplete */
ADIOI_FAKE_IreadStrided, /* IreadStrided */
ADIOI_FAKE_IwriteStrided, /* IwriteStrided */
ADIOI_GRIDFTP_Flush, /* Flush */
ADIOI_GRIDFTP_Resize, /* Resize */
ADIOI_GRIDFTP_Delete, /* Delete */
};

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

@ -0,0 +1,98 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#ifndef AD_GRIDFTP_INCLUDE
#define AD_GRIDFTP_INCLUDE
#include <unistd.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <fcntl.h>
#include "adio.h"
#include <globus_ftp_client.h>
/* These live in globus_routines.c */
extern int num_gridftp_handles;
#ifndef ADIO_GRIDFTP_HANDLES_MAX
#define ADIO_GRIDFTP_HANDLES_MAX 200
#endif /* ! ADIO_GRIDFTP_HANDLES_MAX */
extern globus_ftp_client_handle_t gridftp_fh[ADIO_GRIDFTP_HANDLES_MAX];
extern globus_ftp_client_operationattr_t oattr[ADIO_GRIDFTP_HANDLES_MAX];
/* TODO: weed out the now-unused prototypes */
void ADIOI_GRIDFTP_Open(ADIO_File fd, int *error_code);
void ADIOI_GRIDFTP_Close(ADIO_File fd, int *error_code);
void ADIOI_GRIDFTP_ReadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_GRIDFTP_WriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_GRIDFTP_IwriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
void ADIOI_GRIDFTP_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
int ADIOI_GRIDFTP_ReadDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
int ADIOI_GRIDFTP_WriteDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_GRIDFTP_ReadComplete(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_GRIDFTP_WriteComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code);
void ADIOI_GRIDFTP_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct,
int *error_code);
void ADIOI_GRIDFTP_WriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status,
int *error_code);
void ADIOI_GRIDFTP_ReadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_GRIDFTP_WriteStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_GRIDFTP_ReadStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_GRIDFTP_IreadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
void ADIOI_GRIDFTP_IwriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
void ADIOI_GRIDFTP_Flush(ADIO_File fd, int *error_code);
void ADIOI_GRIDFTP_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
ADIO_Offset ADIOI_GRIDFTP_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
int whence, int *error_code);
void ADIOI_GRIDFTP_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
void ADIOI_GRIDFTP_Get_shared_fp(ADIO_File fd, int size,
ADIO_Offset *shared_fp,
int *error_code);
void ADIOI_GRIDFTP_Set_shared_fp(ADIO_File fd, ADIO_Offset offset,
int *error_code);
void ADIOI_GRIDFTP_Delete(char *filename, int *error_code);
void globus_err_handler(const char *routine, const char *caller,
globus_result_t result);
#endif

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

@ -0,0 +1,50 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_gridftp.h"
#include "adioi.h"
void ADIOI_GRIDFTP_Close(ADIO_File fd, int *error_code)
{
int err;
static char myname[]="ADIOI_GRIDFTP_Close";
globus_result_t result;
MPI_Barrier(fd->comm);
/* Destroy the ftp handle and opattr */
result = globus_ftp_client_operationattr_destroy(&(oattr[fd->fd_sys]));
if (result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_operationattr_destroy",
myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s",globus_object_printable_to_string(result));
return;
}
result=globus_ftp_client_handle_destroy(&(gridftp_fh[fd->fd_sys]));
if (result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_handle_destroy",
myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
fd->fd_sys = -1;
fd->fp_ind=0;
fd->fp_sys_posn=0;
num_gridftp_handles--;
*error_code = MPI_SUCCESS;
}

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

@ -0,0 +1,95 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_gridftp.h"
#include "adioi.h"
static globus_mutex_t lock;
static globus_cond_t cond;
static globus_bool_t delete_done, delete_success;
static void delete_cb(void *myarg, globus_ftp_client_handle_t *handle, globus_object_t *error)
{
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
else
{
delete_success=GLOBUS_TRUE;
}
delete_done=GLOBUS_TRUE;
}
void ADIOI_GRIDFTP_Delete(char *filename, int *error_code)
{
char myname[]="ADIOI_GRIDFTP_Delete";
int myrank, nprocs;
globus_ftp_client_handle_t handle;
globus_result_t result;
*error_code = MPI_SUCCESS;
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);
result=globus_ftp_client_handle_init(&handle,GLOBUS_NULL);
if (result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_handle_init",myname,result);
*error_code= MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO,
"**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
delete_done=GLOBUS_FALSE;
delete_success=GLOBUS_FALSE;
result=globus_ftp_client_delete(&handle,filename,GLOBUS_NULL,delete_cb,GLOBUS_NULL);
if (result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_delete",myname,result);
*error_code= MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO,
"**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
globus_mutex_lock(&lock);
while ( delete_done!=GLOBUS_TRUE )
globus_cond_wait(&cond,&lock);
globus_mutex_unlock(&lock);
result=globus_ftp_client_handle_destroy(&handle);
if (result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_handle_destroy",myname,result);
*error_code= MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO,
"**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
if ( delete_success!=GLOBUS_TRUE )
{
*error_code= MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO,
"**io", "**io %s",
globus_object_printable_to_string(result));
}
}

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

@ -0,0 +1,91 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_gridftp.h"
#include "adioi.h"
#include "adio_extern.h"
globus_mutex_t fcntl_size_lock;
globus_cond_t fcntl_size_cond;
globus_bool_t fcntl_size_done;
void fcntl_size_cb(void *myargs, globus_ftp_client_handle_t *handle,
globus_object_t *error)
{
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
globus_mutex_lock(&fcntl_size_lock);
fcntl_size_done=GLOBUS_TRUE;
globus_cond_signal(&fcntl_size_cond);
globus_mutex_unlock(&fcntl_size_lock);
}
void ADIOI_GRIDFTP_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct,
int *error_code)
{
MPI_Datatype copy_etype, copy_filetype;
int combiner, i, j, k, filetype_is_contig, err;
ADIOI_Flatlist_node *flat_file;
char myname[]="ADIOI_GRIDFTP_Fcntl";
int myrank, nprocs;
*error_code = MPI_SUCCESS;
MPI_Comm_size(fd->comm, &nprocs);
MPI_Comm_rank(fd->comm, &myrank);
switch(flag) {
case ADIO_FCNTL_GET_FSIZE:
{
globus_result_t result;
globus_off_t fsize=0;
globus_mutex_init(&fcntl_size_lock,GLOBUS_NULL);
globus_cond_init(&fcntl_size_cond,GLOBUS_NULL);
fcntl_size_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_size(&(gridftp_fh[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
&(fsize),
fcntl_size_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_size",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
globus_mutex_lock(&fcntl_size_lock);
while ( fcntl_size_done!=GLOBUS_TRUE )
globus_cond_wait(&fcntl_size_lock,&fcntl_size_cond);
globus_mutex_unlock(&fcntl_size_lock);
globus_mutex_destroy(&fcntl_size_lock);
globus_cond_destroy(&fcntl_size_cond);
fcntl_struct->fsize=fsize;
}
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_DISKSPACE:
ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
break;
case ADIO_FCNTL_SET_ATOMICITY:
default:
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_ARG,
"**flag", "**flag %d", flag);
}
}

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

@ -0,0 +1,19 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_gridftp.h"
#include "adioi.h"
/* GridFTP doesn't give you a way to cache writes on the client side, so
is essentially a no-op */
/* if there is a mechanism where we can ask the server to flush data to disk we
* should do it here. I'll leave that up to Troy */
void ADIOI_GRIDFTP_Flush(ADIO_File fd, int *error_code)
{
return;
}

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

@ -0,0 +1,68 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
/*
Valid hints for ftp:// and gsiftp:// URLs (aside from the std. ones):
ftp_control_mode extended|block|stream|compressed
(default extended for gsiftp:// URLs and stream for ftp:// URLs)
parallelism integer number of simultaneous threads connecting to
ftp server (default 1)
striped_ftp true|false or enable|disable; enables gsiftp striped data transfer
tcp_buffer integer size of tcp stream buffers in bytes
transfer_type ascii or binary (default binary)
These *must* be specified at open time currently.
*/
#include "ad_gridftp.h"
#include "adioi.h"
void ADIOI_GRIDFTP_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
{
if (!(fd->info))
{
if ( users_info==MPI_INFO_NULL )
{
/* This must be part of the open call. */
MPI_Info_create(&(fd->info));
}
else
{
MPI_Info_dup(users_info,&(fd->info));
}
}
else
{
int i,nkeys,valuelen,flag;
char key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL];
if ( users_info!=MPI_INFO_NULL )
{
MPI_Info_get_nkeys(users_info,&nkeys);
for (i=0;i<nkeys;i++)
{
MPI_Info_get_nthkey(users_info,i,key);
MPI_Info_get_valuelen(users_info,key,&valuelen,&flag);
if (flag)
{
MPI_Info_get(users_info,key,valuelen,value,&flag);
if (flag) MPI_Info_set(fd->info,key,value);
}
}
}
}
/* let the generic ROMIO and MPI-I/O stuff happen... */
ADIOI_GEN_SetInfo(fd, users_info, error_code);
}

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

@ -0,0 +1,423 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_gridftp.h"
#include "adioi.h"
static globus_mutex_t lock;
static globus_cond_t cond;
static globus_bool_t file_exists,exists_done;
static void exists_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error)
{
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
else
{
file_exists=GLOBUS_TRUE;
}
exists_done=GLOBUS_TRUE;
}
static globus_bool_t touch_ctl_done;
static void touch_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error)
{
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
globus_mutex_lock(&lock);
touch_ctl_done=GLOBUS_TRUE;
globus_cond_signal(&cond);
globus_mutex_unlock(&lock);
}
static void touch_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error,
globus_byte_t *buffer, globus_size_t length, globus_off_t offset,
globus_bool_t eof)
{
if (error)
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
globus_ftp_client_register_read(handle,buffer,length,touch_data_cb,myargs);
return;
}
void ADIOI_GRIDFTP_Open(ADIO_File fd, int *error_code)
{
static char myname[]="ADIOI_GRIDFTP_Open";
int myrank, nprocs, keyfound;
char hintval[MPI_MAX_INFO_VAL+1];
globus_ftp_client_handleattr_t hattr;
globus_result_t result;
MPI_Comm_size(fd->comm, &nprocs);
MPI_Comm_rank(fd->comm, &myrank);
/* activate Globus ftp client module -- can be called multiple times, so
it's safest to call once per file/connection */
globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);
fd->fd_sys = num_gridftp_handles;
/* No shared file pointers for now */
fd->shared_fp_fname = NULL;
*error_code = MPI_SUCCESS;
/* Access modes here mean something very different here than they
would on a "real" filesystem... As a result, the amode and hint
processing here is intermingled and a little weird because many
of them have to do with the connection rather than the file itself.
The thing that sucks about this is that read and write ops will
have to check themselves if the file is being accessed rdonly, rdwr,
or wronly.
*/
result=globus_ftp_client_handleattr_init(&hattr)
if ( result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_handleattr_init",
myname,result);
fd->fd_sys = -1;
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
result = globus_ftp_client_operationattr_init(&(oattr[fd->fd_sys]));
if ( result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_operationattr_init",
myname,result);
fd->fd_sys = -1;
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
/* Always use connection caching unless told otherwise */
result=globus_ftp_client_handleattr_set_cache_all(&hattr,GLOBUS_TRUE)
if ( result !=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_handleattr_set_cache_all",myname,result);
/* Assume that it's safe to cache a file if it's read-only */
if ( (fd->access_mode&MPI_MODE_RDONLY) &&
(result=globus_ftp_client_handleattr_add_cached_url(&hattr,fd->filename))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_handleattr_add_cached_url",myname,result);
/* Since we're (almost by definition) doing things that FTP S (stream)
control mode can't handle, default to E (extended block) control mode
for gsiftp:// URLs. ftp:// URLs use standard stream control mode
by default. This behavior can be overridden by the ftp_control_mode
hint. */
/*
if ( !strncmp(fd->filename,"gsiftp:",7) &&
(result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result);
else if ( !strncmp(fd->filename,"ftp:",4) &&
(result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_STREAM))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result);
*/
/* Set append mode if necessary */
if ( (fd->access_mode&MPI_MODE_APPEND) &&
((result=globus_ftp_client_operationattr_set_append(&(oattr[fd->fd_sys]),GLOBUS_TRUE))!=GLOBUS_SUCCESS) )
globus_err_handler("globus_ftp_client_operationattr_set_append",myname,result);
/* Other hint and amode processing that would affect hattr and/or
oattr[] (eg. parallelism, striping, etc.) goes here */
if ( fd->info!=MPI_INFO_NULL )
{
MPI_Info_get(fd->info,"ftp_control_mode",MPI_MAX_INFO_VAL,hintval,&keyfound);
if ( keyfound )
{
if ( ( !strcmp(hintval,"extended") || !strcmp(hintval,"extended_block") ) &&
(result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result);
else if ( !strcmp(hintval,"block") &&
(result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_BLOCK))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result);
else if ( !strcmp(hintval,"compressed") &&
(result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_COMPRESSED))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result);
else if ( !strcmp(hintval,"stream") &&
(result=globus_ftp_client_operationattr_set_mode(&(oattr[fd->fd_sys]),GLOBUS_FTP_CONTROL_MODE_STREAM))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_mode",myname,result);
}
MPI_Info_get(fd->info,"parallelism",MPI_MAX_INFO_VAL,hintval,&keyfound);
if ( keyfound )
{
int nftpthreads;
if ( sscanf(hintval,"%d",&nftpthreads)==1 )
{
globus_ftp_control_parallelism_t parallelism;
parallelism.mode = GLOBUS_FTP_CONTROL_PARALLELISM_FIXED;
parallelism.fixed.size = nftpthreads;
if ( (result=globus_ftp_client_operationattr_set_parallelism(&(oattr[fd->fd_sys]),
&parallelism))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_parallelism",myname,result);
}
}
MPI_Info_get(fd->info,"striped_ftp",MPI_MAX_INFO_VAL,hintval,&keyfound);
if ( keyfound )
{
/* if set to "true" or "enable", set up round-robin block layout */
if ( !strncmp("true",hintval,4) || !strncmp("TRUE",hintval,4) ||
!strncmp("enable",hintval,4) || !strncmp("ENABLE",hintval,4) )
{
MPI_Info_get(fd->info,"striping_factor",MPI_MAX_INFO_VAL,hintval,&keyfound);
if ( keyfound )
{
int striping_factor;
if ( sscanf(hintval,"%d",&striping_factor)==1 )
{
globus_ftp_control_layout_t layout;
layout.mode = GLOBUS_FTP_CONTROL_STRIPING_BLOCKED_ROUND_ROBIN;
layout.round_robin.block_size = striping_factor;
if ( (result=globus_ftp_client_operationattr_set_layout(&(oattr[fd->fd_sys]),
&layout))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_layout",
myname,result);
}
}
}
}
MPI_Info_get(fd->info,"tcp_buffer",MPI_MAX_INFO_VAL,hintval,&keyfound);
if ( keyfound )
{
/* set tcp buffer size */
int buffer_size;
if ( sscanf(hintval,"%d",&buffer_size)==1 )
{
globus_ftp_control_tcpbuffer_t tcpbuf;
tcpbuf.mode = GLOBUS_FTP_CONTROL_TCPBUFFER_FIXED;
tcpbuf.fixed.size = buffer_size;
if ( (result=globus_ftp_client_operationattr_set_tcp_buffer(&(oattr[fd->fd_sys]),
&tcpbuf))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_tcp_buffer",myname,result);
}
}
MPI_Info_get(fd->info,"transfer_type",MPI_MAX_INFO_VAL,hintval,&keyfound);
if ( keyfound )
{
globus_ftp_control_type_t filetype;
/* set transfer type (i.e. ASCII or binary) */
if ( !strcmp("ascii",hintval) || !strcmp("ASCII",hintval) )
{
filetype=GLOBUS_FTP_CONTROL_TYPE_ASCII;
}
else
{
filetype=GLOBUS_FTP_CONTROL_TYPE_IMAGE;
}
if ( (result=globus_ftp_client_operationattr_set_type(&(oattr[fd->fd_sys]),filetype))!=GLOBUS_SUCCESS )
globus_err_handler("globus_ftp_client_operationattr_set_type",myname,result);
}
}
else
FPRINTF(stderr,"no MPI_Info object associated with %s\n",fd->filename);
/* Create the ftp handle */
result=globus_ftp_client_handle_init(&(gridftp_fh[fd->fd_sys]),&hattr)
if ( result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_handle_init",myname,result);
fd->fd_sys = -1;
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
/* Check for existence of the file */
globus_mutex_init(&lock, GLOBUS_NULL);
globus_cond_init(&cond, GLOBUS_NULL);
file_exists=GLOBUS_FALSE;
exists_done=GLOBUS_FALSE;
if ( myrank==0 )
{
if ( (result=globus_ftp_client_exists(&(gridftp_fh[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
exists_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_exists",myname,result);
fd->fd_sys = -1;
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
/* wait till the callback completes */
globus_mutex_lock(&lock);
while ( exists_done!=GLOBUS_TRUE )
globus_cond_wait(&cond,&lock);
globus_mutex_unlock(&lock);
}
MPI_Barrier(fd->comm);
MPI_Bcast(&file_exists,1,MPI_INT,0,fd->comm);
/* It turns out that this is handled by MPI_File_open() directly */
if ( (file_exists!=GLOBUS_TRUE) && (fd->access_mode&MPI_MODE_CREATE) &&
!(fd->access_mode&MPI_MODE_EXCL) && !(fd->access_mode&MPI_MODE_RDONLY) )
{
if ( myrank==0 )
{
/* if the file doesn't exist, write a single NULL to it */
globus_byte_t touchbuf=(globus_byte_t)'\0';
touch_ctl_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_put(&(gridftp_fh[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
GLOBUS_NULL,
touch_ctl_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_put",myname,result);
fd->fd_sys = -1;
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
result=globus_ftp_client_register_write(&(gridftp_fh[fd->fd_sys]),
(globus_byte_t *)&touchbuf, 0,
(globus_off_t)0, GLOBUS_TRUE,
touch_data_cb, GLOBUS_NULL);
if ( result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_register_write",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
globus_mutex_lock(&lock);
while ( touch_ctl_done!=GLOBUS_TRUE )
globus_cond_wait(&cond,&lock);
globus_mutex_unlock(&lock);
}
MPI_Barrier(fd->comm);
}
else if ( (fd->access_mode&MPI_MODE_EXCL) && (file_exists==GLOBUS_TRUE) )
{
fd->fd_sys = -1;
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", 0);
return;
}
else if ( (fd->access_mode&MPI_MODE_RDONLY) && (file_exists!=GLOBUS_TRUE) )
{
if ( myrank==0 )
{
FPRINTF(stderr,"WARNING: read-only file %s does not exist!\n",fd->filename);
}
}
num_gridftp_handles++;
#if 0
/* Debugging info for testing PASV mode behind firewalls */
if ( myrank==0 )
{
globus_bool_t striped;
globus_ftp_control_mode_t mode;
globus_ftp_control_type_t filetype;
globus_ftp_control_parallelism_t parallelism;
FPRINTF(stderr,"--gridftp details for %s--\n",
fd->filename);
/*
FPRINTF(stderr,"Connection caching: ");
globus_ftp_client_handleattr_get_cache_all(&hattr,&cached);
if ( cached==GLOBUS_TRUE )
FPRINTF(stderr,"Y\n");
else
FPRINTF(stderr,"N\n");
*/
FPRINTF(stderr,"Control mode: ");
globus_ftp_client_operationattr_get_mode(&(oattr[fd->fd_sys]),&mode);
if ( mode==GLOBUS_FTP_CONTROL_MODE_BLOCK )
FPRINTF(stderr,"block\n");
else if ( mode==GLOBUS_FTP_CONTROL_MODE_COMPRESSED )
FPRINTF(stderr,"compressed\n");
else if ( mode==GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK )
FPRINTF(stderr,"extended block\n");
else if ( mode==GLOBUS_FTP_CONTROL_MODE_STREAM )
FPRINTF(stderr,"stream\n");
else
FPRINTF(stderr,"unknown\n");
FPRINTF(stderr,"File type: ");
globus_ftp_client_operationattr_get_type(&(oattr[fd->fd_sys]),&filetype);
if ( filetype==GLOBUS_FTP_CONTROL_TYPE_ASCII )
FPRINTF(stderr,"ASCII\n");
else if ( filetype==GLOBUS_FTP_CONTROL_TYPE_IMAGE )
FPRINTF(stderr,"binary\n");
else if ( filetype==GLOBUS_FTP_CONTROL_TYPE_EBCDIC )
FPRINTF(stderr,"EBCDIC\n");
else
FPRINTF(stderr,"unknown\n");
FPRINTF(stderr,"Parallelism: ");
globus_ftp_client_operationattr_get_parallelism(&(oattr[fd->fd_sys]),&parallelism);
if ( parallelism.mode==GLOBUS_FTP_CONTROL_PARALLELISM_NONE )
FPRINTF(stderr,"none\n");
else if ( parallelism.mode==GLOBUS_FTP_CONTROL_PARALLELISM_FIXED )
FPRINTF(stderr,"fixed with %d streams\n",parallelism.fixed.size);
else
FPRINTF(stderr,"unknown\n");
FPRINTF(stderr,"Striping: ");
globus_ftp_client_operationattr_get_striped(&(oattr[fd->fd_sys]),&striped);
if ( striped==GLOBUS_TRUE )
{
globus_ftp_control_layout_t layout;
FPRINTF(stderr,"Y\nLayout: ");
globus_ftp_client_operationattr_get_layout(&(oattr[fd->fd_sys]),
&layout);
if ( layout.mode==GLOBUS_FTP_CONTROL_STRIPING_NONE )
FPRINTF(stderr,"none\n");
else if ( layout.mode==GLOBUS_FTP_CONTROL_STRIPING_PARTITIONED )
FPRINTF(stderr,"partitioned, size=%d\n",layout.partitioned.size);
else if ( layout.mode==GLOBUS_FTP_CONTROL_STRIPING_BLOCKED_ROUND_ROBIN )
FPRINTF(stderr,"round-robin, block size=%d\n",layout.round_robin.block_size);
else
FPRINTF(stderr,"unknown\n");
}
else
FPRINTF(stderr,"N\n");
fflush(stderr);
}
#endif
}

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

@ -0,0 +1,471 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_gridftp.h"
#include "adioi.h"
#include "adio_extern.h"
static globus_mutex_t readcontig_ctl_lock;
static globus_cond_t readcontig_ctl_cond;
static globus_bool_t readcontig_ctl_done;
static void readcontig_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error)
{
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
globus_mutex_lock(&readcontig_ctl_lock);
if ( readcontig_ctl_done!=GLOBUS_TRUE )
readcontig_ctl_done=GLOBUS_TRUE;
globus_cond_signal(&readcontig_ctl_cond);
globus_mutex_unlock(&readcontig_ctl_lock);
return;
}
static void readcontig_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error,
globus_byte_t *buffer, globus_size_t length, globus_off_t offset,
globus_bool_t eof)
{
globus_size_t *bytes_read;
bytes_read=(globus_size_t *)myargs;
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
*bytes_read+=length;
/* I don't understand why the data callback has to keep recalling register_read,
but everything I've done and all the examples I've seen seem to require
that behavior to work... */
/*
* Using buffer+length seems to work, but is probably not the correct
* solution. A big read of 256kB chunks will have lines like this:
readcontig_data_cb: buffer 0x404e0008 length 0 offset 31719424 eof 1
readcontig_data_cb: buffer 0x404a0008 length 65536 offset 31981568 eof 0
readcontig_data_cb: buffer 0x404b0008 length 65536 offset 32047104 eof 0
readcontig_data_cb: buffer 0x404c0008 length 65536 offset 32112640 eof 0
readcontig_data_cb: buffer 0x404d0008 length 65536 offset 32178176 eof 0
*/
#if 0
FPRINTF(stderr, "%s: buffer %p length %d offset %Ld eof %d\n",
__func__, buffer, length, offset, eof);
#endif
if ( !eof )
globus_ftp_client_register_read(handle,
buffer+length,
length,
readcontig_data_cb,
(void *)(bytes_read));
return;
}
static globus_mutex_t readdiscontig_ctl_lock;
static globus_cond_t readdiscontig_ctl_cond;
static globus_bool_t readdiscontig_ctl_done;
static void readdiscontig_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error)
{
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
globus_mutex_lock(&readdiscontig_ctl_lock);
if ( readdiscontig_ctl_done!=GLOBUS_TRUE )
readdiscontig_ctl_done=GLOBUS_TRUE;
globus_cond_signal(&readdiscontig_ctl_cond);
globus_mutex_unlock(&readdiscontig_ctl_lock);
return;
}
static void readdiscontig_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error,
globus_byte_t *buffer, globus_size_t length, globus_off_t offset,
globus_bool_t eof)
{
globus_size_t *bytes_read;
bytes_read=(globus_size_t *)myargs;
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
*bytes_read+=length;
/* I don't understand why the data callback has to keep recalling register_read,
but everything I've done and all the examples I've seen seem to require
that behavior to work... */
if ( !eof )
globus_ftp_client_register_read(handle,
buffer,
length,
readdiscontig_data_cb,
(void *)(bytes_read));
return;
}
void ADIOI_GRIDFTP_ReadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
static char myname[]="ADIOI_GRIDFTP_ReadContig";
int myrank, nprocs, datatype_size;
globus_size_t len,bytes_read=0;
globus_off_t goff;
globus_result_t result;
if ( fd->access_mode&MPI_MODE_WRONLY )
{
*error_code=MPIR_ERR_MODE_WRONLY;
return;
}
*error_code = MPI_SUCCESS;
MPI_Comm_size(fd->comm, &nprocs);
MPI_Comm_rank(fd->comm, &myrank);
MPI_Type_size(datatype, &datatype_size);
if (file_ptr_type != ADIO_EXPLICIT_OFFSET)
{
offset = fd->fp_ind;
}
/* Do the gridftp I/O transfer */
goff = (globus_off_t)offset;
len = ((globus_size_t)datatype_size)*((globus_size_t)count);
globus_mutex_init(&readcontig_ctl_lock, GLOBUS_NULL);
globus_cond_init(&readcontig_ctl_cond, GLOBUS_NULL);
readcontig_ctl_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_partial_get(&(gridftp_fh[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
GLOBUS_NULL,
goff,
goff+(globus_off_t)len,
readcontig_ctl_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_partial_get",myname,result);
*error_code=MPI_ERR_IO;
ADIOI_Error(fd,*error_code,myname);
return;
}
result=globus_ftp_client_register_read(&(gridftp_fh[fd->fd_sys]),
(globus_byte_t *)buf, len, readcontig_data_cb,
(void *)(&bytes_read));
if ( result != GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_register_read",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname, __LINE__,
MPI_ERR_IO, "**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
/* The ctl callback won't start till the data callbacks complete, so it's
safe to wait on just the ctl callback */
globus_mutex_lock(&readcontig_ctl_lock);
while ( readcontig_ctl_done!=GLOBUS_TRUE )
globus_cond_wait(&readcontig_ctl_cond,&readcontig_ctl_lock);
globus_mutex_unlock(&readcontig_ctl_lock);
globus_mutex_destroy(&readcontig_ctl_lock);
globus_cond_destroy(&readcontig_ctl_cond);
#ifdef HAVE_STATUS_SET_BYTES
MPIR_Status_set_bytes(status, datatype, bytes_read);
#endif
if (file_ptr_type != ADIO_EXPLICIT_OFFSET)
{
fd->fp_ind += bytes_read;
fd->fp_sys_posn = fd->fp_ind;
}
else {
fd->fp_sys_posn = offset + bytes_read;
}
}
void ADIOI_GRIDFTP_ReadDiscontig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
char myname[]="ADIOI_GRIDFTP_ReadDiscontig";
int myrank,nprocs;
/* size and extent of buffer in memory */
MPI_Aint btype_size,btype_extent;
/* size and extent of file record layout */
MPI_Aint ftype_size,ftype_extent;
/* size of file elemental type; seeks are done in units of this */
MPI_Aint etype_size;
MPI_Aint extent;
ADIOI_Flatlist_node *flat_file;
int i,buf_contig,boff,nblks;
globus_off_t start,end,goff;
globus_size_t bytes_read;
globus_result_t result;
globus_byte_t *tmp;
if ( fd->access_mode&MPI_MODE_WRONLY )
{
*error_code=MPIR_ERR_MODE_WRONLY;
return;
}
*error_code=MPI_SUCCESS;
MPI_Comm_rank(fd->comm,&myrank);
MPI_Comm_size(fd->comm,&nprocs);
etype_size=fd->etype_size;
MPI_Type_size(fd->filetype,&ftype_size);
MPI_Type_extent(fd->filetype,&ftype_extent);
/* This is arguably unnecessary, as this routine assumes that the
buffer in memory is contiguous */
MPI_Type_size(datatype,&btype_size);
MPI_Type_extent(datatype,&btype_extent);
ADIOI_Datatype_iscontig(datatype,&buf_contig);
if ( ( btype_extent!=btype_size ) || ( ! buf_contig ) )
{
FPRINTF(stderr,"[%d/%d] %s called with discontigous memory buffer\n",
myrank,nprocs,myname);
fflush(stderr);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname, __LINE__,
MPI_ERR_IO, "**io", 0 );
return;
}
/* from here we can assume btype_extent==btype_size */
/* Flatten out fd->filetype so we know which blocks to skip */
ADIOI_Flatten_datatype(fd->filetype);
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype && flat_file->next!=NULL)
flat_file = flat_file->next;
/* Figure out how big the area to read is */
start=(globus_off_t)(offset*etype_size);
goff=start;
boff=0;
extent=0;
nblks=0;
while ( boff < (count*btype_size) )
{
int blklen=0;
for (i=0;i<flat_file->count;i++)
{
/* find the length of the next block */
if ( (boff+flat_file->blocklens[i]) < (count*btype_size) )
blklen=flat_file->blocklens[i];
else
blklen=(count*btype_size)-boff;
/* increment buffer size to be used */
boff+=blklen;
/* compute extent -- the nblks*ftype_extent bit is
there so we remember how many ftypes we've already
been through */
extent=MAX(extent,nblks*ftype_extent+flat_file->indices[i]+blklen);
if ( boff>=(count*btype_size) )
break;
}
nblks++;
}
if ( extent < count*btype_size )
{
FPRINTF(stderr,"[%d/%d] %s error in computing extent -- extent %d is smaller than total bytes requested %d!\n",
myrank,nprocs,myname,extent,count*btype_size);
fflush(stderr);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myanem, __LINE__,
MPI_ERR_IO, "**io", 0);
return;
}
end=start+(globus_off_t)extent;
tmp=(globus_byte_t *)ADIOI_Malloc((size_t)extent*sizeof(globus_byte_t));
/* start up the globus partial read */
globus_mutex_init(&readdiscontig_ctl_lock, GLOBUS_NULL);
globus_cond_init(&readdiscontig_ctl_cond, GLOBUS_NULL);
readdiscontig_ctl_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_partial_get(&(gridftp_fh[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
GLOBUS_NULL,
start,
end,
readdiscontig_ctl_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_partial_get",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myanem, __LINE__,
MPI_ERR_IO, "**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
/* Do all the actual I/Os */
/* Since globus_ftp_client_register_read() is brain-dead and doesn't
let you specify an offset, we have to slurp the entire extent into
memory and then parse out the pieces we want... Sucks, doesn't it?
This should probably be done in chunks (preferably of a size
set using a file hint), but that'll have to come later.
--TB */
if ( (result=globus_ftp_client_register_read(&(gridftp_fh[fd->fd_sys]),
tmp,
(globus_size_t)extent,
readdiscontig_data_cb,
(void *)(&bytes_read)))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_register_read",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
/* The ctl callback won't start till the data callbacks complete, so it's
safe to wait on just the ctl callback */
globus_mutex_lock(&readdiscontig_ctl_lock);
while ( readdiscontig_ctl_done!=GLOBUS_TRUE )
globus_cond_wait(&readdiscontig_ctl_cond,&readdiscontig_ctl_lock);
globus_mutex_unlock(&readdiscontig_ctl_lock);
globus_mutex_destroy(&readdiscontig_ctl_lock);
globus_cond_destroy(&readdiscontig_ctl_cond);
boff=0;
nblks=0;
goff=0;
while ( boff < (count*btype_size) )
{
int i,blklen;
for (i=0;i<flat_file->count;i++)
{
if ( (boff+flat_file->blocklens[i]) < (count*btype_size) )
blklen=flat_file->blocklens[i];
else
blklen=(count*btype_size)-boff;
if ( blklen > 0 )
{
goff=nblks*ftype_extent+flat_file->indices[i];
memcpy((globus_byte_t *)buf+boff,tmp+goff,(size_t)blklen);
boff+=blklen;
if ( boff>=(count*btype_size) )
break;
}
}
nblks++;
}
ADIOI_Free(tmp);
#ifdef HAVE_STATUS_SET_BYTES
MPIR_Status_set_bytes(status, datatype, bytes_read);
#endif
if (file_ptr_type != ADIO_EXPLICIT_OFFSET)
{
fd->fp_ind += extent;
fd->fp_sys_posn = fd->fp_ind;
}
else {
fd->fp_sys_posn = offset + extent;
}
}
void ADIOI_GRIDFTP_ReadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
/*
int myrank, nprocs;
*error_code = MPI_SUCCESS;
MPI_Comm_size(fd->comm, &nprocs);
MPI_Comm_rank(fd->comm, &myrank);
#ifdef PRINT_ERR_MSG
FPRINTF(stdout, "[%d/%d] ADIOI_GRIDFTP_ReadStrided called on %s\n", myrank,
nprocs, fd->filename);
FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_ReadStrided\n", myrank,
nprocs);
#endif
ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset,
status, error_code);
*/
char myname[]="ADIOI_GRIDFTP_ReadStrided";
int myrank, nprocs;
int i,j;
int buf_contig,file_contig;
MPI_Aint btype_size,bufsize;
globus_off_t start,disp;
globus_size_t bytes_read;
globus_byte_t *intermediate;
*error_code = MPI_SUCCESS;
MPI_Comm_size(fd->comm, &nprocs);
MPI_Comm_rank(fd->comm, &myrank);
MPI_Type_size(datatype,&btype_size);
bufsize=count*btype_size;
ADIOI_Datatype_iscontig(fd->filetype,&file_contig);
ADIOI_Datatype_iscontig(datatype,&buf_contig);
if ( buf_contig && !file_contig )
{
/* Contiguous in memory, discontig in file */
ADIOI_GRIDFTP_ReadDiscontig(fd, buf, count, datatype,
file_ptr_type, offset, status, error_code);
}
else if ( !buf_contig && file_contig )
{
/* Discontiguous in mem, contig in file -- comparatively easy */
int posn=0;
/* read contiguous data into intermediate buffer */
intermediate=(globus_byte_t *)ADIOI_Malloc((size_t)bufsize);
ADIOI_GRIDFTP_ReadContig(fd, intermediate, bufsize, MPI_BYTE,
file_ptr_type, offset, status, error_code);
/* explode contents of intermediate buffer into main buffer */
MPI_Unpack(intermediate,bufsize,&posn,buf,count,datatype,fd->comm);
ADIOI_Free(intermediate);
}
else if ( !buf_contig && !file_contig )
{
/* Discontig in both mem and file -- the hardest case */
int posn=0;
/* Read discontiguous data into intermediate buffer */
intermediate=(globus_byte_t *)ADIOI_Malloc((size_t)bufsize);
ADIOI_GRIDFTP_ReadDiscontig(fd, intermediate, bufsize, MPI_BYTE,
file_ptr_type, offset, status, error_code);
/* explode contents of intermediate buffer into main buffer */
posn=0;
MPI_Unpack(intermediate,bufsize,&posn,buf,count,datatype,fd->comm);
ADIOI_Free(intermediate);
}
else
{
/* Why did you bother calling ReadStrided?!?!?! */
ADIOI_GRIDFTP_ReadContig(fd, buf, count, datatype,
file_ptr_type, offset, status, error_code);
}
}

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

@ -0,0 +1,241 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_gridftp.h"
#include "adioi.h"
static globus_mutex_t resize_lock;
static globus_cond_t resize_cond;
static globus_bool_t resize_done;
static globus_bool_t resize_success;
void resize_cb(void *myargs, globus_ftp_client_handle_t *handle,
globus_object_t *error)
{
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
globus_mutex_lock(&resize_lock);
resize_success=GLOBUS_FALSE;
globus_mutex_unlock(&resize_lock);
}
else
{
globus_mutex_lock(&resize_lock);
resize_success=GLOBUS_TRUE;
globus_mutex_unlock(&resize_lock);
}
globus_mutex_lock(&resize_lock);
resize_done=GLOBUS_TRUE;
globus_cond_signal(&resize_cond);
globus_mutex_unlock(&resize_lock);
}
static void resize_wrdata_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error,
globus_byte_t *buffer, globus_size_t length, globus_off_t offset,
globus_bool_t eof)
{
if (error)
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
if (!eof)
globus_ftp_client_register_read(handle,
buffer,
length,
resize_wrdata_cb,
myargs);
return;
}
void ADIOI_GRIDFTP_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
{
int myrank, nprocs;
char myname[]="ADIOI_GRIDFTP_Resize";
globus_off_t fsize;
globus_result_t result;
*error_code = MPI_SUCCESS;
MPI_Comm_size(fd->comm, &nprocs);
MPI_Comm_rank(fd->comm, &myrank);
/* Sanity check */
if ( fd->access_mode&MPI_MODE_RDONLY )
{
FPRINTF(stderr,"%s: attempt to resize read-only file %s!\n",
myname,fd->filename);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", 0);
return;
}
/* This routine is supposed to do the moral equivalent of truncate(),
but there's not an equivalent operation in the globus_ftp_client API. */
globus_mutex_init(&resize_lock,GLOBUS_NULL);
globus_cond_init(&resize_cond,GLOBUS_NULL);
resize_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_size(&(gridftp_fh[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
&(fsize),
resize_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_size",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
globus_mutex_lock(&resize_lock);
while ( resize_done!=GLOBUS_TRUE )
globus_cond_wait(&resize_lock,&resize_cond);
if ( fsize < (globus_off_t)size )
{
/* The file is smaller than the requested size, so
do a zero-byte write to where the new EOF should be. */
globus_byte_t touchbuf=(globus_byte_t)'\0';
resize_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_partial_put(&(gridftp_fh[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
GLOBUS_NULL,
(globus_off_t)size,
(globus_off_t)size,
resize_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_partial_put",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS,
MPIR_ERR_RECOVERABLE, myname, __LINE__,
MPI_ERR_IO, "**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
if ( (result=globus_ftp_client_register_write(&(gridftp_fh[fd->fd_sys]),
(globus_byte_t *)&touchbuf,
0,
(globus_off_t)0,
GLOBUS_TRUE,
resize_wrdata_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_register_write",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS,
MPIR_ERR_RECOVERABLE, myname, __LINE__,
MPI_ERR_IO, "**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
globus_mutex_lock(&resize_lock);
while ( resize_done!=GLOBUS_TRUE )
globus_cond_wait(&resize_cond,&resize_lock);
globus_mutex_unlock(&resize_lock);
}
else if ( fsize > (globus_off_t)size )
{
/* The file is bigger than the requested size, so
we'll abuse globus_ftp_client_third_party_partial_put()
into truncating it for us. */
char *urlold;
size_t urllen;
urllen=strlen(fd->filename);
urlold=(char *)ADIOI_Malloc(urllen+5);
ADIOI_Snprintf(urlold,urllen+5,"%s.old",fd->filename);
resize_done=GLOBUS_FALSE;
resize_success=GLOBUS_FALSE;
if ( (result=globus_ftp_client_move(&(gridftp_fh[fd->fd_sys]),
fd->filename,
urlold,
&(oattr[fd->fd_sys]),
resize_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_move",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS,
MPIR_ERR_RECOVERABLE, myname, __LINE__,
MPI_ERR_IO, "**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
globus_mutex_lock(&resize_lock);
while ( resize_done!=GLOBUS_TRUE )
globus_cond_wait(&resize_cond,&resize_lock);
globus_mutex_unlock(&resize_lock);
if ( resize_success!=GLOBUS_TRUE )
{
*error_code = MPI_ERR_IO;
return;
}
resize_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_partial_third_party_transfer(&(gridftp_fh[fd->fd_sys]),
urlold,
&(oattr[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
GLOBUS_NULL,
0,
(globus_off_t)size,
resize_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_partial_third_party_transfer",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS,
MPIR_ERR_RECOVERABLE, myname, __LINE__,
MPI_ERR_IO, "**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
globus_mutex_lock(&resize_lock);
while ( resize_done!=GLOBUS_TRUE )
globus_cond_wait(&resize_cond,&resize_lock);
globus_mutex_unlock(&resize_lock);
if ( resize_success!=GLOBUS_TRUE )
{
*error_code = MPI_ERR_IO;
ADIOI_Error(fd,*error_code,myname);
return;
}
resize_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_delete(&(gridftp_fh[fd->fd_sys]),
urlold,
&(oattr[fd->fd_sys]),
resize_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_delete",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS,
MPIR_ERR_RECOVERABLE, myname, __LINE__,
MPI_ERR_IO, "**io", "**io %s",
globus_object_printable_to_string(result));
return;
}
globus_mutex_lock(&resize_lock);
while ( resize_done!=GLOBUS_TRUE )
globus_cond_wait(&resize_cond,&resize_lock);
globus_mutex_unlock(&resize_lock);
if ( resize_success!=GLOBUS_TRUE )
{
*error_code = MPI_ERR_IO;
ADIOI_Error(fd,*error_code,myname);
return;
}
ADIOI_Free(urlold);
}
globus_mutex_destroy(&resize_lock);
globus_cond_destroy(&resize_cond);
}

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

@ -0,0 +1,476 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_gridftp.h"
#include "adioi.h"
#include "adio_extern.h"
static globus_mutex_t writecontig_ctl_lock;
static globus_cond_t writecontig_ctl_cond;
static globus_bool_t writecontig_ctl_done;
static void writecontig_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error)
{
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
globus_mutex_lock(&writecontig_ctl_lock);
if ( writecontig_ctl_done!=GLOBUS_TRUE )
writecontig_ctl_done=GLOBUS_TRUE;
globus_cond_signal(&writecontig_ctl_cond);
globus_mutex_unlock(&writecontig_ctl_lock);
#ifdef PRINT_ERR_MSG
FPRINTF(stderr,"finished with contig write transaction\n");
#endif /* PRINT_ERR_MSG */
return;
}
static void writecontig_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error,
globus_byte_t *buffer, globus_size_t length, globus_off_t offset,
globus_bool_t eof)
{
globus_size_t *bytes_written;
bytes_written=(globus_size_t *)myargs;
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
*bytes_written+=length;
/* I don't understand why the data callback has to keep recalling register_write,
but everything I've done and all the examples I've seen seem to require
that behavior to work... */
if ( !eof )
{
globus_ftp_client_register_write(handle,
buffer,
length,
offset,
GLOBUS_TRUE,
writecontig_data_cb,
(void *)(bytes_written));
}
#ifdef PRINT_ERR_MSG
FPRINTF(stderr,"wrote %Ld bytes...",(long long)length);
#endif /* PRINT_ERR_MSG */
return;
}
static globus_mutex_t writediscontig_ctl_lock;
static globus_cond_t writediscontig_ctl_cond;
static globus_bool_t writediscontig_ctl_done;
static void writediscontig_ctl_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error)
{
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
globus_mutex_lock(&writediscontig_ctl_lock);
if ( writediscontig_ctl_done!=GLOBUS_TRUE )
writediscontig_ctl_done=GLOBUS_TRUE;
globus_cond_signal(&writediscontig_ctl_cond);
globus_mutex_unlock(&writediscontig_ctl_lock);
return;
}
static void writediscontig_data_cb(void *myargs, globus_ftp_client_handle_t *handle, globus_object_t *error,
globus_byte_t *buffer, globus_size_t length, globus_off_t offset,
globus_bool_t eof)
{
globus_size_t *bytes_written;
bytes_written=(globus_size_t *)myargs;
if (error)
{
FPRINTF(stderr, "%s\n", globus_object_printable_to_string(error));
}
*bytes_written+=length;
/* I don't understand why the data callback has to keep recalling register_read,
but everything I've done and all the examples I've seen seem to require
that behavior to work... */
if ( !eof )
globus_ftp_client_register_write(handle,
buffer,
length,
offset,
eof,
writediscontig_data_cb,
(void *)(bytes_written));
FPRINTF(stderr,"wrote %Ld bytes...",(long long)length);
return;
}
void ADIOI_GRIDFTP_WriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
char myname[]="ADIOI_GRIDFTP_WriteContig";
int myrank, nprocs, datatype_size;
globus_size_t len,bytes_written=0;
globus_off_t goff;
globus_result_t result;
if ( fd->access_mode&MPI_MODE_RDONLY )
{
*error_code=MPI_ERR_AMODE;
return;
}
*error_code = MPI_SUCCESS;
MPI_Comm_size(fd->comm, &nprocs);
MPI_Comm_rank(fd->comm, &myrank);
MPI_Type_size(datatype, &datatype_size);
if (file_ptr_type != ADIO_EXPLICIT_OFFSET)
{
offset = fd->fp_ind;
}
/* Do the gridftp I/O transfer */
goff = (globus_off_t)offset;
len = ((globus_size_t)datatype_size)*((globus_size_t)count);
globus_mutex_init(&writecontig_ctl_lock, GLOBUS_NULL);
globus_cond_init(&writecontig_ctl_cond, GLOBUS_NULL);
writecontig_ctl_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_partial_put(&(gridftp_fh[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
GLOBUS_NULL,
goff,
goff+(globus_off_t)len,
writecontig_ctl_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_partial_put",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
if ( (result=globus_ftp_client_register_write(&(gridftp_fh[fd->fd_sys]),
(globus_byte_t *)buf,
len,
goff,
GLOBUS_TRUE,
writecontig_data_cb,
(void *)(&bytes_written)))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_register_write",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
/* The ctl callback won't start till the data callbacks complete, so it's
safe to wait on just the ctl callback */
globus_mutex_lock(&writecontig_ctl_lock);
while ( writecontig_ctl_done!=GLOBUS_TRUE )
globus_cond_wait(&writecontig_ctl_cond,&writecontig_ctl_lock);
globus_mutex_unlock(&writecontig_ctl_lock);
globus_mutex_destroy(&writecontig_ctl_lock);
globus_cond_destroy(&writecontig_ctl_cond);
#ifdef HAVE_STATUS_SET_BYTES
MPIR_Status_set_bytes(status, datatype, bytes_written);
#endif
if (file_ptr_type != ADIO_EXPLICIT_OFFSET)
{
offset = fd->fp_ind;
fd->fp_ind += bytes_written;
fd->fp_sys_posn = fd->fp_ind;
}
else {
fd->fp_sys_posn = offset + bytes_written;
}
}
void ADIOI_GRIDFTP_WriteDiscontig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
char myname[]="ADIOI_GRIDFTP_WriteDiscontig";
int myrank,nprocs;
MPI_Aint btype_size,btype_extent;
MPI_Aint ftype_size,ftype_extent;
MPI_Aint etype_size;
MPI_Aint extent;
ADIOI_Flatlist_node *flat_file;
int buf_contig,boff,i,nblks;
globus_off_t start,end,goff;
globus_size_t bytes_written;
globus_result_t result;
MPI_Comm_rank(fd->comm,&myrank);
MPI_Comm_size(fd->comm,&nprocs);
etype_size=fd->etype_size;
MPI_Type_size(fd->filetype,&ftype_size);
MPI_Type_extent(fd->filetype,&ftype_extent);
/* This is arguably unnecessary, as this routine assumes that the
buffer in memory is contiguous */
MPI_Type_size(datatype,&btype_size);
MPI_Type_extent(datatype,&btype_extent);
ADIOI_Datatype_iscontig(datatype,&buf_contig);
if ( ( btype_extent!=btype_size ) || ( ! buf_contig ) )
{
FPRINTF(stderr,"[%d/%d] %s called with discontigous memory buffer\n",
myrank,nprocs,myname);
fflush(stderr);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
/* from here we can assume btype_extent==btype_size */
/* Flatten out fd->filetype so we know which blocks to skip */
ADIOI_Flatten_datatype(fd->filetype);
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype && flat_file->next!=NULL)
flat_file = flat_file->next;
/* Figure out how big the area to write is */
/* ASSUMPTION: ftype_size is an integer multiple of btype_size or vice versa. */
start=(globus_off_t)(offset*etype_size);
goff=start;
boff=0;
extent=0;
nblks=0;
while ( boff < (count*btype_size) )
{
int blklen;
for (i=0;i<flat_file->count;i++)
{
if ( (boff+flat_file->blocklens[i]) < (count*btype_size) )
blklen=flat_file->blocklens[i];
else
blklen=(count*btype_size)-boff;
boff+=blklen;
extent=MAX(extent,nblks*ftype_extent+flat_file->indices[i]+blklen);
if ( boff>=(count*btype_size) )
break;
}
nblks++;
}
if ( extent < count*btype_size )
{
FPRINTF(stderr,"[%d/%d] %s error in computing extent -- extent %d is smaller than total bytes requested %d!\n",
myrank,nprocs,myname,extent,count*btype_size);
fflush(stderr);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
end=start+(globus_off_t)extent;
FPRINTF(stderr,"[%d/%d] %s writing %d bytes into extent of %d bytes starting at offset %Ld\n",
myrank,nprocs,myname,count*btype_size,extent,(long long)start);
fflush(stderr);
/* start up the globus partial write */
globus_mutex_init(&writediscontig_ctl_lock, GLOBUS_NULL);
globus_cond_init(&writediscontig_ctl_cond, GLOBUS_NULL);
writediscontig_ctl_done=GLOBUS_FALSE;
if ( (result=globus_ftp_client_partial_put(&(gridftp_fh[fd->fd_sys]),
fd->filename,
&(oattr[fd->fd_sys]),
GLOBUS_NULL,
start,
end,
writediscontig_ctl_cb,
GLOBUS_NULL))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_partial_get",myname,result);
*error_code = MPIO_Err_create_code(MPI_SUCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", globus_object_printable_to_string(result));
return;
}
/* Do all the actual I/Os */
boff=0;
nblks=0;
while ( boff < (count*btype_size) )
{
int i,blklen;
for (i=0;i<flat_file->count;i++)
{
if ( (boff+flat_file->blocklens[i]) < (count*btype_size) )
blklen=flat_file->blocklens[i];
else
blklen=(count*btype_size)-boff;
if ( blklen > 0 )
{
goff=start+nblks*ftype_extent+((globus_off_t)flat_file->indices[i]);
/*
FPRINTF(stderr,"[%d/%d] %s writing %d bytes from boff=%d at goff=%Ld\n",myrank,nprocs,myname,blklen,boff,goff);
*/
if ( (result=globus_ftp_client_register_write(&(gridftp_fh[fd->fd_sys]),
((globus_byte_t *)buf)+boff,
(globus_size_t)blklen,
goff,
GLOBUS_TRUE,
writediscontig_data_cb,
(void *)(&bytes_written)))!=GLOBUS_SUCCESS )
{
globus_err_handler("globus_ftp_client_register_write",myname,result);
*error_code=MPI_ERR_IO;
ADIOI_Error(fd,*error_code,myname);
return;
}
boff+=blklen;
if ( boff>=(count*btype_size) )
break;
}
}
nblks++;
}
/* The ctl callback won't start till the data callbacks complete, so it's
safe to wait on just the ctl callback */
globus_mutex_lock(&writediscontig_ctl_lock);
while ( writediscontig_ctl_done!=GLOBUS_TRUE )
globus_cond_wait(&writediscontig_ctl_cond,&writediscontig_ctl_lock);
globus_mutex_unlock(&writediscontig_ctl_lock);
globus_mutex_destroy(&writediscontig_ctl_lock);
globus_cond_destroy(&writediscontig_ctl_cond);
#ifdef HAVE_STATUS_SET_BYTES
MPIR_Status_set_bytes(status, datatype, bytes_written);
#endif
if (file_ptr_type != ADIO_EXPLICIT_OFFSET)
{
fd->fp_ind += extent;
fd->fp_sys_posn = fd->fp_ind;
#if 0
FPRINTF(stdout, "[%d/%d] new file position is %Ld\n", myrank,
nprocs, (long long) fd->fp_ind);
#endif
}
else {
fd->fp_sys_posn = offset + extent;
}
}
#define GRIDFTP_USE_GENERIC_STRIDED
void ADIOI_GRIDFTP_WriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status,
int *error_code)
{
#ifdef GRIDFTP_USE_GENERIC_STRIDED
int myrank, nprocs;
if ( fd->access_mode&MPI_MODE_RDONLY )
{
*error_code=MPI_ERR_AMODE;
return;
}
*error_code = MPI_SUCCESS;
MPI_Comm_size(fd->comm, &nprocs);
MPI_Comm_rank(fd->comm, &myrank);
ADIOI_GEN_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset,
status, error_code);
return;
#else
char myname[]="ADIOI_GRIDFTP_WriteStrided";
int myrank, nprocs;
int buf_contig,file_contig;
MPI_Aint btype_size,bufsize;
globus_byte_t *intermediate;
*error_code = MPI_SUCCESS;
MPI_Comm_size(fd->comm, &nprocs);
MPI_Comm_rank(fd->comm, &myrank);
MPI_Type_size(datatype,&btype_size);
bufsize=count*btype_size;
ADIOI_Datatype_iscontig(fd->filetype,&file_contig);
ADIOI_Datatype_iscontig(datatype,&buf_contig);
if ( buf_contig && !file_contig )
{
/* Contiguous in memory, discontig in file */
FPRINTF(stderr,"[%d/%d] %s called w/ contig mem, discontig file\n",
myrank,nprocs,myname);
fflush(stderr);
ADIOI_GRIDFTP_WriteDiscontig(fd, buf, count, datatype,
file_ptr_type, offset, status, error_code);
}
else if ( !buf_contig && file_contig )
{
/* Discontiguous in mem, contig in file -- comparatively easy */
int posn=0;
FPRINTF(stderr,"[%d/%d] %s called w/ discontig mem, contig file\n",
myrank,nprocs,myname);
fflush(stderr);
/* squeeze contents of main buffer into intermediate buffer*/
intermediate=(globus_byte_t *)ADIOI_Malloc((size_t)bufsize);
MPI_Pack(buf,count,datatype,intermediate,bufsize,&posn,fd->comm);
/* write contiguous data from intermediate buffer */
ADIOI_GRIDFTP_WriteContig(fd, intermediate, bufsize, MPI_BYTE,
file_ptr_type, offset, status, error_code);
ADIOI_Free(intermediate);
}
else if ( !buf_contig && !file_contig )
{
/* Discontig in both mem and file -- the hardest case */
int posn=0;
FPRINTF(stderr,"[%d/%d] %s called w/ discontig mem, discontig file\n",
myrank,nprocs,myname);
fflush(stderr);
/* squeeze contents of main buffer into intermediate buffer*/
intermediate=(globus_byte_t *)ADIOI_Malloc((size_t)bufsize);
MPI_Pack(buf,count,datatype,intermediate,bufsize,&posn,fd->comm);
/* write contiguous data from intermediate buffer */
ADIOI_GRIDFTP_WriteDiscontig(fd, intermediate, bufsize, MPI_BYTE,
file_ptr_type, offset, status, error_code);
ADIOI_Free(intermediate);
}
else
{
/* Why did you bother calling WriteStrided?!?!?! */
FPRINTF(stderr,"[%d/%d] Why the heck did you call %s with contiguous buffer *and* file types?\n",
myrank,nprocs,myname);
ADIOI_GRIDFTP_WriteContig(fd, buf, count, datatype,
file_ptr_type, offset, status, error_code);
}
#endif /* ! GRIDFTP_USE_GENERIC_STRIDED */
}

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

@ -0,0 +1,36 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2003 University of Chicago, Ohio Supercomputer Center.
* See COPYRIGHT notice in top-level directory.
*/
#include <unistd.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <fcntl.h>
#include "adio.h"
#include <globus_ftp_client.h>
/* Here are the canonical definitions of the extern's referenced by
ad_gridftp.h */
int num_gridftp_handles=0;
#ifndef ADIO_GRIDFTP_HANDLES_MAX
#define ADIO_GRIDFTP_HANDLES_MAX 200
#endif /* ! ADIO_GRIDFTP_HANDLES_MAX */
/* having to keep not one but two big global tables sucks... */
globus_ftp_client_handle_t gridftp_fh[ADIO_GRIDFTP_HANDLES_MAX];
globus_ftp_client_operationattr_t oattr[ADIO_GRIDFTP_HANDLES_MAX];
void globus_err_handler(const char *routine, const char *caller,
globus_result_t result)
{
int myrank,nprocs;
globus_object_t *err;
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
err = globus_error_get(result);
FPRINTF(stderr, "[%d/%d] %s error \"%s\", called from %s\n",
myrank,nprocs,routine,globus_object_printable_to_string(err),caller);
}

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

@ -31,6 +31,8 @@ AM_CPPFLAGS = \
-I$(top_ompi_srcdir)/ompi/include \
-I$(top_srcdir)/adio/include
EXTRA_DIST = README
# It is unfortunately necessary to make all the filenames in the ROMIO
# distribtion confrom to the MCA prefix name rule -- there is at least
# one or two filename conflicts that potentially create problems when
@ -44,20 +46,10 @@ noinst_LTLIBRARIES = libadio_hfs.la
libadio_hfs_la_SOURCES = \
ad_hfs.h \
io_romio_ad_hfs.c \
io_romio_ad_hfs_close.c \
io_romio_ad_hfs_done.c \
io_romio_ad_hfs_fcntl.c \
io_romio_ad_hfs_flush.c \
io_romio_ad_hfs_hints.c \
io_romio_ad_hfs_iread.c \
io_romio_ad_hfs_iwrite.c \
io_romio_ad_hfs_open.c \
io_romio_ad_hfs_rdcoll.c \
io_romio_ad_hfs_read.c \
io_romio_ad_hfs_resize.c \
io_romio_ad_hfs_seek.c \
io_romio_ad_hfs_wait.c \
io_romio_ad_hfs_wrcoll.c \
io_romio_ad_hfs_write.c
#

1
ompi/mca/io/romio/romio/adio/ad_hfs/README Обычный файл
Просмотреть файл

@ -0,0 +1 @@
This code is no longer supported.

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs.c,v 1.3 2002/10/24 17:00:43 gropp Exp $
*
* Copyright (C) 2001 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -17,20 +16,20 @@ struct ADIOI_Fns_struct ADIO_HFS_operations = {
ADIOI_HFS_WriteContig, /* WriteContig */
ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */
ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */
ADIOI_HFS_SeekIndividual, /* SeekIndividual */
ADIOI_GEN_SeekIndividual, /* SeekIndividual */
ADIOI_HFS_Fcntl, /* Fcntl */
ADIOI_GEN_SetInfo, /* SetInfo */
ADIOI_GEN_ReadStrided, /* ReadStrided */
ADIOI_GEN_WriteStrided, /* WriteStrided */
ADIOI_HFS_Close, /* Close */
ADIOI_HFS_IreadContig, /* IreadContig */
ADIOI_HFS_IwriteContig, /* IwriteContig */
ADIOI_HFS_ReadDone, /* ReadDone */
ADIOI_HFS_WriteDone, /* WriteDone */
ADIOI_HFS_ReadComplete, /* ReadComplete */
ADIOI_HFS_WriteComplete, /* WriteComplete */
ADIOI_HFS_IreadStrided, /* IreadStrided */
ADIOI_HFS_IwriteStrided, /* IwriteStrided */
ADIOI_GEN_Close, /* Close */
ADIOI_FAKE_IreadContig, /* IreadContig */
ADIOI_FAKE_IwriteContig, /* IwriteContig */
ADIOI_FAKE_IODone, /* ReadDone */
ADIOI_FAKE_IODone, /* WriteDone */
ADIOI_FAKE_IOComplete, /* ReadComplete */
ADIOI_FAKE_IOComplete, /* WriteComplete */
ADIOI_FAKE_IreadStrided, /* IreadStrided */
ADIOI_FAKE_IwriteStrided, /* IwriteStrided */
ADIOI_GEN_Flush, /* Flush */
ADIOI_HFS_Resize, /* Resize */
ADIOI_GEN_Delete, /* Delete */

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs.h,v 1.4 2002/10/24 17:00:43 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -19,4 +18,17 @@
# include <cnx_unistd.h>
#endif
void ADIOI_HFS_Open(ADIO_File fd, int *error_code);
void ADIOI_HFS_ReadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_HFS_WriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
*error_code);
void ADIOI_HFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
#endif

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

@ -1,29 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_close.c,v 1.5 2002/10/24 17:00:43 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
void ADIOI_HFS_Close(ADIO_File fd, int *error_code)
{
int err;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_HFS_CLOSE";
#endif
err = close(fd->fd_sys);
#ifdef PRINT_ERR_MSG
*error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,30 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_done.c,v 1.4 2002/10/24 17:00:43 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
int ADIOI_HFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
{
if (*request != ADIO_REQUEST_NULL) {
#ifdef HAVE_STATUS_SET_BYTES
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
#endif
(*request)->fd->async_count--;
ADIOI_Free_request((ADIOI_Req_node *) (*request));
*request = ADIO_REQUEST_NULL;
}
*error_code = MPI_SUCCESS;
return 1;
}
int ADIOI_HFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
{
return ADIOI_HFS_ReadDone(request, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_fcntl.c,v 1.6 2002/10/24 17:00:43 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -11,9 +10,7 @@
void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code)
{
MPI_Datatype copy_etype, copy_filetype;
int combiner, i, j, k, filetype_is_contig, ntimes, err;
ADIOI_Flatlist_node *flat_file;
int i, ntimes, err;
ADIO_Offset curr_fsize, alloc_size, size, len, done;
ADIO_Status status;
char *buf;
@ -22,65 +19,6 @@ void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *er
#endif
switch(flag) {
case ADIO_FCNTL_SET_VIEW:
/* free copies of old etypes and filetypes and delete flattened
version of filetype if necessary */
MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype));
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (!filetype_is_contig) ADIOI_Delete_flattened(fd->filetype);
MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype));
/* set new info */
ADIO_SetInfo(fd, fcntl_struct->info, &err);
/* set new etypes and filetypes */
MPI_Type_get_envelope(fcntl_struct->etype, &i, &j, &k, &combiner);
if (combiner == MPI_COMBINER_NAMED) fd->etype = fcntl_struct->etype;
else {
MPI_Type_contiguous(1, fcntl_struct->etype, &copy_etype);
MPI_Type_commit(&copy_etype);
fd->etype = copy_etype;
}
MPI_Type_get_envelope(fcntl_struct->filetype, &i, &j, &k, &combiner);
if (combiner == MPI_COMBINER_NAMED)
fd->filetype = fcntl_struct->filetype;
else {
MPI_Type_contiguous(1, fcntl_struct->filetype, &copy_filetype);
MPI_Type_commit(&copy_filetype);
fd->filetype = copy_filetype;
ADIOI_Flatten_datatype(fd->filetype);
/* this function will not flatten the filetype if it turns out
to be all contiguous. */
}
MPI_Type_size(fd->etype, &(fd->etype_size));
fd->disp = fcntl_struct->disp;
/* reset MPI-IO file pointer to point to the first byte that can
be accessed in this view. */
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (filetype_is_contig) fd->fp_ind = fcntl_struct->disp;
else {
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype)
flat_file = flat_file->next;
for (i=0; i<flat_file->count; i++) {
if (flat_file->blocklens[i]) {
fd->fp_ind = fcntl_struct->disp + flat_file->indices[i];
break;
}
}
}
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_GET_FSIZE:
fcntl_struct->fsize = lseek64(fd->fd_sys, 0, SEEK_END);
#ifdef HPUX
@ -88,16 +26,19 @@ void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *er
lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
/* not required in SPPUX since there we use pread/pwrite */
#endif
#ifdef PRINT_ERR_MSG
*error_code = (fcntl_struct->fsize == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (fcntl_struct->fsize == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
if (fcntl_struct->fsize == -1) {
#ifdef MPICH2
*error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
#elif defined(PRINT_ERR_MSG)
*error_code = MPI_ERR_UNKNOWN;
#else /* MPICH-1 */
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
#endif
}
else *error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_DISKSPACE:
@ -107,7 +48,10 @@ void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *er
err = prealloc64(fd->fd_sys, fcntl_struct->diskspace);
/* prealloc64 works only if file is of zero length */
if (err && (errno != ENOTEMPTY)) {
#ifdef PRINT_ERR_MSG
#ifdef MPICH2
*error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
#elif defined(PRINT_ERR_MSG)
*error_code = MPI_ERR_UNKNOWN;
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
@ -125,7 +69,10 @@ void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *er
if (fcntl_struct->diskspace <= 2147483647) {
err = prealloc(fd->fd_sys, (off_t) fcntl_struct->diskspace);
if (err && (errno != ENOTEMPTY)) {
#ifdef PRINT_ERR_MSG
#ifdef MPICH2
*error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
#elif defined(PRINT_ERR_MSG)
*error_code = MPI_ERR_UNKNOWN;
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
@ -139,55 +86,7 @@ void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *er
if ((fcntl_struct->diskspace > 2147483647) ||
(err && (errno == ENOTEMPTY))) {
#endif
/* Explicitly write to allocate space. Since there could be
holes in the file, I need to read up to the current file
size, write it back, and then write beyond that depending
on how much preallocation is needed.
read/write in sizes of no more than ADIOI_PREALLOC_BUFSZ */
curr_fsize = lseek64(fd->fd_sys, 0, SEEK_END);
alloc_size = fcntl_struct->diskspace;
size = ADIOI_MIN(curr_fsize, alloc_size);
ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ);
done = 0;
for (i=0; i<ntimes; i++) {
len = ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ);
ADIO_ReadContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
done, &status, error_code);
if (*error_code != MPI_SUCCESS) {
#ifdef PRINT_ERR_MSG
FPRINTF(stderr, "ADIOI_HFS_Fcntl: To preallocate disk space, ROMIO needs to read the file and write it back, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.\n");
MPI_Abort(MPI_COMM_WORLD, 1);
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_PREALLOC_PERM,
myname, (char *) 0, (char *) 0);
ADIOI_Error(fd, *error_code, myname);
return;
#endif
}
ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
done, &status, error_code);
if (*error_code != MPI_SUCCESS) return;
done += len;
}
if (alloc_size > curr_fsize) {
memset(buf, 0, ADIOI_PREALLOC_BUFSZ);
size = alloc_size - curr_fsize;
ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
for (i=0; i<ntimes; i++) {
len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);
ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
done, &status, error_code);
if (*error_code != MPI_SUCCESS) return;
done += len;
}
ADIOI_GEN_Prealloc(fd,fcntl_struct->diskspace, error_code);
}
ADIOI_Free(buf);
#ifdef HPUX
@ -199,16 +98,6 @@ void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *er
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_IOMODE:
/* for implementing PFS I/O modes. will not occur in MPI-IO
implementation.*/
if (fd->iomode != fcntl_struct->iomode) {
fd->iomode = fcntl_struct->iomode;
MPI_Barrier(MPI_COMM_WORLD);
}
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_ATOMICITY:
fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;
*error_code = MPI_SUCCESS;

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

@ -1,14 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_flush.c,v 1.3 2002/10/24 17:00:43 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
void ADIOI_HFS_Flush(ADIO_File fd, int *error_code)
{
ADIOI_GEN_Flush(fd, error_code);
}

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

@ -1,14 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_hints.c,v 1.3 2002/10/24 17:00:44 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
void ADIOI_HFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
{
ADIOI_GEN_SetInfo(fd, users_info, error_code);
}

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

@ -1,72 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_iread.c,v 1.4 2002/10/24 17:00:44 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
void ADIOI_HFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int *error_code)
{
ADIO_Status status;
int len, typesize;
/* HFS does not support nonblocking I/O. Therefore, use blocking I/O */
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_READ;
(*request)->fd = fd;
(*request)->queued = 0;
(*request)->datatype = datatype;
MPI_Type_size(datatype, &typesize);
len = count * typesize;
ADIOI_HFS_ReadContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset,
&status, error_code);
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Get_elements(&status, MPI_BYTE, &len);
(*request)->nbytes = len;
}
#endif
fd->async_count++;
}
void ADIOI_HFS_IreadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code)
{
ADIO_Status status;
#ifdef HAVE_STATUS_SET_BYTES
int typesize;
#endif
/* HFS does not support nonblocking I/O. Therefore, use blocking I/O */
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_READ;
(*request)->fd = fd;
(*request)->queued = 0;
(*request)->datatype = datatype;
ADIOI_HFS_ReadStrided(fd, buf, count, datatype, file_ptr_type,
offset, &status, error_code);
fd->async_count++;
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Type_size(datatype, &typesize);
(*request)->nbytes = count * typesize;
}
#endif
}

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

@ -1,71 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_iwrite.c,v 1.4 2002/10/24 17:00:44 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
void ADIOI_HFS_IwriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int *error_code)
{
ADIO_Status status;
int len, typesize;
/* HFS does not support nonblocking I/O. Therefore, use blocking I/O */
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_WRITE;
(*request)->fd = fd;
(*request)->queued = 0;
(*request)->datatype = datatype;
MPI_Type_size(datatype, &typesize);
len = count * typesize;
ADIOI_HFS_WriteContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset,
&status, error_code);
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Get_elements(&status, MPI_BYTE, &len);
(*request)->nbytes = len;
}
#endif
fd->async_count++;
}
void ADIOI_HFS_IwriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code)
{
ADIO_Status status;
#ifdef HAVE_STATUS_SET_BYTES
int typesize;
#endif
/* HFS does not support nonblocking I/O. Therefore, use blocking I/O */
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_WRITE;
(*request)->fd = fd;
(*request)->queued = 0;
(*request)->datatype = datatype;
ADIOI_HFS_WriteStrided(fd, buf, count, datatype, file_ptr_type,
offset, &status, error_code);
fd->async_count++;
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Type_size(datatype, &typesize);
(*request)->nbytes = count * typesize;
}
#endif
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_open.c,v 1.6 2002/10/24 17:00:44 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -35,6 +34,7 @@ void ADIOI_HFS_Open(ADIO_File fd, int *error_code)
amode = amode | O_EXCL;
fd->fd_sys = open64(fd->filename, amode, perm);
fd->fd_direct = -1;
if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) {
fd->fp_ind = lseek64(fd->fd_sys, 0, SEEK_END);
@ -47,14 +47,17 @@ void ADIOI_HFS_Open(ADIO_File fd, int *error_code)
fd->fp_sys_posn = -1; /* set it to null bec. we use pread, pwrite*/
#endif
#ifdef PRINT_ERR_MSG
*error_code = (fd->fd_sys == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (fd->fd_sys == -1) {
if (fd->fd_sys == -1 ) {
#ifdef MPICH2
*error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
#elif defined(PRINT_ERR_MSG)
*error_code = MPI_ERR_UNKNOWN;
#else /* MPICH-1 */
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(ADIO_FILE_NULL, *error_code, myname);
#endif
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,18 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_rdcoll.c,v 1.3 2002/10/24 17:00:44 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
void ADIOI_HFS_ReadStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_ReadStridedColl(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_read.c,v 1.6 2002/10/24 17:00:44 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -52,26 +51,17 @@ void ADIOI_HFS_ReadContig(ADIO_File fd, void *buf, int count,
if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
#endif
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
if (err == -1 ) {
#ifdef MPICH2
*error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
#elif defined(PRINT_ERR_MSG)
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else /* MPICH-1 */
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
#endif
}
else *error_code = MPI_SUCCESS;
#endif
}
void ADIOI_HFS_ReadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_resize.c,v 1.5 2002/10/24 17:00:44 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -16,14 +15,17 @@ void ADIOI_HFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
#endif
err = ftruncate64(fd->fd_sys, size);
#ifdef PRINT_ERR_MSG
*error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == -1) {
#ifdef MPICH2
*error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
#elif defined(PRINT_ERR_MSG)
*error_code = MPI_ERR_UNKNOWN;
#else /* MPICH-1 */
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
#endif
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,89 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_seek.c,v 1.7 2002/10/24 17:00:45 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
#include "adio_extern.h"
ADIO_Offset ADIOI_HFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
int whence, int *error_code)
{
/* implemented for whence=SEEK_SET only. SEEK_CUR and SEEK_END must
be converted to the equivalent with SEEK_SET before calling this
routine. */
/* offset is in units of etype relative to the filetype */
ADIO_Offset off;
ADIOI_Flatlist_node *flat_file;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_HFS_SEEKINDIVIDUAL";
#endif
int i, n_etypes_in_filetype, n_filetypes, etype_in_filetype;
ADIO_Offset abs_off_in_filetype=0;
int size_in_filetype, sum;
int filetype_size, etype_size, filetype_is_contig;
MPI_Aint filetype_extent;
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
etype_size = fd->etype_size;
if (filetype_is_contig) off = fd->disp + etype_size * offset;
else {
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype) flat_file = flat_file->next;
MPI_Type_extent(fd->filetype, &filetype_extent);
MPI_Type_size(fd->filetype, &filetype_size);
if ( ! filetype_size ) {
*error_code = MPI_SUCCESS;
return;
}
n_etypes_in_filetype = filetype_size/etype_size;
n_filetypes = (int) (offset / n_etypes_in_filetype);
etype_in_filetype = (int) (offset % n_etypes_in_filetype);
size_in_filetype = etype_in_filetype * etype_size;
sum = 0;
for (i=0; i<flat_file->count; i++) {
sum += flat_file->blocklens[i];
if (sum > size_in_filetype) {
abs_off_in_filetype = flat_file->indices[i] +
size_in_filetype - (sum - flat_file->blocklens[i]);
break;
}
}
/* abs. offset in bytes in the file */
off = fd->disp + (ADIO_Offset) n_filetypes * filetype_extent +
abs_off_in_filetype;
}
fd->fp_ind = off;
#ifdef HPUX
fd->fp_sys_posn = lseek64(fd->fd_sys, off, SEEK_SET);
#ifdef PRINT_ERR_MSG
*error_code = (fd->fp_sys_posn == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (fd->fp_sys_posn == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
#endif
#ifdef SPPUX
fd->fp_sys_posn = -1; /* no need to seek because we use pread/pwrite */
*error_code = MPI_SUCCESS;
#endif
return off;
}

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

@ -1,30 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_wait.c,v 1.4 2002/10/24 17:00:45 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
void ADIOI_HFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
{
if (*request == ADIO_REQUEST_NULL) {
*error_code = MPI_SUCCESS;
return;
}
#ifdef HAVE_STATUS_SET_BYTES
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
#endif
(*request)->fd->async_count--;
ADIOI_Free_request((ADIOI_Req_node *) (*request));
*request = ADIO_REQUEST_NULL;
*error_code = MPI_SUCCESS;
}
void ADIOI_HFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
{
ADIOI_HFS_ReadComplete(request, status, error_code);
}

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

@ -1,18 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_wrcoll.c,v 1.3 2002/10/24 17:00:45 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_hfs.h"
void ADIOI_HFS_WriteStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_WriteStridedColl(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_hfs_write.c,v 1.6 2002/10/24 17:00:45 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -51,24 +50,17 @@ void ADIOI_HFS_WriteContig(ADIO_File fd, void *buf, int count,
if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
#endif
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
#ifdef MPICH2
*error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
#elif defined(PRINT_ERR_MSG)
*error_code = MPI_SUCCESS;
#else /* MPICH-1 */
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
#endif
}
else *error_code = MPI_SUCCESS;
#endif
}
void ADIOI_HFS_WriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_WriteStrided(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -44,22 +44,16 @@ noinst_LTLIBRARIES = libadio_nfs.la
libadio_nfs_la_SOURCES = \
io_romio_ad_nfs.c \
ad_nfs.h \
io_romio_ad_nfs_close.c \
io_romio_ad_nfs_done.c \
io_romio_ad_nfs_fcntl.c \
io_romio_ad_nfs_flush.c \
io_romio_ad_nfs_getsh.c \
io_romio_ad_nfs_hints.c \
io_romio_ad_nfs_iread.c \
io_romio_ad_nfs_iwrite.c \
io_romio_ad_nfs_open.c \
io_romio_ad_nfs_rdcoll.c \
io_romio_ad_nfs_read.c \
io_romio_ad_nfs_resize.c \
io_romio_ad_nfs_seek.c \
io_romio_ad_nfs_setsh.c \
io_romio_ad_nfs_wait.c \
io_romio_ad_nfs_wrcoll.c \
io_romio_ad_nfs_write.c
#

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs.c,v 1.3 2002/10/24 17:00:45 gropp Exp $
*
* Copyright (C) 2001 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -22,16 +21,16 @@ struct ADIOI_Fns_struct ADIO_NFS_operations = {
ADIOI_GEN_SetInfo, /* SetInfo */
ADIOI_NFS_ReadStrided, /* ReadStrided */
ADIOI_NFS_WriteStrided, /* WriteStrided */
ADIOI_NFS_Close, /* Close */
ADIOI_GEN_Close, /* Close */
ADIOI_NFS_IreadContig, /* IreadContig */
ADIOI_NFS_IwriteContig, /* IwriteContig */
ADIOI_NFS_ReadDone, /* ReadDone */
ADIOI_NFS_WriteDone, /* WriteDone */
ADIOI_NFS_ReadComplete, /* ReadComplete */
ADIOI_NFS_WriteComplete, /* WriteComplete */
ADIOI_NFS_IreadStrided, /* IreadStrided */
ADIOI_NFS_IwriteStrided, /* IwriteStrided */
ADIOI_GEN_IreadStrided, /* IreadStrided */
ADIOI_GEN_IwriteStrided, /* IwriteStrided */
ADIOI_GEN_Flush, /* Flush */
ADIOI_NFS_Resize, /* Resize */
ADIOI_GEN_Resize, /* Resize */
ADIOI_GEN_Delete, /* Delete */
};

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

@ -1,7 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs.h,v 1.6 2002/10/24 17:00:46 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
@ -14,15 +12,20 @@
#include <fcntl.h>
#include "adio.h"
#ifndef NO_AIO
#ifdef AIO_SUN
#include <sys/asynch.h>
#else
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#ifdef HAVE_AIO_H
#include <aio.h>
#ifdef NEEDS_ADIOCB_T
typedef struct adiocb adiocb_t;
#endif
#ifdef HAVE_SYS_AIO_H
#include <sys/aio.h>
#endif
/* Workaround for incomplete set of definitions if __REDIRECT is not
defined and large file support is used in aio.h */
#if !defined(__REDIRECT) && defined(__USE_FILE_OFFSET64)
#define aiocb aiocb64
#endif
int ADIOI_NFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
@ -32,4 +35,44 @@ int ADIOI_NFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
#define lseek llseek
#endif
void ADIOI_NFS_Open(ADIO_File fd, int *error_code);
void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_NFS_WriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_NFS_IwriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
void ADIOI_NFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
int ADIOI_NFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_NFS_WriteComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code);
void ADIOI_NFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
*error_code);
void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_NFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
void ADIOI_NFS_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp,
int *error_code);
void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
#endif

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

@ -1,29 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_close.c,v 1.6 2002/10/24 17:00:46 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_nfs.h"
void ADIOI_NFS_Close(ADIO_File fd, int *error_code)
{
int err;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_CLOSE";
#endif
err = close(fd->fd_sys);
#ifdef PRINT_ERR_MSG
*error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,26 +1,19 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_done.c,v 1.8 2002/10/24 17:00:46 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_nfs.h"
int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
#ifndef NO_AIO
#ifdef ROMIO_HAVE_WORKING_AIO
int done=0;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_READDONE";
#endif
#ifdef AIO_SUN
aio_result_t *result=0, *tmp;
#else
int err;
#endif
#ifdef AIO_HANDLE_IN_AIOCB
static char myname[] = "ADIOI_NFS_READDONE";
#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_HANDLE
struct aiocb *tmp1;
#endif
#endif
@ -30,56 +23,20 @@ int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_co
return 1;
}
#ifdef NO_AIO
/* HP, FreeBSD, Linux */
#ifdef HAVE_STATUS_SET_BYTES
#ifndef ROMIO_HAVE_WORKING_AIO
# ifdef HAVE_STATUS_SET_BYTES
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
#endif
# endif
(*request)->fd->async_count--;
ADIOI_Free_request((ADIOI_Req_node *) (*request));
*request = ADIO_REQUEST_NULL;
*error_code = MPI_SUCCESS;
return 1;
#endif
#ifdef AIO_SUN
if ((*request)->queued) {
tmp = (aio_result_t *) (*request)->handle;
if (tmp->aio_return == AIO_INPROGRESS) {
done = 0;
*error_code = MPI_SUCCESS;
}
else if (tmp->aio_return != -1) {
result = (aio_result_t *) aiowait(0); /* dequeue any one request */
done = 1;
(*request)->nbytes = tmp->aio_return;
*error_code = MPI_SUCCESS;
}
else {
#ifdef PRINT_ERR_MSG
*error_code = MPI_ERR_UNKNOWN;
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(tmp->aio_errno));
ADIOI_Error((*request)->fd, *error_code, myname);
#endif
}
}
else {
/* ADIOI_Complete_Async completed this request, but request object
was not freed. */
done = 1;
*error_code = MPI_SUCCESS;
}
#ifdef HAVE_STATUS_SET_BYTES
if (done && ((*request)->nbytes != -1))
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
#endif
#endif
#ifdef AIO_HANDLE_IN_AIOCB
/* IBM */
#ifndef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES
/* old IBM API */
if ((*request)->queued) {
tmp1 = (struct aiocb *) (*request)->handle;
errno = aio_error(tmp1->aio_handle);
@ -94,16 +51,14 @@ int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_co
done = 1;
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error((*request)->fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
}
else {
@ -115,8 +70,8 @@ int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_co
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
#endif
#elif (!defined(NO_AIO) && !defined(AIO_SUN))
/* DEC, SGI IRIX 5 and 6 */
#else
/* everything other than old IBM */
if ((*request)->queued) {
errno = aio_error((const struct aiocb *) (*request)->handle);
if (errno == EINPROGRESS) {
@ -130,16 +85,14 @@ int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_co
done = 1;
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error((*request)->fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
}
else {
@ -153,7 +106,6 @@ int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_co
#endif
#ifndef NO_AIO
if (done) {
/* if request is still queued in the system, it is also there
on ADIOI_Async_list. Delete it from there. */
@ -170,7 +122,8 @@ int ADIOI_NFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_co
}
int ADIOI_NFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
int ADIOI_NFS_WriteDone(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
return ADIOI_NFS_ReadDone(request, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_fcntl.c,v 1.6 2002/10/24 17:00:46 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -8,166 +7,33 @@
#include "ad_nfs.h"
#include "adio_extern.h"
#ifdef MPISGI
/* #ifdef MPISGI
#include "mpisgi2.h"
#endif
#endif */
void ADIOI_NFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code)
{
MPI_Datatype copy_etype, copy_filetype;
int combiner, i, j, k, filetype_is_contig, ntimes, len, err;
ADIOI_Flatlist_node *flat_file;
ADIO_Offset curr_fsize, alloc_size, size, done;
ADIO_Status status;
char *buf;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_FCNTL";
#endif
switch(flag) {
case ADIO_FCNTL_SET_VIEW:
/* free copies of old etypes and filetypes and delete flattened
version of filetype if necessary */
MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype));
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (!filetype_is_contig) ADIOI_Delete_flattened(fd->filetype);
MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype));
/* set new info */
ADIO_SetInfo(fd, fcntl_struct->info, &err);
/* set new etypes and filetypes */
MPI_Type_get_envelope(fcntl_struct->etype, &i, &j, &k, &combiner);
if (combiner == MPI_COMBINER_NAMED) fd->etype = fcntl_struct->etype;
else {
MPI_Type_contiguous(1, fcntl_struct->etype, &copy_etype);
MPI_Type_commit(&copy_etype);
fd->etype = copy_etype;
}
MPI_Type_get_envelope(fcntl_struct->filetype, &i, &j, &k, &combiner);
if (combiner == MPI_COMBINER_NAMED)
fd->filetype = fcntl_struct->filetype;
else {
MPI_Type_contiguous(1, fcntl_struct->filetype, &copy_filetype);
MPI_Type_commit(&copy_filetype);
fd->filetype = copy_filetype;
ADIOI_Flatten_datatype(fd->filetype);
/* this function will not flatten the filetype if it turns out
to be all contiguous. */
}
MPI_Type_size(fd->etype, &(fd->etype_size));
fd->disp = fcntl_struct->disp;
/* reset MPI-IO file pointer to point to the first byte that can
be accessed in this view. */
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (filetype_is_contig) fd->fp_ind = fcntl_struct->disp;
else {
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype)
flat_file = flat_file->next;
for (i=0; i<flat_file->count; i++) {
if (flat_file->blocklens[i]) {
fd->fp_ind = fcntl_struct->disp + flat_file->indices[i];
break;
}
}
}
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_GET_FSIZE:
ADIOI_READ_LOCK(fd, 0, SEEK_SET, 1);
fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END);
ADIOI_UNLOCK(fd, 0, SEEK_SET, 1);
if (fd->fp_sys_posn != -1)
if (fd->fp_sys_posn != -1) {
lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
#ifdef PRINT_ERR_MSG
*error_code = (fcntl_struct->fsize == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
}
if (fcntl_struct->fsize == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
break;
case ADIO_FCNTL_SET_DISKSPACE:
/* will be called by one process only */
/* On file systems with no preallocation function, I have to
explicitly write
to allocate space. Since there could be holes in the file,
I need to read up to the current file size, write it back,
and then write beyond that depending on how much
preallocation is needed.
read/write in sizes of no more than ADIOI_PREALLOC_BUFSZ */
curr_fsize = lseek(fd->fd_sys, 0, SEEK_END);
alloc_size = fcntl_struct->diskspace;
size = ADIOI_MIN(curr_fsize, alloc_size);
ntimes = (int) ((size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ);
buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ);
done = 0;
for (i=0; i<ntimes; i++) {
len = (int) (ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ));
ADIO_ReadContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, done,
&status, error_code);
if (*error_code != MPI_SUCCESS) {
#ifdef PRINT_ERR_MSG
FPRINTF(stderr, "ADIOI_NFS_Fcntl: To preallocate disk space, ROMIO needs to read the file and write it back, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.\n");
MPI_Abort(MPI_COMM_WORLD, 1);
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_PREALLOC_PERM,
myname, (char *) 0, (char *) 0);
ADIOI_Error(fd, *error_code, myname);
return;
#endif
}
ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, done,
&status, error_code);
if (*error_code != MPI_SUCCESS) return;
done += len;
}
if (alloc_size > curr_fsize) {
memset(buf, 0, ADIOI_PREALLOC_BUFSZ);
size = alloc_size - curr_fsize;
ntimes = (int) ((size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ);
for (i=0; i<ntimes; i++) {
len = (int) (ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ));
ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
done, &status, error_code);
if (*error_code != MPI_SUCCESS) return;
done += len;
}
}
ADIOI_Free(buf);
if (fd->fp_sys_posn != -1)
lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_IOMODE:
/* for implementing PFS I/O modes. will not occur in MPI-IO
implementation.*/
if (fd->iomode != fcntl_struct->iomode) {
fd->iomode = fcntl_struct->iomode;
MPI_Barrier(MPI_COMM_WORLD);
}
*error_code = MPI_SUCCESS;
ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
break;
case ADIO_FCNTL_SET_ATOMICITY:
@ -176,7 +42,12 @@ void ADIOI_NFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *er
break;
default:
FPRINTF(stderr, "Unknown flag passed to ADIOI_NFS_Fcntl\n");
MPI_Abort(MPI_COMM_WORLD, 1);
/* --BEGIN ERROR HANDLING-- */
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_ARG,
"**flag", "**flag %d", flag);
return;
/* --END ERROR HANDLING-- */
}
}

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

@ -1,14 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_flush.c,v 1.4 2002/10/24 17:00:46 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_nfs.h"
void ADIOI_NFS_Flush(ADIO_File fd, int *error_code)
{
ADIOI_GEN_Flush(fd, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_getsh.c,v 1.7 2002/10/24 17:00:46 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -19,16 +18,17 @@ void ADIOI_NFS_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp,
ADIO_Offset new_fp;
int err;
MPI_Comm dupcommself;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_GET_SHARED_FP";
#endif
if (fd->shared_fp_fd == ADIO_FILE_NULL) {
MPI_Comm_dup(MPI_COMM_SELF, &dupcommself);
fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, fd->shared_fp_fname,
fd->file_system, ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE,
0, MPI_BYTE, MPI_BYTE, M_ASYNC, MPI_INFO_NULL,
ADIO_PERM_NULL, error_code);
fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself,
fd->shared_fp_fname,
fd->file_system,
fd->fns,
ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE,
0, MPI_BYTE, MPI_BYTE, 0, MPI_INFO_NULL,
ADIO_PERM_NULL, error_code);
if (*error_code != MPI_SUCCESS) return;
*shared_fp = 0;
ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
@ -39,34 +39,34 @@ void ADIOI_NFS_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp,
}
else {
ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET);
err = read(fd->shared_fp_fd->fd_sys, shared_fp, sizeof(ADIO_Offset));
err = lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET);
if (err == 0) {
err = read(fd->shared_fp_fd->fd_sys, shared_fp,
sizeof(ADIO_Offset));
}
if (err == -1) {
ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
#ifdef PRINT_ERR_MSG
*error_code = MPI_ERR_UNKNOWN;
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
#endif
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
return;
}
}
new_fp = *shared_fp + incr;
lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET);
err = write(fd->shared_fp_fd->fd_sys, &new_fp, sizeof(ADIO_Offset));
err = lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET);
if (err == 0) {
err = write(fd->shared_fp_fd->fd_sys, &new_fp, sizeof(ADIO_Offset));
}
ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_hints.c,v 1.4 2002/10/24 17:00:46 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.

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

@ -1,7 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_iread.c,v 1.7 2002/10/24 17:00:47 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
@ -9,17 +7,16 @@
#include "ad_nfs.h"
void ADIOI_NFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int *error_code)
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request,
int *error_code)
{
int len, typesize;
#ifdef NO_AIO
#ifndef ROMIO_HAVE_WORKING_AIO
ADIO_Status status;
#else
int err=-1;
#ifndef PRINT_ERR_MSG
int aio_errno = 0;
static char myname[] = "ADIOI_NFS_IREADCONTIG";
#endif
#endif
(*request) = ADIOI_Malloc_request();
@ -30,8 +27,7 @@ void ADIOI_NFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Type_size(datatype, &typesize);
len = count * typesize;
#ifdef NO_AIO
/* HP, FreeBSD, Linux */
#ifndef ROMIO_HAVE_WORKING_AIO
/* no support for nonblocking I/O. Use blocking I/O. */
ADIOI_NFS_ReadContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset,
@ -44,59 +40,26 @@ void ADIOI_NFS_IreadContig(ADIO_File fd, void *buf, int count,
}
#endif
fd->fp_sys_posn = -1;
#else
if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;
err = ADIOI_NFS_aio(fd, buf, len, offset, 0, &((*request)->handle));
aio_errno = ADIOI_NFS_aio(fd, buf, len, offset, 0, &((*request)->handle));
if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
(*request)->queued = 1;
ADIOI_Add_req_to_list(request);
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
fd->fp_sys_posn = -1;
if (aio_errno != 0) {
/* --BEGIN ERROR HANDLING-- */
MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code);
return;
/* --END ERROR HANDLING-- */
}
else *error_code = MPI_SUCCESS;
#endif
#endif
fd->fp_sys_posn = -1; /* set it to null. */
fd->async_count++;
}
void ADIOI_NFS_IreadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code)
{
ADIO_Status status;
#ifdef HAVE_STATUS_SET_BYTES
int typesize;
#endif
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_READ;
(*request)->fd = fd;
(*request)->datatype = datatype;
(*request)->queued = 0;
(*request)->handle = 0;
/* call the blocking version. It is faster because it does data sieving. */
ADIOI_NFS_ReadStrided(fd, buf, count, datatype, file_ptr_type,
offset, &status, error_code);
fd->async_count++;
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Type_size(datatype, &typesize);
(*request)->nbytes = count * typesize;
}
#endif
}

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

@ -1,7 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_iwrite.c,v 1.7 2002/10/24 17:00:47 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
@ -13,13 +11,11 @@ void ADIOI_NFS_IwriteContig(ADIO_File fd, void *buf, int count,
ADIO_Offset offset, ADIO_Request *request, int *error_code)
{
int len, typesize;
#ifdef NO_AIO
#ifndef ROMIO_HAVE_WORKING_AIO
ADIO_Status status;
#else
int err=-1;
#ifndef PRINT_ERR_MSG
int aio_errno = 0;
static char myname[] = "ADIOI_NFS_IWRITECONTIG";
#endif
#endif
*request = ADIOI_Malloc_request();
@ -30,12 +26,13 @@ void ADIOI_NFS_IwriteContig(ADIO_File fd, void *buf, int count,
MPI_Type_size(datatype, &typesize);
len = count * typesize;
#ifdef NO_AIO
#ifndef ROMIO_HAVE_WORKING_AIO
/* HP, FreeBSD, Linux */
/* no support for nonblocking I/O. Use blocking I/O. */
ADIOI_NFS_WriteContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset, &status,
error_code);
ADIOI_NFS_WriteContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset,
&status,
error_code);
(*request)->queued = 0;
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
@ -44,283 +41,88 @@ void ADIOI_NFS_IwriteContig(ADIO_File fd, void *buf, int count,
}
#endif
fd->fp_sys_posn = -1;
#else
if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;
err = ADIOI_NFS_aio(fd, buf, len, offset, 1, &((*request)->handle));
aio_errno = ADIOI_NFS_aio(fd, buf, len, offset, 1, &((*request)->handle));
if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
(*request)->queued = 1;
ADIOI_Add_req_to_list(request);
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
fd->fp_sys_posn = -1;
if (aio_errno != 0) {
/* --BEGIN ERROR HANDLING-- */
MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code);
return;
/* --END ERROR HANDLING-- */
}
else *error_code = MPI_SUCCESS;
#endif
#endif
fd->fp_sys_posn = -1; /* set it to null. */
fd->async_count++;
}
void ADIOI_NFS_IwriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code)
{
ADIO_Status status;
#ifdef HAVE_STATUS_SET_BYTES
int typesize;
#endif
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_WRITE;
(*request)->fd = fd;
(*request)->datatype = datatype;
(*request)->queued = 0;
(*request)->handle = 0;
/* call the blocking version. It is faster because it does data sieving. */
ADIOI_NFS_WriteStrided(fd, buf, count, datatype, file_ptr_type,
offset, &status, error_code);
fd->async_count++;
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Type_size(datatype, &typesize);
(*request)->nbytes = count * typesize;
}
#endif
}
/* This function is for implementation convenience. It is not user-visible.
It takes care of the differences in the interface for nonblocking I/O
on various Unix machines! If wr==1 write, wr==0 read. */
* It takes care of the differences in the interface for nonblocking I/O
* on various Unix machines! If wr==1 write, wr==0 read.
*
* Returns 0 on success, -errno on failure.
*/
#ifdef ROMIO_HAVE_WORKING_AIO
int ADIOI_NFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
int wr, void *handle)
{
int err=-1, fd_sys;
int error_code, this_errno;
#ifndef NO_AIO
int error_code, this_errno;
#ifdef AIO_SUN
aio_result_t *result;
#else
struct aiocb *aiocbp;
#endif
#endif
fd_sys = fd->fd_sys;
#ifdef AIO_SUN
result = (aio_result_t *) ADIOI_Malloc(sizeof(aio_result_t));
result->aio_return = AIO_INPROGRESS;
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
err = aioread(fd_sys, buf, len, offset, SEEK_SET, result);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
if (err == -1) {
if (this_errno == EAGAIN) {
/* the man pages say EPROCLIM, but in reality errno is set to EAGAIN! */
/* exceeded the max. no. of outstanding requests.
complete all previous async. requests and try again.*/
ADIOI_Complete_async(&error_code);
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
err = aioread(fd_sys, buf, len, offset, SEEK_SET, result);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
while (err == -1) {
if (this_errno == EAGAIN) {
/* sleep and try again */
sleep(1);
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
err = aioread(fd_sys, buf, len, offset, SEEK_SET, result);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
}
else {
FPRINTF(stderr, "Unknown errno %d in ADIOI_NFS_aio\n", this_errno);
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
}
else {
FPRINTF(stderr, "Unknown errno %d in ADIOI_NFS_aio\n", this_errno);
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
*((aio_result_t **) handle) = result;
#endif
#ifdef NO_FD_IN_AIOCB
/* IBM */
aiocbp = (struct aiocb *) ADIOI_Malloc(sizeof(struct aiocb));
aiocbp->aio_whence = SEEK_SET;
aiocbp->aio_offset = offset;
aiocbp->aio_buf = buf;
aiocbp->aio_nbytes = len;
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_write(aiocbp);
#else
err = aio_write(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_read(aiocbp);
#else
err = aio_read(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
if (err == -1) {
if (this_errno == EAGAIN) {
/* exceeded the max. no. of outstanding requests.
complete all previous async. requests and try again. */
ADIOI_Complete_async(&error_code);
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_write(aiocbp);
#else
err = aio_write(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_read(aiocbp);
#else
err = aio_read(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
while (err == -1) {
if (this_errno == EAGAIN) {
/* sleep and try again */
sleep(1);
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_write(aiocbp);
#else
err = aio_write(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_read(aiocbp);
#else
err = aio_read(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
}
else {
FPRINTF(stderr, "Unknown errno %d in ADIOI_NFS_aio\n", this_errno);
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
}
else {
FPRINTF(stderr, "Unknown errno %d in ADIOI_NFS_aio\n", this_errno);
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
*((struct aiocb **) handle) = aiocbp;
#elif (!defined(NO_AIO) && !defined(AIO_SUN))
/* DEC, SGI IRIX 5 and 6 */
aiocbp = (struct aiocb *) ADIOI_Calloc(sizeof(struct aiocb), 1);
aiocbp->aio_fildes = fd_sys;
aiocbp->aio_offset = offset;
aiocbp->aio_buf = buf;
aiocbp->aio_buf = buf;
aiocbp->aio_nbytes = len;
#ifdef AIO_PRIORITY_DEFAULT
/* DEC */
aiocbp->aio_reqprio = AIO_PRIO_DFL; /* not needed DEC Unix 4.0 */
aiocbp->aio_sigevent.sigev_signo = 0;
#else
aiocbp->aio_reqprio = 0;
/* This madness is mostly here to deal with IBM AIO implementation */
#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_WHENCE
aiocbp->aio_whence = SEEK_SET;
#endif
#ifdef AIO_SIGNOTIFY_NONE
/* SGI IRIX 6 */
#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES
aiocbp->aio_fildes = fd_sys;
#endif
#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_SIGEVENT
# ifdef AIO_SIGNOTIFY_NONE
aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE;
#else
# endif
aiocbp->aio_sigevent.sigev_signo = 0;
#endif
#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_REQPRIO
# ifdef AIO_PRIO_DFL
aiocbp->aio_reqprio = AIO_PRIO_DFL; /* not needed in DEC Unix 4.0 */
# else
aiocbp->aio_reqprio = 0;
# endif
#endif
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
err = aio_write(aiocbp);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
err = aio_read(aiocbp);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
if (wr) ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES
if (wr) err = aio_write(aiocbp);
else err = aio_read(aiocbp);
#else
/* Broken IBM interface */
if (wr) err = aio_write(fd_sys, aiocbp);
else err = aio_read(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
if (err == -1) {
if (this_errno == EAGAIN) {
@ -328,50 +130,41 @@ int error_code, this_errno;
complete all previous async. requests and try again. */
ADIOI_Complete_async(&error_code);
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
err = aio_write(aiocbp);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
err = aio_read(aiocbp);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
if (error_code != MPI_SUCCESS) return -EIO;
while (err == -1) {
if (this_errno == EAGAIN) {
while (err == -1 && this_errno == EAGAIN) {
if (wr) ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES
if (wr) err = aio_write(aiocbp);
else err = aio_read(aiocbp);
#else
/* Broken IBM interface */
if (wr) err = aio_write(fd_sys, aiocbp);
else err = aio_read(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
if (err == -1 && this_errno == EAGAIN) {
/* sleep and try again */
sleep(1);
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
err = aio_write(aiocbp);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
err = aio_read(aiocbp);
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
}
else {
FPRINTF(stderr, "Unknown errno %d in ADIOI_NFS_aio\n", this_errno);
MPI_Abort(MPI_COMM_WORLD, 1);
else if (err == -1) {
/* real error */
return -errno;
}
}
}
else {
FPRINTF(stderr, "Unknown errno %d in ADIOI_NFS_aio\n", this_errno);
MPI_Abort(MPI_COMM_WORLD, 1);
return -this_errno;
}
}
*((struct aiocb **) handle) = aiocbp;
#endif
return err;
return 0;
}
#endif

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_open.c,v 1.6 2002/11/13 17:58:48 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -10,10 +9,9 @@
void ADIOI_NFS_Open(ADIO_File fd, int *error_code)
{
int perm, old_mask, amode;
#ifndef PRINT_ERR_MSG
int perm, amode;
mode_t old_mask;
static char myname[] = "ADIOI_NFS_OPEN";
#endif
if (fd->perm == ADIO_PERM_NULL) {
old_mask = umask(022);
@ -35,18 +33,57 @@ void ADIOI_NFS_Open(ADIO_File fd, int *error_code)
amode = amode | O_EXCL;
fd->fd_sys = open(fd->filename, amode, perm);
fd->fd_direct = -1;
if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND))
fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
#ifdef PRINT_ERR_MSG
*error_code = (fd->fd_sys == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (fd->fd_sys == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(ADIO_FILE_NULL, *error_code, myname);
/* Check for special error codes for those MPI error
classes that relate to particular problems */
if (errno == ENAMETOOLONG)
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_BAD_FILE,
"**filenamelong",
"**filenamelong %s %d",
fd->filename,
strlen(fd->filename));
else if (errno == ENOENT)
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_NO_SUCH_FILE,
"**filenoexist",
"**filenoexist %s",
fd->filename);
else if (errno == ENOTDIR || errno == ELOOP)
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_BAD_FILE,
"**filenamedir",
"**filenamedir %s",
fd->filename);
else if (errno == EACCES) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_ACCESS,
"**fileaccess",
"**fileaccess %s",
fd->filename);
}
else if (errno == EROFS) {
/* Read only file or file system and write access requested */
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_READ_ONLY,
"**ioneedrd", 0);
}
else {
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,18 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_rdcoll.c,v 1.4 2002/10/24 17:00:47 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_nfs.h"
void ADIOI_NFS_ReadStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_ReadStridedColl(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_read.c,v 1.11 2002/10/24 17:00:47 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -14,9 +13,7 @@ void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count,
ADIO_Offset offset, ADIO_Status *status, int *error_code)
{
int err=-1, datatype_size, len;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_READCONTIG";
#endif
MPI_Type_size(datatype, &datatype_size);
len = datatype_size * count;
@ -45,20 +42,20 @@ void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count,
fd->fp_sys_posn = fd->fp_ind;
}
/* --BEGIN ERROR HANDLING-- */
if (err == -1) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", strerror(errno));
return;
}
/* --END ERROR HANDLING-- */
#ifdef HAVE_STATUS_SET_BYTES
if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
MPIR_Status_set_bytes(status, datatype, err);
#endif
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
*error_code = MPI_SUCCESS;
}
@ -115,9 +112,8 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
char *readbuf, *tmp_buf, *value;
int flag, st_frd_size, st_n_filetypes, readbuf_len;
int new_brd_size, new_frd_size, err_flag=0, info_flag, max_bufsize;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_READSTRIDED";
#endif
ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
@ -186,16 +182,13 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
ADIOI_Free(readbuf); /* malloced in the buffered_read macro */
#ifdef PRINT_ERR_MSG
*error_code = (err_flag) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err_flag) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
else { /* noncontiguous in file */
@ -403,16 +396,13 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
ADIOI_Free(readbuf); /* malloced in the buffered_read macro */
#ifdef PRINT_ERR_MSG
*error_code = (err_flag) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err_flag) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
fd->fp_sys_posn = -1; /* set it to null. */

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

@ -1,29 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_resize.c,v 1.6 2002/10/24 17:00:47 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_nfs.h"
void ADIOI_NFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
{
int err;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_RESIZE";
#endif
err = ftruncate(fd->fd_sys, size);
#ifdef PRINT_ERR_MSG
*error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,18 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_seek.c,v 1.5 2002/10/24 17:00:47 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_nfs.h"
#ifdef PROFILE
#include "mpe.h"
#endif
ADIO_Offset ADIOI_NFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
int whence, int *error_code)
{
return ADIOI_GEN_SeekIndividual(fd, offset, whence, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_setsh.c,v 1.7 2002/10/24 17:00:47 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -11,20 +10,38 @@
/* set the shared file pointer to "offset" etypes relative to the current
view */
/*
This looks very similar to ADIOI_GEN_Set_shared_fp, except this
function avoids locking the file twice. The generic version does
Write lock
ADIO_WriteContig
Unlock
For NFS, ADIOI_NFS_WriteContig does a lock before writing to disable
caching. To avoid the lock being called twice, this version for NFS does
Write lock
Lseek
Write
Unlock
*/
void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code)
{
int err;
MPI_Comm dupcommself;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_SET_SHARED_FP";
#endif
if (fd->shared_fp_fd == ADIO_FILE_NULL) {
MPI_Comm_dup(MPI_COMM_SELF, &dupcommself);
fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself, fd->shared_fp_fname,
fd->file_system, ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE,
0, MPI_BYTE, MPI_BYTE, M_ASYNC, MPI_INFO_NULL,
ADIO_PERM_NULL, error_code);
fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself,
fd->shared_fp_fname,
fd->file_system, fd->fns,
ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE,
0, MPI_BYTE, MPI_BYTE, 0, MPI_INFO_NULL,
ADIO_PERM_NULL, error_code);
}
if (*error_code != MPI_SUCCESS) return;
@ -34,15 +51,12 @@ void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code)
err = write(fd->shared_fp_fd->fd_sys, &offset, sizeof(ADIO_Offset));
ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,25 +1,18 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_wait.c,v 1.8 2002/10/24 17:00:48 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_nfs.h"
void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
#ifndef NO_AIO
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_READCOMPLETE";
#endif
#ifdef AIO_SUN
aio_result_t *result=0, *tmp;
#else
#ifdef ROMIO_HAVE_WORKING_AIO
int err;
#endif
#ifdef AIO_HANDLE_IN_AIOCB
static char myname[] = "ADIOI_NFS_READCOMPLETE";
#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_HANDLE
struct aiocb *tmp1;
#endif
#endif
@ -28,45 +21,9 @@ void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *err
*error_code = MPI_SUCCESS;
return;
}
#ifdef AIO_SUN
if ((*request)->queued) { /* dequeue it */
tmp = (aio_result_t *) (*request)->handle;
while (tmp->aio_return == AIO_INPROGRESS) usleep(1000);
/* sleep for 1 ms., until done. Is 1 ms. a good number? */
/* when done, dequeue any one request */
result = (aio_result_t *) aiowait(0);
(*request)->nbytes = tmp->aio_return;
#ifdef PRINT_ERR_MSG
*error_code = (tmp->aio_return == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (tmp->aio_return == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(tmp->aio_errno));
ADIOI_Error((*request)->fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
/* aiowait only dequeues a request. The completion of a request can be
checked by just checking the aio_return flag in the handle passed
to the original aioread()/aiowrite(). Therefore, I need to ensure
that aiowait() is called exactly once for each previous
aioread()/aiowrite(). This is also taken care of in ADIOI_xxxDone */
}
else *error_code = MPI_SUCCESS;
#ifdef HAVE_STATUS_SET_BYTES
if ((*request)->nbytes != -1)
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
#endif
#endif
#ifdef AIO_HANDLE_IN_AIOCB
/* IBM */
#ifdef ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS
/* old IBM */
if ((*request)->queued) {
do {
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
@ -88,29 +45,26 @@ void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *err
IBM man pages don't indicate what function to use for dequeue.
I'm assuming it is aio_return! */
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error((*request)->fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
else *error_code = MPI_SUCCESS;
else *error_code = MPI_SUCCESS; /* if ( (*request)->queued ) */
#ifdef HAVE_STATUS_SET_BYTES
if ((*request)->nbytes != -1)
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
#endif
#elif (!defined(NO_AIO) && !defined(AIO_SUN))
/* DEC, SGI IRIX 5 and 6 */
#elif defined(ROMIO_HAVE_WORKING_AIO)
/* all other aio types */
if ((*request)->queued) {
do {
err = aio_suspend((const aiocb_t **) &((*request)->handle), 1, 0);
err = aio_suspend((const struct aiocb **) &((*request)->handle), 1, 0);
} while ((err == -1) && (errno == EINTR));
if (err != -1) {
@ -120,25 +74,22 @@ void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *err
}
else (*request)->nbytes = -1;
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error((*request)->fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
else *error_code = MPI_SUCCESS;
else *error_code = MPI_SUCCESS; /* if ((*request)->queued) ... */
#ifdef HAVE_STATUS_SET_BYTES
if ((*request)->nbytes != -1)
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
#endif
#endif
#ifndef NO_AIO
#ifdef ROMIO_HAVE_WORKING_AIO
if ((*request)->queued != -1) {
/* queued = -1 is an internal hack used when the request must
@ -160,7 +111,7 @@ void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *err
}
#else
/* HP, FreeBSD, Linux */
/* no aio */
#ifdef HAVE_STATUS_SET_BYTES
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
@ -173,7 +124,8 @@ void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *err
}
void ADIOI_NFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
void ADIOI_NFS_WriteComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
ADIOI_NFS_ReadComplete(request, status, error_code);
}

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

@ -1,18 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_wrcoll.c,v 1.4 2002/10/24 17:00:48 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_nfs.h"
void ADIOI_NFS_WriteStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_WriteStridedColl(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_nfs_write.c,v 1.10 2002/10/24 17:00:48 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -14,9 +13,7 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, void *buf, int count,
ADIO_Offset offset, ADIO_Status *status, int *error_code)
{
int err=-1, datatype_size, len;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_WRITECONTIG";
#endif
MPI_Type_size(datatype, &datatype_size);
len = datatype_size * count;
@ -41,20 +38,21 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, void *buf, int count,
fd->fp_sys_posn = fd->fp_ind;
}
/* --BEGIN ERROR HANDLING-- */
if (err == -1) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
return;
}
/* --END ERROR HANDLING-- */
#ifdef HAVE_STATUS_SET_BYTES
if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
MPIR_Status_set_bytes(status, datatype, err);
#endif
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
*error_code = MPI_SUCCESS;
}
@ -73,8 +71,11 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, void *buf, int count,
lseek(fd->fd_sys, writebuf_off, SEEK_SET); \
err = read(fd->fd_sys, writebuf, writebuf_len); \
if (err == -1) { \
FPRINTF(stderr, "ADIOI_NFS_WriteStrided: ROMIO tries to optimize this access by doing a read-modify-write, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.\n"); \
MPI_Abort(MPI_COMM_WORLD, 1); \
*error_code = MPIO_Err_create_code(MPI_SUCCESS, \
MPIR_ERR_RECOVERABLE, myname, \
__LINE__, MPI_ERR_IO, \
"**ioRMWrdwr", 0); \
return; \
} \
} \
write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
@ -92,8 +93,11 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, void *buf, int count,
lseek(fd->fd_sys, writebuf_off, SEEK_SET); \
err = read(fd->fd_sys, writebuf, writebuf_len); \
if (err == -1) { \
FPRINTF(stderr, "ADIOI_NFS_WriteStrided: ROMIO tries to optimize this access by doing a read-modify-write, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.\n"); \
MPI_Abort(MPI_COMM_WORLD, 1); \
*error_code = MPIO_Err_create_code(MPI_SUCCESS, \
MPIR_ERR_RECOVERABLE, myname, \
__LINE__, MPI_ERR_IO, \
"**ioRMWrdwr", 0); \
return; \
} \
write_sz = ADIOI_MIN(req_len, writebuf_len); \
memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\
@ -153,9 +157,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count,
char *writebuf, *value;
int flag, st_fwr_size, st_n_filetypes, writebuf_len, write_sz;
int new_bwr_size, new_fwr_size, err_flag=0, info_flag, max_bufsize;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_WRITESTRIDED";
#endif
ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
@ -224,16 +226,13 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count,
ADIOI_Free(writebuf); /* malloced in the buffered_write macro */
if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;
#ifdef PRINT_ERR_MSG
*error_code = (err_flag) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err_flag) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
else { /* noncontiguous in file */
@ -322,8 +321,12 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count,
lseek(fd->fd_sys, writebuf_off, SEEK_SET);
err = read(fd->fd_sys, writebuf, writebuf_len);
if (err == -1) {
FPRINTF(stderr, "ADIOI_NFS_WriteStrided: ROMIO tries to optimize this access by doing a read-modify-write, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.\n");
MPI_Abort(MPI_COMM_WORLD, 1);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO,
"ADIOI_NFS_WriteStrided: ROMIO tries to optimize this access by doing a read-modify-write, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.", 0);
return;
}
if (buftype_is_contig && !filetype_is_contig) {
@ -448,16 +451,13 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count,
ADIOI_Free(writebuf); /* malloced in the buffered_write macro */
if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;
#ifdef PRINT_ERR_MSG
*error_code = (err_flag) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err_flag) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
fd->fp_sys_posn = -1; /* set it to null. */

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

@ -48,16 +48,12 @@ libadio_ntfs_la_SOURCES = \
io_romio_ad_ntfs_done.c \
io_romio_ad_ntfs_fcntl.c \
io_romio_ad_ntfs_flush.c \
io_romio_ad_ntfs_hints.c \
io_romio_ad_ntfs_iread.c \
io_romio_ad_ntfs_iwrite.c \
io_romio_ad_ntfs_open.c \
io_romio_ad_ntfs_rdcoll.c \
io_romio_ad_ntfs_read.c \
io_romio_ad_ntfs_resize.c \
io_romio_ad_ntfs_seek.c \
io_romio_ad_ntfs_wait.c \
io_romio_ad_ntfs_wrcoll.c \
io_romio_ad_ntfs_write.c
#

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

@ -16,7 +16,7 @@ struct ADIOI_Fns_struct ADIO_NTFS_operations = {
ADIOI_NTFS_WriteContig, /* WriteContig */
ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */
ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */
ADIOI_NTFS_SeekIndividual, /* SeekIndividual */
ADIOI_GEN_SeekIndividual, /* SeekIndividual */
ADIOI_NTFS_Fcntl, /* Fcntl */
ADIOI_GEN_SetInfo, /* SetInfo */
ADIOI_GEN_ReadStrided, /* ReadStrided */
@ -28,8 +28,8 @@ struct ADIOI_Fns_struct ADIO_NTFS_operations = {
ADIOI_NTFS_WriteDone, /* WriteDone */
ADIOI_NTFS_ReadComplete, /* ReadComplete */
ADIOI_NTFS_WriteComplete, /* WriteComplete */
ADIOI_NTFS_IreadStrided, /* IreadStrided */
ADIOI_NTFS_IwriteStrided, /* IwriteStrided */
ADIOI_FAKE_IreadStrided, /* IreadStrided */
ADIOI_FAKE_IwriteStrided, /* IwriteStrided */
ADIOI_NTFS_Flush, /* Flush */
ADIOI_NTFS_Resize, /* Resize */
ADIOI_GEN_Delete, /* Delete */

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

@ -26,4 +26,41 @@
int ADIOI_NTFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
int wr, void *handle);
void ADIOI_NTFS_Open(ADIO_File fd, int *error_code);
void ADIOI_NTFS_Close(ADIO_File fd, int *error_code);
void ADIOI_NTFS_ReadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_NTFS_WriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_NTFS_IwriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
void ADIOI_NTFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
int ADIOI_NTFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
int ADIOI_NTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_NTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_NTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code);
void ADIOI_NTFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
*error_code);
void ADIOI_NTFS_IwriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
void ADIOI_NTFS_Flush(ADIO_File fd, int *error_code);
void ADIOI_NTFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
const char * ADIOI_NTFS_Strerror(int error);
#endif

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_close.c,v 1.2 2002/10/24 17:00:48 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -11,19 +10,19 @@
void ADIOI_NTFS_Close(ADIO_File fd, int *error_code)
{
int err;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_CLOSE";
#endif
static char myname[] = "ADIOI_NTFS_Close";
err = CloseHandle(fd->fd_sys);
#ifdef PRINT_ERR_MSG
*error_code = (err == TRUE) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == FALSE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
err = CloseHandle(fd->fd_sys);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
return;
}
else *error_code = MPI_SUCCESS;
#endif
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
}

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

@ -1,82 +1,100 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_done.c,v 1.4 2002/11/13 13:30:34 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
/* Set the style to c++ since this code will only be compiled with the
Windows C/C++ compiler that accepts C++ style comments and other
constructions */
/* style:c++ header */
#include "ad_ntfs.h"
int ADIOI_NTFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
int ADIOI_NTFS_ReadDone(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
DWORD ret_val;
int done=0;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_READDONE";
#endif
if (*request == ADIO_REQUEST_NULL) {
*error_code = MPI_SUCCESS;
return 1;
DWORD ret_val;
int done = 0;
static char myname[] = "ADIOI_NTFS_ReadDone";
if (*request == ADIO_REQUEST_NULL)
{
*error_code = MPI_SUCCESS;
return 1;
}
if ((*request)->queued)
{
(*request)->nbytes = 0;
ret_val = GetOverlappedResult((*request)->fd, (*request)->handle, &(*request)->nbytes, FALSE);
if (!ret_val)
{
(*request)->nbytes = 0;
ret_val = GetOverlappedResult((*request)->fd, (*request)->handle, &(*request)->nbytes, FALSE);
//ret_val = WaitForSingleObject((*request)->handle, INFINITE);
//ret_val = (ret_val == WAIT_OBJECT_0) ? TRUE : FALSE;
if (!ret_val)
{
ret_val = GetLastError();
if (ret_val == ERROR_IO_INCOMPLETE)
{
done = 0;
*error_code = MPI_SUCCESS;
}
}
else
{
done = 1;
*error_code = MPI_SUCCESS;
}
}
else {
done = 1;
/* --BEGIN ERROR HANDLING-- */
ret_val = GetLastError();
if (ret_val == ERROR_IO_INCOMPLETE)
{
done = 0;
*error_code = MPI_SUCCESS;
}
else
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(ret_val));
}
/* --END ERROR HANDLING-- */
}
else
{
done = 1;
*error_code = MPI_SUCCESS;
}
}
else
{
done = 1;
*error_code = MPI_SUCCESS;
}
#ifdef HAVE_STATUS_SET_BYTES
if (done && ((*request)->nbytes != -1))
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
#endif
if (done)
{
{
/* if request is still queued in the system, it is also there
on ADIOI_Async_list. Delete it from there. */
if ((*request)->queued) ADIOI_Del_req_from_list(request);
(*request)->fd->async_count--;
if ((*request)->handle)
{
CloseHandle(((OVERLAPPED*)((*request)->handle))->hEvent);
ADIOI_Free((*request)->handle);
}
ADIOI_Free_request((ADIOI_Req_node *) (*request));
*request = ADIO_REQUEST_NULL;
on ADIOI_Async_list. Delete it from there. */
if ((*request)->queued) ADIOI_Del_req_from_list(request);
(*request)->fd->async_count--;
if ((*request)->handle)
{
if (!CloseHandle(((OVERLAPPED*)((*request)->handle))->hEvent))
{
ret_val = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(ret_val));
}
ADIOI_Free((*request)->handle);
}
ADIOI_Free_request((ADIOI_Req_node *) (*request));
*request = ADIO_REQUEST_NULL;
}
return done;
}
int ADIOI_NTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
int ADIOI_NTFS_WriteDone(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
return ADIOI_NTFS_ReadDone(request, status, error_code);
}
static char myname[] = "ADIOI_NTFS_WriteDone";
int ret_val;
ret_val = ADIOI_NTFS_ReadDone(request, status, error_code);
/* --BEGIN ERROR HANDLING-- */
if (*error_code != MPI_SUCCESS)
{
*error_code = MPIO_Err_create_code(*error_code, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", 0);
}
/* --END ERROR HANDLING-- */
return ret_val;
}

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

@ -1,191 +1,72 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_fcntl.c,v 1.6 2002/11/13 13:30:35 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
/* Set the style to c++ since this code will only be compiled with the
Windows C/C++ compiler that accepts C++ style comments and other
constructions */
/* style:c++ header */
#include "ad_ntfs.h"
#include "adio_extern.h"
void ADIOI_NTFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code)
{
DWORD dwTemp;
MPI_Datatype copy_etype, copy_filetype;
int combiner, i, j, k, filetype_is_contig, ntimes, err;
ADIOI_Flatlist_node *flat_file;
ADIO_Offset curr_fsize, alloc_size, size, len, done;
ADIO_Status status;
char *buf;
#ifndef PRINT_ERR_MSG
DWORD err;
LONG dwTemp;
static char myname[] = "ADIOI_NTFS_FCNTL";
#endif
switch(flag) {
case ADIO_FCNTL_SET_VIEW:
/* free copies of old etypes and filetypes and delete flattened
version of filetype if necessary */
MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype));
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (!filetype_is_contig) ADIOI_Delete_flattened(fd->filetype);
MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype));
/* set new info */
ADIO_SetInfo(fd, fcntl_struct->info, &err);
/* set new etypes and filetypes */
MPI_Type_get_envelope(fcntl_struct->etype, &i, &j, &k, &combiner);
if (combiner == MPI_COMBINER_NAMED) fd->etype = fcntl_struct->etype;
else {
MPI_Type_contiguous(1, fcntl_struct->etype, &copy_etype);
MPI_Type_commit(&copy_etype);
fd->etype = copy_etype;
}
MPI_Type_get_envelope(fcntl_struct->filetype, &i, &j, &k, &combiner);
if (combiner == MPI_COMBINER_NAMED)
fd->filetype = fcntl_struct->filetype;
else {
MPI_Type_contiguous(1, fcntl_struct->filetype, &copy_filetype);
MPI_Type_commit(&copy_filetype);
fd->filetype = copy_filetype;
ADIOI_Flatten_datatype(fd->filetype);
/* this function will not flatten the filetype if it turns out
to be all contiguous. */
}
MPI_Type_size(fd->etype, &(fd->etype_size));
fd->disp = fcntl_struct->disp;
/* reset MPI-IO file pointer to point to the first byte that can
be accessed in this view. */
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (filetype_is_contig) fd->fp_ind = fcntl_struct->disp;
else {
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype)
flat_file = flat_file->next;
for (i=0; i<flat_file->count; i++) {
if (flat_file->blocklens[i]) {
fd->fp_ind = fcntl_struct->disp + flat_file->indices[i];
break;
}
}
}
*error_code = MPI_SUCCESS;
break;
switch(flag)
{
case ADIO_FCNTL_GET_FSIZE:
fcntl_struct->fsize = SetFilePointer(fd->fd_sys, 0, 0, FILE_END);
if (fd->fp_sys_posn != -1)
{
dwTemp = DWORDHIGH(fd->fp_sys_posn);
SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_sys_posn), &dwTemp, FILE_BEGIN);
dwTemp = DWORDHIGH(fd->fp_sys_posn);
if (SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_sys_posn), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
{
err = GetLastError();
if (err != NO_ERROR)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
return;
}
}
}
#ifdef PRINT_ERR_MSG
*error_code = (fcntl_struct->fsize == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (fcntl_struct->fsize == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
/* --BEGIN ERROR HANDLING-- */
if (fcntl_struct->fsize == INVALID_SET_FILE_POINTER)
{
dwTemp = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", ADIOI_NTFS_Strerror(dwTemp));
return;
}
else *error_code = MPI_SUCCESS;
#endif
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_DISKSPACE:
/* will be called by one process only */
/* On file systems with no preallocation function, I have to
explicitly write
to allocate space. Since there could be holes in the file,
I need to read up to the current file size, write it back,
and then write beyond that depending on how much
preallocation is needed.
read/write in sizes of no more than ADIOI_PREALLOC_BUFSZ */
curr_fsize = SetFilePointer(fd->fd_sys, 0, 0, FILE_END);
alloc_size = fcntl_struct->diskspace;
size = ADIOI_MIN(curr_fsize, alloc_size);
ntimes = ((int)size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ);
done = 0;
for (i=0; i<ntimes; i++) {
len = ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ);
ADIO_ReadContig(fd, buf, (int)len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, (ADIO_Offset)done,
&status, error_code);
if (*error_code != MPI_SUCCESS) {
#ifdef PRINT_ERR_MSG
FPRINTF(stderr, "ADIOI_NTFS_Fcntl: To preallocate disk space, ROMIO needs to read the file and write it back, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.\n");
MPI_Abort(MPI_COMM_WORLD, 1);
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_PREALLOC_PERM,
myname, (char *) 0, (char *) 0);
ADIOI_Error(fd, *error_code, myname);
return;
#endif
}
ADIO_WriteContig(fd, buf, (int)len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
(ADIO_Offset)done, &status, error_code);
if (*error_code != MPI_SUCCESS) return;
done += len;
}
if (alloc_size > curr_fsize) {
memset(buf, 0, ADIOI_PREALLOC_BUFSZ);
size = alloc_size - curr_fsize;
ntimes = ((int)size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
for (i=0; i<ntimes; i++) {
len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);
ADIO_WriteContig(fd, buf, (int)len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
(ADIO_Offset)done, &status, error_code);
if (*error_code != MPI_SUCCESS) return;
done += len;
}
}
ADIOI_Free(buf);
if (fd->fp_sys_posn != -1)
{
dwTemp = DWORDHIGH(fd->fp_sys_posn);
SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_sys_posn), &dwTemp, FILE_BEGIN);
}
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_IOMODE:
/* for implementing PFS I/O modes. will not occur in MPI-IO
implementation.*/
if (fd->iomode != fcntl_struct->iomode) {
fd->iomode = fcntl_struct->iomode;
MPI_Barrier(MPI_COMM_WORLD);
}
*error_code = MPI_SUCCESS;
ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
break;
case ADIO_FCNTL_SET_ATOMICITY:
//fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;
//*error_code = MPI_SUCCESS;
fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;
*error_code = MPI_SUCCESS;
/*
fd->atomicity = 0;
*error_code = MPI_ERR_UNSUPPORTED_OPERATION;
*/
break;
default:
FPRINTF(stderr, "Unknown flag passed to ADIOI_NTFS_Fcntl\n");
MPI_Abort(MPI_COMM_WORLD, 1);
/* --BEGIN ERROR HANDLING-- */
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_ARG,
"**flag", "**flag %d", flag);
return;
/* --END ERROR HANDLING-- */
}
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_flush.c,v 1.3 2002/10/24 17:00:49 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -11,20 +10,21 @@
void ADIOI_NTFS_Flush(ADIO_File fd, int *error_code)
{
int err;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_GEN_FLUSH";
#endif
static char myname[] = "ADIOI_NTFS_Flush";
err = (fd->access_mode & ADIO_RDONLY) ? TRUE : FlushFileBuffers(fd->fd_sys);
err = (fd->access_mode & ADIO_RDONLY) ? TRUE :
FlushFileBuffers(fd->fd_sys);
#ifdef PRINT_ERR_MSG
*error_code = (err == TRUE) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == FALSE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(MPI_FILE_NULL, *error_code, myname);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
return;
}
else *error_code = MPI_SUCCESS;
#endif
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
}

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

@ -1,14 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_hints.c,v 1.2 2002/10/24 17:00:49 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_ntfs.h"
void ADIOI_NTFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
{
ADIOI_GEN_SetInfo(fd, users_info, error_code);
}

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

@ -1,16 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_iread.c,v 1.3 2002/11/13 13:30:35 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
/* Set the style to c++ since this code will only be compiled with the
Windows C/C++ compiler that accepts C++ style comments and other
constructions */
/* style:c++ */
#include "ad_ntfs.h"
void ADIOI_NTFS_IreadContig(ADIO_File fd, void *buf, int count,
@ -18,12 +11,17 @@ void ADIOI_NTFS_IreadContig(ADIO_File fd, void *buf, int count,
ADIO_Offset offset, ADIO_Request *request, int *error_code)
{
int len, typesize;
int err=FALSE;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_IREADCONTIG";
#endif
int err;
static char myname[] = "ADIOI_NTFS_IreadContig";
(*request) = ADIOI_Malloc_request();
if ((*request) == NULL)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**nomem", "**nomem %s", "ADIOI_Request");
return;
}
(*request)->optype = ADIOI_READ;
(*request)->fd = fd;
(*request)->datatype = datatype;
@ -31,57 +29,30 @@ void ADIOI_NTFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Type_size(datatype, &typesize);
len = count * typesize;
if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;
if (file_ptr_type == ADIO_INDIVIDUAL)
{
offset = fd->fp_ind;
}
err = ADIOI_NTFS_aio(fd, buf, len, offset, 0, &((*request)->handle));
if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
if (file_ptr_type == ADIO_INDIVIDUAL)
{
fd->fp_ind += len;
}
(*request)->queued = 1;
ADIOI_Add_req_to_list(request);
#ifdef PRINT_ERR_MSG
*error_code = (err == FALSE) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == FALSE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
/* --BEGIN ERROR HANDLING-- */
if (err != MPI_SUCCESS)
{
*error_code = MPIO_Err_create_code(err, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", 0);
return;
}
else *error_code = MPI_SUCCESS;
#endif
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
fd->fp_sys_posn = -1; /* set it to null. */
fd->async_count++;
}
void ADIOI_NTFS_IreadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code)
{
ADIO_Status status;
#ifdef HAVE_STATUS_SET_BYTES
int typesize;
#endif
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_READ;
(*request)->fd = fd;
(*request)->datatype = datatype;
(*request)->queued = 0;
(*request)->handle = 0;
/* call the blocking version. It is faster because it does data sieving. */
ADIOI_NTFS_ReadStrided(fd, buf, count, datatype, file_ptr_type,
offset, &status, error_code);
fd->async_count++;
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Type_size(datatype, &typesize);
(*request)->nbytes = count * typesize;
}
#endif
}

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

@ -1,29 +1,28 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_iwrite.c,v 1.4 2002/11/15 16:26:22 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
/* Set the style to c++ since this code will only be compiled with the
Windows C/C++ compiler that accepts C++ style comments and other
constructions */
/* style:c++ header */
#include "ad_ntfs.h"
void ADIOI_NTFS_IwriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int *error_code)
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request,
int *error_code)
{
int len, typesize;
int err=FALSE;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_IWRITECONTIG";
#endif
int err;
static char myname[] = "ADIOI_NTFS_IwriteContig";
*request = ADIOI_Malloc_request();
if ((*request) == NULL)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**nomem", "**nomem %s", "ADIOI_Request");
return;
}
(*request)->optype = ADIOI_WRITE;
(*request)->fd = fd;
(*request)->datatype = datatype;
@ -31,111 +30,127 @@ void ADIOI_NTFS_IwriteContig(ADIO_File fd, void *buf, int count,
MPI_Type_size(datatype, &typesize);
len = count * typesize;
if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;
if (file_ptr_type == ADIO_INDIVIDUAL)
{
offset = fd->fp_ind;
}
err = ADIOI_NTFS_aio(fd, buf, len, offset, 1, &((*request)->handle));
if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
if (file_ptr_type == ADIO_INDIVIDUAL)
{
fd->fp_ind += len;
}
(*request)->queued = 1;
ADIOI_Add_req_to_list(request);
#ifdef PRINT_ERR_MSG
*error_code = (err == FALSE) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == FALSE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
/* --BEGIN ERROR HANDLING-- */
if (err != MPI_SUCCESS)
{
*error_code = MPIO_Err_create_code(err, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", 0);
return;
}
else *error_code = MPI_SUCCESS;
#endif
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
fd->fp_sys_posn = -1; /* set it to null. */
fd->async_count++;
}
void ADIOI_NTFS_IwriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code)
{
ADIO_Status status;
#ifdef HAVE_STATUS_SET_BYTES
int typesize;
#endif
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_WRITE;
(*request)->fd = fd;
(*request)->datatype = datatype;
(*request)->queued = 0;
(*request)->handle = 0;
/* call the blocking version. It is faster because it does data sieving. */
ADIOI_NTFS_WriteStrided(fd, buf, count, datatype, file_ptr_type,
offset, &status, error_code);
fd->async_count++;
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Type_size(datatype, &typesize);
(*request)->nbytes = count * typesize;
}
#endif
}
/* This function is for implementation convenience. It is not user-visible.
It takes care of the differences in the interface for nonblocking I/O
on various Unix machines! If wr==1 write, wr==0 read. */
* If wr==1 write, wr==0 read.
*
* Returns MPI_SUCCESS on success, mpi_errno on failure.
*/
int ADIOI_NTFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
int wr, void *handle)
int wr, void *handle)
{
DWORD dwNumWritten=0, dwNumRead=0;
BOOL ret_val = FALSE;
FDTYPE fd_sys;
OVERLAPPED *pOvl;
static char myname[] = "ADIOI_NTFS_aio";
static DWORD dwNumWritten, dwNumRead;
BOOL ret_val = FALSE;
FDTYPE fd_sys;
int mpi_errno = MPI_SUCCESS;
OVERLAPPED *pOvl;
DWORD err;
fd_sys = fd->fd_sys;
pOvl = (OVERLAPPED *) ADIOI_Calloc(sizeof(OVERLAPPED), 1);
pOvl->hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
pOvl->Offset = DWORDLOW(offset);
pOvl->OffsetHigh = DWORDHIGH(offset);
if (pOvl == NULL)
{
mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**nomem", "**nomem %s", "OVERLAPPED");
return mpi_errno;
}
pOvl->hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
if (pOvl->hEvent == NULL)
{
err = GetLastError();
mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
ADIOI_Free(pOvl);
return mpi_errno;
}
pOvl->Offset = DWORDLOW(offset);
pOvl->OffsetHigh = DWORDHIGH(offset);
if (wr)
{
ret_val = WriteFile(fd_sys, buf, len, &dwNumWritten, pOvl);
//ret_val = WriteFile(fd_sys, buf, len, &dwNumWritten, NULL);
//if (ret_val && dwNumWritten) printf("written immediately: %d\n", dwNumWritten);
}
else
{
ret_val = ReadFile(fd_sys, buf, len, &dwNumRead, pOvl);
//ret_val = ReadFile(fd_sys, buf, len, &dwNumRead, NULL);
}
if (wr)
{
ret_val = WriteFile(fd_sys, buf, len, &dwNumWritten, pOvl);
}
else
{
ret_val = ReadFile(fd_sys, buf, len, &dwNumRead, pOvl);
}
/* --BEGIN ERROR HANDLING-- */
if (ret_val == FALSE)
{
mpi_errno = GetLastError();
if (mpi_errno != ERROR_IO_PENDING)
{
errno = GetLastError();
if (errno != ERROR_IO_PENDING)
{
if (wr)
FPRINTF(stderr, "WriteFile error: len %d, dwNumWritten %d\n", len, dwNumWritten);
else
FPRINTF(stderr, "ReadFile error: len %d, dwNumRead %d\n", len, dwNumRead);
FPRINTF(stderr, "Unknown errno %d in ADIOI_NTFS_aio\n", errno);
MPI_Abort(MPI_COMM_WORLD, 1);
}
ret_val = TRUE;
mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(mpi_errno));
return mpi_errno;
}
mpi_errno = MPI_SUCCESS;
}
/* --END ERROR HANDLING-- */
*((OVERLAPPED **) handle) = pOvl;
return ret_val;
return mpi_errno;
}
const char * ADIOI_NTFS_Strerror(int error)
{
/* obviously not thread safe to store a message like this */
static char msg[1024];
HLOCAL str;
int num_bytes;
num_bytes = FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ALLOCATE_BUFFER,
0,
error,
MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ),
(LPTSTR) &str,
0,0);
if (num_bytes == 0)
{
*msg = '\0';
}
else
{
memcpy(msg, str, num_bytes+1);
LocalFree(str);
strtok(msg, "\r\n");
}
return msg;
}

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

@ -6,113 +6,92 @@
* See COPYRIGHT notice in top-level directory.
*/
/* Set the style to c++ since this code will only be compiled with the
Windows C/C++ compiler that accepts C++ style comments and other
constructions */
/* style:c++ header */
#include "ad_ntfs.h"
void ADIOI_NTFS_Open(ADIO_File fd, int *error_code)
{
int cmode, amode, smode;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_OPEN";
#endif
int err;
int cmode, amode, attrib;
static char myname[] = "ADIOI_NTFS_Open";
amode = 0;
cmode = OPEN_EXISTING;
smode = 0;
#ifdef USE_WIN_THREADED_IO
attrib = FILE_FLAG_OVERLAPPED;
#else
attrib = FILE_ATTRIBUTE_NORMAL;
#endif
if (fd->access_mode & ADIO_CREATE)
cmode = OPEN_ALWAYS; //CREATE_ALWAYS;
{
cmode = OPEN_ALWAYS;
}
if (fd->access_mode & ADIO_EXCL)
{
cmode = CREATE_NEW;
}
if (fd->access_mode & ADIO_RDONLY)
{
amode = amode | FILE_SHARE_READ;
smode = smode | GENERIC_READ;
amode = GENERIC_READ;
}
if (fd->access_mode & ADIO_WRONLY)
{
amode = amode | FILE_SHARE_WRITE;
smode = smode | GENERIC_WRITE;
amode = GENERIC_WRITE;
}
if (fd->access_mode & ADIO_RDWR)
{
amode = amode | FILE_SHARE_READ | FILE_SHARE_WRITE;
smode = smode | GENERIC_READ | GENERIC_WRITE;
amode = GENERIC_READ | GENERIC_WRITE;
}
fd->fd_sys = CreateFile(
fd->filename,
//smode,
GENERIC_READ | GENERIC_WRITE,
amode,
NULL,
cmode,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (fd->access_mode & ADIO_DELETE_ON_CLOSE)
{
attrib = attrib | FILE_FLAG_DELETE_ON_CLOSE;
}
if (fd->access_mode & ADIO_SEQUENTIAL)
{
attrib = attrib | FILE_FLAG_SEQUENTIAL_SCAN;
}
else
{
attrib = attrib | FILE_FLAG_RANDOM_ACCESS;
}
fd->fd_sys = CreateFile(fd->filename,
amode,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL,
cmode,
attrib,
NULL);
fd->fd_direct = -1;
if ((fd->fd_sys != INVALID_HANDLE_VALUE) && (fd->access_mode & ADIO_APPEND))
fd->fp_ind = fd->fp_sys_posn = SetFilePointer(fd->fd_sys, 0, NULL, FILE_END);
#ifdef PRINT_ERR_MSG
*error_code = (fd->fd_sys == INVALID_HANDLE_VALUE) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
FPRINTF(stderr, "MPI_NTFS_File_open: Error %d opening file %s\n", GetLastError(), fd->filename);
#else
if (fd->fd_sys == INVALID_HANDLE_VALUE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(ADIO_FILE_NULL, *error_code, myname);
{
fd->fp_ind = fd->fp_sys_posn = SetFilePointer(fd->fd_sys, 0, NULL, FILE_END);
if (fd->fp_ind == INVALID_SET_FILE_POINTER)
{
err = GetLastError();
if (err != NO_ERROR)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
return;
}
}
}
else *error_code = MPI_SUCCESS;
#endif
}
/*
void ADIOI_NTFS_Open(ADIO_File fd, int *error_code)
{
int cmode, amode;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_OPEN";
#endif
amode = 0;
cmode = 0;
if (fd->access_mode & ADIO_CREATE)
cmode = OPEN_ALWAYS; //CREATE_ALWAYS;
if (fd->access_mode & ADIO_EXCL)
cmode = CREATE_NEW;
if (fd->access_mode & ADIO_RDONLY)
amode = amode | FILE_SHARE_READ;
if (fd->access_mode & ADIO_WRONLY)
amode = amode | FILE_SHARE_WRITE;
if (fd->access_mode & ADIO_RDWR)
amode = amode | FILE_SHARE_READ | FILE_SHARE_WRITE;
fd->fd_sys = CreateFile(
fd->filename,
GENERIC_READ | GENERIC_WRITE,
amode,
NULL,
cmode,
FILE_ATTRIBUTE_NORMAL,
NULL);
if ((fd->fd_sys != INVALID_HANDLE_VALUE) && (fd->access_mode & ADIO_APPEND))
fd->fp_ind = fd->fp_sys_posn = SetFilePointer(fd->fd_sys, 0, NULL, FILE_END);
#ifdef PRINT_ERR_MSG
*error_code = (fd->fd_sys == INVALID_HANDLE_VALUE) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (fd->fd_sys == INVALID_HANDLE_VALUE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(ADIO_FILE_NULL, *error_code, myname);
/* --BEGIN ERROR HANDLING-- */
if (fd->fd_sys == INVALID_HANDLE_VALUE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
return;
}
else *error_code = MPI_SUCCESS;
#endif
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
}
*/

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

@ -1,18 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_rdcoll.c,v 1.2 2002/10/24 17:00:49 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_ntfs.h"
void ADIOI_NTFS_ReadStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_ReadStridedColl(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,82 +1,206 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_read.c,v 1.4 2002/11/13 13:30:36 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
/* Set the style to c++ since this code will only be compiled with the
Windows C/C++ compiler that accepts C++ style comments and other
constructions */
/* style:c++ header */
#include "ad_ntfs.h"
void ADIOI_NTFS_ReadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int *error_code)
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status,
int *error_code)
{
//int rank;
DWORD dwTemp;
DWORD dwNumRead = 0;
LONG dwTemp;
DWORD dwNumRead = 0;
int err=-1, datatype_size, len;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_READCONTIG";
#endif
static char myname[] = "ADIOI_NTFS_ReadContig";
OVERLAPPED *pOvl;
MPI_Type_size(datatype, &datatype_size);
len = datatype_size * count;
if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
pOvl = (OVERLAPPED *) ADIOI_Calloc(sizeof(OVERLAPPED), 1);
if (pOvl == NULL)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**nomem", "**nomem %s", "OVERLAPPED");
return;
}
pOvl->hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
if (pOvl->hEvent == NULL)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
ADIOI_Free(pOvl);
return;
}
pOvl->Offset = DWORDLOW(offset);
pOvl->OffsetHigh = DWORDHIGH(offset);
if (file_ptr_type == ADIO_EXPLICIT_OFFSET)
{
if (fd->fp_sys_posn != offset)
{
dwTemp = DWORDHIGH(offset);
SetFilePointer(fd->fd_sys, DWORDLOW(offset), &dwTemp, FILE_BEGIN);
dwTemp = DWORDHIGH(offset);
if (SetFilePointer(fd->fd_sys, DWORDLOW(offset), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
{
err = GetLastError();
if (err != NO_ERROR)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
}
}
err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, NULL);
//MPI_Comm_rank(MPI_COMM_WORLD, &rank);
//printf("[%d]R(%d,%d)\n", rank, DWORDLOW(offset), dwNumRead);
err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, pOvl);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
switch (err)
{
case ERROR_IO_PENDING:
break;
case ERROR_HANDLE_EOF:
SetEvent(pOvl->hEvent);
break;
default:
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
}
/* --END ERROR HANDLING-- */
err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumRead, TRUE);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
/* --END ERROR HANDLING-- */
if (!CloseHandle(pOvl->hEvent))
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
ADIOI_Free(pOvl);
fd->fp_sys_posn = offset + (ADIO_Offset)dwNumRead;
/* individual file pointer not updated */
}
else { /* read from curr. location of ind. file pointer */
else
{
/* read from curr. location of ind. file pointer */
if (fd->fp_sys_posn != fd->fp_ind)
{
dwTemp = DWORDHIGH(fd->fp_ind);
SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_ind), &dwTemp, FILE_BEGIN);
dwTemp = DWORDHIGH(fd->fp_ind);
if (SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_ind), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
{
err = GetLastError();
if (err != NO_ERROR)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
}
}
err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, NULL);
//MPI_Comm_rank(MPI_COMM_WORLD, &rank);
//printf("[%d]r(%d,%d)\n", rank, DWORDLOW(offset), dwNumRead);
err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, pOvl);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
switch (err)
{
case ERROR_IO_PENDING:
break;
case ERROR_HANDLE_EOF:
SetEvent(pOvl->hEvent);
break;
default:
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
}
/* --END ERROR HANDLING-- */
err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumRead, TRUE);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
/* --END ERROR HANDLING-- */
if (!CloseHandle(pOvl->hEvent))
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
ADIOI_Free(pOvl);
return;
}
ADIOI_Free(pOvl);
fd->fp_ind = fd->fp_ind + (ADIO_Offset)dwNumRead;
fd->fp_sys_posn = fd->fp_ind;
}
#ifdef HAVE_STATUS_SET_BYTES
if (err != FALSE) MPIR_Status_set_bytes(status, datatype, dwNumRead);
#endif
#ifdef PRINT_ERR_MSG
*error_code = (err == FALSE) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == FALSE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
if (err != FALSE)
{
MPIR_Status_set_bytes(status, datatype, dwNumRead);
}
else *error_code = MPI_SUCCESS;
#endif
}
void ADIOI_NTFS_ReadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
return;
}
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_resize.c,v 1.2 2002/10/24 17:00:49 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -10,23 +9,38 @@
void ADIOI_NTFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
{
DWORD dwTemp;
int err;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_RESIZE";
#endif
LONG dwTemp;
DWORD err;
BOOL result;
static char myname[] = "ADIOI_NTFS_Resize";
dwTemp = DWORDHIGH(size);
err = SetFilePointer(fd->fd_sys, DWORDLOW(size), &dwTemp, FILE_BEGIN);
err = SetEndOfFile(fd->fd_sys);
#ifdef PRINT_ERR_MSG
*error_code = (err == TRUE) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == FALSE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
dwTemp = DWORDHIGH(size);
err = SetFilePointer(fd->fd_sys, DWORDLOW(size), &dwTemp, FILE_BEGIN);
/* --BEGIN ERROR HANDLING-- */
if (err == INVALID_SET_FILE_POINTER)
{
err = GetLastError();
if (err != NO_ERROR)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
return;
}
}
else *error_code = MPI_SUCCESS;
#endif
/* --END ERROR HANDLING-- */
result = SetEndOfFile(fd->fd_sys);
/* --BEGIN ERROR HANDLING-- */
if (result == FALSE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
return;
}
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
}

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

@ -1,117 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_seek.c,v 1.5 2002/11/13 13:30:36 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
/* Set the style to c++ since this code will only be compiled with the
Windows C/C++ compiler that accepts C++ style comments and other
constructions */
/* style:c++ header */
#include "ad_ntfs.h"
//#include "adio.h"
#include "adio_extern.h"
#ifdef PROFILE
#include "mpe.h"
#endif
ADIO_Offset ADIOI_NTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
int whence, int *error_code)
{
//return ADIOI_GEN_SeekIndividual(fd, offset, whence, error_code);
/* implemented for whence=SEEK_SET only. SEEK_CUR and SEEK_END must
be converted to the equivalent with SEEK_SET before calling this
routine. */
/* offset is in units of etype relative to the filetype */
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_GEN_SEEKINDIVIDUAL";
#endif
ADIO_Offset off, err;
ADIOI_Flatlist_node *flat_file;
int i, n_etypes_in_filetype, n_filetypes, etype_in_filetype;
ADIO_Offset abs_off_in_filetype=0;
int size_in_filetype, sum;
int filetype_size, etype_size, filetype_is_contig;
MPI_Aint filetype_extent;
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
etype_size = fd->etype_size;
if (filetype_is_contig) off = fd->disp + etype_size * offset;
else {
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype) flat_file = flat_file->next;
MPI_Type_extent(fd->filetype, &filetype_extent);
MPI_Type_size(fd->filetype, &filetype_size);
if ( ! filetype_size ) {
/* Since offset relative to the filetype size, we can't
do compute the offset when that result is zero.
Return zero for the offset for now */
*error_code = MPI_SUCCESS;
return 0;
}
n_etypes_in_filetype = filetype_size/etype_size;
n_filetypes = (int) (offset / n_etypes_in_filetype);
etype_in_filetype = (int) (offset % n_etypes_in_filetype);
size_in_filetype = etype_in_filetype * etype_size;
sum = 0;
for (i=0; i<flat_file->count; i++) {
sum += flat_file->blocklens[i];
if (sum > size_in_filetype) {
abs_off_in_filetype = flat_file->indices[i] +
size_in_filetype - (sum - flat_file->blocklens[i]);
break;
}
}
/* abs. offset in bytes in the file */
off = fd->disp + (ADIO_Offset) n_filetypes * filetype_extent +
abs_off_in_filetype;
}
#ifdef PROFILE
MPE_Log_event(11, 0, "start seek");
#endif
#ifdef ROMIO_NTFS
{
#ifdef HAVE_INT64
DWORD dwTemp;
dwTemp = ( (DWORD) ( (off >> 32) & (__int64) 0xFFFFFFFF ) );
err = SetFilePointer(fd->fd_sys,
( (DWORD) ( off & (__int64) 0xFFFFFFFF ) ), &dwTemp,
FILE_BEGIN);
#else
err = SetFilePointer(fd->fd_sys, off, NULL, FILE_BEGIN);
#endif
}
#else
err = lseek(fd->fd_sys, off, SEEK_SET);
#endif
#ifdef PROFILE
MPE_Log_event(12, 0, "end seek");
#endif
fd->fp_ind = off;
fd->fp_sys_posn = off;
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(MPI_FILE_NULL, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
return off;
}

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

@ -1,57 +1,53 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_wait.c,v 1.2 2002/10/24 17:00:50 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_ntfs.h"
void ADIOI_NTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
void ADIOI_NTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_READCOMPLETE";
#endif
DWORD ret_val;
DWORD ret_val;
static char myname[] = "ADIOI_NTFS_ReadComplete";
if (*request == ADIO_REQUEST_NULL) {
if (*request == ADIO_REQUEST_NULL)
{
*error_code = MPI_SUCCESS;
return;
}
if ((*request)->queued) {
ret_val = GetOverlappedResult((*request)->fd, (*request)->handle, &(*request)->nbytes, TRUE);
if ((*request)->queued)
{
ret_val = GetOverlappedResult((*request)->fd, (*request)->handle,
&(*request)->nbytes, TRUE);
/*
// Is this a busy wait on the aio handle?
do {
err = aio_suspend((const aiocb_t **) &((*request)->handle), 1, 0);
} while ((err == -1) && (errno == EINTR));
//*/
if (!ret_val)
(*request)->nbytes = -1;
if (!ret_val)
(*request)->nbytes = -1;
#ifdef PRINT_ERR_MSG
*error_code = (ret_val == FALSE) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (ret_val == FALSE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error((*request)->fd, *error_code, myname);
/* --BEGIN ERROR HANDLING-- */
if (ret_val == FALSE)
{
ret_val = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", ADIOI_NTFS_Strerror(ret_val));
return;
}
else *error_code = MPI_SUCCESS;
#endif
}
else *error_code = MPI_SUCCESS;
/* --END ERROR HANDLING-- */
} /* if ((*request)->queued) ... */
*error_code = MPI_SUCCESS;
#ifdef HAVE_STATUS_SET_BYTES
if ((*request)->nbytes != -1)
{
MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
}
#endif
if ((*request)->queued != -1) {
if ((*request)->queued != -1)
{
/* queued = -1 is an internal hack used when the request must
be completed, but the request object should not be
freed. This is used in ADIOI_Complete_async, because the user
@ -67,17 +63,26 @@ void ADIOI_NTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *er
(*request)->fd->async_count--;
if ((*request)->handle)
{
CloseHandle(((OVERLAPPED*)((*request)->handle))->hEvent);
ADIOI_Free((*request)->handle);
CloseHandle(((OVERLAPPED*)((*request)->handle))->hEvent);
ADIOI_Free((*request)->handle);
}
ADIOI_Free_request((ADIOI_Req_node *) (*request));
*request = ADIO_REQUEST_NULL;
}
}
void ADIOI_NTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
void ADIOI_NTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
static char myname[] = "ADIOI_NTFS_WriteComplete";
ADIOI_NTFS_ReadComplete(request, status, error_code);
/* --BEGIN ERROR HANDLING-- */
if (*error_code != MPI_SUCCESS)
{
*error_code = MPIO_Err_create_code(*error_code,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io", 0);
}
/* --END ERROR HANDLING-- */
}

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

@ -1,18 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_wrcoll.c,v 1.2 2002/10/24 17:00:50 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_ntfs.h"
void ADIOI_NTFS_WriteStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_WriteStridedColl(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,81 +1,194 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_ntfs_write.c,v 1.4 2002/11/13 13:30:36 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
/* Set the style to c++ since this code will only be compiled with the
Windows C/C++ compiler that accepts C++ style comments and other
constructions */
/* style:c++ header */
#include "ad_ntfs.h"
void ADIOI_NTFS_WriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int *error_code)
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status,
int *error_code)
{
//int rank;
DWORD dwTemp;
DWORD dwNumWritten = 0;
static char myname[] = "ADIOI_NTFS_WriteContig";
LONG dwTemp;
DWORD dwNumWritten = 0;
int err=-1, datatype_size, len;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NTFS_WRITECONTIG";
#endif
OVERLAPPED *pOvl;
MPI_Type_size(datatype, &datatype_size);
len = datatype_size * count;
if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
pOvl = (OVERLAPPED *) ADIOI_Calloc(sizeof(OVERLAPPED), 1);
if (pOvl == NULL)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**nomem", "**nomem %s", "OVERLAPPED");
return;
}
pOvl->hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
if (pOvl->hEvent == NULL)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
ADIOI_Free(pOvl);
return;
}
pOvl->Offset = DWORDLOW(offset);
pOvl->OffsetHigh = DWORDHIGH(offset);
if (file_ptr_type == ADIO_EXPLICIT_OFFSET)
{
if (fd->fp_sys_posn != offset)
{
dwTemp = DWORDHIGH(offset);
SetFilePointer(fd->fd_sys, DWORDLOW(offset), &dwTemp, FILE_BEGIN);
dwTemp = DWORDHIGH(offset);
if (SetFilePointer(fd->fd_sys, DWORDLOW(offset), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
{
err = GetLastError();
if (err != NO_ERROR)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
}
}
err = WriteFile(fd->fd_sys, buf, len, &dwNumWritten, NULL);
//MPI_Comm_rank(MPI_COMM_WORLD, &rank);
//printf("[%d]W(%d,%d)\n", rank, DWORDLOW(offset), dwNumWritten);
err = WriteFile(fd->fd_sys, buf, len, &dwNumWritten, pOvl);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
if (err != ERROR_IO_PENDING)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
}
/* --END ERROR HANDLING-- */
err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumWritten, TRUE);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
/* --END ERROR HANDLING-- */
if (!CloseHandle(pOvl->hEvent))
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
ADIOI_Free(pOvl);
fd->fp_sys_posn = offset + dwNumWritten;
/* individual file pointer not updated */
}
else { /* write from curr. location of ind. file pointer */
else
{
/* write from curr. location of ind. file pointer */
if (fd->fp_sys_posn != fd->fp_ind)
{
dwTemp = DWORDHIGH(fd->fp_ind);
SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_ind), &dwTemp, FILE_BEGIN);
dwTemp = DWORDHIGH(fd->fp_ind);
if (SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_ind), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
{
err = GetLastError();
if (err != NO_ERROR)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
}
}
err = WriteFile(fd->fd_sys, buf, len, &dwNumWritten, NULL);
//MPI_Comm_rank(MPI_COMM_WORLD, &rank);
//printf("[%d]w(%d,%d)\n", rank, DWORDLOW(offset), dwNumWritten);
err = WriteFile(fd->fd_sys, buf, len, &dwNumWritten, pOvl);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
if (err != ERROR_IO_PENDING)
{
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
}
/* --END ERROR HANDLING-- */
err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumWritten, TRUE);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", ADIOI_NTFS_Strerror(err));
CloseHandle(pOvl->hEvent);
ADIOI_Free(pOvl);
return;
}
/* --END ERROR HANDLING-- */
if (!CloseHandle(pOvl->hEvent))
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", ADIOI_NTFS_Strerror(err));
ADIOI_Free(pOvl);
return;
}
ADIOI_Free(pOvl);
fd->fp_ind = fd->fp_ind + dwNumWritten;
fd->fp_sys_posn = fd->fp_ind;
}
#ifdef HAVE_STATUS_SET_BYTES
if (err != FALSE) MPIR_Status_set_bytes(status, datatype, dwNumWritten);
#endif
#ifdef PRINT_ERR_MSG
*error_code = (err == FALSE) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == FALSE) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
if (err != FALSE)
{
MPIR_Status_set_bytes(status, datatype, dwNumWritten);
}
else *error_code = MPI_SUCCESS;
#endif
}
void ADIOI_NTFS_WriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_WriteStrided(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
/* --BEGIN ERROR HANDLING-- */
if (err == FALSE)
{
err = GetLastError();
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", ADIOI_NTFS_Strerror(err));
return;
}
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
}

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

@ -0,0 +1,59 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_ompi_srcdir)/config/Makefile.options
AM_CPPFLAGS = \
-DOMPI_BUILDING=1 \
-I$(top_ompi_srcdir) \
-I$(top_ompi_srcdir)/include \
-I$(top_ompi_builddir)/include \
-I$(top_ompi_srcdir)/opal \
-I$(top_ompi_srcdir)/opal/include \
-I$(top_ompi_srcdir)/orte \
-I$(top_ompi_srcdir)/orte/include \
-I$(top_ompi_srcdir)/ompi \
-I$(top_ompi_srcdir)/ompi/include \
-I$(top_srcdir)/adio/include
# It is unfortunately necessary to make all the filenames in the ROMIO
# distribtion confrom to the MCA prefix name rule -- there is at least
# one or two filename conflicts that potentially create problems when
# merging everything into onelibmpi.
# In developer's copies, we have the real ROMIO files, and sym links
# are made. In distribution tarballs, the sym-linked files turn into
# real files and the original filenames do not appear.
noinst_LTLIBRARIES = libadio_panfs.la
libadio_panfs_la_SOURCES = \
io_romio_ad_panfs.c \
ad_panfs.h \
io_romio_ad_panfs_hints.c \
io_romio_ad_panfs_open.c
#
# Sym link the sources to conform to the MCA prefix name rule
#
dir=$(top_srcdir)/adio/ad_panfs
$(libadio_panfs_la_SOURCES):
if test ! -r $@ ; then \
pname=`echo $@ | cut -b '10-'` ; \
rm -f $@; \
ln -s $(dir)/$$pname $@ ; \
fi

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

@ -0,0 +1,37 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* ad_panfs.c
*
* Copyright (C) 2001 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_panfs.h"
/* adioi.h has the ADIOI_Fns_struct define */
#include "adioi.h"
struct ADIOI_Fns_struct ADIO_PANFS_operations = {
ADIOI_PANFS_Open, /* Open */
ADIOI_GEN_ReadContig, /* ReadContig */
ADIOI_GEN_WriteContig, /* WriteContig */
ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */
ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */
ADIOI_GEN_SeekIndividual, /* SeekIndividual */
ADIOI_GEN_Fcntl, /* Fcntl */
ADIOI_PANFS_SetInfo, /* SetInfo */
ADIOI_GEN_ReadStrided, /* ReadStrided */
ADIOI_GEN_WriteStrided, /* WriteStrided */
ADIOI_GEN_Close, /* Close */
ADIOI_GEN_IreadContig, /* IreadContig */
ADIOI_GEN_IwriteContig, /* IwriteContig */
ADIOI_GEN_IODone, /* ReadDone */
ADIOI_GEN_IODone, /* WriteDone */
ADIOI_GEN_IOComplete, /* ReadComplete */
ADIOI_GEN_IOComplete, /* WriteComplete */
ADIOI_GEN_IreadStrided, /* IreadStrided */
ADIOI_GEN_IwriteStrided, /* IwriteStrided */
ADIOI_GEN_Flush, /* Flush */
ADIOI_GEN_Resize, /* Resize */
ADIOI_GEN_Delete, /* Delete */
};

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

@ -0,0 +1,52 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* ad_panfs.h
*
* Copyright (C) 2001 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#ifndef AD_UNIX_INCLUDE
#define AD_UNIX_INCLUDE
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include "adio.h"
#ifndef NO_AIO
#ifdef AIO_SUN
#include <sys/asynch.h>
#else
#include <aio.h>
#ifdef NEEDS_ADIOCB_T
typedef struct adiocb adiocb_t;
#endif
#endif
#endif
int ADIOI_PANFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
int wr, void *handle);
void ADIOI_PANFS_Open(ADIO_File fd, int *error_code);
void ADIOI_PANFS_IwriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
void ADIOI_PANFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
int ADIOI_PANFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
int ADIOI_PANFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_PANFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_PANFS_WriteComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code);
void ADIOI_PANFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
*error_code);
void ADIOI_PANFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
#endif

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

@ -0,0 +1,143 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* ad_panfs_hints.c
*
* Copyright (C) 2001 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_panfs.h"
#include <pan_fs_client_cw_mode.h>
void ADIOI_PANFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
{
static char myname[] = "ADIOI_PANFS_SETINFO";
char* value;
int flag, tmp_val = -1;
unsigned long int concurrent_write = 0;
pan_fs_client_layout_agg_type_t layout_type = PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT;
unsigned long int layout_stripe_unit = 0;
unsigned long int layout_parity_stripe_width = 0;
unsigned long int layout_parity_stripe_depth = 0;
unsigned long int layout_total_num_comps = 0;
pan_fs_client_layout_visit_t layout_visit_policy = PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN;
int gen_error_code;
*error_code = MPI_SUCCESS;
if (fd->info == MPI_INFO_NULL) {
/* This must be part of the open call. can set striping parameters
* if necessary.
*/
MPI_Info_create(&(fd->info));
/* has user specified striping parameters
and do they have the same value on all processes? */
if (users_info != MPI_INFO_NULL) {
value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
MPI_Info_get(users_info, "panfs_concurrent_write", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
concurrent_write = strtoul(value,NULL,10);
tmp_val = concurrent_write;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
if (tmp_val != concurrent_write) {
FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_concurrent_write\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
MPI_Info_set(fd->info, "panfs_concurrent_write", value);
}
MPI_Info_get(users_info, "panfs_layout_type", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
layout_type = strtoul(value,NULL,10);
tmp_val = layout_type;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
if (tmp_val != layout_type) {
FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_type\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
MPI_Info_set(fd->info, "panfs_layout_type", value);
}
MPI_Info_get(users_info, "panfs_layout_stripe_unit", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
layout_stripe_unit = strtoul(value,NULL,10);
tmp_val = layout_stripe_unit;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
if (tmp_val != layout_stripe_unit) {
FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_stripe_unit\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
MPI_Info_set(fd->info, "panfs_layout_stripe_unit", value);
}
MPI_Info_get(users_info, "panfs_layout_parity_stripe_width", MPI_MAX_INFO_VAL,
value, &flag);
if (flag && (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE)) {
layout_parity_stripe_width = strtoul(value,NULL,10);
tmp_val = layout_parity_stripe_width;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
if (tmp_val != layout_parity_stripe_width) {
FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_parity_stripe_width\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
MPI_Info_set(fd->info, "panfs_layout_parity_stripe_width", value);
}
MPI_Info_get(users_info, "panfs_layout_parity_stripe_depth", MPI_MAX_INFO_VAL,
value, &flag);
if (flag && (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE)) {
layout_parity_stripe_depth = strtoul(value,NULL,10);
tmp_val = layout_parity_stripe_depth;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
if (tmp_val != layout_parity_stripe_depth) {
FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_parity_stripe_depth\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
MPI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", value);
}
MPI_Info_get(users_info, "panfs_layout_total_num_comps", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
layout_total_num_comps = strtoul(value,NULL,10);
tmp_val = layout_total_num_comps;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
if (tmp_val != layout_total_num_comps) {
FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_total_num_comps\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
MPI_Info_set(fd->info, "panfs_layout_total_num_comps", value);
}
MPI_Info_get(users_info, "panfs_layout_visit_policy", MPI_MAX_INFO_VAL,
value, &flag);
if (flag && (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE)) {
layout_visit_policy = strtoul(value,NULL,10);
tmp_val = layout_visit_policy;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
if (tmp_val != layout_visit_policy) {
FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_visit_policy\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
MPI_Info_set(fd->info, "panfs_layout_visit_policy", value);
}
ADIOI_Free(value);
}
}
ADIOI_GEN_SetInfo(fd, users_info, &gen_error_code);
/* If this function is successful, use the error code returned from ADIOI_GEN_SetInfo
* otherwise use the error_code generated by this function
*/
if(*error_code == MPI_SUCCESS)
{
*error_code = gen_error_code;
}
}

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

@ -0,0 +1,337 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* ad_panfs_open.c
*
* Copyright (C) 2001 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_panfs.h"
#include <string.h>
#include <pan_fs_client_cw_mode.h>
#define TEMP_BUFFER_SIZE 64
void ADIOI_PANFS_Open(ADIO_File fd, int *error_code)
{
char* value;
int perm, old_mask, amode, flag;
static char myname[] = "ADIOI_PANFS_OPEN";
if (fd->perm == ADIO_PERM_NULL) {
old_mask = umask(022);
umask(old_mask);
perm = ~old_mask & 0666;
}
else perm = fd->perm;
amode = 0;
if (fd->access_mode & ADIO_CREATE)
{
pan_fs_client_layout_agg_type_t layout_type = PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT;
unsigned long int layout_stripe_unit = 0;
unsigned long int layout_parity_stripe_width = 0;
unsigned long int layout_parity_stripe_depth = 0;
unsigned long int layout_total_num_comps = 0;
pan_fs_client_layout_visit_t layout_visit_policy = PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN;
*error_code = MPI_SUCCESS;
value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
MPI_Info_get(fd->info, "panfs_layout_type", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
layout_type = strtoul(value,NULL,10);
}
MPI_Info_get(fd->info, "panfs_layout_stripe_unit", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
layout_stripe_unit = strtoul(value,NULL,10);
}
MPI_Info_get(fd->info, "panfs_layout_total_num_comps", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
layout_total_num_comps = strtoul(value,NULL,10);
}
MPI_Info_get(fd->info, "panfs_layout_parity_stripe_width", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
layout_parity_stripe_width = strtoul(value,NULL,10);
}
MPI_Info_get(fd->info, "panfs_layout_parity_stripe_depth", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
layout_parity_stripe_depth = strtoul(value,NULL,10);
}
MPI_Info_get(fd->info, "panfs_layout_visit_policy", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
layout_visit_policy = strtoul(value,NULL,10);
}
ADIOI_Free(value);
amode = amode | O_CREAT;
/* Check for valid set of hints */
if ((layout_type < PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT) ||
(layout_type > PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE))
{
FPRINTF(stderr, "%s: panfs_layout_type is not a valid value: %u.\n", myname, layout_type);
MPI_Abort(MPI_COMM_WORLD, 1);
}
if ((layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0) &&
((layout_stripe_unit == 0) || (layout_total_num_comps == 0)))
{
if(layout_stripe_unit == 0)
{
FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_stripe_unit hint which is necessary to specify a valid RAID0 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname);
}
if(layout_total_num_comps == 0)
{
FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_total_num_comps hint which is necessary to specify a valid RAID0 layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname);
}
MPI_Abort(MPI_COMM_WORLD, 1);
}
if (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE)
{
if ((layout_stripe_unit == 0) ||
(layout_parity_stripe_width == 0) ||
(layout_parity_stripe_depth == 0) ||
(layout_total_num_comps == 0))
{
if(layout_stripe_unit == 0)
{
FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_stripe_unit hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname);
}
if(layout_total_num_comps == 0)
{
FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_total_num_comps hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname);
}
if(layout_parity_stripe_width == 0)
{
FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_parity_stripe_width hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname);
}
if(layout_parity_stripe_depth == 0)
{
FPRINTF(stderr, "%s: MPI_Info does not contain the panfs_layout_parity_stripe_depth hint which is necessary to specify a valid RAID5 parity stripe layout to the PAN_FS_CLIENT_LAYOUT_CREATE_FILE ioctl.\n", myname);
}
MPI_Abort(MPI_COMM_WORLD, 1);
}
if ((layout_visit_policy < PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN) ||
(layout_visit_policy > PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN_WITH_HASHED_OFFSET))
{
FPRINTF(stderr, "%s: panfs_layout_visit_policy is not a valid value: %u.\n", myname, layout_visit_policy);
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
if ((layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0) ||
(layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE))
{
int myrank;
MPI_Comm_rank(fd->comm, &myrank);
if (myrank == 0) {
pan_fs_client_layout_create_args_t file_create_args;
int fd_dir;
char* slash;
struct stat stat_buf;
int err;
char *value, *path, *file_name_ptr;
/* Check that the file does not exist before
* trying to create it. The ioctl itself should
* be able to handle this condition. Currently,
* the ioctl will return successfully if the file
* has been previously created. Filed bug 33862
* to track the problem.
*/
err = stat(fd->filename,&stat_buf);
if((err == -1) && (errno != ENOENT))
{
FPRINTF(stderr,"%s: Unexpected I/O Error calling stat() on PanFS file: %s.\n", myname, strerror(errno));
MPI_Abort(MPI_COMM_WORLD, 1);
}
else if (err == 0)
{
FPRINTF(stderr,"%s: Cannot create PanFS file with ioctl when file already exists.\n", myname);
MPI_Abort(MPI_COMM_WORLD, 1);
}
else
{
/* (err == -1) && (errno == ENOENT) */
/* File does not exist */
path = ADIOI_Strdup(fd->filename);
slash = strrchr(path, '/');
if (!slash)
ADIOI_Strncpy(path, ".", 2);
else {
if (slash == path)
*(path + 1) = '\0';
else *slash = '\0';
}
/* create PanFS object */
bzero(&file_create_args,sizeof(pan_fs_client_layout_create_args_t));
/* open directory */
fd_dir = open(path, O_RDONLY);
if (fd_dir < 0) {
FPRINTF(stderr, "%s: I/O Error opening parent directory to create PanFS file using ioctl: %s.\n", myname, strerror(errno));
MPI_Abort(MPI_COMM_WORLD, 1);
}
else
{
char *file_name_ptr = fd->filename;
slash = strrchr(fd->filename, '/');
if (slash)
{
file_name_ptr = slash + 1;
}
/* create file in the directory */
file_create_args.mode = perm;
file_create_args.version = PAN_FS_CLIENT_LAYOUT_VERSION;
file_create_args.flags = PAN_FS_CLIENT_LAYOUT_CREATE_F__NONE;
ADIOI_Strncpy(file_create_args.filename, file_name_ptr, strlen(fd->filename)+1);
file_create_args.layout.agg_type = layout_type;
file_create_args.layout.layout_is_valid = 1;
if(layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE)
{
file_create_args.layout.u.raid1_5_parity_stripe.total_num_comps = layout_total_num_comps;
file_create_args.layout.u.raid1_5_parity_stripe.parity_stripe_width = layout_parity_stripe_width;
file_create_args.layout.u.raid1_5_parity_stripe.parity_stripe_depth = layout_parity_stripe_depth;
file_create_args.layout.u.raid1_5_parity_stripe.stripe_unit = layout_stripe_unit;
file_create_args.layout.u.raid1_5_parity_stripe.layout_visit_policy = layout_visit_policy;
}
else if(layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0)
{
file_create_args.layout.u.raid0.total_num_comps = layout_total_num_comps;
file_create_args.layout.u.raid0.stripe_unit = layout_stripe_unit;
}
err = ioctl(fd_dir, PAN_FS_CLIENT_LAYOUT_CREATE_FILE, &file_create_args);
if (err < 0) {
FPRINTF(stderr, "%s: I/O Error doing ioctl on parent directory to create PanFS file using ioctl: %s.\n", myname, strerror(errno));
MPI_Abort(MPI_COMM_WORLD, 1);
}
err = close(fd_dir);
}
ADIOI_Free(path);
}
}
MPI_Barrier(fd->comm);
}
}
if (fd->access_mode & ADIO_RDONLY)
amode = amode | O_RDONLY;
if (fd->access_mode & ADIO_WRONLY)
amode = amode | O_WRONLY;
if (fd->access_mode & ADIO_RDWR)
amode = amode | O_RDWR;
if (fd->access_mode & ADIO_EXCL)
amode = amode | O_EXCL;
value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
MPI_Info_get(fd->info, "panfs_concurrent_write", MPI_MAX_INFO_VAL,
value, &flag);
if (flag) {
unsigned long int concurrent_write = strtoul(value,NULL,10);
if(concurrent_write == 1)
{
amode = amode | O_CONCURRENT_WRITE;
}
}
ADIOI_Free(value);
fd->fd_sys = open(fd->filename, amode, perm);
fd->fd_direct = -1;
if (fd->fd_sys != -1)
{
int rc;
char temp_buffer[TEMP_BUFFER_SIZE];
pan_fs_client_layout_query_args_t file_query_args;
bzero(&file_query_args,sizeof(pan_fs_client_layout_query_args_t));
file_query_args.version = PAN_FS_CLIENT_LAYOUT_VERSION;
rc = ioctl(fd->fd_sys, PAN_FS_CLIENT_LAYOUT_QUERY_FILE, &file_query_args);
if (rc < 0)
{
/* Error - set layout type to unknown */
MPI_Info_set(fd->info, "panfs_layout_type", "PAN_FS_CLIENT_LAYOUT_TYPE__INVALID");
}
else
{
ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.agg_type);
MPI_Info_set(fd->info, "panfs_layout_type", temp_buffer);
if (file_query_args.layout.layout_is_valid == 1)
{
switch (file_query_args.layout.agg_type)
{
case PAN_FS_CLIENT_LAYOUT_TYPE__RAID0:
ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid0.stripe_unit);
MPI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer);
ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid0.total_num_comps);
MPI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer);
break;
case PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE:
ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.stripe_unit);
MPI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer);
ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.parity_stripe_width);
MPI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer);
ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.parity_stripe_depth);
MPI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer);
ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.total_num_comps);
MPI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer);
ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.layout_visit_policy);
MPI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer);
break;
}
}
}
}
if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND))
fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
if (fd->fd_sys == -1) {
if (errno == ENAMETOOLONG)
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_BAD_FILE,
"**filenamelong",
"**filenamelong %s %d",
fd->filename,
strlen(fd->filename));
else if (errno == ENOENT)
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_NO_SUCH_FILE,
"**filenoexist",
"**filenoexist %s",
fd->filename);
else if (errno == ENOTDIR || errno == ELOOP)
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_BAD_FILE,
"**filenamedir",
"**filenamedir %s",
fd->filename);
else if (errno == EACCES) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_ACCESS,
"**fileaccess",
"**fileaccess %s",
fd->filename );
}
else if (errno == EROFS) {
/* Read only file or file system and write access requested */
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_READ_ONLY,
"**ioneedrd", 0 );
}
else {
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
}
else *error_code = MPI_SUCCESS;
}

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

@ -43,7 +43,6 @@ AM_CPPFLAGS = \
noinst_LTLIBRARIES = libadio_pfs.la
libadio_pfs_la_SOURCES = \
io_romio_ad_pfs.c \
io_romio_ad_pfs_close.c \
io_romio_ad_pfs_done.c \
io_romio_ad_pfs_fcntl.c \
io_romio_ad_pfs_flush.c \
@ -52,12 +51,8 @@ libadio_pfs_la_SOURCES = \
io_romio_ad_pfs_iread.c \
io_romio_ad_pfs_iwrite.c \
io_romio_ad_pfs_open.c \
io_romio_ad_pfs_rdcoll.c \
io_romio_ad_pfs_read.c \
io_romio_ad_pfs_resize.c \
io_romio_ad_pfs_seek.c \
io_romio_ad_pfs_wait.c \
io_romio_ad_pfs_wrcoll.c \
io_romio_ad_pfs_write.c
#

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs.c,v 1.3 2002/10/24 17:00:50 gropp Exp $
*
* Copyright (C) 2001 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -17,21 +16,21 @@ struct ADIOI_Fns_struct ADIO_PFS_operations = {
ADIOI_PFS_WriteContig, /* WriteContig */
ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */
ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */
ADIOI_PFS_SeekIndividual, /* SeekIndividual */
ADIOI_GEN_SeekIndividual, /* SeekIndividual */
ADIOI_PFS_Fcntl, /* Fcntl */
ADIOI_PFS_SetInfo, /* SetInfo */
ADIOI_GEN_ReadStrided, /* ReadStrided */
ADIOI_GEN_WriteStrided, /* WriteStrided */
ADIOI_PFS_Close, /* Close */
ADIOI_GEN_Close, /* Close */
ADIOI_PFS_IreadContig, /* IreadContig */
ADIOI_PFS_IwriteContig, /* IwriteContig */
ADIOI_PFS_ReadDone, /* ReadDone */
ADIOI_PFS_WriteDone, /* WriteDone */
ADIOI_PFS_ReadComplete, /* ReadComplete */
ADIOI_PFS_WriteComplete, /* WriteComplete */
ADIOI_PFS_IreadStrided, /* IreadStrided */
ADIOI_PFS_IwriteStrided, /* IwriteStrided */
ADIOI_FAKE_IreadStrided, /* IreadStrided */
ADIOI_FAKE_IwriteStrided, /* IwriteStrided */
ADIOI_PFS_Flush, /* Flush */
ADIOI_PFS_Resize, /* Resize */
ADIOI_GEN_Resize, /* Resize */
ADIOI_GEN_Delete, /* Delete */
};

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs.h,v 1.6 2002/10/24 17:00:50 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -24,4 +23,40 @@
#define _gopen(n,m,i,p) open(n,m,p)
#endif
/* PFS file-pointer modes (removed most of them because they are unused) */
#ifndef M_ASYNC
#define M_UNIX 0
#define M_ASYNC 5
#endif
void ADIOI_PFS_Open(ADIO_File fd, int *error_code);
void ADIOI_PFS_ReadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_PFS_WriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_PFS_IwriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
void ADIOI_PFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code);
int ADIOI_PFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
int ADIOI_PFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_PFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int
*error_code);
void ADIOI_PFS_WriteComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code);
void ADIOI_PFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
*error_code);
void ADIOI_PFS_Flush(ADIO_File fd, int *error_code);
void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
#endif

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

@ -1,38 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_close.c,v 1.5 2002/10/24 17:00:51 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_pfs.h"
#ifdef PROFILE
#include "mpe.h"
#endif
void ADIOI_PFS_Close(ADIO_File fd, int *error_code)
{
int err;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_CLOSE";
#endif
#ifdef PROFILE
MPE_Log_event(9, 0, "start close");
#endif
err = close(fd->fd_sys);
#ifdef PROFILE
MPE_Log_event(10, 0, "end close");
#endif
#ifdef PRINT_ERR_MSG
*error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_done.c,v 1.6 2002/10/24 17:00:51 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -8,12 +7,11 @@
#include "ad_pfs.h"
int ADIOI_PFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
int ADIOI_PFS_ReadDone(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
int done=0;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_READDONE";
#endif
if (*request == ADIO_REQUEST_NULL) {
*error_code = MPI_SUCCESS;
@ -41,21 +39,19 @@ int ADIOI_PFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_co
*request = ADIO_REQUEST_NULL;
}
#ifdef PRINT_ERR_MSG
*error_code = (done == -1 && errno != 0) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (done == -1 && errno != 0) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error((*request)->fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
return done;
}
int ADIOI_PFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
int ADIOI_PFS_WriteDone(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
return ADIOI_PFS_ReadDone(request, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_fcntl.c,v 1.5 2002/10/24 17:00:51 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -9,76 +8,14 @@
#include "ad_pfs.h"
#include "adio_extern.h"
void ADIOI_PFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code)
void ADIOI_PFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct,
int *error_code)
{
MPI_Datatype copy_etype, copy_filetype;
int combiner, i, j, k, filetype_is_contig, err;
ADIOI_Flatlist_node *flat_file;
int i, err;
int iomod, np_total, np_comm;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_FCNTL";
#endif
switch(flag) {
case ADIO_FCNTL_SET_VIEW:
/* free copies of old etypes and filetypes and delete flattened
version of filetype if necessary */
MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype));
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (!filetype_is_contig) ADIOI_Delete_flattened(fd->filetype);
MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner);
if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype));
/* set new info */
ADIO_SetInfo(fd, fcntl_struct->info, &err);
/* set new etypes and filetypes */
MPI_Type_get_envelope(fcntl_struct->etype, &i, &j, &k, &combiner);
if (combiner == MPI_COMBINER_NAMED) fd->etype = fcntl_struct->etype;
else {
MPI_Type_contiguous(1, fcntl_struct->etype, &copy_etype);
MPI_Type_commit(&copy_etype);
fd->etype = copy_etype;
}
MPI_Type_get_envelope(fcntl_struct->filetype, &i, &j, &k, &combiner);
if (combiner == MPI_COMBINER_NAMED)
fd->filetype = fcntl_struct->filetype;
else {
MPI_Type_contiguous(1, fcntl_struct->filetype, &copy_filetype);
MPI_Type_commit(&copy_filetype);
fd->filetype = copy_filetype;
ADIOI_Flatten_datatype(fd->filetype);
/* this function will not flatten the filetype if it turns out
to be all contiguous. */
}
MPI_Type_size(fd->etype, &(fd->etype_size));
fd->disp = fcntl_struct->disp;
/* reset MPI-IO file pointer to point to the first byte that can
be accessed in this view. */
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
if (filetype_is_contig) fd->fp_ind = fcntl_struct->disp;
else {
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype)
flat_file = flat_file->next;
for (i=0; i<flat_file->count; i++) {
if (flat_file->blocklens[i]) {
fd->fp_ind = fcntl_struct->disp + flat_file->indices[i];
break;
}
}
}
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_GET_FSIZE:
if (!(fd->atomicity)) {
/* in M_ASYNC mode, all processes are not aware of changes
@ -101,27 +38,13 @@ void ADIOI_PFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *er
case ADIO_FCNTL_SET_DISKSPACE:
err = _lsize(fd->fd_sys, fcntl_struct->diskspace, SEEK_SET);
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS ;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
break;
case ADIO_FCNTL_SET_IOMODE:
/* for implementing PFS I/O modes. will not occur in MPI-IO
implementation.*/
if (fd->iomode != fcntl_struct->iomode) {
fd->iomode = fcntl_struct->iomode;
setiomode(fd->fd_sys, iomode);
/* for some unknown reason, the compiler gives a warning here */
}
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_ATOMICITY:
@ -136,20 +59,23 @@ void ADIOI_PFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *er
gopen is also global. */
fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS ;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
/* --BEGIN ERROR HANDLING-- */
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
/* --END ERROR HANDLING-- */
}
else *error_code = MPI_SUCCESS;
#endif
break;
default:
FPRINTF(stderr, "Unknown flag passed to ADIOI_PFS_Fcntl\n");
MPI_Abort(MPI_COMM_WORLD, 1);
/* --BEGIN ERROR HANDLING-- */
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPI_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_ARG,
"**flag", "**flag %d", flag);
return;
/* --END ERROR HANDLING-- */
}
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_flush.c,v 1.6 2002/10/24 17:00:51 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -11,23 +10,18 @@
void ADIOI_PFS_Flush(ADIO_File fd, int *error_code)
{
int err, np_total, np_comm;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_FLUSH";
#endif
/* fsync is not actually needed in PFS, because it uses something
called fast-path I/O. However, it doesn't do any harm either. */
err = fsync(fd->fd_sys);
#ifdef PRINT_ERR_MSG
*error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
/* MPI-IO requires that after an fsync all processes must see the same
file size. In PFS M_ASYNC mode, this doesn't automatically happen.

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_hints.c,v 1.4 2002/10/24 17:00:51 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -15,7 +14,7 @@ void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
struct sattr attr;
int err, myrank, fd_sys, perm, amode, old_mask;
if (!(fd->info)) {
if ( (fd->info) == MPI_INFO_NULL) {
/* This must be part of the open call. can set striping parameters
if necessary. */
MPI_Info_create(&(fd->info));
@ -31,10 +30,14 @@ void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
str_factor=atoi(value);
tmp_val = str_factor;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
/* --BEGIN ERROR HANDLING-- */
if (tmp_val != str_factor) {
FPRINTF(stderr, "ADIOI_PFS_SetInfo: the value for key \"striping_factor\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
"striping_factor",
error_code);
return;
}
/* --END ERROR HANDLING-- */
}
MPI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
@ -43,10 +46,14 @@ void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
str_unit=atoi(value);
tmp_val = str_unit;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
/* --BEGIN ERROR HANDLING-- */
if (tmp_val != str_unit) {
FPRINTF(stderr, "ADIOI_PFS_SetInfo: the value for key \"striping_unit\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
"striping_unit",
error_code);
return;
}
/* --END ERROR HANDLING-- */
}
MPI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL,
@ -55,10 +62,14 @@ void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
start_iodev=atoi(value);
tmp_val = start_iodev;
MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
/* --BEGIN ERROR HANDLING-- */
if (tmp_val != start_iodev) {
FPRINTF(stderr, "ADIOI_PFS_SetInfo: the value for key \"start_iodevice\" must be the same on all processes\n");
MPI_Abort(MPI_COMM_WORLD, 1);
MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
"start_iodevice",
error_code);
return;
}
/* --END ERROR HANDLING-- */
}
/* if user has specified striping info, process 0 tries to set it */

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_iread.c,v 1.5 2002/10/24 17:00:52 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -9,15 +8,14 @@
#include "ad_pfs.h"
void ADIOI_PFS_IreadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int *error_code)
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request,
int *error_code)
{
long *id_sys;
int len, typesize, err=-1;
ADIO_Offset off;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_IREADCONTIG";
#endif
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_READ;
@ -41,33 +39,26 @@ void ADIOI_PFS_IreadContig(ADIO_File fd, void *buf, int count,
/* exceeded the max. no. of outstanding requests. */
/* complete all previous async. requests */
ADIOI_Complete_async(&err);
ADIOI_Complete_async(error_code);
if (*error_code != MPI_SUCCESS) return;
/* try again */
*id_sys = _iread(fd->fd_sys, buf, len);
if ((*id_sys == -1) && (errno == EQNOMID)) {
#ifdef PRINT_ERR_MSG
FPRINTF(stderr, "Error in asynchronous I/O\n");
MPI_Abort(MPI_COMM_WORLD, 1);
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
return;
#endif
}
}
else if (*id_sys == -1) {
#ifdef PRINT_ERR_MSG
FPRINTF(stderr, "Unknown errno %d in ADIOI_PFS_IreadContig\n", errno);
MPI_Abort(MPI_COMM_WORLD, 1);
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
return;
#endif
}
if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
@ -79,46 +70,11 @@ void ADIOI_PFS_IreadContig(ADIO_File fd, void *buf, int count,
fd->fp_sys_posn = -1; /* set it to null. */
#ifdef PRINT_ERR_MSG
*error_code = (*id_sys == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (*id_sys == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
void ADIOI_PFS_IreadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code)
{
ADIO_Status status;
#ifdef HAVE_STATUS_SET_BYTES
int typesize;
#endif
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_READ;
(*request)->fd = fd;
(*request)->datatype = datatype;
(*request)->queued = 0;
(*request)->handle = 0;
/* call the blocking version. It is faster because it does data sieving. */
ADIOI_PFS_ReadStrided(fd, buf, count, datatype, file_ptr_type,
offset, &status, error_code);
fd->async_count++;
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Type_size(datatype, &typesize);
(*request)->nbytes = count * typesize;
}
#endif
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_iwrite.c,v 1.6 2002/10/24 17:00:52 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -15,9 +14,7 @@ void ADIOI_PFS_IwriteContig(ADIO_File fd, void *buf, int count,
long *id_sys;
ADIO_Offset off;
int len, typesize, err;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_IWRITECONTIG";
#endif
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_WRITE;
@ -41,33 +38,26 @@ void ADIOI_PFS_IwriteContig(ADIO_File fd, void *buf, int count,
/* exceeded the max. no. of outstanding requests. */
/* complete all previous async. requests */
ADIOI_Complete_async(&err);
ADIOI_Complete_async(error_code);
if (error_code != MPI_SUCCESS) return;
/* try again */
*id_sys = _iwrite(fd->fd_sys, buf, len);
if ((*id_sys == -1) && (errno == EQNOMID)) {
#ifdef PRINT_ERR_MSG
FPRINTF(stderr, "Error in asynchronous I/O\n");
MPI_Abort(MPI_COMM_WORLD, 1);
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
return;
#endif
}
}
else if (*id_sys == -1) {
#ifdef PRINT_ERR_MSG
FPRINTF(stderr, "Unknown errno %d in ADIOI_PFS_IwriteContig\n", errno);
MPI_Abort(MPI_COMM_WORLD, 1);
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
return;
#endif
}
if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
@ -79,46 +69,11 @@ void ADIOI_PFS_IwriteContig(ADIO_File fd, void *buf, int count,
fd->fp_sys_posn = -1; /* set it to null. */
#ifdef PRINT_ERR_MSG
*error_code = (*id_sys == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (*id_sys == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
void ADIOI_PFS_IwriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Request *request, int
*error_code)
{
ADIO_Status status;
#ifdef HAVE_STATUS_SET_BYTES
int typesize;
#endif
*request = ADIOI_Malloc_request();
(*request)->optype = ADIOI_WRITE;
(*request)->fd = fd;
(*request)->datatype = datatype;
(*request)->queued = 0;
(*request)->handle = 0;
/* call the blocking version. It is faster because it does data sieving. */
ADIOI_PFS_WriteStrided(fd, buf, count, datatype, file_ptr_type,
offset, &status, error_code);
fd->async_count++;
#ifdef HAVE_STATUS_SET_BYTES
if (*error_code == MPI_SUCCESS) {
MPI_Type_size(datatype, &typesize);
(*request)->nbytes = count * typesize;
}
#endif
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_open.c,v 1.6 2002/10/24 17:00:52 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -16,9 +15,7 @@ void ADIOI_PFS_Open(ADIO_File fd, int *error_code)
int perm, amode, old_mask, np_comm, np_total, err, flag;
char *value;
struct sattr attr;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_OPEN";
#endif
if (fd->perm == ADIO_PERM_NULL) {
old_mask = umask(022);
@ -46,11 +43,12 @@ void ADIOI_PFS_Open(ADIO_File fd, int *error_code)
MPE_Log_event(1, 0, "start open");
#endif
if (np_total == np_comm)
fd->fd_sys = _gopen(fd->filename,amode,fd->iomode,perm);
fd->fd_sys = _gopen(fd->filename, amode, M_ASYNC, perm);
else fd->fd_sys = open(fd->filename, amode, perm);
#ifdef PROFILE
MPE_Log_event(2, 0, "end open");
#endif
fd->fd_direct = -1;
if (fd->fd_sys != -1) {
value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
@ -71,13 +69,13 @@ void ADIOI_PFS_Open(ADIO_File fd, int *error_code)
err = fcntl(fd->fd_sys, F_GETSATTR, &attr);
if (!err) {
sprintf(value, "%d", attr.s_sunitsize);
ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sunitsize);
MPI_Info_set(fd->info, "striping_unit", value);
sprintf(value, "%d", attr.s_sfactor);
ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sfactor);
MPI_Info_set(fd->info, "striping_factor", value);
sprintf(value, "%d", attr.s_start_sdir);
ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_start_sdir);
MPI_Info_set(fd->info, "start_iodevice", value);
}
ADIOI_Free(value);
@ -86,14 +84,11 @@ void ADIOI_PFS_Open(ADIO_File fd, int *error_code)
fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
}
#ifdef PRINT_ERR_MSG
*error_code = (fd->fd_sys == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (fd->fd_sys == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(ADIO_FILE_NULL, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,18 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_rdcoll.c,v 1.3 2002/10/24 17:00:52 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_pfs.h"
void ADIOI_PFS_ReadStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_ReadStridedColl(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_read.c,v 1.6 2002/10/24 17:00:52 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -16,9 +15,7 @@ void ADIOI_PFS_ReadContig(ADIO_File fd, void *buf, int count,
ADIO_Offset offset, ADIO_Status *status, int *error_code)
{
int err=-1, datatype_size, len;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_READCONTIG";
#endif
MPI_Type_size(datatype, &datatype_size);
len = datatype_size * count;
@ -68,24 +65,11 @@ void ADIOI_PFS_ReadContig(ADIO_File fd, void *buf, int count,
if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
#endif
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
void ADIOI_PFS_ReadStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,29 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_resize.c,v 1.5 2002/10/24 17:00:52 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_pfs.h"
void ADIOI_PFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
{
int err;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_RESIZE";
#endif
err = ftruncate(fd->fd_sys, size);
#ifdef PRINT_ERR_MSG
*error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
}
else *error_code = MPI_SUCCESS;
#endif
}

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

@ -1,15 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_seek.c,v 1.3 2002/10/24 17:00:52 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_pfs.h"
ADIO_Offset ADIOI_PFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
int whence, int *error_code)
{
return ADIOI_GEN_SeekIndividual(fd, offset, whence, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_wait.c,v 1.5 2002/10/24 17:00:53 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -8,12 +7,11 @@
#include "ad_pfs.h"
void ADIOI_PFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
void ADIOI_PFS_ReadComplete(ADIO_Request *request, ADIO_Status *status,
int *error_code)
{
int err=0;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_READCOMPLETE";
#endif
if (*request == ADIO_REQUEST_NULL) {
*error_code = MPI_SUCCESS;
@ -22,17 +20,14 @@ void ADIOI_PFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *err
if ((*request)->queued) {
err = _iowait(*((long *) (*request)->handle));
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error((*request)->fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, myname,
__LINE__, MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
} /* if ((*request)->queued) ... */
else *error_code = MPI_SUCCESS;
#ifdef HAVE_STATUS_SET_BYTES
if ((*request)->nbytes != -1)

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

@ -1,18 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_wrcoll.c,v 1.3 2002/10/24 17:00:53 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_pfs.h"
void ADIOI_PFS_WriteStridedColl(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_WriteStridedColl(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -1,6 +1,5 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* $Id: ad_pfs_write.c,v 1.6 2002/10/24 17:00:54 gropp Exp $
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
@ -12,13 +11,12 @@
#endif
void ADIOI_PFS_WriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int *error_code)
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status,
int *error_code)
{
int err=-1, datatype_size, len;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_PFS_WRITECONTIG";
#endif
MPI_Type_size(datatype, &datatype_size);
len = datatype_size * count;
@ -68,24 +66,11 @@ void ADIOI_PFS_WriteContig(ADIO_File fd, void *buf, int count,
if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
#endif
#ifdef PRINT_ERR_MSG
*error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err == -1) {
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
myname, "I/O Error", "%s", strerror(errno));
ADIOI_Error(fd, *error_code, myname);
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io",
"**io %s", strerror(errno));
}
else *error_code = MPI_SUCCESS;
#endif
}
void ADIOI_PFS_WriteStrided(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status, int
*error_code)
{
ADIOI_GEN_WriteStrided(fd, buf, count, datatype, file_ptr_type,
offset, status, error_code);
}

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

@ -31,6 +31,8 @@ AM_CPPFLAGS = \
-I$(top_ompi_srcdir)/ompi/include \
-I$(top_srcdir)/adio/include
EXTRA_DIST = README
# It is unfortunately necessary to make all the filenames in the ROMIO
# distribtion confrom to the MCA prefix name rule -- there is at least
# one or two filename conflicts that potentially create problems when
@ -44,20 +46,10 @@ noinst_LTLIBRARIES = libadio_piofs.la
libadio_piofs_la_SOURCES = \
io_romio_ad_piofs.c \
ad_piofs.h \
io_romio_ad_piofs_close.c \
io_romio_ad_piofs_done.c \
io_romio_ad_piofs_fcntl.c \
io_romio_ad_piofs_flush.c \
io_romio_ad_piofs_hints.c \
io_romio_ad_piofs_iread.c \
io_romio_ad_piofs_iwrite.c \
io_romio_ad_piofs_open.c \
io_romio_ad_piofs_rdcoll.c \
io_romio_ad_piofs_read.c \
io_romio_ad_piofs_resize.c \
io_romio_ad_piofs_seek.c \
io_romio_ad_piofs_wait.c \
io_romio_ad_piofs_wrcoll.c \
io_romio_ad_piofs_write.c
#

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше