From b25d36ce2fb19985ba0494481c2a1e4afe2c7d53 Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Wed, 16 Jan 2019 13:06:52 -0600 Subject: [PATCH] AMPI #952: update ROMIO to MPICH2-1.4.1p1 This is the most recent version of ROMIO that works with AMPI. Newer versions require the external32 data representation. Change-Id: I53ad12d4a988b225aaa8a7e9b9a213d36bc3d7cf --- src/libs/ck-libs/ampi/Makefile | 51 +- src/libs/ck-libs/ampi/romio/.config_params | 37 - src/libs/ck-libs/ampi/romio/Makefile.in | 164 +- src/libs/ck-libs/ampi/romio/README | 117 +- src/libs/ck-libs/ampi/romio/acconfig.h | 54 - src/libs/ck-libs/ampi/romio/aclocal.m4 | 1254 -- .../ck-libs/ampi/romio/adio/ad_bgl/.state-cache | 61 + .../ck-libs/ampi/romio/adio/ad_bgl/Makefile.in | 47 + src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.c | 60 + src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.h | 97 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.c | 966 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.h | 108 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_close.c | 53 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_fcntl.c | 58 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_flush.c | 90 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_getsh.c | 84 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_hints.c | 542 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_open.c | 304 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.c | 109 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.h | 82 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_rdcoll.c | 1195 ++ .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_read.c | 546 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_setsh.c | 68 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_tuning.c | 163 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_tuning.h | 95 + .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_wrcoll.c | 1535 ++ .../ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_write.c | 608 + .../ampi/romio/adio/ad_bglockless/.state-cache | 13 + .../ampi/romio/adio/ad_bglockless/Makefile.in | 49 + .../ampi/romio/adio/ad_bglockless/ad_bglockless.c | 44 + .../ampi/romio/adio/ad_bglockless/ad_bglockless.h | 14 + .../adio/ad_bglockless/ad_bglockless_features.c | 15 + .../ampi/romio/adio/ad_gridftp/.state-cache | 43 + .../ck-libs/ampi/romio/adio/ad_gridftp/Makefile.in | 52 + .../ampi/romio/adio/ad_gridftp/ad_gridftp.c | 37 + .../ampi/romio/adio/ad_gridftp/ad_gridftp.h | 96 + .../ampi/romio/adio/ad_gridftp/ad_gridftp_close.c | 50 + .../ampi/romio/adio/ad_gridftp/ad_gridftp_delete.c | 95 + .../ampi/romio/adio/ad_gridftp/ad_gridftp_fcntl.c | 91 + .../romio/adio/ad_gridftp/ad_gridftp_features.c | 12 + .../ampi/romio/adio/ad_gridftp/ad_gridftp_flush.c | 19 + .../ampi/romio/adio/ad_gridftp/ad_gridftp_hints.c | 68 + .../ampi/romio/adio/ad_gridftp/ad_gridftp_open.c | 343 + .../ampi/romio/adio/ad_gridftp/ad_gridftp_read.c | 467 + .../ampi/romio/adio/ad_gridftp/ad_gridftp_resize.c | 241 + .../ampi/romio/adio/ad_gridftp/ad_gridftp_write.c | 472 + .../ampi/romio/adio/ad_gridftp/globus_routines.c | 36 + .../ck-libs/ampi/romio/adio/ad_hfs/.state-cache | 25 + .../ck-libs/ampi/romio/adio/ad_hfs/Makefile.in | 12 +- src/libs/ck-libs/ampi/romio/adio/ad_hfs/README | 1 + src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.c | 21 +- src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.h | 14 +- .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_close.c | 29 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_done.c | 30 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_fcntl.c | 334 +- .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_flush.c | 14 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_hints.c | 14 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iread.c | 72 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iwrite.c | 71 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_open.c | 19 +- .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_rdcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_read.c | 30 +- .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_resize.c | 12 +- .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_seek.c | 89 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wait.c | 30 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wrcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_write.c | 26 +- .../ck-libs/ampi/romio/adio/ad_lustre/.state-cache | 31 + .../ck-libs/ampi/romio/adio/ad_lustre/Makefile.in | 49 + src/libs/ck-libs/ampi/romio/adio/ad_lustre/README | 55 + .../ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.c | 43 + .../ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.h | 91 + .../romio/adio/ad_lustre/ad_lustre_aggregate.c | 322 + .../ampi/romio/adio/ad_lustre/ad_lustre_fcntl.c | 97 + .../ampi/romio/adio/ad_lustre/ad_lustre_hints.c | 201 + .../ampi/romio/adio/ad_lustre/ad_lustre_open.c | 156 + .../ampi/romio/adio/ad_lustre/ad_lustre_rwcontig.c | 201 + .../ampi/romio/adio/ad_lustre/ad_lustre_wrcoll.c | 954 + .../ampi/romio/adio/ad_lustre/ad_lustre_wrstr.c | 530 + .../ck-libs/ampi/romio/adio/ad_nfs/.state-cache | 49 + .../ck-libs/ampi/romio/adio/ad_nfs/Makefile.in | 58 +- src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.c | 15 +- src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.h | 66 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_close.c | 29 - .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_done.c | 195 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_fcntl.c | 247 +- .../ampi/romio/adio/ad_nfs/ad_nfs_features.c | 17 + .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_flush.c | 14 - .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_getsh.c | 83 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_hints.c | 1 - .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iread.c | 139 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iwrite.c | 483 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_open.c | 74 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_rdcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_read.c | 260 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_resize.c | 36 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_seek.c | 18 - .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_setsh.c | 54 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wait.c | 195 +- .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wrcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_write.c | 358 +- .../ck-libs/ampi/romio/adio/ad_ntfs/.state-cache | 43 + src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.c | 8 +- src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.h | 39 + .../ampi/romio/adio/ad_ntfs/ad_ntfs_close.c | 59 +- .../ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_done.c | 102 +- .../ampi/romio/adio/ad_ntfs/ad_ntfs_fcntl.c | 267 +- .../ampi/romio/adio/ad_ntfs/ad_ntfs_flush.c | 62 +- .../ampi/romio/adio/ad_ntfs/ad_ntfs_hints.c | 14 - .../ampi/romio/adio/ad_ntfs/ad_ntfs_iread.c | 129 +- .../ampi/romio/adio/ad_ntfs/ad_ntfs_iwrite.c | 444 +- .../ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_open.c | 219 +- .../ampi/romio/adio/ad_ntfs/ad_ntfs_rdcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_read.c | 340 +- .../ampi/romio/adio/ad_ntfs/ad_ntfs_resize.c | 83 +- .../ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_seek.c | 117 - .../ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wait.c | 103 +- .../ampi/romio/adio/ad_ntfs/ad_ntfs_wrcoll.c | 18 - .../ampi/romio/adio/ad_ntfs/ad_ntfs_write.c | 303 +- .../ck-libs/ampi/romio/adio/ad_panfs/.state-cache | 25 + .../ck-libs/ampi/romio/adio/ad_panfs/Makefile.in | 66 + .../ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.c | 44 + .../ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.h | 56 + .../ampi/romio/adio/ad_panfs/ad_panfs_hints.c | 143 + .../ampi/romio/adio/ad_panfs/ad_panfs_open.c | 387 + .../ampi/romio/adio/ad_panfs/ad_panfs_read.c | 68 + .../ampi/romio/adio/ad_panfs/ad_panfs_resize.c | 49 + .../ampi/romio/adio/ad_panfs/ad_panfs_write.c | 68 + .../ck-libs/ampi/romio/adio/ad_pfs/.state-cache | 40 + .../ck-libs/ampi/romio/adio/ad_pfs/Makefile.in | 8 +- src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.c | 11 +- src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.h | 37 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_close.c | 38 - .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_done.c | 20 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_fcntl.c | 236 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_flush.c | 14 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_hints.c | 49 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iread.c | 78 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iwrite.c | 73 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_open.c | 42 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_rdcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_read.c | 51 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_resize.c | 29 - .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_seek.c | 15 - .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wait.c | 19 +- .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wrcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_write.c | 56 +- .../ck-libs/ampi/romio/adio/ad_piofs/.state-cache | 28 + .../ck-libs/ampi/romio/adio/ad_piofs/Makefile.in | 12 +- src/libs/ck-libs/ampi/romio/adio/ad_piofs/README | 1 + .../ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.c | 24 +- .../ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.h | 20 +- .../ampi/romio/adio/ad_piofs/ad_piofs_close.c | 38 - .../ampi/romio/adio/ad_piofs/ad_piofs_done.c | 30 - .../ampi/romio/adio/ad_piofs/ad_piofs_fcntl.c | 273 +- .../ampi/romio/adio/ad_piofs/ad_piofs_features.c | 13 + .../ampi/romio/adio/ad_piofs/ad_piofs_flush.c | 14 - .../ampi/romio/adio/ad_piofs/ad_piofs_hints.c | 22 +- .../ampi/romio/adio/ad_piofs/ad_piofs_iread.c | 72 - .../ampi/romio/adio/ad_piofs/ad_piofs_iwrite.c | 71 - .../ampi/romio/adio/ad_piofs/ad_piofs_open.c | 34 +- .../ampi/romio/adio/ad_piofs/ad_piofs_rdcoll.c | 18 - .../ampi/romio/adio/ad_piofs/ad_piofs_read.c | 49 +- .../ampi/romio/adio/ad_piofs/ad_piofs_resize.c | 29 - .../ampi/romio/adio/ad_piofs/ad_piofs_seek.c | 88 - .../ampi/romio/adio/ad_piofs/ad_piofs_wait.c | 30 - .../ampi/romio/adio/ad_piofs/ad_piofs_wrcoll.c | 18 - .../ampi/romio/adio/ad_piofs/ad_piofs_write.c | 85 +- .../ck-libs/ampi/romio/adio/ad_pvfs/.state-cache | 37 + .../ck-libs/ampi/romio/adio/ad_pvfs/Makefile.in | 97 +- src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.c | 22 +- src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.h | 38 +- .../ampi/romio/adio/ad_pvfs/ad_pvfs_close.c | 22 +- .../ampi/romio/adio/ad_pvfs/ad_pvfs_delete.c | 14 +- .../ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_done.c | 30 - .../ampi/romio/adio/ad_pvfs/ad_pvfs_fcntl.c | 248 +- .../ampi/romio/adio/ad_pvfs/ad_pvfs_flush.c | 30 +- .../ampi/romio/adio/ad_pvfs/ad_pvfs_hints.c | 271 +- .../ampi/romio/adio/ad_pvfs/ad_pvfs_iread.c | 71 - .../ampi/romio/adio/ad_pvfs/ad_pvfs_iwrite.c | 70 - .../ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_open.c | 59 +- .../ampi/romio/adio/ad_pvfs/ad_pvfs_rdcoll.c | 20 - .../ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_read.c | 64 +- .../ampi/romio/adio/ad_pvfs/ad_pvfs_resize.c | 27 +- .../ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_seek.c | 91 - .../ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_wait.c | 30 - .../ampi/romio/adio/ad_pvfs/ad_pvfs_wrcoll.c | 20 - .../ampi/romio/adio/ad_pvfs/ad_pvfs_write.c | 299 +- .../ck-libs/ampi/romio/adio/ad_pvfs2/.state-cache | 64 + .../ck-libs/ampi/romio/adio/ad_pvfs2/Makefile.in | 67 + .../ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.c | 42 + .../ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.h | 66 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_aio.c | 219 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_close.c | 28 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.c | 150 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.h | 35 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_delete.c | 69 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_fcntl.c | 59 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_features.c | 16 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_flush.c | 55 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c | 274 + .../ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io.h | 79 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c | 720 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c | 665 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_open.c | 246 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_read.c | 168 + .../adio/ad_pvfs2/ad_pvfs2_read_list_classic.c | 909 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_resize.c | 56 + .../ampi/romio/adio/ad_pvfs2/ad_pvfs2_write.c | 181 + .../adio/ad_pvfs2/ad_pvfs2_write_list_classic.c | 963 + .../ck-libs/ampi/romio/adio/ad_sfs/.state-cache | 19 + .../ck-libs/ampi/romio/adio/ad_sfs/Makefile.in | 12 +- src/libs/ck-libs/ampi/romio/adio/ad_sfs/README | 1 + src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.c | 25 +- src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.h | 6 +- .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_close.c | 29 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_done.c | 30 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_fcntl.c | 252 +- .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_flush.c | 8 +- .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_hints.c | 14 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iread.c | 70 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iwrite.c | 69 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_open.c | 13 +- .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_rdcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_read.c | 63 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_resize.c | 29 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_seek.c | 15 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wait.c | 30 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wrcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_write.c | 62 - .../ck-libs/ampi/romio/adio/ad_testfs/.state-cache | 64 + .../ck-libs/ampi/romio/adio/ad_testfs/Makefile.in | 56 +- .../ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.c | 3 +- .../ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.h | 1 - .../ampi/romio/adio/ad_testfs/ad_testfs_close.c | 1 - .../ampi/romio/adio/ad_testfs/ad_testfs_delete.c | 1 - .../ampi/romio/adio/ad_testfs/ad_testfs_done.c | 103 +- .../ampi/romio/adio/ad_testfs/ad_testfs_fcntl.c | 166 +- .../ampi/romio/adio/ad_testfs/ad_testfs_flush.c | 1 - .../ampi/romio/adio/ad_testfs/ad_testfs_getsh.c | 1 - .../ampi/romio/adio/ad_testfs/ad_testfs_hints.c | 10 +- .../ampi/romio/adio/ad_testfs/ad_testfs_iread.c | 39 +- .../ampi/romio/adio/ad_testfs/ad_testfs_iwrite.c | 36 +- .../ampi/romio/adio/ad_testfs/ad_testfs_open.c | 2 +- .../ampi/romio/adio/ad_testfs/ad_testfs_rdcoll.c | 1 - .../ampi/romio/adio/ad_testfs/ad_testfs_read.c | 10 +- .../ampi/romio/adio/ad_testfs/ad_testfs_resize.c | 1 - .../ampi/romio/adio/ad_testfs/ad_testfs_seek.c | 11 +- .../ampi/romio/adio/ad_testfs/ad_testfs_setsh.c | 1 - .../ampi/romio/adio/ad_testfs/ad_testfs_wait.c | 99 +- .../ampi/romio/adio/ad_testfs/ad_testfs_wrcoll.c | 1 - .../ampi/romio/adio/ad_testfs/ad_testfs_write.c | 10 +- .../ck-libs/ampi/romio/adio/ad_ufs/.state-cache | 13 + .../ck-libs/ampi/romio/adio/ad_ufs/Makefile.in | 95 +- src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.c | 34 +- src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.h | 42 +- .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_close.c | 29 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_done.c | 176 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_fcntl.c | 180 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_flush.c | 14 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_hints.c | 14 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iread.c | 102 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iwrite.c | 264 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_open.c | 73 +- .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_rdcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_read.c | 64 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_resize.c | 29 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_seek.c | 15 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wait.c | 176 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wrcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_write.c | 63 - .../ck-libs/ampi/romio/adio/ad_xfs/.state-cache | 28 + .../ck-libs/ampi/romio/adio/ad_xfs/Makefile.in | 33 +- src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.c | 28 +- src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.h | 31 +- .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_close.c | 31 - .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_done.c | 74 - .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_fcntl.c | 223 +- .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_flush.c | 14 - .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_hints.c | 67 +- .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iread.c | 81 - .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iwrite.c | 148 - .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_open.c | 72 +- .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_rdcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_read.c | 53 +- .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_resize.c | 13 +- .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_seek.c | 74 - .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wait.c | 78 - .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wrcoll.c | 18 - .../ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_write.c | 138 +- .../ck-libs/ampi/romio/adio/ad_zoidfs/.state-cache | 46 + .../ck-libs/ampi/romio/adio/ad_zoidfs/Makefile.in | 52 + .../ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.c | 42 + .../ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.h | 44 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_close.c | 25 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.c | 126 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.h | 43 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_delete.c | 45 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_fcntl.c | 60 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_features.c | 16 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_flush.c | 52 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_io.c | 95 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_open.c | 153 + .../romio/adio/ad_zoidfs/ad_zoidfs_read_list.c | 826 + .../ampi/romio/adio/ad_zoidfs/ad_zoidfs_resize.c | 53 + .../romio/adio/ad_zoidfs/ad_zoidfs_write_list.c | 857 + .../ck-libs/ampi/romio/adio/common/.state-cache | 190 + .../ck-libs/ampi/romio/adio/common/Makefile.in | 77 +- .../ck-libs/ampi/romio/adio/common/ad_aggregate.c | 181 +- .../ampi/romio/adio/common/ad_aggregate_new.c | 284 + src/libs/ck-libs/ampi/romio/adio/common/ad_close.c | 90 +- .../ampi/romio/adio/common/ad_coll_build_req_new.c | 2086 ++ .../ampi/romio/adio/common/ad_coll_exch_new.c | 510 + .../ck-libs/ampi/romio/adio/common/ad_darray.c | 295 + .../ck-libs/ampi/romio/adio/common/ad_delete.c | 15 +- src/libs/ck-libs/ampi/romio/adio/common/ad_done.c | 47 + .../ck-libs/ampi/romio/adio/common/ad_done_fake.c | 20 + src/libs/ck-libs/ampi/romio/adio/common/ad_end.c | 74 +- src/libs/ck-libs/ampi/romio/adio/common/ad_fcntl.c | 64 + .../ck-libs/ampi/romio/adio/common/ad_features.c | 18 + src/libs/ck-libs/ampi/romio/adio/common/ad_flush.c | 21 +- .../ck-libs/ampi/romio/adio/common/ad_fstype.c | 750 +- .../ck-libs/ampi/romio/adio/common/ad_get_sh_fp.c | 23 +- src/libs/ck-libs/ampi/romio/adio/common/ad_hints.c | 421 +- src/libs/ck-libs/ampi/romio/adio/common/ad_init.c | 298 +- .../ck-libs/ampi/romio/adio/common/ad_io_coll.c | 1131 + src/libs/ck-libs/ampi/romio/adio/common/ad_iopen.c | 21 + src/libs/ck-libs/ampi/romio/adio/common/ad_iread.c | 91 + .../ck-libs/ampi/romio/adio/common/ad_iread_fake.c | 61 + .../ck-libs/ampi/romio/adio/common/ad_iwrite.c | 338 + .../ampi/romio/adio/common/ad_iwrite_fake.c | 65 + src/libs/ck-libs/ampi/romio/adio/common/ad_open.c | 295 +- .../ck-libs/ampi/romio/adio/common/ad_opencoll.c | 108 + .../ampi/romio/adio/common/ad_opencoll_failsafe.c | 89 + .../ampi/romio/adio/common/ad_opencoll_scalable.c | 57 + .../ck-libs/ampi/romio/adio/common/ad_prealloc.c | 91 + src/libs/ck-libs/ampi/romio/adio/common/ad_read.c | 91 + .../ck-libs/ampi/romio/adio/common/ad_read_coll.c | 377 +- .../ck-libs/ampi/romio/adio/common/ad_read_str.c | 206 +- .../ampi/romio/adio/common/ad_read_str_naive.c | 79 +- .../ck-libs/ampi/romio/adio/common/ad_resize.c | 40 + src/libs/ck-libs/ampi/romio/adio/common/ad_seek.c | 67 +- .../ck-libs/ampi/romio/adio/common/ad_set_sh_fp.c | 17 +- .../ck-libs/ampi/romio/adio/common/ad_set_view.c | 5 +- .../ck-libs/ampi/romio/adio/common/ad_subarray.c | 98 + src/libs/ck-libs/ampi/romio/adio/common/ad_wait.c | 47 + .../ck-libs/ampi/romio/adio/common/ad_wait_fake.c | 20 + src/libs/ck-libs/ampi/romio/adio/common/ad_write.c | 92 + .../ck-libs/ampi/romio/adio/common/ad_write_coll.c | 491 +- .../ampi/romio/adio/common/ad_write_nolock.c | 406 + .../ck-libs/ampi/romio/adio/common/ad_write_str.c | 280 +- .../ampi/romio/adio/common/ad_write_str_naive.c | 380 + .../ck-libs/ampi/romio/adio/common/adi_close.c | 48 + .../ck-libs/ampi/romio/adio/common/async_list.c | 99 +- .../ck-libs/ampi/romio/adio/common/byte_offset.c | 17 +- .../ampi/romio/adio/common/cb_config_list.c | 97 +- .../ck-libs/ampi/romio/adio/common/eof_offset.c | 20 +- src/libs/ck-libs/ampi/romio/adio/common/error.c | 4 +- src/libs/ck-libs/ampi/romio/adio/common/flatten.c | 607 +- src/libs/ck-libs/ampi/romio/adio/common/gencheck.c | 32 - .../ck-libs/ampi/romio/adio/common/get_fp_posn.c | 21 +- src/libs/ck-libs/ampi/romio/adio/common/greq_fns.c | 31 + .../ck-libs/ampi/romio/adio/common/heap-sort.c | 133 + src/libs/ck-libs/ampi/romio/adio/common/iscontig.c | 38 +- src/libs/ck-libs/ampi/romio/adio/common/lock.c | 197 +- src/libs/ck-libs/ampi/romio/adio/common/malloc.c | 58 +- .../ck-libs/ampi/romio/adio/common/req_malloc.c | 42 +- src/libs/ck-libs/ampi/romio/adio/common/setfn.c | 113 - .../ck-libs/ampi/romio/adio/common/shfp_fname.c | 18 +- .../ck-libs/ampi/romio/adio/common/status_setb.c | 28 +- src/libs/ck-libs/ampi/romio/adio/common/strfns.c | 315 + .../ck-libs/ampi/romio/adio/common/system_hints.c | 190 + .../ck-libs/ampi/romio/adio/include/.state-cache | 37 + .../ampi/romio/adio/include/BaseIOErrMsgs.msg | 2 +- src/libs/ck-libs/ampi/romio/adio/include/adio.h | 176 +- .../ampi/romio/adio/include/adio_cb_config_list.h | 5 +- .../ck-libs/ampi/romio/adio/include/adio_extern.h | 92 +- src/libs/ck-libs/ampi/romio/adio/include/adioi.h | 566 +- .../ck-libs/ampi/romio/adio/include/adioi_errmsg.h | 8 +- .../ck-libs/ampi/romio/adio/include/adioi_error.h | 154 +- .../ampi/romio/adio/include/adioi_fs_proto.h | 679 +- .../ck-libs/ampi/romio/adio/include/heap-sort.h | 22 + .../ck-libs/ampi/romio/adio/include/mpio_error.h | 6 +- src/libs/ck-libs/ampi/romio/adio/include/mpipr.h | 58 +- src/libs/ck-libs/ampi/romio/adio/include/mpisgi2.h | 17 - .../ck-libs/ampi/romio/adio/include/mpiu_greq.h | 15 + .../ck-libs/ampi/romio/adio/include/romioconf.h.in | 467 +- src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpi.h | 713 - src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpif.h | 308 - .../ampi/romio/common/dataloop/.state-cache | 64 + .../ck-libs/ampi/romio/common/dataloop/Makefile.in | 121 + .../ampi/romio/common/dataloop/darray_support.c | 301 + .../ck-libs/ampi/romio/common/dataloop/dataloop.c | 731 + .../ck-libs/ampi/romio/common/dataloop/dataloop.h | 21 + .../ampi/romio/common/dataloop/dataloop_create.c | 387 + .../ampi/romio/common/dataloop/dataloop_create.h | 83 + .../common/dataloop/dataloop_create_blockindexed.c | 325 + .../romio/common/dataloop/dataloop_create_contig.c | 160 + .../common/dataloop/dataloop_create_indexed.c | 429 + .../common/dataloop/dataloop_create_pairtype.c | 82 + .../romio/common/dataloop/dataloop_create_struct.c | 672 + .../romio/common/dataloop/dataloop_create_vector.c | 161 + .../ampi/romio/common/dataloop/dataloop_parts.h | 463 + .../ampi/romio/common/dataloop/romio_dataloop.c | 575 + .../ampi/romio/common/dataloop/romio_dataloop.h | 148 + .../ampi/romio/common/dataloop/romio_segment_ops.c | 482 + .../ck-libs/ampi/romio/common/dataloop/segment.c | 988 + .../ampi/romio/common/dataloop/segment_ops.c | 794 + .../ampi/romio/common/dataloop/subarray_support.c | 99 + .../ampi/romio/common/dataloop/typesize_support.c | 880 + .../ampi/romio/common/dataloop/typesize_support.h | 28 + src/libs/ck-libs/ampi/romio/confdb/aclocal.m4 | 38 + src/libs/ck-libs/ampi/romio/confdb/aclocal_am.m4 | 6 + .../ck-libs/ampi/romio/confdb/aclocal_atomic.m4 | 227 + .../ampi/romio/confdb/aclocal_attr_alias.m4 | 504 + .../ck-libs/ampi/romio/confdb/aclocal_bugfix.m4 | 75 + .../ck-libs/ampi/romio/confdb/aclocal_cache.m4 | 372 + src/libs/ck-libs/ampi/romio/confdb/aclocal_cc.m4 | 1600 ++ src/libs/ck-libs/ampi/romio/confdb/aclocal_cxx.m4 | 175 + src/libs/ck-libs/ampi/romio/confdb/aclocal_f77.m4 | 1412 ++ .../ck-libs/ampi/romio/confdb/aclocal_f77old.m4 | 389 + src/libs/ck-libs/ampi/romio/confdb/aclocal_fc.m4 | 950 + src/libs/ck-libs/ampi/romio/confdb/aclocal_libs.m4 | 81 + src/libs/ck-libs/ampi/romio/confdb/aclocal_make.m4 | 315 + src/libs/ck-libs/ampi/romio/confdb/aclocal_mpi.m4 | 516 + .../ck-libs/ampi/romio/confdb/aclocal_romio.m4 | 835 + .../ck-libs/ampi/romio/confdb/aclocal_runlog.m4 | 252 + src/libs/ck-libs/ampi/romio/confdb/aclocal_shl.m4 | 407 + .../ck-libs/ampi/romio/confdb/aclocal_subcfg.m4 | 137 + src/libs/ck-libs/ampi/romio/confdb/aclocal_util.m4 | 191 + .../ampi/romio/confdb/ax_prefix_config_h.m4 | 219 + src/libs/ck-libs/ampi/romio/confdb/ax_tls.m4 | 74 + src/libs/ck-libs/ampi/romio/confdb/config.guess | 1501 ++ src/libs/ck-libs/ampi/romio/confdb/config.sub | 1705 ++ src/libs/ck-libs/ampi/romio/confdb/depcomp | 630 + src/libs/ck-libs/ampi/romio/confdb/install-sh | 520 + src/libs/ck-libs/ampi/romio/confdb/missing | 376 + src/libs/ck-libs/ampi/romio/configure | 20938 ++++++++++++++----- src/libs/ck-libs/ampi/romio/configure.in | 3730 ++-- src/libs/ck-libs/ampi/romio/configure2.in | 1341 -- src/libs/ck-libs/ampi/romio/doc/Makefile | 11 + src/libs/ck-libs/ampi/romio/doc/README | 35 + src/libs/ck-libs/ampi/romio/doc/makepubpage.sh | 28 + src/libs/ck-libs/ampi/romio/doc/pubs.bib | 465 + src/libs/ck-libs/ampi/romio/doc/romio.bib | 92 + src/libs/ck-libs/ampi/romio/doc/source-guide.tex | 494 + src/libs/ck-libs/ampi/romio/doc/users-guide.pdf | Bin 0 -> 95189 bytes src/libs/ck-libs/ampi/romio/doc/users-guide.tex | 1143 + src/libs/ck-libs/ampi/romio/include/mpio.h.in | 907 +- src/libs/ck-libs/ampi/romio/include/mpiof.h.in | 6 +- src/libs/ck-libs/ampi/romio/localdefs.in | 4 + src/libs/ck-libs/ampi/romio/mpi-io/.state-cache | 217 + src/libs/ck-libs/ampi/romio/mpi-io/Makefile.in | 298 +- src/libs/ck-libs/ampi/romio/mpi-io/close.c | 68 +- src/libs/ck-libs/ampi/romio/mpi-io/delete.c | 69 +- src/libs/ck-libs/ampi/romio/mpi-io/file_c2f.c | 104 +- src/libs/ck-libs/ampi/romio/mpi-io/file_f2c.c | 12 +- .../ck-libs/ampi/romio/mpi-io/fortran/.state-cache | 169 + .../ck-libs/ampi/romio/mpi-io/fortran/Makefile.in | 172 +- .../ck-libs/ampi/romio/mpi-io/fortran/closef.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/deletef.c | 19 +- .../ck-libs/ampi/romio/mpi-io/fortran/fsyncf.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/get_amodef.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/get_atomf.c | 9 +- .../ampi/romio/mpi-io/fortran/get_bytofff.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/get_errhf.c | 9 +- .../ampi/romio/mpi-io/fortran/get_extentf.c | 17 +- .../ck-libs/ampi/romio/mpi-io/fortran/get_groupf.c | 13 +- .../ck-libs/ampi/romio/mpi-io/fortran/get_infof.c | 9 +- .../ampi/romio/mpi-io/fortran/get_posn_shf.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/get_posnf.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/get_sizef.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/get_viewf.c | 33 +- .../ck-libs/ampi/romio/mpi-io/fortran/iotestf.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/iowaitf.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/iread_atf.c | 21 +- .../ck-libs/ampi/romio/mpi-io/fortran/iread_shf.c | 21 +- .../ck-libs/ampi/romio/mpi-io/fortran/ireadf.c | 21 +- .../ck-libs/ampi/romio/mpi-io/fortran/iwrite_atf.c | 21 +- .../ck-libs/ampi/romio/mpi-io/fortran/iwrite_shf.c | 21 +- .../ck-libs/ampi/romio/mpi-io/fortran/iwritef.c | 21 +- src/libs/ck-libs/ampi/romio/mpi-io/fortran/openf.c | 39 +- .../ck-libs/ampi/romio/mpi-io/fortran/preallocf.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/rd_atallbf.c | 15 +- .../ck-libs/ampi/romio/mpi-io/fortran/rd_atallef.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/read_allbf.c | 23 +- .../ck-libs/ampi/romio/mpi-io/fortran/read_allef.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/read_allf.c | 23 +- .../ampi/romio/mpi-io/fortran/read_atallf.c | 23 +- .../ck-libs/ampi/romio/mpi-io/fortran/read_atf.c | 15 +- .../ck-libs/ampi/romio/mpi-io/fortran/read_ordbf.c | 23 +- .../ck-libs/ampi/romio/mpi-io/fortran/read_ordef.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/read_ordf.c | 23 +- .../ck-libs/ampi/romio/mpi-io/fortran/read_shf.c | 23 +- src/libs/ck-libs/ampi/romio/mpi-io/fortran/readf.c | 23 +- .../ck-libs/ampi/romio/mpi-io/fortran/seek_shf.c | 11 +- src/libs/ck-libs/ampi/romio/mpi-io/fortran/seekf.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/set_atomf.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/set_errhf.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/set_infof.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/set_sizef.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/set_viewf.c | 23 +- .../ck-libs/ampi/romio/mpi-io/fortran/wr_atallbf.c | 15 +- .../ck-libs/ampi/romio/mpi-io/fortran/wr_atallef.c | 9 +- .../ampi/romio/mpi-io/fortran/write_allbf.c | 23 +- .../ampi/romio/mpi-io/fortran/write_allef.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/write_allf.c | 21 +- .../ampi/romio/mpi-io/fortran/write_atallf.c | 21 +- .../ck-libs/ampi/romio/mpi-io/fortran/write_atf.c | 21 +- .../ampi/romio/mpi-io/fortran/write_ordbf.c | 21 +- .../ampi/romio/mpi-io/fortran/write_ordef.c | 9 +- .../ck-libs/ampi/romio/mpi-io/fortran/write_ordf.c | 21 +- .../ck-libs/ampi/romio/mpi-io/fortran/write_shf.c | 21 +- .../ck-libs/ampi/romio/mpi-io/fortran/writef.c | 21 +- src/libs/ck-libs/ampi/romio/mpi-io/fsync.c | 37 +- src/libs/ck-libs/ampi/romio/mpi-io/get_amode.c | 25 +- src/libs/ck-libs/ampi/romio/mpi-io/get_atom.c | 21 +- src/libs/ck-libs/ampi/romio/mpi-io/get_bytoff.c | 54 +- src/libs/ck-libs/ampi/romio/mpi-io/get_errh.c | 41 +- src/libs/ck-libs/ampi/romio/mpi-io/get_extent.c | 36 +- src/libs/ck-libs/ampi/romio/mpi-io/get_group.c | 32 +- src/libs/ck-libs/ampi/romio/mpi-io/get_info.c | 31 +- src/libs/ck-libs/ampi/romio/mpi-io/get_posn.c | 33 +- src/libs/ck-libs/ampi/romio/mpi-io/get_posn_sh.c | 49 +- src/libs/ck-libs/ampi/romio/mpi-io/get_size.c | 29 +- src/libs/ck-libs/ampi/romio/mpi-io/get_view.c | 54 +- .../ampi/romio/mpi-io/glue/default/.state-cache | 10 + .../ampi/romio/mpi-io/glue/default/Makefile.in | 52 + .../ampi/romio/mpi-io/glue/default/mpio_err.c | 88 + .../ampi/romio/mpi-io/glue/default/mpio_file.c | 90 + .../ampi/romio/mpi-io/glue/mpich1/.state-cache | 10 + .../ampi/romio/mpi-io/glue/mpich1/Makefile.in | 52 + .../ampi/romio/mpi-io/glue/mpich1/mpio_err.c | 65 + .../ampi/romio/mpi-io/glue/mpich1/mpio_file.c | 94 + .../ampi/romio/mpi-io/glue/mpich2/.state-cache | 10 + .../ampi/romio/mpi-io/glue/mpich2/Makefile.in | 79 + .../ampi/romio/mpi-io/glue/mpich2/mpio_err.c | 113 + .../ampi/romio/mpi-io/glue/mpich2/mpio_file.c | 92 + src/libs/ck-libs/ampi/romio/mpi-io/ioreq_c2f.c | 52 +- src/libs/ck-libs/ampi/romio/mpi-io/ioreq_f2c.c | 35 +- src/libs/ck-libs/ampi/romio/mpi-io/iotest.c | 39 +- src/libs/ck-libs/ampi/romio/mpi-io/iotestall.c | 77 + src/libs/ck-libs/ampi/romio/mpi-io/iotestany.c | 81 + src/libs/ck-libs/ampi/romio/mpi-io/iotestsome.c | 86 + src/libs/ck-libs/ampi/romio/mpi-io/iowait.c | 43 +- src/libs/ck-libs/ampi/romio/mpi-io/iowaitall.c | 74 + src/libs/ck-libs/ampi/romio/mpi-io/iowaitany.c | 84 + src/libs/ck-libs/ampi/romio/mpi-io/iowaitsome.c | 81 + src/libs/ck-libs/ampi/romio/mpi-io/iread.c | 332 +- src/libs/ck-libs/ampi/romio/mpi-io/iread_at.c | 256 +- src/libs/ck-libs/ampi/romio/mpi-io/iread_sh.c | 137 +- src/libs/ck-libs/ampi/romio/mpi-io/iwrite.c | 325 +- src/libs/ck-libs/ampi/romio/mpi-io/iwrite_at.c | 251 +- src/libs/ck-libs/ampi/romio/mpi-io/iwrite_sh.c | 101 +- .../ck-libs/ampi/romio/mpi-io/mpich2_fileutil.c | 60 + src/libs/ck-libs/ampi/romio/mpi-io/mpioimpl.h | 25 +- src/libs/ck-libs/ampi/romio/mpi-io/mpioprof.h | 34 +- src/libs/ck-libs/ampi/romio/mpi-io/mpir-mpioinit.c | 56 + src/libs/ck-libs/ampi/romio/mpi-io/mpiu_greq.c | 49 + src/libs/ck-libs/ampi/romio/mpi-io/open.c | 479 +- src/libs/ck-libs/ampi/romio/mpi-io/prealloc.c | 63 +- src/libs/ck-libs/ampi/romio/mpi-io/rd_atallb.c | 182 +- src/libs/ck-libs/ampi/romio/mpi-io/rd_atalle.c | 31 +- src/libs/ck-libs/ampi/romio/mpi-io/read.c | 326 +- src/libs/ck-libs/ampi/romio/mpi-io/read_all.c | 246 +- src/libs/ck-libs/ampi/romio/mpi-io/read_allb.c | 235 +- src/libs/ck-libs/ampi/romio/mpi-io/read_alle.c | 61 +- src/libs/ck-libs/ampi/romio/mpi-io/read_at.c | 241 +- src/libs/ck-libs/ampi/romio/mpi-io/read_atall.c | 204 +- src/libs/ck-libs/ampi/romio/mpi-io/read_ord.c | 231 +- src/libs/ck-libs/ampi/romio/mpi-io/read_ordb.c | 249 +- src/libs/ck-libs/ampi/romio/mpi-io/read_orde.c | 50 +- src/libs/ck-libs/ampi/romio/mpi-io/read_sh.c | 111 +- .../ck-libs/ampi/romio/mpi-io/register_datarep.c | 135 + src/libs/ck-libs/ampi/romio/mpi-io/seek.c | 119 +- src/libs/ck-libs/ampi/romio/mpi-io/seek_sh.c | 351 +- src/libs/ck-libs/ampi/romio/mpi-io/set_atom.c | 54 +- src/libs/ck-libs/ampi/romio/mpi-io/set_errh.c | 47 +- src/libs/ck-libs/ampi/romio/mpi-io/set_info.c | 30 +- src/libs/ck-libs/ampi/romio/mpi-io/set_size.c | 62 +- src/libs/ck-libs/ampi/romio/mpi-io/set_view.c | 351 +- src/libs/ck-libs/ampi/romio/mpi-io/wr_atallb.c | 179 +- src/libs/ck-libs/ampi/romio/mpi-io/wr_atalle.c | 29 +- src/libs/ck-libs/ampi/romio/mpi-io/write.c | 320 +- src/libs/ck-libs/ampi/romio/mpi-io/write_all.c | 117 +- src/libs/ck-libs/ampi/romio/mpi-io/write_allb.c | 232 +- src/libs/ck-libs/ampi/romio/mpi-io/write_alle.c | 70 +- src/libs/ck-libs/ampi/romio/mpi-io/write_at.c | 230 +- src/libs/ck-libs/ampi/romio/mpi-io/write_atall.c | 193 +- src/libs/ck-libs/ampi/romio/mpi-io/write_ord.c | 109 +- src/libs/ck-libs/ampi/romio/mpi-io/write_ordb.c | 253 +- src/libs/ck-libs/ampi/romio/mpi-io/write_orde.c | 46 +- src/libs/ck-libs/ampi/romio/mpi-io/write_sh.c | 107 +- .../ampi/romio/mpi2-other/array/.state-cache | 10 + .../ampi/romio/mpi2-other/array/Makefile.in | 50 +- .../ck-libs/ampi/romio/mpi2-other/array/darray.c | 599 +- .../romio/mpi2-other/array/fortran/.state-cache | 10 + .../romio/mpi2-other/array/fortran/Makefile.in | 16 +- .../ampi/romio/mpi2-other/array/fortran/darrayf.c | 62 +- .../romio/mpi2-other/array/fortran/subarrayf.c | 59 +- .../ck-libs/ampi/romio/mpi2-other/array/subarray.c | 184 +- .../ampi/romio/mpi2-other/info/.state-cache | 37 + .../ck-libs/ampi/romio/mpi2-other/info/Makefile.in | 69 +- .../romio/mpi2-other/info/fortran/.state-cache | 31 + .../ampi/romio/mpi2-other/info/fortran/Makefile.in | 30 +- .../romio/mpi2-other/info/fortran/info_createf.c | 1 - .../romio/mpi2-other/info/fortran/info_deletef.c | 3 +- .../ampi/romio/mpi2-other/info/fortran/info_dupf.c | 1 - .../romio/mpi2-other/info/fortran/info_freef.c | 1 - .../ampi/romio/mpi2-other/info/fortran/info_getf.c | 5 +- .../romio/mpi2-other/info/fortran/info_getnksf.c | 1 - .../romio/mpi2-other/info/fortran/info_getnthf.c | 5 +- .../romio/mpi2-other/info/fortran/info_getvlnf.c | 3 +- .../ampi/romio/mpi2-other/info/fortran/info_setf.c | 5 +- .../ck-libs/ampi/romio/mpi2-other/info/info_c2f.c | 1 - .../ampi/romio/mpi2-other/info/info_create.c | 33 +- .../ampi/romio/mpi2-other/info/info_delete.c | 5 +- .../ck-libs/ampi/romio/mpi2-other/info/info_dup.c | 5 +- .../ck-libs/ampi/romio/mpi2-other/info/info_f2c.c | 1 - .../ck-libs/ampi/romio/mpi2-other/info/info_free.c | 5 +- .../ck-libs/ampi/romio/mpi2-other/info/info_get.c | 3 +- .../ampi/romio/mpi2-other/info/info_getnks.c | 1 - .../ampi/romio/mpi2-other/info/info_getnth.c | 3 +- .../ampi/romio/mpi2-other/info/info_getvln.c | 1 - .../ck-libs/ampi/romio/mpi2-other/info/info_set.c | 9 +- .../ck-libs/ampi/romio/test-internal/.state-cache | 13 + .../ck-libs/ampi/romio/test-internal/Makefile.in | 47 + .../ampi/romio/test-internal/file_realms_test.c | 76 + .../ck-libs/ampi/romio/test-internal/heap_test.c | 453 + .../ampi/romio/test-internal/io_bounds_test.c | 302 + src/libs/ck-libs/ampi/romio/test/.codingcheck | 13 + src/libs/ck-libs/ampi/romio/test/.state-cache | 79 + src/libs/ck-libs/ampi/romio/test/Makefile.in | 141 +- src/libs/ck-libs/ampi/romio/test/Mfile.in | 84 + src/libs/ck-libs/ampi/romio/test/README | 30 +- src/libs/ck-libs/ampi/romio/test/aggregation1.c | 260 + src/libs/ck-libs/ampi/romio/test/aggregation2.c | 89 + src/libs/ck-libs/ampi/romio/test/async-multiple.c | 139 + src/libs/ck-libs/ampi/romio/test/async.c | 74 +- src/libs/ck-libs/ampi/romio/test/atomicity.c | 69 +- src/libs/ck-libs/ampi/romio/test/big_extents.c | 211 + src/libs/ck-libs/ampi/romio/test/coll_perf.c | 17 +- src/libs/ck-libs/ampi/romio/test/coll_test.c | 96 +- src/libs/ck-libs/ampi/romio/test/creat_excl.c | 134 + src/libs/ck-libs/ampi/romio/test/error.c | 46 +- src/libs/ck-libs/ampi/romio/test/excl.c | 34 +- src/libs/ck-libs/ampi/romio/test/fcoll_test.f.in | 54 +- src/libs/ck-libs/ampi/romio/test/file_info.c | 181 +- src/libs/ck-libs/ampi/romio/test/fmisc.f.in | 99 +- src/libs/ck-libs/ampi/romio/test/fperf.f.in | 41 +- src/libs/ck-libs/ampi/romio/test/hindexed.c | 253 + src/libs/ck-libs/ampi/romio/test/i_noncontig.c | 125 +- src/libs/ck-libs/ampi/romio/test/large_array.c | 23 +- src/libs/ck-libs/ampi/romio/test/large_file.c.in | 22 +- src/libs/ck-libs/ampi/romio/test/misc.c.in | 222 +- src/libs/ck-libs/ampi/romio/test/noncontig.c | 96 +- src/libs/ck-libs/ampi/romio/test/noncontig_coll.c | 94 +- src/libs/ck-libs/ampi/romio/test/noncontig_coll2.c | 201 +- src/libs/ck-libs/ampi/romio/test/ordered_fp.c | 144 + src/libs/ck-libs/ampi/romio/test/perf.c | 45 +- src/libs/ck-libs/ampi/romio/test/pfcoll_test.f.in | 42 +- src/libs/ck-libs/ampi/romio/test/psimple.c | 37 +- src/libs/ck-libs/ampi/romio/test/rtest.in | 131 + src/libs/ck-libs/ampi/romio/test/runtests.in | 327 +- src/libs/ck-libs/ampi/romio/test/shared_fp.c | 66 +- src/libs/ck-libs/ampi/romio/test/simple.c | 72 +- src/libs/ck-libs/ampi/romio/test/split_coll.c | 36 +- src/libs/ck-libs/ampi/romio/test/status.c | 33 +- src/libs/ck-libs/ampi/romio/test/std/async.std | 1 - src/libs/ck-libs/ampi/romio/test/std/atomicity.std | 4 - src/libs/ck-libs/ampi/romio/test/std/coll_test.std | 1 - src/libs/ck-libs/ampi/romio/test/std/error.std | 9 - src/libs/ck-libs/ampi/romio/test/std/excl.std | 1 - .../ck-libs/ampi/romio/test/std/fcoll_test.std | 1 - src/libs/ck-libs/ampi/romio/test/std/file_info.std | 1 - src/libs/ck-libs/ampi/romio/test/std/fmisc.std | 11 - .../ck-libs/ampi/romio/test/std/i_noncontig.std | 6 - src/libs/ck-libs/ampi/romio/test/std/misc.std | 11 - src/libs/ck-libs/ampi/romio/test/std/noncontig.std | 6 - .../ck-libs/ampi/romio/test/std/noncontig_coll.std | 6 - .../ampi/romio/test/std/noncontig_coll2.std | 1 - .../ck-libs/ampi/romio/test/std/pfcoll_test.std | 1 - src/libs/ck-libs/ampi/romio/test/std/psimple.std | 1 - src/libs/ck-libs/ampi/romio/test/std/shared_fp.std | 1 - src/libs/ck-libs/ampi/romio/test/std/simple.std | 1 - .../ck-libs/ampi/romio/test/std/split_coll.std | 1 - src/libs/ck-libs/ampi/romio/test/std/status.std | 2 - src/libs/ck-libs/ampi/romio/util/.state-cache | 7 + src/libs/ck-libs/ampi/romio/util/nfslock.c | 72 + src/libs/ck-libs/ampi/romio/util/romioinstall.in | 51 +- src/libs/ck-libs/ampi/romio/util/tarch | 28 +- 691 files changed, 90928 insertions(+), 28335 deletions(-) delete mode 100644 src/libs/ck-libs/ampi/romio/.config_params delete mode 100644 src/libs/ck-libs/ampi/romio/acconfig.h delete mode 100644 src/libs/ck-libs/ampi/romio/aclocal.m4 create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_close.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_fcntl.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_flush.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_getsh.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_hints.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_open.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_rdcoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_read.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_setsh.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_tuning.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_tuning.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_wrcoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_write.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bglockless/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bglockless/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless_features.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_close.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_delete.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_fcntl.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_features.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_flush.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_hints.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_open.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_read.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_resize.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_write.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_gridftp/globus_routines.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/README delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_close.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_done.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_fcntl.c (66%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_flush.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_hints.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iread.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iwrite.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_rdcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_seek.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wait.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wrcoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/README create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_aggregate.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_fcntl.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_hints.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_open.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_rwcontig.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_wrcoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_wrstr.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_nfs/.state-cache delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_close.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_done.c (90%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_fcntl.c (85%) create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_features.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_flush.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iread.c (79%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iwrite.c (84%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_rdcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_seek.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wait.c (92%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wrcoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ntfs/.state-cache rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_close.c (63%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_done.c (84%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_fcntl.c (88%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_flush.c (66%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_hints.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iread.c (78%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iwrite.c (83%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_open.c (79%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_rdcoll.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_read.c (72%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_resize.c (68%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_seek.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wait.c (86%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wrcoll.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_write.c (73%) create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_panfs/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_panfs/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_hints.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_open.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_read.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_resize.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_write.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pfs/.state-cache delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_close.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_fcntl.c (63%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_rdcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_resize.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_seek.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wrcoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/README delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_close.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_done.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_fcntl.c (70%) create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_features.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_flush.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_iread.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_iwrite.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_rdcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_resize.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_seek.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_wait.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_wrcoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs/.state-cache rewrite src/libs/ck-libs/ampi/romio/adio/ad_pvfs/Makefile.in (64%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_done.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_fcntl.c (88%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_hints.c (66%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_iread.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_iwrite.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_rdcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_seek.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_wait.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_wrcoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_aio.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_close.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_delete.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_fcntl.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_features.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_flush.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_open.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_read.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_resize.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_write.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/README delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_close.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_done.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_fcntl.c (74%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_hints.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iread.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iwrite.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_rdcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_read.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_resize.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_seek.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wait.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wrcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_write.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_testfs/.state-cache rewrite src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_done.c (68%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_fcntl.c (74%) rewrite src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_wait.c (70%) create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/.state-cache rewrite src/libs/ck-libs/ampi/romio/adio/ad_ufs/Makefile.in (64%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_close.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_done.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_fcntl.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_flush.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_hints.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iread.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iwrite.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_rdcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_read.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_resize.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_seek.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wait.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wrcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_write.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/.state-cache delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_close.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_done.c rewrite src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_fcntl.c (72%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_flush.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iread.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iwrite.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_rdcoll.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_seek.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wait.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wrcoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_close.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_delete.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_fcntl.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_features.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_flush.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_io.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_open.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_resize.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_aggregate_new.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_coll_build_req_new.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_coll_exch_new.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_darray.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_done.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_done_fake.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_fcntl.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_features.c rewrite src/libs/ck-libs/ampi/romio/adio/common/ad_init.c (64%) create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_io_coll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_iopen.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_iread.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_iread_fake.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_iwrite.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_iwrite_fake.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll_failsafe.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll_scalable.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_prealloc.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_read.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_resize.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_subarray.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_wait.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_wait_fake.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_write.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_write_nolock.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/ad_write_str_naive.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/adi_close.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/common/gencheck.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/greq_fns.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/heap-sort.c delete mode 100644 src/libs/ck-libs/ampi/romio/adio/common/setfn.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/strfns.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/common/system_hints.c create mode 100644 src/libs/ck-libs/ampi/romio/adio/include/.state-cache rewrite src/libs/ck-libs/ampi/romio/adio/include/adio_extern.h (72%) rewrite src/libs/ck-libs/ampi/romio/adio/include/adioi_error.h (76%) rewrite src/libs/ck-libs/ampi/romio/adio/include/adioi_fs_proto.h (96%) create mode 100644 src/libs/ck-libs/ampi/romio/adio/include/heap-sort.h delete mode 100644 src/libs/ck-libs/ampi/romio/adio/include/mpisgi2.h create mode 100644 src/libs/ck-libs/ampi/romio/adio/include/mpiu_greq.h rewrite src/libs/ck-libs/ampi/romio/adio/include/romioconf.h.in (70%) delete mode 100644 src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpi.h delete mode 100644 src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpif.h create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/darray_support.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop.h create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create.h create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_blockindexed.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_contig.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_indexed.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_pairtype.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_struct.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_vector.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_parts.h create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/romio_dataloop.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/romio_dataloop.h create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/romio_segment_ops.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/segment.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/segment_ops.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/subarray_support.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/typesize_support.c create mode 100644 src/libs/ck-libs/ampi/romio/common/dataloop/typesize_support.h create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_am.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_atomic.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_attr_alias.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_bugfix.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_cache.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_cc.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_cxx.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_f77.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_f77old.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_fc.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_libs.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_make.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_mpi.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_romio.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_runlog.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_shl.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_subcfg.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/aclocal_util.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/ax_prefix_config_h.m4 create mode 100644 src/libs/ck-libs/ampi/romio/confdb/ax_tls.m4 create mode 100755 src/libs/ck-libs/ampi/romio/confdb/config.guess create mode 100755 src/libs/ck-libs/ampi/romio/confdb/config.sub create mode 100755 src/libs/ck-libs/ampi/romio/confdb/depcomp create mode 100755 src/libs/ck-libs/ampi/romio/confdb/install-sh create mode 100755 src/libs/ck-libs/ampi/romio/confdb/missing rewrite src/libs/ck-libs/ampi/romio/configure (81%) rewrite src/libs/ck-libs/ampi/romio/configure.in (64%) delete mode 100644 src/libs/ck-libs/ampi/romio/configure2.in create mode 100644 src/libs/ck-libs/ampi/romio/doc/Makefile create mode 100644 src/libs/ck-libs/ampi/romio/doc/README create mode 100755 src/libs/ck-libs/ampi/romio/doc/makepubpage.sh create mode 100644 src/libs/ck-libs/ampi/romio/doc/pubs.bib create mode 100644 src/libs/ck-libs/ampi/romio/doc/romio.bib create mode 100644 src/libs/ck-libs/ampi/romio/doc/source-guide.tex create mode 100644 src/libs/ck-libs/ampi/romio/doc/users-guide.pdf create mode 100644 src/libs/ck-libs/ampi/romio/doc/users-guide.tex rewrite src/libs/ck-libs/ampi/romio/include/mpio.h.in (71%) create mode 100644 src/libs/ck-libs/ampi/romio/localdefs.in create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/.state-cache rewrite src/libs/ck-libs/ampi/romio/mpi-io/file_c2f.c (60%) create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/fortran/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/default/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/default/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/default/mpio_err.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/default/mpio_file.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/mpio_err.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/mpio_file.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/mpio_err.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/mpio_file.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/iotestall.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/iotestany.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/iotestsome.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/iowaitall.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/iowaitany.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/iowaitsome.c rewrite src/libs/ck-libs/ampi/romio/mpi-io/iread.c (68%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/iread_at.c (77%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/iwrite.c (62%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/iwrite_at.c (74%) create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/mpich2_fileutil.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/mpir-mpioinit.c create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/mpiu_greq.c rewrite src/libs/ck-libs/ampi/romio/mpi-io/open.c (71%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/rd_atallb.c (72%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/read.c (68%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/read_all.c (61%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/read_allb.c (64%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/read_at.c (78%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/read_atall.c (68%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/read_ord.c (60%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/read_ordb.c (65%) create mode 100644 src/libs/ck-libs/ampi/romio/mpi-io/register_datarep.c rewrite src/libs/ck-libs/ampi/romio/mpi-io/seek_sh.c (69%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/set_view.c (72%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/wr_atallb.c (73%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/write.c (60%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/write_allb.c (68%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/write_at.c (72%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/write_atall.c (61%) rewrite src/libs/ck-libs/ampi/romio/mpi-io/write_ordb.c (65%) create mode 100644 src/libs/ck-libs/ampi/romio/mpi2-other/array/.state-cache rewrite src/libs/ck-libs/ampi/romio/mpi2-other/array/darray.c (78%) create mode 100644 src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/mpi2-other/info/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/test-internal/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/test-internal/Makefile.in create mode 100644 src/libs/ck-libs/ampi/romio/test-internal/file_realms_test.c create mode 100644 src/libs/ck-libs/ampi/romio/test-internal/heap_test.c create mode 100644 src/libs/ck-libs/ampi/romio/test-internal/io_bounds_test.c create mode 100644 src/libs/ck-libs/ampi/romio/test/.codingcheck create mode 100644 src/libs/ck-libs/ampi/romio/test/.state-cache rewrite src/libs/ck-libs/ampi/romio/test/Makefile.in (65%) create mode 100644 src/libs/ck-libs/ampi/romio/test/Mfile.in create mode 100644 src/libs/ck-libs/ampi/romio/test/aggregation1.c create mode 100644 src/libs/ck-libs/ampi/romio/test/aggregation2.c create mode 100644 src/libs/ck-libs/ampi/romio/test/async-multiple.c create mode 100644 src/libs/ck-libs/ampi/romio/test/big_extents.c create mode 100644 src/libs/ck-libs/ampi/romio/test/creat_excl.c create mode 100644 src/libs/ck-libs/ampi/romio/test/hindexed.c create mode 100644 src/libs/ck-libs/ampi/romio/test/ordered_fp.c create mode 100644 src/libs/ck-libs/ampi/romio/test/rtest.in delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/async.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/atomicity.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/coll_test.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/error.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/excl.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/fcoll_test.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/file_info.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/fmisc.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/i_noncontig.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/misc.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/noncontig.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/noncontig_coll.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/noncontig_coll2.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/pfcoll_test.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/psimple.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/shared_fp.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/simple.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/split_coll.std delete mode 100644 src/libs/ck-libs/ampi/romio/test/std/status.std create mode 100644 src/libs/ck-libs/ampi/romio/util/.state-cache create mode 100644 src/libs/ck-libs/ampi/romio/util/nfslock.c diff --git a/src/libs/ck-libs/ampi/Makefile b/src/libs/ck-libs/ampi/Makefile index 3ff1a15af1..ed1f08d5e1 100644 --- a/src/libs/ck-libs/ampi/Makefile +++ b/src/libs/ck-libs/ampi/Makefile @@ -17,19 +17,12 @@ DEST=$(AMPI_LIBDIR)/$(AMPI_LIB).a DESTF=$(AMPI_LIBDIR)/$(AMPI_LIB)f.a COMPATLIB=$(AMPI_LIBDIR)/libampi-compat.a ROMIOLIB=$(AMPI_LIBDIR)/libampiromio -ROMIOLIBSHARED= -AMPI_STATIC_ONLY := $(CMK_NO_BUILD_SHARED) - -SHARED_SUF := $(CMK_SHARED_SUF) - -ifeq ($(AMPI_STATIC_ONLY),false) - ROMIOLIBSHARED=$(CDIR)/lib_so/libampiromio.$(SHARED_SUF) +ifeq ($(CMK_NO_BUILD_SHARED),false) + ROMIOLIBSHARED=$(CDIR)/lib_so/libampiromio.$(CMK_SHARED_SUF) endif -USE_ROMIO := $(CMK_AMPI_WITH_ROMIO) - -ifeq ($(USE_ROMIO),true) +ifeq ($(CMK_AMPI_WITH_ROMIO),true) ROMIO=$(ROMIOLIB).a endif @@ -44,32 +37,27 @@ all: AMPI AMPIF $(COMPATLIB) $(ROMIO) # AMPI and AMPIF are order-only dependencies (|), i.e., no up-to-date check # is done, in order to prevent ROMIO recompilation when AMPI changes. $(ROMIO): | AMPI AMPIF - cd romio && ./configure \ - -mpiincdir=$(CDIR)/include \ - -mpilib=$(CDIR)/lib/libmoduleampi.a \ - -mpibindir=$(CDIR)/bin \ - -cc=$(CDIR)/bin/ampicc \ - -fc=$(CDIR)/bin/ampif77 \ - -f90=$(CDIR)/bin/ampif90 \ - -cflags="$(OPTS)" \ - -fflags="$(OPTS)" \ - -noprofile \ - -mpiolib=$@ - - @# Cygwin only supports NTFS - case `uname` in CYGWIN*|cygwin*|Cygwin*) \ - echo -e "#undef UFS\n#undef NFS\n#define ROMIO_NTFS\n" >> romio/adio/include/romioconf.h; \ - sed -i s,ufs\ nfs,, romio/Makefile; \ - esac + @echo "Building ROMIO" + cd romio && \ + CFLAGS="$(OPTS)" \ + FFLAGS="$(OPTS)" \ + F77=$(CDIR)/bin/ampif90 \ + CC=$(CDIR)/bin/ampicc \ + ./configure \ + --disable-aio \ + --enable-f77=`test -f $(DESTF) && echo yes || echo no` \ + --srcdir=`pwd` + cp romio/include/mpio.h romio/include/mpiof.h $(CDIR)/include $(MAKE) -C romio + cp romio/lib/libmpio.a $@ if [ -n "$(ROMIOLIBSHARED)" ]; then \ echo "Building dynamic ROMIO library: $(ROMIOLIBSHARED)"; \ find romio/ -name \*.o -exec $(CHARMC) -o $(ROMIOLIBSHARED) {} + ; \ fi @echo "ROMIO built successfully" -AMPI: $(DEST) +AMPI: $(DEST) @echo "AMPI built successfully" AMPIF: $(DESTF) @@ -93,7 +81,6 @@ headers: $(HEADERS) cp $(HEADERS) $(CDIR)/include/ cp ampi.h $(CDIR)/include/mpi.h cp ampif.h $(CDIR)/include/mpif.h -# cp mpiCC mpicc mpicxx mpif77 mpif90 $(CDIR)/bin cp ampiCC $(CDIR)/bin/ampicc cp ampiCC $(CDIR)/bin/ampiCC cp ampiCC $(CDIR)/bin/ampicxx @@ -133,13 +120,13 @@ ampiMisc.o: ampiMisc.C ampiimpl.h $(HEADDEP) $(CHARMC) -c ampiMisc.C mpich-alltoall.o: mpich-alltoall.C $(HEADDEP) - $(CHARMC) -c mpich-alltoall.C + $(CHARMC) -c mpich-alltoall.C ampi.decl.h ampi.def.h: ampi.ci $(CHARMC) ampi.ci ddt.o: ddt.C ddt.h $(HEADDEP) -clean: - -rm -fr *.o *~ *.decl.h *.def.h gmon.out $(DEST) $(DESTF) $(COMPATLIB) conv-host charmrun headers *.mod +clean: + rm -fr *.o *~ *.decl.h *.def.h gmon.out $(DEST) $(DESTF) $(COMPATLIB) conv-host charmrun headers *.mod - cd romio && $(MAKE) clean diff --git a/src/libs/ck-libs/ampi/romio/.config_params b/src/libs/ck-libs/ampi/romio/.config_params deleted file mode 100644 index 01ac7258d5..0000000000 --- a/src/libs/ck-libs/ampi/romio/.config_params +++ /dev/null @@ -1,37 +0,0 @@ -__sun4_ -__rs6000_ -__paragon_ -__solaris_ -__solaris86_ -__tflop_ -__tflops_ -__hpux_ -__sppux_ -__SX4_ -__sgi_ -__sgi5_ -__IRIX_ -__IRIX32_ -__IRIXN32_ -__IRIX64_ -__alpha_ -__ALPHA_ -__freebsd_ -__netbsd_ -__LINUX_ -__LINUX_ALPHA_ -__CRAY_ -__nfs_ -__ufs_ -__pfs_ -__piofs_ -__pvfs_ -__testfs_ -__xfs_ -__hfs_ -__sfs_ -__mpich_mpi -__sgi_mpi -__hp_mpi -__cray_mpi -__lam_mpi diff --git a/src/libs/ck-libs/ampi/romio/Makefile.in b/src/libs/ck-libs/ampi/romio/Makefile.in index 1e3d879d99..0e1a18527c 100644 --- a/src/libs/ck-libs/ampi/romio/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/Makefile.in @@ -6,15 +6,15 @@ AR = @AR@ LIBNAME = @LIBNAME@ NOF77 = @NOF77@ NOPROFILE = @NOPROFILE@ -MPI = @MPI@ PREFIX = @prefix@ -FROM_MPICH = @FROM_MPICH@ -FROM_MPICH2 = @FROM_MPICH2@ +srcdir = @srcdir@ BUILD_MPI_INFO = @BUILD_MPI_INFO@ BUILD_MPI_ARRAY = @BUILD_MPI_ARRAY@ -DIRS = mpi-io adio/common +DIRS = mpi-io adio/common @GLUE_DIR@ MPIO_DIRS = mpi-io -ALL_DIRS = mpi-io mpi-io/fortran mpi2-other/info mpi2-other/info/fortran mpi2-other/array mpi2-other/array/fortran adio/common adio/ad_pfs adio/ad_piofs adio/ad_nfs adio/ad_ufs adio/ad_xfs adio/ad_hfs adio/ad_sfs adio/ad_testfs adio/ad_pvfs +EXTRA_SRC_DIRS = @EXTRA_SRC_DIRS@ +FILE_SYS_DIRS = @FILE_SYS_DIRS@ +ALL_DIRS = mpi-io mpi-io/fortran mpi2-other/info mpi2-other/info/fortran mpi2-other/array mpi2-other/array/fortran adio/common adio/ad_pfs adio/ad_piofs adio/ad_nfs adio/ad_ufs adio/ad_xfs adio/ad_hfs adio/ad_sfs adio/ad_testfs adio/ad_pvfs adio/ad_pvfs2 adio/ad_panfs adio/ad_gridftp adio/ad_lustre adio/ad_bgl adio/ad_bglockless test test-internal mpi-io/glue/default mpi-io/glue/mpich1 mpi-io/glue/mpich2 SHELL = /bin/sh @VPATH@ @@ -26,13 +26,22 @@ all: mpio # use the same library. This is a work around for a bug in make that # is related to the use of file time stamps in make, but is in fact # a bug in the logic of several make implementations, including gnumake +# +# The make clean /make profile /make clean handles the rebuilding of +# the object files with the same names but with different CPP definitions. +# If weak symbols are supported or profiling is turned off, we don't +# need to rebuild everything. +# +# Eventually, the clean at the top will also be removed, at least for the +# MPICH builds (which do their own clean if required) +# $(MAKE) clean mpio: $(MAKE) mpiolib - @if test "$(NOPROFILE)" = 0 ; then\ - $(MAKE) profile; \ + @if [ "$(NOPROFILE)" = 0 ] ; then\ + $(MAKE) profile || exit 1; \ fi;\ $(RANLIB) $(LIBNAME) - @if test "$(FROM_MPICH)" = 0 -a "$(FROM_MPICH2)" = 0 ; then \ + @if [ "$(WITHIN_KNOWN_MPI_IMPL)" = no ] ; then \ echo " "; \ echo "Completed build of ROMIO. Check the output for errors."; \ echo " " ;\ @@ -45,122 +54,86 @@ mpio: fi @sleep 1 +# FIXME: This should invoke the clean targets in each of the Makefiles. clean: - @-rm -f charmrun work.pc work.pcl - @dirs=`echo "$(DIRS)"`; \ - for x in $(FILE_SYSTEM) ;\ - do \ - dirs=`echo "$$dirs" adio/ad_$$x` ;\ - done ; \ - if test "$(BUILD_MPI_INFO)" = 1 ; then \ - dirs=`echo "$$dirs" mpi2-other/info` ;\ - if test "$(NOF77)" = 0 ; then\ - dirs=`echo "$$dirs" mpi2-other/info/fortran` ;\ - fi;\ - fi; \ - if test "$(BUILD_MPI_ARRAY)" = 1 ; then \ - dirs=`echo "$$dirs" mpi2-other/array` ;\ - if test "$(NOF77)" = 0 ; then\ - dirs=`echo "$$dirs" mpi2-other/array/fortran` ;\ - fi;\ - fi; \ - if test "$(NOF77)" = 0 ; then\ - dirs=`echo "$$dirs" mpi-io/fortran` ;\ - fi;\ - for dir in $$dirs ;\ + @-rm -f work.pc work.pcl + @for dir in $(DIRS) $(FILE_SYS_DIRS) $(EXTRA_SRC_DIRS) ;\ do \ echo " " ;\ echo cleaning directory $$dir ;\ - (cd $$dir; rm -f *.o) ;\ + (cd $$dir && rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg) ;\ done; \ - echo " " + echo " " ;\ + echo cleaning directory test-internal ;\ + (cd test-internal && $(MAKE) clean);\ + echo " ";\ + echo " " ;\ + echo cleaning directory test ;\ + (cd test && $(MAKE) clean);\ + echo " "; mpiolib: - @if test "$(FROM_MPICH)" = 0 -a "$(FROM_MPICH2)" = 0 ; then \ + @if [ "$(WITHIN_KNOWN_MPI_IMPL)" = no ] ; then \ echo " " ;\ echo "deleting previously built library if it exists" ;\ rm -f $(LIBNAME) ;\ - fi; \ - dirs=`echo "$(DIRS)"`; \ - for x in $(FILE_SYSTEM) ;\ - do \ - dirs=`echo "$$dirs" adio/ad_$$x` ;\ - done ; \ - if test "$(BUILD_MPI_INFO)" = 1 ; then \ - dirs=`echo "$$dirs" mpi2-other/info` ;\ - if test "$(NOF77)" = 0 ; then \ - dirs=`echo "$$dirs" mpi2-other/info/fortran` ;\ - fi; \ - fi; \ - if test "$(BUILD_MPI_ARRAY)" = 1 ; then \ - dirs=`echo "$$dirs" mpi2-other/array` ;\ - if test "$(NOF77)" = 0 ; then \ - dirs=`echo "$$dirs" mpi2-other/array/fortran` ;\ - fi; \ - fi; \ - if test "$(NOF77)" = 0 ; then \ - dirs=`echo "$$dirs" mpi-io/fortran` ;\ - fi; \ - for dir in $$dirs ;\ + fi + @for dir in $(DIRS) $(FILE_SYS_DIRS) $(EXTRA_SRC_DIRS) ;\ do \ echo " " ;\ echo compiling ROMIO in directory $$dir ;\ sleep 1;\ - (cd $$dir && $(MAKE) ;) ;\ + (cd $$dir && $(MAKE);) || exit 1 ;\ if [ $$? != 0 ] ; then \ echo "Make failed in directory $$dir" ; exit 1 ;\ fi ;\ done +# We no longer need to clean before building the profiling interface profile: @if [ "@HAVE_WEAK_SYMBOLS@" = 0 ] ; then \ - dirs=`echo "$(MPIO_DIRS)"`; \ - if test "$(BUILD_MPI_INFO)" = 1 ; then \ - dirs=`echo "$$dirs" mpi2-other/info` ;\ - if test "$(NOF77)" = 0 ; then\ - dirs=`echo "$$dirs" mpi2-other/info/fortran` ;\ - fi;\ - fi; \ - if test "$(BUILD_MPI_ARRAY)" = 1 ; then \ - dirs=`echo "$$dirs" mpi2-other/array` ;\ - if test "$(NOF77)" = 0 ; then\ - dirs=`echo "$$dirs" mpi2-other/array/fortran` ;\ - fi;\ - fi; \ - if test "$(NOF77)" = 0 ; then\ - dirs=`echo "$$dirs" mpi-io/fortran` ;\ - fi;\ - for dir in $$dirs ;\ - do \ + for dir in $(MPIO_DIRS) $(EXTRA_SRC_DIRS) ;\ + do \ echo " " ;\ echo building profiling interface in directory $$dir ;\ sleep 1;\ - (cd $$dir; \ - $(MAKE) profile MPIOPROFILE="-DMPIO_BUILD_PROFILING";) ;\ + (cd $$dir && \ + $(MAKE) profile MPIOPROFILE="-DMPIO_BUILD_PROFILING";) || exit 1;\ if [ $$? != 0 ] ; then \ echo "Make failed in directory $$dir" ; exit 1 ;\ fi ;\ - done \ + done ;\ fi +# FIXME: This should look at the enabled File systems +coverage: + (cd mpi-io && make coverage) + (cd adio/ad_ufs && make coverage) + (cd adio/ad_nfs && make coverage) + cleanall: @dirs=`echo "$(ALL_DIRS)"`; \ + echo "cleaning test directory" ;\ + (cd test && ${MAKE} cleanall ) ;\ echo cleaning current directory ;\ - (rm -f config.status Makefile *~ *.log romio.tar*) ;\ + (rm -f config.status Makefile *~ *.log romio.tar* localdefs) ;\ for dir in $$dirs ;\ do \ echo " " ;\ if [ ! -d $$dir ] ; then continue ; fi ; \ echo cleaning directory $$dir ;\ - (cd $$dir; rm -f *.o Makefile *~) ;\ + (cd $$dir && rm -f *.o Makefile *~) ;\ done; \ echo " " ;\ echo "cleaning directory include" ;\ - (cd include; rm -f *.h);\ + (cd include && rm -f *.h);\ + echo " " ;\ + echo "cleaning directory adio/include" ;\ + (cd adio/include && rm -f romioconf.h);\ echo " " ;\ echo "cleaning directory util" ;\ - (cd util; rm -f romioinstall *~) - -rm -rf lib + (cd util && rm -f romioinstall *~) + -rm -f lib install: $(MAKE) clean @@ -170,6 +143,8 @@ install: uninstall: @./util/romioinstall -prefix=$(PREFIX) -uninstall +# FIXME: To avoid problems with noisy make programs, these should be accessed +# through entries in localdefs . romio_lflags: @echo '@ROMIO_LFLAGS@' @@ -187,3 +162,28 @@ romio_tfflags: # distclean the standard form for cleanall distclean: cleanall + +# Allow dependencies target +dependencies: + +# MPICH2 documentation targets +mandoc: + (cd mpi-io && $(MAKE) mandoc ) +htmldoc: + (cd mpi-io && $(MAKE) htmldoc ) +latexdoc: + (cd mpi-io && $(MAKE) latexdoc ) + + +tags: TAGS +TAGS: + for dir in mpi-io adio/common - ; do \ + if [ "$$dir" = "-" ] ; then break ; fi ; \ + (cd $$dir && ${MAKE} TAGS ; ) ; done + +# This target is appropriate for autoconf 2.59 (the command line options +# for selecting the macro directories changes in incompatible ways between +# autoconf releases). +${srcdir}/configure: ${srcdir}/configure.in + cd ${srcdir} && autoheader -I confdb + cd ${srcdir} && rm -rf autom4te*.cache && autoconf -I confdb diff --git a/src/libs/ck-libs/ampi/romio/README b/src/libs/ck-libs/ampi/romio/README index 49071468e1..42fe329a9f 100644 --- a/src/libs/ck-libs/ampi/romio/README +++ b/src/libs/ck-libs/ampi/romio/README @@ -1,8 +1,112 @@ ROMIO: A High-Performance, Portable MPI-IO Implementation - Version 1.2.4, May 2002 + Version 2008-03-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 diff --git a/src/libs/ck-libs/ampi/romio/acconfig.h b/src/libs/ck-libs/ampi/romio/acconfig.h deleted file mode 100644 index f1a335f4dd..0000000000 --- a/src/libs/ck-libs/ampi/romio/acconfig.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* $Id$ - * - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ - -#undef AIO_HANDLE_IN_AIOCB -#undef AIO_PRIORITY_DEFAULT -#undef AIO_SIGNOTIFY_NONE -#undef AIO_SUN -#undef FREEBSD -#undef HAVE_LONG_LONG_64 -#undef HAVE_MOUNT_NFS -#undef HAVE_MPI_COMBINERS -#undef HAVE_MPI_DARRAY_SUBARRAY -#undef HAVE_MPI_INFO -#undef HAVE_MPI_LONG_LONG_INT -#undef HAVE_PRAGMA_CRI_DUP -#undef HAVE_PRAGMA_HP_SEC_DEF -#undef HAVE_PRAGMA_WEAK -#undef HAVE_PREAD64 -#undef HAVE_STATUS_SET_BYTES -#undef HAVE_STRERROR -#undef HAVE_SYSERRLIST -#undef HAVE_WEAK_SYMBOLS -#undef HFS -#undef HPUX -#undef INT_LT_POINTER -#undef IRIX -#undef LINUX -#undef MPICH -#undef MPIHP -#undef MPILAM -#undef MPISGI -#undef MPI_OFFSET_IS_INT -#undef NEEDS_MPI_TEST -#undef NFS -#undef NO_AIO -#undef NO_FD_IN_AIOCB -#undef NO_MPI_SGI_type_is_contig -#undef PARAGON -#undef PFS -#undef PIOFS -#undef PRINT_ERR_MSG -#undef ROMIO_PVFS -#undef ROMIO_TESTFS -#undef SFS -#undef SOLARIS -#undef SPPUX -#undef SX4 -#undef UFS -#undef XFS -#undef NEEDS_AIOCB_T diff --git a/src/libs/ck-libs/ampi/romio/aclocal.m4 b/src/libs/ck-libs/ampi/romio/aclocal.m4 deleted file mode 100644 index b2d640120a..0000000000 --- a/src/libs/ck-libs/ampi/romio/aclocal.m4 +++ /dev/null @@ -1,1254 +0,0 @@ -dnl -dnl This files contains additional macros for using autoconf to -dnl build configure scripts. -dnl -dnl Almost all of this file is taken from the aclocal.m4 of MPICH -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 -define(PAC_GET_FORTNAMES,[ - rm -f confftest.f confftest.o - cat > 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)." - NOF77=1 - elif test -z "$FORTRANNAMES" ; then - if test $arch_CRAY ; then - # 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 - rm -f confftest.f confftest.o - if test -n "$nameform4" ; then - echo "Fortran externals are lower case and have two trailing underscores" - FORTRANNAMES="FORTRANDOUBLEUNDERSCORE" - elif test -n "$nameform1" ; then - # We don't set this in CFLAGS; it is a default case - echo "Fortran externals have a trailing underscore and are lowercase" - FORTRANNAMES="FORTRANUNDERSCORE" - elif test -n "$nameform2" ; then - echo "Fortran externals are uppercase" - FORTRANNAMES="FORTRANCAPS" - elif test -n "$nameform3" ; then - 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)." - NOF77=1 - fi - fi - if test -n "$FORTRANNAMES" ; then - WDEF="-D$FORTRANNAMES" - fi - ])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 -define(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 -define(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(<>,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 -main() { - FILE *f=fopen("conftestval","w"); - if (!f) exit(1); - fprintf( f, "%d\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 -define(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 -dnl Check whether to use -n, \c, or newline-tab to separate -dnl checking messages from result messages. -dnl from MPICH -define(AC_PROG_ECHO_N, -ac_echo_n=yes -[if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi -])dnl -dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION) -define(AC_FD_MSG,1)dnl -define(AC_MSG_CHECKING,[dnl -if test -z "$ac_echo_n" ; then -AC_PROG_ECHO_N -fi -if test -z "$ac_echo_test" -a AC_FD_MSG = 1 ; then -echo $ac_n "checking $1""... $ac_c" -else -echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSG -fi])dnl -dnl -dnl AC_MSG(msg) -dnl generates "msg..." (no newline) -define(AC_MSG,[dnl -if test -z "$ac_echo_n" ; then -AC_PROG_ECHO_N -fi -if test -z "$ac_echo_test" -a AC_FD_MSG = 1 ; then -echo $ac_n "$1""... $ac_c" -else -echo $ac_n "$1""... $ac_c" 1>&AC_FD_MSG -fi])dnl -dnl -dnl AC_CHECKING(FEATURE-DESCRIPTION) -define(AC_CHECKING,dnl -[echo "checking $1" 1>&AC_FD_MSG])dnl -dnl -dnl AC_MSG_RESULT(RESULT-DESCRIPTION) -define(AC_MSG_RESULT,dnl -if test -z "$ac_echo_test" -a AC_FD_MSG = 1 ; then -[echo "$ac_t""$1"] -else -[echo "$ac_t""$1" 1>&AC_FD_MSG] -fi)dnl -dnl -define(PAC_GET_SPECIAL_SYSTEM_INFO,[ -# -if test -n "$arch_IRIX"; then - AC_MSG_CHECKING(for IRIX OS version) - dnl This block of code replaces a generic "IRIX" arch value with - dnl IRIX__ - 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/'` - 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' '` - if test "$cpucount" = "" ; then - 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 " - hinv - print_error "to romio-maint@mcs.anl.gov" - exit 1 - fi - AC_MSG_RESULT($cpucount) - dnl - AC_MSG_CHECKING(for IRIX cpumodel) - dnl The tail -1 is necessary for multiple processor SGI boxes - dnl We might use this to detect SGI multiprocessors and recommend - 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 " - hinv -t cpu 2>&1 - hinv -t cpu | cut -f 3 -d' ' 2>&1 - print_error "to romio-maint@mcs.anl.gov" - exit 1 - 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 " " - uname -a - print_error "to romio-maint@mcs.anl.gov" - exit 1 - elif test $osversion = 4 ; then - true - elif test $osversion = 5 ; then - true - 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" - uname -a 2>&1 - hinv 2>&1 - print_error "to romio-maint@mcs.anl.gov" - exit 1 - fi - AC_MSG_CHECKING(for cputype) - OLD_ARCH=IRIX - IRIXARCH="$ARCH_$osversion" - dnl Now, handle the chip set - changequote(,)dnl - cputype=`echo $cputype | sed -e 's%.*/%%' -e 's/R//' | tr -d "[A-Z]"` - changequote([,])dnl - case $cputype in - 3000) ;; - 4000) ;; - 4400) ;; - 4600) ;; - 5000) ;; - 8000) ;; - 10000);; - 12000);; - *) - print_error "Unexpected IRIX/MIPS chipset $cputype. Please send the output" - print_error " " - 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 " " - cputype=4400 - ;; - esac - AC_MSG_RESULT($cputype) - IRIXARCH="$IRIXARCH_$cputype" - echo "IRIX-specific architecture is $IRIXARCH" -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 -define(PAC_CHECK_SGI_3264,[ -AC_MSG_CHECKING(for 32-bit or 64-bit objects) -cat <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 -define(PAC_TEST_MPI,[ - AC_MSG_CHECKING(if a simple MPI program compiles and links) - rm -f mpitest.c - cat > mpitest.c < /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 - else - rm -f conftest mpitest.c - fi -AC_MSG_RESULT(yes) -])dnl -dnl -dnl -dnl -define(PAC_NEEDS_FINT,[ - AC_MSG_CHECKING(if MPI_Fint is defined in the MPI implementation) - cat > mpitest1.c < /dev/null 2>&1 - if test ! -s mpitest1.o ; then - NEEDS_MPI_FINT="#define NEEDS_MPI_FINT" - CFLAGS="$CFLAGS -DNEEDS_MPI_FINT" - AC_MSG_RESULT(no) - rm -f mpitest1.o mpitest1.c - else - NEEDS_MPI_FINT="" - AC_MSG_RESULT(yes) - rm -f mpitest1.o mpitest1.c - fi -])dnl -dnl -dnl -dnl -define(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 -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 < /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MPI_LONG_LONG_INT,,[Define if mpi has long long it]) - else - AC_MSG_RESULT(no) - fi - rm -f conftest mpitest.c -])dnl -dnl -dnl Check that the compile accepts ANSI prototypes. -dnl PAC_CHECK_CC_PROTOTYPES() -dnl -define(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 -define(PAC_TEST_LONG_LONG, -[AC_MSG_CHECKING([if the compiler prints long longs correctly with %lld]) -rm -f conftestll -AC_TEST_PROGRAM([#include -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 - 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 -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" - 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" - LL="\%lld" - elif test "$longlongsize" = "int" ; then # a hack to set MPI_Offset as int - echo "defining MPI_Offset as int in C and integer in Fortran" - DEFINE_MPI_OFFSET="typedef int MPI_Offset;" - FORTRAN_MPI_OFFSET="integer" - AC_DEFINE(MPI_OFFSET_IS_INT,,[Define if MPI_Offset is int]) - LL="\%d" - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - else - 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 -else - PAC_GET_TYPE_SIZE(long long, longlongsize) - if test -n "$longlongsize" ; then - if test "$longlongsize" = 8 ; then - PAC_TEST_LONG_LONG() - else - 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 - else -dnl check if longlong is not supported or only its size cannot be determined -dnl because the program cannot be run. - rm -f ltest.c - cat > ltest.c < /dev/null 2>&1 - if test -x conftest ; then - echo "assuming size of long long is 8bytes; use '-longlongsize' to indicate otherwise" - rm -f conftest ltest.c - echo "defining MPI_Offset as long long in C and integer*8 in Fortran" - 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" - LL="\%lld" - else - echo "assuming long long is not available; use '-longlongsize' to indicate otherwise" - 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 -fi -])dnl -dnl -dnl -define(PAC_MPI_INFO,[ - AC_MSG_CHECKING(if MPI_Info functions are defined in the MPI implementation) - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MPI_INFO,,[Define if MPI_Info available]) - HAVE_MPI_INFO="#define HAVE_MPI_INFO" - MPI_FINFO1="!" - MPI_FINFO2="!" - MPI_FINFO3="!" - MPI_FINFO4="!" - else - AC_MSG_RESULT(no) - BUILD_MPI_INFO=1 - MPI_FINFO1=" INTEGER MPI_MAX_INFO_KEY, MPI_MAX_INFO_VAL" - MPI_FINFO2=" PARAMETER (MPI_MAX_INFO_KEY=255, MPI_MAX_INFO_VAL=1024)" - MPI_FINFO3=" INTEGER MPI_INFO_NULL" - MPI_FINFO4=" PARAMETER (MPI_INFO_NULL=0)" - fi - rm -f conftest mpitest.c -])dnl -dnl -dnl -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 < /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY,,[Define if MPI Darray available]) - HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" - MPI_FARRAY1="!" - MPI_FARRAY2="!" - MPI_FARRAY3="!" - MPI_FARRAY4="!" - MPI_FARRAY5="!" - MPI_FARRAY6="!" - MPI_FARRAY7="!" - else - AC_MSG_RESULT(no) - BUILD_MPI_ARRAY=1 - MPI_FARRAY1=" INTEGER MPI_ORDER_C, MPI_ORDER_FORTRAN" - MPI_FARRAY2=" PARAMETER (MPI_ORDER_C=56, MPI_ORDER_FORTRAN=57)" - MPI_FARRAY3=" INTEGER MPI_DISTRIBUTE_BLOCK, MPI_DISTRIBUTE_CYCLIC" - MPI_FARRAY4=" INTEGER MPI_DISTRIBUTE_NONE, MPI_DISTRIBUTE_DFLT_DARG" - MPI_FARRAY5=" PARAMETER (MPI_DISTRIBUTE_BLOCK=121, MPI_DISTRIBUTE_CYCLIC=122)" - MPI_FARRAY6=" PARAMETER (MPI_DISTRIBUTE_NONE=123)" - MPI_FARRAY7=" PARAMETER (MPI_DISTRIBUTE_DFLT_DARG=-49767)" - fi - rm -f conftest mpitest.c -])dnl -dnl -dnl -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 < /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - cp adio/sgi/mpi3.1/*.h include - else - AC_MSG_RESULT(no) - fi - rm -f conftest mpitest.c -])dnl -dnl -dnl -dnl -define(PAC_CHECK_MPIOF_H,[ - AC_MSG_CHECKING(if mpiof.h is included in mpif.h) - rm -f mpitest.f - cat > mpitest.f < /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - MPIOF_H_INCLUDED=1 - else - AC_MSG_RESULT(no) - fi - rm -f conftest mpitest.f -])dnl -dnl -dnl -dnl check if pread64 is defined in IRIX. needed on IRIX 6.5 -dnl -define(PAC_HAVE_PREAD64,[ - AC_MSG_CHECKING(if pread64 is defined) - rm -f conftest.c - cat > conftest.c < - main() - { - int fd=0, buf=0, i=0; - off64_t off=0; - pread64(fd, &buf, i, off); - } -EOF - rm -f conftest - $CC $USER_CFLAGS -o conftest conftest.c > /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_PREAD64,,[Define if pread64 available]) - else - AC_MSG_RESULT(no) - fi -rm -f conftest conftest.c -])dnl -dnl -dnl -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 < /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - AC_DEFINE(NO_MPI_SGI_type_is_contig,,[Define if no MPI type is contig]) - fi - rm -f conftest mpitest.c -])dnl -dnl -dnl -dnl -define(PAC_TEST_MPI_COMBINERS,[ - AC_MSG_CHECKING(if MPI-2 combiners are defined in mpi.h) - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MPI_COMBINERS,,[Define if MPI combiners available]) - else - AC_MSG_RESULT(no) - fi - rm -f conftest mpitest.c -])dnl -dnl -dnl -dnl PAC_MPI_OFFSET_KIND() -dnl -dnl tries to determine the Fortran 90 kind parameter for 8-byte integers -dnl -define(PAC_MPI_OFFSET_KIND, -[AC_MSG_CHECKING([for Fortran 90 KIND parameter for 8-byte integers]) -rm -f kind.f kind.o kind -cat < kind.f - program main - integer i - i = selected_int_kind(16) - open(8, file="k.out", form="formatted") - write (8,*) i - close(8) - stop - end -EOF -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` - fi -fi -rm -f kind k.out kind.f kind.o k.out -if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then - AC_MSG_RESULT($KINDVAL) - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)" -else - AC_MSG_RESULT(unavailable) -fi -])dnl -dnl -dnl -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 < /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - else - AC_MSG_RESULT(no) - fi - rm -f conftest mpitest.f -])dnl -dnl -dnl -dnl PAC_GET_XFS_MEMALIGN -dnl -dnl -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 -AC_TEST_PROGRAM([#include -#include -#include -#include -main() { - struct dioattr st; - int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); - FILE *f=fopen("memalignval","w"); - if (fd == -1) exit(1); - if (!f) exit(1); - fcntl(fd, F_DIOINFO, &st); - fprintf( f, "%u\n", st.d_mem); - exit(0); -}],Pac_CV_NAME=`cat memalignval`,Pac_CV_NAME="") -/bin/rm -f memalignval -/bin/rm -f /tmp/romio_tmp.bin -if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then - AC_MSG_RESULT($Pac_CV_NAME) - CFLAGS="$CFLAGS -DXFS_MEMALIGN=$Pac_CV_NAME" -else - AC_MSG_RESULT(unavailable, assuming 128) - CFLAGS="$CFLAGS -DXFS_MEMALIGN=128" -fi -])dnl -dnl -dnl -dnl Look for a style of VPATH. Known forms are -dnl VPATH = .:dir -dnl .PATH: . dir -dnl -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 -define(PAC_MAKE_VPATH,[ -AC_SUBST(VPATH) -AC_MSG_CHECKING(for virtual path format) -rm -rf conftest* -mkdir conftestdir -cat >conftestdir/a.c < conftest <&1 | grep 'conftestdir/a.c'` -if test -n "$ac_out" ; then - AC_MSG_RESULT(VPATH) - VPATH='VPATH=.:$(srcdir)' -else - rm -f conftest - cat > conftest <&1 | grep 'conftestdir/a.c'` - if test -n "$ac_out" ; then - AC_MSG_RESULT(.PATH) - VPATH='.PATH: . $(srcdir)' - else - AC_MSG_RESULT(neither VPATH nor .PATH works) - fi -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 -define(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 -dnl -dnl AC_TRY_LINK(INCLUDES, FUNCTION-BODY, -dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) -define(AC_TRY_LINK, -if test -z "$ac_ext" ; then - ac_ext=c -fi -[cat > conftest.$ac_ext <> config.log ; fi -ifelse([$4], , , [rm -rf conftest* - $4 -])dnl -fi -rm -f conftest*] -)dnl -dnl -dnl -define(PAC_HAVE_MOUNT_NFS,[ - AC_MSG_CHECKING([if MOUNT_NFS is defined in the include files]) - rm -f conftest.c - cat > conftest.c < -#include - main() - { - int i=MOUNT_NFS; - } -EOF - rm -f conftest - $CC $USER_CFLAGS -o conftest conftest.c > /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MOUNT_NFS,,[Define if MOUNT_NFS defined]) - else - AC_MSG_RESULT(no) - fi - rm -f conftest conftest.c -])dnl -dnl -dnl -dnl PAC_MPI_OFFSET_KIND_4BYTE() -dnl -dnl tries to determine the Fortran 90 kind parameter for 4-byte integers -dnl -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 < kind.f - program main - integer i - i = selected_int_kind(8) - open(8, file="k.out", form="formatted") - write (8,*) i - close(8) - stop - end -EOF -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` - fi -fi -rm -f kind k.out kind.f kind.o -if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then - AC_MSG_RESULT($KINDVAL) - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)" -else - AC_MSG_RESULT(unavailable) -fi -])dnl -dnl -dnl -define(PAC_FUNC_STRERROR,[ - AC_MSG_CHECKING([for strerror()]) - rm -f conftest.c - cat > conftest.c < - main() - { - char *s = strerror(5); - } -EOF - rm -f conftest - $CC $USER_CFLAGS -o conftest conftest.c >> config.log 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_STRERROR,,[Define if strerror available]) - else - AC_MSG_RESULT(no) - AC_MSG_CHECKING([for sys_errlist]) - rm -f conftest.c -changequote(,) - cat > conftest.c < - main() - { - extern char *sys_errlist[]; - printf("%s\n", sys_errlist[34]); - } -EOF -changequote([,]) - rm -f conftest - $CC $USER_CFLAGS -o conftest conftest.c > config.log 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SYSERRLIST,,[Define if syserrlist available]) - else - AC_MSG_RESULT(no) - fi - fi - rm -f conftest conftest.c -])dnl -dnl -dnl -dnl -define(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 -define(AC_MSG_WARN,[AC_MSG_RESULT([Warning: $1])]) -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 ]) -dnl -define(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]]) -define(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 -define(PAC_TEST_MPIR_STATUS_SET_BYTES,[ - AC_MSG_CHECKING(if MPIR_Status_set_bytes is defined) - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status set bytes available]) - else - AC_MSG_RESULT(no) - fi - rm -f conftest mpitest.c -])dnl -dnl -dnl -dnl - diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/.state-cache new file mode 100644 index 0000000000..efed268922 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/.state-cache @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/Makefile.in new file mode 100644 index 0000000000..158dcf9fde --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/Makefile.in @@ -0,0 +1,47 @@ +CC = @CC@ +AR = @AR@ +LIBNAME = @LIBNAME@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include @CPPFLAGS@ +CFLAGS = @CFLAGS@ $(INCLUDES) -DBGL_OPTIM_STEP1_2=1 -DBGL_OPTIM_STEP1_1=1 + +C_COMPILE_SHL = $(CC_SHL) @CFLAGS@ $(INCLUDES) + +@VPATH@ + +AD_BGL_OBJECTS = \ + ad_bgl_open.o ad_bgl_close.o \ + ad_bgl_fcntl.o ad_bgl_flush.o \ + ad_bgl_read.o ad_bgl_write.o ad_bgl_getsh.o ad_bgl_setsh.o \ + ad_bgl.o ad_bgl_aggrs.o ad_bgl_pset.o ad_bgl_hints.o \ + ad_bgl_rdcoll.o ad_bgl_wrcoll.o ad_bgl_tuning.o + +default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +.c.o: + $(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< + @mv -f $*.o $*.lo + +$(LIBNAME): $(AD_BGL_OBJECTS) + $(AR) $(LIBNAME) $(AD_BGL_OBJECTS) + +AD_BGL_LOOBJECTS=$(AD_BGL_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_BGL_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_BGL_LOOBJECTS) + +coverage: + -@for file in ${AD_BGL_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.c new file mode 100644 index 0000000000..e17cf31fa1 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.c @@ -0,0 +1,60 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl.c + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2001 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_bgl.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_BGL_operations = { + ADIOI_BGL_Open, /* Open */ + ADIOI_GEN_OpenColl, /* Collective open */ + ADIOI_BGL_ReadContig, /* ReadContig */ + ADIOI_BGL_WriteContig, /* WriteContig */ +#if BGL_OPTIM_STEP1_2 + ADIOI_BGL_ReadStridedColl, /* ReadStridedColl */ + ADIOI_BGL_WriteStridedColl, /* WriteStridedColl */ +#else + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ +#endif + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_BGL_Fcntl, /* Fcntl */ +#if BGL_OPTIM_STEP1_1 + ADIOI_BGL_SetInfo, /* SetInfo */ +#else + ADIOI_GEN_SetInfo, /* SetInfo */ +#endif + ADIOI_BGL_ReadStrided, /* ReadStrided */ + ADIOI_BGL_WriteStrided, /* WriteStrided */ + ADIOI_BGL_Close, /* Close */ +#ifdef ROMIO_HAVE_WORKING_AIO +#warning Consider BG support for NFS before enabling this. + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + 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_BGL_Flush, /* Flush */ + ADIOI_GEN_Resize, /* Resize */ + ADIOI_GEN_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ +}; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.h b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.h new file mode 100644 index 0000000000..89d247b0df --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl.h @@ -0,0 +1,97 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl.h + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#ifndef AD_BGL_INCLUDE +#define AD_BGL_INCLUDE + +#include +#include +#include +#include +#include "adio.h" + +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif + +#if 0 +int ADIOI_BGL_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, + int wr, void *handle); +#endif + +void ADIOI_BGL_Open(ADIO_File fd, int *error_code); + +void ADIOI_BGL_Close(ADIO_File fd, int *error_code); + +void ADIOI_BGL_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_BGL_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code); +#if 0 +void ADIOI_BGL_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_BGL_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_BGL_ReadDone(ADIO_Request *request, ADIO_Status *status, int + *error_code); +int ADIOI_BGL_WriteDone(ADIO_Request *request, ADIO_Status *status, int + *error_code); +void ADIOI_BGL_ReadComplete(ADIO_Request *request, ADIO_Status *status, int + *error_code); +void ADIOI_BGL_WriteComplete(ADIO_Request *request, ADIO_Status *status, + int *error_code); +#endif +void ADIOI_BGL_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int + *error_code); +void ADIOI_BGL_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); + +void ADIOI_BGL_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_BGL_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_BGL_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_BGL_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_BGL_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp, int *error_code); +void ADIOI_BGL_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); + +void ADIOI_BGL_Flush(ADIO_File fd, int *error_code); + +#include "ad_bgl_tuning.h" + + +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.c new file mode 100644 index 0000000000..cbfbb232ec --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.c @@ -0,0 +1,966 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_aggrs.c + * \brief The externally used function from this file is is declared in ad_bgl_aggrs.h + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997-2001 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_cb_config_list.h" +#include "ad_bgl.h" +#include "ad_bgl_pset.h" +#include "ad_bgl_aggrs.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +#ifdef USE_DBG_LOGGING + #define AGG_DEBUG 1 +#endif + + + +static int aggrsInPsetSize=0; +static int *aggrsInPset=NULL; + +/* Comments copied from common: + * This file contains four functions: + * + * ADIOI_Calc_aggregator() + * ADIOI_Calc_file_domains() + * ADIOI_Calc_my_req() + * ADIOI_Calc_others_req() + * + * The last three of these were originally in ad_read_coll.c, but they are + * also shared with ad_write_coll.c. I felt that they were better kept with + * the rest of the shared aggregation code. + */ + +/* Discussion of values available from above: + * + * ADIO_Offset st_offsets[0..nprocs-1] + * ADIO_Offset end_offsets[0..nprocs-1] + * These contain a list of start and end offsets for each process in + * the communicator. For example, an access at loc 10, size 10 would + * have a start offset of 10 and end offset of 19. + * int nprocs + * number of processors in the collective I/O communicator + * ADIO_Offset min_st_offset + * ADIO_Offset fd_start[0..nprocs_for_coll-1] + * starting location of "file domain"; region that a given process will + * perform aggregation for (i.e. actually do I/O) + * ADIO_Offset fd_end[0..nprocs_for_coll-1] + * start + size - 1 roughly, but it can be less, or 0, in the case of + * uneven distributions + */ + +/* forward declaration */ +static void +ADIOI_BGL_compute_agg_ranklist_serial ( ADIO_File fd, + const ADIOI_BGL_ConfInfo_t *confInfo, + ADIOI_BGL_ProcInfo_t *all_procInfo, + int *aggrsInPset ); + +/* + * Compute the aggregator-related parameters that are required in 2-phase collective IO of ADIO. + * The parameters are + * . the number of aggregators (proxies) : fd->hints->cb_nodes + * . the ranks of the aggregators : fd->hints->ranklist + * By compute these two parameters in a BGL-PSET-aware way, the default 2-phase collective IO of + * ADIO can work more efficiently. + */ +int +ADIOI_BGL_gen_agg_ranklist(ADIO_File fd, int n_aggrs_per_pset) +{ + int r, s; + ADIOI_BGL_ProcInfo_t *procInfo, *all_procInfo; + ADIOI_BGL_ConfInfo_t *confInfo; + + MPI_Comm_size( fd->comm, &s ); + MPI_Comm_rank( fd->comm, &r ); + + /* Collect individual BGL personality information */ + confInfo = ADIOI_BGL_ConfInfo_new (); + procInfo = ADIOI_BGL_ProcInfo_new (); + ADIOI_BGL_persInfo_init( confInfo, procInfo, s, r, n_aggrs_per_pset ); + + /* Gather BGL personality infomation onto process 0 */ + // if (r == 0) + all_procInfo = ADIOI_BGL_ProcInfo_new_n (s); + if(s > aggrsInPsetSize) + { + if(aggrsInPset) ADIOI_Free(aggrsInPset); + aggrsInPset = (int *) ADIOI_Malloc (s *sizeof(int)); + aggrsInPsetSize = s; + } + + + MPI_Gather( (void *)procInfo, sizeof(ADIOI_BGL_ProcInfo_t), MPI_BYTE, + (void *)all_procInfo, sizeof(ADIOI_BGL_ProcInfo_t), MPI_BYTE, + 0, + fd->comm ); + + /* Compute a list of the ranks of chosen IO proxy CN on process 0 */ + if (r == 0) { + ADIOI_BGL_compute_agg_ranklist_serial (fd, confInfo, all_procInfo, aggrsInPset); + // ADIOI_BGL_ProcInfo_free (all_procInfo); + } + ADIOI_BGL_ProcInfo_free (all_procInfo); + + /* Send the info of IO proxy CN to all processes and keep the info in fd->hints struct. + Declared in adio_cb_config_list.h */ + ADIOI_cb_bcast_rank_map(fd); + + /* Broadcast the BGL-GPFS related file domain info */ + MPI_Bcast( (void *)aggrsInPset, + fd->hints->cb_nodes * sizeof(int), MPI_BYTE, + 0, + fd->comm ); + + ADIOI_BGL_persInfo_free( confInfo, procInfo ); + return 0; +} + +/* + * the purpose of abstracting out this routine is to make it easy for trying different proxy-selection criteria. + */ +static int +ADIOI_BGL_select_agg_in_pset (const ADIOI_BGL_ConfInfo_t *confInfo, + ADIOI_BGL_ProcInfo_t *pset_procInfo, + int nCN_in_pset, + int *tmp_ranklist) +{ +/* first implementation, based on their rank order. */ + + int i, j, k; + + /* The number of aggregators in the PSET is proportional to the CNs in the PSET */ + int nAggrs = nCN_in_pset * confInfo->aggRatio; + if (nAggrs < ADIOI_BGL_NAGG_PSET_MIN) nAggrs = ADIOI_BGL_NAGG_PSET_MIN; + + /* for not virtual-node-mode, pick aggregators in this PSET based on the order of the global rank */ + if (!confInfo->isVNM) + { + for (i=0; icpuidSize; k++){ + for (i=0; i< nCN_in_pset ; i++) { + if (pset_procInfo[i].cpuid == k) + tmp_ranklist[j++] = pset_procInfo[i].rank; + if ( j >= nAggrs) break; + } + if ( j >= nAggrs) break; + } + } + + return nAggrs; +} + +/* + * Pick IO aggregators based on the under PSET organization and stores the ranks of the proxy CNs in tmp_ranklist. + * The first order of tmp_ranklist is : PSET number + * The secondary order of the list is determined in ADIOI_BGL_select_agg_in_pset() and thus adjustable. + */ +static int +ADIOI_BGL_compute_agg_ranklist_serial_do (const ADIOI_BGL_ConfInfo_t *confInfo, + ADIOI_BGL_ProcInfo_t *all_procInfo, + int *aggrsInPset, + int *tmp_ranklist) +{ + int i, j; + + /* a list of the numbers of all the PSETS */ + int *psetNumList = (int *) ADIOI_Malloc ( confInfo->nProcs * sizeof(int) ); + + /* sweep through all processes' records, collect the numbers of all the PSETS. + * The reason for not doing MIN, MAX is that the owned PSETs may not have contiguous numbers */ + int n_psets=0; + for (i=0; inProcs; i++) { + + ADIOI_BGL_ProcInfo_t *info_p = all_procInfo+i; + + int exist = 0; + for (j=n_psets-1; j>=0; j--) + if (info_p->psetNum == psetNumList[j]) { exist=1; break; } + + if (!exist) { + psetNumList [n_psets] = info_p->psetNum; + n_psets ++; + } + } + + /* bucket sort: put the CN nodes into ordered buckets, each of which represents a PSET */ + + /* bucket space for bucket sort */ + ADIOI_BGL_ProcInfo_t *sorted_procInfo = ADIOI_BGL_ProcInfo_new_n ( n_psets * confInfo->virtualPsetSize ); + int *PsetIdx = (int *) ADIOI_Malloc ( n_psets * sizeof(int) ); + AD_BGL_assert ( (PsetIdx != NULL) ); + + /* initialize bucket pointer */ + for (i=0; ivirtualPsetSize; + } + + /* sort */ + for (i=0; inProcs; i++) { + int pset_id = all_procInfo[i].psetNum; + + for (j=n_psets-1; j>=0; j--) if (pset_id == psetNumList[j]) break; + AD_BGL_assert ( (j >= 0) ); /* got to find a PSET bucket */ + + sorted_procInfo[ PsetIdx[j] ++ ] = all_procInfo[i]; + } + + ADIOI_Free(psetNumList); + + /* select a number of CN aggregators from each Pset */ + int naggs = 0; + for (i=0; ivirtualPsetSize; + + /* select aggregators and put them into tmp_ranklist contiguously. */ + int local_naggs = ADIOI_BGL_select_agg_in_pset( confInfo, + sorted_procInfo + i*confInfo->virtualPsetSize, + nCN_in_pset, + tmp_ranklist + naggs); + aggrsInPset[i+1] = local_naggs; + + naggs += local_naggs; + } + aggrsInPset[0] = n_psets; + + /* leave */ + ADIOI_Free ( PsetIdx ); + ADIOI_BGL_ProcInfo_free ( sorted_procInfo ); + return naggs; +} + +/* + * compute aggregators ranklist and put it into fd->hints struct + */ +static void +ADIOI_BGL_compute_agg_ranklist_serial ( ADIO_File fd, + const ADIOI_BGL_ConfInfo_t *confInfo, + ADIOI_BGL_ProcInfo_t *all_procInfo, + int *aggrsInPset ) +{ +# if AGG_DEBUG + int i; +# endif + int naggs; + int *tmp_ranklist; + + /* compute the ranklist of IO aggregators and put into tmp_ranklist */ + tmp_ranklist = (int *) ADIOI_Malloc (confInfo->nProcs * sizeof(int)); + +# if AGG_DEBUG + for (i=0; inProcs; i++) { + DBG_FPRINTF(stderr, "\tcpuid %1d, rank = %6d\n", all_procInfo[i].cpuid, all_procInfo[i].rank ); + } +# endif + + naggs = + ADIOI_BGL_compute_agg_ranklist_serial_do (confInfo, all_procInfo, aggrsInPset, tmp_ranklist); + +# define VERIFY 0 +# if VERIFY + DBG_FPRINTF(stderr, "\tconfInfo = %3d,%3d,%3d,%3d,%3d,%3d,%.4f; naggs = %d\n", + confInfo->PsetSize , + confInfo->numPsets , + confInfo->isVNM , + confInfo->virtualPsetSize , + confInfo->nProcs , + confInfo->nAggrs , + confInfo->aggRatio , + naggs ); +# endif + +# if AGG_DEBUG + for (i=0; ihints */ + if(fd->hints->ranklist != NULL) ADIOI_Free (fd->hints->ranklist); + + fd->hints->cb_nodes = naggs; + fd->hints->ranklist = (int *) ADIOI_Malloc (naggs * sizeof(int)); + memcpy( fd->hints->ranklist, tmp_ranklist, naggs*sizeof(int) ); + + /* */ + ADIOI_Free( tmp_ranklist ); + return; +} + +/* Description from common/ad_aggregate.c. (Does it completely apply to bgl?) + * ADIOI_Calc_aggregator() + * + * The intention here is to implement a function which provides basically + * the same functionality as in Rajeev's original version of + * ADIOI_Calc_my_req(). He used a ceiling division approach to assign the + * file domains, and we use the same approach here when calculating the + * location of an offset/len in a specific file domain. Further we assume + * this same distribution when calculating the rank_index, which is later + * used to map to a specific process rank in charge of the file domain. + * + * A better (i.e. more general) approach would be to use the list of file + * domains only. This would be slower in the case where the + * original ceiling division was used, but it would allow for arbitrary + * distributions of regions to aggregators. We'd need to know the + * nprocs_for_coll in that case though, which we don't have now. + * + * Note a significant difference between this function and Rajeev's old code: + * this code doesn't necessarily return a rank in the range + * 0..nprocs_for_coll; instead you get something in 0..nprocs. This is a + * result of the rank mapping; any set of ranks in the communicator could be + * used now. + * + * Returns an integer representing a rank in the collective I/O communicator. + * + * The "len" parameter is also modified to indicate the amount of data + * actually available in this file domain. + */ +/* + * This is more general aggregator search function which does not base on the assumption + * that each aggregator hosts the file domain with the same size + */ +int ADIOI_BGL_Calc_aggregator(ADIO_File fd, + ADIO_Offset off, + ADIO_Offset min_off, + ADIO_Offset *len, + ADIO_Offset fd_size, + ADIO_Offset *fd_start, + ADIO_Offset *fd_end) +{ + int rank_index, rank; + ADIO_Offset avail_bytes; + + AD_BGL_assert ( (off <= fd_end[fd->hints->cb_nodes-1] && off >= min_off && fd_start[0] >= min_off ) ); + + /* binary search --> rank_index is returned */ + int ub = fd->hints->cb_nodes; + int lb = 0; + /* get an index into our array of aggregators */ + /* Common code for striping - bgl doesn't use it but it's + here to make diff'ing easier. + rank_index = (int) ((off - min_off + fd_size)/ fd_size - 1); + + if (fd->hints->striping_unit > 0) { + * wkliao: implementation for file domain alignment + fd_start[] and fd_end[] have been aligned with file lock + boundaries when returned from ADIOI_Calc_file_domains() so cannot + just use simple arithmatic as above * + rank_index = 0; + while (off > fd_end[rank_index]) rank_index++; + } + bgl does it's own striping below + */ + rank_index = fd->hints->cb_nodes / 2; + while ( off < fd_start[rank_index] || off > fd_end[rank_index] ) { + if ( off > fd_end [rank_index] ) { + lb = rank_index; + rank_index = (rank_index + ub) / 2; + } + else + if ( off < fd_start[rank_index] ) { + ub = rank_index; + rank_index = (rank_index + lb) / 2; + } + } + /* we index into fd_end with rank_index, and fd_end was allocated to be no + * bigger than fd->hins->cb_nodes. If we ever violate that, we're + * overrunning arrays. Obviously, we should never ever hit this abort */ + if (rank_index >= fd->hints->cb_nodes || rank_index < 0) { + FPRINTF(stderr, "Error in ADIOI_Calc_aggregator(): rank_index(%d) >= fd->hints->cb_nodes (%d) fd_size=%lld off=%lld\n", + rank_index,fd->hints->cb_nodes,fd_size,off); + MPI_Abort(MPI_COMM_WORLD, 1); + } + // DBG_FPRINTF ("ADIOI_BGL_Calc_aggregator: rank_index = %d\n", rank_index ); + + /* + * remember here that even in Rajeev's original code it was the case that + * different aggregators could end up with different amounts of data to + * aggregate. here we use fd_end[] to make sure that we know how much + * data this aggregator is working with. + * + * the +1 is to take into account the end vs. length issue. + */ + avail_bytes = fd_end[rank_index] + 1 - off; + if (avail_bytes < *len && avail_bytes > 0) { + /* this file domain only has part of the requested contig. region */ + + *len = avail_bytes; + } + + /* map our index to a rank */ + /* NOTE: FOR NOW WE DON'T HAVE A MAPPING...JUST DO 0..NPROCS_FOR_COLL */ + rank = fd->hints->ranklist[rank_index]; + + return rank; +} + +/* + * Compute a dynamic access range based file domain partition among I/O aggregators, + * which align to the GPFS block size + * Divide the I/O workload among "nprocs_for_coll" processes. This is + * done by (logically) dividing the file into file domains (FDs); each + * process may directly access only its own file domain. + * Additional effort is to make sure that each I/O aggregator get + * a file domain that aligns to the GPFS block size. So, there will + * not be any false sharing of GPFS file blocks among multiple I/O nodes. + * + * The common version of this now accepts a min_fd_size and striping_unit. + * It doesn't seem necessary here (using GPFS block sizes) but keep it in mind + * (e.g. we could pass striping unit instead of using fs_ptr->blksize). + */ +void ADIOI_BGL_GPFS_Calc_file_domains(ADIO_Offset *st_offsets, + ADIO_Offset *end_offsets, + int nprocs, + int nprocs_for_coll, + ADIO_Offset *min_st_offset_ptr, + ADIO_Offset **fd_start_ptr, + ADIO_Offset **fd_end_ptr, + ADIO_Offset *fd_size_ptr, + void *fs_ptr) +{ + ADIO_Offset min_st_offset, max_end_offset, *fd_start, *fd_end, *fd_size; + int i, aggr; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5004, 0, NULL); +#endif + +# if AGG_DEBUG + static char myname[] = "ADIOI_BGL_GPFS_Calc_file_domains"; + DBG_FPRINTF(stderr, "%s(%d): %d aggregator(s)\n", + myname,__LINE__,nprocs_for_coll); +# endif + __blksize_t blksize = 1048576; /* default to 1M */ + if(fs_ptr && ((ADIOI_BGL_fs*)fs_ptr)->blksize) /* ignore null ptr or 0 blksize */ + blksize = ((ADIOI_BGL_fs*)fs_ptr)->blksize; +# if AGG_DEBUG + DBG_FPRINTF(stderr,"%s(%d): Blocksize=%ld\n",myname,__LINE__,blksize); +# endif +/* find min of start offsets and max of end offsets of all processes */ + min_st_offset = st_offsets [0]; + max_end_offset = end_offsets[0]; + for (i=1; ihints->cb_nodes; i++) + if (fd->hints->ranklist[i] == myrank) return i; + return -1; +} + +/* + * ADIOI_BGL_Calc_my_req() overrides ADIOI_Calc_my_req for the default implementation + * is specific for static file domain partitioning. + * + * ADIOI_Calc_my_req() - calculate what portions of the access requests + * of this process are located in the file domains of various processes + * (including this one) + */ +void ADIOI_BGL_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list, ADIO_Offset *len_list, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset *fd_start, + ADIO_Offset *fd_end, ADIO_Offset fd_size, + int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access **my_req_ptr, + int **buf_idx_ptr) +/* Possibly reconsider if buf_idx's are ok as int's, or should they be aints/offsets? + They are used as memory buffer indices so it seems like the 2G limit is in effect */ +{ + int *count_my_req_per_proc, count_my_req_procs, *buf_idx; + int i, l, proc; + ADIO_Offset fd_len, rem_len, curr_idx, off; + ADIOI_Access *my_req; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5024, 0, NULL); +#endif + + *count_my_req_per_proc_ptr = (int *) ADIOI_Calloc(nprocs,sizeof(int)); + count_my_req_per_proc = *count_my_req_per_proc_ptr; +/* count_my_req_per_proc[i] gives the no. of contig. requests of this + process in process i's file domain. calloc initializes to zero. + I'm allocating memory of size nprocs, so that I can do an + MPI_Alltoall later on.*/ + + buf_idx = (int *) ADIOI_Malloc(nprocs*sizeof(int)); +/* buf_idx is relevant only if buftype_is_contig. + buf_idx[i] gives the index into user_buf where data received + from proc. i should be placed. This allows receives to be done + without extra buffer. This can't be done if buftype is not contig. */ + + /* initialize buf_idx to -1 */ + for (i=0; i < nprocs; i++) buf_idx[i] = -1; + + /* one pass just to calculate how much space to allocate for my_req; + * contig_access_count was calculated way back in ADIOI_Calc_my_off_len() + */ + for (i=0; i < contig_access_count; i++) { + /* short circuit offset/len processing if len == 0 + * (zero-byte read/write */ + if (len_list[i] == 0) + continue; + off = offset_list[i]; + fd_len = len_list[i]; + /* note: we set fd_len to be the total size of the access. then + * ADIOI_Calc_aggregator() will modify the value to return the + * amount that was available from the file domain that holds the + * first part of the access. + */ + proc = ADIOI_BGL_Calc_aggregator(fd, off, min_st_offset, &fd_len, fd_size, + fd_start, fd_end); + count_my_req_per_proc[proc]++; + + /* figure out how much data is remaining in the access (i.e. wasn't + * part of the file domain that had the starting byte); we'll take + * care of this data (if there is any) in the while loop below. + */ + rem_len = len_list[i] - fd_len; + + while (rem_len > 0) { + off += fd_len; /* point to first remaining byte */ + fd_len = rem_len; /* save remaining size, pass to calc */ + proc = ADIOI_BGL_Calc_aggregator(fd, off, min_st_offset, &fd_len, + fd_size, fd_start, fd_end); + + count_my_req_per_proc[proc]++; + rem_len -= fd_len; /* reduce remaining length by amount from fd */ + } + } + +/* now allocate space for my_req, offset, and len */ + + *my_req_ptr = (ADIOI_Access *) + ADIOI_Malloc(nprocs*sizeof(ADIOI_Access)); + my_req = *my_req_ptr; + + count_my_req_procs = 0; + for (i=0; i < nprocs; i++) { + if (count_my_req_per_proc[i]) { + my_req[i].offsets = (ADIO_Offset *) + ADIOI_Malloc(count_my_req_per_proc[i] * sizeof(ADIO_Offset)); + my_req[i].lens = (int *) + ADIOI_Malloc(count_my_req_per_proc[i] * sizeof(int)); + count_my_req_procs++; + } + my_req[i].count = 0; /* will be incremented where needed + later */ + } + +/* now fill in my_req */ + curr_idx = 0; + for (i=0; i 0) { + off += fd_len; + fd_len = rem_len; + proc = ADIOI_BGL_Calc_aggregator(fd, off, min_st_offset, &fd_len, + fd_size, fd_start, fd_end); + + if (buf_idx[proc] == -1) + { + ADIOI_Assert(curr_idx == (int) curr_idx); + buf_idx[proc] = (int) curr_idx; + } + + l = my_req[proc].count; + curr_idx += fd_len; + rem_len -= fd_len; + + my_req[proc].offsets[l] = off; + ADIOI_Assert(fd_len == (int) fd_len); + my_req[proc].lens[l] = (int) fd_len; + my_req[proc].count++; + } + } + +#ifdef AGG_DEBUG + for (i=0; i 0) { + DBG_FPRINTF(stderr, "data needed from %d (count = %d):\n", i, + my_req[i].count); + for (l=0; l < my_req[i].count; l++) { + DBG_FPRINTF(stderr, " off[%d] = %lld, len[%d] = %d\n", l, + my_req[i].offsets[l], l, my_req[i].lens[l]); + } + } + DBG_FPRINTF(stderr, "buf_idx[%d] = 0x%x\n", i, buf_idx[i]); + } +#endif + + *count_my_req_procs_ptr = count_my_req_procs; + *buf_idx_ptr = buf_idx; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5025, 0, NULL); +#endif +} + +/* + * ADIOI_Calc_others_req (copied to bgl and switched to all to all for performance) + * + * param[in] count_my_req_procs Number of processes whose file domain my + * request touches. + * param[in] count_my_req_per_proc count_my_req_per_proc[i] gives the no. of + * contig. requests of this process in + * process i's file domain. + * param[in] my_req A structure defining my request + * param[in] nprocs Number of nodes in the block + * param[in] myrank Rank of this node + * param[out] count_others_req_proc_ptr Number of processes whose requests lie in + * my process's file domain (including my + * process itself) + * param[out] others_req_ptr Array of other process' requests that lie + * in my process's file domain + */ +void ADIOI_BGL_Calc_others_req(ADIO_File fd, int count_my_req_procs, + int *count_my_req_per_proc, + ADIOI_Access *my_req, + int nprocs, int myrank, + int *count_others_req_procs_ptr, + ADIOI_Access **others_req_ptr) +{ +/* determine what requests of other processes lie in this process's + file domain */ + +/* count_others_req_procs = number of processes whose requests lie in + this process's file domain (including this process itself) + count_others_req_per_proc[i] indicates how many separate contiguous + requests of proc. i lie in this process's file domain. */ + + int *count_others_req_per_proc, count_others_req_procs; + int i; + ADIOI_Access *others_req; + + /* Parameters for MPI_Alltoallv */ + int *scounts, *sdispls, *rcounts, *rdispls; + + /* Parameters for MPI_Alltoallv. These are the buffers, which + * are later computed to be the lowest address of all buffers + * to be sent/received for offsets and lengths. Initialize to + * the highest possible address which is the current minimum. + */ + void *sendBufForOffsets=(void*)0xFFFFFFFF, + *sendBufForLens =(void*)0xFFFFFFFF, + *recvBufForOffsets=(void*)0xFFFFFFFF, + *recvBufForLens =(void*)0xFFFFFFFF; + +/* first find out how much to send/recv and from/to whom */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5026, 0, NULL); +#endif + /* Send 1 int to each process. count_my_req_per_proc[i] is the number of + * requests that my process will do to the file domain owned by process[i]. + * Receive 1 int from each process. count_others_req_per_proc[i] is the number of + * requests that process[i] will do to the file domain owned by my process. + */ + count_others_req_per_proc = (int *) ADIOI_Malloc(nprocs*sizeof(int)); +/* cora2a1=timebase(); */ + MPI_Alltoall(count_my_req_per_proc, 1, MPI_INT, + count_others_req_per_proc, 1, MPI_INT, fd->comm); +/* total_cora2a+=timebase()-cora2a1; */ + + /* Allocate storage for an array of other nodes' accesses of our + * node's file domain. Also allocate storage for the alltoallv + * parameters. + */ + *others_req_ptr = (ADIOI_Access *) + ADIOI_Malloc(nprocs*sizeof(ADIOI_Access)); + others_req = *others_req_ptr; + + scounts = ADIOI_Malloc(nprocs*sizeof(int)); + sdispls = ADIOI_Malloc(nprocs*sizeof(int)); + rcounts = ADIOI_Malloc(nprocs*sizeof(int)); + rdispls = ADIOI_Malloc(nprocs*sizeof(int)); + + /* If process[i] has any requests in my file domain, + * initialize an ADIOI_Access structure that will describe each request + * from process[i]. The offsets, lengths, and buffer pointers still need + * to be obtained to complete the setting of this structure. + */ + count_others_req_procs = 0; + for (i=0; icomm); + + /************************/ + /* Exchange the lengths */ + /************************/ + + for (i=0; icomm); + + /* Clean up */ + ADIOI_Free(count_others_req_per_proc); + ADIOI_Free (scounts); + ADIOI_Free (sdispls); + ADIOI_Free (rcounts); + ADIOI_Free (rdispls); + + *count_others_req_procs_ptr = count_others_req_procs; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5027, 0, NULL); +#endif +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.h b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.h new file mode 100644 index 0000000000..ffa9ec0f77 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_aggrs.h @@ -0,0 +1,108 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_aggrs.h + * \brief ??? + */ + +/* + * File: ad_bgl_aggrs.h + * + * Declares functions specific for BG/L - GPFS parallel I/O solution. The implemented optimizations are: + * . Aligned file-domain partitioning, integrated in 7/28/2005 + * + * In addition, following optimizations are planned: + * . Integrating multiple file-domain partitioning schemes + * (corresponding to Alok Chouhdary's persistent file domain work). + */ + +#ifndef AD_BGL_AGGRS_H_ +#define AD_BGL_AGGRS_H_ + +#include "adio.h" +#include + +#if !defined(GPFS_SUPER_MAGIC) + #define GPFS_SUPER_MAGIC (0x47504653) +#endif + +#if !defined(PVFS2_SUPER_MAGIC) + #define PVFS2_SUPER_MAGIC (0x20030528) +#endif + + /* File system (BGL) specific information - + hung off of ADIOI_FileD file descriptor (fd->fs_ptr) at open */ + typedef struct ADIOI_BGL_fs_s { + __blksize_t blksize; + int fsync_aggr; /* "fsync aggregation" flags (below) */ +#define ADIOI_BGL_FSYNC_AGGREGATION_DISABLED 0x00 +#define ADIOI_BGL_FSYNC_AGGREGATION_ENABLED 0x01 +#define ADIOI_BGL_FSYNC_AGGREGATOR 0x10 /* This rank is an aggregator */ + } ADIOI_BGL_fs; + + /* generate a list of I/O aggregators that utilizes BGL-PSET orginization. */ + int ADIOI_BGL_gen_agg_ranklist(ADIO_File fd, int n_aggrs_per_pset); + + /* overriding ADIOI_Calc_file_domains() to apply 'aligned file domain partitioning'. */ + void ADIOI_BGL_GPFS_Calc_file_domains(ADIO_Offset *st_offsets, + ADIO_Offset *end_offsets, + int nprocs, + int nprocs_for_coll, + ADIO_Offset *min_st_offset_ptr, + ADIO_Offset **fd_start_ptr, + ADIO_Offset **fd_end_ptr, + ADIO_Offset *fd_size_ptr, + void *fs_ptr); + + /* a utilitiy function for debugging */ + int ADIOI_BGL_Aggrs_index(ADIO_File fd, int myrank ); + + /* overriding ADIOI_Calc_aggregator() for the default implementation is specific for + static file domain partitioning */ + int ADIOI_BGL_Calc_aggregator(ADIO_File fd, + ADIO_Offset off, + ADIO_Offset min_off, + ADIO_Offset *len, + ADIO_Offset fd_size, + ADIO_Offset *fd_start, + ADIO_Offset *fd_end); + + /* overriding ADIOI_Calc_my_req for the default implementation is specific for + static file domain partitioning */ + void ADIOI_BGL_Calc_my_req ( ADIO_File fd, ADIO_Offset *offset_list, ADIO_Offset *len_list, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset *fd_start, + ADIO_Offset *fd_end, ADIO_Offset fd_size, + int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access **my_req_ptr, + int **buf_idx_ptr); + + /* + * ADIOI_Calc_others_req + * + * param[in] count_my_req_procs Number of processes whose file domain my + * request touches. + * param[in] count_my_req_per_proc count_my_req_per_proc[i] gives the no. of + * contig. requests of this process in + * process i's file domain. + * param[in] my_req A structure defining my request + * param[in] nprocs Number of nodes in the block + * param[in] myrank Rank of this node + * param[out] count_others_req_proc_ptr Number of processes whose requests lie in + * my process's file domain (including my + * process itself) + * param[out] others_req_ptr Array of other process' requests that lie + * in my process's file domain + */ + void ADIOI_BGL_Calc_others_req(ADIO_File fd, int count_my_req_procs, + int *count_my_req_per_proc, + ADIOI_Access *my_req, + int nprocs, int myrank, + int *count_others_req_procs_ptr, + ADIOI_Access **others_req_ptr); + + +#endif /* AD_BGL_AGGRS_H_ */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_close.c new file mode 100644 index 0000000000..8fcf857507 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_close.c @@ -0,0 +1,53 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_close.c + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_bgl.h" +#include "ad_bgl_aggrs.h" + +void ADIOI_BGL_Close(ADIO_File fd, int *error_code) +{ + int err, derr=0; + static char myname[] = "ADIOI_BGL_CLOSE"; + +#ifdef PROFILE + MPE_Log_event(9, 0, "start close"); +#endif + + err = close(fd->fd_sys); + if (fd->fd_direct >= 0) + { + derr = close(fd->fd_direct); + } + +#ifdef PROFILE + MPE_Log_event(10, 0, "end close"); +#endif + +/* FPRINTF(stderr,"%s(%d):'%s'. Free %#X\n",myname,__LINE__,fd->filename,(int)fd->fs_ptr);*/ + if (fd->fs_ptr != NULL) { + ADIOI_Free(fd->fs_ptr); + fd->fs_ptr = NULL; + } + fd->fd_sys = -1; + fd->fd_direct = -1; + + if (err == -1 || derr == -1) + { + *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; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_fcntl.c new file mode 100644 index 0000000000..afae2c2988 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_fcntl.c @@ -0,0 +1,58 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_fcntl.c + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_bgl.h" +#include "adio_extern.h" +/* #ifdef MPISGI +#include "mpisgi2.h" +#endif */ + +void ADIOI_BGL_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, + int *error_code) +{ + static char myname[] = "ADIOI_BGL_FCNTL"; + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); + if (fd->fp_sys_posn != -1) + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); + if (fcntl_struct->fsize == -1) { + *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; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + 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; + break; + + /* --BEGIN ERROR HANDLING-- */ + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "**flag", "**flag %d", flag); + /* --END ERROR HANDLING-- */ + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_flush.c new file mode 100644 index 0000000000..97fd2ca99e --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_flush.c @@ -0,0 +1,90 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_flush.c + * \brief Scalable flush based on underlying filesystem and psets + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_bgl.h" +#include "ad_bgl_aggrs.h" + +void ADIOI_BGL_Flush(ADIO_File fd, int *error_code) +{ + int err=0; + static char myname[] = "ADIOI_BGL_FLUSH"; + + + if(((ADIOI_BGL_fs*)fd->fs_ptr)->fsync_aggr & ADIOI_BGL_FSYNC_AGGREGATION_ENABLED) + { + int rank; + + /* Barrier so we can collectively do fewer fsync's */ + MPI_Barrier(fd->comm); + + MPI_Comm_rank(fd->comm, &rank); + + /* All ranks marked as "fsync aggregators" should fsync. + (We currently only do one fsync on rank 0 but this is general + enough to support >1 aggregator using allreduce to get the + results instead of simply bcast'ing the results from rank 0.)*/ + if(((ADIOI_BGL_fs*)fd->fs_ptr)->fsync_aggr & ADIOI_BGL_FSYNC_AGGREGATOR) + { + err = fsync(fd->fd_sys); + DBG_FPRINTF(stderr,"aggregation:fsync %s, err=%#X, errno=%#X\n",fd->filename, err, errno); + /* We want errno, not the return code if it failed */ + if (err == -1) err = errno; + else err = 0; + } + /* Just pick an errno (using unsigned MPI_MAX) from any failures */ + MPI_Allreduce( MPI_IN_PLACE, (unsigned*)&err, 1, MPI_UNSIGNED, MPI_MAX, fd->comm); + DBGV_FPRINTF(stderr,"aggregation result:fsync %s, errno %#X,\n",fd->filename, err); + + if (err) /* if it's non-zero, it must be an errno */ + { + errno = err; + err = -1; + } + } + else /* Non-aggregated fsync */ + { +#ifdef USE_DBG_LOGGING + int rank; +#endif + err = fsync(fd->fd_sys); +#ifdef USE_DBG_LOGGING + MPI_Comm_rank(fd->comm, &rank); + + if(rank == 0) + { + DBG_FPRINTF(stderr,"no aggregation:fsync %s, err=%#X, errno=%#X\n",fd->filename, err, errno); + } + else + { + DBGV_FPRINTF(stderr,"no aggregation:fsync %s, err=%#X, errno=%#X\n",fd->filename, err, errno); + } +#endif + } + + /* --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)); + DBGT_FPRINTF(stderr,"fsync %s, err=%#X, errno=%#X\n",fd->filename, err, errno); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; +} + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_getsh.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_getsh.c new file mode 100644 index 0000000000..2c51b1f357 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_getsh.c @@ -0,0 +1,84 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_getsh.c + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_bgl.h" + +/* returns the current location of the shared_fp in terms of the + no. of etypes relative to the current view, and also increments the + shared_fp by the number of etypes to be accessed (incr) in the read + or write following this function. */ + +void ADIOI_BGL_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp, + int *error_code) +{ + ADIO_Offset new_fp; + int err; + MPI_Comm dupcommself; + static char myname[] = "ADIOI_BGL_GET_SHARED_FP"; + + 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, + fd->fns, + ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, + 0, + MPI_BYTE, + MPI_BYTE, + 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)); + err = read(fd->shared_fp_fd->fd_sys, shared_fp, sizeof(ADIO_Offset)); + /* if the file is empty, the above read may return error + (reading beyond end of file). In that case, shared_fp = 0, + set above, is the correct value. */ + } + else { + ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, 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)); + *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; + + 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)); + if (err == -1) { + *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; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_hints.c new file mode 100644 index 0000000000..d106eeaef6 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_hints.c @@ -0,0 +1,542 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_hints.c + * \brief BlueGene hint processing + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" + +#include "ad_bgl.h" +#include "ad_bgl_pset.h" +#include "ad_bgl_aggrs.h" + +#define ADIOI_BGL_CB_BUFFER_SIZE_DFLT "16777216" +#define ADIOI_BGL_IND_RD_BUFFER_SIZE_DFLT "4194304" +#define ADIOI_BGL_IND_WR_BUFFER_SIZE_DFLT "4194304" +#define ADIOI_BGL_NAGG_IN_PSET_HINT_NAME "bgl_nodes_pset" +/** \page mpiio_vars MPIIO Configuration + * + * BlueGene MPIIO configuration and performance tuning. Used by ad_bgl and ad_bglockless ADIO's. + * + * \section hint_sec Hints + * - bgl_nodes_pset - Specify how many aggregators to use per pset. + * This hint will override the cb_nodes hint based on BlueGene psets. + * - N - Use N nodes per pset as aggregators. + * - Default is based on partition configuration and cb_nodes. + * + * The following default key/value pairs may differ from other platform defaults. + * + * - key = cb_buffer_size value = 16777216 + * - key = romio_cb_read value = enable + * - key = romio_cb_write value = enable + * - key = ind_rd_buffer_size value = 4194304 + * - key = ind_wr_buffer_size value = 4194304 + */ + +/* Compute the aggregator-related parameters that are required in 2-phase collective IO of ADIO. */ +extern int +ADIOI_BGL_gen_agg_ranklist(ADIO_File fd, int n_proxy_per_pset); + +void ADIOI_BGL_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ +/* if fd->info is null, create a new info object. + Initialize fd->info to default values. + Initialize fd->hints to default values. + Examine the info object passed by the user. If it contains values that + ROMIO understands, override the default. */ + + MPI_Info info; + char *value; + int flag, intval, tmp_val, nprocs=0, nprocs_is_valid = 0; + static char myname[] = "ADIOI_BGL_SETINFO"; + + int did_anything = 0; + + if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info)); + info = fd->info; + + /* Note that fd->hints is allocated at file open time; thus it is + * not necessary to allocate it, or check for allocation, here. + */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); + AD_BGL_assert ((value != NULL)); + + /* initialize info and hints to default values if they haven't been + * previously initialized + */ + if (!fd->hints->initialized) { + + did_anything = 1; + + /* buffer size for collective I/O */ + ADIOI_Info_set(info, "cb_buffer_size", ADIOI_BGL_CB_BUFFER_SIZE_DFLT); + fd->hints->cb_buffer_size = atoi(ADIOI_BGL_CB_BUFFER_SIZE_DFLT); + + /* default is to let romio automatically decide when to use + * collective buffering + */ + ADIOI_Info_set(info, "romio_cb_read", "enable"); + fd->hints->cb_read = ADIOI_HINT_ENABLE; + ADIOI_Info_set(info, "romio_cb_write", "enable"); + fd->hints->cb_write = ADIOI_HINT_ENABLE; + + if ( fd->hints->cb_config_list != NULL ) ADIOI_Free (fd->hints->cb_config_list); + fd->hints->cb_config_list = NULL; + + /* number of processes that perform I/O in collective I/O */ + MPI_Comm_size(fd->comm, &nprocs); + nprocs_is_valid = 1; + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs); + ADIOI_Info_set(info, "cb_nodes", value); + fd->hints->cb_nodes = -1; + + /* hint indicating that no indep. I/O will be performed on this file */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = 0; + + /* bgl is not implementing file realms (ADIOI_IOStridedColl), + initialize to disabled it. */ + /* hint instructing the use of persistent file realms */ + ADIOI_Info_set(info, "romio_cb_pfr", "disable"); + fd->hints->cb_pfr = ADIOI_HINT_DISABLE; + + /* hint guiding the assignment of persistent file realms */ + ADIOI_Info_set(info, "romio_cb_fr_types", "aar"); + fd->hints->cb_fr_type = ADIOI_FR_AAR; + + /* hint to align file realms with a certain byte value */ + ADIOI_Info_set(info, "romio_cb_fr_alignment", "1"); + fd->hints->cb_fr_alignment = 1; + + /* hint to set a threshold percentage for a datatype's size/extent at + * which data sieving should be done in collective I/O */ + ADIOI_Info_set(info, "romio_cb_ds_threshold", "0"); + fd->hints->cb_ds_threshold = 0; + + /* hint to switch between point-to-point or all-to-all for two-phase */ + ADIOI_Info_set(info, "romio_cb_alltoall", "automatic"); + fd->hints->cb_alltoall = ADIOI_HINT_AUTO; + + /* deferred_open derived from no_indep_rw and cb_{read,write} */ + fd->hints->deferred_open = 0; + + /* buffer size for data sieving in independent reads */ + ADIOI_Info_set(info, "ind_rd_buffer_size", ADIOI_BGL_IND_RD_BUFFER_SIZE_DFLT); + fd->hints->ind_rd_buffer_size = atoi(ADIOI_BGL_IND_RD_BUFFER_SIZE_DFLT); + + /* buffer size for data sieving in independent writes */ + ADIOI_Info_set(info, "ind_wr_buffer_size", ADIOI_BGL_IND_WR_BUFFER_SIZE_DFLT); + fd->hints->ind_wr_buffer_size = atoi(ADIOI_BGL_IND_WR_BUFFER_SIZE_DFLT); + + if(fd->file_system == ADIO_UFS) + { + /* default for ufs/pvfs is to disable data sieving */ + ADIOI_Info_set(info, "romio_ds_read", "disable"); + fd->hints->ds_read = ADIOI_HINT_DISABLE; + ADIOI_Info_set(info, "romio_ds_write", "disable"); + fd->hints->ds_write = ADIOI_HINT_DISABLE; + } + else + { + /* default is to let romio automatically decide when to use data + * sieving + */ + ADIOI_Info_set(info, "romio_ds_read", "automatic"); + fd->hints->ds_read = ADIOI_HINT_AUTO; + ADIOI_Info_set(info, "romio_ds_write", "automatic"); + fd->hints->ds_write = ADIOI_HINT_AUTO; + } + + /* still to do: tune this a bit for a variety of file systems. there's + * no good default value so just leave it unset */ + fd->hints->min_fdomain_size = 0; + fd->hints->striping_unit = 0; + + fd->hints->initialized = 1; + } + + /* add in user's info if supplied */ + if (users_info != MPI_INFO_NULL) { + ADIOI_Info_get(users_info, "cb_buffer_size", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval=atoi(value)) > 0)) { + tmp_val = intval; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != intval) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "cb_buffer_size", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(info, "cb_buffer_size", value); + fd->hints->cb_buffer_size = intval; + + } +#if 0 + /* bgl is not implementing file realms (ADIOI_IOStridedColl) ... */ + /* aligning file realms to certain sizes (e.g. stripe sizes) + * may benefit I/O performance */ + ADIOI_Info_get(users_info, "romio_cb_fr_alignment", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval=atoi(value)) > 0)) { + tmp_val = intval; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != intval) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_fr_alignment", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(info, "romio_cb_fr_alignment", value); + fd->hints->cb_fr_alignment = intval; + + } + + /* for collective I/O, try to be smarter about when to do data sieving + * using a specific threshold for the datatype size/extent + * (percentage 0-100%) */ + ADIOI_Info_get(users_info, "romio_cb_ds_threshold", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval=atoi(value)) > 0)) { + tmp_val = intval; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != intval) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_ds_threshold", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(info, "romio_cb_ds_threshold", value); + fd->hints->cb_ds_threshold = intval; + + } + ADIOI_Info_get(users_info, "romio_cb_alltoall", MPI_MAX_INFO_VAL, value, + &flag); + if (flag) { + if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { + ADIOI_Info_set(info, "romio_cb_alltoall", value); + fd->hints->cb_read = ADIOI_HINT_ENABLE; + } + else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { + ADIOI_Info_set(info, "romio_cb_alltoall", value); + fd->hints->cb_read = ADIOI_HINT_DISABLE; + } + else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(info, "romio_cb_alltoall", value); + fd->hints->cb_read = ADIOI_HINT_AUTO; + } + + tmp_val = fd->hints->cb_alltoall; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != fd->hints->cb_alltoall) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_alltoall", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + } +#endif + /* new hints for enabling/disabling coll. buffering on + * reads/writes + */ + ADIOI_Info_get(users_info, "romio_cb_read", MPI_MAX_INFO_VAL, value, + &flag); + if (flag) { + if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { + ADIOI_Info_set(info, "romio_cb_read", value); + fd->hints->cb_read = ADIOI_HINT_ENABLE; + } + else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { + /* romio_cb_read overrides no_indep_rw */ + ADIOI_Info_set(info, "romio_cb_read", value); + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->cb_read = ADIOI_HINT_DISABLE; + fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; + } + else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(info, "romio_cb_read", value); + fd->hints->cb_read = ADIOI_HINT_AUTO; + } + + tmp_val = fd->hints->cb_read; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != fd->hints->cb_read) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_read", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + } + ADIOI_Info_get(users_info, "romio_cb_write", MPI_MAX_INFO_VAL, value, + &flag); + if (flag) { + if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { + ADIOI_Info_set(info, "romio_cb_write", value); + fd->hints->cb_write = ADIOI_HINT_ENABLE; + } + else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) + { + /* romio_cb_write overrides no_indep_rw, too */ + ADIOI_Info_set(info, "romio_cb_write", value); + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->cb_write = ADIOI_HINT_DISABLE; + fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; + } + else if (!strcmp(value, "automatic") || + !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(info, "romio_cb_write", value); + fd->hints->cb_write = ADIOI_HINT_AUTO; + } + + tmp_val = fd->hints->cb_write; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != fd->hints->cb_write) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_write", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + } + +#if 0 + /* bgl is not implementing file realms (ADIOI_IOStridedColl) ... */ + /* enable/disable persistent file realms for collective I/O */ + /* may want to check for no_indep_rdwr hint as well */ + ADIOI_Info_get(users_info, "romio_cb_pfr", MPI_MAX_INFO_VAL, value, + &flag); + if (flag) { + if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { + ADIOI_Info_set(info, "romio_cb_pfr", value); + fd->hints->cb_pfr = ADIOI_HINT_ENABLE; + } + else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { + ADIOI_Info_set(info, "romio_cb_pfr", value); + fd->hints->cb_pfr = ADIOI_HINT_DISABLE; + } + else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(info, "romio_cb_pfr", value); + fd->hints->cb_pfr = ADIOI_HINT_AUTO; + } + + tmp_val = fd->hints->cb_pfr; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != fd->hints->cb_pfr) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_pfr", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + } + + /* file realm assignment types ADIOI_FR_AAR(0), + ADIOI_FR_FSZ(-1), ADIOI_FR_USR_REALMS(-2), all others specify + a regular fr size in bytes. probably not the best way... */ + ADIOI_Info_get(users_info, "romio_cb_fr_type", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval=atoi(value)) >= -2)) { + tmp_val = intval; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != intval) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_fr_type", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(info, "romio_cb_fr_type", value); + fd->hints->cb_fr_type = intval; + + } +#endif + /* new hint for specifying no indep. read/write will be performed */ + ADIOI_Info_get(users_info, "romio_no_indep_rw", MPI_MAX_INFO_VAL, value, + &flag); + if (flag) { + if (!strcmp(value, "true") || !strcmp(value, "TRUE")) { + /* if 'no_indep_rw' set, also hint that we will do + * collective buffering: if we aren't doing independent io, + * then we have to do collective */ + ADIOI_Info_set(info, "romio_no_indep_rw", value); + ADIOI_Info_set(info, "romio_cb_write", "enable"); + ADIOI_Info_set(info, "romio_cb_read", "enable"); + fd->hints->no_indep_rw = 1; + fd->hints->cb_read = 1; + fd->hints->cb_write = 1; + tmp_val = 1; + } + else if (!strcmp(value, "false") || !strcmp(value, "FALSE")) { + ADIOI_Info_set(info, "romio_no_indep_rw", value); + fd->hints->no_indep_rw = 0; + tmp_val = 0; + } + else { + /* default is above */ + tmp_val = 0; + } + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != fd->hints->no_indep_rw) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_no_indep_rw", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + } + /* new hints for enabling/disabling data sieving on + * reads/writes + */ + ADIOI_Info_get(users_info, "romio_ds_read", MPI_MAX_INFO_VAL, value, + &flag); + if (flag) { + if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { + ADIOI_Info_set(info, "romio_ds_read", value); + fd->hints->ds_read = ADIOI_HINT_ENABLE; + } + else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { + ADIOI_Info_set(info, "romio_ds_read", value); + fd->hints->ds_read = ADIOI_HINT_DISABLE; + } + else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(info, "romio_ds_read", value); + fd->hints->ds_read = ADIOI_HINT_AUTO; + } + /* otherwise ignore */ + } + ADIOI_Info_get(users_info, "romio_ds_write", MPI_MAX_INFO_VAL, value, + &flag); + if (flag) { + if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { + ADIOI_Info_set(info, "romio_ds_write", value); + fd->hints->ds_write = ADIOI_HINT_ENABLE; + } + else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { + ADIOI_Info_set(info, "romio_ds_write", value); + fd->hints->ds_write = ADIOI_HINT_DISABLE; + } + else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(info, "romio_ds_write", value); + fd->hints->ds_write = ADIOI_HINT_AUTO; + } + /* otherwise ignore */ + } + + ADIOI_Info_get(users_info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval = atoi(value)) > 0)) { + ADIOI_Info_set(info, "ind_wr_buffer_size", value); + fd->hints->ind_wr_buffer_size = intval; + } + + ADIOI_Info_get(users_info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval = atoi(value)) > 0)) { + ADIOI_Info_set(info, "ind_rd_buffer_size", value); + fd->hints->ind_rd_buffer_size = intval; + } + + memset( value, 0, MPI_MAX_INFO_VAL+1 ); + ADIOI_Info_get(users_info, "romio_min_fdomain_size", MPI_MAX_INFO_VAL, + value, &flag); + if ( flag && ((intval = atoi(value)) > 0) ) { + ADIOI_Info_set(info, "romio_min_fdomain_size", value); + fd->hints->min_fdomain_size = intval; + } + /* Now we use striping unit in common code so we should + process hints for it. */ + ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, + value, &flag); + if ( flag && ((intval = atoi(value)) > 0) ) { + ADIOI_Info_set(info, "striping_unit", value); + fd->hints->striping_unit = intval; + } + + memset( value, 0, MPI_MAX_INFO_VAL+1 ); + ADIOI_Info_get(users_info, ADIOI_BGL_NAGG_IN_PSET_HINT_NAME, MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval = atoi(value)) > 0)) { + + did_anything = 1; + ADIOI_Info_set(info, ADIOI_BGL_NAGG_IN_PSET_HINT_NAME, value); + fd->hints->cb_nodes = intval; + } + } + + /* associate CB aggregators to certain CNs in every involved PSET */ + if (did_anything) { + ADIOI_BGL_gen_agg_ranklist(fd, fd->hints->cb_nodes); + } + /* ignore defered open hints and do not enable it for bluegene: need all + * processors in the open path so we can stat-and-broadcast the blocksize + */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = 0; + fd->hints->deferred_open = 0; + + /* BobC commented this out, but since hint processing runs on both bgl and + * bglockless, we need to keep DS writes enabled on gpfs and disabled on + * PVFS */ + if (ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES) == 0) { + /* disable data sieving for fs that do not + support file locking */ + ADIOI_Info_get(info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + /* get rid of this value if it is set */ + ADIOI_Info_delete(info, "ind_wr_buffer_size"); + } + /* note: leave ind_wr_buffer_size alone; used for other cases + * as well. -- Rob Ross, 04/22/2003 + */ + ADIOI_Info_set(info, "romio_ds_write", "disable"); + fd->hints->ds_write = ADIOI_HINT_DISABLE; + } + + ADIOI_Free(value); + + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_open.c new file mode 100644 index 0000000000..f8115728fb --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_open.c @@ -0,0 +1,304 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_open.c + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_bgl.h" +#include "ad_bgl_aggrs.h" + +#include +#include + +/* COPIED FROM ad_fstype.c since it is static in that file + + ADIO_FileSysType_parentdir - determines a string pathname for the + parent directory of a given filename. + +Input Parameters: +. filename - pointer to file name character array + +Output Parameters: +. dirnamep - pointer to location in which to store a pointer to a string + + Note that the caller should free the memory located at the pointer returned + after the string is no longer needed. +*/ + +#ifndef PATH_MAX +#define PATH_MAX 65535 +#endif + +/* In a strict ANSI environment, S_ISLNK may not be defined. Fix that + here. We assume that S_ISLNK is *always* defined as a macro. If + that is not universally true, then add a test to the romio + configure that trys to link a program that references S_ISLNK */ +#if !defined(S_ISLNK) +# if defined(S_IFLNK) + /* Check for the link bit */ +# define S_ISLNK(mode) ((mode) & S_IFLNK) +# else + /* no way to check if it is a link, so say false */ +# define S_ISLNK(mode) 0 +# endif +#endif /* !(S_ISLNK) */ + +/* ADIO_FileSysType_parentdir + * + * Returns pointer to string in dirnamep; that string is allocated with + * strdup and must be free()'d. + */ +static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep) +{ + int err; + char *dir = NULL, *slash; + struct stat statbuf; + + err = lstat(filename, &statbuf); + + if (err || (!S_ISLNK(statbuf.st_mode))) { + /* no such file, or file is not a link; these are the "normal" + * cases where we can just return the parent directory. + */ + dir = ADIOI_Strdup(filename); + } + else { + /* filename is a symlink. we've presumably already tried + * to stat it and found it to be missing (dangling link), + * but this code doesn't care if the target is really there + * or not. + */ + int namelen; + char *linkbuf; + + linkbuf = ADIOI_Malloc(PATH_MAX+1); + namelen = readlink(filename, linkbuf, PATH_MAX+1); + if (namelen == -1) { + /* something strange has happened between the time that + * we determined that this was a link and the time that + * we attempted to read it; punt and use the old name. + */ + dir = ADIOI_Strdup(filename); + } + else { + /* successfully read the link */ + linkbuf[namelen] = '\0'; /* readlink doesn't null terminate */ + dir = ADIOI_Strdup(linkbuf); + ADIOI_Free(linkbuf); + } + } + + slash = strrchr(dir, '/'); + if (!slash) ADIOI_Strncpy(dir, ".", 2); + else { + if (slash == dir) *(dir + 1) = '\0'; + else *slash = '\0'; + } + + *dirnamep = dir; + return; +} + +static void scaleable_stat(ADIO_File fd) +{ + struct stat64 bgl_stat; + struct statfs bgl_statfs; + int rank, rc; + char * dir; + long buf[2]; + MPI_Comm_rank(fd->comm, &rank); + + if (rank == 0) { + /* Get the (real) underlying file system block size */ + rc = stat64(fd->filename, &bgl_stat); + if (rc >= 0) + { + buf[0] = bgl_stat.st_blksize; + DBGV_FPRINTF(stderr,"Successful stat '%s'. Blocksize=%ld\n", + fd->filename,bgl_stat.st_blksize); + } + else + { + DBGV_FPRINTF(stderr,"Stat '%s' failed with rc=%d, errno=%d\n", + fd->filename,rc,errno); + } + /* Get the (real) underlying file system type so we can + * plan our fsync scaling strategy */ + rc = statfs(fd->filename,&bgl_statfs); + if (rc >= 0) + { + DBGV_FPRINTF(stderr,"Successful statfs '%s'. Magic number=%#X\n", + fd->filename,bgl_statfs.f_type); + buf[1] = bgl_statfs.f_type; + } + else + { + DBGV_FPRINTF(stderr,"Statfs '%s' failed with rc=%d, errno=%d\n", + fd->filename,rc,errno); + ADIO_FileSysType_parentdir(fd->filename, &dir); + rc = statfs(dir,&bgl_statfs); + if (rc >= 0) + { + DBGV_FPRINTF(stderr,"Successful statfs '%s'. Magic number=%#X\n",dir,bgl_statfs.f_type); + buf[1] = bgl_statfs.f_type; + } + else + { + /* Hmm. Guess we'll assume the worst-case, that it's not GPFS + * or BGLOCKLESSMPIO_F_TYPE (default PVFS2) below */ + buf[1] = -1; /* bogus magic number */ + DBGV_FPRINTF(stderr,"Statfs '%s' failed with rc=%d, errno=%d\n",dir,rc,errno); + } + free(dir); + } + } + /* now we can broadcast the stat/statfs data to everyone else */ + MPI_Bcast(buf, 2, MPI_LONG, 0, fd->comm); + bgl_stat.st_blksize = buf[0]; + bgl_statfs.f_type = buf[1]; + + /* data from stat64 */ + /* store the blksize in the file system specific storage */ + ((ADIOI_BGL_fs*)fd->fs_ptr)->blksize = bgl_stat.st_blksize; + + /* data from statfs */ + if ((bgl_statfs.f_type == GPFS_SUPER_MAGIC) || + (bgl_statfs.f_type == bglocklessmpio_f_type)) + { + ((ADIOI_BGL_fs*)fd->fs_ptr)->fsync_aggr = + ADIOI_BGL_FSYNC_AGGREGATION_ENABLED; + + /* Only one rank is an "fsync aggregator" because only one + * fsync is needed */ + if (rank == 0) + { + ((ADIOI_BGL_fs*)fd->fs_ptr)->fsync_aggr |= + ADIOI_BGL_FSYNC_AGGREGATOR; + DBG_FPRINTF(stderr,"fsync aggregator %d\n",rank); + } + else ; /* aggregation enabled but this rank is not an aggregator*/ + } + else; /* Other filesystems default to no fsync aggregation */ +} + + +void ADIOI_BGL_Open(ADIO_File fd, int *error_code) +{ + int perm, old_mask, amode; + static char myname[] = "ADIOI_BGL_OPEN"; + + /* set internal variables for tuning environment variables */ + ad_bgl_get_env_vars(); + + 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) + amode = amode | O_CREAT; + 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; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_a, 0, NULL); +#endif + fd->fd_sys = open(fd->filename, amode, perm); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_open_b, 0, NULL); +#endif + DBG_FPRINTF(stderr,"open('%s',%#X,%#X) rc=%d, errno=%d\n",fd->filename,amode,perm,fd->fd_sys,errno); + 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); + + if(fd->fd_sys != -1) + { + /* Initialize the ad_bgl file system specific information */ + AD_BGL_assert(fd->fs_ptr == NULL); + fd->fs_ptr = (ADIOI_BGL_fs*) ADIOI_Malloc(sizeof(ADIOI_BGL_fs)); + + ((ADIOI_BGL_fs*)fd->fs_ptr)->blksize = 1048576; /* default to 1M */ + + /* default is no fsync aggregation */ + ((ADIOI_BGL_fs*)fd->fs_ptr)->fsync_aggr = + ADIOI_BGL_FSYNC_AGGREGATION_DISABLED; + + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_stat_a, 0, NULL); +#endif + scaleable_stat(fd); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_stat_b, 0, NULL); +#endif + } + + 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; +} +/* + *vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.c new file mode 100644 index 0000000000..370b7315c8 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.c @@ -0,0 +1,109 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_pset.c + * \brief Definition of functions associated to structs ADIOI_BGL_ProcInfo_t and ADIOI_BGL_ConfInfo_t + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include +#include "ad_bgl.h" +#include "ad_bgl_pset.h" +#include "mpidimpl.h" + +ADIOI_BGL_ProcInfo_t * +ADIOI_BGL_ProcInfo_new() +{ + ADIOI_BGL_ProcInfo_t *p = (ADIOI_BGL_ProcInfo_t *) ADIOI_Malloc (sizeof(ADIOI_BGL_ProcInfo_t)); + AD_BGL_assert ((p != NULL)); + return p; +} + +ADIOI_BGL_ProcInfo_t * +ADIOI_BGL_ProcInfo_new_n( int n ) +{ + ADIOI_BGL_ProcInfo_t *p = (ADIOI_BGL_ProcInfo_t *) ADIOI_Malloc (n * sizeof(ADIOI_BGL_ProcInfo_t)); + AD_BGL_assert ((p != NULL)); + return p; +} + +void +ADIOI_BGL_ProcInfo_free( ADIOI_BGL_ProcInfo_t *info ) +{ + if (info != NULL) ADIOI_Free (info); +} + +static +void +ADIOI_BGL_ProcInfo_set(ADIOI_BGL_ProcInfo_t *info, const DCMF_Hardware_t *hw, int r) +{ + info->psetNum = hw->idOfPset; + info->xInPset = hw->xCoord; + info->yInPset = hw->yCoord; + info->zInPset = hw->zCoord; + info->cpuid = hw->tCoord; + info->rank = r; + info->rankInPset = hw->rankInPset; +} + + +ADIOI_BGL_ConfInfo_t * +ADIOI_BGL_ConfInfo_new () +{ + ADIOI_BGL_ConfInfo_t *p = (ADIOI_BGL_ConfInfo_t *) ADIOI_Malloc (sizeof(ADIOI_BGL_ConfInfo_t)); + AD_BGL_assert ((p != NULL)); + return p; +} + +static +void +ADIOI_BGL_ConfInfo_set(ADIOI_BGL_ConfInfo_t *info, const DCMF_Hardware_t *hw, int s, int n_aggrs) +{ + info->PsetSize = hw->sizeOfPset; + info->numPsets = (hw->xSize * hw->ySize * + hw->zSize) / hw->sizeOfPset; + info->isVNM = (hw->tSize != 1); + info->cpuidSize = hw->tSize; + info->virtualPsetSize = hw->sizeOfPset * hw->tSize; + info->nProcs = s; + + /* More complicated logic maybe needed for nAggrs specification */ + info->nAggrs = n_aggrs; + if ( info->nAggrs <=0 || MIN(info->nProcs, info->virtualPsetSize) < info->nAggrs ) + info->nAggrs = ADIOI_BGL_NAGG_PSET_DFLT; + if ( info->nAggrs > info->virtualPsetSize ) info->nAggrs = info->virtualPsetSize; + + info->aggRatio = 1. * info->nAggrs / info->virtualPsetSize; + if (info->aggRatio > 1) info->aggRatio = 1.; +} + +void +ADIOI_BGL_ConfInfo_free( ADIOI_BGL_ConfInfo_t *info ) +{ + if (info != NULL) ADIOI_Free (info); +} + +void +ADIOI_BGL_persInfo_init(ADIOI_BGL_ConfInfo_t *conf, + ADIOI_BGL_ProcInfo_t *proc, + int s, int r, int n_aggrs) +{ + DCMF_Hardware_t hw; + DCMF_Hardware(&hw); + + ADIOI_BGL_ConfInfo_set (conf, &hw, s, n_aggrs); + ADIOI_BGL_ProcInfo_set (proc, &hw, r); +} + +void +ADIOI_BGL_persInfo_free( ADIOI_BGL_ConfInfo_t *conf, ADIOI_BGL_ProcInfo_t *proc ) +{ + ADIOI_BGL_ConfInfo_free( conf ); + ADIOI_BGL_ProcInfo_free( proc ); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.h b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.h new file mode 100644 index 0000000000..f6a916411f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_pset.h @@ -0,0 +1,82 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_pset.h + * \brief ??? + */ + +/* File: ad_bgl_pset.h + * + * Defines two structures that keep BG/L PSET specific information and their public interfaces: + * . ADIOI_BGL_ProcInfo_t object keeps specific information to each process + * . ADIOI_BGL_ConfInfo_t object keeps general information for the whole communicator, only kept + * on process 0. + */ + +#ifndef AD_BGL_PSET_H_ +#define AD_BGL_PSET_H_ + +/* Keeps specific information to each process, will be exchanged among processes */ +typedef struct { + + int psetNum; /* which PSET I am in */ + int rank; /* my rank */ + int xInPset; /* my relative coordinates in my PSET */ + int yInPset; + int zInPset; + int cpuid; /* my CPU id -- for virtual node mode (t coord)*/ + int rankInPset; /* my relative rank in my PSET */ + + int __pad; /* pad to 16 byte alignment */ + +} ADIOI_BGL_ProcInfo_t __attribute__((aligned(16))); + + +/* Keeps general information for the whole communicator, only on process 0 */ +typedef struct { + + int PsetSize; + int nAggrs; + int numPsets; + int isVNM; + int virtualPsetSize; + int nProcs; + float aggRatio; + int cpuidSize; /* how many cpu ids? (t size) */ + +} ADIOI_BGL_ConfInfo_t __attribute__((aligned(16))); + + +#undef MIN +#define MIN(a,b) ((a +#endif + +#ifdef PROFILE +#include "mpe.h" +#endif + +#ifdef USE_DBG_LOGGING + #define RDCOLL_DEBUG 1 +#endif +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +/* prototypes of functions used for collective reads only. */ +static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, + int myrank, ADIOI_Access + *others_req, ADIO_Offset *offset_list, + ADIO_Offset *len_list, int contig_access_count, + ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + int *buf_idx, int *error_code); +static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node + *flat_buf, ADIO_Offset *offset_list, ADIO_Offset + *len_list, int *send_size, int *recv_size, + int *count, int *start_pos, + int *partial_send, + int *recd_from_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + ADIOI_Access *others_req, + int iter, + MPI_Aint buftype_extent, int *buf_idx); +static void ADIOI_R_Exchange_data_alltoallv(ADIO_File fd, void *buf, ADIOI_Flatlist_node + *flat_buf, ADIO_Offset *offset_list, ADIO_Offset + *len_list, int *send_size, int *recv_size, + int *count, int *start_pos, + int *partial_send, + int *recd_from_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + ADIOI_Access *others_req, + int iter, + MPI_Aint buftype_extent, int *buf_idx); +static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + *flat_buf, char **recv_buf, ADIO_Offset + *offset_list, ADIO_Offset *len_list, + unsigned *recv_size, + MPI_Request *requests, MPI_Status *statuses, + int *recd_from_proc, int nprocs, + int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, ADIO_Offset *fd_start, + ADIO_Offset *fd_end, + MPI_Aint buftype_extent); + +extern void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype + datatype, int file_ptr_type, ADIO_Offset + offset, ADIO_Offset **offset_list_ptr, ADIO_Offset + **len_list_ptr, ADIO_Offset *start_offset_ptr, + ADIO_Offset *end_offset_ptr, int + *contig_access_count_ptr); + +static int ADIOI_too_much_memory_for_alltoallv(int nprocs, + int * send_size, int *recv_size); + +void ADIOI_BGL_ReadStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code) +{ +/* Uses a generalized version of the extended two-phase method described + in "An Extended Two-Phase Method for Accessing Sections of + Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + Scientific Programming, (5)4:301--317, Winter 1996. + http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ + + ADIOI_Access *my_req; + /* array of nprocs structures, one for each other process in + whose file domain this process's request lies */ + + ADIOI_Access *others_req; + /* array of nprocs structures, one for each other process + whose request lies in this process's file domain. */ + + int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; + int contig_access_count=0, interleave_count = 0, buftype_is_contig; + int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; + ADIO_Offset start_offset, end_offset, orig_fp, fd_size, min_st_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, + *fd_end = NULL, *end_offsets = NULL; + ADIO_Offset *bgl_offsets0 = NULL, *bgl_offsets = NULL; + int ii; + ADIO_Offset *len_list = NULL; + int *buf_idx = NULL; +#if BGL_PROFILE + BGLMPIO_T_CIO_RESET( 0, r ) +#endif + +#ifdef HAVE_STATUS_SET_BYTES + int bufsize, size; +#endif + +#if 0 +/* From common code - not implemented for bgl. */ + if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { + ADIOI_IOStridedColl (fd, buf, count, ADIOI_READ, datatype, + file_ptr_type, offset, status, error_code); + return; + } */ +#endif +#ifdef PROFILE + MPE_Log_event(13, 0, "start computation"); +#endif + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + + /* number of aggregators, cb_nodes, is stored in the hints */ + nprocs_for_coll = fd->hints->cb_nodes; + orig_fp = fd->fp_ind; + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, r, 0, 1, 0, BGLMPIO_CIO_LCOMP, BGLMPIO_CIO_LAST ) +#endif + + /* only check for interleaving if cb_read isn't disabled */ + if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + lengths in the file and determine the start and end offsets. */ + + /* Note: end_offset points to the last byte-offset that will be accessed. + e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ + + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, r, 1, 1, 1, BGLMPIO_CIO_GATHER, BGLMPIO_CIO_LCOMP ) +#endif + +#ifdef RDCOLL_DEBUG + for (i=0; icomm ); + + for (ii=0; iicomm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, + ADIO_OFFSET, fd->comm); + } + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, r, 0, 1, 1, BGLMPIO_CIO_PATANA, BGLMPIO_CIO_GATHER ) +#endif + + /* are the accesses of different processes interleaved? */ + for (i=1; ihints->cb_read == ADIOI_HINT_DISABLE + || (!interleave_count && (fd->hints->cb_read == ADIOI_HINT_AUTO))) + { + /* don't do aggregation */ + if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(len_list); + ADIOI_Free(st_offsets); + ADIOI_Free(end_offsets); + } + + fd->fp_ind = orig_fp; + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + if (buftype_is_contig && filetype_is_contig) { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; + ADIO_ReadContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + off, status, error_code); + } + else ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, + 0, status, error_code); + } + else ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, + offset, status, error_code); + + return; + } + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, r, 1, 1, 1, BGLMPIO_CIO_FD_PART, BGLMPIO_CIO_PATANA ) +#endif + + /* We're going to perform aggregation of I/O. Here we call + * ADIOI_Calc_file_domains() to determine what processes will handle I/O + * to what regions. We pass nprocs_for_coll into this function; it is + * used to determine how many processes will perform I/O, which is also + * the number of regions into which the range of bytes must be divided. + * These regions are called "file domains", or FDs. + * + * When this function returns, fd_start, fd_end, fd_size, and + * min_st_offset will be filled in. fd_start holds the starting byte + * location for each file domain. fd_end holds the ending byte location. + * min_st_offset holds the minimum byte location that will be accessed. + * + * Both fd_start[] and fd_end[] are indexed by an aggregator number; this + * needs to be mapped to an actual rank in the communicator later. + * + */ + if (bglmpio_tuneblocking) + ADIOI_BGL_GPFS_Calc_file_domains(st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, &fd_size, fd->fs_ptr); + else + ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, + fd->hints->striping_unit); + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, r, 0, 1, 1, BGLMPIO_CIO_MYREQ, BGLMPIO_CIO_FD_PART ) +#endif + + /* calculate where the portions of the access requests of this process + * are located in terms of the file domains. this could be on the same + * process or on other processes. this function fills in: + * count_my_req_procs - number of processes (including this one) for which + * this process has requests in their file domain + * count_my_req_per_proc - count of requests for each process, indexed + * by rank of the process + * my_req[] - array of data structures describing the requests to be + * performed by each process (including self). indexed by rank. + * buf_idx[] - array of locations into which data can be directly moved; + * this is only valid for contiguous buffer case + */ + if (bglmpio_tuneblocking) + ADIOI_BGL_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, + &count_my_req_per_proc, &my_req, + &buf_idx); + else + ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, + &count_my_req_per_proc, &my_req, + &buf_idx); + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, r, 1, 1, 1, BGLMPIO_CIO_OTHREQ, BGLMPIO_CIO_MYREQ ) +#endif + + /* perform a collective communication in order to distribute the + * data calculated above. fills in the following: + * count_others_req_procs - number of processes (including this + * one) which have requests in this process's file domain. + * count_others_req_per_proc[] - number of separate contiguous + * requests from proc i lie in this process's file domain. + */ + if (bglmpio_tuneblocking) + ADIOI_BGL_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, &count_others_req_procs, + &others_req); + + else + ADIOI_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, &count_others_req_procs, + &others_req); + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, r, 1, 1, 1, BGLMPIO_CIO_DEXCH, BGLMPIO_CIO_OTHREQ ) +#endif + + /* my_req[] and count_my_req_per_proc aren't needed at this point, so + * let's free the memory + */ + ADIOI_Free(count_my_req_per_proc); + for (i=0; ifp_sys_posn = -1; /* set it to null. */ +} + +static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, + int myrank, ADIOI_Access + *others_req, ADIO_Offset *offset_list, + ADIO_Offset *len_list, int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + int *buf_idx, int *error_code) +{ +/* Read in sizes of no more than coll_bufsize, an info parameter. + Send data to appropriate processes. + Place recd. data in user buf. + The idea is to reduce the amount of extra memory required for + collective I/O. If all data were read all at once, which is much + easier, it would require temp space more than the size of user_buf, + which is often unacceptable. For example, to read a distributed + array from a file, where each local array is 8Mbytes, requiring + at least another 8Mbytes of temp space is unacceptable. */ + + int i, j, m, ntimes, max_ntimes, buftype_is_contig; + ADIO_Offset st_loc=-1, end_loc=-1, off, done, real_off, req_off; + char *read_buf = NULL, *tmp_buf; + int *curr_offlen_ptr, *count, *send_size, *recv_size; + int *partial_send, *recd_from_proc, *start_pos; + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ + ADIO_Offset real_size, size, for_curr_iter, for_next_iter; + int req_len, flag, rank; + MPI_Status status; + ADIOI_Flatlist_node *flat_buf=NULL; + MPI_Aint buftype_extent; + int coll_bufsize; +#ifdef RDCOLL_DEBUG + int iii; +#endif + *error_code = MPI_SUCCESS; /* changed below if error */ + /* only I/O errors are currently reported */ + +/* calculate the number of reads of size coll_bufsize + to be done by each process and the max among all processes. + That gives the no. of communication phases as well. + coll_bufsize is obtained from the hints object. */ + + coll_bufsize = fd->hints->cb_buffer_size; + + /* grab some initial values for st_loc and end_loc */ + for (i=0; i < nprocs; i++) { + if (others_req[i].count) { + st_loc = others_req[i].offsets[0]; + end_loc = others_req[i].offsets[0]; + break; + } + } + + /* now find the real values */ + for (i=0; i < nprocs; i++) + for (j=0; jcomm); + + if (ntimes) read_buf = (char *) ADIOI_Malloc(coll_bufsize); + + curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* its use is explained below. calloc initializes to 0. */ + + count = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* to store count of how many off-len pairs per proc are satisfied + in an iteration. */ + + partial_send = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* if only a portion of the last off-len pair is sent to a process + in a particular iteration, the length sent is stored here. + calloc initializes to 0. */ + + send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* total size of data to be sent to each proc. in an iteration */ + + recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* total size of data to be recd. from each proc. in an iteration. + Of size nprocs so that I can use MPI_Alltoall later. */ + + recd_from_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* amount of data recd. so far from each proc. Used in + ADIOI_Fill_user_buffer. initialized to 0 here. */ + + start_pos = (int *) ADIOI_Malloc(nprocs*sizeof(int)); + /* used to store the starting value of curr_offlen_ptr[i] in + this iteration */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + if (!buftype_is_contig) { + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + } + MPI_Type_extent(datatype, &buftype_extent); + + done = 0; + off = st_loc; + for_curr_iter = for_next_iter = 0; + + MPI_Comm_rank(fd->comm, &rank); + +#ifdef PROFILE + MPE_Log_event(14, 0, "end computation"); +#endif + + for (m=0; mcomm); + + nprocs_recv = 0; + for (i=0; i < nprocs; i++) if (recv_size[i]) nprocs_recv++; + + nprocs_send = 0; + for (i=0; icomm, requests+j); + j++; + buf_idx[i] += recv_size[i]; + } + } + else { +/* allocate memory for recv_buf and post receives */ + recv_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char*)); + for (i=0; i < nprocs; i++) + if (recv_size[i]) recv_buf[i] = + (char *) ADIOI_Malloc(recv_size[i]); + + j = 0; + for (i=0; i < nprocs; i++) + if (recv_size[i]) { + MPI_Irecv(recv_buf[i], recv_size[i], MPI_BYTE, i, + myrank+i+100*iter, fd->comm, requests+j); + j++; +#ifdef RDCOLL_DEBUG + DBG_FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", + myrank, recv_size[i], myrank+i+100*iter); +#endif + } + } + +/* create derived datatypes and send data */ + + j = 0; + for (i=0; icomm, requests+nprocs_recv+j); + MPI_Type_free(&send_type); + if (partial_send[i]) others_req[i].lens[k] = tmp; + j++; + } + } + + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+nprocs_recv+1) * \ + sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ + + /* wait on the receives */ + if (nprocs_recv) { +#ifdef NEEDS_MPI_TEST + j = 0; + while (!j) MPI_Testall(nprocs_recv, requests, &j, statuses); +#else + MPI_Waitall(nprocs_recv, requests, statuses); +#endif + + /* if noncontiguous, to the copies from the recv buffers */ + if (!buftype_is_contig) + ADIOI_Fill_user_buffer(fd, buf, flat_buf, recv_buf, + offset_list, len_list, (unsigned*)recv_size, + requests, statuses, recd_from_proc, + nprocs, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + buftype_extent); + } + + /* wait on the sends*/ + MPI_Waitall(nprocs_send, requests+nprocs_recv, statuses+nprocs_recv); + + ADIOI_Free(statuses); + ADIOI_Free(requests); + + if (!buftype_is_contig) { + for (i=0; i < nprocs; i++) + if (recv_size[i]) ADIOI_Free(recv_buf[i]); + ADIOI_Free(recv_buf); + } +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5033, 0, NULL); +#endif +} + +#define ADIOI_BUF_INCR \ +{ \ + while (buf_incr) { \ + size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + buf_incr -= size_in_buf; \ + } \ +} + + +#define ADIOI_BUF_COPY \ +{ \ + while (size) { \ + size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIR_Upint)(buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ + memcpy(((char *) buf) + user_buf_idx, \ + &(recv_buf[p][recv_buf_idx[p]]), size_in_buf); \ + recv_buf_idx[p] += size_in_buf; /* already tested (size_t)size_in_buf*/ \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + size -= size_in_buf; \ + buf_incr -= size_in_buf; \ + } \ + ADIOI_BUF_INCR \ +} + +static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + *flat_buf, char **recv_buf, ADIO_Offset + *offset_list, ADIO_Offset *len_list, + unsigned *recv_size, + MPI_Request *requests, MPI_Status *statuses, + int *recd_from_proc, int nprocs, + int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, ADIO_Offset *fd_start, + ADIO_Offset *fd_end, + MPI_Aint buftype_extent) +{ + +/* this function is only called if buftype is not contig */ + + int i, p, flat_buf_idx; + ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; + int n_buftypes; + ADIO_Offset off, len, rem_len, user_buf_idx; + /* Not sure unsigned is necessary, but it makes the math safer */ + unsigned *curr_from_proc, *done_from_proc, *recv_buf_idx; + + ADIOI_UNREFERENCED_ARG(requests); + ADIOI_UNREFERENCED_ARG(statuses); + +/* curr_from_proc[p] = amount of data recd from proc. p that has already + been accounted for so far + done_from_proc[p] = amount of data already recd from proc. p and + filled into user buffer in previous iterations + user_buf_idx = current location in user buffer + recv_buf_idx[p] = current location in recv_buf of proc. p */ + curr_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); + done_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); + recv_buf_idx = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); + + for (i=0; i < nprocs; i++) { + recv_buf_idx[i] = curr_from_proc[i] = 0; + done_from_proc[i] = recd_from_proc[i]; + } + + user_buf_idx = flat_buf->indices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + flat_buf_sz = size of current contiguous component in + flattened buf */ + + for (i=0; i 0) { + len = rem_len; + /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no + * longer than the single region that processor "p" is responsible + * for. + */ + p = ADIOI_BGL_Calc_aggregator(fd, + off, + min_st_offset, + &len, + fd_size, + fd_start, + fd_end); + + if (recv_buf_idx[p] < recv_size[p]) { + if (curr_from_proc[p]+len > done_from_proc[p]) { + if (done_from_proc[p] > curr_from_proc[p]) { + size = ADIOI_MIN(curr_from_proc[p] + len - + done_from_proc[p], recv_size[p]-recv_buf_idx[p]); + buf_incr = done_from_proc[p] - curr_from_proc[p]; + ADIOI_BUF_INCR + buf_incr = curr_from_proc[p]+len-done_from_proc[p]; + ADIOI_Assert((done_from_proc[p] + size) == (unsigned)((ADIO_Offset)done_from_proc[p] + size)); + curr_from_proc[p] = done_from_proc[p] + size; + ADIOI_BUF_COPY + } + else { + size = ADIOI_MIN(len,recv_size[p]-recv_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_from_proc[p] + size) == (unsigned)((ADIO_Offset)curr_from_proc[p] + size)); + curr_from_proc[p] += (unsigned) size; + ADIOI_BUF_COPY + } + } + else { + ADIOI_Assert((curr_from_proc[p] + len) == (unsigned)((ADIO_Offset)curr_from_proc[p] + len)); + curr_from_proc[p] += (unsigned) len; + buf_incr = len; + ADIOI_BUF_INCR + } + } + else { + buf_incr = len; + ADIOI_BUF_INCR + } + off += len; + rem_len -= len; + } + } + for (i=0; i < nprocs; i++) + if (recv_size[i]) recd_from_proc[i] = curr_from_proc[i]; + + ADIOI_Free(curr_from_proc); + ADIOI_Free(done_from_proc); + ADIOI_Free(recv_buf_idx); +} + +static void ADIOI_R_Exchange_data_alltoallv( + ADIO_File fd, void *buf, ADIOI_Flatlist_node + *flat_buf, ADIO_Offset *offset_list, ADIO_Offset + *len_list, int *send_size, int *recv_size, + int *count, int *start_pos, int *partial_send, + int *recd_from_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + ADIOI_Access *others_req, + int iter, MPI_Aint buftype_extent, int *buf_idx) +{ + int i, j, k=0, tmp=0, nprocs_recv, nprocs_send; + char **recv_buf = NULL; + MPI_Request *requests=NULL; + MPI_Status *statuses=NULL; + int rtail, stail; + char *sbuf_ptr, *from_ptr; + int len; + int *sdispls, *rdispls; + char *all_recv_buf, *all_send_buf; + int my_too_big, too_big; + + /* exchange send_size info so that each process knows how much to + receive from whom and how much memory to allocate. */ + MPI_Alltoall(send_size, 1, MPI_INT, recv_size, 1, MPI_INT, fd->comm); + + /* we now have enough information to know how much memory we will allocate + * for this routine */ + my_too_big = ADIOI_too_much_memory_for_alltoallv(nprocs, + send_size, recv_size); + MPI_Allreduce(&my_too_big, &too_big, 1, MPI_INT, MPI_MAX, fd->comm); + if (too_big) { + /* fall back to point-to-point */ + ADIOI_R_Exchange_data(fd, buf, flat_buf, + offset_list, len_list, send_size, recv_size, + count, start_pos, partial_send, recd_from_proc, + nprocs, myrank, buftype_is_contig, + contig_access_count, min_st_offset, + fd_size, fd_start, fd_end, + others_req, iter, buftype_extent, buf_idx); + return; + } + + + nprocs_recv = 0; + for (i=0; icomm ); + +#if 0 + DBG_FPRINTF(stderr, "\tall_recv_buf = " ); + for (i=131072; i<131073; i++) { DBG_FPRINTF(stderr, "%2d,", all_recv_buf [i] ); } + DBG_FPRINTF(stderr, "\n" ); +#endif + + /* unpack at the receiver side */ + if (nprocs_recv) { + if (!buftype_is_contig) + ADIOI_Fill_user_buffer(fd, buf, flat_buf, recv_buf, + offset_list, len_list, (unsigned*)recv_size, + requests, statuses, /* never used inside */ + recd_from_proc, + nprocs, contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + buftype_extent); + else { + rtail = 0; + for (i=0; i < nprocs; i++) + if (recv_size[i]) { + memcpy( (char *)buf + buf_idx[i], all_recv_buf + rtail, recv_size[i] ); + buf_idx[i] += recv_size[i]; + rtail += recv_size[i]; + } + } + } + + ADIOI_Free( all_send_buf ); + ADIOI_Free( all_recv_buf ); + ADIOI_Free( recv_buf ); + ADIOI_Free( sdispls ); + ADIOI_Free( rdispls ); + return; +} + +static int ADIOI_too_much_memory_for_alltoallv(int nprocs, + int * send_size, int *recv_size) { + + unsigned int threshold; +#ifdef HAVE_KERNEL_GETMEMORYSIZE + Kernel_GetMemorySize(KERNEL_MEMSIZE_ESTHEAPAVAIL, &threshold); +#else + threshold = 1024*1024*128; +#endif + + int i, mem_required=0; + + for (i=0; i< nprocs; i++) + /* the 'stail' and 'rtail' arrays */ + mem_required += recv_size[i] + send_size[i]; + /* the sdispl, recv_buf, and rdispls arrays */ + mem_required += nprocs*sizeof(int)*3; + + if (mem_required > threshold) return 1; + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_read.c new file mode 100644 index 0000000000..b62c8f4fcf --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_read.c @@ -0,0 +1,546 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_read.c + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_bgl.h" +#include "adio_extern.h" + +#include "ad_bgl_tuning.h" + +void ADIOI_BGL_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int *error_code) +{ + int err=-1, datatype_size; + ADIO_Offset len; + static char myname[] = "ADIOI_BGL_READCONTIG"; +#if BGL_PROFILE + /* timing */ + double io_time, io_time2; + + if (bglmpio_timing) { + io_time = MPI_Wtime(); + bglmpio_prof_cr[ BGLMPIO_CIO_DATA_SIZE ] += len; + } +#endif + + MPI_Type_size(datatype, &datatype_size); + len = (ADIO_Offset)datatype_size * (ADIO_Offset)count; + ADIOI_Assert(len == (unsigned int) len); /* read takes an unsigned int parm */ + +#if BGL_PROFILE + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + if (bglmpio_timing2) io_time2 = MPI_Wtime(); + if (fd->fp_sys_posn != offset) + lseek(fd->fd_sys, offset, SEEK_SET); + if (bglmpio_timing2) bglmpio_prof_cr[ BGLMPIO_CIO_T_SEEK ] += (MPI_Wtime() - io_time2); + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); + else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); + if (bglmpio_timing2) io_time2 = MPI_Wtime(); + err = read(fd->fd_sys, buf, (unsigned int)len); + if (bglmpio_timing2) bglmpio_prof_cr[ BGLMPIO_CIO_T_POSI_RW ] += (MPI_Wtime() - io_time2); + ADIOI_UNLOCK(fd, offset, SEEK_SET, len); + fd->fp_sys_posn = offset + err; + /* individual file pointer not updated */ + } + else { /* read from curr. location of ind. file pointer */ + offset = fd->fp_ind; + if (bglmpio_timing2) io_time2 = MPI_Wtime(); + if (fd->fp_sys_posn != fd->fp_ind) + lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); + if (bglmpio_timing2) bglmpio_prof_cr[ BGLMPIO_CIO_T_SEEK ] += (MPI_Wtime() - io_time2); + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); + else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); + if (bglmpio_timing2) io_time2 = MPI_Wtime(); + err = read(fd->fd_sys, buf, (unsigned int)len); + if (bglmpio_timing2) bglmpio_prof_cr[ BGLMPIO_CIO_T_POSI_RW ] += (MPI_Wtime() - io_time2); + ADIOI_UNLOCK(fd, offset, SEEK_SET, len); + fd->fp_ind += err; + fd->fp_sys_posn = fd->fp_ind; + } + +#else /* BGL_PROFILE */ + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + if (fd->fp_sys_posn != offset) + lseek(fd->fd_sys, offset, SEEK_SET); + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); + else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); + err = read(fd->fd_sys, buf, (unsigned int)len); + ADIOI_UNLOCK(fd, offset, SEEK_SET, len); + fd->fp_sys_posn = offset + err; + /* individual file pointer not updated */ + } + else { /* read from curr. location of ind. file pointer */ + offset = fd->fp_ind; + if (fd->fp_sys_posn != fd->fp_ind) + lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); + else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); + err = read(fd->fd_sys, buf, (unsigned int)len); + ADIOI_UNLOCK(fd, offset, SEEK_SET, len); + fd->fp_ind += err; + fd->fp_sys_posn = fd->fp_ind; + } + +#endif /* BGL_PROFILE */ + +#if BGL_PROFILE + if (bglmpio_timing) bglmpio_prof_cr[ BGLMPIO_CIO_T_MPIO_RW ] += (MPI_Wtime() - io_time); +#endif + + /* --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 + MPIR_Status_set_bytes(status, datatype, err); +#endif + + *error_code = MPI_SUCCESS; +} + + +#define ADIOI_BUFFERED_READ \ +{ \ + if (req_off >= readbuf_off + readbuf_len) { \ + readbuf_off = req_off; \ + readbuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\ + lseek(fd->fd_sys, readbuf_off, SEEK_SET);\ + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len);\ + err = read(fd->fd_sys, readbuf, readbuf_len);\ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len);\ + if (err == -1) err_flag = 1; \ + } \ + while (req_len > readbuf_off + readbuf_len - req_off) { \ + ADIOI_Assert((readbuf_off + readbuf_len - req_off) == (int) (readbuf_off + readbuf_len - req_off));\ + partial_read = (int) (readbuf_off + readbuf_len - req_off); \ + tmp_buf = (char *) ADIOI_Malloc(partial_read); \ + memcpy(tmp_buf, readbuf+readbuf_len-partial_read, partial_read); \ + ADIOI_Free(readbuf); \ + readbuf = (char *) ADIOI_Malloc(partial_read + max_bufsize); \ + memcpy(readbuf, tmp_buf, partial_read); \ + ADIOI_Free(tmp_buf); \ + readbuf_off += readbuf_len-partial_read; \ + readbuf_len = (unsigned) (partial_read + ADIOI_MIN(max_bufsize, \ + end_offset-readbuf_off+1)); \ + lseek(fd->fd_sys, readbuf_off+partial_read, SEEK_SET);\ + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read);\ + err = read(fd->fd_sys, readbuf+partial_read, readbuf_len-partial_read);\ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read);\ + if (err == -1) err_flag = 1; \ + } \ + ADIOI_Assert(req_len == (size_t)req_len); \ + memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ +} + + +void ADIOI_BGL_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code) +{ +/* offset is in units of etype relative to the filetype. */ + + + ADIOI_Flatlist_node *flat_buf, *flat_file; + ADIO_Offset i_offset, new_brd_size, brd_size, size; + int i, j, k, err=-1, st_index=0; + ADIO_Offset frd_size=0, new_frd_size, st_frd_size; + unsigned num, bufsize; + int n_etypes_in_filetype; + ADIO_Offset n_filetypes, etype_in_filetype, st_n_filetypes, size_in_filetype; + ADIO_Offset abs_off_in_filetype=0; + int filetype_size, etype_size, buftype_size, partial_read; + MPI_Aint filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off, req_len, sum; + ADIO_Offset off, req_off, disp, end_offset=0, readbuf_off, start_off; + char *readbuf, *tmp_buf, *value; + int err_flag=0, info_flag; + unsigned max_bufsize, readbuf_len; + static char myname[] = "ADIOI_BGL_READSTRIDED"; + + if (fd->hints->ds_read == ADIOI_HINT_DISABLE) { + /* if user has disabled data sieving on reads, use naive + * approach instead. + */ + /*FPRINTF(stderr, "ADIOI_GEN_ReadStrided_naive(%d):\n", __LINE__);*/ + ADIOI_GEN_ReadStrided_naive(fd, + buf, + count, + datatype, + file_ptr_type, + offset, + status, + error_code); + return; + } + /*FPRINTF(stderr, "%s(%d):\n",myname, __LINE__);*/ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size(fd->filetype, &filetype_size); + if ( ! filetype_size ) { + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); + bufsize = buftype_size * count; + +/* get max_bufsize from the info object. */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); + ADIOI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, + &info_flag); + max_bufsize = atoi(value); + ADIOI_Free(value); + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + (ADIO_Offset)etype_size * offset; + + start_off = off; + end_offset = off + bufsize - 1; + readbuf_off = off; + readbuf = (char *) ADIOI_Malloc(max_bufsize); + readbuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1)); + +/* if atomicity is true, lock (exclusive) the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + lseek(fd->fd_sys, readbuf_off, SEEK_SET); + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len); + err = read(fd->fd_sys, readbuf, readbuf_len); + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len); + if (err == -1) err_flag = 1; + + for (j=0; jcount; i++) { + userbuf_off = (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_READ + off += flat_buf->blocklens[i]; + } + } + + if (fd->atomicity) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; + + ADIOI_Free(readbuf); /* malloced in the buffered_read macro */ + + if (err_flag) { + *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; + } + + else { /* noncontiguous in file */ + +/* filetype already flattened in ADIO_Open */ + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset)n_filetypes * filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i=0; icount; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* frd_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + frd_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + frd_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; + } + else { + n_etypes_in_filetype = filetype_size/etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i=0; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + frd_size = 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 */ + offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + + abs_off_in_filetype; + } + + start_off = offset; + + /* Wei-keng Liao: read request is within a single flat_file contig + * block e.g. with subarray types that actually describe the whole + * array */ + if (buftype_is_contig && bufsize <= frd_size) { + ADIO_ReadContig(fd, buf, bufsize, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte that + * can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == frd_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + n_filetypes*filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + return; + } + + /* Calculate end_offset, the last byte-offset that will be accessed. + e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ + + st_frd_size = frd_size; + st_n_filetypes = n_filetypes; + i_offset = 0; + j = st_index; + off = offset; + frd_size = ADIOI_MIN(st_frd_size, bufsize); + while (i_offset < bufsize) { + i_offset += frd_size; + end_offset = off + frd_size - 1; + + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + n_filetypes*(ADIO_Offset)filetype_extent; + frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); + } + +/* if atomicity is true, lock (exclusive) the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + /* initial read into readbuf */ + readbuf_off = offset; + readbuf = (char *) ADIOI_Malloc(max_bufsize); + readbuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1)); + + lseek(fd->fd_sys, offset, SEEK_SET); + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, offset, SEEK_SET, readbuf_len); + err = read(fd->fd_sys, readbuf, readbuf_len); + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, offset, SEEK_SET, readbuf_len); + + if (err == -1) err_flag = 1; + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + frd_size = ADIOI_MIN(st_frd_size, bufsize); + while (i_offset < bufsize) { + if (frd_size) { + /* TYPE_UB and TYPE_LB can result in + frd_size = 0. save system call in such cases */ + /* lseek(fd->fd_sys, off, SEEK_SET); + err = read(fd->fd_sys, ((char *) buf) + i, frd_size);*/ + + req_off = off; + req_len = frd_size; + userbuf_off = i_offset; + ADIOI_BUFFERED_READ + } + i_offset += frd_size; + + if (off + frd_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes*(ADIO_Offset)filetype_extent) + off += frd_size; + /* did not reach end of contiguous block in filetype. + no more I/O needed. off is incremented by frd_size. */ + else { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); + } + } + } + else { +/* noncontiguous in memory as well as in file */ + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + k = num = buf_count = 0; + i_offset = flat_buf->indices[0]; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = ADIOI_MIN(frd_size, brd_size); + if (size) { + /* lseek(fd->fd_sys, off, SEEK_SET); + err = read(fd->fd_sys, ((char *) buf) + i, size); */ + + req_off = off; + req_len = size; + userbuf_off = i_offset; + ADIOI_BUFFERED_READ + } + + new_frd_size = frd_size; + new_brd_size = brd_size; + + if (size == frd_size) { +/* reached end of contiguous block in file */ + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + + new_frd_size = flat_file->blocklens[j]; + if (size != brd_size) { + i_offset += size; + new_brd_size -= size; + } + } + + if (size == brd_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1)%flat_buf->count; + buf_count++; + i_offset = ((ADIO_Offset)buftype_extent*(ADIO_Offset)(buf_count/flat_buf->count) + + flat_buf->indices[k]); + new_brd_size = flat_buf->blocklens[k]; + if (size != frd_size) { + off += size; + new_frd_size -= size; + } + } + ADIOI_Assert(((ADIO_Offset)num + size) == (unsigned)(num + size)); + num += size; + frd_size = new_frd_size; + brd_size = new_brd_size; + } + } + + if (fd->atomicity) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; + + ADIOI_Free(readbuf); /* malloced in the buffered_read macro */ + + if (err_flag) { + *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; + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually read and placed in buf + by ADIOI_BUFFERED_READ. */ +#endif + + if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_setsh.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_setsh.c new file mode 100644 index 0000000000..b7a8bce998 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_setsh.c @@ -0,0 +1,68 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_setsh.c + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_bgl.h" + +/* 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 BGL, ADIOI_BGL_WriteContig does a lock before writing to disable +caching. To avoid the lock being called twice, this version for BGL does + +Write lock +Lseek +Write +Unlock + +*/ + +void ADIOI_BGL_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code) +{ + int err; + MPI_Comm dupcommself; + static char myname[] = "ADIOI_BGL_SET_SHARED_FP"; + + 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, fd->fns, + ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, + 0, MPI_BYTE, MPI_BYTE, MPI_INFO_NULL, + ADIO_PERM_NULL, error_code); + } + + if (*error_code != MPI_SUCCESS) return; + + ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); + err = write(fd->shared_fp_fd->fd_sys, &offset, sizeof(ADIO_Offset)); + ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); + + if (err == -1) { + *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; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_tuning.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_tuning.c new file mode 100644 index 0000000000..0f54de1d67 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_tuning.c @@ -0,0 +1,163 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_tuning.c + * \brief defines ad_bgl performance tuning + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +/*--------------------------------------------------------------------- + * ad_bgl_tuning.c + * + * defines global variables and functions for performance tuning and + * functional debugging. + *---------------------------------------------------------------------*/ + +#include "ad_bgl_tuning.h" +#include "mpi.h" + +#if !defined(PVFS2_SUPER_MAGIC) + #define PVFS2_SUPER_MAGIC (0x20030528) +#endif + +int bglmpio_timing; +int bglmpio_timing2; +int bglmpio_comm; +int bglmpio_tunegather; +int bglmpio_tuneblocking; +long bglocklessmpio_f_type; + +double bglmpio_prof_cw [BGLMPIO_CIO_LAST]; +double bglmpio_prof_cr [BGLMPIO_CIO_LAST]; + +/* set internal variables for tuning environment variables */ +/** \page mpiio_vars MPIIO Configuration + \section env_sec Environment Variables + * - BGLMPIO_COMM - Define how data is exchanged on collective + * reads and writes. Possible values: + * - 0 - Use MPI_Alltoallv. + * - 1 - Use MPI_Isend/MPI_Irecv. + * - Default is 0. + * + * - BGLMPIO_TIMING - collect timing breakdown for MPI I/O collective calls. + * Must also compile the library with BGL_PROFILE defined. Possible values: + * - 0 - Do not collect/report timing. + * - 1 - Collect/report timing. + * - Default is 0. + * + * - BGLMPIO_TIMING2 - collect additional averages for MPI I/O collective calls. + * Must also compile the library with BGL_PROFILE defined. Possible values: + * - 0 - Do not collect/report averages. + * - 1 - Collect/report averages. + * - Default is 0. + * + * - BGLMPIO_TUNEGATHER - Tune how starting and ending offsets are communicated + * for aggregator collective i/o. Possible values: + * - 0 - Use two MPI_Allgather's to collect starting and ending offsets. + * - 1 - Use MPI_Allreduce(MPI_MAX) to collect starting and ending offsets. + * - Default is 1. + * + * - BGLMPIO_TUNEBLOCKING - Tune how aggregate file domains are + * calculated (block size). Possible values: + * - 0 - Evenly calculate file domains across aggregators. Also use + * MPI_Isend/MPI_Irecv to exchange domain information. + * - 1 - Align file domains with the underlying file system's block size. Also use + * MPI_Alltoallv to exchange domain information. + * - Default is 1. + * + * - BGLOCKLESSMPIO_F_TYPE - Specify a filesystem type that should run + * the ad_bglockless driver. NOTE: Using romio prefixes (such as + * "bgl:" or "bglockless:") on a file name will override this environment + * variable. Possible values: + * - 0xnnnnnnnn - Any valid file system type (or "magic number") from + * statfs() field f_type. + * - The default is 0x20030528 (PVFS2_SUPER_MAGIC) + * +*/ +void ad_bgl_get_env_vars() { + char *x, *dummy; + + bglmpio_comm = 0; + x = getenv( "BGLMPIO_COMM" ); + if (x) bglmpio_comm = atoi(x); + bglmpio_timing = 0; + x = getenv( "BGLMPIO_TIMING" ); + if (x) bglmpio_timing = atoi(x); + bglmpio_timing2 = 0; + x = getenv( "BGLMPIO_TIMING2" ); + if (x) bglmpio_timing2 = atoi(x); + bglmpio_tunegather = 1; + x = getenv( "BGLMPIO_TUNEGATHER" ); + if (x) bglmpio_tunegather = atoi(x); + bglmpio_tuneblocking = 1; + x = getenv( "BGLMPIO_TUNEBLOCKING" ); + if (x) bglmpio_tuneblocking = atoi(x); + bglocklessmpio_f_type = PVFS2_SUPER_MAGIC; + x = getenv( "BGLOCKLESSMPIO_F_TYPE" ); + if (x) bglocklessmpio_f_type = strtol(x,&dummy,0); + DBG_FPRINTF(stderr,"BGLOCKLESSMPIO_F_TYPE=%ld/%#lX\n", + bglocklessmpio_f_type,bglocklessmpio_f_type); +} + +/* report timing breakdown for MPI I/O collective call */ +void ad_bgl_wr_timing_report( int rw, ADIO_File fd, int myrank, int nprocs ) +{ + int i; + + if (bglmpio_timing) { + + double *bglmpio_prof_org = bglmpio_prof_cr; + if (rw) bglmpio_prof_org = bglmpio_prof_cw; + + double bglmpio_prof_avg[ BGLMPIO_CIO_LAST ]; + double bglmpio_prof_max[ BGLMPIO_CIO_LAST ]; + + MPI_Reduce( bglmpio_prof_org, bglmpio_prof_avg, BGLMPIO_CIO_LAST, MPI_DOUBLE, MPI_SUM, 0, fd->comm ); + MPI_Reduce( bglmpio_prof_org, bglmpio_prof_max, BGLMPIO_CIO_LAST, MPI_DOUBLE, MPI_MAX, 0, fd->comm ); + + if (myrank == 0) { + + for (i=0; i= LEVEL) { \ + int i; \ + for ( i = 0; i < BGLMPIO_T_LAST; i ++ ) \ + bglmpio_prof_c##RW [ i ] = 0; \ + } + +#define BGLMPIO_T_CIO_REPORT( LEVEL, RW, FD, MYRANK, NPROCS ) \ + if (bglmpio_timing_cw_level >= LEVEL) { \ + ad_bgl_timing_crw_report ( RW, FD, MYRANK, NPROCS ); \ + } + +#define BGLMPIO_T_CIO_SET_GET( LEVEL, RW, DOBAR, ISSET, ISGET, VAR1, VAR2 ) \ + if (bglmpio_timing_cw_level >= LEVEL) { \ + if ( DOBAR ) MPI_Barrier( fd->comm ); \ + double temp = MPI_Wtime(); \ + if ( ISSET ) bglmpio_prof_c##RW [ VAR1 ] = temp; \ + if ( ISGET ) bglmpio_prof_c##RW [ VAR2 ] = temp - bglmpio_prof_c##RW [ VAR2 ] ; \ + } + +#endif /* AD_BGL_TUNING_H_ */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_wrcoll.c new file mode 100644 index 0000000000..232b20e997 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_wrcoll.c @@ -0,0 +1,1535 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_wrcoll.c + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_bgl.h" +#include "ad_bgl_pset.h" +#include "ad_bgl_aggrs.h" + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif +#ifdef PROFILE +#include "mpe.h" +#endif + +/* prototypes of functions used for collective writes only. */ +static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, int myrank, ADIOI_Access + *others_req, ADIO_Offset *offset_list, + ADIO_Offset *len_list, int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + int *buf_idx, int *error_code); +static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, + ADIOI_Flatlist_node *flat_buf, ADIO_Offset + *offset_list, ADIO_Offset *len_list, int *send_size, + int *recv_size, ADIO_Offset off, int size, + int *count, int *start_pos, int *partial_recv, + int *sent_to_proc, int nprocs, + int myrank, int + buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + ADIOI_Access *others_req, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int *hole, int iter, + MPI_Aint buftype_extent, int *buf_idx, int *error_code); +static void ADIOI_W_Exchange_data_alltoallv( + ADIO_File fd, void *buf, + char *write_buf, /* 1 */ + ADIOI_Flatlist_node *flat_buf, + ADIO_Offset *offset_list, + ADIO_Offset *len_list, int *send_size, int *recv_size, + ADIO_Offset off, int size, /* 2 */ + int *count, int *start_pos, int *partial_recv, + int *sent_to_proc, int nprocs, int myrank, + int buftype_is_contig, int contig_access_count, + ADIO_Offset min_st_offset, + ADIO_Offset fd_size, + ADIO_Offset *fd_start, + ADIO_Offset *fd_end, + ADIOI_Access *others_req, + int *send_buf_idx, int *curr_to_proc, /* 3 */ + int *done_to_proc, int *hole, /* 4 */ + int iter, MPI_Aint buftype_extent, int *buf_idx, + int *error_code); +static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + *flat_buf, char **send_buf, ADIO_Offset + *offset_list, ADIO_Offset *len_list, int *send_size, + MPI_Request *requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, + MPI_Aint buftype_extent); +static void ADIOI_Fill_send_buffer_nosend(ADIO_File fd, void *buf, ADIOI_Flatlist_node + *flat_buf, char **send_buf, ADIO_Offset + *offset_list, ADIO_Offset *len_list, int *send_size, + MPI_Request *requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, ADIO_Offset + min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, + MPI_Aint buftype_extent); +static void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, + ADIO_Offset *srt_off, int *srt_len, int *start_pos, + int nprocs, int nprocs_recv, int total_elements); + + +void ADIOI_BGL_WriteStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code) +{ +/* Uses a generalized version of the extended two-phase method described + in "An Extended Two-Phase Method for Accessing Sections of + Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + Scientific Programming, (5)4:301--317, Winter 1996. + http://www.mcs.anl.gov/home/thakur/ext2ph.ps */ + + ADIOI_Access *my_req; + /* array of nprocs access structures, one for each other process in + whose file domain this process's request lies */ + + ADIOI_Access *others_req; + /* array of nprocs access structures, one for each other process + whose request lies in this process's file domain. */ + + int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; + int contig_access_count=0, interleave_count = 0, buftype_is_contig; + int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; + ADIO_Offset orig_fp, start_offset, end_offset, fd_size, min_st_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, + *fd_end = NULL, *end_offsets = NULL; + ADIO_Offset *bgl_offsets0 = NULL, *bgl_offsets = NULL; + int ii; + + int *buf_idx = NULL; + ADIO_Offset *len_list = NULL; +#if BGL_PROFILE + BGLMPIO_T_CIO_RESET( 0, w ) +#endif +#if 0 + /* From common code - not implemented for bgl.*/ + int old_error, tmp_error; +#endif +#ifdef PROFILE + MPE_Log_event(13, 0, "start computation"); +#endif + +#if 0 +/* From common code - not implemented for bgl. */ + if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { + ADIOI_IOStridedColl (fd, buf, count, ADIOI_WRITE, datatype, + file_ptr_type, offset, status, error_code); + return; + } +#endif + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + +/* the number of processes that actually perform I/O, nprocs_for_coll, + * is stored in the hints off the ADIO_File structure + */ + nprocs_for_coll = fd->hints->cb_nodes; + orig_fp = fd->fp_ind; + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, w, 0, 1, 0, BGLMPIO_CIO_LCOMP, BGLMPIO_CIO_LAST ) +#endif + + + /* only check for interleaving if cb_write isn't disabled */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + lengths in the file and determine the start and end offsets. */ + + /* Note: end_offset points to the last byte-offset that will be accessed. + e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ + + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, w, 1, 1, 1, BGLMPIO_CIO_GATHER, BGLMPIO_CIO_LCOMP ) +#endif + + /* each process communicates its start and end offsets to other + processes. The result is an array each of start and end offsets stored + in order of process rank. */ + + st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); + end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); + + if (bglmpio_tunegather) { + bgl_offsets0 = (ADIO_Offset *) ADIOI_Malloc(2*nprocs*sizeof(ADIO_Offset)); + bgl_offsets = (ADIO_Offset *) ADIOI_Malloc(2*nprocs*sizeof(ADIO_Offset)); + for (ii=0; iicomm ); + + for (ii=0; iicomm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, + ADIO_OFFSET, fd->comm); + } + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, w, 0, 1, 1, BGLMPIO_CIO_PATANA, BGLMPIO_CIO_GATHER ) +#endif + + /* are the accesses of different processes interleaved? */ + for (i=1; ihints->cb_write == ADIOI_HINT_DISABLE || + (!interleave_count && (fd->hints->cb_write == ADIOI_HINT_AUTO))) + { + /* use independent accesses */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(len_list); + ADIOI_Free(st_offsets); + ADIOI_Free(end_offsets); + } + + fd->fp_ind = orig_fp; + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + if (buftype_is_contig && filetype_is_contig) { + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; + ADIO_WriteContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, + off, status, error_code); + } + else ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, + 0, status, error_code); + } + else ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, + offset, status, error_code); + + return; + } + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, w, 1, 1, 1, BGLMPIO_CIO_FD_PART, BGLMPIO_CIO_PATANA ) +#endif + +/* Divide the I/O workload among "nprocs_for_coll" processes. This is + done by (logically) dividing the file into file domains (FDs); each + process may directly access only its own file domain. */ + + if (bglmpio_tuneblocking) + ADIOI_BGL_GPFS_Calc_file_domains(st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, &fd_size, fd->fs_ptr); + else + ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, + nprocs_for_coll, &min_st_offset, + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, + fd->hints->striping_unit); + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, w, 0, 1, 1, BGLMPIO_CIO_MYREQ, BGLMPIO_CIO_FD_PART ) +#endif + +/* calculate what portions of the access requests of this process are + located in what file domains */ + + if (bglmpio_tuneblocking) + ADIOI_BGL_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, + &count_my_req_per_proc, &my_req, + &buf_idx); + else + ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, + &count_my_req_per_proc, &my_req, + &buf_idx); + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, w, 1, 1, 1, BGLMPIO_CIO_OTHREQ, BGLMPIO_CIO_MYREQ ) +#endif + +/* based on everyone's my_req, calculate what requests of other + processes lie in this process's file domain. + count_others_req_procs = number of processes whose requests lie in + this process's file domain (including this process itself) + count_others_req_per_proc[i] indicates how many separate contiguous + requests of proc. i lie in this process's file domain. */ + + if (bglmpio_tuneblocking) + ADIOI_BGL_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, + &count_others_req_procs, &others_req); + else + ADIOI_Calc_others_req(fd, count_my_req_procs, + count_my_req_per_proc, my_req, + nprocs, myrank, + &count_others_req_procs, &others_req); + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, w, 1, 1, 1, BGLMPIO_CIO_DEXCH, BGLMPIO_CIO_OTHREQ ) +#endif + + ADIOI_Free(count_my_req_per_proc); + for (i=0; i < nprocs; i++) { + if (my_req[i].count) { + ADIOI_Free(my_req[i].offsets); + ADIOI_Free(my_req[i].lens); + } + } + ADIOI_Free(my_req); + +/* exchange data and write in sizes of no more than coll_bufsize. */ + ADIOI_Exch_and_write(fd, buf, datatype, nprocs, myrank, + others_req, offset_list, + len_list, contig_access_count, min_st_offset, + fd_size, fd_start, fd_end, buf_idx, error_code); + +#if BGL_PROFILE + BGLMPIO_T_CIO_SET_GET( 0, w, 1, 0, 1, BGLMPIO_CIO_LAST, BGLMPIO_CIO_T_DEXCH ) + BGLMPIO_T_CIO_SET_GET( 0, w, 0, 0, 1, BGLMPIO_CIO_LAST, BGLMPIO_CIO_T_MPIO_CRW ) + + BGLMPIO_T_CIO_REPORT( 0, w, fd, myrank ) +#endif +#if 0 + /* From common code - not implemented for bgl. + * + * If this collective write is followed by an independent write, + * it's possible to have those subsequent writes on other processes + * race ahead and sneak in before the read-modify-write completes. + * We carry out a collective communication at the end here so no one + * can start independent i/o before collective I/O completes. + * + * need to do some gymnastics with the error codes so that if something + * went wrong, all processes report error, but if a process has a more + * specific error code, we can still have that process report the + * additional information */ + + old_error = *error_code; + if (*error_code != MPI_SUCCESS) *error_code = MPI_ERR_IO; + + /* optimization: if only one process performing i/o, we can perform + * a less-expensive Bcast */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_postwrite_a, 0, NULL ); +#endif + if (fd->hints->cb_nodes == 1) + MPI_Bcast(error_code, 1, MPI_INT, + fd->hints->ranklist[0], fd->comm); + else { + tmp_error = *error_code; + MPI_Allreduce(&tmp_error, error_code, 1, MPI_INT, + MPI_MAX, fd->comm); + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_postwrite_b, 0, NULL ); +#endif +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5012, 0, NULL); +#endif + + if ( (old_error != MPI_SUCCESS) && (old_error != MPI_ERR_IO) ) + *error_code = old_error; + + +#endif +/* free all memory allocated for collective I/O */ + if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); + + for (i=0; ifp_sys_posn = -1; /* set it to null. */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5013, 0, NULL); +#endif +} + + + +/* If successful, error_code is set to MPI_SUCCESS. Otherwise an error + * code is created and returned in error_code. + */ +static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype + datatype, int nprocs, + int myrank, + ADIOI_Access + *others_req, ADIO_Offset *offset_list, + ADIO_Offset *len_list, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + int *buf_idx, int *error_code) +{ +/* Send data to appropriate processes and write in sizes of no more + than coll_bufsize. + The idea is to reduce the amount of extra memory required for + collective I/O. If all data were written all at once, which is much + easier, it would require temp space more than the size of user_buf, + which is often unacceptable. For example, to write a distributed + array to a file, where each local array is 8Mbytes, requiring + at least another 8Mbytes of temp space is unacceptable. */ + + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ + ADIO_Offset size=0; + int hole, i, j, m, ntimes, max_ntimes, buftype_is_contig; + ADIO_Offset st_loc=-1, end_loc=-1, off, done, req_off; + char *write_buf=NULL; + int *curr_offlen_ptr, *count, *send_size, req_len, *recv_size; + int *partial_recv, *sent_to_proc, *start_pos, flag; + int *send_buf_idx, *curr_to_proc, *done_to_proc; + MPI_Status status; + ADIOI_Flatlist_node *flat_buf=NULL; + MPI_Aint buftype_extent; + int info_flag, coll_bufsize; + char *value; + static char myname[] = "ADIOI_EXCH_AND_WRITE"; + + *error_code = MPI_SUCCESS; /* changed below if error */ + /* only I/O errors are currently reported */ + +/* calculate the number of writes of size coll_bufsize + to be done by each process and the max among all processes. + That gives the no. of communication phases as well. */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); + ADIOI_Info_get(fd->info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, + &info_flag); + coll_bufsize = atoi(value); + ADIOI_Free(value); + + + for (i=0; i < nprocs; i++) { + if (others_req[i].count) { + st_loc = others_req[i].offsets[0]; + end_loc = others_req[i].offsets[0]; + break; + } + } + + for (i=0; i < nprocs; i++) + for (j=0; j < others_req[i].count; j++) { + st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]); + end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] + + others_req[i].lens[j] - 1)); + } + +/* ntimes=ceiling_div(end_loc - st_loc + 1, coll_bufsize)*/ + + ntimes = (int) ((end_loc - st_loc + coll_bufsize)/coll_bufsize); + + if ((st_loc==-1) && (end_loc==-1)) { + ntimes = 0; /* this process does no writing. */ + } + + MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, + fd->comm); + + if (ntimes) write_buf = (char *) ADIOI_Malloc(coll_bufsize); + + curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* its use is explained below. calloc initializes to 0. */ + + count = (int *) ADIOI_Malloc(nprocs*sizeof(int)); + /* to store count of how many off-len pairs per proc are satisfied + in an iteration. */ + + partial_recv = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* if only a portion of the last off-len pair is recd. from a process + in a particular iteration, the length recd. is stored here. + calloc initializes to 0. */ + + send_size = (int *) ADIOI_Malloc(nprocs*sizeof(int)); + /* total size of data to be sent to each proc. in an iteration. + Of size nprocs so that I can use MPI_Alltoall later. */ + + recv_size = (int *) ADIOI_Malloc(nprocs*sizeof(int)); + /* total size of data to be recd. from each proc. in an iteration.*/ + + sent_to_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* amount of data sent to each proc so far. Used in + ADIOI_Fill_send_buffer. initialized to 0 here. */ + + send_buf_idx = (int *) ADIOI_Malloc(nprocs*sizeof(int)); + curr_to_proc = (int *) ADIOI_Malloc(nprocs*sizeof(int)); + done_to_proc = (int *) ADIOI_Malloc(nprocs*sizeof(int)); + /* Above three are used in ADIOI_Fill_send_buffer*/ + + start_pos = (int *) ADIOI_Malloc(nprocs*sizeof(int)); + /* used to store the starting value of curr_offlen_ptr[i] in + this iteration */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + if (!buftype_is_contig) { + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + } + MPI_Type_extent(datatype, &buftype_extent); + + +/* I need to check if there are any outstanding nonblocking writes to + the file, which could potentially interfere with the writes taking + place in this collective write call. Since this is not likely to be + common, let me do the simplest thing possible here: Each process + completes all pending nonblocking operations before completing. */ + + /*ADIOI_Complete_async(error_code); + if (*error_code != MPI_SUCCESS) return; + MPI_Barrier(fd->comm); + */ + + done = 0; + off = st_loc; + +#ifdef PROFILE + MPE_Log_event(14, 0, "end computation"); +#endif + + for (m=0; m < ntimes; m++) { + /* go through all others_req and check which will be satisfied + by the current write */ + + /* Note that MPI guarantees that displacements in filetypes are in + monotonically nondecreasing order and that, for writes, the + filetypes cannot specify overlapping regions in the file. This + simplifies implementation a bit compared to reads. */ + + /* off = start offset in the file for the data to be written in + this iteration + size = size of data written (bytes) corresponding to off + req_off = off in file for a particular contiguous request + minus what was satisfied in previous iteration + req_size = size corresponding to req_off */ + + /* first calculate what should be communicated */ + +#ifdef PROFILE + MPE_Log_event(13, 0, "start computation"); +#endif + for (i=0; i < nprocs; i++) count[i] = recv_size[i] = 0; + + size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); + + for (i=0; i < nprocs; i++) { + if (others_req[i].count) { + start_pos[i] = curr_offlen_ptr[i]; + for (j=curr_offlen_ptr[i]; jcomm); + + /* create derived datatypes for recv */ + + nprocs_recv = 0; + for (i=0; i srt_len[0]) srt_len[0] = new_len; + } + else + break; + } + if (i < sum || size != srt_len[0]) /* hole in middle or end */ + *hole = 1; + } + + ADIOI_Free(srt_off); + ADIOI_Free(srt_len); + } + + if (nprocs_recv) { + if (*hole) { + ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, &err); + /* --BEGIN ERROR HANDLING-- */ + if (err != MPI_SUCCESS) { + *error_code = MPIO_Err_create_code(err, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, + "**ioRMWrdwr", 0); + return; + } + /* --END ERROR HANDLING-- */ + } + } + + nprocs_send = 0; + for (i=0; i < nprocs; i++) if (send_size[i]) nprocs_send++; + + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send+1)*sizeof(MPI_Request)); + send_req = requests; + } + else { + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send+nprocs_recv+1)*sizeof(MPI_Request)); + /* +1 to avoid a 0-size malloc */ + + /* post receives */ + j = 0; + for (i=0; icomm, requests+j); + j++; + } + } + send_req = requests + nprocs_recv; + } + +/* post sends. if buftype_is_contig, data can be directly sent from + user buf at location given by buf_idx. else use send_buf. */ + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5032, 0, NULL); +#endif + if (buftype_is_contig) { + j = 0; + for (i=0; i < nprocs; i++) + if (send_size[i]) { + MPI_Isend(((char *) buf) + buf_idx[i], send_size[i], + MPI_BYTE, i, myrank+i+100*iter, fd->comm, + send_req+j); + j++; + buf_idx[i] += send_size[i]; + } + } + else if (nprocs_send) { + /* buftype is not contig */ + send_buf = (char **) ADIOI_Malloc(nprocs*sizeof(char*)); + for (i=0; i < nprocs; i++) + if (send_size[i]) + send_buf[i] = (char *) ADIOI_Malloc(send_size[i]); + + ADIOI_Fill_send_buffer(fd, buf, flat_buf, send_buf, + offset_list, len_list, send_size, + send_req, + sent_to_proc, nprocs, myrank, + contig_access_count, + min_st_offset, fd_size, fd_start, fd_end, + send_buf_idx, curr_to_proc, done_to_proc, iter, + buftype_extent); + /* the send is done in ADIOI_Fill_send_buffer */ + } + + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + j = 0; + for (i=0; icomm, &wkl_status); + j++; + } + } + } + + for (i=0; iatomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+1) * \ + sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ + } + else { + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+nprocs_recv+1) * \ + sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ + } + +#ifdef NEEDS_MPI_TEST + i = 0; + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + while (!i) MPI_Testall(nprocs_send, send_req, &i, statuses); + } + else { + while (!i) MPI_Testall(nprocs_send+nprocs_recv, requests, &i, statuses); + } +#else + if (fd->atomicity) + /* bug fix from Wei-keng Liao and Kenin Coloma */ + MPI_Waitall(nprocs_send, send_req, statuses); + else + MPI_Waitall(nprocs_send+nprocs_recv, requests, statuses); +#endif + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5033, 0, NULL); +#endif + ADIOI_Free(statuses); + ADIOI_Free(requests); + if (!buftype_is_contig && nprocs_send) { + for (i=0; i < nprocs; i++) + if (send_size[i]) ADIOI_Free(send_buf[i]); + ADIOI_Free(send_buf); + } +} + + +#define ADIOI_BUF_INCR \ +{ \ + while (buf_incr) { \ + size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + buf_incr -= size_in_buf; \ + } \ +} + + +#define ADIOI_BUF_COPY \ +{ \ + while (size) { \ + size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ + memcpy(&(send_buf[p][send_buf_idx[p]]), \ + ((char *) buf) + user_buf_idx, size_in_buf); \ + send_buf_idx[p] += size_in_buf; \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + size -= size_in_buf; \ + buf_incr -= size_in_buf; \ + } \ + ADIOI_BUF_INCR \ +} + +static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + *flat_buf, char **send_buf, ADIO_Offset + *offset_list, ADIO_Offset *len_list, int *send_size, + MPI_Request *requests, int *sent_to_proc, + int nprocs, int myrank, + int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + int *send_buf_idx, int *curr_to_proc, + int *done_to_proc, int iter, + MPI_Aint buftype_extent) +{ +/* this function is only called if buftype is not contig */ + + int i, p, flat_buf_idx; + ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; + int jj, n_buftypes; + ADIO_Offset off, len, rem_len, user_buf_idx; + +/* curr_to_proc[p] = amount of data sent to proc. p that has already + been accounted for so far + done_to_proc[p] = amount of data already sent to proc. p in + previous iterations + user_buf_idx = current location in user buffer + send_buf_idx[p] = current location in send_buf of proc. p */ + + for (i=0; i < nprocs; i++) { + send_buf_idx[i] = curr_to_proc[i] = 0; + done_to_proc[i] = sent_to_proc[i]; + } + jj = 0; + + user_buf_idx = flat_buf->indices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + flat_buf_sz = size of current contiguous component in + flattened buf */ + + for (i=0; i done_to_proc[p]) { + if (done_to_proc[p] > curr_to_proc[p]) { + size = ADIOI_MIN(curr_to_proc[p] + len - + done_to_proc[p], send_size[p]-send_buf_idx[p]); + buf_incr = done_to_proc[p] - curr_to_proc[p]; + ADIOI_BUF_INCR + ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == (unsigned)(curr_to_proc[p] + len - done_to_proc[p])); + buf_incr = curr_to_proc[p] + len - done_to_proc[p]; + ADIOI_Assert((done_to_proc[p] + size) == (unsigned)(done_to_proc[p] + size)); + curr_to_proc[p] = done_to_proc[p] + size; + ADIOI_BUF_COPY + } + else { + size = ADIOI_MIN(len,send_size[p]-send_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size)); + curr_to_proc[p] += size; + ADIOI_BUF_COPY + } + if (send_buf_idx[p] == send_size[p]) { + MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, + myrank+p+100*iter, fd->comm, requests+jj); + jj++; + } + } + else { + ADIOI_Assert((curr_to_proc[p] + len) == (unsigned)((ADIO_Offset)curr_to_proc[p] + len)); + curr_to_proc[p] += len; + buf_incr = len; + ADIOI_BUF_INCR + } + } + else { + buf_incr = len; + ADIOI_BUF_INCR + } + off += len; + rem_len -= len; + } + } + for (i=0; i < nprocs; i++) + if (send_size[i]) sent_to_proc[i] = curr_to_proc[i]; +} + + + +static void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, + ADIO_Offset *srt_off, int *srt_len, int *start_pos, + int nprocs, int nprocs_recv, int total_elements) +{ + typedef struct { + ADIO_Offset *off_list; + int *len_list; + int nelem; + } heap_struct; + + heap_struct *a, tmp; + int i, j, heapsize, l, r, k, smallest; + + a = (heap_struct *) ADIOI_Malloc((nprocs_recv+1)*sizeof(heap_struct)); + + j = 0; + for (i=0; i=0; i--) { + /* Heapify(a, i, heapsize); Algorithm from Cormen et al. pg. 143 + modified for a heap with smallest element at root. I have + removed the recursion so that there are no function calls. + Function calls are too expensive. */ + k = i; + while (1) { + l = 2*(k+1) - 1; + r = 2*(k+1); + + if ((l < heapsize) && + (*(a[l].off_list) < *(a[k].off_list))) + smallest = l; + else smallest = k; + + if ((r < heapsize) && + (*(a[r].off_list) < *(a[smallest].off_list))) + smallest = r; + + if (smallest != k) { + tmp.off_list = a[k].off_list; + tmp.len_list = a[k].len_list; + tmp.nelem = a[k].nelem; + + a[k].off_list = a[smallest].off_list; + a[k].len_list = a[smallest].len_list; + a[k].nelem = a[smallest].nelem; + + a[smallest].off_list = tmp.off_list; + a[smallest].len_list = tmp.len_list; + a[smallest].nelem = tmp.nelem; + + k = smallest; + } + else break; + } + } + + for (i=0; icomm); + + nprocs_recv = 0; + for (i=0; icomm ); + + /* data sieving pre-read */ + /* To avoid a read-modify-write, check if there are holes in the + data to be written. For this, merge the (sorted) offset lists + others_req using a heap-merge. */ + + sum = 0; + for (i=0; i off) || + ((srt_off[sum-1] + srt_len[sum-1]) < (off + size))) + { + *hole = 1; + } + else /* See if there are holes between the requests, if there are more than one */ + for (i=0; iindices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + flat_buf_sz = size of current contiguous component in + flattened buf */ + + for (i=0; i done_to_proc[p]) { + if (done_to_proc[p] > curr_to_proc[p]) { + size = ADIOI_MIN(curr_to_proc[p] + len - + done_to_proc[p], send_size[p]-send_buf_idx[p]); + buf_incr = done_to_proc[p] - curr_to_proc[p]; + ADIOI_BUF_INCR + ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == (unsigned)(curr_to_proc[p] + len - done_to_proc[p])); + buf_incr = curr_to_proc[p] + len - done_to_proc[p]; + ADIOI_Assert((done_to_proc[p] + size) == (unsigned)(done_to_proc[p] + size)); + curr_to_proc[p] = done_to_proc[p] + size; + ADIOI_BUF_COPY + } + else { + size = ADIOI_MIN(len,send_size[p]-send_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size)); + curr_to_proc[p] += size; + ADIOI_BUF_COPY + } + /* moved to alltoallv */ + /* + if (send_buf_idx[p] == send_size[p]) { + MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, + myrank+p+100*iter, fd->comm, requests+jj); + jj++; + } + */ + } + else { + ADIOI_Assert((curr_to_proc[p] + len) == (unsigned)((ADIO_Offset)curr_to_proc[p] + len)); + curr_to_proc[p] += (int)len; + buf_incr = len; + ADIOI_BUF_INCR + } + } + else { + buf_incr = len; + ADIOI_BUF_INCR + } + off += len; + rem_len -= len; + } + } + for (i=0; i < nprocs; i++) + if (send_size[i]) sent_to_proc[i] = curr_to_proc[i]; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_write.c new file mode 100644 index 0000000000..6fcd569fef --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bgl/ad_bgl_write.c @@ -0,0 +1,608 @@ +/* ---------------------------------------------------------------- */ +/* (C)Copyright IBM Corp. 2007, 2008 */ +/* ---------------------------------------------------------------- */ +/** + * \file ad_bgl_write.c + * \brief ??? + */ + +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_bgl.h" +#include "adio_extern.h" + +#include "ad_bgl_tuning.h" + +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +void ADIOI_BGL_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int *error_code) +{ + int err=-1, datatype_size; + ADIO_Offset len; + static char myname[] = "ADIOI_BGL_WRITECONTIG"; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5036, 0, NULL); +#endif +#if BGL_PROFILE + /* timing */ + double io_time, io_time2; + + if (bglmpio_timing) { + io_time = MPI_Wtime(); + bglmpio_prof_cw[ BGLMPIO_CIO_DATA_SIZE ] += len; + } +#endif + + MPI_Type_size(datatype, &datatype_size); + len = (ADIO_Offset)datatype_size * (ADIO_Offset)count; + ADIOI_Assert(len == (unsigned int) len); /* write takes an unsigned int parm */ + +#if BGL_PROFILE + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + if (bglmpio_timing2) io_time2 = MPI_Wtime(); + if (fd->fp_sys_posn != offset) + lseek(fd->fd_sys, offset, SEEK_SET); + if (bglmpio_timing2) bglmpio_prof_cw[ BGLMPIO_CIO_T_SEEK ] += (MPI_Wtime() - io_time2); + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); + if (bglmpio_timing2) io_time2 = MPI_Wtime(); + err = write(fd->fd_sys, buf, (unsigned int)len); + if (bglmpio_timing2) bglmpio_prof_cw[ BGLMPIO_CIO_T_POSI_RW ] += (MPI_Wtime() - io_time2); + ADIOI_UNLOCK(fd, offset, SEEK_SET, len); + fd->fp_sys_posn = offset + err; + /* individual file pointer not updated */ + } + else { /* write from curr. location of ind. file pointer */ + offset = fd->fp_ind; + if (bglmpio_timing2) io_time2 = MPI_Wtime(); + if (fd->fp_sys_posn != fd->fp_ind) + lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); + if (bglmpio_timing2) bglmpio_prof_cw[ BGLMPIO_CIO_T_SEEK ] += (MPI_Wtime() - io_time2); + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); + if (bglmpio_timing2) io_time2 = MPI_Wtime(); + err = write(fd->fd_sys, buf, (unsigned int)len); + if (bglmpio_timing2) bglmpio_prof_cw[ BGLMPIO_CIO_T_POSI_RW ] += (MPI_Wtime() - io_time2); + ADIOI_UNLOCK(fd, offset, SEEK_SET, len); + fd->fp_ind += err; + fd->fp_sys_posn = fd->fp_ind; + } + +#else /* BGL_PROFILE */ + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + if (fd->fp_sys_posn != offset) + lseek(fd->fd_sys, offset, SEEK_SET); + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); + err = write(fd->fd_sys, buf, (unsigned int)len); + ADIOI_UNLOCK(fd, offset, SEEK_SET, len); + fd->fp_sys_posn = offset + err; + /* individual file pointer not updated */ + } + else { /* write from curr. location of ind. file pointer */ + offset = fd->fp_ind; + if (fd->fp_sys_posn != fd->fp_ind) + lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); + ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); + err = write(fd->fd_sys, buf, (unsigned int)len); + ADIOI_UNLOCK(fd, offset, SEEK_SET, len); + fd->fp_ind += err; + fd->fp_sys_posn = fd->fp_ind; + } + +#endif /* BGL_PROFILE */ + +#if BGL_PROFILE + if (bglmpio_timing) bglmpio_prof_cw[ BGLMPIO_CIO_T_MPIO_RW ] += (MPI_Wtime() - io_time); +#endif + + /* --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 + MPIR_Status_set_bytes(status, datatype, err); +#endif + + *error_code = MPI_SUCCESS; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5037, 0, NULL); +#endif +} + + +#define ADIOI_BUFFERED_WRITE \ +{ \ + if (req_off >= writebuf_off + writebuf_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + writebuf_off = req_off; \ + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = read(fd->fd_sys, writebuf, writebuf_len); \ + if (err == -1) { \ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**ioRMWrdwr", 0); \ + return; \ + } \ + } \ + write_sz = (unsigned) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off));\ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ + while (write_sz != req_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = read(fd->fd_sys, writebuf, writebuf_len); \ + if (err == -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);\ + } \ +} + + +/* this macro is used when filetype is contig and buftype is not contig. + it does not do a read-modify-write and does not lock*/ +#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ +{ \ + if (req_off >= writebuf_off + writebuf_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + writebuf_off = req_off; \ + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + } \ + write_sz = (unsigned) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off));\ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ + while (write_sz != req_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + write_sz = ADIOI_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ + } \ +} + + + +void ADIOI_BGL_WriteStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code) +{ +/* offset is in units of etype relative to the filetype. */ + + + + ADIOI_Flatlist_node *flat_buf, *flat_file; + ADIO_Offset i_offset, sum, size_in_filetype; + int i, j, k, err=-1, st_index=0; + int n_etypes_in_filetype; + ADIO_Offset num, size, n_filetypes, etype_in_filetype, st_n_filetypes; + ADIO_Offset abs_off_in_filetype=0; + int filetype_size, etype_size, buftype_size; + MPI_Aint filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off; + ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off; + char *writebuf, *value; + unsigned bufsize, writebuf_len, max_bufsize, write_sz; + int err_flag=0, info_flag; + ADIO_Offset new_bwr_size, new_fwr_size, st_fwr_size, fwr_size=0, bwr_size, req_len; + static char myname[] = "ADIOI_BGL_WRITESTRIDED"; + + if (fd->hints->ds_write == ADIOI_HINT_DISABLE) { + /* if user has disabled data sieving on reads, use naive + * approach instead. + */ + /*FPRINTF(stderr, "ADIOI_GEN_WriteStrided_naive(%d):\n", __LINE__);*/ + ADIOI_GEN_WriteStrided_naive(fd, + buf, + count, + datatype, + file_ptr_type, + offset, + status, + error_code); + return; + } + /*FPRINTF(stderr, "%s(%d):\n",myname, __LINE__);*/ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size(fd->filetype, &filetype_size); + if ( ! filetype_size ) { + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); + bufsize = buftype_size * count; + +/* get max_bufsize from the info object. */ + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); + ADIOI_Info_get(fd->info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, + &info_flag); + max_bufsize = atoi(value); + ADIOI_Free(value); + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + etype_size * offset; + + start_off = off; + end_offset = off + bufsize - 1; + writebuf_off = off; + writebuf = (char *) ADIOI_Malloc(max_bufsize); + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1)); + +/* if atomicity is true, lock the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + for (j=0; jcount; i++) { + userbuf_off = (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_WRITE_WITHOUT_READ + off += flat_buf->blocklens[i]; + } + } + + /* write the buffer out finally */ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + err = write(fd->fd_sys, writebuf, writebuf_len); + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + if (err == -1) err_flag = 1; + + if (fd->atomicity) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + ADIOI_Free(writebuf); /* malloced in the buffered_write macro */ + + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; + if (err_flag) { + *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; + } + + else { /* noncontiguous in file */ + +/* filetype already flattened in ADIO_Open */ + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset)n_filetypes * filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i=0; icount; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* fwr_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + fwr_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + fwr_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; + } + else { + int i; + n_etypes_in_filetype = filetype_size/etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i=0; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = 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 */ + offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + + abs_off_in_filetype; + } + + start_off = offset; + /* Wei-keng Liao:write request is within single flat_file contig block*/ + /* this could happen, for example, with subarray types that are + * actually fairly contiguous */ + if (buftype_is_contig && bufsize <= fwr_size) { + ADIO_WriteContig(fd, buf, bufsize, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte + * that can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == fwr_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + (ADIO_Offset)n_filetypes*filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + return; + } + + /* Calculate end_offset, the last byte-offset that will be accessed. + e.g., if start_offset=0 and 100 bytes to be write, end_offset=99*/ + + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + i_offset = 0; + j = st_index; + off = offset; + fwr_size = ADIOI_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + i_offset += fwr_size; + end_offset = off + fwr_size - 1; + + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); + } + +/* if atomicity is true, lock the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + /* initial read for the read-modify-write */ + writebuf_off = offset; + writebuf = (char *) ADIOI_Malloc(max_bufsize); + writebuf_len = (unsigned)(ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1)); + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + lseek(fd->fd_sys, writebuf_off, SEEK_SET); + err = read(fd->fd_sys, writebuf, writebuf_len); + if (err == -1) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, + "ADIOI_BGL_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) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = ADIOI_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + if (fwr_size) { + /* TYPE_UB and TYPE_LB can result in + fwr_size = 0. save system call in such cases */ + /* lseek(fd->fd_sys, off, SEEK_SET); + err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size);*/ + + req_off = off; + req_len = fwr_size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE + } + i_offset += fwr_size; + + if (off + fwr_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes*(ADIO_Offset)filetype_extent) + off += fwr_size; + /* did not reach end of contiguous block in filetype. + no more I/O needed. off is incremented by fwr_size. */ + else { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + fwr_size = ADIOI_MIN(flat_file->blocklens[j], + bufsize-i_offset); + } + } + } + else { +/* noncontiguous in memory as well as in file */ + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + k = num = buf_count = 0; + i_offset = flat_buf->indices[0]; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = ADIOI_MIN(fwr_size, bwr_size); + if (size) { + /* lseek(fd->fd_sys, off, SEEK_SET); + err = write(fd->fd_sys, ((char *) buf) + i_offset, size); */ + + req_off = off; + req_len = size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE + } + + new_fwr_size = fwr_size; + new_bwr_size = bwr_size; + + if (size == fwr_size) { +/* reached end of contiguous block in file */ + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + + new_fwr_size = flat_file->blocklens[j]; + if (size != bwr_size) { + i_offset += size; + new_bwr_size -= size; + } + } + + if (size == bwr_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1)%flat_buf->count; + buf_count++; + i_offset = (ADIO_Offset)buftype_extent*(ADIO_Offset)(buf_count/flat_buf->count) + + flat_buf->indices[k]; + new_bwr_size = flat_buf->blocklens[k]; + if (size != fwr_size) { + off += size; + new_fwr_size -= size; + } + } + num += size; + fwr_size = new_fwr_size; + bwr_size = new_bwr_size; + } + } + + /* write the buffer out finally */ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + err = write(fd->fd_sys, writebuf, writebuf_len); + + if (!(fd->atomicity)) + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + else ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + if (err == -1) err_flag = 1; + + ADIOI_Free(writebuf); /* malloced in the buffered_write macro */ + + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; + if (err_flag) { + *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; + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/.state-cache new file mode 100644 index 0000000000..fa99f4c500 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/.state-cache @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/Makefile.in new file mode 100644 index 0000000000..5366e5a701 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/Makefile.in @@ -0,0 +1,49 @@ +CC = @CC@ +AR = @AR@ +RANLIB = @RANLIB@ +LIBNAME = @LIBNAME@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE_SHL = $(CC_SHL) + +@VPATH@ + +AD_BGLOCKLESS_OBJECTS = ad_bglockless.o ad_bglockless_features.o + + +default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +.c.o: + $(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + +$(LIBNAME): $(AD_BGLOCKLESS_OBJECTS) + $(AR) $(LIBNAME) $(AD_BGLOCKLESS_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_BGLOCKLESS_LOOBJECTS=$(AD_BGLOCKLESS_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_BGLOCKLESS_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_BGLOCKLESS_LOOBJECTS) + +coverage: + -@for file in ${AD_BGLOCKLESS_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless.c b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless.c new file mode 100644 index 0000000000..759616523c --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless.c @@ -0,0 +1,44 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2001 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "../ad_bgl/ad_bgl.h" +#include "ad_bglockless.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_BGLOCKLESS_operations = { + ADIOI_BGL_Open, /* Open */ + ADIOI_GEN_OpenColl, /* Collective open */ + ADIOI_GEN_ReadContig, /* ReadContig */ + ADIOI_GEN_WriteContig, /* WriteContig */ + ADIOI_BGL_ReadStridedColl, /* ReadStridedColl */ + ADIOI_BGL_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_GEN_Fcntl, /* Fcntl */ + ADIOI_BGL_SetInfo, /* SetInfo */ + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_NOLOCK_WriteStrided, /* WriteStrided */ + ADIOI_BGL_Close, /* Close */ +#ifdef ROMIO_HAVE_WORKING_AIO + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + 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_BGL_Flush, /* Flush */ + ADIOI_GEN_Resize, /* Resize */ + ADIOI_GEN_Delete, /* Delete */ + ADIOI_BGLOCKLESS_Feature /* Features */ +}; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless.h b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless.h new file mode 100644 index 0000000000..5b6a1fc40f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless.h @@ -0,0 +1,14 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2008 Uchicago Argonne LLC + * See COPYRIGHT notice in top-level directory. + */ + +#ifndef AD_BGLOCKLESS_INCLUDE +#define AD_PVFS2_INCLUDE + +int ADIOI_BGLOCKLESS_Feature(ADIO_File fd, int flag); + +#endif + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless_features.c b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless_features.c new file mode 100644 index 0000000000..4153c5e409 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_bglockless/ad_bglockless_features.c @@ -0,0 +1,15 @@ +#include "adio.h" + +int ADIOI_BGLOCKLESS_Feature(ADIO_File fd, int flag) +{ + switch(flag) { + case ADIO_SCALABLE_OPEN: + return 1; + case ADIO_SHARED_FP: + case ADIO_LOCKS: + case ADIO_SEQUENTIAL: + case ADIO_DATA_SIEVING_WRITES: + default: + return 0; + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/.state-cache new file mode 100644 index 0000000000..d3a80b8a91 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/.state-cache @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/Makefile.in new file mode 100644 index 0000000000..3603f552be --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/Makefile.in @@ -0,0 +1,52 @@ +CC = @CC@ +AR = @AR@ +RANLIB = @RANLIB@ +LIBNAME = @LIBNAME@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CFLAGS@ $(INCLUDES) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE_SHL = $(CC_SHL) + +@VPATH@ + +AD_GRIDFTP_OBJECTS = ad_gridftp_close.o \ + ad_gridftp_open.o ad_gridftp_read.o ad_gridftp_write.o \ + ad_gridftp_fcntl.o ad_gridftp_flush.o \ + ad_gridftp_resize.o ad_gridftp_hints.o \ + ad_gridftp_delete.o ad_gridftp.o globus_routines.o ad_gridftp_features.o + +default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +.c.o: + $(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + +$(LIBNAME): $(AD_GRIDFTP_OBJECTS) + $(AR) $(LIBNAME) $(AD_GRIDFTP_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_GRIDFTP_LOOBJECTS=$(AD_GRIDFTP_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_GRIDFTP_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_GRIDFTP_LOOBJECTS) + +coverage: + -@for file in ${AD_UFS_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp.c new file mode 100644 index 0000000000..fe429c9e4b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp.c @@ -0,0 +1,37 @@ +/* -*- 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 */ + ADIOI_GRIDFTP_Feature, /* Features */ +}; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp.h b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp.h new file mode 100644 index 0000000000..857d13365f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp.h @@ -0,0 +1,96 @@ +/* -*- 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 +#include +#include +#include +#include "adio.h" +#include + +/* 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); +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 + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_close.c new file mode 100644 index 0000000000..deb6044305 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_close.c @@ -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_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s",globus_object_printable_to_string(globus_error_get(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_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", globus_object_printable_to_string(globus_error_get(result))); + return; + } + + fd->fd_sys = -1; + fd->fp_ind=0; + fd->fp_sys_posn=0; + num_gridftp_handles--; + + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_delete.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_delete.c new file mode 100644 index 0000000000..9c35116427 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_delete.c @@ -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(globus_error_get(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(globus_error_get(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(globus_error_get(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(globus_error_get(result))); + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_fcntl.c new file mode 100644 index 0000000000..4b9f5a5261 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_fcntl.c @@ -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(globus_error_get(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); + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_features.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_features.c new file mode 100644 index 0000000000..6eea52734b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_features.c @@ -0,0 +1,12 @@ +int ADIOI_GRIDFTP_Feature (ADIO_File fd, int flag) +{ + switch(flag) { + case ADIO_SCALABLE_OPEN: + case ADIO_SHARED_FP: + case ADIO_LOCKS: + case ADIO_SEQUENTIAL: + case ADIO_DATA_SIEVING_WRITES: + default: + return 0; + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_flush.c new file mode 100644 index 0000000000..408d860aa2 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_flush.c @@ -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; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_hints.c new file mode 100644 index 0000000000..124bef6174 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_hints.c @@ -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;iinfo,key,value); + } + } + } + } + + /* let the generic ROMIO and MPI-I/O stuff happen... */ + ADIOI_GEN_SetInfo(fd, users_info, error_code); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_open.c new file mode 100644 index 0000000000..d7b175ed86 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_open.c @@ -0,0 +1,343 @@ +/* -*- 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(globus_error_get(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(globus_error_get(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&ADIO_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&ADIO_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 ) + { + ADIOI_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); + } + + ADIOI_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]), + ¶llelism))!=GLOBUS_SUCCESS ) + globus_err_handler("globus_ftp_client_operationattr_set_parallelism",myname,result); + } + } + + ADIOI_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) ) + { + ADIOI_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); + } + } + } + } + + ADIOI_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); + } + } + + ADIOI_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(globus_error_get(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(globus_error_get(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&ADIO_CREATE) && + !(fd->access_mode&ADIO_EXCL) && !(fd->access_mode&ADIO_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(globus_error_get(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(globus_error_get(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&ADIO_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&ADIO_RDONLY) && (file_exists!=GLOBUS_TRUE) ) + { + if ( myrank==0 ) + { + FPRINTF(stderr,"WARNING: read-only file %s does not exist!\n",fd->filename); + } + } + num_gridftp_handles++; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_read.c new file mode 100644 index 0000000000..a6af99d50e --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_read.c @@ -0,0 +1,467 @@ +/* -*- 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 ( !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&ADIO_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(globus_error_get(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&ADIO_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;icount;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, myname, __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, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", + globus_object_printable_to_string(globus_error_get(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_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", globus_object_printable_to_string(globus_error_get(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;icount;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); + } + +} + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_resize.c new file mode 100644 index 0000000000..9ee3e3d4d0 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_resize.c @@ -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&ADIO_RDONLY ) + { + FPRINTF(stderr,"%s: attempt to resize read-only file %s!\n", + myname,fd->filename); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, 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_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", globus_object_printable_to_string(globus_error_get(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_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", + globus_object_printable_to_string(globus_error_get(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_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", + globus_object_printable_to_string(globus_error_get(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_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", + globus_object_printable_to_string(globus_error_get(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_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", + globus_object_printable_to_string(globus_error_get(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_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", + globus_object_printable_to_string(globus_error_get(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); +} + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_write.c new file mode 100644 index 0000000000..869ecef8d6 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/ad_gridftp_write.c @@ -0,0 +1,472 @@ +/* -*- 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&ADIO_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_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", globus_object_printable_to_string(globus_error_get(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_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", globus_object_printable_to_string(globus_error_get(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_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", globus_object_printable_to_string(globus_error_get(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;icount;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_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", globus_object_printable_to_string(globus_error_get(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_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", globus_object_printable_to_string(globus_error_get(result))); + return; + } + + /* Do all the actual I/Os */ + boff=0; + nblks=0; + while ( boff < (count*btype_size) ) + { + int i,blklen; + + for (i=0;icount;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; + } + 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&ADIO_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 */ +} + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/globus_routines.c b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/globus_routines.c new file mode 100644 index 0000000000..edb2f56bde --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_gridftp/globus_routines.c @@ -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 +#include +#include +#include +#include "adio.h" +#include + +/* 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); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/.state-cache new file mode 100644 index 0000000000..30bc93c505 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/.state-cache @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/Makefile.in index 2881f73590..b240524752 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/Makefile.in @@ -3,15 +3,15 @@ AR = @AR@ LIBNAME = @LIBNAME@ srcdir = @srcdir@ -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) @VPATH@ -AD_HFS_OBJECTS = ad_hfs_close.o ad_hfs_read.o \ - ad_hfs_wrcoll.o ad_hfs_open.o ad_hfs_write.o ad_hfs_done.o \ - ad_hfs_fcntl.o ad_hfs_iread.o ad_hfs_iwrite.o ad_hfs_wait.o \ - ad_hfs_resize.o ad_hfs_seek.o \ +AD_HFS_OBJECTS = ad_hfs_read.o \ + ad_hfs_open.o ad_hfs_write.o \ + ad_hfs_fcntl.o \ + ad_hfs_resize.o \ ad_hfs.o default: $(LIBNAME) diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/README b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/README new file mode 100644 index 0000000000..933677b177 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/README @@ -0,0 +1 @@ +This code is no longer supported. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.c index edb76060f9..95816882d8 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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 */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.h index e54c954e9e..f5142d17ee 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -19,4 +18,17 @@ # include #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 diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_close.c deleted file mode 100644 index a1e10ad457..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_close.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_done.c deleted file mode 100644 index cacecc17a9..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_done.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_fcntl.c dissimilarity index 66% index 6e62ccb4fd..b17227fd41 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_fcntl.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_fcntl.c @@ -1,221 +1,113 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_hfs.h" -#include "adio_extern.h" - -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; - ADIO_Offset curr_fsize, alloc_size, size, len, done; - ADIO_Status status; - char *buf; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_HFS_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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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; icount; 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 - if (fd->fp_sys_posn != -1) - 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; -#endif - break; - - case ADIO_FCNTL_SET_DISKSPACE: - /* will be called by one process only */ - -#ifdef HPUX - 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 - *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 - return; - } - if (err && (errno == ENOTEMPTY)) { -#endif - -#ifdef SPPUX - /* SPPUX has no prealloc64. therefore, use prealloc - if size < (2GB - 1), otherwise use long method. */ - if (fcntl_struct->diskspace <= 2147483647) { - err = prealloc(fd->fd_sys, (off_t) fcntl_struct->diskspace); - if (err && (errno != ENOTEMPTY)) { -#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 - return; - } - } - - 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 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; ifp_sys_posn != -1) - lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); - /* not required in SPPUX since there we use pread/pwrite */ -#endif - } - *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; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_HFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_hfs.h" +#include "adio_extern.h" + +#ifndef HAVE_LSEEK64 +#define lseek64 lseek +#endif +void ADIOI_HFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) +{ + int i, ntimes, err; + ADIO_Offset curr_fsize, alloc_size, size, len, done; + ADIO_Status status; + char *buf; +#ifndef PRINT_ERR_MSG + static char myname[] = "ADIOI_HFS_FCNTL"; +#endif + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + fcntl_struct->fsize = lseek64(fd->fd_sys, 0, SEEK_END); +#ifdef HPUX + if (fd->fp_sys_posn != -1) + lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); +/* not required in SPPUX since there we use pread/pwrite */ +#endif + 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: + /* will be called by one process only */ + +#ifdef HPUX + err = prealloc64(fd->fd_sys, fcntl_struct->diskspace); + /* prealloc64 works only if file is of zero length */ + if (err && (errno != ENOTEMPTY)) { +#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, + myname, "I/O Error", "%s", strerror(errno)); + ADIOI_Error(fd, *error_code, myname); +#endif + return; + } + if (err && (errno == ENOTEMPTY)) { +#endif + +#ifdef SPPUX + /* SPPUX has no prealloc64. therefore, use prealloc + if size < (2GB - 1), otherwise use long method. */ + if (fcntl_struct->diskspace <= 2147483647) { + err = prealloc(fd->fd_sys, (off_t) fcntl_struct->diskspace); + if (err && (errno != ENOTEMPTY)) { +#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, + myname, "I/O Error", "%s", strerror(errno)); + ADIOI_Error(fd, *error_code, myname); +#endif + return; + } + } + + if ((fcntl_struct->diskspace > 2147483647) || + (err && (errno == ENOTEMPTY))) { +#endif + ADIOI_GEN_Prealloc(fd,fcntl_struct->diskspace, error_code); + } + ADIOI_Free(buf); +#ifdef HPUX + if (fd->fp_sys_posn != -1) + lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); + /* not required in SPPUX since there we use pread/pwrite */ +#endif + } + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + default: + FPRINTF(stderr, "Unknown flag passed to ADIOI_HFS_Fcntl\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_flush.c deleted file mode 100644 index 9038a5b1e4..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_flush.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_hints.c deleted file mode 100644 index 75fa196eda..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_hints.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iread.c deleted file mode 100644 index 6deebbf192..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iread.c +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iwrite.c deleted file mode 100644 index 7f923664c2..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_iwrite.c +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_open.c index 69c9fd940e..8e56a4571e 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_open.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -8,6 +7,10 @@ #include "ad_hfs.h" +#ifndef HAVE_LSEEK64 +#define lseek64 lseek +#endif + void ADIOI_HFS_Open(ADIO_File fd, int *error_code) { int perm, old_mask, amode; @@ -35,6 +38,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 +51,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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_rdcoll.c deleted file mode 100644 index 539f508e4d..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_rdcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_read.c index 9691bfe34e..06e7fec896 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_read.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_read.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -8,6 +7,10 @@ #include "ad_hfs.h" +#ifndef HAVE_LSEEK64 +#define lseek64 lseek +#endif + 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) @@ -52,26 +55,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); } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_resize.c index 12c86dfaa5..65e8f93de9 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_resize.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_resize.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_seek.c deleted file mode 100644 index c445d5edf0..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_seek.c +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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; icount; 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; -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wait.c deleted file mode 100644 index 861b1c073c..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wait.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wrcoll.c deleted file mode 100644 index 8b5a12b917..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_wrcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_write.c index b47a621498..ab42d31bb6 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_write.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_hfs/ad_hfs_write.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -8,6 +7,10 @@ #include "ad_hfs.h" +#ifndef HAVE_LSEEK64 +#define lseek64 lseek +#endif + 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) @@ -51,24 +54,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); } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/.state-cache new file mode 100644 index 0000000000..8c6a6bf243 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/.state-cache @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/Makefile.in new file mode 100644 index 0000000000..ca0c1106a8 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/Makefile.in @@ -0,0 +1,49 @@ +CC = @CC@ +AR = @AR@ +RANLIB = @RANLIB@ +LIBNAME = @LIBNAME@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE_SHL = $(CC_SHL) @CFLAGS@ $(INCLUDES) + +@VPATH@ + +AD_LUSTRE_OBJECTS = ad_lustre.o ad_lustre_open.o \ + ad_lustre_rwcontig.o ad_lustre_wrcoll.o ad_lustre_wrstr.o \ + ad_lustre_hints.o ad_lustre_aggregate.o + + +default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +.c.o: + $(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + +$(LIBNAME): $(AD_LUSTRE_OBJECTS) + $(AR) $(LIBNAME) $(AD_LUSTRE_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_LUSTRE_LOOBJECTS=$(AD_LUSTRE_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_LUSTRE_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_LUSTRE_LOOBJECTS) + +coverage: + -@for file in ${AD_LUSTRE_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/README b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/README new file mode 100644 index 0000000000..a217c0f8fe --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/README @@ -0,0 +1,55 @@ +Upcoming soon: + o Hierarchical striping as described in the paper from CCGrid2007 + http://ft.ornl.gov/projects/io/pubs/CCGrid-2007-file-joining.pdf +Further out: + o To post the code for ParColl (Partitioned collective IO) + +----------------------------------------------------- +V05: +----------------------------------------------------- +Improved data redistribution + o Improve I/O pattern identification. Besides checking interleaving, + if request I/O size is small, collective I/O will be performed. + The hint bigsize can be used to define the req size value. + o Provide hint CO for load balancing to control the number of + IO clients for each OST + o Produce stripe-contiguous I/O pattern that Lustre prefers + o Control read-modify-write in data sieving in collective IO + by hint ds_in_coll. + o Reduce extent lock conflicts by make each OST accessed by one or + more constant clients. + +----------------------------------------------------- +V04: +----------------------------------------------------- + o Direct IO and Lockless IO support + +----------------------------------------------------- +V03: +----------------------------------------------------- + o Correct detection of fs_type when lustre: prefix is not given + o Further fix on stripe alignment + o Tested/Enabled striping hints over Cray XT (Catamount and CNL) + +----------------------------------------------------- +V02: +----------------------------------------------------- +The Lustre ADIO driver has been cleaned up quite a lot. Compared +to the intital posting, here are the changes: + o Removal of dead/redundant code + o Removal of asynchronous IO piece as it appears outdated + o Bug fixes for setting Lustre Hints + o Bug fixes for data sieving + o Improved Setsize operation with one process calling ftruncate + o Improved collective IO with domain partitioning on + Lustre stripe boundary + +Contributing: + o You may contribute via many different ways, such as + testing results, bug reports, and new feature patches. + o We appreciate any courtesy reference of this work. + o Disclaimer: you are welcome to try the code, but at your own risk. + +Contact info: + For more info, visit http://ft.ornl.gov/projects/io/ + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.c b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.c new file mode 100644 index 0000000000..08809e5c65 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.c @@ -0,0 +1,43 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2001 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Copyright (C) 2007 Oak Ridge National Laboratory + * + * Copyright (C) 2008 Sun Microsystems, Lustre group + */ + +#include "ad_lustre.h" + +struct ADIOI_Fns_struct ADIO_LUSTRE_operations = { + ADIOI_LUSTRE_Open, /* Open */ + ADIOI_GEN_OpenColl, /* OpenColl */ + ADIOI_LUSTRE_ReadContig, /* ReadContig */ + ADIOI_LUSTRE_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_LUSTRE_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_GEN_Fcntl, /* Fcntl */ + ADIOI_LUSTRE_SetInfo, /* SetInfo */ + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_LUSTRE_WriteStrided, /* WriteStrided */ + ADIOI_GEN_Close, /* Close */ +#if defined(ROMIO_HAVE_WORKING_AIO) && !defined(CRAY_XT_LUSTRE) + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + 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 */ + ADIOI_GEN_Feature, /* Features */ +}; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.h b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.h new file mode 100644 index 0000000000..3252907596 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre.h @@ -0,0 +1,91 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Copyright (C) 2007 Oak Ridge National Laboratory + * + * Copyright (C) 2008 Sun Microsystems, Lustre group + */ + +#ifndef AD_UNIX_INCLUDE +#define AD_UNIX_INCLUDE + +/* temp*/ +#define HAVE_ASM_TYPES_H 1 + +#include +#include + +#ifdef __linux__ +# include /* necessary for: */ +# include +# define __USE_GNU /* O_DIRECT and */ +# include /* IO operations */ +# undef __USE_GNU +#endif /* __linux__ */ + +/*#include */ +#include +#include +#include "adio.h" +/*#include "adioi.h"*/ + +#ifdef HAVE_SIGNAL_H +#include +#endif + +#ifdef HAVE_AIO_H +#include +#ifdef HAVE_SYS_AIO_H +#include +#endif +#endif /* End of HAVE_SYS_AIO_H */ + +void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code); +void ADIOI_LUSTRE_Close(ADIO_File fd, int *error_code); +void ADIOI_LUSTRE_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_LUSTRE_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_LUSTRE_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_LUSTRE_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_LUSTRE_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_LUSTRE_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_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, + int *error_code); +void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); + +/* the lustre utilities: */ +int ADIOI_LUSTRE_Docollect(ADIO_File fd, int contig_access_count, + ADIO_Offset *len_list, int nprocs); + +void ADIOI_LUSTRE_Get_striping_info(ADIO_File fd, int **striping_info_ptr, + int mode); +void ADIOI_LUSTRE_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list, + ADIO_Offset *len_list, int contig_access_count, + int *striping_info, int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access **my_req_ptr, + int ***buf_idx_ptr); + +int ADIOI_LUSTRE_Calc_aggregator(ADIO_File fd, ADIO_Offset off, + ADIO_Offset *len, int *striping_info); +#endif /* End of AD_UNIX_INCLUDE */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_aggregate.c b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_aggregate.c new file mode 100644 index 0000000000..203b080edb --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_aggregate.c @@ -0,0 +1,322 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Copyright (C) 2007 Oak Ridge National Laboratory + * + * Copyright (C) 2008 Sun Microsystems, Lustre group + */ + +#include "ad_lustre.h" +#include "adio_extern.h" + +#undef AGG_DEBUG + +void ADIOI_LUSTRE_Get_striping_info(ADIO_File fd, int **striping_info_ptr, + int mode) +{ + int *striping_info = NULL; + /* get striping information: + * striping_info[0]: stripe_size + * striping_info[1]: stripe_count + * striping_info[2]: avail_cb_nodes + */ + int stripe_size, stripe_count, CO = 1; + int avail_cb_nodes, divisor, nprocs_for_coll = fd->hints->cb_nodes; + + /* Get hints value */ + /* stripe size */ + stripe_size = fd->hints->striping_unit; + /* stripe count */ + /* stripe_size and stripe_count have been validated in ADIOI_LUSTRE_Open() */ + stripe_count = fd->hints->striping_factor; + + /* Calculate the available number of I/O clients */ + if (!mode) { + /* for collective read, + * if "CO" clients access the same OST simultaneously, + * the OST disk seek time would be much. So, to avoid this, + * it might be better if 1 client only accesses 1 OST. + * So, we set CO = 1 to meet the above requirement. + */ + CO = 1; + /*XXX: maybe there are other better way for collective read */ + } else { + /* CO also has been validated in ADIOI_LUSTRE_Open(), >0 */ + CO = fd->hints->fs_hints.lustre.co_ratio; + } + /* Calculate how many IO clients we need */ + /* Algorithm courtesy Pascal Deveze (pascal.deveze@bull.net) */ + /* To avoid extent lock conflicts, + * avail_cb_nodes should either + * - be a multiple of stripe_count, + * - or divide stripe_count exactly + * so that each OST is accessed by a maximum of CO constant clients. */ + if (nprocs_for_coll >= stripe_count) + /* avail_cb_nodes should be a multiple of stripe_count and the number + * of procs per OST should be limited to the minimum between + * nprocs_for_coll/stripe_count and CO + * + * e.g. if stripe_count=20, nprocs_for_coll=42 and CO=3 then + * avail_cb_nodes should be equal to 40 */ + avail_cb_nodes = + stripe_count * ADIOI_MIN(nprocs_for_coll/stripe_count, CO); + else { + /* nprocs_for_coll is less than stripe_count */ + /* avail_cb_nodes should divide stripe_count */ + /* e.g. if stripe_count=60 and nprocs_for_coll=8 then + * avail_cb_nodes should be egal to 6 */ + /* This could be done with : + while (stripe_count % avail_cb_nodes != 0) avail_cb_nodes--; + but this can be optimized for large values of nprocs_for_coll and + stripe_count */ + divisor = 2; + avail_cb_nodes = 1; + /* try to divise */ + while (stripe_count >= divisor*divisor) { + if ((stripe_count % divisor) == 0) { + if (stripe_count/divisor <= nprocs_for_coll) { + /* The value is found ! */ + avail_cb_nodes = stripe_count/divisor; + break; + } + /* if divisor is less than nprocs_for_coll, divisor is a + * solution, but it is not sure that it is the best one */ + else if (divisor <= nprocs_for_coll) + avail_cb_nodes = divisor; + } + divisor++; + } + } + + *striping_info_ptr = (int *) ADIOI_Malloc(3 * sizeof(int)); + striping_info = *striping_info_ptr; + striping_info[0] = stripe_size; + striping_info[1] = stripe_count; + striping_info[2] = avail_cb_nodes; +} + +int ADIOI_LUSTRE_Calc_aggregator(ADIO_File fd, ADIO_Offset off, + ADIO_Offset *len, int *striping_info) +{ + int rank_index, rank; + ADIO_Offset avail_bytes; + int stripe_size = striping_info[0]; + int avail_cb_nodes = striping_info[2]; + + /* Produce the stripe-contiguous pattern for Lustre */ + rank_index = (int)((off / stripe_size) % avail_cb_nodes); + + /* we index into fd_end with rank_index, and fd_end was allocated to be no + * bigger than fd->hins->cb_nodes. If we ever violate that, we're + * overrunning arrays. Obviously, we should never ever hit this abort + */ + if (rank_index >= fd->hints->cb_nodes) + MPI_Abort(MPI_COMM_WORLD, 1); + + avail_bytes = (off / (ADIO_Offset)stripe_size + 1) * + (ADIO_Offset)stripe_size - off; + if (avail_bytes < *len) { + /* this proc only has part of the requested contig. region */ + *len = avail_bytes; + } + /* map our index to a rank */ + /* NOTE: FOR NOW WE DON'T HAVE A MAPPING...JUST DO 0..NPROCS_FOR_COLL */ + rank = fd->hints->ranklist[rank_index]; + + return rank; +} + +/* ADIOI_LUSTRE_Calc_my_req() - calculate what portions of the access requests + * of this process are located in the file domains of various processes + * (including this one) + */ + + +void ADIOI_LUSTRE_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list, + ADIO_Offset *len_list, int contig_access_count, + int *striping_info, int nprocs, + int *count_my_req_procs_ptr, + int **count_my_req_per_proc_ptr, + ADIOI_Access **my_req_ptr, + int ***buf_idx_ptr) +{ + /* Nothing different from ADIOI_Calc_my_req(), except calling + * ADIOI_Lustre_Calc_aggregator() instead of the old one */ + int *count_my_req_per_proc, count_my_req_procs, **buf_idx; + int i, l, proc; + ADIO_Offset avail_len, rem_len, curr_idx, off; + ADIOI_Access *my_req; + + *count_my_req_per_proc_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + count_my_req_per_proc = *count_my_req_per_proc_ptr; + /* count_my_req_per_proc[i] gives the no. of contig. requests of this + * process in process i's file domain. calloc initializes to zero. + * I'm allocating memory of size nprocs, so that I can do an + * MPI_Alltoall later on. + */ + + buf_idx = (int **) ADIOI_Malloc(nprocs * sizeof(int*)); + + /* one pass just to calculate how much space to allocate for my_req; + * contig_access_count was calculated way back in ADIOI_Calc_my_off_len() + */ + for (i = 0; i < contig_access_count; i++) { + /* short circuit offset/len processing if len == 0 + * (zero-byte read/write + */ + if (len_list[i] == 0) + continue; + off = offset_list[i]; + avail_len = len_list[i]; + /* note: we set avail_len to be the total size of the access. + * then ADIOI_LUSTRE_Calc_aggregator() will modify the value to return + * the amount that was available. + */ + proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); + count_my_req_per_proc[proc]++; + + /* figure out how many data is remaining in the access + * we'll take care of this data (if there is any) + * in the while loop below. + */ + rem_len = len_list[i] - avail_len; + + while (rem_len != 0) { + off += avail_len; /* point to first remaining byte */ + avail_len = rem_len; /* save remaining size, pass to calc */ + proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); + count_my_req_per_proc[proc]++; + rem_len -= avail_len; /* reduce remaining length by amount from fd */ + } + } + + /* buf_idx is relevant only if buftype_is_contig. + * buf_idx[i] gives the index into user_buf where data received + * from proc 'i' should be placed. This allows receives to be done + * without extra buffer. This can't be done if buftype is not contig. + */ + + /* initialize buf_idx vectors */ + for (i = 0; i < nprocs; i++) { + /* add one to count_my_req_per_proc[i] to avoid zero size malloc */ + buf_idx[i] = (int *) ADIOI_Malloc((count_my_req_per_proc[i] + 1) + * sizeof(int)); + } + + /* now allocate space for my_req, offset, and len */ + *my_req_ptr = (ADIOI_Access *) ADIOI_Malloc(nprocs * sizeof(ADIOI_Access)); + my_req = *my_req_ptr; + + count_my_req_procs = 0; + for (i = 0; i < nprocs; i++) { + if (count_my_req_per_proc[i]) { + my_req[i].offsets = (ADIO_Offset *) + ADIOI_Malloc(count_my_req_per_proc[i] * + sizeof(ADIO_Offset)); + my_req[i].lens = (int *) ADIOI_Malloc(count_my_req_per_proc[i] * + sizeof(int)); + count_my_req_procs++; + } + my_req[i].count = 0; /* will be incremented where needed later */ + } + + /* now fill in my_req */ + curr_idx = 0; + for (i = 0; i < contig_access_count; i++) { + /* short circuit offset/len processing if len == 0 + * (zero-byte read/write */ + if (len_list[i] == 0) + continue; + off = offset_list[i]; + avail_len = len_list[i]; + proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, striping_info); + + l = my_req[proc].count; + + ADIOI_Assert(curr_idx == (int) curr_idx); + ADIOI_Assert(l < count_my_req_per_proc[proc]); + buf_idx[proc][l] = (int) curr_idx; + curr_idx += avail_len; + + rem_len = len_list[i] - avail_len; + + /* store the proc, offset, and len information in an array + * of structures, my_req. Each structure contains the + * offsets and lengths located in that process's FD, + * and the associated count. + */ + my_req[proc].offsets[l] = off; + ADIOI_Assert(avail_len == (int) avail_len); + my_req[proc].lens[l] = (int) avail_len; + my_req[proc].count++; + + while (rem_len != 0) { + off += avail_len; + avail_len = rem_len; + proc = ADIOI_LUSTRE_Calc_aggregator(fd, off, &avail_len, + striping_info); + + l = my_req[proc].count; + ADIOI_Assert(curr_idx == (int) curr_idx); + ADIOI_Assert(l < count_my_req_per_proc[proc]); + buf_idx[proc][l] = (int) curr_idx; + + curr_idx += avail_len; + rem_len -= avail_len; + + my_req[proc].offsets[l] = off; + ADIOI_Assert(avail_len == (int) avail_len); + my_req[proc].lens[l] = (int) avail_len; + my_req[proc].count++; + } + } + +#ifdef AGG_DEBUG + for (i = 0; i < nprocs; i++) { + if (count_my_req_per_proc[i] > 0) { + FPRINTF(stdout, "data needed from %d (count = %d):\n", + i, my_req[i].count); + for (l = 0; l < my_req[i].count; l++) { + FPRINTF(stdout, " off[%d] = %lld, len[%d] = %d\n", + l, my_req[i].offsets[l], l, my_req[i].lens[l]); + } + } + } +#endif + + *count_my_req_procs_ptr = count_my_req_procs; + *buf_idx_ptr = buf_idx; +} + +int ADIOI_LUSTRE_Docollect(ADIO_File fd, int contig_access_count, + ADIO_Offset *len_list, int nprocs) +{ + /* If the processes are non-interleaved, we will check the req_size. + * if (avg_req_size > big_req_size) { + * docollect = 0; + * } + */ + + int i, docollect = 1, big_req_size = 0; + ADIO_Offset req_size = 0, total_req_size; + int avg_req_size, total_access_count; + + /* calculate total_req_size and total_access_count */ + for (i = 0; i < contig_access_count; i++) + req_size += len_list[i]; + MPI_Allreduce(&req_size, &total_req_size, 1, MPI_LONG_LONG_INT, MPI_SUM, + fd->comm); + MPI_Allreduce(&contig_access_count, &total_access_count, 1, MPI_INT, MPI_SUM, + fd->comm); + /* estimate average req_size */ + avg_req_size = (int)(total_req_size / total_access_count); + /* get hint of big_req_size */ + big_req_size = fd->hints->fs_hints.lustre.coll_threshold; + /* Don't perform collective I/O if there are big requests */ + if ((big_req_size > 0) && (avg_req_size > big_req_size)) + docollect = 0; + + return docollect; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_fcntl.c new file mode 100644 index 0000000000..3afd16a011 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_fcntl.c @@ -0,0 +1,97 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Copyright (C) 2007 Oak Ridge National Laboratory + */ + +#include "ad_lustre.h" +#include "adio_extern.h" + +void ADIOI_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) +{ + int i, ntimes; + ADIO_Offset curr_fsize, alloc_size, size, len, done; + ADIO_Status status; + char *buf; +#if defined(MPICH2) || !defined(PRINT_ERR_MSG) + static char myname[] = "ADIOI_LUSTRE_FCNTL"; +#endif + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); + if (fd->fp_sys_posn != -1) + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); + if (fcntl_struct->fsize == -1) { + *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; + 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 = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ; + buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ); + done = 0; + + for (i=0; i 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; ifp_sys_posn != -1) + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + default: + FPRINTF(stderr, "Unknown flag passed to ADIOI_LUSTRE_Fcntl\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_hints.c new file mode 100644 index 0000000000..d925779ef3 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_hints.c @@ -0,0 +1,201 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Copyright (C) 2007 Oak Ridge National Laboratory + * + * Copyright (C) 2008 Sun Microsystems, Lustre group + */ + +#include "ad_lustre.h" +#include "adio_extern.h" + +void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ + char *value; + int flag, stripe_val[3], str_factor = -1, str_unit=0, start_iodev=-1; + struct lov_user_md lum = { 0 }; + int err, myrank, fd_sys, perm, amode, old_mask; + int int_val, tmp_val; + static char myname[] = "ADIOI_LUSTRE_SETINFO"; + + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); + 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)); + + ADIOI_Info_set(fd->info, "direct_read", "false"); + ADIOI_Info_set(fd->info, "direct_write", "false"); + fd->direct_read = fd->direct_write = 0; + /* initialize lustre hints */ + ADIOI_Info_set(fd->info, "romio_lustre_co_ratio", "1"); + fd->hints->fs_hints.lustre.co_ratio = 1; + ADIOI_Info_set(fd->info, "romio_lustre_coll_threshold", "0"); + fd->hints->fs_hints.lustre.coll_threshold = 0; + ADIOI_Info_set(fd->info, "romio_lustre_ds_in_coll", "enable"); + fd->hints->fs_hints.lustre.ds_in_coll = ADIOI_HINT_ENABLE; + + /* has user specified striping or server buffering parameters + and do they have the same value on all processes? */ + if (users_info != MPI_INFO_NULL) { + /* striping information */ + ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) + str_unit=atoi(value); + + ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) + str_factor=atoi(value); + + ADIOI_Info_get(users_info, "romio_lustre_start_iodevice", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) + start_iodev=atoi(value); + + /* direct read and write */ + ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) { + ADIOI_Info_set(fd->info, "direct_read", "true"); + fd->direct_read = 1; + } + ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) { + ADIOI_Info_set(fd->info, "direct_write", "true"); + fd->direct_write = 1; + } + } + + /* set striping information with ioctl */ + MPI_Comm_rank(fd->comm, &myrank); + if (myrank == 0) { + stripe_val[0] = str_factor; + stripe_val[1] = str_unit; + stripe_val[2] = start_iodev; + } + MPI_Bcast(stripe_val, 3, MPI_INT, 0, fd->comm); + + if (stripe_val[0] != str_factor + || stripe_val[1] != str_unit + || stripe_val[2] != start_iodev) { + FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: All keys" + "-striping_factor:striping_unit:start_iodevice " + "need to be identical across all processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } else if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0)) { + /* if user has specified striping info, process 0 tries to set it */ + if (!myrank) { + 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) + amode = amode | O_CREAT; + 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; + + /* we need to create file so ensure this is set */ + amode = amode | O_LOV_DELAY_CREATE | O_CREAT; + + fd_sys = open(fd->filename, amode, perm); + if (fd_sys == -1) { + if (errno != EEXIST) + fprintf(stderr, + "Failure to open file %s %d %d\n",strerror(errno), amode, perm); + } else { + lum.lmm_magic = LOV_USER_MAGIC; + lum.lmm_pattern = 0; + lum.lmm_stripe_size = str_unit; + lum.lmm_stripe_count = str_factor; + lum.lmm_stripe_offset = start_iodev; + + err = ioctl(fd_sys, LL_IOC_LOV_SETSTRIPE, &lum); + if (err == -1 && errno != EEXIST) { + fprintf(stderr, "Failure to set stripe info %s \n", strerror(errno)); + } + close(fd_sys); + } + } /* End of striping parameters validation */ + } + MPI_Barrier(fd->comm); + } + /* get other hint */ + if (users_info != MPI_INFO_NULL) { + /* CO: IO Clients/OST, + * to keep the load balancing between clients and OSTs */ + ADIOI_Info_get(users_info, "romio_lustre_co_ratio", MPI_MAX_INFO_VAL, value, + &flag); + if (flag && (int_val = atoi(value)) > 0) { + tmp_val = int_val; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + if (tmp_val != int_val) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_lustre_co_ratio", + error_code); + ADIOI_Free(value); + return; + } + ADIOI_Info_set(fd->info, "romio_lustre_co_ratio", value); + fd->hints->fs_hints.lustre.co_ratio = atoi(value); + } + /* coll_threshold: + * if the req size is bigger than this, collective IO may not be performed. + */ + ADIOI_Info_get(users_info, "romio_lustre_coll_threshold", MPI_MAX_INFO_VAL, value, + &flag); + if (flag && (int_val = atoi(value)) > 0) { + tmp_val = int_val; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + if (tmp_val != int_val) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_lustre_coll_threshold", + error_code); + ADIOI_Free(value); + return; + } + ADIOI_Info_set(fd->info, "romio_lustre_coll_threshold", value); + fd->hints->fs_hints.lustre.coll_threshold = atoi(value); + } + /* ds_in_coll: disable data sieving in collective IO */ + ADIOI_Info_get(users_info, "romio_lustre_ds_in_coll", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && (!strcmp(value, "disable") || + !strcmp(value, "DISABLE"))) { + tmp_val = int_val = 2; + MPI_Bcast(&tmp_val, 2, MPI_INT, 0, fd->comm); + if (tmp_val != int_val) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_lustre_ds_in_coll", + error_code); + ADIOI_Free(value); + return; + } + ADIOI_Info_set(fd->info, "romio_lustre_ds_in_coll", "disable"); + fd->hints->fs_hints.lustre.ds_in_coll = ADIOI_HINT_DISABLE; + } + } + /* set the values for collective I/O and data sieving parameters */ + ADIOI_GEN_SetInfo(fd, users_info, error_code); + + if (ADIOI_Direct_read) fd->direct_read = 1; + if (ADIOI_Direct_write) fd->direct_write = 1; + + ADIOI_Free(value); + + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_open.c new file mode 100644 index 0000000000..1ee9870fcf --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_open.c @@ -0,0 +1,156 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Copyright (C) 2007 Oak Ridge National Laboratory + * + * Copyright (C) 2008 Sun Microsystems, Lustre group + */ + +#include "ad_lustre.h" + +/* what is the basis for this define? + * what happens if there are more than 1k UUIDs? */ + +#define MAX_LOV_UUID_COUNT 1000 + +void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code) +{ + int perm, old_mask, amode, amode_direct; + int lumlen; + struct lov_user_md *lum = NULL; + char *value; + +#if defined(MPICH2) || !defined(PRINT_ERR_MSG) + static char myname[] = "ADIOI_LUSTRE_OPEN"; +#endif + + 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) + amode = amode | O_CREAT; + 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; + + amode_direct = amode | O_DIRECT; + + fd->fd_sys = open(fd->filename, amode|O_CREAT, perm); + + if (fd->fd_sys != -1) { + int err; + + /* get file striping information and set it in info */ + /* odd malloc here because lov_user_md contains some fixed data and + * then a list of 'lmm_objects' representing stripe */ + lumlen = sizeof(struct lov_user_md) + + MAX_LOV_UUID_COUNT * sizeof(struct lov_user_ost_data); + /* furthermore, Pascal Deveze reports that, even though we pass a + * "GETSTRIPE" (read) flag to the ioctl, if some of the values of this + * struct are uninitialzed, the call can give an error. calloc in case + * there are other members that must be initialized and in case + * lov_user_md struct changes in future */ + lum = (struct lov_user_md *)ADIOI_Calloc(1,lumlen); + lum->lmm_magic = LOV_USER_MAGIC; + err = ioctl(fd->fd_sys, LL_IOC_LOV_GETSTRIPE, (void *)lum); + if (!err) { + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); + + fd->hints->striping_unit = lum->lmm_stripe_size; + sprintf(value, "%d", lum->lmm_stripe_size); + ADIOI_Info_set(fd->info, "striping_unit", value); + + fd->hints->striping_factor = lum->lmm_stripe_count; + sprintf(value, "%d", lum->lmm_stripe_count); + ADIOI_Info_set(fd->info, "striping_factor", value); + + fd->hints->fs_hints.lustre.start_iodevice = lum->lmm_stripe_offset; + sprintf(value, "%d", lum->lmm_stripe_offset); + ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value); + + ADIOI_Free(value); + } + ADIOI_Free(lum); + + if (fd->access_mode & ADIO_APPEND) + fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); + } + + if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) + fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); + + fd->fd_direct = -1; + if (fd->direct_write || fd->direct_read) { + fd->fd_direct = open(fd->filename, amode_direct, perm); + if (fd->fd_direct != -1) { + fd->d_mem = fd->d_miniosz = (1<<12); + } else { + perror("cannot open file with O_Direct"); + fd->direct_write = fd->direct_read = 0; + } + } + + /* --BEGIN ERROR HANDLING-- */ + if (fd->fd_sys == -1 || ((fd->fd_direct == -1) && + (fd->direct_write || fd->direct_read))) { + 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)); + } + } + /* --END ERROR HANDLING-- */ + else *error_code = MPI_SUCCESS; + +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_rwcontig.c b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_rwcontig.c new file mode 100644 index 0000000000..dd8f5ec8a6 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_rwcontig.c @@ -0,0 +1,201 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Copyright (C) 2007 Oak Ridge National Laboratory + * + * Copyright (C) 2008 Sun Microsystems, Lustre group + */ + +#define _XOPEN_SOURCE 600 +#include +#include +#include "ad_lustre.h" + +#define LUSTRE_MEMALIGN (1<<12) /* to use page_shift */ + +static void ADIOI_LUSTRE_Aligned_Mem_File_Write(ADIO_File fd, void *buf, int len, + ADIO_Offset offset, int *err); +static void ADIOI_LUSTRE_Aligned_Mem_File_Write(ADIO_File fd, void *buf, int len, + ADIO_Offset offset, int *err) +{ + int rem, size, nbytes; + if (!(len % fd->d_miniosz) && (len >= fd->d_miniosz)) { + *err = pwrite(fd->fd_direct, buf, len, offset); + } else if (len < fd->d_miniosz) { + *err = pwrite(fd->fd_sys, buf, len, offset); + } else { + rem = len % fd->d_miniosz; + size = len - rem; + nbytes = pwrite(fd->fd_direct, buf, size, offset); + nbytes += pwrite(fd->fd_sys, ((char *)buf) + size, rem, offset+size); + *err = nbytes; + } +} + +static void ADIOI_LUSTRE_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, + ADIO_Offset offset, int *err); +static void ADIOI_LUSTRE_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, + ADIO_Offset offset, int *err) +{ + int rem, size, nbytes; + if (!(len % fd->d_miniosz) && (len >= fd->d_miniosz)) + *err = pread(fd->fd_direct, buf, len, offset); + else if (len < fd->d_miniosz) + *err = pread(fd->fd_sys, buf, len, offset); + else { + rem = len % fd->d_miniosz; + size = len - rem; + nbytes = pread(fd->fd_direct, buf, size, offset); + nbytes += pread(fd->fd_sys, ((char *)buf) + size, rem, offset+size); + *err = nbytes; + } +} + + +static int ADIOI_LUSTRE_Directio(ADIO_File fd, void *buf, int len, + off_t offset, int rw); +static int ADIOI_LUSTRE_Directio(ADIO_File fd, void *buf, int len, + off_t offset, int rw) +{ + int err=-1, diff, size=len, nbytes = 0; + void *newbuf; + + if (offset % fd->d_miniosz) { + diff = fd->d_miniosz - (offset % fd->d_miniosz); + diff = ADIOI_MIN(diff, len); + if (rw) + nbytes = pwrite(fd->fd_sys, buf, diff, offset); + else + nbytes = pread(fd->fd_sys, buf, diff, offset); + buf = ((char *) buf) + diff; + offset += diff; + size = len - diff; + } + + if (!size) { + return diff; + } + + if (rw) { /* direct I/O enabled */ + if (!(((long) buf) % fd->d_mem)) { + ADIOI_LUSTRE_Aligned_Mem_File_Write(fd, buf, size, offset, &err); + nbytes += err; + } else { + newbuf = (void *) memalign(LUSTRE_MEMALIGN, size); + if (newbuf) { + memcpy(newbuf, buf, size); + ADIOI_LUSTRE_Aligned_Mem_File_Write(fd, newbuf, size, offset, &err); + nbytes += err; + ADIOI_Free(newbuf); + } + else nbytes += pwrite(fd->fd_sys, buf, size, offset); + } + err = nbytes; + } else { + if (!(((long) buf) % fd->d_mem)) { + ADIOI_LUSTRE_Aligned_Mem_File_Read(fd, buf, size, offset, &err); + nbytes += err; + } else { + newbuf = (void *) memalign(LUSTRE_MEMALIGN, size); + if (newbuf) { + ADIOI_LUSTRE_Aligned_Mem_File_Read(fd, newbuf, size, offset, &err); + if (err > 0) memcpy(buf, newbuf, err); + nbytes += err; + ADIOI_Free(newbuf); + } + else nbytes += pread(fd->fd_sys, buf, size, offset); + } + err = nbytes; + } + return err; +} + +static void ADIOI_LUSTRE_IOContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int io_mode, int *error_code); +static void ADIOI_LUSTRE_IOContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int io_mode, int *error_code) +{ + int err=-1, datatype_size, len; + static char myname[] = "ADIOI_LUSTRE_IOCONTIG"; + + MPI_Type_size(datatype, &datatype_size); + len = datatype_size * count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + if (!(fd->direct_read || fd->direct_write)) { + if (fd->fp_sys_posn != offset) { + err = lseek(fd->fd_sys, offset, SEEK_SET); + if (err == -1) goto ioerr; + } + + if (io_mode) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->fd_sys, buf, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + } else { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_a, 0, NULL); +#endif + err = read(fd->fd_sys, buf, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_read_b, 0, NULL); +#endif + } + } else { + err = ADIOI_LUSTRE_Directio(fd, buf, len, offset, io_mode); + } + + if (err == -1) goto ioerr; + fd->fp_sys_posn = offset + err; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += err; + } + +#ifdef HAVE_STATUS_SET_BYTES + if (status) MPIR_Status_set_bytes(status, datatype, err); +#endif + *error_code = MPI_SUCCESS; + +ioerr: + /* --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)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ +} + +void ADIOI_LUSTRE_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int *error_code) +{ + ADIOI_LUSTRE_IOContig(fd, buf, count, datatype, file_ptr_type, + offset, status, 1, error_code); +} + +void ADIOI_LUSTRE_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int *error_code) +{ + ADIOI_LUSTRE_IOContig(fd, buf, count, datatype, file_ptr_type, + offset, status, 0, error_code); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_wrcoll.c new file mode 100644 index 0000000000..231465b481 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_wrcoll.c @@ -0,0 +1,954 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Copyright (C) 2007 Oak Ridge National Laboratory + * + * Copyright (C) 2008 Sun Microsystems, Lustre group + */ + +#include "ad_lustre.h" +#include "adio_extern.h" + +/* prototypes of functions used for collective writes only. */ +static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, void *buf, + MPI_Datatype datatype, int nprocs, + int myrank, + ADIOI_Access *others_req, + ADIOI_Access *my_req, + ADIO_Offset *offset_list, + ADIO_Offset *len_list, + int contig_access_count, + int *striping_info, + int **buf_idx, int *error_code); +static void ADIOI_LUSTRE_Fill_send_buffer(ADIO_File fd, void *buf, + ADIOI_Flatlist_node *flat_buf, + char **send_buf, + ADIO_Offset *offset_list, + ADIO_Offset *len_list, int *send_size, + MPI_Request *requests, + int *sent_to_proc, int nprocs, + int myrank, int contig_access_count, + int *striping_info, + int *send_buf_idx, + int *curr_to_proc, + int *done_to_proc, int iter, + MPI_Aint buftype_extent); +static void ADIOI_LUSTRE_W_Exchange_data(ADIO_File fd, void *buf, + char *write_buf, + ADIOI_Flatlist_node *flat_buf, + ADIO_Offset *offset_list, + ADIO_Offset *len_list, int *send_size, + int *recv_size, ADIO_Offset off, + int size, int *count, + int *start_pos, int *partial_recv, + int *sent_to_proc, int nprocs, + int myrank, int buftype_is_contig, + int contig_access_count, + int *striping_info, + ADIOI_Access *others_req, + int *send_buf_idx, + int *curr_to_proc, + int *done_to_proc, int *hole, + int iter, MPI_Aint buftype_extent, + int *buf_idx, int *error_code); +void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, + ADIO_Offset *srt_off, int *srt_len, int *start_pos, + int nprocs, int nprocs_recv, int total_elements); + +void ADIOI_LUSTRE_WriteStridedColl(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, + int file_ptr_type, ADIO_Offset offset, + ADIO_Status *status, int *error_code) +{ + /* Uses a generalized version of the extended two-phase method described + * in "An Extended Two-Phase Method for Accessing Sections of + * Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary, + * Scientific Programming, (5)4:301--317, Winter 1996. + * http://www.mcs.anl.gov/home/thakur/ext2ph.ps + */ + + ADIOI_Access *my_req; + /* array of nprocs access structures, one for each other process has + this process's request */ + + ADIOI_Access *others_req; + /* array of nprocs access structures, one for each other process + whose request is written by this process. */ + + int i, filetype_is_contig, nprocs, myrank, do_collect = 0; + int contig_access_count = 0, buftype_is_contig, interleave_count = 0; + int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; + ADIO_Offset orig_fp, start_offset, end_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *end_offsets = NULL; + ADIO_Offset *len_list = NULL; + int **buf_idx = NULL, *striping_info = NULL; + int old_error, tmp_error; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + + orig_fp = fd->fp_ind; + + /* IO patten identification if cb_write isn't disabled */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + lengths in the file and determine the start and end offsets. */ + + /* Note: end_offset points to the last byte-offset that will be accessed. + * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 + */ + + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); + + /* each process communicates its start and end offsets to other + * processes. The result is an array each of start and end offsets + * stored in order of process rank. + */ + st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset)); + end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset)); + MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, + ADIO_OFFSET, fd->comm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, + ADIO_OFFSET, fd->comm); + /* are the accesses of different processes interleaved? */ + for (i = 1; i < nprocs; i++) + if ((st_offsets[i] < end_offsets[i-1]) && + (st_offsets[i] <= end_offsets[i])) + interleave_count++; + /* This is a rudimentary check for interleaving, but should suffice + for the moment. */ + + /* Two typical access patterns can benefit from collective write. + * 1) the processes are interleaved, and + * 2) the req size is small. + */ + if (interleave_count > 0) { + do_collect = 1; + } else { + do_collect = ADIOI_LUSTRE_Docollect(fd, contig_access_count, + len_list, nprocs); + } + } + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + + /* Decide if collective I/O should be done */ + if ((!do_collect && fd->hints->cb_write == ADIOI_HINT_AUTO) || + fd->hints->cb_write == ADIOI_HINT_DISABLE) { + + /* use independent accesses */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(len_list); + ADIOI_Free(st_offsets); + ADIOI_Free(end_offsets); + } + + fd->fp_ind = orig_fp; + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + if (buftype_is_contig && filetype_is_contig) { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; + ADIO_WriteContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, + off, status, error_code); + } else + ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, + 0, status, error_code); + } else { + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, + offset, status, error_code); + } + return; + } + + /* Get Lustre hints information */ + ADIOI_LUSTRE_Get_striping_info(fd, &striping_info, 1); + + /* calculate what portions of the access requests of this process are + * located in which process + */ + ADIOI_LUSTRE_Calc_my_req(fd, offset_list, len_list, contig_access_count, + striping_info, nprocs, &count_my_req_procs, + &count_my_req_per_proc, &my_req, + &buf_idx); + + /* based on everyone's my_req, calculate what requests of other processes + * will be accessed by this process. + * count_others_req_procs = number of processes whose requests (including + * this process itself) will be accessed by this process + * count_others_req_per_proc[i] indicates how many separate contiguous + * requests of proc. i will be accessed by this process. + */ + + ADIOI_Calc_others_req(fd, count_my_req_procs, count_my_req_per_proc, + my_req, nprocs, myrank, &count_others_req_procs, + &others_req); + ADIOI_Free(count_my_req_per_proc); + + /* exchange data and write in sizes of no more than stripe_size. */ + ADIOI_LUSTRE_Exch_and_write(fd, buf, datatype, nprocs, myrank, + others_req, my_req, offset_list, len_list, + contig_access_count, striping_info, + buf_idx, error_code); + + /* If this collective write is followed by an independent write, + * it's possible to have those subsequent writes on other processes + * race ahead and sneak in before the read-modify-write completes. + * We carry out a collective communication at the end here so no one + * can start independent i/o before collective I/O completes. + * + * need to do some gymnastics with the error codes so that if something + * went wrong, all processes report error, but if a process has a more + * specific error code, we can still have that process report the + * additional information */ + + old_error = *error_code; + if (*error_code != MPI_SUCCESS) + *error_code = MPI_ERR_IO; + + /* optimization: if only one process performing i/o, we can perform + * a less-expensive Bcast */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_postwrite_a, 0, NULL); +#endif + if (fd->hints->cb_nodes == 1) + MPI_Bcast(error_code, 1, MPI_INT, + fd->hints->ranklist[0], fd->comm); + else { + tmp_error = *error_code; + MPI_Allreduce(&tmp_error, error_code, 1, MPI_INT, + MPI_MAX, fd->comm); + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_postwrite_b, 0, NULL); +#endif + + if ((old_error != MPI_SUCCESS) && (old_error != MPI_ERR_IO)) + *error_code = old_error; + + + if (!buftype_is_contig) + ADIOI_Delete_flattened(datatype); + + /* free all memory allocated for collective I/O */ + /* free others_req */ + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + ADIOI_Free(others_req[i].offsets); + ADIOI_Free(others_req[i].lens); + ADIOI_Free(others_req[i].mem_ptrs); + } + } + ADIOI_Free(others_req); + /* free my_req here */ + for (i = 0; i < nprocs; i++) { + if (my_req[i].count) { + ADIOI_Free(my_req[i].offsets); + ADIOI_Free(my_req[i].lens); + } + } + ADIOI_Free(my_req); + for (i = 0; i < nprocs; i++) { + ADIOI_Free(buf_idx[i]); + } + ADIOI_Free(buf_idx); + ADIOI_Free(offset_list); + ADIOI_Free(len_list); + ADIOI_Free(st_offsets); + ADIOI_Free(end_offsets); + ADIOI_Free(striping_info); + +#ifdef HAVE_STATUS_SET_BYTES + if (status) { + int bufsize, size; + /* Don't set status if it isn't needed */ + MPI_Type_size(datatype, &size); + bufsize = size * count; + MPIR_Status_set_bytes(status, datatype, bufsize); + } + /* This is a temporary way of filling in status. The right way is to + * keep track of how much data was actually written during collective I/O. + */ +#endif + + fd->fp_sys_posn = -1; /* set it to null. */ +} + +/* If successful, error_code is set to MPI_SUCCESS. Otherwise an error + * code is created and returned in error_code. + */ +static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, void *buf, + MPI_Datatype datatype, int nprocs, + int myrank, ADIOI_Access *others_req, + ADIOI_Access *my_req, + ADIO_Offset *offset_list, + ADIO_Offset *len_list, + int contig_access_count, + int *striping_info, int **buf_idx, + int *error_code) +{ + /* Send data to appropriate processes and write in sizes of no more + * than lustre stripe_size. + * The idea is to reduce the amount of extra memory required for + * collective I/O. If all data were written all at once, which is much + * easier, it would require temp space more than the size of user_buf, + * which is often unacceptable. For example, to write a distributed + * array to a file, where each local array is 8Mbytes, requiring + * at least another 8Mbytes of temp space is unacceptable. + */ + + int hole, i, j, m, flag, ntimes = 1 , max_ntimes, buftype_is_contig; + ADIO_Offset st_loc = -1, end_loc = -1, min_st_loc, max_end_loc; + ADIO_Offset off, req_off, send_off, iter_st_off, *off_list; + ADIO_Offset max_size, step_size = 0; + int real_size, req_len, send_len; + int *recv_curr_offlen_ptr, *recv_count, *recv_size; + int *send_curr_offlen_ptr, *send_size; + int *partial_recv, *sent_to_proc, *recv_start_pos; + int *send_buf_idx, *curr_to_proc, *done_to_proc; + int *this_buf_idx; + char *write_buf = NULL; + MPI_Status status; + ADIOI_Flatlist_node *flat_buf = NULL; + MPI_Aint buftype_extent; + int stripe_size = striping_info[0], avail_cb_nodes = striping_info[2]; + int data_sieving = 0; + + *error_code = MPI_SUCCESS; /* changed below if error */ + /* only I/O errors are currently reported */ + + /* calculate the number of writes of stripe size to be done. + * That gives the no. of communication phases as well. + * Note: + * Because we redistribute data in stripe-contiguous pattern for Lustre, + * each process has the same no. of communication phases. + */ + + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + st_loc = others_req[i].offsets[0]; + end_loc = others_req[i].offsets[0]; + break; + } + } + for (i = 0; i < nprocs; i++) { + for (j = 0; j < others_req[i].count; j++) { + st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]); + end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] + + others_req[i].lens[j] - 1)); + } + } + /* this process does no writing. */ + if ((st_loc == -1) && (end_loc == -1)) + ntimes = 0; + MPI_Allreduce(&end_loc, &max_end_loc, 1, MPI_LONG_LONG_INT, MPI_MAX, fd->comm); + /* avoid min_st_loc be -1 */ + if (st_loc == -1) + st_loc = max_end_loc; + MPI_Allreduce(&st_loc, &min_st_loc, 1, MPI_LONG_LONG_INT, MPI_MIN, fd->comm); + /* align downward */ + min_st_loc -= min_st_loc % (ADIO_Offset)stripe_size; + + /* Each time, only avail_cb_nodes number of IO clients perform IO, + * so, step_size=avail_cb_nodes*stripe_size IO will be performed at most, + * and ntimes=whole_file_portion/step_size + */ + step_size = (ADIO_Offset) avail_cb_nodes * stripe_size; + max_ntimes = (max_end_loc - min_st_loc + 1) / step_size + + (((max_end_loc - min_st_loc + 1) % step_size) ? 1 : 0); +/* max_ntimes = (int)((max_end_loc - min_st_loc) / step_size + 1); */ + if (ntimes) + write_buf = (char *) ADIOI_Malloc(stripe_size); + + /* calculate the start offset for each iteration */ + off_list = (ADIO_Offset *) ADIOI_Malloc(max_ntimes * sizeof(ADIO_Offset)); + for (m = 0; m < max_ntimes; m ++) + off_list[m] = max_end_loc; + for (i = 0; i < nprocs; i++) { + for (j = 0; j < others_req[i].count; j ++) { + req_off = others_req[i].offsets[j]; + m = (int)((req_off - min_st_loc) / step_size); + off_list[m] = ADIOI_MIN(off_list[m], req_off); + } + } + + recv_curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + send_curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* their use is explained below. calloc initializes to 0. */ + + recv_count = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* to store count of how many off-len pairs per proc are satisfied + in an iteration. */ + + send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* total size of data to be sent to each proc. in an iteration. + Of size nprocs so that I can use MPI_Alltoall later. */ + + recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* total size of data to be recd. from each proc. in an iteration. */ + + sent_to_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int)); + /* amount of data sent to each proc so far. Used in + ADIOI_Fill_send_buffer. initialized to 0 here. */ + + send_buf_idx = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + curr_to_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + done_to_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* Above three are used in ADIOI_Fill_send_buffer */ + + this_buf_idx = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + + recv_start_pos = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + /* used to store the starting value of recv_curr_offlen_ptr[i] in + this iteration */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + if (!buftype_is_contig) { + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) + flat_buf = flat_buf->next; + } + MPI_Type_extent(datatype, &buftype_extent); + /* I need to check if there are any outstanding nonblocking writes to + * the file, which could potentially interfere with the writes taking + * place in this collective write call. Since this is not likely to be + * common, let me do the simplest thing possible here: Each process + * completes all pending nonblocking operations before completing. + */ + /*ADIOI_Complete_async(error_code); + if (*error_code != MPI_SUCCESS) return; + MPI_Barrier(fd->comm); + */ + + iter_st_off = min_st_loc; + + /* Although we have recognized the data according to OST index, + * a read-modify-write will be done if there is a hole between the data. + * For example: if blocksize=60, xfersize=30 and stripe_size=100, + * then rank0 will collect data [0, 30] and [60, 90] then write. There + * is a hole in [30, 60], which will cause a read-modify-write in [0, 90]. + * + * To reduce its impact on the performance, we can disable data sieving + * by hint "ds_in_coll". + */ + /* check the hint for data sieving */ + data_sieving = fd->hints->fs_hints.lustre.ds_in_coll; + + for (m = 0; m < max_ntimes; m++) { + /* go through all others_req and my_req to check which will be received + * and sent in this iteration. + */ + + /* Note that MPI guarantees that displacements in filetypes are in + monotonically nondecreasing order and that, for writes, the + filetypes cannot specify overlapping regions in the file. This + simplifies implementation a bit compared to reads. */ + + /* + off = start offset in the file for the data to be written in + this iteration + iter_st_off = start offset of this iteration + real_size = size of data written (bytes) corresponding to off + max_size = possible maximum size of data written in this iteration + req_off = offset in the file for a particular contiguous request minus + what was satisfied in previous iteration + send_off = offset the request needed by other processes in this iteration + req_len = size corresponding to req_off + send_len = size corresponding to send_off + */ + + /* first calculate what should be communicated */ + for (i = 0; i < nprocs; i++) + recv_count[i] = recv_size[i] = send_size[i] = 0; + + off = off_list[m]; + max_size = ADIOI_MIN(step_size, max_end_loc - iter_st_off + 1); + real_size = (int) ADIOI_MIN((off / stripe_size + 1) * stripe_size - + off, + end_loc - off + 1); + + for (i = 0; i < nprocs; i++) { + if (my_req[i].count) { + this_buf_idx[i] = buf_idx[i][send_curr_offlen_ptr[i]]; + for (j = send_curr_offlen_ptr[i]; j < my_req[i].count; j++) { + send_off = my_req[i].offsets[j]; + send_len = my_req[i].lens[j]; + if (send_off < iter_st_off + max_size) { + send_size[i] += send_len; + } else { + break; + } + } + send_curr_offlen_ptr[i] = j; + } + if (others_req[i].count) { + recv_start_pos[i] = recv_curr_offlen_ptr[i]; + for (j = recv_curr_offlen_ptr[i]; j < others_req[i].count; j++) { + req_off = others_req[i].offsets[j]; + req_len = others_req[i].lens[j]; + if (req_off < iter_st_off + max_size) { + recv_count[i]++; + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)write_buf)+req_off-off) == (ADIO_Offset)(MPIR_Upint)(write_buf+req_off-off)); + MPI_Address(write_buf + req_off - off, + &(others_req[i].mem_ptrs[j])); + recv_size[i] += req_len; + } else { + break; + } + } + recv_curr_offlen_ptr[i] = j; + } + } + /* use variable "hole" to pass data_sieving flag into W_Exchange_data */ + hole = data_sieving; + ADIOI_LUSTRE_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, + len_list, send_size, recv_size, off, real_size, + recv_count, recv_start_pos, partial_recv, + sent_to_proc, nprocs, myrank, + buftype_is_contig, contig_access_count, + striping_info, others_req, send_buf_idx, + curr_to_proc, done_to_proc, &hole, m, + buftype_extent, this_buf_idx, error_code); + if (*error_code != MPI_SUCCESS) + goto over; + + flag = 0; + for (i = 0; i < nprocs; i++) + if (recv_count[i]) { + flag = 1; + break; + } + if (flag) { + /* check whether to do data sieving */ + if(data_sieving == ADIOI_HINT_ENABLE) { + ADIO_WriteContig(fd, write_buf, real_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, + error_code); + } else { + /* if there is no hole, write data in one time; + * otherwise, write data in several times */ + if (!hole) { + ADIO_WriteContig(fd, write_buf, real_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, + error_code); + } else { + for (i = 0; i < nprocs; i++) { + if (others_req[i].count) { + for (j = 0; j < others_req[i].count; j++) { + if (others_req[i].offsets[j] < off + real_size && + others_req[i].offsets[j] >= off) { + ADIO_WriteContig(fd, + write_buf + others_req[i].offsets[j] - off, + others_req[i].lens[j], + MPI_BYTE, ADIO_EXPLICIT_OFFSET, + others_req[i].offsets[j], &status, + error_code); + if (*error_code != MPI_SUCCESS) + goto over; + } + } + } + } + } + } + if (*error_code != MPI_SUCCESS) + goto over; + } + iter_st_off += max_size; + } +over: + if (ntimes) + ADIOI_Free(write_buf); + ADIOI_Free(recv_curr_offlen_ptr); + ADIOI_Free(send_curr_offlen_ptr); + ADIOI_Free(recv_count); + ADIOI_Free(send_size); + ADIOI_Free(recv_size); + ADIOI_Free(sent_to_proc); + ADIOI_Free(recv_start_pos); + ADIOI_Free(send_buf_idx); + ADIOI_Free(curr_to_proc); + ADIOI_Free(done_to_proc); + ADIOI_Free(this_buf_idx); + ADIOI_Free(off_list); +} + +/* Sets error_code to MPI_SUCCESS if successful, or creates an error code + * in the case of error. + */ +static void ADIOI_LUSTRE_W_Exchange_data(ADIO_File fd, void *buf, + char *write_buf, + ADIOI_Flatlist_node *flat_buf, + ADIO_Offset *offset_list, + ADIO_Offset *len_list, int *send_size, + int *recv_size, ADIO_Offset off, + int size, int *count, + int *start_pos, int *partial_recv, + int *sent_to_proc, int nprocs, + int myrank, int buftype_is_contig, + int contig_access_count, + int *striping_info, + ADIOI_Access *others_req, + int *send_buf_idx, + int *curr_to_proc, int *done_to_proc, + int *hole, int iter, + MPI_Aint buftype_extent, + int *buf_idx, int *error_code) +{ + int i, j, nprocs_recv, nprocs_send, err; + char **send_buf = NULL; + MPI_Request *requests, *send_req; + MPI_Datatype *recv_types; + MPI_Status *statuses, status; + int *srt_len, sum, sum_recv; + ADIO_Offset *srt_off; + int data_sieving = *hole; + static char myname[] = "ADIOI_W_EXCHANGE_DATA"; + + /* create derived datatypes for recv */ + nprocs_recv = 0; + for (i = 0; i < nprocs; i++) + if (recv_size[i]) + nprocs_recv++; + + recv_types = (MPI_Datatype *) ADIOI_Malloc((nprocs_recv + 1) * + sizeof(MPI_Datatype)); + /* +1 to avoid a 0-size malloc */ + + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + MPI_Type_hindexed(count[i], + &(others_req[i].lens[start_pos[i]]), + &(others_req[i].mem_ptrs[start_pos[i]]), + MPI_BYTE, recv_types + j); + /* absolute displacements; use MPI_BOTTOM in recv */ + MPI_Type_commit(recv_types + j); + j++; + } + } + + /* To avoid a read-modify-write, + * check if there are holes in the data to be written. + * For this, merge the (sorted) offset lists others_req using a heap-merge. + */ + + sum = 0; + for (i = 0; i < nprocs; i++) + sum += count[i]; + srt_off = (ADIO_Offset *) ADIOI_Malloc((sum + 1) * sizeof(ADIO_Offset)); + srt_len = (int *) ADIOI_Malloc((sum + 1) * sizeof(int)); + /* +1 to avoid a 0-size malloc */ + + ADIOI_Heap_merge(others_req, count, srt_off, srt_len, start_pos, + nprocs, nprocs_recv, sum); + + /* check if there are any holes */ + *hole = 0; + for (i = 0; i < sum - 1; i++) { + if (srt_off[i] + srt_len[i] < srt_off[i + 1]) { + *hole = 1; + break; + } + } + /* In some cases (see John Bent ROMIO REQ # 835), an odd interaction + * between aggregation, nominally contiguous regions, and cb_buffer_size + * should be handled with a read-modify-write (otherwise we will write out + * more data than we receive from everyone else (inclusive), so override + * hole detection + */ + if (*hole == 0) { + sum_recv = 0; + for (i = 0; i < nprocs; i++) + sum_recv += recv_size[i]; + if (size > sum_recv) + *hole = 1; + } + /* check the hint for data sieving */ + if (data_sieving == ADIOI_HINT_ENABLE && nprocs_recv && *hole) { + ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, off, &status, &err); + // --BEGIN ERROR HANDLING-- + if (err != MPI_SUCCESS) { + *error_code = MPIO_Err_create_code(err, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_IO, + "**ioRMWrdwr", 0); + ADIOI_Free(recv_types); + ADIOI_Free(srt_off); + ADIOI_Free(srt_len); + return; + } + // --END ERROR HANDLING-- + } + ADIOI_Free(srt_off); + ADIOI_Free(srt_len); + + nprocs_send = 0; + for (i = 0; i < nprocs; i++) + if (send_size[i]) + nprocs_send++; + + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + requests = (MPI_Request *) ADIOI_Malloc((nprocs_send + 1) * + sizeof(MPI_Request)); + send_req = requests; + } else { + requests = (MPI_Request *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1)* + sizeof(MPI_Request)); + /* +1 to avoid a 0-size malloc */ + + /* post receives */ + j = 0; + for (i = 0; i < nprocs; i++) { + if (recv_size[i]) { + MPI_Irecv(MPI_BOTTOM, 1, recv_types[j], i, + myrank + i + 100 * iter, fd->comm, requests + j); + j++; + } + } + send_req = requests + nprocs_recv; + } + + /* post sends. + * if buftype_is_contig, data can be directly sent from + * user buf at location given by buf_idx. else use send_buf. + */ + if (buftype_is_contig) { + j = 0; + for (i = 0; i < nprocs; i++) + if (send_size[i]) { + ADIOI_Assert(buf_idx[i] != -1); + MPI_Isend(((char *) buf) + buf_idx[i], send_size[i], + MPI_BYTE, i, myrank + i + 100 * iter, fd->comm, + send_req + j); + j++; + } + } else + if (nprocs_send) { + /* buftype is not contig */ + send_buf = (char **) ADIOI_Malloc(nprocs * sizeof(char *)); + for (i = 0; i < nprocs; i++) + if (send_size[i]) + send_buf[i] = (char *) ADIOI_Malloc(send_size[i]); + + ADIOI_LUSTRE_Fill_send_buffer(fd, buf, flat_buf, send_buf, offset_list, + len_list, send_size, send_req, + sent_to_proc, nprocs, myrank, + contig_access_count, striping_info, + send_buf_idx, curr_to_proc, done_to_proc, + iter, buftype_extent); + /* the send is done in ADIOI_Fill_send_buffer */ + } + + /* bug fix from Wei-keng Liao and Kenin Coloma */ + if (fd->atomicity) { + j = 0; + for (i = 0; i < nprocs; i++) { + MPI_Status wkl_status; + if (recv_size[i]) { + MPI_Recv(MPI_BOTTOM, 1, recv_types[j], i, + myrank + i + 100 * iter, fd->comm, &wkl_status); + j++; + } + } + } + + for (i = 0; i < nprocs_recv; i++) + MPI_Type_free(recv_types + i); + ADIOI_Free(recv_types); + + /* bug fix from Wei-keng Liao and Kenin Coloma */ + /* +1 to avoid a 0-size malloc */ + if (fd->atomicity) { + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + 1) * + sizeof(MPI_Status)); + } else { + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send + nprocs_recv + 1) * + sizeof(MPI_Status)); + } + +#ifdef NEEDS_MPI_TEST + i = 0; + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + while (!i) + MPI_Testall(nprocs_send, send_req, &i, statuses); + } else { + while (!i) + MPI_Testall(nprocs_send + nprocs_recv, requests, &i, statuses); + } +#else + /* bug fix from Wei-keng Liao and Kenin Coloma */ + if (fd->atomicity) + MPI_Waitall(nprocs_send, send_req, statuses); + else + MPI_Waitall(nprocs_send + nprocs_recv, requests, statuses); +#endif + ADIOI_Free(statuses); + ADIOI_Free(requests); + if (!buftype_is_contig && nprocs_send) { + for (i = 0; i < nprocs; i++) + if (send_size[i]) + ADIOI_Free(send_buf[i]); + ADIOI_Free(send_buf); + } +} + +#define ADIOI_BUF_INCR \ +{ \ + while (buf_incr) { \ + size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + buf_incr -= size_in_buf; \ + } \ +} + + +#define ADIOI_BUF_COPY \ +{ \ + while (size) { \ + size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ + memcpy(&(send_buf[p][send_buf_idx[p]]), \ + ((char *) buf) + user_buf_idx, size_in_buf); \ + send_buf_idx[p] += size_in_buf; \ + user_buf_idx += size_in_buf; \ + flat_buf_sz -= size_in_buf; \ + if (!flat_buf_sz) { \ + if (flat_buf_idx < (flat_buf->count - 1)) flat_buf_idx++; \ + else { \ + flat_buf_idx = 0; \ + n_buftypes++; \ + } \ + user_buf_idx = flat_buf->indices[flat_buf_idx] + \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ + flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ + } \ + size -= size_in_buf; \ + buf_incr -= size_in_buf; \ + } \ + ADIOI_BUF_INCR \ +} + +static void ADIOI_LUSTRE_Fill_send_buffer(ADIO_File fd, void *buf, + ADIOI_Flatlist_node *flat_buf, + char **send_buf, + ADIO_Offset *offset_list, + ADIO_Offset *len_list, int *send_size, + MPI_Request *requests, + int *sent_to_proc, int nprocs, + int myrank, + int contig_access_count, + int *striping_info, + int *send_buf_idx, + int *curr_to_proc, + int *done_to_proc, int iter, + MPI_Aint buftype_extent) +{ + /* this function is only called if buftype is not contig */ + int i, p, flat_buf_idx, size; + int flat_buf_sz, buf_incr, size_in_buf, jj, n_buftypes; + ADIO_Offset off, len, rem_len, user_buf_idx; + + /* curr_to_proc[p] = amount of data sent to proc. p that has already + * been accounted for so far + * done_to_proc[p] = amount of data already sent to proc. p in + * previous iterations + * user_buf_idx = current location in user buffer + * send_buf_idx[p] = current location in send_buf of proc. p + */ + + for (i = 0; i < nprocs; i++) { + send_buf_idx[i] = curr_to_proc[i] = 0; + done_to_proc[i] = sent_to_proc[i]; + } + jj = 0; + + user_buf_idx = flat_buf->indices[0]; + flat_buf_idx = 0; + n_buftypes = 0; + flat_buf_sz = flat_buf->blocklens[0]; + + /* flat_buf_idx = current index into flattened buftype + * flat_buf_sz = size of current contiguous component in flattened buf + */ + for (i = 0; i < contig_access_count; i++) { + off = offset_list[i]; + rem_len = (ADIO_Offset) len_list[i]; + + /*this request may span to more than one process */ + while (rem_len != 0) { + len = rem_len; + /* NOTE: len value is modified by ADIOI_Calc_aggregator() to be no + * longer than the single region that processor "p" is responsible + * for. + */ + p = ADIOI_LUSTRE_Calc_aggregator(fd, off, &len, striping_info); + + if (send_buf_idx[p] < send_size[p]) { + if (curr_to_proc[p] + len > done_to_proc[p]) { + if (done_to_proc[p] > curr_to_proc[p]) { + size = (int) ADIOI_MIN(curr_to_proc[p] + len - + done_to_proc[p], + send_size[p] - + send_buf_idx[p]); + buf_incr = done_to_proc[p] - curr_to_proc[p]; + ADIOI_BUF_INCR + ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == (unsigned)(curr_to_proc[p] + len - done_to_proc[p])); + buf_incr = (int) (curr_to_proc[p] + len - + done_to_proc[p]); + ADIOI_Assert((done_to_proc[p] + size) == (unsigned)(done_to_proc[p] + size)); + curr_to_proc[p] = done_to_proc[p] + size; + ADIOI_BUF_COPY + } else { + size = (int) ADIOI_MIN(len, send_size[p] - + send_buf_idx[p]); + buf_incr = (int) len; + ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size)); + curr_to_proc[p] += size; + ADIOI_BUF_COPY + } + if (send_buf_idx[p] == send_size[p]) { + MPI_Isend(send_buf[p], send_size[p], MPI_BYTE, p, + myrank + p + 100 * iter, fd->comm, + requests + jj); + jj++; + } + } else { + ADIOI_Assert((curr_to_proc[p] + len) == (unsigned)((ADIO_Offset)curr_to_proc[p] + len)); + curr_to_proc[p] += (int) len; + buf_incr = (int) len; + ADIOI_BUF_INCR + } + } else { + buf_incr = (int) len; + ADIOI_BUF_INCR + } + off += len; + rem_len -= len; + } + } + for (i = 0; i < nprocs; i++) + if (send_size[i]) + sent_to_proc[i] = curr_to_proc[i]; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_wrstr.c b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_wrstr.c new file mode 100644 index 0000000000..2854a37c7e --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_lustre/ad_lustre_wrstr.c @@ -0,0 +1,530 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Copyright (C) 2007 Oak Ridge National Laboratory + * + * Copyright (C) 2008 Sun Microsystems, Lustre group + */ + +#include "ad_lustre.h" +#include "adio_extern.h" + +#define ADIOI_BUFFERED_WRITE \ +{ \ + if (req_off >= writebuf_off + writebuf_len) { \ + if (writebuf_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, \ + &status1, error_code); \ + if (!(fd->atomicity)) \ + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, \ + myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + } \ + writebuf_off = req_off; \ + /* stripe_size alignment */ \ + writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \ + (writebuf_off / stripe_size + 1) * \ + stripe_size - writebuf_off); \ + if (!(fd->atomicity)) \ + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, \ + writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, \ + myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowsrc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + } \ + write_sz = (unsigned) (ADIOI_MIN(req_len, \ + writebuf_off + writebuf_len - req_off)); \ + ADIOI_Assert((ADIO_Offset)write_sz == \ + ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf + req_off - writebuf_off, (char *)buf +userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (!(fd->atomicity)) \ + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + /* stripe_size alignment */ \ + writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \ + (writebuf_off / stripe_size + 1) * \ + stripe_size - writebuf_off); \ + if (!(fd->atomicity)) \ + ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, \ + writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowsrc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + write_sz = ADIOI_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ +} + + +/* this macro is used when filetype is contig and buftype is not contig. + it does not do a read-modify-write and does not lock*/ +#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ +{ \ + if (req_off >= writebuf_off + writebuf_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, \ + error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, \ + myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + writebuf_off = req_off; \ + /* stripe_size alignment */ \ + writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \ + (writebuf_off / stripe_size + 1) * \ + stripe_size - writebuf_off); \ + } \ + write_sz = (unsigned) ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off); \ + ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf + req_off - writebuf_off, \ + (char *)buf + userbuf_off, write_sz); \ + while (write_sz != req_len) { \ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + ADIOI_Free(writebuf); \ + return; \ + } \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + /* stripe_size alignment */ \ + writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \ + (writebuf_off / stripe_size + 1) * \ + stripe_size - writebuf_off); \ + write_sz = ADIOI_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz); \ + } \ +} + +void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status * status, + int *error_code) +{ + /* offset is in units of etype relative to the filetype. */ + ADIOI_Flatlist_node *flat_buf, *flat_file; + ADIO_Offset i_offset, sum, size_in_filetype; + int i, j, k, st_index=0; + int n_etypes_in_filetype; + ADIO_Offset num, size, n_filetypes, etype_in_filetype, st_n_filetypes; + ADIO_Offset abs_off_in_filetype=0; + int filetype_size, etype_size, buftype_size; + MPI_Aint filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off; + ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off; + char *writebuf; + unsigned bufsize, writebuf_len, write_sz; + ADIO_Status status1; + ADIO_Offset new_bwr_size, new_fwr_size, st_fwr_size, fwr_size=0, bwr_size, req_len; + int stripe_size; + static char myname[] = "ADIOI_LUSTRE_WriteStrided"; + + if (fd->hints->ds_write == ADIOI_HINT_DISABLE) { + /* if user has disabled data sieving on writes, use naive + * approach instead. + */ + ADIOI_GEN_WriteStrided_naive(fd, + buf, + count, + datatype, + file_ptr_type, + offset, status, error_code); + return; + } + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size(fd->filetype, &filetype_size); + if (!filetype_size) { + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); + bufsize = buftype_size * count; + + /* get striping info */ + stripe_size = fd->hints->striping_unit; + + /* Different buftype to different filetype */ + if (!buftype_is_contig && filetype_is_contig) { + /* noncontiguous in memory, contiguous in file. */ + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) + flat_buf = flat_buf->next; + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + (ADIO_Offset)etype_size * offset; + + start_off = off; + end_offset = start_off + bufsize - 1; + /* write stripe size buffer each time */ + writebuf = (char *) ADIOI_Malloc(ADIOI_MIN(bufsize, stripe_size)); + writebuf_off = 0; + writebuf_len = 0; + + /* if atomicity is true, lock the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, bufsize); + + for (j = 0; j < count; j++) { + for (i = 0; i < flat_buf->count; i++) { + userbuf_off = (ADIO_Offset)j * (ADIO_Offset)buftype_extent + + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_WRITE_WITHOUT_READ + off += flat_buf->blocklens[i]; + } + } + + /* write the buffer out finally */ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, + error_code); + + if (fd->atomicity) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, bufsize); + if (*error_code != MPI_SUCCESS) { + ADIOI_Free(writebuf); + return; + } + ADIOI_Free(writebuf); + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind = off; + } else { + /* noncontiguous in file */ + /* filetype already flattened in ADIO_Open */ + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) + flat_file = flat_file->next; + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset)n_filetypes * filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i=0; icount; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* fwr_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + fwr_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + fwr_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; + } + else { + n_etypes_in_filetype = filetype_size/etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = 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) { + st_index = i; + fwr_size = 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 */ + offset = disp + (ADIO_Offset) n_filetypes *filetype_extent + + abs_off_in_filetype; + } + + start_off = offset; + + /* Wei-keng Liao:write request is within single flat_file + * contig block*/ + /* this could happen, for example, with subarray types that are + * actually fairly contiguous */ + if (buftype_is_contig && bufsize <= fwr_size) { + req_off = start_off; + req_len = bufsize; + end_offset = start_off + bufsize - 1; + writebuf = (char *) ADIOI_Malloc(ADIOI_MIN(bufsize, stripe_size)); + memset(writebuf, -1, ADIOI_MIN(bufsize, stripe_size)); + writebuf_off = 0; + writebuf_len = 0; + userbuf_off = 0; + ADIOI_BUFFERED_WRITE_WITHOUT_READ + /* write the buffer out finally */ + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, + error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte + * that can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == fwr_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + (ADIO_Offset)n_filetypes*filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + ADIOI_Free(writebuf); + return; + } + + /* Calculate end_offset, the last byte-offset that will be accessed. + e.g., if start_offset=0 and 100 bytes to be write, end_offset=99*/ + + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + i_offset = 0; + j = st_index; + off = offset; + fwr_size = ADIOI_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + i_offset += fwr_size; + end_offset = off + fwr_size - 1; + + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); + } + +/* if atomicity is true, lock the region to be accessed */ + if (fd->atomicity) + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + writebuf_off = 0; + writebuf_len = 0; + writebuf = (char *) ADIOI_Malloc(stripe_size); + memset(writebuf, -1, stripe_size); + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = ADIOI_MIN(st_fwr_size, bufsize); + while (i_offset < bufsize) { + if (fwr_size) { + /* TYPE_UB and TYPE_LB can result in + fwr_size = 0. save system call in such cases */ + /* lseek(fd->fd_sys, off, SEEK_SET); + err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size);*/ + + req_off = off; + req_len = fwr_size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE + } + i_offset += fwr_size; + + if (off + fwr_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + + n_filetypes*(ADIO_Offset)filetype_extent) + off += fwr_size; + /* did not reach end of contiguous block in filetype. + no more I/O needed. off is incremented by fwr_size. */ + else { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + fwr_size = ADIOI_MIN(flat_file->blocklens[j], + bufsize-i_offset); + } + } + } + else { +/* noncontiguous in memory as well as in file */ + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + k = num = buf_count = 0; + i_offset = flat_buf->indices[0]; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = ADIOI_MIN(fwr_size, bwr_size); + if (size) { + /* lseek(fd->fd_sys, off, SEEK_SET); + err = write(fd->fd_sys, ((char *) buf) + i_offset, size); */ + + req_off = off; + req_len = size; + userbuf_off = i_offset; + ADIOI_BUFFERED_WRITE + } + + new_fwr_size = fwr_size; + new_bwr_size = bwr_size; + + if (size == fwr_size) { +/* reached end of contiguous block in file */ + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } + + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + + new_fwr_size = flat_file->blocklens[j]; + if (size != bwr_size) { + i_offset += size; + new_bwr_size -= size; + } + } + + if (size == bwr_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1)%flat_buf->count; + buf_count++; + i_offset = (ADIO_Offset)buftype_extent * + (ADIO_Offset)(buf_count/flat_buf->count) + + flat_buf->indices[k]; + new_bwr_size = flat_buf->blocklens[k]; + if (size != fwr_size) { + off += size; + new_fwr_size -= size; + } + } + num += size; + fwr_size = new_fwr_size; + bwr_size = new_bwr_size; + } + } + + /* write the buffer out finally */ + if (writebuf_len) { + ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, + writebuf_off, &status1, error_code); + if (!(fd->atomicity)) + ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); + if (*error_code != MPI_SUCCESS) return; + } + if (fd->atomicity) + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + + ADIOI_Free(writebuf); + + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + if (!buftype_is_contig) + ADIOI_Delete_flattened(datatype); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/.state-cache new file mode 100644 index 0000000000..02ea76f1a4 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/.state-cache @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/Makefile.in index 8872aa7a2c..d64e700024 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/Makefile.in @@ -1,26 +1,70 @@ CC = @CC@ AR = @AR@ +RANLIB = @RANLIB@ LIBNAME = @LIBNAME@ srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) +#DEFS = @DEFS@ -I. -I${srcdir} +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +#CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) +CFLAGS = @CFLAGS@ + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +C_COMPILE_SHL = $(CC_SHL) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +#C_COMPILE_SHL = $(CC_SHL) @VPATH@ -AD_NFS_OBJECTS = ad_nfs_close.o ad_nfs_read.o \ +AD_NFS_OBJECTS = ad_nfs_read.o \ ad_nfs_open.o ad_nfs_write.o ad_nfs_done.o \ ad_nfs_fcntl.o ad_nfs_iread.o ad_nfs_iwrite.o ad_nfs_wait.o \ - ad_nfs_resize.o \ - ad_nfs_setsh.o ad_nfs_getsh.o ad_nfs.o + ad_nfs_setsh.o ad_nfs_getsh.o ad_nfs.o ad_nfs_resize.o ad_nfs_features.o default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo +# $(CC) $(CFLAGS) -c $< .c.o: - $(CC) $(CFLAGS) -c $< + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE) -c $< ; \ + fi + @$(C_COMPILE) -c $< +# $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o +# @mv -f _s$*.o $*.lo +.c.lo: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE_SHL) -c $< -o _s$*.o ; \ + echo mv -f _s$*.o $*.lo ; \ + fi + @$(C_COMPILE_SHL) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo $(LIBNAME): $(AD_NFS_OBJECTS) $(AR) $(LIBNAME) $(AD_NFS_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_NFS_LOOBJECTS=$(AD_NFS_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_NFS_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_NFS_LOOBJECTS) + +coverage: + -@for file in ${AD_NFS_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done clean: - @rm -f *.o + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.c index 64d94941fb..c3f8b4ce4f 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -13,6 +12,7 @@ struct ADIOI_Fns_struct ADIO_NFS_operations = { ADIOI_NFS_Open, /* Open */ + ADIOI_FAILSAFE_OpenColl, /* OpenColl */ ADIOI_NFS_ReadContig, /* ReadContig */ ADIOI_NFS_WriteContig, /* WriteContig */ ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ @@ -22,16 +22,19 @@ struct ADIOI_Fns_struct ADIO_NFS_operations = { ADIOI_GEN_SetInfo, /* SetInfo */ ADIOI_NFS_ReadStrided, /* ReadStrided */ ADIOI_NFS_WriteStrided, /* WriteStrided */ - ADIOI_NFS_Close, /* Close */ - ADIOI_NFS_IreadContig, /* IreadContig */ - ADIOI_NFS_IwriteContig, /* IwriteContig */ + ADIOI_GEN_Close, /* Close */ + /* Even with lockd running and NFS mounted 'noac', we have been unable to + * gaurantee correct behavior over NFS with asyncronous I/O operations */ + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_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_Delete, /* Delete */ + ADIOI_NFS_Feature, /* Features */ }; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.h index 5b36043c74..5a1daa5f64 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs.h @@ -1,7 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ @@ -14,22 +12,72 @@ #include #include "adio.h" -#ifndef NO_AIO -#ifdef AIO_SUN -#include -#else +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H #include -#ifdef NEEDS_ADIOCB_T -typedef struct adiocb adiocb_t; #endif +#ifdef HAVE_SYS_AIO_H +#include #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, - int wr, void *handle); + int wr, MPI_Request *request); #ifdef SX4 #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); +void ADIOI_NFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +int ADIOI_NFS_Feature(ADIO_File fd, int feature_flag); + #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_close.c deleted file mode 100644 index 43561da712..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_close.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_done.c dissimilarity index 90% index 9cf3815f75..79baf2ec86 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_done.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_done.c @@ -1,176 +1,19 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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) -{ -#ifndef NO_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 - struct aiocb *tmp1; -#endif -#endif - - if (*request == ADIO_REQUEST_NULL) { - *error_code = MPI_SUCCESS; - return 1; - } - -#ifdef NO_AIO -/* HP, FreeBSD, Linux */ -#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; -#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 */ - if ((*request)->queued) { - tmp1 = (struct aiocb *) (*request)->handle; - errno = aio_error(tmp1->aio_handle); - if (errno == EINPROG) { - done = 0; - *error_code = MPI_SUCCESS; - } - else { - err = aio_return(tmp1->aio_handle); - (*request)->nbytes = err; - errno = aio_error(tmp1->aio_handle); - - 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - } - 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); -#endif - -#elif (!defined(NO_AIO) && !defined(AIO_SUN)) -/* DEC, SGI IRIX 5 and 6 */ - if ((*request)->queued) { - errno = aio_error((const struct aiocb *) (*request)->handle); - if (errno == EINPROGRESS) { - done = 0; - *error_code = MPI_SUCCESS; - } - else { - err = aio_return((struct aiocb *) (*request)->handle); - (*request)->nbytes = err; - errno = aio_error((struct aiocb *) (*request)->handle); - - 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - } - 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); -#endif - -#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. */ - if ((*request)->queued) ADIOI_Del_req_from_list(request); - - (*request)->fd->async_count--; - if ((*request)->handle) ADIOI_Free((*request)->handle); - ADIOI_Free_request((ADIOI_Req_node *) (*request)); - *request = ADIO_REQUEST_NULL; - } - return done; -#endif - -} - - -int ADIOI_NFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - return ADIOI_NFS_ReadDone(request, status, error_code); -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * 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) +{ + *error_code = MPI_SUCCESS; + return 1; +} +int ADIOI_NFS_WriteDone(ADIO_Request *request, ADIO_Status *status, + int *error_code) +{ + return ADIOI_NFS_ReadDone(request, status, error_code); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_fcntl.c dissimilarity index 85% index 1de39446e6..992c09bfb6 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_fcntl.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_fcntl.c @@ -1,182 +1,65 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" -#include "adio_extern.h" -#ifdef MPISGI -#include "mpisgi2.h" -#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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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 = CtvAccess(ADIOI_Flatlist); - while (flat_file->type != fd->filetype) - flat_file = flat_file->next; - for (i=0; icount; 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) - 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); - } - 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 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; ifp_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; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_NFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_nfs.h" +#include "adio_extern.h" +/* #ifdef MPISGI +#include "mpisgi2.h" +#endif */ + +void ADIOI_NFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) +{ + static char myname[] = "ADIOI_NFS_FCNTL"; + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + ADIOI_READ_LOCK(fd, 0, SEEK_SET, 1); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + ADIOI_UNLOCK(fd, 0, SEEK_SET, 1); + if (fd->fp_sys_posn != -1) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } + if (fcntl_struct->fsize == -1) { + *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; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + 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; + break; + + default: + /* --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-- */ + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_features.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_features.c new file mode 100644 index 0000000000..14918063af --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_features.c @@ -0,0 +1,17 @@ +#include "adio.h" +#include "ad_nfs.h" + +int ADIOI_NFS_Feature(ADIO_File fd, int flag) +{ + switch(flag) { + case ADIO_SHARED_FP: + case ADIO_LOCKS: + case ADIO_SEQUENTIAL: + case ADIO_DATA_SIEVING_WRITES: + return 1; + case ADIO_SCALABLE_OPEN: + case ADIO_UNLINK_AFTER_CLOSE: + default: + return 0; + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_flush.c deleted file mode 100644 index 5dfa8da9c0..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_flush.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_getsh.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_getsh.c index 29f0e77e31..33a0fcd7c4 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_getsh.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_getsh.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -19,54 +18,88 @@ 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, 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)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif err = read(fd->shared_fp_fd->fd_sys, shared_fp, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif /* if the file is empty, the above read may return error (reading beyond end of file). In that case, shared_fp = 0, set above, is the correct value. */ } 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)); + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + err = lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + if (err == 0) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif + err = read(fd->shared_fp_fd->fd_sys, shared_fp, + sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + } 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; } } + if (incr == 0) {goto done;} + 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)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + err = lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + if (err == 0) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + err = write(fd->shared_fp_fd->fd_sys, &new_fp, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + } +done: 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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_hints.c index 4b38fd2c4b..891a3701ac 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_hints.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_hints.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iread.c dissimilarity index 79% index b4c0fcab9a..4896354a33 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iread.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iread.c @@ -1,102 +1,37 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#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) -{ - int len, typesize; -#ifdef NO_AIO - ADIO_Status status; -#else - int err=-1; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_NFS_IREADCONTIG"; -#endif -#endif - - (*request) = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_READ; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size(datatype, &typesize); - len = count * typesize; - -#ifdef NO_AIO - /* HP, FreeBSD, Linux */ - /* no support for nonblocking I/O. Use blocking I/O. */ - - ADIOI_NFS_ReadContig(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) { - MPI_Get_elements(&status, MPI_BYTE, &len); - (*request)->nbytes = len; - } -#endif - -#else - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - err = 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); - } - 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 -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_nfs.h" + +#ifdef ROMIO_HAVE_WORKING_AIO +/* nearly identical to ADIOI_GEN_IreadContig, except we lock around I/O */ +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 len, typesize; + int aio_errno = 0; + static char myname[] = "ADIOI_NFS_IREADCONTIG"; + + MPI_Type_size(datatype, &typesize); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; + aio_errno = ADIOI_NFS_aio(fd, buf, len, offset, 0, request); + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; + + 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 diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iwrite.c dissimilarity index 84% index 90880dc743..0cfd562170 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iwrite.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_iwrite.c @@ -1,353 +1,130 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_nfs.h" - -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) -{ - int len, typesize; -#ifdef NO_AIO - ADIO_Status status; -#else - int err=-1; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_NFS_IWRITECONTIG"; -#endif -#endif - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size(datatype, &typesize); - len = count * typesize; - -#ifdef NO_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); - (*request)->queued = 0; -#ifdef HAVE_STATUS_SET_BYTES - if (*error_code == MPI_SUCCESS) { - MPI_Get_elements(&status, MPI_BYTE, &len); - (*request)->nbytes = len; - } -#endif - -#else - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - err = 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); - } - 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. */ - -int ADIOI_NFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, void *handle) -{ - int err=-1, fd_sys; - -#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); - err = aio_write(fd_sys, aiocbp); - this_errno = errno; - ADIOI_UNLOCK(fd, offset, SEEK_SET, len); - } - else { - ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); - err = aio_read(fd_sys, aiocbp); - 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); - err = aio_write(fd_sys, aiocbp); - this_errno = errno; - ADIOI_UNLOCK(fd, offset, SEEK_SET, len); - } - else { - ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); - err = aio_read(fd_sys, aiocbp); - 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 = aio_write(fd_sys, aiocbp); - this_errno = errno; - ADIOI_UNLOCK(fd, offset, SEEK_SET, len); - } - else { - ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); - err = aio_read(fd_sys, 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 { - 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_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; -#endif - -#ifdef AIO_SIGNOTIFY_NONE -/* SGI IRIX 6 */ - aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE; -#else - aiocbp->aio_sigevent.sigev_signo = 0; -#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 (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); - 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); - } - - while (err == -1) { - if (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 { - FPRINTF(stderr, "Unknown errno %d in ADIOI_NFS_aio\n", this_errno); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - - *((struct aiocb **) handle) = aiocbp; -#endif - - return err; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_nfs.h" + +#include "../../mpi-io/mpioimpl.h" +#include "../../mpi-io/mpioprof.h" +#include "mpiu_greq.h" + +#include + +#ifdef ROMIO_HAVE_WORKING_AIO +static MPIX_Grequest_class ADIOI_GEN_greq_class = 0; +/* this routine is nearly identical to ADIOI_GEN_IwriteContig, except we lock + * around I/O */ +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) +{ + int len, typesize; + int aio_errno = 0; + static char myname[] = "ADIOI_NFS_IWRITECONTIG"; + + MPI_Type_size(datatype, &typesize); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; + aio_errno = ADIOI_NFS_aio(fd, buf, len, offset, 1, request); + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; + + 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; + return; +} +#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. + * + * 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, MPI_Request *request) +{ + int err=-1, fd_sys; + int error_code, this_errno; + + struct aiocb *aiocbp; + ADIOI_AIO_Request *aio_req; + MPI_Status status; + + fd_sys = fd->fd_sys; + + aio_req = (ADIOI_AIO_Request*)ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); + aiocbp = (struct aiocb *) ADIOI_Calloc(sizeof(struct aiocb), 1); + aiocbp->aio_offset = offset; + aiocbp->aio_buf = buf; + aiocbp->aio_nbytes = len; + +#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_WHENCE + aiocbp->aio_whence = SEEK_SET; +#endif +#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; +# 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); + else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); + +#ifndef ROMIO_HAVE_AIO_CALLS_NEED_FILEDES + 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) { + /* exceeded the max. no. of outstanding requests. + complete all previous async. requests and try again. */ + ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + offset, &status, &error_code); + MPIO_Completed_request_create(&fd, len, &error_code, request); + return 0; + } else { + return -this_errno; + } + } + aio_req->aiocbp = aiocbp; + if (ADIOI_GEN_greq_class == 0) { + MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, + ADIOI_GEN_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_GEN_aio_poll_fn, ADIOI_GEN_aio_wait_fn, + &ADIOI_GEN_greq_class); + } + MPIX_Grequest_class_allocate(ADIOI_GEN_greq_class, aio_req, request); + memcpy(&(aio_req->req), request, sizeof(MPI_Request)); + return 0; +} +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_open.c index eda2bf3943..399dc27663 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_open.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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); @@ -34,19 +32,71 @@ void ADIOI_NFS_Open(ADIO_File fd, int *error_code) if (fd->access_mode & ADIO_EXCL) amode = amode | O_EXCL; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); +#endif fd->fd_sys = open(fd->filename, amode, perm); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); +#endif + fd->fd_direct = -1; - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) + if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } -#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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_rdcoll.c deleted file mode 100644 index 7613163af5..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_rdcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_read.c index a239fecfa1..b64b590093 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_read.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_read.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -14,55 +13,119 @@ 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; if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) + if (fd->fp_sys_posn != offset) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->fd_sys, offset, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } if (fd->atomicity) ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif err = read(fd->fd_sys, buf, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif ADIOI_UNLOCK(fd, offset, SEEK_SET, len); fd->fp_sys_posn = offset + err; /* individual file pointer not updated */ } else { /* read from curr. location of ind. file pointer */ offset = fd->fp_ind; - if (fd->fp_sys_posn != fd->fp_ind) + if (fd->fp_sys_posn != fd->fp_ind) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } if (fd->atomicity) ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); else ADIOI_READ_LOCK(fd, offset, SEEK_SET, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif err = read(fd->fd_sys, buf, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif ADIOI_UNLOCK(fd, offset, SEEK_SET, len); fd->fp_ind += err; fd->fp_sys_posn = fd->fp_ind; } -#ifdef HAVE_STATUS_SET_BYTES - 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 + /* --BEGIN ERROR HANDLING-- */ 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)); + return; } - else *error_code = MPI_SUCCESS; + /* --END ERROR HANDLING-- */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, err); #endif + + *error_code = MPI_SUCCESS; } +#ifdef ADIOI_MPE_LOGGING +#define ADIOI_BUFFERED_READ \ +{ \ + if (req_off >= readbuf_off + readbuf_len) { \ + readbuf_off = req_off; \ + readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\ + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ + lseek(fd->fd_sys, readbuf_off, SEEK_SET);\ + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len);\ + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); \ + err = read(fd->fd_sys, readbuf, readbuf_len);\ + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len);\ + if (err == -1) err_flag = 1; \ + } \ + while (req_len > readbuf_off + readbuf_len - req_off) { \ + partial_read = (int) (readbuf_off + readbuf_len - req_off); \ + tmp_buf = (char *) ADIOI_Malloc(partial_read); \ + memcpy(tmp_buf, readbuf+readbuf_len-partial_read, partial_read); \ + ADIOI_Free(readbuf); \ + readbuf = (char *) ADIOI_Malloc(partial_read + max_bufsize); \ + memcpy(readbuf, tmp_buf, partial_read); \ + ADIOI_Free(tmp_buf); \ + readbuf_off += readbuf_len-partial_read; \ + readbuf_len = (int) (partial_read + ADIOI_MIN(max_bufsize, \ + end_offset-readbuf_off+1)); \ + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ + lseek(fd->fd_sys, readbuf_off+partial_read, SEEK_SET);\ + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ + if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read);\ + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); \ + err = read(fd->fd_sys, readbuf+partial_read, readbuf_len-partial_read);\ + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read);\ + if (err == -1) err_flag = 1; \ + } \ + memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ +} +#else #define ADIOI_BUFFERED_READ \ { \ if (req_off >= readbuf_off + readbuf_len) { \ @@ -93,6 +156,7 @@ void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count, } \ memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ } +#endif void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, @@ -113,11 +177,10 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, ADIO_Offset userbuf_off; ADIO_Offset off, req_off, disp, end_offset=0, readbuf_off, start_off; char *readbuf, *tmp_buf, *value; - int flag, st_frd_size, st_n_filetypes, readbuf_len; + int 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); @@ -138,7 +201,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, /* get max_bufsize from the info object. */ value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, + ADIOI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); max_bufsize = atoi(value); ADIOI_Free(value); @@ -164,9 +227,21 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, if (fd->atomicity) ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->fd_sys, readbuf_off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif err = read(fd->fd_sys, readbuf, readbuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len); if (err == -1) err_flag = 1; @@ -186,16 +261,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 */ @@ -206,25 +278,32 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, disp = fd->disp; if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; icount; i++) { - if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + flat_file->blocklens[i] - >= offset) { - st_index = i; - frd_size = (int) (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - offset); - flag = 1; - break; - } - } - } - } + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset)n_filetypes * filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i=0; icount; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* frd_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + frd_size = flat_file->blocklens[i]; + break; + } + if (dist > 0 ) { + frd_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; + } else { n_etypes_in_filetype = filetype_size/etype_size; n_filetypes = (int) (offset / n_etypes_in_filetype); @@ -244,11 +323,42 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, } /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; + offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + + abs_off_in_filetype; } start_off = offset; + /* Wei-keng Liao: read request is within a single flat_file contig + * block e.g. with subarray types that actually describe the whole + * array */ + if (buftype_is_contig && bufsize <= frd_size) { + ADIO_ReadContig(fd, buf, bufsize, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte that + * can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == frd_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + n_filetypes*filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + return; + } + /* Calculate end_offset, the last byte-offset that will be accessed. e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ @@ -261,11 +371,11 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, while (i < bufsize) { i += frd_size; end_offset = off + frd_size - 1; - - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; } off = disp + flat_file->indices[j] + (ADIO_Offset) n_filetypes*filetype_extent; @@ -281,9 +391,21 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, readbuf = (char *) ADIOI_Malloc(max_bufsize); readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->fd_sys, offset, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, offset, SEEK_SET, readbuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif err = read(fd->fd_sys, readbuf, readbuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif if (!(fd->atomicity)) ADIOI_UNLOCK(fd, offset, SEEK_SET, readbuf_len); if (err == -1) err_flag = 1; @@ -318,11 +440,12 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, /* did not reach end of contiguous block in filetype. no more I/O needed. off is incremented by frd_size. */ else { - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } off = disp + flat_file->indices[j] + (ADIO_Offset) n_filetypes*filetype_extent; frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); @@ -361,12 +484,12 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count, if (size == frd_size) { /* reached end of contiguous block in file */ - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } off = disp + flat_file->indices[j] + (ADIO_Offset) n_filetypes*filetype_extent; @@ -403,16 +526,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. */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_resize.c index fca3787c9d..99ede411b4 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_resize.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_resize.c @@ -1,29 +1,37 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * - * Copyright (C) 1997 University of Chicago. + * Copyright (C) 2004 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "ad_nfs.h" +#ifdef HAVE_UNISTD_H +#include +#endif + +/* NFS resize + * + * Note: we resize on all processors to guarantee that all processors + * will have updated cache values. This used to be the generic + * implementation used by the majority of the ADIO implementations. + */ 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 - + static char myname[] = "ADIOI_GEN_RESIZE"; + err = ftruncate(fd->fd_sys, size); -#ifdef PRINT_ERR_MSG - *error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; -#else + + /* --BEGIN ERROR HANDLING-- */ 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)); + return; } - else *error_code = MPI_SUCCESS; -#endif + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_seek.c deleted file mode 100644 index b2add496ca..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_seek.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_setsh.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_setsh.c index 76da35c5d3..a0beff77da 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_setsh.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_setsh.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -11,38 +10,65 @@ /* 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, MPI_INFO_NULL, + ADIO_PERM_NULL, error_code); } if (*error_code != MPI_SUCCESS) return; ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif err = write(fd->shared_fp_fd->fd_sys, &offset, sizeof(ADIO_Offset)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif 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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wait.c dissimilarity index 92% index 0d127d7430..0148f63973 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wait.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wait.c @@ -1,175 +1,20 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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) -{ -#ifndef NO_AIO -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_NFS_READCOMPLETE"; -#endif -#ifdef AIO_SUN - aio_result_t *result=0, *tmp; -#else - int err; -#endif -#ifdef AIO_HANDLE_IN_AIOCB - struct aiocb *tmp1; -#endif -#endif - - if (*request == ADIO_REQUEST_NULL) { - *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 */ - if ((*request)->queued) { - do { - err = aio_suspend(1, (struct aiocb **) &((*request)->handle)); - } while ((err == -1) && (errno == EINTR)); - - tmp1 = (struct aiocb *) (*request)->handle; - if (err != -1) { - err = aio_return(tmp1->aio_handle); - (*request)->nbytes = err; - errno = aio_error(tmp1->aio_handle); - } - else (*request)->nbytes = -1; - -/* on DEC, it is required to call aio_return to dequeue the request. - 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - else *error_code = MPI_SUCCESS; - -#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 */ - if ((*request)->queued) { - do { - err = aio_suspend((const struct aiocb **) &((*request)->handle), 1, 0); - } while ((err == -1) && (errno == EINTR)); - - if (err != -1) { - err = aio_return((struct aiocb *) (*request)->handle); - (*request)->nbytes = err; - errno = aio_error((struct aiocb *) (*request)->handle); - } - 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - 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 - -#ifndef NO_AIO - 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 - will call MPI_Wait later, which would require status to - be filled. Ugly but works. queued = -1 should be used only - in ADIOI_Complete_async. - This should not affect the user in any way. */ - - /* 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) ADIOI_Free((*request)->handle); - ADIOI_Free_request((ADIOI_Req_node *) (*request)); - *request = ADIO_REQUEST_NULL; - } - -#else -/* HP, FreeBSD, Linux */ - -#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; -#endif -} - - -void ADIOI_NFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - ADIOI_NFS_ReadComplete(request, status, error_code); -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * 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) +{ + return; +} + + +void ADIOI_NFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, + int *error_code) +{ + ADIOI_NFS_ReadComplete(request, status, error_code); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wrcoll.c deleted file mode 100644 index ae57ed5e88..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_wrcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_write.c index 6e3e26403a..68bae91e46 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_write.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_nfs/ad_nfs_write.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -14,74 +13,115 @@ 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; if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) + if (fd->fp_sys_posn != offset) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->fd_sys, offset, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif err = write(fd->fd_sys, buf, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif ADIOI_UNLOCK(fd, offset, SEEK_SET, len); fd->fp_sys_posn = offset + err; /* individual file pointer not updated */ } else { /* write from curr. location of ind. file pointer */ offset = fd->fp_ind; - if (fd->fp_sys_posn != fd->fp_ind) + if (fd->fp_sys_posn != fd->fp_ind) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif err = write(fd->fd_sys, buf, len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif ADIOI_UNLOCK(fd, offset, SEEK_SET, len); fd->fp_ind += err; fd->fp_sys_posn = fd->fp_ind; } -#ifdef HAVE_STATUS_SET_BYTES - 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 + /* --BEGIN ERROR HANDLING-- */ 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)); + return; } - else *error_code = MPI_SUCCESS; + /* --END ERROR HANDLING-- */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, err); #endif + + *error_code = MPI_SUCCESS; } +#ifdef ADIOI_MPE_LOGGING #define ADIOI_BUFFERED_WRITE \ { \ if (req_off >= writebuf_off + writebuf_len) { \ + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); \ err = write(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); \ if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ if (err == -1) err_flag = 1; \ writebuf_off = req_off; \ writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); \ err = read(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); \ 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)); \ memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ while (write_sz != req_len) { \ + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); \ err = write(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); \ if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ if (err == -1) err_flag = 1; \ req_len -= write_sz; \ @@ -89,26 +129,84 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, void *buf, int count, writebuf_off += writebuf_len; \ writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); \ err = read(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); \ 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);\ } \ } - +#else +#define ADIOI_BUFFERED_WRITE \ +{ \ + if (req_off >= writebuf_off + writebuf_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + writebuf_off = req_off; \ + writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = read(fd->fd_sys, writebuf, writebuf_len); \ + if (err == -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)); \ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ + while (write_sz != req_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + err = read(fd->fd_sys, writebuf, writebuf_len); \ + if (err == -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);\ + } \ +} +#endif /* this macro is used when filetype is contig and buftype is not contig. it does not do a read-modify-write and does not lock*/ +#ifdef ADIOI_MPE_LOGGING #define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ { \ if (req_off >= writebuf_off + writebuf_len) { \ + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); \ err = write(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); \ if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ if (err == -1) err_flag = 1; \ writebuf_off = req_off; \ @@ -117,9 +215,13 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, void *buf, int count, write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ while (write_sz != req_len) { \ + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \ lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \ if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); \ err = write(fd->fd_sys, writebuf, writebuf_len); \ + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); \ if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ if (err == -1) err_flag = 1; \ req_len -= write_sz; \ @@ -130,7 +232,35 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, void *buf, int count, memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ } \ } - +#else +#define ADIOI_BUFFERED_WRITE_WITHOUT_READ \ +{ \ + if (req_off >= writebuf_off + writebuf_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + writebuf_off = req_off; \ + writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + } \ + write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ + while (write_sz != req_len) { \ + lseek(fd->fd_sys, writebuf_off, SEEK_SET); \ + if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + err = write(fd->fd_sys, writebuf, writebuf_len); \ + if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ + if (err == -1) err_flag = 1; \ + req_len -= write_sz; \ + userbuf_off += write_sz; \ + writebuf_off += writebuf_len; \ + writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + write_sz = ADIOI_MIN(req_len, writebuf_len); \ + memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ + } \ +} +#endif void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, @@ -151,11 +281,9 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, ADIO_Offset userbuf_off; ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off; char *writebuf, *value; - int flag, st_fwr_size, st_n_filetypes, writebuf_len, write_sz; + int 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); @@ -176,7 +304,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, /* get max_bufsize from the info object. */ value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(fd->info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, + ADIOI_Info_get(fd->info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); max_bufsize = atoi(value); ADIOI_Free(value); @@ -212,9 +340,21 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, } /* write the buffer out finally */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->fd_sys, writebuf_off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif err = write(fd->fd_sys, writebuf, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); if (err == -1) err_flag = 1; @@ -224,16 +364,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 */ @@ -244,25 +381,32 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, disp = fd->disp; if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; icount; i++) { - if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + flat_file->blocklens[i] - >= offset) { - st_index = i; - fwr_size = (int) (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - offset); - flag = 1; - break; - } - } - } - } + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset)n_filetypes * filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i=0; icount; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* fwr_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + fwr_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + fwr_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; + } else { n_etypes_in_filetype = filetype_size/etype_size; n_filetypes = (int) (offset / n_etypes_in_filetype); @@ -282,10 +426,40 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, } /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; + offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + + abs_off_in_filetype; } start_off = offset; + /* Wei-keng Liao:write request is within single flat_file contig block*/ + /* this could happen, for example, with subarray types that are + * actually fairly contiguous */ + if (buftype_is_contig && bufsize <= fwr_size) { + ADIO_WriteContig(fd, buf, bufsize, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte + * that can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == fwr_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + (ADIO_Offset)n_filetypes*filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + return; + } /* Calculate end_offset, the last byte-offset that will be accessed. e.g., if start_offset=0 and 100 bytes to be write, end_offset=99*/ @@ -299,14 +473,15 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, while (i < bufsize) { i += fwr_size; end_offset = off + fwr_size - 1; - - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; } - off = disp + flat_file->indices[j] + (ADIO_Offset) n_filetypes*filetype_extent; + off = disp + flat_file->indices[j] + + (ADIO_Offset) n_filetypes*filetype_extent; fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); } @@ -319,11 +494,27 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, writebuf = (char *) ADIOI_Malloc(max_bufsize); writebuf_len = (int)(ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1)); if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->fd_sys, writebuf_off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif err = read(fd->fd_sys, writebuf, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif 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) { @@ -356,13 +547,14 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, /* did not reach end of contiguous block in filetype. no more I/O needed. off is incremented by fwr_size. */ else { - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; + (ADIO_Offset) n_filetypes*filetype_extent; fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); } } @@ -399,10 +591,11 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, if (size == fwr_size) { /* reached end of contiguous block in file */ - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; } off = disp + flat_file->indices[j] + @@ -435,9 +628,21 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count, } /* write the buffer out finally */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif lseek(fd->fd_sys, writebuf_off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif err = write(fd->fd_sys, writebuf, writebuf_len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); @@ -448,16 +653,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. */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/.state-cache new file mode 100644 index 0000000000..7fd6413ecd --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/.state-cache @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.c index 99f4e2beea..c49f2e86eb 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.c @@ -12,11 +12,12 @@ struct ADIOI_Fns_struct ADIO_NTFS_operations = { ADIOI_NTFS_Open, /* Open */ + ADIOI_GEN_OpenColl, /* OpenColl */ ADIOI_NTFS_ReadContig, /* ReadContig */ 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,9 +29,10 @@ 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 */ + ADIOI_GEN_Feature /* Features */ }; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.h index 3ddecc0949..836d1401ed 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs.h @@ -26,4 +26,43 @@ 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); + +#define FORMAT_MESSAGE_MIN_SIZE 100 +#define ADIOI_NTFS_ERR_MSG_MAX FORMAT_MESSAGE_MIN_SIZE +void ADIOI_NTFS_Strerror(int error, char *errMsg, int errMsgLen); + #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_close.c dissimilarity index 63% index c2a3821f3c..37994b852b 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_close.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_close.c @@ -1,29 +1,30 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_Close(ADIO_File fd, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_NTFS_CLOSE"; -#endif - - 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); - } - else *error_code = MPI_SUCCESS; -#endif -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_ntfs.h" + +void ADIOI_NTFS_Close(ADIO_File fd, int *error_code) +{ + int err; + static char myname[] = "ADIOI_NTFS_Close"; + + err = CloseHandle(fd->fd_sys); + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + return; + } + /* --END ERROR HANDLING-- */ + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_done.c dissimilarity index 84% index 0e7a4784cc..ab2bbb7c21 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_done.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_done.c @@ -1,82 +1,20 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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) -{ - 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; - } - - if ((*request)->queued) - { - (*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; - *error_code = MPI_SUCCESS; - } -#ifdef HAVE_STATUS_SET_BYTES - if (done && ((*request)->nbytes != -1)) - 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; - } - return done; -} - - -int ADIOI_NTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - return ADIOI_NTFS_ReadDone(request, status, error_code); -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_ntfs.h" + +int ADIOI_NTFS_ReadDone(ADIO_Request *request, ADIO_Status *status, + int *error_code) +{ + return 0; +} + + +int ADIOI_NTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, + int *error_code) +{ + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_fcntl.c dissimilarity index 88% index be119dd93f..5841475bd0 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_fcntl.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_fcntl.c @@ -1,191 +1,76 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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 - 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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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; icount; 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 = 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); - } -#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; -#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 = 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 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; ifp_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; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - //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); - } -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#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 err; + LONG dwTemp; + static char myname[] = "ADIOI_NTFS_FCNTL"; + + 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); + if (SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_sys_posn), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + if (err != NO_ERROR) + { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + return; + } + } + } + /* --BEGIN ERROR HANDLING-- */ + if (fcntl_struct->fsize == INVALID_SET_FILE_POINTER) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + dwTemp = GetLastError(); + ADIOI_NTFS_Strerror(dwTemp, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", errMsg); + return; + } + /* --END ERROR HANDLING-- */ + *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: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + /* + fd->atomicity = 0; + *error_code = MPI_ERR_UNSUPPORTED_OPERATION; + */ + break; + + default: + /* --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-- */ + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_flush.c dissimilarity index 66% index 986a753c16..ecabf1d5a9 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_flush.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_flush.c @@ -1,30 +1,32 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -void ADIOI_NTFS_Flush(ADIO_File fd, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_GEN_FLUSH"; -#endif - - 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); - } - else *error_code = MPI_SUCCESS; -#endif -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_ntfs.h" + +void ADIOI_NTFS_Flush(ADIO_File fd, int *error_code) +{ + int err; + static char myname[] = "ADIOI_NTFS_Flush"; + + err = (fd->access_mode & ADIO_RDONLY) ? TRUE : + FlushFileBuffers(fd->fd_sys); + + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + return; + } + /* --END ERROR HANDLING-- */ + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_hints.c deleted file mode 100644 index 7f28ae1001..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_hints.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iread.c dissimilarity index 78% index 5a2a3b0149..174f6447cb 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iread.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iread.c @@ -1,87 +1,42 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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, - 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_IREADCONTIG"; -#endif - - (*request) = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_READ; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size(datatype, &typesize); - len = count * typesize; - - 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; - - (*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); - } - else *error_code = MPI_SUCCESS; -#endif - - 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 -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_ntfs.h" + +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 len, typesize; + int err; + static char myname[] = "ADIOI_NTFS_IreadContig"; + + MPI_Type_size(datatype, &typesize); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) + { + offset = fd->fp_ind; + } + err = ADIOI_NTFS_aio(fd, buf, len, offset, 0, request); + if (file_ptr_type == ADIO_INDIVIDUAL) + { + fd->fp_ind += len; + } + + /* --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; + } + /* --END ERROR HANDLING-- */ + *error_code = MPI_SUCCESS; + + fd->fp_sys_posn = -1; /* set it to null. */ +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iwrite.c dissimilarity index 83% index 5f505e3ea0..b43e1a9a75 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iwrite.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_iwrite.c @@ -1,141 +1,303 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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) -{ - int len, typesize; - int err=FALSE; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_NTFS_IWRITECONTIG"; -#endif - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size(datatype, &typesize); - len = count * typesize; - - 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; - - (*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); - } - else *error_code = MPI_SUCCESS; -#endif - - 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. */ - -int ADIOI_NTFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, void *handle) -{ - DWORD dwNumWritten=0, dwNumRead=0; - BOOL ret_val = FALSE; - FDTYPE fd_sys; - - OVERLAPPED *pOvl; - - 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 (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 (ret_val == FALSE) - { - 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; - } - - *((OVERLAPPED **) handle) = pOvl; - - return ret_val; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_ntfs.h" + +#include "../../mpi-io/mpioimpl.h" +#include "../../mpi-io/mpioprof.h" +#include "mpiu_greq.h" + +static MPIX_Grequest_class ADIOI_NTFS_greq_class = 0; + +/* Fills the input buffer, errMsg, with the error message + corresponding to error code, error */ +void ADIOI_NTFS_Strerror(int error, char *errMsg, int errMsgLen) +{ + LPTSTR str; + int num_bytes; + num_bytes = FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, + error, + 0, + &str, + FORMAT_MESSAGE_MIN_SIZE, + 0); + if (num_bytes == 0) + { + strncpy(errMsg, "\0", errMsgLen); + } + else + { + strncpy(errMsg, str, errMsgLen); + LocalFree(str); + } +} + +/* poll for completion of a single outstanding AIO request */ +int ADIOI_NTFS_aio_poll_fn(void *extra_state, MPI_Status *status) +{ + ADIOI_AIO_Request *aio_req; + int mpi_errno = MPI_SUCCESS; + + /* FIXME: Validate the args -- has it already been done by the + caller ? */ + + aio_req = (ADIOI_AIO_Request *)extra_state; + + /* XXX: test for AIO completion here */ + if(!GetOverlappedResult( aio_req->fd, aio_req->lpOvl, + &(aio_req->nbytes), FALSE)){ + if(GetLastError() == ERROR_IO_INCOMPLETE){ + /* IO in progress */ + /* TODO: need to diddle with status somehow */ + }else{ + /* Error occured */ + /* TODO: unsure how to handle this */ + } + }else{ + mpi_errno = MPI_Grequest_complete(aio_req->req); + if (mpi_errno != MPI_SUCCESS) { + mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + "ADIOI_NTFS_aio_poll_fn", __LINE__, + MPI_ERR_IO, "**mpi_grequest_complete", + 0); + } + } + return mpi_errno; +} + + +/* Wait for completion of one of the outstanding AIO requests */ +int ADIOI_NTFS_aio_wait_fn(int count, void **array_of_states, + double timeout, MPI_Status *status) +{ + int i, mpi_errno = MPI_SUCCESS; + ADIOI_AIO_Request **aio_reqlist; + LPHANDLE lpHandles; + DWORD retObject=0; + + /* FIXME: Validate the args -- has it already been done by the + caller ? */ + aio_reqlist = (ADIOI_AIO_Request **)array_of_states; + lpHandles = (LPHANDLE) ADIOI_Calloc(count, sizeof(HANDLE)); + if (lpHandles == NULL) + { + mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + "ADIOI_NTFS_aio_wait_fn", __LINE__, MPI_ERR_IO, + "**nomem", "**nomem %s", "Event handles"); + return mpi_errno; + } + /* XXX: set-up arrays of outstanding requests */ + for(i=0; ilpOvl->hEvent; + } + + /* XXX: wait for one request to complete */ + /* FIXME: Is the timeout in seconds ? */ + timeout = (timeout <= 0) ? INFINITE : (timeout * 1000); + + if((retObject = WaitForMultipleObjects(count, lpHandles, + FALSE, timeout)) != WAIT_FAILED){ + retObject = retObject - WAIT_OBJECT_0; + if(GetOverlappedResult( aio_reqlist[retObject]->fd, + aio_reqlist[retObject]->lpOvl, &(aio_reqlist[retObject]->nbytes), + FALSE)){ + /* XXX: mark completed requests as 'done'*/ + mpi_errno = MPI_Grequest_complete(aio_reqlist[retObject]->req); + if (mpi_errno != MPI_SUCCESS) { + mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + "ADIOI_NTFS_aio_wait_fn", __LINE__, + MPI_ERR_IO, "**mpi_grequest_complete", + 0); + } + }else{ + if(GetLastError() == ERROR_IO_INCOMPLETE){ + /* IO in progress */ + /* TODO: need to diddle with status somehow */ + }else{ + /* Error occured */ + /* TODO: not sure how to handle this */ + } + } + }else{ + /* TODO: How to handle error while waiting ? */ + } + ADIOI_Free(lpHandles); + return mpi_errno; +} + +int ADIOI_NTFS_aio_query_fn(void *extra_state, MPI_Status *status) +{ + ADIOI_AIO_Request *aio_req; + + aio_req = (ADIOI_AIO_Request *)extra_state; + + + MPI_Status_set_elements(status, MPI_BYTE, aio_req->nbytes); + + /* can never cancel so always true */ + MPI_Status_set_cancelled(status, 0); + + /* choose not to return a value for this */ + status->MPI_SOURCE = MPI_UNDEFINED; + /* tag has no meaning for this generalized request */ + status->MPI_TAG = MPI_UNDEFINED; + /* this generalized request never fails */ + return MPI_SUCCESS; +} + + +int ADIOI_NTFS_aio_free_fn(void *extra_state) +{ + ADIOI_AIO_Request *aio_req; + /* FIXME: Validate the args -- has it already been done by the + caller ? */ + aio_req = (ADIOI_AIO_Request*)extra_state; + CloseHandle(aio_req->lpOvl->hEvent); + ADIOI_Free(aio_req->lpOvl); + ADIOI_Free(aio_req); + return MPI_SUCCESS; +} + +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) +{ + int len, typesize; + int err; + static char myname[] = "ADIOI_NTFS_IwriteContig"; + + MPI_Type_size(datatype, &typesize); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) + { + offset = fd->fp_ind; + } + err = ADIOI_NTFS_aio(fd, buf, len, offset, 1, request); + if (file_ptr_type == ADIO_INDIVIDUAL) + { + fd->fp_ind += len; + } + + /* --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; + } + /* --END ERROR HANDLING-- */ + *error_code = MPI_SUCCESS; + + fd->fp_sys_posn = -1; /* set it to null. */ +} + + +/* This function is for implementation convenience. It is not user-visible. + * 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, MPI_Request *request) +{ + static char myname[] = "ADIOI_NTFS_aio"; + + ADIOI_AIO_Request *aio_req; + static DWORD dwNumWritten, dwNumRead; + BOOL ret_val = FALSE; + FDTYPE fd_sys; + int mpi_errno = MPI_SUCCESS; + DWORD err; + + fd_sys = fd->fd_sys; + + aio_req = (ADIOI_AIO_Request *)ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); + if (aio_req == NULL) + { + mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**nomem", "**nomem %s", "AIO_REQ"); + return mpi_errno; + } + aio_req->lpOvl = (LPOVERLAPPED ) ADIOI_Calloc(sizeof(OVERLAPPED), 1); + if (aio_req->lpOvl == NULL) + { + mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**nomem", "**nomem %s", "OVERLAPPED"); + ADIOI_Free(aio_req); + return mpi_errno; + } + aio_req->lpOvl->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + if (aio_req->lpOvl->hEvent == NULL) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + ADIOI_Free(aio_req->lpOvl); + ADIOI_Free(aio_req); + return mpi_errno; + } + aio_req->lpOvl->Offset = DWORDLOW(offset); + aio_req->lpOvl->OffsetHigh = DWORDHIGH(offset); + aio_req->fd = fd_sys; + + /* XXX: initiate async I/O */ + if (wr) + { + ret_val = WriteFile(fd_sys, buf, len, &dwNumWritten, aio_req->lpOvl); + } + else + { + ret_val = ReadFile(fd_sys, buf, len, &dwNumRead, aio_req->lpOvl); + } + + /* --BEGIN ERROR HANDLING-- */ + if (ret_val == FALSE) + { + mpi_errno = GetLastError(); + if (mpi_errno != ERROR_IO_PENDING) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + ADIOI_NTFS_Strerror(mpi_errno, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + mpi_errno = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + return mpi_errno; + } + mpi_errno = MPI_SUCCESS; + } + /* --END ERROR HANDLING-- */ + + /* XXX: set up generalized request class and request */ + if (ADIOI_NTFS_greq_class == 0) { + mpi_errno = MPIX_Grequest_class_create(ADIOI_NTFS_aio_query_fn, + ADIOI_NTFS_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_NTFS_aio_poll_fn, ADIOI_NTFS_aio_wait_fn, + &ADIOI_NTFS_greq_class); + if(mpi_errno != MPI_SUCCESS){ + /* FIXME: Pass appropriate error code to user */ + } + } + mpi_errno = MPIX_Grequest_class_allocate(ADIOI_NTFS_greq_class, aio_req, request); + if(mpi_errno != MPI_SUCCESS){ + /* FIXME: Pass appropriate error code to user */ + } + memcpy(&(aio_req->req), request, sizeof(MPI_Request)); + return mpi_errno; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_open.c dissimilarity index 79% index 98c56f4e52..1f1db067f4 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_open.c @@ -1,118 +1,101 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * - * - * 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_Open(ADIO_File fd, int *error_code) -{ - int cmode, amode, smode; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_NTFS_OPEN"; -#endif - - amode = 0; - cmode = OPEN_EXISTING; - smode = 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; - smode = smode | GENERIC_READ; - } - if (fd->access_mode & ADIO_WRONLY) - { - amode = amode | FILE_SHARE_WRITE; - smode = smode | GENERIC_WRITE; - } - if (fd->access_mode & ADIO_RDWR) - { - amode = amode | FILE_SHARE_READ | FILE_SHARE_WRITE; - smode = smode | GENERIC_READ | GENERIC_WRITE; - } - - fd->fd_sys = CreateFile( - fd->filename, - //smode, - 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; - 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); - } - 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); - } - else *error_code = MPI_SUCCESS; -#endif -} -*/ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_ntfs.h" + +void ADIOI_NTFS_Open(ADIO_File fd, int *error_code) +{ + int err; + int cmode, amode, attrib; + static char myname[] = "ADIOI_NTFS_Open"; + + amode = 0; + cmode = OPEN_EXISTING; +#ifdef USE_WIN_THREADED_IO + attrib = FILE_FLAG_OVERLAPPED; +#else + attrib = FILE_ATTRIBUTE_NORMAL; +#endif + + if (fd->access_mode & ADIO_CREATE) + { + cmode = OPEN_ALWAYS; + } + if (fd->access_mode & ADIO_EXCL) + { + cmode = CREATE_NEW; + } + + if (fd->access_mode & ADIO_RDONLY) + { + amode = GENERIC_READ; + } + if (fd->access_mode & ADIO_WRONLY) + { + amode = GENERIC_WRITE; + } + if (fd->access_mode & ADIO_RDWR) + { + amode = GENERIC_READ | GENERIC_WRITE; + } + + 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); + if (fd->fp_ind == INVALID_SET_FILE_POINTER) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + if (err != NO_ERROR) + { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + return; + } + } + } + + /* --BEGIN ERROR HANDLING-- */ + if (fd->fd_sys == INVALID_HANDLE_VALUE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + return; + } + /* --END ERROR HANDLING-- */ + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_rdcoll.c deleted file mode 100644 index 3595d6935b..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_rdcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_read.c dissimilarity index 72% index 13d275bcdb..3a22cad781 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_read.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_read.c @@ -1,82 +1,258 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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) -{ - //int rank; - DWORD dwTemp; - DWORD dwNumRead = 0; - int err=-1, datatype_size, len; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_NTFS_READCONTIG"; -#endif - - MPI_Type_size(datatype, &datatype_size); - len = datatype_size * count; - - 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); - } - 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); - fd->fp_sys_posn = offset + (ADIO_Offset)dwNumRead; - /* individual file pointer not updated */ - } - 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); - } - 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); - 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); - } - 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); -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#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) +{ + LONG dwTemp; + DWORD dwNumRead = 0; + int err=-1, datatype_size, len; + static char myname[] = "ADIOI_NTFS_ReadContig"; + OVERLAPPED *pOvl; + + /* If file pointer is of type ADIO_INDIVIDUAL ignore the offset + and use the current location of file pointer */ + if(file_ptr_type == ADIO_INDIVIDUAL){ + offset = fd->fp_ind; + } + + MPI_Type_size(datatype, &datatype_size); + len = datatype_size * count; + + 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) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + 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); + if (SetFilePointer(fd->fd_sys, DWORDLOW(offset), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + if (err != NO_ERROR) + { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + } + /* + { + ADIO_Fcntl_t fcntl_struct; + int error_code; + ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, &fcntl_struct, &error_code); + printf("File size b: %d\n", fcntl_struct.fsize); + } + printf("ReadFile(%d bytes)\n", len);fflush(stdout); + */ + err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, pOvl); + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + switch (err) + { + case ERROR_IO_PENDING: + break; + case ERROR_HANDLE_EOF: + /*printf("EOF error\n");fflush(stdout);*/ + SetEvent(pOvl->hEvent); + break; + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + /* --END ERROR HANDLING-- */ + err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumRead, TRUE); + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + if (err != ERROR_HANDLE_EOF) /* Ignore EOF errors */ + { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + /* --END ERROR HANDLING-- */ + if (!CloseHandle(pOvl->hEvent)) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + 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 */ + if (fd->fp_sys_posn != fd->fp_ind) + { + dwTemp = DWORDHIGH(fd->fp_ind); + if (SetFilePointer(fd->fd_sys, DWORDLOW(fd->fp_ind), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + if (err != NO_ERROR) + { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + } + /* + { + ADIO_Fcntl_t fcntl_struct; + int error_code; + ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, &fcntl_struct, &error_code); + printf("File size c: %d\n", fcntl_struct.fsize); + } + printf("ReadFile(%d bytes)\n", len);fflush(stdout); + */ + err = ReadFile(fd->fd_sys, buf, len, &dwNumRead, pOvl); + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + switch (err) + { + case ERROR_IO_PENDING: + break; + case ERROR_HANDLE_EOF: + /*printf("EOF error\n");fflush(stdout);*/ + SetEvent(pOvl->hEvent); + break; + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + /* --END ERROR HANDLING-- */ + err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumRead, TRUE); + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + if (err != ERROR_HANDLE_EOF) /* Ignore EOF errors */ + { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + /* --END ERROR HANDLING-- */ + if (!CloseHandle(pOvl->hEvent)) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + 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 + + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + return; + } + /* --END ERROR HANDLING-- */ + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_resize.c dissimilarity index 68% index d6b45b7b20..68efa00e9a 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_resize.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_resize.c @@ -1,32 +1,51 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ntfs.h" - -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 - - 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); - } - else *error_code = MPI_SUCCESS; -#endif -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_ntfs.h" + +void ADIOI_NTFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + 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); + /* --BEGIN ERROR HANDLING-- */ + if (err == INVALID_SET_FILE_POINTER) + { + err = GetLastError(); + if (err != NO_ERROR) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + return; + } + } + /*printf("setting file length to %d\n", size);fflush(stdout);*/ + /* --END ERROR HANDLING-- */ + result = SetEndOfFile(fd->fd_sys); + /* --BEGIN ERROR HANDLING-- */ + if (result == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + return; + } + /* --END ERROR HANDLING-- */ + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_seek.c deleted file mode 100644 index a2697771fe..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_seek.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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; icount; 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; -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wait.c dissimilarity index 86% index 1ad42ddc49..20a95cc656 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wait.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wait.c @@ -1,83 +1,20 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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) -{ -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_NTFS_READCOMPLETE"; -#endif - DWORD ret_val; - - if (*request == ADIO_REQUEST_NULL) { - *error_code = MPI_SUCCESS; - return; - } - - 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; - -#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); - } - else *error_code = MPI_SUCCESS; -#endif - } - else *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) { - - /* 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 - will call MPI_Wait later, which would require status to - be filled. Ugly but works. queued = -1 should be used only - in ADIOI_Complete_async. - This should not affect the user in any way. */ - - /* 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; - } - -} - - -void ADIOI_NTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - ADIOI_NTFS_ReadComplete(request, status, error_code); -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * 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) +{ + return; +} + + +void ADIOI_NTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, + int *error_code) +{ + return; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wrcoll.c deleted file mode 100644 index 15b14f39a8..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_wrcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_write.c dissimilarity index 73% index 16e59eff7b..f971e8a525 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_write.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ntfs/ad_ntfs_write.c @@ -1,81 +1,222 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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) -{ - //int rank; - DWORD dwTemp; - DWORD dwNumWritten = 0; - int err=-1, datatype_size, len; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_NTFS_WRITECONTIG"; -#endif - - MPI_Type_size(datatype, &datatype_size); - len = datatype_size * count; - - 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); - } - 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); - fd->fp_sys_posn = offset + dwNumWritten; - /* individual file pointer not updated */ - } - 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); - } - 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); - 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); - } - 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); -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#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) +{ + static char myname[] = "ADIOI_NTFS_WriteContig"; + LONG dwTemp; + DWORD dwNumWritten = 0; + int err=-1, datatype_size, len; + OVERLAPPED *pOvl; + + /* If file pointer type in ADIO_INDIVIDUAL then offset should be + ignored and the current location of file pointer should be used */ + if(file_ptr_type == ADIO_INDIVIDUAL){ + offset = fd->fp_ind; + } + + MPI_Type_size(datatype, &datatype_size); + len = datatype_size * count; + + 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) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + 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); + if (SetFilePointer(fd->fd_sys, DWORDLOW(offset), &dwTemp, FILE_BEGIN) == INVALID_SET_FILE_POINTER) + { + err = GetLastError(); + if (err != NO_ERROR) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + } + /*printf("WriteFile(%d bytes)\n", len);fflush(stdout);*/ + err = WriteFile(fd->fd_sys, buf, len, &dwNumWritten, pOvl); + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + err = GetLastError(); + if (err != ERROR_IO_PENDING) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + /* --END ERROR HANDLING-- */ + err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumWritten, TRUE); + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + /* --END ERROR HANDLING-- */ + if (!CloseHandle(pOvl->hEvent)) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + 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 */ + if (fd->fp_sys_posn != fd->fp_ind) + { + 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) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + } + /*printf("WriteFile(%d bytes)\n", len);fflush(stdout);*/ + err = WriteFile(fd->fd_sys, buf, len, &dwNumWritten, pOvl); + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + err = GetLastError(); + if (err != ERROR_IO_PENDING) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + } + /* --END ERROR HANDLING-- */ + err = GetOverlappedResult(fd->fd_sys, pOvl, &dwNumWritten, TRUE); + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, "**io", + "**io %s", errMsg); + CloseHandle(pOvl->hEvent); + ADIOI_Free(pOvl); + return; + } + /* --END ERROR HANDLING-- */ + if (!CloseHandle(pOvl->hEvent)) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", "**io %s", errMsg); + 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 + + /* --BEGIN ERROR HANDLING-- */ + if (err == FALSE) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + err = GetLastError(); + ADIOI_NTFS_Strerror(err, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", errMsg); + return; + } + /* --END ERROR HANDLING-- */ + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_panfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/.state-cache new file mode 100644 index 0000000000..e1f7866d94 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/.state-cache @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_panfs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/Makefile.in new file mode 100644 index 0000000000..01f7cd294e --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/Makefile.in @@ -0,0 +1,66 @@ +CC = @CC@ +AR = @AR@ +RANLIB = @RANLIB@ +LIBNAME = @LIBNAME@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +CPPFLAGS = @CPPFLAGS@ +# I don't like this hard-coded path to the PANFS headers but I guess that's +# where they always are? +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include -I/opt/panfs/include +CFLAGS = @CFLAGS@ + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +C_COMPILE_SHL = $(CC_SHL) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) + +@VPATH@ + +AD_PANFS_OBJECTS = ad_panfs.o ad_panfs_open.o ad_panfs_hints.o ad_panfs_read.o ad_panfs_resize.o ad_panfs_write.o + + +default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +.c.o: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE) -c $< ; \ + fi + @$(C_COMPILE) -c $< + +.c.lo: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE_SHL) -c $< -o _s$*.o ; \ + echo mv -f _s$*.o $*.lo ; \ + fi + @$(C_COMPILE_SHL) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + + +$(LIBNAME): $(AD_PANFS_OBJECTS) + $(AR) $(LIBNAME) $(AD_PANFS_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_PANFS_LOOBJECTS=$(AD_PANFS_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_PANFS_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_PANFS_LOOBJECTS) + +coverage: + -@for file in ${AD_PANFS_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.c new file mode 100644 index 0000000000..f2e96bbba8 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.c @@ -0,0 +1,44 @@ +/* -*- 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_OpenColl, + ADIOI_PANFS_ReadContig, /* ReadContig */ + ADIOI_PANFS_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 */ +#ifdef ROMIO_HAVE_WORKING_AIO + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + 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_PANFS_Resize, /* Resize */ + ADIOI_GEN_Delete, /* Delete */ + ADIOI_GEN_Feature, +}; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.h new file mode 100644 index 0000000000..97f61ddb3d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs.h @@ -0,0 +1,56 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * ad_panfs.h + * + * Copyright (C) 2001 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#ifndef AD_PANFS_INCLUDE +#define AD_PANFS_INCLUDE + +#include +#include +#include +#include "adio.h" + +#ifndef NO_AIO +#ifdef AIO_SUN +#include +#else +#include +#ifdef NEEDS_ADIOCB_T +typedef struct adiocb adiocb_t; +#endif +#endif +#endif + +void ADIOI_PANFS_Open(ADIO_File fd, int *error_code); +void ADIOI_PANFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +void ADIOI_PANFS_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_PANFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_PANFS_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code); + +/* Delay 1 ms */ +#define AD_PANFS_RETRY_DELAY 1000 + +#define AD_PANFS_RETRY(_op_,_rc_) \ +{ \ + _rc_ = (_op_); \ + while(_rc_ == -1 && errno == EAGAIN) \ + { \ + if(usleep(AD_PANFS_RETRY_DELAY) == -1) \ + { \ + break; \ + } \ + _rc_ = (_op_); \ + } \ +} + +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_hints.c new file mode 100644 index 0000000000..4755a0aa74 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_hints.c @@ -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 + +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)); + + ADIOI_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); + } + ADIOI_Info_set(fd->info, "panfs_concurrent_write", value); + } + + ADIOI_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); + } + ADIOI_Info_set(fd->info, "panfs_layout_type", value); + } + + ADIOI_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); + } + ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", value); + } + + ADIOI_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); + } + ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", value); + } + + ADIOI_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); + } + ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", value); + } + + ADIOI_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); + } + ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", value); + } + + ADIOI_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_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10)) { + 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); + } + ADIOI_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; + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_open.c new file mode 100644 index 0000000000..d1797ed552 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_open.c @@ -0,0 +1,387 @@ +/* -*- 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 +#include +#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; + int myrank; + + MPI_Comm_rank(fd->comm, &myrank); + + *error_code = MPI_SUCCESS; + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); + ADIOI_Info_get(fd->info, "panfs_layout_type", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + layout_type = strtoul(value,NULL,10); + } + ADIOI_Info_get(fd->info, "panfs_layout_stripe_unit", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + layout_stripe_unit = strtoul(value,NULL,10); + } + ADIOI_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); + } + ADIOI_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); + } + ADIOI_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); + } + ADIOI_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__RAID10)) + { + 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__RAID10) + { + if ((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 RAID10 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 RAID10 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); + } + } + /* Create the file via ioctl() or open(). ADIOI_PANFS_Open's caller + * already optimizes performance by only calling this function with + * ADIO_CREATE on rank 0. Therefore, we don't need to worry about + * implementing that optimization here. */ + if((layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID0) || (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE) + || (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10)) { + pan_fs_client_layout_create_args_t file_create_args; + int fd_dir; + char* slash; + struct stat stat_buf; + int err; + char *path; + + /* 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; + } + else if(layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10) + { + file_create_args.layout.u.raid10.total_num_comps = layout_total_num_comps; + file_create_args.layout.u.raid10.stripe_unit = layout_stripe_unit; + file_create_args.layout.u.raid10.layout_visit_policy = layout_visit_policy; + } + 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); + } + } + else + { + int create_fd = open(fd->filename,amode,perm); + if(create_fd != -1) + { + close(create_fd); + } + else + { + FPRINTF(stderr, "%s: I/O Error creating PanFS file using open: %s.\n", myname, strerror(errno)); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } + } + 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)); + ADIOI_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 */ + ADIOI_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); + ADIOI_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); + ADIOI_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); + ADIOI_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); + ADIOI_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); + ADIOI_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); + ADIOI_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); + ADIOI_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); + ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); + break; + case PAN_FS_CLIENT_LAYOUT_TYPE__RAID10: + ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.stripe_unit); + ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer); + ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.total_num_comps); + ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer); + ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.layout_visit_policy); + ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer); + break; + default: + 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; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_read.c new file mode 100644 index 0000000000..dd5635e22d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_read.c @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_panfs.h" + +#ifdef HAVE_UNISTD_H +#include +#endif + +void ADIOI_PANFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + int err = -1, datatype_size, len; + static char myname[] = "ADIOI_PANFS_READCONTIG"; + + MPI_Type_size(datatype, &datatype_size); + len = datatype_size * count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + if (fd->fp_sys_posn != offset) { + err = lseek(fd->fd_sys, offset, SEEK_SET); + /* --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)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + } + + AD_PANFS_RETRY(read(fd->fd_sys, buf, len),err) + /* --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)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + + fd->fp_sys_posn = offset + err; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += err; + } + +#ifdef HAVE_STATUS_SET_BYTES + if (err != -1) MPIR_Status_set_bytes(status, datatype, err); +#endif + + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_resize.c new file mode 100644 index 0000000000..bc566cf574 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_resize.c @@ -0,0 +1,49 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_panfs.h" + +#ifdef HAVE_UNISTD_H +#include +#endif + +void ADIOI_PANFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + int err; + int myrank; + struct stat stat_buf; + static char myname[] = "ADIOI_PANFS_RESIZE"; + + MPI_Comm_rank(fd->comm, &myrank); + if (!myrank) + { + AD_PANFS_RETRY(ftruncate(fd->fd_sys,size),err); + MPI_Barrier(fd->comm); + } + else + { + MPI_Barrier(fd->comm); + AD_PANFS_RETRY(fstat(fd->fd_sys,&stat_buf),err); + if(((ADIO_Offset)stat_buf.st_size) != size) + { + /* This should never happen otherwise there is a coherency problem. */ + FPRINTF(stderr, "%s: Rank %d: Resize failed: requested=%llu actual=%llu.\n",myname,myrank,size,stat_buf.st_size); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } + + /* --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-- */ + + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_write.c new file mode 100644 index 0000000000..2b186b7203 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_panfs/ad_panfs_write.c @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_panfs.h" + +#ifdef HAVE_UNISTD_H +#include +#endif + +void ADIOI_PANFS_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + int err = -1, datatype_size, len; + static char myname[] = "ADIOI_PANFS_WRITECONTIG"; + + MPI_Type_size(datatype, &datatype_size); + len = datatype_size * count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + if (fd->fp_sys_posn != offset) { + err = lseek(fd->fd_sys, offset, SEEK_SET); + /* --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)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + } + + AD_PANFS_RETRY(write(fd->fd_sys, buf, len),err) + /* --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)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + + fd->fp_sys_posn = offset + err; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += err; + } + +#ifdef HAVE_STATUS_SET_BYTES + if (err != -1 && status) MPIR_Status_set_bytes(status, datatype, err); +#endif + + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/.state-cache new file mode 100644 index 0000000000..aa7f481f94 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/.state-cache @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/Makefile.in index c01f4ebff7..c86c464ebd 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/Makefile.in @@ -3,15 +3,15 @@ AR = @AR@ LIBNAME = @LIBNAME@ srcdir = @srcdir@ -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) @VPATH@ -AD_PFS_OBJECTS = ad_pfs_close.o ad_pfs_read.o \ +AD_PFS_OBJECTS = ad_pfs_read.o \ ad_pfs_open.o ad_pfs_write.o ad_pfs_done.o \ ad_pfs_fcntl.o ad_pfs_iread.o ad_pfs_iwrite.o ad_pfs_wait.o \ - ad_pfs_flush.o ad_pfs_seek.o ad_pfs_resize.o ad_pfs_hints.o \ + ad_pfs_flush.o ad_pfs_hints.o \ ad_pfs.o diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.c index 3399aa6221..f5b2262e00 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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 */ }; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.h index 77dde0f711..80d808a0b8 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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 diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_close.c deleted file mode 100644 index d5d337134a..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_close.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_done.c index cca4330657..94c61cd7b4 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_done.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_done.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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); } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_fcntl.c dissimilarity index 63% index 56078b9085..d11d73b671 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_fcntl.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_fcntl.c @@ -1,155 +1,81 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#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) -{ - MPI_Datatype copy_etype, copy_filetype; - int combiner, i, j, k, filetype_is_contig, err; - ADIOI_Flatlist_node *flat_file; - 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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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; icount; 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 - in file size (although the manual says otherwise). Therefore, - temporarily change to M_UNIX and then change - back to M_ASYNC.*/ - MPI_Comm_size(MPI_COMM_WORLD, &np_total); - MPI_Comm_size(fd->comm, &np_comm); - if (np_total == np_comm) { - err = _setiomode(fd->fd_sys, M_UNIX); - err = _setiomode(fd->fd_sys, M_ASYNC); - } - /* else it is M_UNIX anyway, so no problem */ - } - fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); - 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_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); - } - 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: - MPI_Comm_size(MPI_COMM_WORLD, &np_total); - MPI_Comm_size(fd->comm, &np_comm); - if (np_total == np_comm) { - iomod = (fcntl_struct->atomicity == 0) ? M_ASYNC : M_UNIX; - err = _setiomode(fd->fd_sys, iomod); - } - /* else can't do anything because setiomode is global. but - the file will have been opened with M_UNIX anyway, because - 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); - } - else *error_code = MPI_SUCCESS; -#endif - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_PFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#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) +{ + int i, err; + int iomod, np_total, np_comm; + static char myname[] = "ADIOI_PFS_FCNTL"; + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + if (!(fd->atomicity)) { + /* in M_ASYNC mode, all processes are not aware of changes + in file size (although the manual says otherwise). Therefore, + temporarily change to M_UNIX and then change + back to M_ASYNC.*/ + MPI_Comm_size(MPI_COMM_WORLD, &np_total); + MPI_Comm_size(fd->comm, &np_comm); + if (np_total == np_comm) { + err = _setiomode(fd->fd_sys, M_UNIX); + err = _setiomode(fd->fd_sys, M_ASYNC); + } + /* else it is M_UNIX anyway, so no problem */ + } + fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); + 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_DISKSPACE: + err = _lsize(fd->fd_sys, fcntl_struct->diskspace, SEEK_SET); + if (err == -1) { + *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; + break; + + case ADIO_FCNTL_SET_ATOMICITY: + MPI_Comm_size(MPI_COMM_WORLD, &np_total); + MPI_Comm_size(fd->comm, &np_comm); + if (np_total == np_comm) { + iomod = (fcntl_struct->atomicity == 0) ? M_ASYNC : M_UNIX; + err = _setiomode(fd->fd_sys, iomod); + } + /* else can't do anything because setiomode is global. but + the file will have been opened with M_UNIX anyway, because + gopen is also global. */ + + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + if (err == -1) { + /* --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; + break; + + default: + /* --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-- */ + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_flush.c index ad69ee8b5d..57cae24535 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_flush.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_flush.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_hints.c index e62dea2240..5815ca0925 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_hints.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_hints.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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)); @@ -25,40 +24,52 @@ void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) if (users_info != MPI_INFO_NULL) { value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, value, &flag); if (flag) { 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, + ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, value, &flag); if (flag) { 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, + ADIOI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, value, &flag); if (flag) { 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 */ @@ -108,15 +119,15 @@ void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) If so, mark it as true in fd->info and turn it on in ADIOI_PFS_Open after the file is opened */ - MPI_Info_get(users_info, "pfs_svr_buf", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "pfs_svr_buf", MPI_MAX_INFO_VAL, value, &flag); if (flag && (!strcmp(value, "true"))) - MPI_Info_set(fd->info, "pfs_svr_buf", "true"); - else MPI_Info_set(fd->info, "pfs_svr_buf", "false"); + ADIOI_Info_set(fd->info, "pfs_svr_buf", "true"); + else ADIOI_Info_set(fd->info, "pfs_svr_buf", "false"); ADIOI_Free(value); } - else MPI_Info_set(fd->info, "pfs_svr_buf", "false"); + else ADIOI_Info_set(fd->info, "pfs_svr_buf", "false"); /* set the values for collective I/O and data sieving parameters */ ADIOI_GEN_SetInfo(fd, users_info, error_code); @@ -133,23 +144,23 @@ void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) if (users_info != MPI_INFO_NULL) { value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(users_info, "pfs_svr_buf", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "pfs_svr_buf", MPI_MAX_INFO_VAL, value, &flag); if (flag && (!strcmp(value, "true") || !strcmp(value, "false"))) { value_in_fd = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(fd->info, "pfs_svr_buf", MPI_MAX_INFO_VAL, + ADIOI_Info_get(fd->info, "pfs_svr_buf", MPI_MAX_INFO_VAL, value_in_fd, &flag); if (strcmp(value, value_in_fd)) { if (!strcmp(value, "true")) { err = fcntl(fd->fd_sys, F_PFS_SVR_BUF, TRUE); if (!err) - MPI_Info_set(fd->info, "pfs_svr_buf", "true"); + ADIOI_Info_set(fd->info, "pfs_svr_buf", "true"); } else { err = fcntl(fd->fd_sys, F_PFS_SVR_BUF, FALSE); if (!err) - MPI_Info_set(fd->info, "pfs_svr_buf", "false"); + ADIOI_Info_set(fd->info, "pfs_svr_buf", "false"); } } ADIOI_Free(value_in_fd); diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iread.c index 739ac800d1..c181ea8799 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iread.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iread.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iwrite.c index c3ed13ae3e..a3d3f38e10 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iwrite.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_iwrite.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_open.c index fa69239423..c424af07fa 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_open.c @@ -1,24 +1,18 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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_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); @@ -42,15 +36,10 @@ void ADIOI_PFS_Open(ADIO_File fd, int *error_code) MPI_Comm_size(MPI_COMM_WORLD, &np_total); MPI_Comm_size(fd->comm, &np_comm); -#ifdef PROFILE - 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)); @@ -60,25 +49,25 @@ void ADIOI_PFS_Open(ADIO_File fd, int *error_code) to ADIOI_PFS_SetInfo. Turn it on now, since we now have a valid file descriptor. */ - MPI_Info_get(fd->info, "pfs_svr_buf", MPI_MAX_INFO_VAL, + ADIOI_Info_get(fd->info, "pfs_svr_buf", MPI_MAX_INFO_VAL, value, &flag); if (flag && (!strcmp(value, "true"))) { err = fcntl(fd->fd_sys, F_PFS_SVR_BUF, TRUE); - if (err) MPI_Info_set(fd->info, "pfs_svr_buf", "false"); + if (err) ADIOI_Info_set(fd->info, "pfs_svr_buf", "false"); } /* get file striping information and set it in info */ err = fcntl(fd->fd_sys, F_GETSATTR, &attr); if (!err) { - sprintf(value, "%d", attr.s_sunitsize); - MPI_Info_set(fd->info, "striping_unit", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sunitsize); + ADIOI_Info_set(fd->info, "striping_unit", value); - sprintf(value, "%d", attr.s_sfactor); - MPI_Info_set(fd->info, "striping_factor", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sfactor); + ADIOI_Info_set(fd->info, "striping_factor", value); - sprintf(value, "%d", attr.s_start_sdir); - MPI_Info_set(fd->info, "start_iodevice", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_start_sdir); + ADIOI_Info_set(fd->info, "start_iodevice", value); } ADIOI_Free(value); @@ -86,14 +75,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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_rdcoll.c deleted file mode 100644 index a4bf5bd48a..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_rdcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_read.c index 42985a5c00..e148dec309 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_read.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_read.c @@ -1,65 +1,35 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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_ReadContig(ADIO_File fd, void *buf, int count, 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_READCONTIG"; -#endif MPI_Type_size(datatype, &datatype_size); len = datatype_size * count; if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { if (fd->fp_sys_posn != offset) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif lseek(fd->fd_sys, offset, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); -#endif } -#ifdef PROFILE - MPE_Log_event(3, 0, "start read"); -#endif err = _cread(fd->fd_sys, buf, len); -#ifdef PROFILE - MPE_Log_event(4, 0, "end read"); -#endif fd->fp_sys_posn = offset + err; /* individual file pointer not updated */ } else { /* read from curr. location of ind. file pointer */ if (fd->fp_sys_posn != fd->fp_ind) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); -#endif } -#ifdef PROFILE - MPE_Log_event(3, 0, "start read"); -#endif err = _cread(fd->fd_sys, buf, len); -#ifdef PROFILE - MPE_Log_event(4, 0, "end read"); -#endif fd->fp_ind += err; fd->fp_sys_posn = fd->fp_ind; } @@ -68,24 +38,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); } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_resize.c deleted file mode 100644 index a791b5deeb..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_resize.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_seek.c deleted file mode 100644 index 0dc6c3e410..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_seek.c +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wait.c index 557bfe3384..4719bcc4ba 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wait.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wait.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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) diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wrcoll.c deleted file mode 100644 index 3898cf1169..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_wrcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * 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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_write.c index faa678b5f2..257114b301 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_write.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pfs/ad_pfs_write.c @@ -1,65 +1,36 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * 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_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; if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { if (fd->fp_sys_posn != offset) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif lseek(fd->fd_sys, offset, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); -#endif } -#ifdef PROFILE - MPE_Log_event(5, 0, "start write"); -#endif err = _cwrite(fd->fd_sys, buf, len); -#ifdef PROFILE - MPE_Log_event(6, 0, "end write"); -#endif fd->fp_sys_posn = offset + err; /* individual file pointer not updated */ } else { /* write from curr. location of ind. file pointer */ if (fd->fp_sys_posn != fd->fp_ind) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); -#endif } -#ifdef PROFILE - MPE_Log_event(5, 0, "start write"); -#endif err = _cwrite(fd->fd_sys, buf, len); -#ifdef PROFILE - MPE_Log_event(6, 0, "end write"); -#endif fd->fp_ind += err; fd->fp_sys_posn = fd->fp_ind; } @@ -68,24 +39,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); } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/.state-cache new file mode 100644 index 0000000000..99f82d8eed --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/.state-cache @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/Makefile.in index 1d67f7bb7d..5bbd0a89a7 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/Makefile.in @@ -3,15 +3,15 @@ AR = @AR@ LIBNAME = @LIBNAME@ srcdir = @srcdir@ -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) @VPATH@ -AD_PIOFS_OBJECTS = ad_piofs_close.o ad_piofs_read.o \ - ad_piofs_open.o ad_piofs_write.o ad_piofs_done.o \ - ad_piofs_fcntl.o ad_piofs_iread.o ad_piofs_iwrite.o ad_piofs_wait.o \ - ad_piofs_seek.o ad_piofs_resize.o ad_piofs_hints.o \ +AD_PIOFS_OBJECTS = ad_piofs_read.o \ + ad_piofs_open.o ad_piofs_write.o \ + ad_piofs_fcntl.o \ + ad_piofs_hints.o \ ad_piofs.o diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/README b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/README new file mode 100644 index 0000000000..933677b177 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/README @@ -0,0 +1 @@ +This code is no longer supported. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.c index 4943fd5a89..b602c789bd 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -17,21 +16,22 @@ struct ADIOI_Fns_struct ADIO_PIOFS_operations = { ADIOI_PIOFS_WriteContig, /* WriteContig */ ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_PIOFS_SeekIndividual, /* SeekIndividual */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ ADIOI_PIOFS_Fcntl, /* Fcntl */ ADIOI_PIOFS_SetInfo, /* SetInfo */ ADIOI_GEN_ReadStrided, /* ReadStrided */ ADIOI_PIOFS_WriteStrided, /* WriteStrided */ - ADIOI_PIOFS_Close, /* Close */ - ADIOI_PIOFS_IreadContig, /* IreadContig */ - ADIOI_PIOFS_IwriteContig, /* IwriteContig */ - ADIOI_PIOFS_ReadDone, /* ReadDone */ - ADIOI_PIOFS_WriteDone, /* WriteDone */ - ADIOI_PIOFS_ReadComplete, /* ReadComplete */ - ADIOI_PIOFS_WriteComplete, /* WriteComplete */ - ADIOI_PIOFS_IreadStrided, /* IreadStrided */ - ADIOI_PIOFS_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_PIOFS_Resize, /* Resize */ + ADIOI_GEN_Resize, /* Resize */ ADIOI_GEN_Delete, /* Delete */ + ADIOI_PIOFS_Feature, }; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.h b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.h index a7b96717e0..919cdb4cab 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -19,4 +18,23 @@ #include #include "adio.h" +void ADIOI_PIOFS_Open(ADIO_File fd, int *error_code); +void ADIOI_PIOFS_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_PIOFS_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_PIOFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int + *error_code); +void ADIOI_PIOFS_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_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); + +void ADIOI_PIOFS_Feature(ADIO_File fd, int flag); + #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_close.c deleted file mode 100644 index 0fa35476df..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_close.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" -#ifdef PROFILE -#include "mpe.h" -#endif - -void ADIOI_PIOFS_Close(ADIO_File fd, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PIOFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_done.c deleted file mode 100644 index 3466943426..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_done.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -int ADIOI_PIOFS_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_PIOFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - ADIOI_PIOFS_ReadDone(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_fcntl.c dissimilarity index 70% index 5b4baf89eb..13b8501ae1 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_fcntl.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_fcntl.c @@ -1,196 +1,77 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" -#include "adio_extern.h" - -void ADIOI_PIOFS_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; - ADIO_Offset curr_fsize, alloc_size, size, len, done; - ADIO_Status status; - char *buf; - piofs_change_view_t *piofs_change_view; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PIOFS_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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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; icount; 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 = llseek(fd->fd_sys, 0, SEEK_END); - if (fd->fp_sys_posn != -1) - llseek(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); - } - 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 = llseek(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 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; ifp_sys_posn != -1) - llseek(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; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - piofs_change_view = (piofs_change_view_t *) - ADIOI_Malloc(sizeof(piofs_change_view_t)); - piofs_change_view->Vbs = piofs_change_view->Vn = - piofs_change_view->Hbs = piofs_change_view->Hn = 1; - piofs_change_view->subfile = 0; - piofs_change_view->flags = (fcntl_struct->atomicity == 0) - ? (ACTIVE | NORMAL) : (ACTIVE | CAUTIOUS); - err = piofsioctl(fd->fd_sys, PIOFS_CHANGE_VIEW, piofs_change_view); - ADIOI_Free(piofs_change_view); - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; -#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 - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_PIOFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_piofs.h" +#include "adio_extern.h" + +void ADIOI_PIOFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) +{ + MPI_Datatype copy_etype, copy_filetype; + int i, ntimes, err; + ADIO_Offset curr_fsize, alloc_size, size, len, done; + ADIO_Status status; + char *buf; + piofs_change_view_t *piofs_change_view; +#ifndef PRINT_ERR_MSG + static char myname[] = "ADIOI_PIOFS_FCNTL"; +#endif + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + fcntl_struct->fsize = llseek(fd->fd_sys, 0, SEEK_END); + if (fd->fp_sys_posn != -1) + llseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); + 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: + ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); + break; + + case ADIO_FCNTL_SET_ATOMICITY: + piofs_change_view = (piofs_change_view_t *) + ADIOI_Malloc(sizeof(piofs_change_view_t)); + piofs_change_view->Vbs = piofs_change_view->Vn = + piofs_change_view->Hbs = piofs_change_view->Hn = 1; + piofs_change_view->subfile = 0; + piofs_change_view->flags = (fcntl_struct->atomicity == 0) + ? (ACTIVE | NORMAL) : (ACTIVE | CAUTIOUS); + err = piofsioctl(fd->fd_sys, PIOFS_CHANGE_VIEW, piofs_change_view); + ADIOI_Free(piofs_change_view); + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 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 = 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; + + default: + FPRINTF(stderr, "Unknown flag passed to ADIOI_PIOFS_Fcntl\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_features.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_features.c new file mode 100644 index 0000000000..11b17bf7be --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_features.c @@ -0,0 +1,13 @@ +int ADIOI_PIOFS_Features(int flag) +{ + switch(flag) { + case ADIO_LOCKS: + case ADIO_SHARED_FP: + case ADIO_ATOMIC_MODE: + case ADIO_DATA_SIEVING_WRITES: + case ADIO_SCALABLE_OPEN: + default: + return 0; + break; + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_flush.c deleted file mode 100644 index fa6a2368a9..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_flush.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_Flush(ADIO_File fd, int *error_code) -{ - ADIOI_GEN_Flush(fd, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_hints.c index 63a58caa6c..295310512d 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_hints.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_hints.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -16,7 +15,7 @@ void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) int flag, tmp_val, str_factor=-1, str_unit=-1, start_iodev=-1; int err, myrank, perm, old_mask, nioservers; - 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)); @@ -26,7 +25,7 @@ void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) if (users_info != MPI_INFO_NULL) { value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, value, &flag); if (flag) { str_factor=atoi(value); @@ -38,7 +37,7 @@ void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) } } - MPI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, value, &flag); if (flag) { str_unit=atoi(value); @@ -50,7 +49,7 @@ void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) } } - MPI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, value, &flag); if (flag) { start_iodev=atoi(value); @@ -68,6 +67,8 @@ void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0)) { MPI_Comm_rank(fd->comm, &myrank); if (!myrank) { + int len; + if (fd->perm == ADIO_PERM_NULL) { old_mask = umask(022); umask(old_mask); @@ -78,23 +79,24 @@ void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) /* to find out the number of I/O servers, I need the path to the directory containing the file */ - path = strdup(fd->filename); + path = ADIOI_Strdup(fd->filename); + len = strlen(path) + 1; slash = strrchr(path, '/'); - if (!slash) strcpy(path, "."); + if (!slash) ADIOI_Strncpy(path, ".", len); else { if (slash == path) *(path + 1) = '\0'; else *slash = '\0'; } - strcpy(piofs_statfs.name, path); + ADIOI_Strncpy(piofs_statfs.name, path, len); err = piofsioctl(0, PIOFS_STATFS, &piofs_statfs); nioservers = (err) ? -1 : piofs_statfs.f_nodes; - free(path); + ADIOI_Free(path); str_factor = ADIOI_MIN(nioservers, str_factor); if (start_iodev >= nioservers) start_iodev = -1; - strcpy(piofs_create.name, fd->filename); + ADIOI_Strncpy(piofs_create.name, fd->filename, len); piofs_create.bsu = (str_unit > 0) ? str_unit : -1; piofs_create.cells = (str_factor > 0) ? str_factor : -1; piofs_create.permissions = perm; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_iread.c deleted file mode 100644 index e834bfacfa..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_iread.c +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_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; - -/* PIOFS 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_PIOFS_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_PIOFS_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 - -/* PIOFS 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_PIOFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_iwrite.c deleted file mode 100644 index ee34666df5..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_iwrite.c +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_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; - -/* PIOFS 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_PIOFS_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_PIOFS_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 - -/* PIOFS 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_PIOFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_open.c index 45db639d37..20c3644c9b 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_open.c @@ -1,15 +1,11 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "ad_piofs.h" -#ifdef PROFILE -#include "mpe.h" -#endif void ADIOI_PIOFS_Open(ADIO_File fd, int *error_code) { @@ -39,13 +35,8 @@ void ADIOI_PIOFS_Open(ADIO_File fd, int *error_code) if (fd->access_mode & ADIO_EXCL) amode = amode | O_EXCL; -#ifdef PROFILE - MPE_Log_event(1, 0, "start open"); -#endif fd->fd_sys = open(fd->filename, amode, perm); -#ifdef PROFILE - MPE_Log_event(2, 0, "end open"); -#endif + fd->fd_direct = -1; llseek(fd->fd_sys, 0, SEEK_SET); /* required to initiate use of 64-bit offset */ @@ -57,14 +48,14 @@ void ADIOI_PIOFS_Open(ADIO_File fd, int *error_code) err = piofsioctl(fd->fd_sys, PIOFS_FSTAT, &piofs_fstat); if (!err) { - sprintf(value, "%d", piofs_fstat.st_bsu); - MPI_Info_set(fd->info, "striping_unit", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_bsu); + ADIOI_Info_set(fd->info, "striping_unit", value); - sprintf(value, "%d", piofs_fstat.st_cells); - MPI_Info_set(fd->info, "striping_factor", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_cells); + ADIOI_Info_set(fd->info, "striping_factor", value); - sprintf(value, "%d", piofs_fstat.st_base_node); - MPI_Info_set(fd->info, "start_iodevice", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_base_node); + ADIOI_Info_set(fd->info, "start_iodevice", value); } ADIOI_Free(value); @@ -72,14 +63,17 @@ void ADIOI_PIOFS_Open(ADIO_File fd, int *error_code) fd->fp_ind = fd->fp_sys_posn = llseek(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) { +#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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_rdcoll.c deleted file mode 100644 index d0b886225e..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_rdcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_read.c index 6427bd2ba8..c25e7e17e2 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_read.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_read.c @@ -1,15 +1,11 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "ad_piofs.h" -#ifdef PROFILE -#include "mpe.h" -#endif void ADIOI_PIOFS_ReadContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, int file_ptr_type, @@ -25,41 +21,17 @@ void ADIOI_PIOFS_ReadContig(ADIO_File fd, void *buf, int count, if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { if (fd->fp_sys_posn != offset) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif llseek(fd->fd_sys, offset, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); -#endif } -#ifdef PROFILE - MPE_Log_event(3, 0, "start read"); -#endif err = read(fd->fd_sys, buf, len); -#ifdef PROFILE - MPE_Log_event(4, 0, "end read"); -#endif fd->fp_sys_posn = offset + err; /* individual file pointer not updated */ } else { /* read from curr. location of ind. file pointer */ if (fd->fp_sys_posn != fd->fp_ind) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif llseek(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); -#endif } -#ifdef PROFILE - MPE_Log_event(3, 0, "start read"); -#endif err = read(fd->fd_sys, buf, len); -#ifdef PROFILE - MPE_Log_event(4, 0, "end read"); -#endif fd->fp_ind += err; fd->fp_sys_posn = fd->fp_ind; } @@ -68,24 +40,17 @@ void ADIOI_PIOFS_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) { +#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, myname, "I/O Error", "%s", strerror(errno)); ADIOI_Error(fd, *error_code, myname); +#endif } else *error_code = MPI_SUCCESS; -#endif -} - - -void ADIOI_PIOFS_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); } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_resize.c deleted file mode 100644 index a9a5273719..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_resize.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PIOFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_seek.c deleted file mode 100644 index 379b509b9f..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_seek.c +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" -#include "adio_extern.h" - -ADIO_Offset ADIOI_PIOFS_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 */ - -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PIOFS_SEEKINDIVIDUAL"; -#endif - - ADIO_Offset off, abs_off_in_filetype=0, err; - ADIOI_Flatlist_node *flat_file; - - int i, n_etypes_in_filetype, n_filetypes, etype_in_filetype; - 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; icount; 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 - err = llseek(fd->fd_sys, off, SEEK_SET); -#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(fd, *error_code, myname); - } - else *error_code = MPI_SUCCESS; -#endif - return off; -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_wait.c deleted file mode 100644 index 0fab6d1b6d..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_wait.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_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_PIOFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - ADIOI_PIOFS_ReadComplete(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_wrcoll.c deleted file mode 100644 index 0ad2311a0c..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_wrcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_piofs.h" - -void ADIOI_PIOFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_write.c index eb012edeeb..3f6417108b 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_write.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_piofs/ad_piofs_write.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -8,9 +7,6 @@ #include "ad_piofs.h" #include "adio_extern.h" -#ifdef PROFILE -#include "mpe.h" -#endif void ADIOI_PIOFS_WriteContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, int file_ptr_type, @@ -26,41 +22,17 @@ void ADIOI_PIOFS_WriteContig(ADIO_File fd, void *buf, int count, if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { if (fd->fp_sys_posn != offset) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif llseek(fd->fd_sys, offset, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); -#endif } -#ifdef PROFILE - MPE_Log_event(5, 0, "start write"); -#endif err = write(fd->fd_sys, buf, len); -#ifdef PROFILE - MPE_Log_event(6, 0, "end write"); -#endif fd->fp_sys_posn = offset + err; /* individual file pointer not updated */ } else { /* write from curr. location of ind. file pointer */ if (fd->fp_sys_posn != fd->fp_ind) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif llseek(fd->fd_sys, fd->fp_ind, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); -#endif } -#ifdef PROFILE - MPE_Log_event(5, 0, "start write"); -#endif err = write(fd->fd_sys, buf, len); -#ifdef PROFILE - MPE_Log_event(6, 0, "end write"); -#endif fd->fp_ind += err; fd->fp_sys_posn = fd->fp_ind; } @@ -69,16 +41,19 @@ void ADIOI_PIOFS_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_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 } else *error_code = MPI_SUCCESS; -#endif } @@ -172,17 +147,20 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count, if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; ADIOI_Free(iov); -#ifdef PRINT_ERR_MSG - *error_code = (err_flag) ? MPI_ERR_UNKNOWN : MPI_SUCCESS; -#else if (err_flag) { +#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 - } + } /* if (!buftype_is_contig && filetype_is_contig) ... */ else { /* noncontiguous in file */ @@ -250,18 +228,8 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count, if (fwr_size) { /* TYPE_UB and TYPE_LB can result in fwr_size = 0. save system call in such cases */ -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif llseek(fd->fd_sys, off, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); - MPE_Log_event(5, 0, "start write"); -#endif err = write(fd->fd_sys, ((char *) buf) + i, fwr_size); -#ifdef PROFILE - MPE_Log_event(6, 0, "end write"); -#endif if (err == -1) err_flag = 1; } i += fwr_size; @@ -299,18 +267,8 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count, while (num < bufsize) { size = ADIOI_MIN(fwr_size, bwr_size); if (size) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif llseek(fd->fd_sys, off, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); - MPE_Log_event(5, 0, "start write"); -#endif err = write(fd->fd_sys, ((char *) buf) + indx, size); -#ifdef PROFILE - MPE_Log_event(6, 0, "end write"); -#endif if (err == -1) err_flag = 1; } @@ -355,17 +313,20 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count, } 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) { +#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 - } + } fd->fp_sys_posn = -1; /* set it to null. */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/.state-cache new file mode 100644 index 0000000000..0dd159f742 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/.state-cache @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/Makefile.in dissimilarity index 64% index 6e1294bac2..89d7bb0d7f 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/Makefile.in @@ -1,26 +1,71 @@ -CC = @CC@ -AR = @AR@ -LIBNAME = @LIBNAME@ -srcdir = @srcdir@ - -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) - -@VPATH@ - -AD_PVFS_OBJECTS = ad_pvfs_close.o ad_pvfs_read.o ad_pvfs_rdcoll.o \ - ad_pvfs_wrcoll.o ad_pvfs_open.o ad_pvfs_write.o ad_pvfs_done.o \ - ad_pvfs_fcntl.o ad_pvfs_iread.o ad_pvfs_iwrite.o ad_pvfs_wait.o \ - ad_pvfs_flush.o ad_pvfs_seek.o ad_pvfs_resize.o ad_pvfs_hints.o \ - ad_pvfs_delete.o ad_pvfs.o - -default: $(LIBNAME) - -.c.o: - $(CC) $(CFLAGS) -c $< - -$(LIBNAME): $(AD_PVFS_OBJECTS) - $(AR) $(LIBNAME) $(AD_PVFS_OBJECTS) - -clean: - @rm -f *.o +CC = @CC@ +AR = @AR@ +RANLIB = @RANLIB@ +LIBNAME = @LIBNAME@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +#DEFS = @DEFS@ -I. -I${srcdir} +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +#CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) +CFLAGS = @CFLAGS@ + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +C_COMPILE_SHL = $(CC_SHL) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +#C_COMPILE_SHL = $(CC_SHL) + +@VPATH@ + +AD_PVFS_OBJECTS = ad_pvfs_close.o ad_pvfs_read.o \ + ad_pvfs_open.o ad_pvfs_write.o \ + ad_pvfs_fcntl.o \ + ad_pvfs_flush.o ad_pvfs_resize.o ad_pvfs_hints.o \ + ad_pvfs_delete.o ad_pvfs.o + +default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +# $(CC) $(CFLAGS) -c $< +.c.o: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE) -c $< ; \ + fi + @$(C_COMPILE) -c $< +# $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o +# @mv -f _s$*.o $*.lo +.c.lo: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE_SHL) -c $< -o _s$*.o ; \ + echo mv -f _s$*.o $*.lo ; \ + fi + @$(C_COMPILE_SHL) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + +$(LIBNAME): $(AD_PVFS_OBJECTS) + $(AR) $(LIBNAME) $(AD_PVFS_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_PVFS_LOOBJECTS=$(AD_PVFS_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_PVFS_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_PVFS_LOOBJECTS) + +coverage: + -@for file in ${AD_PVFS_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.c index c8f2016b51..198cc9fb65 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -17,21 +16,22 @@ struct ADIOI_Fns_struct ADIO_PVFS_operations = { ADIOI_PVFS_WriteContig, /* WriteContig */ ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_PVFS_SeekIndividual, /* SeekIndividual */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ ADIOI_PVFS_Fcntl, /* Fcntl */ ADIOI_PVFS_SetInfo, /* SetInfo */ - ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_PVFS_ReadStrided, /* ReadStrided */ ADIOI_PVFS_WriteStrided, /* WriteStrided */ ADIOI_PVFS_Close, /* Close */ - ADIOI_PVFS_IreadContig, /* IreadContig */ - ADIOI_PVFS_IwriteContig, /* IwriteContig */ - ADIOI_PVFS_ReadDone, /* ReadDone */ - ADIOI_PVFS_WriteDone, /* WriteDone */ - ADIOI_PVFS_ReadComplete, /* ReadComplete */ - ADIOI_PVFS_WriteComplete, /* WriteComplete */ - ADIOI_PVFS_IreadStrided, /* IreadStrided */ - ADIOI_PVFS_IwriteStrided, /* IwriteStrided */ + 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_PVFS_Flush, /* Flush */ ADIOI_PVFS_Resize, /* Resize */ ADIOI_PVFS_Delete, /* Delete */ + ADIOI_PVFS_Feature, /* Features */ }; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.h index bfe2885240..4691c9f09b 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -9,12 +8,47 @@ #ifndef AD_PVFS_INCLUDE #define AD_PVFS_INCLUDE +#ifndef ROMIOCONF_H_INCLUDED +#include "romioconf.h" +#define ROMIOCONF_H_INCLUDED +#endif +#ifdef ROMIO_PVFS_NEEDS_INT64_DEFINITION +typedef long long int int64_t; +#endif + #include #include #include #include +#ifdef HAVE_PVFS_H #include +#endif #include "adio.h" -#include "pvfs_proto.h" + +void ADIOI_PVFS_Open(ADIO_File fd, int *error_code); +void ADIOI_PVFS_Close(ADIO_File fd, int *error_code); +void ADIOI_PVFS_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_PVFS_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_PVFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int + *error_code); +void ADIOI_PVFS_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_PVFS_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_PVFS_Flush(ADIO_File fd, int *error_code); +void ADIOI_PVFS_Delete(char *filename, int *error_code); +void ADIOI_PVFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_PVFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); + #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_close.c index 5780e7e99e..517278d0c9 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_close.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_close.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -11,19 +10,22 @@ void ADIOI_PVFS_Close(ADIO_File fd, int *error_code) { int err; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_PVFS_CLOSE"; -#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_close_a, 0, NULL ); +#endif err = pvfs_close(fd->fd_sys); -#ifdef PRINT_ERR_MSG - *error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; -#else +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_close_b, 0, NULL ); +#endif + fd->fd_sys = -1; + 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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_delete.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_delete.c index df932a967e..5e1c46ac97 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_delete.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_delete.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -12,19 +11,14 @@ void ADIOI_PVFS_Delete(char *filename, int *error_code) { int err; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_PVFS_DELETE"; -#endif err = pvfs_unlink(filename); -#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(MPI_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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_done.c deleted file mode 100644 index ecaae6a46d..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_done.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -int ADIOI_PVFS_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_PVFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - return ADIOI_PVFS_ReadDone(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_fcntl.c dissimilarity index 88% index ec08366e42..33e32732d6 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_fcntl.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_fcntl.c @@ -1,176 +1,72 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" -#include "adio_extern.h" - -void ADIOI_PVFS_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; - ADIO_Offset curr_fsize, alloc_size, size, len, done; - ADIO_Status status; - char *buf; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PVFS_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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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; icount; 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 = pvfs_lseek64(fd->fd_sys, 0, SEEK_END); - if (fd->fp_sys_posn != -1) - pvfs_lseek64(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); - } - 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 = pvfs_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 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; ifp_sys_posn != -1) - pvfs_lseek64(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; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - *error_code = MPI_ERR_UNKNOWN; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_PVFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs.h" +#include "adio_extern.h" + +void ADIOI_PVFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, + int *error_code) +{ + static char myname[] = "ADIOI_PVFS_FCNTL"; + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + fcntl_struct->fsize = pvfs_lseek64(fd->fd_sys, 0, SEEK_END); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + if (fd->fp_sys_posn != -1) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + pvfs_lseek64(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } + if (fcntl_struct->fsize == -1) { + *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; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = 0; + /* --BEGIN ERROR HANDLING-- */ + if (fcntl_struct->atomicity != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNSUPPORTED_OPERATION, + "PVFS does not support atomic mode", + 0); + return; + } + /* --END ERROR HANDLING-- */ + break; + + default: + /* --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-- */ + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_flush.c index 2e64c7e1e3..d378a1315e 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_flush.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_flush.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -10,21 +9,28 @@ void ADIOI_PVFS_Flush(ADIO_File fd, int *error_code) { - int err; -#ifndef PRINT_ERR_MSG + int err, rank, dummy=0, dummy_in=0; static char myname[] = "ADIOI_PVFS_FLUSH"; -#endif - err = pvfs_fsync(fd->fd_sys); + /* a collective routine: because we do not cache data in PVFS1, one process + * can initiate the fsync operation and broadcast the result to the others. + * One catch: MPI_File_sync has special meaning with respect to file system + * consistency. Ensure no clients have outstanding write operations. + */ + + MPI_Comm_rank(fd->comm, &rank); + MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, + fd->hints->ranklist[0], fd->comm); + if (rank == fd->hints->ranklist[0]) { + err = pvfs_fsync(fd->fd_sys); + } + MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); -#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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_hints.c dissimilarity index 66% index 48f1a9bbd0..710aea7708 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_hints.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_hints.c @@ -1,125 +1,146 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -void ADIOI_PVFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - char *value; - int flag, tmp_val, str_factor=-1, str_unit=-1, start_iodev=-1; - - if (!(fd->info)) { - /* This must be part of the open call. can set striping parameters - if necessary. */ - MPI_Info_create(&(fd->info)); - MPI_Info_set(fd->info, "romio_pvfs_listio_read", "disable"); - MPI_Info_set(fd->info, "romio_pvfs_listio_write", "disable"); - fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE; - fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE; - - /* has user specified any pvfs-specific hints (striping params, listio) - 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, "striping_factor", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - str_factor=atoi(value); - tmp_val = str_factor; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != str_factor) { - FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"striping_factor\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - else MPI_Info_set(fd->info, "striping_factor", value); - } - - MPI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - str_unit=atoi(value); - tmp_val = str_unit; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != str_unit) { - FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"striping_unit\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - else MPI_Info_set(fd->info, "striping_unit", value); - } - - MPI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - start_iodev=atoi(value); - tmp_val = start_iodev; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != start_iodev) { - FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"start_iodevice\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - else MPI_Info_set(fd->info, "start_iodevice", value); - } - - MPI_Info_get(users_info, "romio_pvfs_listio_read", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) - { - MPI_Info_set(fd->info, "romio_pvfs_listio_read", value); - fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_ENABLE; - } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE")) - { - MPI_Info_set(fd->info , "romio_pvfs_listio_read", value); - fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE; - } - else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) - { - MPI_Info_set(fd->info, "romio_pvfs_listio_read", value); - fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_AUTO; - } - tmp_val = fd->hints->fs_hints.pvfs.listio_read; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != fd->hints->fs_hints.pvfs.listio_read) { - FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"romio_pvfs_listio_read\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - MPI_Info_get(users_info, "romio_pvfs_listio_write", MPI_MAX_INFO_VAL, - value, &flag); - if (flag) { - if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) - { - MPI_Info_set(fd->info, "romio_pvfs_listio_write", value); - fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_ENABLE; - } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE")) - { - MPI_Info_set(fd->info, "romio_pvfs_listio_write", value); - fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE; - } - else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) - { - MPI_Info_set(fd->info, "romio_pvfs_listio_write", value); - fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_AUTO; - } - tmp_val = fd->hints->fs_hints.pvfs.listio_write; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != fd->hints->fs_hints.pvfs.listio_write) { - FPRINTF(stderr, "ADIOI_PVFS_SetInfo: the value for key \"romio_pvfs_listio_write\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - ADIOI_Free(value); - } - } - - /* set the values for collective I/O and data sieving parameters */ - ADIOI_GEN_SetInfo(fd, users_info, error_code); - - *error_code = MPI_SUCCESS; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs.h" + +void ADIOI_PVFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ + char *value; + int flag, tmp_val, str_factor=-1, str_unit=-1, start_iodev=-1; + static char myname[] = "ADIOI_PVFS_SETINFO"; + + 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)); + ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", "disable"); + ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", "disable"); + fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE; + fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE; + + /* has user specified any pvfs-specific hints (striping params, listio) + 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)); + + ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + str_factor=atoi(value); + tmp_val = str_factor; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + if (tmp_val != str_factor) { + /* --BEGIN ERROR HANDLING-- */ + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "striping_factor", + error_code); + return; + /* --END ERROR HANDLING-- */ + } + else ADIOI_Info_set(fd->info, "striping_factor", value); + } + + ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + str_unit=atoi(value); + tmp_val = str_unit; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + if (tmp_val != str_unit) { + /* --BEGIN ERROR HANDLING-- */ + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "striping_unit", + error_code); + return; + /* --END ERROR HANDLING-- */ + } + else ADIOI_Info_set(fd->info, "striping_unit", value); + } + + ADIOI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + start_iodev=atoi(value); + tmp_val = start_iodev; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + if (tmp_val != start_iodev) { + /* --BEGIN ERROR HANDLING-- */ + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "start_iodevice", + error_code); + return; + /* --END ERROR HANDLING-- */ + } + else ADIOI_Info_set(fd->info, "start_iodevice", value); + } + + ADIOI_Info_get(users_info, "romio_pvfs_listio_read", + MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) + { + ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", value); + fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_ENABLE; + } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE")) + { + ADIOI_Info_set(fd->info , "romio_pvfs_listio_read", value); + fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_DISABLE; + } + else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(fd->info, "romio_pvfs_listio_read", value); + fd->hints->fs_hints.pvfs.listio_read = ADIOI_HINT_AUTO; + } + tmp_val = fd->hints->fs_hints.pvfs.listio_read; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + if (tmp_val != fd->hints->fs_hints.pvfs.listio_read) { + /* --BEGIN ERROR HANDLING-- */ + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_pvfs_listio_read", + error_code); + return; + /* --END ERROR HANDLING-- */ + } + } + ADIOI_Info_get(users_info, "romio_pvfs_listio_write", MPI_MAX_INFO_VAL, + value, &flag); + if (flag) { + if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) + { + ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value); + fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_ENABLE; + } else if ( !strcmp(value, "disable") || !strcmp(value, "DISABLE")) + { + ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value); + fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_DISABLE; + } + else if ( !strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(fd->info, "romio_pvfs_listio_write", value); + fd->hints->fs_hints.pvfs.listio_write = ADIOI_HINT_AUTO; + } + tmp_val = fd->hints->fs_hints.pvfs.listio_write; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + if (tmp_val != fd->hints->fs_hints.pvfs.listio_write) { + /* --BEGIN ERROR HANDLING-- */ + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_pvfs_listio_write", + error_code); + return; + /* --END ERROR HANDLING-- */ + } + } + ADIOI_Free(value); + } + } + + /* set the values for collective I/O and data sieving parameters */ + ADIOI_GEN_SetInfo(fd, users_info, error_code); + + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_iread.c deleted file mode 100644 index 9ce684580c..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_iread.c +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -void ADIOI_PVFS_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; - -/* PVFS 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_PVFS_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_PVFS_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 - -/* PVFS 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_PVFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_iwrite.c deleted file mode 100644 index 1ffd61de54..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_iwrite.c +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -void ADIOI_PVFS_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; - -/* PVFS 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_PVFS_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_PVFS_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 - -/* PVFS 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_PVFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_open.c index 48173281af..535ed04b5b 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_open.c @@ -1,22 +1,20 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "ad_pvfs.h" -#include "pvfs_config.h" void ADIOI_PVFS_Open(ADIO_File fd, int *error_code) { int perm, amode, old_mask, flag; char *value; - struct pvfs_filestat pstat = {-1,-1,-1,0,0}; -#ifndef PRINT_ERR_MSG + /* some really old versions of pvfs may not have a release nr */ + /* we changed the structure of pvfs_filestat in pvfs-1.5.7 */ + struct pvfs_filestat pstat = {-1,-1,-1}; static char myname[] = "ADIOI_PVFS_OPEN"; -#endif if (fd->perm == ADIO_PERM_NULL) { old_mask = umask(022); @@ -39,43 +37,54 @@ void ADIOI_PVFS_Open(ADIO_File fd, int *error_code) value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(fd->info, "striping_factor", MPI_MAX_INFO_VAL, - value, &flag); + ADIOI_Info_get(fd->info, "striping_factor", MPI_MAX_INFO_VAL, + value, &flag); if (flag && (atoi(value) > 0)) pstat.pcount = atoi(value); - MPI_Info_get(fd->info, "striping_unit", MPI_MAX_INFO_VAL, - value, &flag); + ADIOI_Info_get(fd->info, "striping_unit", MPI_MAX_INFO_VAL, + value, &flag); if (flag && (atoi(value) > 0)) pstat.ssize = atoi(value); - MPI_Info_get(fd->info, "start_iodevice", MPI_MAX_INFO_VAL, - value, &flag); + ADIOI_Info_get(fd->info, "start_iodevice", MPI_MAX_INFO_VAL, + value, &flag); if (flag && (atoi(value) >= 0)) pstat.base = atoi(value); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); +#endif fd->fd_sys = pvfs_open64(fd->filename, amode, perm, &pstat, NULL); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); +#endif + fd->fd_direct = -1; - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) + if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif fd->fp_ind = fd->fp_sys_posn = pvfs_lseek64(fd->fd_sys, 0, SEEK_END); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + } if (fd->fd_sys != -1) { pvfs_ioctl(fd->fd_sys, GETMETA, &pstat); - sprintf(value, "%d", pstat.pcount); - MPI_Info_set(fd->info, "striping_factor", value); - sprintf(value, "%d", pstat.ssize); - MPI_Info_set(fd->info, "striping_unit", value); - sprintf(value, "%d", pstat.base); - MPI_Info_set(fd->info, "start_iodevice", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.pcount); + ADIOI_Info_set(fd->info, "striping_factor", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.ssize); + ADIOI_Info_set(fd->info, "striping_unit", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.base); + ADIOI_Info_set(fd->info, "start_iodevice", value); } ADIOI_Free(value); -#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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_rdcoll.c deleted file mode 100644 index 0084bf44ea..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_rdcoll.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -/* not referenced from operations table */ - -void ADIOI_PVFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_read.c index 7c313ed957..f6035218c3 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_read.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_read.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -22,25 +21,51 @@ void ADIOI_PVFS_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_PVFS_READCONTIG"; -#endif MPI_Type_size(datatype, &datatype_size); len = datatype_size * count; if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) + if (fd->fp_sys_posn != offset) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif pvfs_lseek64(fd->fd_sys, offset, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif err = pvfs_read(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + if (err>0) + fd->fp_sys_posn = offset + err; /* individual file pointer not updated */ } else { /* read from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) + if (fd->fp_sys_posn != fd->fp_ind) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif err = pvfs_read(fd->fd_sys, buf, len); - fd->fp_ind += err; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + if (err > 0) + fd->fp_ind += err; fd->fp_sys_posn = fd->fp_ind; } @@ -48,23 +73,20 @@ void ADIOI_PVFS_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_PVFS_ReadStrided(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) { #ifdef HAVE_PVFS_LISTIO if ( fd->hints->fs_hints.pvfs.listio_read == ADIOI_HINT_ENABLE) { @@ -116,7 +138,7 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count, int start_k, start_j, new_file_read, new_buffer_read; int start_mem_offset; -#define MAX_ARRAY_SIZE 11 +#define MAX_ARRAY_SIZE 1024 #ifndef PRINT_ERR_MESG static char myname[] = "ADIOI_PVFS_ReadStrided"; @@ -250,7 +272,7 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count, } } } /* while (!flag) */ - } /* if (file_ptr_type == ADIOI_INDIVIDUAL) */ + } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ else { n_etypes_in_filetype = filetype_size/etype_size; n_filetypes = (int) (offset / n_etypes_in_filetype); @@ -272,7 +294,7 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count, /* abs. offset in bytes in the file */ offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; - } /* else [file_ptr_type != ADIOI_INDIVIDUAL] */ + } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ start_off = offset; st_frd_size = frd_size; @@ -547,8 +569,6 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count, max_mem_list = mem_list_count; if (max_file_list < file_list_count) max_file_list = file_list_count; - if (max_mem_list == max_mem_list == MAX_ARRAY_SIZE) - break; } /* while (size_read < bufsize) */ mem_offsets = (char **)ADIOI_Malloc(max_mem_list*sizeof(char *)); diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_resize.c index 203207153e..ce72b4c17c 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_resize.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_resize.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -11,19 +10,23 @@ void ADIOI_PVFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) { int err; -#ifndef PRINT_ERR_MSG + int rank; static char myname[] = "ADIOI_PVFS_RESIZE"; -#endif - - err = pvfs_ftruncate64(fd->fd_sys, size); -#ifdef PRINT_ERR_MSG - *error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; -#else + + /* because MPI_File_set_size is a collective operation, and PVFS1 clients + * do not cache metadata locally, one client can resize and broadcast the + * result to the others */ + MPI_Comm_rank(fd->comm, &rank); + if (rank == fd->hints->ranklist[0]) { + err = pvfs_ftruncate64(fd->fd_sys, size); + } + MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + 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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_seek.c deleted file mode 100644 index c5c8e76752..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_seek.c +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" -#include "adio_extern.h" -#ifdef PROFILE -#include "mpe.h" -#endif - -ADIO_Offset ADIOI_PVFS_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 */ - -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_PVFS_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 ) { - *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; icount; 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 - err = pvfs_lseek64(fd->fd_sys, off, SEEK_SET); -#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(fd, *error_code, myname); - } - else *error_code = MPI_SUCCESS; -#endif - return off; -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_wait.c deleted file mode 100644 index baa85502a9..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_wait.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -void ADIOI_PVFS_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_PVFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - ADIOI_PVFS_ReadComplete(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_wrcoll.c deleted file mode 100644 index 0395c5cde8..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_wrcoll.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_pvfs.h" - -/* not referenced from operations table */ - -void ADIOI_PVFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_write.c index 5a3af8a05e..50175f3e51 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_write.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs/ad_pvfs_write.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -17,29 +16,56 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, #endif void ADIOI_PVFS_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_PVFS_WRITECONTIG"; -#endif MPI_Type_size(datatype, &datatype_size); len = datatype_size * count; if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) + if (fd->fp_sys_posn != offset) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif pvfs_lseek64(fd->fd_sys, offset, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif err = pvfs_write(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + if (err > 0) + fd->fp_sys_posn = offset + err; /* individual file pointer not updated */ } else { /* write from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) + if (fd->fp_sys_posn != fd->fp_ind) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif err = pvfs_write(fd->fd_sys, buf, len); - fd->fp_ind += err; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + if (err > 0) + fd->fp_ind += err; fd->fp_sys_posn = fd->fp_ind; } @@ -47,24 +73,21 @@ void ADIOI_PVFS_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_PVFS_WriteStrided(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) { /* Since PVFS does not support file locking, can't do buffered writes as on Unix */ @@ -72,7 +95,6 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count, /* offset is in units of etype relative to the filetype. */ ADIOI_Flatlist_node *flat_buf, *flat_file; - struct iovec *iov; int i, j, k, err=-1, bwr_size, fwr_size=0, st_index=0; int bufsize, num, size, sum, n_etypes_in_filetype, size_in_filetype; int n_filetypes, etype_in_filetype; @@ -82,9 +104,7 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count, int buf_count, buftype_is_contig, filetype_is_contig; ADIO_Offset off, disp; int flag, new_bwr_size, new_fwr_size, err_flag=0; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_PVFS_WRITESTRIDED"; -#endif #ifdef HAVE_PVFS_LISTIO if ( fd->hints->fs_hints.pvfs.listio_write == ADIOI_HINT_ENABLE ) { @@ -95,10 +115,15 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count, #endif /* if hint set to DISABLE or AUTOMATIC, don't use listio */ + /* --BEGIN ERROR HANDLING-- */ if (fd->atomicity) { - FPRINTF(stderr, "ROMIO cannot guarantee atomicity of noncontiguous accesses in atomic mode, as PVFS doesn't support file locking. Use nonatomic mode and its associated semantics.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_INTERN, + "Atomic mode set in PVFS I/O function", 0); + return; } + /* --END ERROR HANDLING-- */ ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); @@ -117,59 +142,121 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count, bufsize = buftype_size * count; if (!buftype_is_contig && filetype_is_contig) { - + char *combine_buf, *combine_buf_ptr; + ADIO_Offset combine_buf_remain; /* noncontiguous in memory, contiguous in file. use writev */ ADIOI_Flatten_datatype(datatype); flat_buf = ADIOI_Flatlist; while (flat_buf->type != datatype) flat_buf = flat_buf->next; -/* There is a limit of 16 on the number of iovecs for readv/writev! */ - - iov = (struct iovec *) ADIOI_Malloc(16*sizeof(struct iovec)); + /* allocate our "combine buffer" to pack data into before writing */ + combine_buf = (char *) ADIOI_Malloc(fd->hints->ind_wr_buffer_size); + combine_buf_ptr = combine_buf; + combine_buf_remain = fd->hints->ind_wr_buffer_size; + /* seek to the right spot in the file */ if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { off = fd->disp + etype_size * offset; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif pvfs_lseek64(fd->fd_sys, off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif } - else off = pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); + else { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + off = pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } - k = 0; - for (j=0; jcount; i++) { - iov[k].iov_base = ((char *) buf) + j*buftype_extent + - flat_buf->indices[i]; - iov[k].iov_len = flat_buf->blocklens[i]; - /*FPRINTF(stderr, "%d %d\n", iov[k].iov_base, iov[k].iov_len);*/ + if (flat_buf->blocklens[i] > combine_buf_remain && combine_buf != combine_buf_ptr) { + /* there is data in the buffer; write out the buffer so far */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + err = pvfs_write(fd->fd_sys, + combine_buf, + fd->hints->ind_wr_buffer_size - combine_buf_remain); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + if (err == -1) err_flag = 1; - off += flat_buf->blocklens[i]; - k = (k+1)%16; + /* reset our buffer info */ + combine_buf_ptr = combine_buf; + combine_buf_remain = fd->hints->ind_wr_buffer_size; + } - if (!k) { - err = pvfs_writev(fd->fd_sys, iov, 16); + /* TODO: heuristic for when to not bother to use combine buffer? */ + if (flat_buf->blocklens[i] >= combine_buf_remain) { + /* special case: blocklen is as big as or bigger than the combine buf; + * write directly + */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + err = pvfs_write(fd->fd_sys, + ((char *) buf) + j*buftype_extent + flat_buf->indices[i], + flat_buf->blocklens[i]); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif if (err == -1) err_flag = 1; + off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ + } + else { + /* copy more data into combine buffer */ + memcpy(combine_buf_ptr, + ((char *) buf) + j*buftype_extent + flat_buf->indices[i], + flat_buf->blocklens[i]); + combine_buf_ptr += flat_buf->blocklens[i]; + combine_buf_remain -= flat_buf->blocklens[i]; + off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ } } + } - if (k) { - err = pvfs_writev(fd->fd_sys, iov, k); + if (combine_buf_ptr != combine_buf) { + /* data left in buffer to write */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + err = pvfs_write(fd->fd_sys, + combine_buf, + fd->hints->ind_wr_buffer_size - combine_buf_remain); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif if (err == -1) err_flag = 1; } if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; - ADIOI_Free(iov); -#ifdef PRINT_ERR_MSG - *error_code = (err_flag) ? MPI_ERR_UNKNOWN : MPI_SUCCESS; -#else + ADIOI_Free(combine_buf); + 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 - } + } /* if (!buftype_is_contig && filetype_is_contig) ... */ else { /* noncontiguous in file */ @@ -237,17 +324,19 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count, if (fwr_size) { /* TYPE_UB and TYPE_LB can result in fwr_size = 0. save system call in such cases */ -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); #endif pvfs_lseek64(fd->fd_sys, off, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); - MPE_Log_event(5, 0, "start write"); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); #endif err = pvfs_write(fd->fd_sys, ((char *) buf) + i, fwr_size); -#ifdef PROFILE - MPE_Log_event(6, 0, "end write"); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); #endif if (err == -1) err_flag = 1; } @@ -286,17 +375,19 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count, while (num < bufsize) { size = ADIOI_MIN(fwr_size, bwr_size); if (size) { -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); #endif pvfs_lseek64(fd->fd_sys, off, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); - MPE_Log_event(5, 0, "start write"); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); #endif err = pvfs_write(fd->fd_sys, ((char *) buf) + indx, size); -#ifdef PROFILE - MPE_Log_event(6, 0, "end write"); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); #endif if (err == -1) err_flag = 1; } @@ -342,16 +433,13 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count, } 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. */ @@ -406,23 +494,20 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, int start_k, start_j, new_file_write, new_buffer_write; int start_mem_offset; #define MAX_ARRAY_SIZE 1024 - -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_PVFS_WRITESTRIDED"; -#endif /* PFS file pointer modes are not relevant here, because PFS does not support strided accesses. */ - if ((fd->iomode != M_ASYNC) && (fd->iomode != M_UNIX)) { - FPRINTF(stderr, "ADIOI_PVFS_WriteStrided: only M_ASYNC and M_UNIX iomodes are valid\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - + /* --BEGIN ERROR HANDLING-- */ if (fd->atomicity) { - FPRINTF(stderr, "ROMIO cannot guarantee atomicity of noncontiguous accesses in atomic mode, as PVFS doesn't support file locking. Use nonatomic mode and its associated semantics.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_INTERN, + "Atomic mode set in PVFS I/O function", 0); + return; } + /* --END ERROR HANDLING-- */ ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); @@ -452,9 +537,23 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { off = fd->disp + etype_size * offset; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif } - else off = pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); + else { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + off = pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } file_list_count = 1; file_offsets = off; @@ -508,16 +607,22 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, 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; + + fd->fp_sys_posn = -1; /* clear this. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ #endif + ADIOI_Delete_flattened(datatype); return; } /* if (!buftype_is_contig && filetype_is_contig) */ @@ -555,7 +660,7 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, } } } /* while (!flag) */ - } /* if (file_ptr_type == ADIOI_INDIVIDUAL) */ + } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ else { n_etypes_in_filetype = filetype_size/etype_size; n_filetypes = (int) (offset / n_etypes_in_filetype); @@ -577,7 +682,7 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, /* abs. offset in bytes in the file */ offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; - } /* else [file_ptr_type != ADIOI_INDIVIDUAL] */ + } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ start_off = offset; st_fwr_size = fwr_size; @@ -854,8 +959,6 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, max_mem_list = mem_list_count; if (max_file_list < file_list_count) max_file_list = file_list_count; - if (max_mem_list == max_mem_list == MAX_ARRAY_SIZE) - break; } /* while (size_wrote < bufsize) */ mem_offsets = (char **)ADIOI_Malloc(max_mem_list*sizeof(char *)); @@ -1043,17 +1146,13 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count, ADIOI_Free(file_lengths); 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. */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/.state-cache new file mode 100644 index 0000000000..8b53706d36 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/.state-cache @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/Makefile.in new file mode 100644 index 0000000000..966548eaee --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/Makefile.in @@ -0,0 +1,67 @@ +CC = @CC@ +AR = @AR@ +RANLIB = @RANLIB@ +LIBNAME = @LIBNAME@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +C_COMPILE_SHL = $(CC_SHL) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) + +@VPATH@ + +AD_PVFS2_OBJECTS = ad_pvfs2_close.o ad_pvfs2_read.o \ + ad_pvfs2_open.o ad_pvfs2_write.o \ + ad_pvfs2_fcntl.o \ + ad_pvfs2_flush.o ad_pvfs2_resize.o ad_pvfs2_hints.o \ + ad_pvfs2_delete.o ad_pvfs2.o ad_pvfs2_common.o ad_pvfs2_aio.o \ + ad_pvfs2_read_list_classic.o ad_pvfs2_io_list.o ad_pvfs2_io_dtype.o \ + ad_pvfs2_write_list_classic.o ad_pvfs2_features.o + +default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +.c.o: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE) -c $< ; \ + fi + @$(C_COMPILE) -c $< +.c.lo: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE_SHL) -c $< -o _s$*.o ; \ + echo mv -f _s$*.o $*.lo ; \ + fi + @$(C_COMPILE_SHL) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + + +$(LIBNAME): $(AD_PVFS2_OBJECTS) + $(AR) $(LIBNAME) $(AD_PVFS2_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_PVFS2_LOOBJECTS=$(AD_PVFS2_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_PVFS2_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_PVFS2_LOOBJECTS) + +coverage: + -@for file in ${AD_PVFS2_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.c new file mode 100644 index 0000000000..75ab87d854 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.c @@ -0,0 +1,42 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2003 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs2.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_PVFS2_operations = { + ADIOI_PVFS2_Open, /* Open */ + ADIOI_SCALEABLE_OpenColl, /* OpenColl */ + ADIOI_PVFS2_ReadContig, /* ReadContig */ + ADIOI_PVFS2_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_PVFS2_Fcntl, /* Fcntl */ + ADIOI_PVFS2_SetInfo, /* SetInfo */ + ADIOI_PVFS2_ReadStrided, /* ReadStrided */ + ADIOI_PVFS2_WriteStrided, /* WriteStrided */ + ADIOI_PVFS2_Close, /* Close */ + ADIOI_PVFS2_IReadContig, /* IreadContig */ + ADIOI_PVFS2_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_PVFS2_Flush, /* Flush */ + ADIOI_PVFS2_Resize, /* Resize */ + ADIOI_PVFS2_Delete, /* Delete */ + ADIOI_PVFS2_Feature, +}; + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.h b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.h new file mode 100644 index 0000000000..e3ff045233 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2.h @@ -0,0 +1,66 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#ifndef AD_PVFS2_INCLUDE +#define AD_PVFS2_INCLUDE + +#include "adio.h" +#ifdef HAVE_PVFS2_H +#include "pvfs2.h" +#endif + +#ifdef PVFS2_VERSION_MAJOR +#include "pvfs2-compat.h" +#endif + +void ADIOI_PVFS2_Open(ADIO_File fd, int *error_code); +void ADIOI_PVFS2_Close(ADIO_File fd, int *error_code); +void ADIOI_PVFS2_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_PVFS2_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_PVFS2_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int + *error_code); +void ADIOI_PVFS2_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_PVFS2_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_PVFS2_Flush(ADIO_File fd, int *error_code); +void ADIOI_PVFS2_Delete(char *filename, int *error_code); +void ADIOI_PVFS2_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +int ADIOI_PVFS2_Feature(ADIO_File fd, int flag); + +void ADIOI_PVFS2_IReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request *request, + int *error_code); +void ADIOI_PVFS2_IWriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request *request, + int *error_code); +void ADIOI_PVFS2_AIO_contig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request *request, + int flag, int *error_code); +void ADIOI_PVFS2_OldWriteStrided(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_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code); +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_aio.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_aio.c new file mode 100644 index 0000000000..89ca5c2f6b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_aio.c @@ -0,0 +1,219 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" +#include + +#include "ad_pvfs2_common.h" +#include "mpiu_greq.h" +#include "../../mpi-io/mpioimpl.h" + +#define READ 0 +#define WRITE 1 + +static int ADIOI_PVFS2_greq_class = 0; +int ADIOI_PVFS2_aio_free_fn(void *extra_state); +int ADIOI_PVFS2_aio_poll_fn(void *extra_state, MPI_Status *status); +int ADIOI_PVFS2_aio_wait_fn(int count, void ** array_of_states, + double timeout, MPI_Status *status); + +void ADIOI_PVFS2_IReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request *request, + int *error_code) +{ + ADIOI_PVFS2_AIO_contig(fd, buf, count, datatype, file_ptr_type, + offset, request, READ, error_code); +} + +void ADIOI_PVFS2_IWriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request *request, + int *error_code) +{ + ADIOI_PVFS2_AIO_contig(fd, buf, count, datatype, file_ptr_type, + offset, request, WRITE, error_code); +} + +void ADIOI_PVFS2_AIO_contig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request *request, + int flag, int *error_code) +{ + + int ret, datatype_size, len; + ADIOI_PVFS2_fs *pvfs_fs; + ADIOI_AIO_Request *aio_req; + static char myname[] = "ADIOI_PVFS2_AIO_contig"; + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + aio_req = (ADIOI_AIO_Request*)ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); + + MPI_Type_size(datatype, &datatype_size); + len = datatype_size * count; + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &(aio_req->mem_req)); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in pvfs_request_contig (memory)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &(aio_req->file_req)); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in pvfs_request_contig (file)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* copy individual file pointer into offset variable, continue */ + offset = fd->fp_ind; + } + if (flag == READ) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_iread_a, 0, NULL ); +#endif + ret = PVFS_isys_read(pvfs_fs->object_ref, aio_req->file_req, offset, + buf, aio_req->mem_req, &(pvfs_fs->credentials), + &(aio_req->resp_io), &(aio_req->op_id), NULL); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_iread_b, 0, NULL ); +#endif + } else if (flag == WRITE) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_iwrite_a, 0, NULL ); +#endif + ret = PVFS_isys_write(pvfs_fs->object_ref, aio_req->file_req, offset, + buf, aio_req->mem_req, &(pvfs_fs->credentials), + &(aio_req->resp_io), &(aio_req->op_id), NULL); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_iwrite_b, 0, NULL ); +#endif + } + + /* --BEGIN ERROR HANDLING-- */ + if (ret < 0 ) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_isys_io", 0); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + /* posted. defered completion */ + if (ret == 0) { + if (ADIOI_PVFS2_greq_class == 0) { + MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, + ADIOI_PVFS2_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_PVFS2_aio_poll_fn, ADIOI_PVFS2_aio_wait_fn, + &ADIOI_PVFS2_greq_class); + } + MPIX_Grequest_class_allocate(ADIOI_PVFS2_greq_class, aio_req, request); + memcpy(&(aio_req->req), request, sizeof(request)); + } + + /* immediate completion */ + if (ret == 1) { + MPIO_Completed_request_create(&fd, len, error_code, request); + } + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += len; + } + fd->fp_sys_posn = offset + len; + + *error_code = MPI_SUCCESS; +fn_exit: + return; +} + +int ADIOI_PVFS2_aio_free_fn(void *extra_state) +{ + ADIOI_AIO_Request *aio_req; + aio_req = (ADIOI_AIO_Request*)extra_state; + + PVFS_Request_free(&(aio_req->mem_req)); + PVFS_Request_free(&(aio_req->file_req)); + ADIOI_Free(aio_req); + + return MPI_SUCCESS; +} + +int ADIOI_PVFS2_aio_poll_fn(void *extra_state, MPI_Status *status) +{ + ADIOI_AIO_Request *aio_req; + int ret, error; + + aio_req = (ADIOI_AIO_Request *)extra_state; + + /* BUG: cannot PVFS_sys_testsome: does not work for a specific request */ + ret = PVFS_sys_wait(aio_req->op_id, "ADIOI_PVFS2_aio_poll_fn", &error); + if (ret == 0) { + aio_req->nbytes = aio_req->resp_io.total_completed; + MPI_Grequest_complete(aio_req->req); + return MPI_SUCCESS; + } else + return MPI_UNDEFINED; /* TODO: what's this error? */ +} + +/* wait for multiple requests to complete */ +int ADIOI_PVFS2_aio_wait_fn(int count, void ** array_of_states, + double timeout, MPI_Status *status) +{ + + ADIOI_AIO_Request **aio_reqlist; + PVFS_sys_op_id *op_id_array; + int i,j, greq_count, completed_count=0; + int *error_array; + + aio_reqlist = (ADIOI_AIO_Request **)array_of_states; + + op_id_array = (PVFS_sys_op_id*)ADIOI_Calloc(count, sizeof(PVFS_sys_op_id)); + error_array = (int *)ADIOI_Calloc(count, sizeof(int)); + greq_count = count; + + + /* PVFS-2.6: testsome actually tests all requests and fills in op_id_array + * with the ones that have completed. count is an in/out parameter. + * returns with the number of completed operations. what a mess! */ + while (completed_count < greq_count ) { + count = greq_count; + PVFS_sys_testsome(op_id_array, &count, NULL, error_array, INT_MAX); + completed_count += count; + for (i=0; i< count; i++) { + for (j=0; jop_id) { + aio_reqlist[j]->nbytes = + aio_reqlist[j]->resp_io.total_completed; + MPI_Grequest_complete(aio_reqlist[j]->req); + } + } + } + } + return MPI_SUCCESS; /* TODO: no idea how to deal with errors */ +} + + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_close.c new file mode 100644 index 0000000000..905356852f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_close.c @@ -0,0 +1,28 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs2.h" + +void ADIOI_PVFS2_Close(ADIO_File fd, int *error_code) +{ + ADIOI_Free(fd->fs_ptr); + fd->fs_ptr = NULL; + /* PVFS2 doesn't have a 'close', but MPI-IO semantics dictate that we + * ensure all data has been flushed. + */ + + /* At some point or another it was decided that ROMIO would not + * explicitly flush (other than any local cache) on close, because + * there is no way to *avoid* that overhead if you implement it here + * and don't actually want it. + */ + + *error_code = MPI_SUCCESS; +} +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.c new file mode 100644 index 0000000000..4da9eac02a --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.c @@ -0,0 +1,150 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2003 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs2.h" +#include "ad_pvfs2_common.h" +#include +#include +#include +#include + +/* maybe give romio access to the globalconfig struct */ +/* keyval hack to both tell us if we've already initialized pvfs2 and also + * close it down when mpi exits */ +int ADIOI_PVFS2_Initialized = MPI_KEYVAL_INVALID; + +void ADIOI_PVFS2_End(int *error_code) +{ + int ret; + static char myname[] = "ADIOI_PVFS2_END"; + + ret = PVFS_sys_finalize(); + + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0 ) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_finalize", 0); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; +} + +int ADIOI_PVFS2_End_call(MPI_Comm comm, int keyval, + void *attribute_val, void *extra_state) +{ + int error_code; + ADIOI_PVFS2_End(&error_code); + MPI_Keyval_free(&keyval); + return error_code; +} + +void ADIOI_PVFS2_Init(int *error_code ) +{ + int ret; + static char myname[] = "ADIOI_PVFS2_INIT"; + char * ncache_timeout; + + /* do nothing if we've already fired up the pvfs2 interface */ + if (ADIOI_PVFS2_Initialized != MPI_KEYVAL_INVALID) { + *error_code = MPI_SUCCESS; + return; + } + + /* for consistency, we should disable the pvfs2 ncache. If the + * environtment variable is already set, assume a user knows it + * won't be a problem */ + ncache_timeout = getenv("PVFS2_NCACHE_TIMEOUT"); + if (ncache_timeout == NULL ) + setenv("PVFS2_NCACHE_TIMEOUT", "0", 1); + + ret = PVFS_util_init_defaults(); + if (ret < 0 ) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_util_init_defaults", + 0); + PVFS_perror("PVFS_util_init_defaults", ret); + + return; + } + + MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_PVFS2_End_call, + &ADIOI_PVFS2_Initialized, (void *)0); + /* just like romio does, we make a dummy attribute so we + * get cleaned up */ + MPI_Attr_put(MPI_COMM_SELF, ADIOI_PVFS2_Initialized, (void *)0); +} + +void ADIOI_PVFS2_makeattribs(PVFS_sys_attr * attribs) +{ + memset(attribs, 0, sizeof(PVFS_sys_attr)); + + attribs->owner = geteuid(); + attribs->group = getegid(); + attribs->perms = 0644; + attribs->mask = PVFS_ATTR_SYS_ALL_SETABLE; + attribs->atime = time(NULL); + attribs->mtime = attribs->atime; + attribs->ctime = attribs->atime; +} + + +void ADIOI_PVFS2_makecredentials(PVFS_credentials * credentials) +{ + memset(credentials, 0, sizeof(PVFS_credentials)); + + PVFS_util_gen_credentials(credentials); +} + +int ADIOI_PVFS2_error_convert(int pvfs_error) +{ + switch(pvfs_error) + { + case PVFS_EPERM: + case PVFS_EACCES: + return MPI_ERR_ACCESS; + case PVFS_ENOENT: + case PVFS_ENXIO: + case PVFS_ENODEV: + return MPI_ERR_NO_SUCH_FILE; + case PVFS_EIO: + return MPI_ERR_IO; + case PVFS_EEXIST: + return MPI_ERR_FILE_EXISTS; + case PVFS_ENOTDIR: /* ??? */ + case PVFS_EISDIR: /* ??? */ + case PVFS_ENAMETOOLONG: + return MPI_ERR_BAD_FILE; + case PVFS_EINVAL: + return MPI_ERR_FILE; + case PVFS_EFBIG: /* ??? */ + case PVFS_ENOSPC: + return MPI_ERR_NO_SPACE; + case PVFS_EROFS: + return MPI_ERR_READ_ONLY; + case PVFS_ENOSYS: + return MPI_ERR_UNSUPPORTED_OPERATION; + /* PVFS does not support quotas */ + case EDQUOT: + return MPI_ERR_QUOTA; + case PVFS_ENOMEM: + return MPI_ERR_INTERN; + default: + return MPI_UNDEFINED; + } + +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.h b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.h new file mode 100644 index 0000000000..42c239adb7 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_common.h @@ -0,0 +1,35 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#ifndef _AD_PVFS2_h +#define _AD_PVFS2_H +#include "ad_pvfs2.h" + +/* useful values: + * 0: no debugging + * CLIENT_DEBUG: debug client state machines + */ +#define ADIOI_PVFS2_DEBUG_MASK 0 + + +struct ADIOI_PVFS2_fs_s { + PVFS_object_ref object_ref; + PVFS_credentials credentials; +} ADIOI_PVFS2_fs_s; + +typedef struct ADIOI_PVFS2_fs_s ADIOI_PVFS2_fs; + + +void ADIOI_PVFS2_Init(int *error_code ); +void ADIOI_PVFS2_makeattribs(PVFS_sys_attr * attribs); +void ADIOI_PVFS2_makecredentials(PVFS_credentials * credentials); +void ADIOI_PVFS2_End(int *error_code); +int ADIOI_PVFS2_End_call(MPI_Comm comm, int keyval, + void *attribute_val, void *extra_state); +int ADIOI_PVFS2_error_convert(int pvfs_error); + +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_delete.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_delete.c new file mode 100644 index 0000000000..1ab8582dca --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_delete.c @@ -0,0 +1,69 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2003 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs2.h" +#include "adio.h" + +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_Delete(char *filename, int *error_code) +{ + PVFS_credentials credentials; + PVFS_sysresp_getparent resp_getparent; + int ret; + PVFS_fs_id cur_fs; + static char myname[] = "ADIOI_PVFS2_DELETE"; + char pvfs_path[PVFS_NAME_MAX] = {0}; + + ADIOI_PVFS2_Init(error_code); + /* --BEGIN ERROR HANDLING-- */ + if (*error_code != MPI_SUCCESS) + { + /* ADIOI_PVFS2_INIT handles creating error codes itself */ + return; + } + /* --END ERROR HANDLING-- */ + + /* in most cases we'll store the credentials in the fs struct, but we don't + * have one of those in Delete */ + ADIOI_PVFS2_makecredentials(&credentials); + + /* given the filename, figure out which pvfs filesystem it is on */ + ret = PVFS_util_resolve(filename, &cur_fs, pvfs_path, PVFS_NAME_MAX); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_util_resolve", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ret = PVFS_sys_getparent(cur_fs, pvfs_path, &credentials, &resp_getparent); + + ret = PVFS_sys_remove(resp_getparent.basename, + resp_getparent.parent_ref, &credentials); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_remove", 0); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; + return; +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_fcntl.c new file mode 100644 index 0000000000..50142e824a --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_fcntl.c @@ -0,0 +1,59 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs2.h" +#include "adio_extern.h" +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, + int *error_code) +{ + int ret; + ADIOI_PVFS2_fs *pvfs_fs; + PVFS_sysresp_getattr resp_getattr; + static char myname[] = "ADIOI_PVFS2_FCNTL"; + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + ret = PVFS_sys_getattr(pvfs_fs->object_ref, PVFS_ATTR_SYS_SIZE, + &(pvfs_fs->credentials), &resp_getattr); + if (ret != 0 ) { + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_getattr", 0); + /* --END ERROR HANDLING-- */ + } + else { + *error_code = MPI_SUCCESS; + } + fcntl_struct->fsize = resp_getattr.attr.size; + return; + + case ADIO_FCNTL_SET_DISKSPACE: + ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); + break; + + /* --BEGIN ERROR HANDLING-- */ + 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); + /* --END ERROR HANDLING-- */ + } +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_features.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_features.c new file mode 100644 index 0000000000..71d99e67e8 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_features.c @@ -0,0 +1,16 @@ +#include "adio.h" +#include "ad_pvfs2.h" + +int ADIOI_PVFS2_Feature(ADIO_File fd, int flag) +{ + switch(flag) { + case ADIO_SCALABLE_OPEN: + return 1; + case ADIO_SHARED_FP: + case ADIO_LOCKS: + case ADIO_SEQUENTIAL: + case ADIO_DATA_SIEVING_WRITES: + default: + return 0; + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_flush.c new file mode 100644 index 0000000000..2caf3ac51c --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_flush.c @@ -0,0 +1,55 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs2.h" +#include "ad_pvfs2_common.h" + +/* we want to be a bit clever here: at scale, if every client sends a + * flush request, it will stress the PVFS2 servers with redundant + * PVFS_sys_flush requests. Instead, one process should wait for + * everyone to catch up, do the sync, then broadcast the result. We can + * get away with this thanks to PVFS2's stateless design + */ + +void ADIOI_PVFS2_Flush(ADIO_File fd, int *error_code) +{ + int ret, rank, dummy=0, dummy_in=0; + ADIOI_PVFS2_fs *pvfs_fs; + static char myname[] = "ADIOI_PVFS2_FLUSH"; + + *error_code = MPI_SUCCESS; + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + MPI_Comm_rank(fd->comm, &rank); + + + /* unlike ADIOI_PVFS2_Resize, MPI_File_sync() does not perform any + * syncronization */ + MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, + fd->hints->ranklist[0], fd->comm); + + /* io_worker computed in ADIO_Open */ + if (rank == fd->hints->ranklist[0]) { + ret = PVFS_sys_flush(pvfs_fs->object_ref, &(pvfs_fs->credentials)); + } + MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_flush", 0); + } + /* --END ERROR HANDLING-- */ +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c new file mode 100644 index 0000000000..5170e8afb7 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c @@ -0,0 +1,274 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include +#include "ad_pvfs2.h" + +void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) +{ + char *value; + int flag, tmp_value; + static char myname[] = "ADIOI_PVFS_SETINFO"; + + if ((fd->info) == MPI_INFO_NULL) { + /* part of the open call */ + MPI_Info_create(&(fd->info)); + ADIOI_Info_set(fd->info, "romio_pvfs2_debugmask", "0"); + fd->hints->fs_hints.pvfs2.debugmask = 0; + + ADIOI_Info_set(fd->info, "striping_factor", "0"); + fd->hints->striping_factor = 0; + + ADIOI_Info_set(fd->info, "striping_unit", "0"); + fd->hints->striping_unit = 0; + + /* disable the aggressive strided optimizations by default */ + ADIOI_Info_set(fd->info, "romio_pvfs2_posix_read", "disable"); + ADIOI_Info_set(fd->info, "romio_pvfs2_posix_write", "disable"); + fd->hints->fs_hints.pvfs2.posix_read = ADIOI_HINT_DISABLE; + fd->hints->fs_hints.pvfs2.posix_write = ADIOI_HINT_DISABLE; + + ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_read", "disable"); + ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_write", "disable"); + fd->hints->fs_hints.pvfs2.dtype_read = ADIOI_HINT_DISABLE; + fd->hints->fs_hints.pvfs2.dtype_write = ADIOI_HINT_DISABLE; + + ADIOI_Info_set(fd->info, "romio_pvfs2_listio_read", "disable"); + ADIOI_Info_set(fd->info, "romio_pvfs2_listio_write", "disable"); + fd->hints->fs_hints.pvfs2.listio_read = ADIOI_HINT_DISABLE; + fd->hints->fs_hints.pvfs2.listio_write = ADIOI_HINT_DISABLE; + + + /* any user-provided hints? */ + if (users_info != MPI_INFO_NULL) { + /* pvfs2 debugging */ + value = (char *) ADIOI_Malloc( (MPI_MAX_INFO_VAL+1)*sizeof(char)); + ADIOI_Info_get(users_info, "romio_pvfs2_debugmask", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + tmp_value = fd->hints->fs_hints.pvfs2.debugmask = + PVFS_debug_eventlog_to_mask(value); + + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_value != fd->hints->fs_hints.pvfs2.debugmask) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_pvfs2_debugmask", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(fd->info, "romio_pvfs2_debugmask", value); + } + + /* the striping factor */ + ADIOI_Info_get(users_info, "striping_factor", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + tmp_value = fd->hints->striping_factor = atoi(value); + + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_value != fd->hints->striping_factor) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "striping_factor", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(fd->info, "striping_factor", value); + } + + /* the striping unit */ + ADIOI_Info_get(users_info, "striping_unit", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + tmp_value = fd->hints->striping_unit = atoi(value); + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_value != fd->hints->striping_unit) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "striping_unit", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(fd->info, "striping_unit", value); + } + + /* distribution name */ + ADIOI_Info_get(users_info, "romio_pvfs2_distribution_name", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + } + + + /* POSIX read */ + ADIOI_Info_get(users_info, "romio_pvfs2_posix_read", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) + { + ADIOI_Info_set(fd->info, "romio_pvfs2_posix_read", value); + fd->hints->fs_hints.pvfs2.posix_read = ADIOI_HINT_ENABLE; + } + else if ( !strcmp(value, "disable") || + !strcmp(value, "DISABLE")) + { + ADIOI_Info_set(fd->info , "romio_pvfs2_posix_read", value); + fd->hints->fs_hints.pvfs2.posix_read = ADIOI_HINT_DISABLE; + } + tmp_value = fd->hints->fs_hints.pvfs2.posix_read; + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + if (tmp_value != fd->hints->fs_hints.pvfs2.posix_read) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "posix_read", + error_code); + return; + } + } + + /* POSIX write */ + ADIOI_Info_get(users_info, "romio_pvfs2_posix_write", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) + { + ADIOI_Info_set(fd->info, "romio_pvfs2_posix_write", value); + fd->hints->fs_hints.pvfs2.posix_write = ADIOI_HINT_ENABLE; + } + else if ( !strcmp(value, "disable") || + !strcmp(value, "DISABLE")) + { + ADIOI_Info_set(fd->info , "romio_pvfs2_posix_write", value); + fd->hints->fs_hints.pvfs2.posix_write = ADIOI_HINT_DISABLE; + } + tmp_value = fd->hints->fs_hints.pvfs2.posix_write; + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + if (tmp_value != fd->hints->fs_hints.pvfs2.posix_write) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "posix_write", + error_code); + return; + } + } + + /* Datatype read */ + ADIOI_Info_get(users_info, "romio_pvfs2_dtype_read", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) + { + ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_read", value); + fd->hints->fs_hints.pvfs2.dtype_read = ADIOI_HINT_ENABLE; + } + else if ( !strcmp(value, "disable") || + !strcmp(value, "DISABLE")) + { + ADIOI_Info_set(fd->info , "romio_pvfs2_dtype_read", value); + fd->hints->fs_hints.pvfs2.dtype_read = ADIOI_HINT_DISABLE; + } + tmp_value = fd->hints->fs_hints.pvfs2.dtype_read; + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + if (tmp_value != fd->hints->fs_hints.pvfs2.dtype_read) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "dtype_read", + error_code); + return; + } + } + + /* Datatype write */ + ADIOI_Info_get(users_info, "romio_pvfs2_dtype_write", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) + { + ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_write", value); + fd->hints->fs_hints.pvfs2.dtype_write = ADIOI_HINT_ENABLE; + } + else if ( !strcmp(value, "disable") || + !strcmp(value, "DISABLE")) + { + ADIOI_Info_set(fd->info , "romio_pvfs2_dtype_write", value); + fd->hints->fs_hints.pvfs2.dtype_write = ADIOI_HINT_DISABLE; + } + tmp_value = fd->hints->fs_hints.pvfs2.dtype_write; + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + if (tmp_value != fd->hints->fs_hints.pvfs2.dtype_write) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "dtype_write", + error_code); + return; + } + } + + /* Listio read */ + ADIOI_Info_get(users_info, "romio_pvfs2_listio_read", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) + { + ADIOI_Info_set(fd->info, "romio_pvfs2_listio_read", value); + fd->hints->fs_hints.pvfs2.listio_read = ADIOI_HINT_ENABLE; + } + else if ( !strcmp(value, "disable") || + !strcmp(value, "DISABLE")) + { + ADIOI_Info_set(fd->info , "romio_pvfs2_listio_read", value); + fd->hints->fs_hints.pvfs2.listio_read = ADIOI_HINT_DISABLE; + } + tmp_value = fd->hints->fs_hints.pvfs2.listio_read; + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + if (tmp_value != fd->hints->fs_hints.pvfs2.listio_read) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "listio_read", + error_code); + return; + } + } + + /* Datatype write */ + ADIOI_Info_get(users_info, "romio_pvfs2_listio_write", + MPI_MAX_INFO_VAL, value, &flag); + if (flag) { + if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE")) + { + ADIOI_Info_set(fd->info, "romio_pvfs2_listio_write", value); + fd->hints->fs_hints.pvfs2.listio_write = ADIOI_HINT_ENABLE; + } + else if ( !strcmp(value, "disable") || + !strcmp(value, "DISABLE")) + { + ADIOI_Info_set(fd->info , "romio_pvfs2_listio_write", value); + fd->hints->fs_hints.pvfs2.listio_write = ADIOI_HINT_DISABLE; + } + tmp_value = fd->hints->fs_hints.pvfs2.listio_write; + MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm); + if (tmp_value != fd->hints->fs_hints.pvfs2.listio_write) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "listio_write", + error_code); + return; + } + } + ADIOI_Free(value); + + } + } + /* set the values for collective I/O and data sieving parameters */ + ADIOI_GEN_SetInfo(fd, users_info, error_code); + + *error_code = MPI_SUCCESS; +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io.h b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io.h new file mode 100644 index 0000000000..dc1641ee1b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io.h @@ -0,0 +1,79 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 2006 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +/* Contig I/O helper prototypes */ + +#define READ 0 +#define WRITE 1 + +/* #define DEBUG_CONTIG */ +/* #define DEBUG_LIST */ +/* #define DEBUG_DTYPE */ + +/* Contig I/O helper prototypes */ +int ADIOI_PVFS2_Contig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code, int rw_type); + +/* List I/O helper prototypes */ +int ADIOI_PVFS2_StridedListIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code, int rw_type); + +int gen_listio_arr(ADIOI_Flatlist_node *flat_buf, + int *flat_buf_index_p, + int64_t *cur_flat_buf_reg_off_p, + int flat_buf_size, + int flat_buf_extent, + ADIOI_Flatlist_node *flat_file, + int *flat_file_index_p, + int64_t *cur_flat_file_reg_off_p, + int flat_file_size, + int flat_file_extent, + int max_ol_count, + ADIO_Offset disp, + int bytes_into_filetype, + int64_t *bytes_completed, + int64_t total_io_size, + int64_t buf_off_arr[], + int32_t buf_len_arr[], + int32_t *buf_ol_count_p, + int64_t file_off_arr[], + int32_t file_len_arr[], + int32_t *file_ol_count_p); + +void print_buf_file_ol_pairs(int64_t buf_off_arr[], + int32_t buf_len_arr[], + int32_t buf_ol_count, + int64_t file_off_arr[], + int32_t file_len_arr[], + int32_t file_ol_count, + void *buf, + int rw_type); + +/* Datatype I/O helper prototypes */ +int ADIOI_PVFS2_StridedDtypeIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code, int rw_type); + +int convert_named(MPI_Datatype *mpi_dtype, + PVFS_Request *pvfs_dtype, int combiner); + +void print_dtype_info(int combiner, + int num_int, + int num_addr, + int num_dtype, + int *arr_int, + MPI_Aint *arr_addr, + MPI_Datatype *arr_dtype); + +int convert_mpi_pvfs2_dtype(MPI_Datatype *mpi_dtype, + PVFS_Request *pvfs_dtype); + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c new file mode 100644 index 0000000000..ff625b53f8 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_dtype.c @@ -0,0 +1,720 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 2006 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" +#include "ad_pvfs2_io.h" +#include "ad_pvfs2_common.h" + +int ADIOI_PVFS2_StridedDtypeIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code, + int rw_type) +{ + int filetype_size = -1, ret = -1, filetype_is_contig = -1; + int num_filetypes = 0, cur_flat_file_reg_off = 0; + PVFS_Request tmp_mem_req, mem_req, tmp_file_req, file_req; + PVFS_sysresp_io resp_io; + ADIO_Offset off = -1, bytes_into_filetype = 0; + MPI_Aint filetype_extent = -1; + int etype_size = -1, i = -1; + PVFS_size pvfs_disp = -1; + ADIOI_Flatlist_node *flat_file_p = ADIOI_Flatlist; + + /* Use for offseting the PVFS2 filetype */ + int pvfs_blk = 1; + ADIOI_PVFS2_fs *pvfs_fs; + static char myname[] = "ADIOI_PVFS2_STRIDED_DTYPE"; + + memset(&tmp_mem_req, 0, sizeof(PVFS_Request)); + memset(&mem_req, 0, sizeof(PVFS_Request)); + memset(&tmp_file_req, 0, sizeof(PVFS_Request)); + memset(&file_req, 0, sizeof(PVFS_Request)); + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + /* changed below if error */ + *error_code = MPI_SUCCESS; + + /* datatype is the memory type + * fd->filetype is the file type */ + MPI_Type_size(fd->filetype, &filetype_size); + if (filetype_size == 0) { + *error_code = MPI_SUCCESS; + return -1; + } + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(fd->etype, &etype_size); + if (filetype_size == 0) { + *error_code = MPI_SUCCESS; + return -1; + } + + /* offset is in units of etype relative to the filetype. We + * convert this to off in terms of actual data bytes (the offset + * minus the number of bytes that are not used). We are allowed + * to do this since PVFS2 handles offsets with respect to a + * file_req in bytes, otherwise we would have to convert into a + * pure byte offset as is done in other methods. Explicit offset + * case is handled by using fd->disp and byte-converted off. */ + + pvfs_disp = fd->disp; + if (file_ptr_type == ADIO_INDIVIDUAL) + { + if (filetype_is_contig) + { + off = fd->fp_ind - fd->disp; + } + else + { + int flag = 0; + /* Should have already been flattened in ADIO_Open*/ + while (flat_file_p->type != fd->filetype) + { + flat_file_p = flat_file_p->next; + } + num_filetypes = -1; + while (!flag) + { + num_filetypes++; + for (i = 0; i < flat_file_p->count; i++) + { + /* Start on a non zero-length region */ + if (flat_file_p->blocklens[i]) + { + if (fd->disp + flat_file_p->indices[i] + + (num_filetypes * filetype_extent) + + flat_file_p->blocklens[i] > fd->fp_ind && + fd->disp + flat_file_p->indices[i] <= + fd->fp_ind) + { + cur_flat_file_reg_off = fd->fp_ind - + (fd->disp + flat_file_p->indices[i] + + (num_filetypes * filetype_extent)); + flag = 1; + break; + } + else + bytes_into_filetype += flat_file_p->blocklens[i]; + } + } + } + /* Impossible that we don't find it in this datatype */ + assert(i != flat_file_p->count); + off = bytes_into_filetype + cur_flat_file_reg_off; + } + } + else /* ADIO_EXPLICIT */ + { + off = etype_size * offset; + } + +#ifdef DEBUG_DTYPE + fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: (fd->fp_ind=%Ld,fd->disp=%Ld," + " offset=%Ld),(pvfs_disp=%Ld,off=%Ld)\n", + fd->fp_ind, fd->disp, offset, pvfs_disp, off); +#endif + + + /* Convert the MPI memory and file datatypes into + * PVFS2 datatypes */ + ret = convert_mpi_pvfs2_dtype(&datatype, &tmp_mem_req); + if (ret < 0) + { + goto error_state; + } + ret = convert_mpi_pvfs2_dtype(&(fd->filetype), &tmp_file_req); + if (ret < 0) + { + goto error_state; + } + + ret = PVFS_Request_contiguous(count, tmp_mem_req, &mem_req); + if (ret != 0) /* TODO: convert this to MPIO error handling */ + fprintf(stderr, "ADIOI_PVFS2_stridedDtypeIO: error in final" + " CONTIG memory type\n"); + PVFS_Request_free(&tmp_mem_req); + + /* pvfs_disp is used to offset the filetype */ + ret = PVFS_Request_hindexed(1, &pvfs_blk, &pvfs_disp, + tmp_file_req, &file_req); + if (ret != 0) + fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: error in final" + " HINDEXED file type\n"); + PVFS_Request_free(&tmp_file_req); + + if (rw_type == READ) + ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, off, buf, + mem_req, &(pvfs_fs->credentials), &resp_io); + else + ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, off, buf, + mem_req, &(pvfs_fs->credentials), &resp_io); + + if (ret != 0) { + fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: Warning - PVFS_sys_" + "read/write returned %d and completed %Ld bytes.\n", + ret, resp_io.total_completed); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_io \n", 0); + goto error_state; + } + + if (file_ptr_type == ADIO_INDIVIDUAL) + { + fd->fp_ind = off += resp_io.total_completed; + } + + error_state: + fd->fp_sys_posn = -1; /* set it to null. */ + + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + +#ifdef DEBUG_DTYPE + fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: " + "resp_io.total_completed=%Ld,ret=%d\n", + resp_io.total_completed, ret); +#endif + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, (int)resp_io.total_completed); + /* This is a temporary way of filling in status. The right way is to + * keep track of how much data was actually acccessed by + * ADIOI_BUFFERED operations */ +#endif + return ret; +} + +/* convert_mpi_pvfs2_dtype - Convert a MPI datatype into + * a PVFS2 datatype so that we can natively use the PVFS2 + * datatypes in the PVFS2 I/O calls instead of converting + * all datatypes to the hindexed method + * return 1 - a leaf node + * return 0 - normal return + * return -1 - problems */ + +int convert_mpi_pvfs2_dtype(MPI_Datatype *mpi_dtype, + PVFS_Request *pvfs_dtype) +{ + int num_int = -1, num_addr = -1, num_dtype = -1, + combiner = -1, i = -1, ret = -1, leaf = -1; + int *arr_int = NULL, *arr_addr = NULL; + MPI_Datatype *arr_dtype = NULL; + PVFS_Request *old_pvfs_dtype = NULL; + PVFS_Request *old_pvfs_dtype_arr = NULL; + int arr_count = -1; + PVFS_size *pvfs_arr_disp = NULL; + int *pvfs_arr_len = NULL; + + MPI_Type_get_envelope(*mpi_dtype, + &num_int, + &num_addr, + &num_dtype, + &combiner); + + /* Depending on type of datatype do the following + * operations */ + + if (combiner == MPI_COMBINER_NAMED) + { + convert_named(mpi_dtype, pvfs_dtype, combiner); + return 1; + } + + /* Allocate space for the arrays necessary for + * MPI_Type_get_contents */ + + if ((arr_int = ADIOI_Malloc(sizeof(int)*num_int)) == NULL) + { + fprintf(stderr, "Failed to allocate array_int\n"); + return -1; + } + if ((arr_addr = ADIOI_Malloc(sizeof(int)*num_addr)) == NULL) + { + ADIOI_Free(arr_int); + fprintf(stderr, "Failed to allocate array_addr\n"); + return -1; + } + if ((arr_dtype = ADIOI_Malloc(sizeof(MPI_Datatype)*num_dtype)) == NULL) + { + ADIOI_Free(arr_int); + ADIOI_Free(arr_addr); + fprintf(stderr, "Failed to allocate array_dtypes\n"); + return -1; + } + + MPI_Type_get_contents(*mpi_dtype, + num_int, + num_addr, + num_dtype, + arr_int, + arr_addr, + arr_dtype); + + /* If it's not a predefined datatype, it is either a + * derived datatype or a structured datatype */ + + if (combiner != MPI_COMBINER_STRUCT) + { + if ((old_pvfs_dtype = ADIOI_Malloc(sizeof(PVFS_Request))) == NULL) + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "Failed to allocate PVFS_Request\n"); + switch (combiner) + { + case MPI_COMBINER_CONTIGUOUS: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + ret = PVFS_Request_contiguous(arr_int[0], + *old_pvfs_dtype, pvfs_dtype); + break; + case MPI_COMBINER_VECTOR: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + ret = PVFS_Request_vector(arr_int[0], arr_int[1], + arr_int[2], *old_pvfs_dtype, + pvfs_dtype); + break; + case MPI_COMBINER_HVECTOR: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + ret = PVFS_Request_hvector(arr_int[0], arr_int[1], + arr_addr[0], *old_pvfs_dtype, + pvfs_dtype); + break; + /* Both INDEXED and HINDEXED types require PVFS_size + * address arrays. Therefore, we need to copy and + * convert the data from MPI_get_contents() into + * a PVFS_size buffer */ + case MPI_COMBINER_INDEXED: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + if ((pvfs_arr_disp = + ADIOI_Malloc(arr_int[0]*sizeof(PVFS_size))) == 0) + { + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "Failed to allocate pvfs_arr_disp\n"); + } + for (i = 0; i < arr_int[0]; i++) + { + pvfs_arr_disp[i] = + (PVFS_size) arr_int[arr_int[0]+1+i]; + } + ret = PVFS_Request_indexed(arr_int[0], &arr_int[1], + pvfs_arr_disp, + *old_pvfs_dtype, pvfs_dtype); + ADIOI_Free(pvfs_arr_disp); + break; + case MPI_COMBINER_HINDEXED: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + if ((pvfs_arr_disp = + ADIOI_Malloc(arr_int[0]*sizeof(PVFS_size))) == 0) + { + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "Failed to allocate pvfs_arr_disp\n"); + } + for (i = 0; i < arr_int[0]; i++) + { + pvfs_arr_disp[i] = + (PVFS_size) arr_addr[i]; + } + ret = PVFS_Request_hindexed(arr_int[0], &arr_int[1], + (int64_t *)&arr_addr[0], + *old_pvfs_dtype, pvfs_dtype); + ADIOI_Free(pvfs_arr_disp); + break; + case MPI_COMBINER_DUP: + leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype); + ret = PVFS_Request_contiguous(1, + *old_pvfs_dtype, pvfs_dtype); + + break; + case MPI_COMBINER_INDEXED_BLOCK: + /* No native PVFS2 support for this operation currently */ + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "INDEXED_BLOCK is unsupported\n"); + break; + case MPI_COMBINER_HINDEXED_INTEGER: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "HINDEXED_INTEGER is unsupported\n"); + break; + case MPI_COMBINER_STRUCT_INTEGER: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "STRUCT_INTEGER is unsupported\n"); + break; + case MPI_COMBINER_SUBARRAY: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "SUBARRAY is unsupported\n"); + break; + case MPI_COMBINER_DARRAY: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "DARRAY is unsupported\n"); + break; + case MPI_COMBINER_F90_REAL: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "F90_REAL is unsupported\n"); + break; + case MPI_COMBINER_F90_COMPLEX: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "F90_COMPLEX is unsupported\n"); + break; + case MPI_COMBINER_F90_INTEGER: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "F90_INTEGER is unsupported\n"); + break; + case MPI_COMBINER_RESIZED: + ADIOI_Free(old_pvfs_dtype); + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "RESIZED is unsupported\n"); + break; + default: + break; + } + + if (ret != 0) + fprintf(stderr, "Error in PVFS_Request_* " + "for a derived datatype\n"); + +#ifdef DEBUG_DTYPE + print_dtype_info(combiner, + num_int, + num_addr, + num_dtype, + arr_int, + arr_addr, + arr_dtype); +#endif + + if (leaf != 1 && combiner != MPI_COMBINER_DUP) + MPI_Type_free(&arr_dtype[0]); + + ADIOI_Free(arr_int); + ADIOI_Free(arr_addr); + ADIOI_Free(arr_dtype); + + PVFS_Request_free(old_pvfs_dtype); + ADIOI_Free(old_pvfs_dtype); + + return ret; + } + else /* MPI_COMBINER_STRUCT */ + { + MPI_Aint mpi_lb = -1, mpi_extent = -1; + PVFS_offset pvfs_lb = -1; + PVFS_size pvfs_extent = -1; + int has_lb_ub = 0; + + /* When converting into a PVFS_Request_struct, we no longer + * can use MPI_LB and MPI_UB. Therfore, we have to do the + * following. + * We simply ignore all the MPI_LB and MPI_UB types and + * get the lb and extent and pass it on through a + * PVFS resized_req */ + + arr_count = 0; + for (i = 0; i < arr_int[0]; i++) + { + if (arr_dtype[i] != MPI_LB && + arr_dtype[i] != MPI_UB) + { + arr_count++; + } + } + + if (arr_int[0] != arr_count) + { + MPI_Type_get_extent(*mpi_dtype, &mpi_lb, &mpi_extent); + pvfs_lb = mpi_lb; + pvfs_extent = mpi_extent; + if ((pvfs_arr_len = ADIOI_Malloc(arr_count*sizeof(int))) + == NULL) + { + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "Failed to allocate pvfs_arr_len\n"); + } + has_lb_ub = 1; + } + + if ((old_pvfs_dtype_arr + = ADIOI_Malloc(arr_count*sizeof(PVFS_Request))) == NULL) + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "Failed to allocate PVFS_Requests\n"); + + if ((pvfs_arr_disp = ADIOI_Malloc(arr_count*sizeof(PVFS_size))) + == NULL) + { + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "Failed to allocate pvfs_arr_disp\n"); + } + + arr_count = 0; + for (i = 0; i < arr_int[0]; i++) + { + if (arr_dtype[i] != MPI_LB && + arr_dtype[i] != MPI_UB) + { + leaf = convert_mpi_pvfs2_dtype( + &arr_dtype[i], &old_pvfs_dtype_arr[arr_count]); + if (leaf != 1) + MPI_Type_free(&arr_dtype[i]); + pvfs_arr_disp[arr_count] = + (PVFS_size) arr_addr[i]; + if (has_lb_ub) + { + pvfs_arr_len[arr_count] = + arr_int[i+1]; + } + arr_count++; + } + } + + /* If a MPI_UB or MPI_LB did exist, we have to + * resize the datatype */ + if (has_lb_ub) + { + PVFS_Request *tmp_pvfs_dtype = NULL; + if ((tmp_pvfs_dtype = ADIOI_Malloc(sizeof(PVFS_Request))) == NULL) + fprintf(stderr, "convert_mpi_pvfs2_dtype: " + "Failed to allocate PVFS_Request\n"); + + ret = PVFS_Request_struct(arr_count, pvfs_arr_len, + pvfs_arr_disp, + old_pvfs_dtype_arr, tmp_pvfs_dtype); + if (ret != 0) + fprintf(stderr, "Error in PVFS_Request_struct\n"); + + arr_count = 0; + for (i = 0; i < arr_int[0]; i++) + { + if (arr_dtype[i] != MPI_LB && + arr_dtype[i] != MPI_UB) + { + PVFS_Request_free(&old_pvfs_dtype_arr[arr_count]); + arr_count++; + } + } + +#ifdef DEBUG_DTYPE + fprintf(stderr, "STRUCT(WITHOUT %d LB or UB)(%d,[", + arr_int[0] - arr_count, arr_count); + for (i = 0; i < arr_count; i++) + fprintf(stderr, "(%d,%Ld) ", + pvfs_arr_len[i], + pvfs_arr_disp[i]); + fprintf(stderr, "]\n"); + fprintf(stderr, "RESIZED(LB = %Ld, EXTENT = %Ld)\n", + pvfs_lb, pvfs_extent); +#endif + ret = PVFS_Request_resized(*tmp_pvfs_dtype, + pvfs_lb, pvfs_extent, pvfs_dtype); + if (ret != 0) + fprintf(stderr, "Error in PVFS_Request_resize\n"); + + PVFS_Request_free(tmp_pvfs_dtype); + ADIOI_Free(tmp_pvfs_dtype); + } + else /* No MPI_LB or MPI_UB datatypes */ + { + ret = PVFS_Request_struct(arr_int[0], &arr_int[1], + pvfs_arr_disp, + old_pvfs_dtype_arr, pvfs_dtype); + if (ret != 0) + fprintf(stderr, "Error in PVFS_Request_struct\n"); + + for (i = 0; i < arr_int[0]; i++) + { + if (arr_dtype[i] != MPI_LB && + arr_dtype[i] != MPI_UB) + PVFS_Request_free(&old_pvfs_dtype_arr[i]); + } + +#ifdef DEBUG_DTYPE + print_dtype_info(combiner, + num_int, + num_addr, + num_dtype, + arr_int, + arr_addr, + arr_dtype); +#endif + } + + ADIOI_Free(arr_int); + ADIOI_Free(arr_addr); + ADIOI_Free(arr_dtype); + + ADIOI_Free(old_pvfs_dtype_arr); + ADIOI_Free(pvfs_arr_disp); + ADIOI_Free(pvfs_arr_len); + + return ret; + } + + /* Shouldn't have gotten here */ + fprintf(stderr, "convert_mpi_pvfs2_dtype: SERIOUS ERROR\n"); + return -1; +} + +int convert_named(MPI_Datatype *mpi_dtype, + PVFS_Request *pvfs_dtype, int combiner) +{ + int ret = -1; +#ifdef DEBUG_DTYPE + fprintf(stderr, "NAMED"); +#endif + + switch (*mpi_dtype) + { + case MPI_CHAR: + ret = PVFS_Request_contiguous(1, PVFS_CHAR, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_CHAR\n"); +#endif + break; + case MPI_BYTE: + ret = PVFS_Request_contiguous(1, PVFS_BYTE, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_BYTE\n"); +#endif + break; + case MPI_SHORT: + ret = PVFS_Request_contiguous(1, PVFS_SHORT, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_SHORT\n"); +#endif + break; + case MPI_INT: + ret = PVFS_Request_contiguous(1, PVFS_INT, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_INT\n"); +#endif + break; + case MPI_LONG: + ret = PVFS_Request_contiguous(1, PVFS_LONG, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_LONG\n"); +#endif + break; + case MPI_FLOAT: + ret = PVFS_Request_contiguous(1, PVFS_FLOAT, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_FLOAT\n"); +#endif + break; + case MPI_DOUBLE: + ret = PVFS_Request_contiguous(1, PVFS_DOUBLE, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_DOUBLE\n"); +#endif + break; + case MPI_UNSIGNED_CHAR: + ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED_CHAR, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_UNSIGNED_CHAR\n"); +#endif + break; + case MPI_UNSIGNED_SHORT: + ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_UNSIGNED_SHORT\n"); +#endif + break; + case MPI_UNSIGNED: + ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_SHORT\n"); +#endif + break; + case MPI_UNSIGNED_LONG: + ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED_LONG, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_UNSIGNED_LONG\n"); +#endif + break; + case MPI_LONG_DOUBLE: + ret = PVFS_Request_contiguous(1, PVFS_LONG_DOUBLE, pvfs_dtype); +#ifdef DEBUG_DTYPE + fprintf(stderr, "-MPI_LONG_DOUBLE\n"); +#endif + break; + default: + fprintf(stderr, "convert_named: predefined type not found"); + return -1; + break; + } + if (ret != 0) + fprintf(stderr, "convert_named: Datatype creation failed\n"); + return ret; +} + +void print_dtype_info(int combiner, + int num_int, + int num_addr, + int num_dtype, + int *arr_int, + MPI_Aint *arr_addr, + MPI_Datatype *arr_dtype) +{ + int i = -1; + switch (combiner) + { + case MPI_COMBINER_CONTIGUOUS: + fprintf(stderr, "CONTIG(%d)\n", arr_int[0]); + break; + case MPI_COMBINER_VECTOR: + fprintf(stderr, "VECTOR(%d,%d,%d)\n", + arr_int[0], arr_int[1], arr_int[2]); + break; + case MPI_COMBINER_HVECTOR: + fprintf(stderr, "HVECTOR(%d,%d,%d)\n", + arr_int[0], arr_int[1],arr_addr[0]); + break; + case MPI_COMBINER_INDEXED: + fprintf(stderr, "INDEXED(%d,[", + arr_int[0]); + for (i = 0; i < arr_int[0]; i++) + fprintf(stderr, "(%d,%Ld) ", + arr_int[1+i], + (int64_t) arr_int[arr_int[0]+1+i]); + fprintf(stderr, "]\n"); + break; + case MPI_COMBINER_HINDEXED: + fprintf(stderr, "HINDEXED(%d,[", + arr_int[0]); + for (i = 0; i < arr_int[0]; i++) + fprintf(stderr, "(%d,%Ld) ", + arr_int[1+i], + (int64_t) arr_addr[i]); + fprintf(stderr, "]\n"); + break; + case MPI_COMBINER_STRUCT: + fprintf(stderr, "STRUCT(%d,[", + arr_int[0]); + for (i = 0; i < arr_int[0]; i++) + fprintf(stderr, "(%d,%Ld) ", + arr_int[1+i], + (int64_t) arr_addr[i]); + fprintf(stderr, "]\n"); + break; + case MPI_COMBINER_DUP: + fprintf(stderr, "DUP\n"); + break; + default: + fprintf(stderr, "no available information on this datatype"); + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c new file mode 100644 index 0000000000..38cc63e3e1 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_io_list.c @@ -0,0 +1,665 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 2006 Unknown (TODO: fix this) + */ + +#include +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" +#include "ad_pvfs2_io.h" +#include "ad_pvfs2_common.h" + +#define COALESCE_REGIONS /* TODO: would we ever want to *not* coalesce? */ +#define MAX_OL_COUNT 64 +int ADIOI_PVFS2_StridedListIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code, int rw_type) +{ + /* list I/O parameters */ + int i = -1, ret = -1; + int tmp_filetype_size = -1; + int64_t cur_io_size = 0, io_size = 0; + int etype_size = -1; + int num_etypes_in_filetype = -1, num_filetypes = -1; + int etypes_in_filetype = -1, size_in_filetype = -1; + int bytes_into_filetype = 0; + MPI_Offset total_bytes_accessed = 0; + + /* parameters for offset-length pairs arrays */ + int64_t buf_off_arr[MAX_OL_COUNT]; + int32_t buf_len_arr[MAX_OL_COUNT]; + int64_t file_off_arr[MAX_OL_COUNT]; + int32_t file_len_arr[MAX_OL_COUNT]; + int32_t buf_ol_count = 0; + int32_t file_ol_count = 0; + + /* parameters for flattened memory and file datatypes*/ + int flat_buf_index = 0; + int flat_file_index = 0; + int64_t cur_flat_buf_reg_off = 0; + int64_t cur_flat_file_reg_off = 0; + ADIOI_Flatlist_node *flat_buf_p, *flat_file_p; + int buftype_size = -1, buftype_extent = -1, + filetype_size = -1, filetype_extent = -1; + int buftype_is_contig = -1, filetype_is_contig = -1; + + /* PVFS2 specific parameters */ + PVFS_Request mem_req, file_req; + ADIOI_PVFS2_fs * pvfs_fs; + PVFS_sysresp_io resp_io; + static char myname[] = "ADIOI_PVFS2_STRIDED_LISTIO"; + + if (fd->atomicity) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "Atomic noncontiguous writes" + " are not supported by PVFS2", 0); + return -1; + } + + MPI_Type_size(fd->filetype, &filetype_size); + if (filetype_size == 0) { + *error_code = MPI_SUCCESS; + return -1; + } + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + io_size = buftype_size*count; + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + /* Flatten the memory datatype + * (file datatype has already been flattened in ADIO open + * unless it is contibuous, then we need to flatten it manually) + * and set the correct buffers for flat_buf and flat_file */ + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + if (buftype_is_contig == 0) + { + ADIOI_Flatten_datatype(datatype); + flat_buf_p = ADIOI_Flatlist; + while (flat_buf_p->type != datatype) + flat_buf_p = flat_buf_p->next; + } + else + { + /* flatten and add to the list */ + flat_buf_p = (ADIOI_Flatlist_node *) ADIOI_Malloc + (sizeof(ADIOI_Flatlist_node)); + flat_buf_p->blocklens = (ADIO_Offset*)ADIOI_Malloc(sizeof(ADIO_Offset)); + flat_buf_p->indices = + (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset)); + /* For the buffer, we can optimize the buftype, this is not + * possible with the filetype since it is tiled */ + buftype_size = buftype_size*count; + buftype_extent = buftype_size*count; + flat_buf_p->blocklens[0] = buftype_size; + flat_buf_p->indices[0] = 0; + flat_buf_p->count = 1; + } + if (filetype_is_contig == 0) + { + /* TODO: why does avery say this should already have been + * flattened in Open, but also says contig types don't get + * flattened */ + ADIOI_Flatten_datatype(fd->filetype); + flat_file_p = ADIOI_Flatlist; + while (flat_file_p->type != fd->filetype) + flat_file_p = flat_file_p->next; + } + else + { + /* flatten and add to the list */ + flat_file_p = (ADIOI_Flatlist_node *) ADIOI_Malloc + (sizeof(ADIOI_Flatlist_node)); + flat_file_p->blocklens =(ADIO_Offset*)ADIOI_Malloc(sizeof(ADIO_Offset)); + flat_file_p->indices = + (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset)); + flat_file_p->blocklens[0] = filetype_size; + flat_file_p->indices[0] = 0; + flat_file_p->count = 1; + } + + /* Find out where we are in the flattened filetype (the block index, + * how far into the block, and how many bytes_into_filetype) + * If the file_ptr_type == ADIO_INDIVIDUAL we will use disp, fp_ind + * to figure this out (offset should always be zero) + * If file_ptr_type == ADIO_EXPLICIT, we will use disp and offset + * to figure this out. */ + + etype_size = fd->etype_size; + num_etypes_in_filetype = filetype_size / etype_size; + if (file_ptr_type == ADIO_INDIVIDUAL) + { + int flag = 0; + /* Should have already been flattened in ADIO_Open*/ + num_filetypes = -1; + while (!flag) + { + num_filetypes++; + for (i = 0; i < flat_file_p->count; i++) + { + /* Start on a non zero-length region */ + if (flat_file_p->blocklens[i]) + { + if (fd->disp + flat_file_p->indices[i] + + (num_filetypes * filetype_extent) + + flat_file_p->blocklens[i] > fd->fp_ind && + fd->disp + flat_file_p->indices[i] <= + fd->fp_ind) + { + flat_file_index = i; + cur_flat_file_reg_off = fd->fp_ind - + (fd->disp + flat_file_p->indices[i] + + (num_filetypes * filetype_extent)); + flag = 1; + break; + } + else + bytes_into_filetype += flat_file_p->blocklens[i]; + } + } + } + /* Impossible that we don't find it in this datatype */ + assert(i != flat_file_p->count); + } + else + { + num_filetypes = (int) (offset / num_etypes_in_filetype); + etypes_in_filetype = (int) (offset % num_etypes_in_filetype); + size_in_filetype = etypes_in_filetype * etype_size; + + tmp_filetype_size = 0; + for (i=0; icount; i++) { + tmp_filetype_size += flat_file_p->blocklens[i]; + if (tmp_filetype_size > size_in_filetype) + { + flat_file_index = i; + cur_flat_file_reg_off = flat_file_p->blocklens[i] - + (tmp_filetype_size - size_in_filetype); + bytes_into_filetype = offset * filetype_size - + flat_file_p->blocklens[i]; + break; + } + } + } +#ifdef DEBUG_LIST + fprintf(stderr, "ADIOI_PVFS2_StridedListIO: (fd->fp_ind=%Ld,fd->disp=%Ld," + " offset=%Ld)\n(flat_file_index=%d,cur_flat_file_reg_off=%Ld," + "bytes_into_filetype=%d)\n", + fd->fp_ind, fd->disp, offset, flat_file_index, + cur_flat_file_reg_off, bytes_into_filetype); +#endif +#ifdef DEBUG_LIST2 + fprintf(stderr, "flat_buf:\n"); + for (i = 0; i < flat_buf_p->count; i++) + fprintf(stderr, "(offset, length) = (%Ld, %d)\n", + flat_buf_p->indices[i], + flat_buf_p->blocklens[i]); + fprintf(stderr, "flat_file:\n"); + for (i = 0; i < flat_file_p->count; i++) + fprintf(stderr, "(offset, length) = (%Ld, %d)\n", + flat_file_p->indices[i], + flat_file_p->blocklens[i]); +#endif + + /* total data written */ + cur_io_size = 0; + while (cur_io_size != io_size) + { + /* Initialize the temporarily unrolling lists and + * and associated variables */ + buf_ol_count = 0; + file_ol_count = 0; + for (i = 0; i < MAX_OL_COUNT; i++) + { + buf_off_arr[i] = 0; + buf_len_arr[i] = 0; + file_off_arr[i] = 0; + file_len_arr[i] = 0; + } + + /* Generate the offset-length pairs for a + * list I/O operation */ + gen_listio_arr(flat_buf_p, + &flat_buf_index, + &cur_flat_buf_reg_off, + buftype_size, + buftype_extent, + flat_file_p, + &flat_file_index, + &cur_flat_file_reg_off, + filetype_size, + filetype_extent, + MAX_OL_COUNT, + fd->disp, + bytes_into_filetype, + &cur_io_size, + io_size, + buf_off_arr, + buf_len_arr, + &buf_ol_count, + file_off_arr, + file_len_arr, + &file_ol_count); + + assert(buf_ol_count <= MAX_OL_COUNT); + assert(file_ol_count <= MAX_OL_COUNT); +#ifdef DEBUG_LIST2 + print_buf_file_ol_pairs(buf_off_arr, + buf_len_arr, + buf_ol_count, + file_off_arr, + file_len_arr, + file_ol_count, + buf, + rw_type); +#endif +#ifdef DEBUG_LIST2 + do { + int y, z; + fprintf(stderr, "ad_pvfs2_io_list.c::\n"); + for (y = 0; y < buf_ol_count; y++) + { + for (z = 0; z < buf_len_arr[y]; z++) + { + fprintf(stderr, "buf[%d][%d]=%c\n", + y, z, ((char *) buf + buf_off_arr[y])[z]); + } + } + } while (0); +#endif + + /* Run list I/O operation */ + ret = PVFS_Request_hindexed(buf_ol_count, buf_len_arr, + buf_off_arr, PVFS_BYTE, &mem_req); + + ret = PVFS_Request_hindexed(file_ol_count, file_len_arr, + file_off_arr, PVFS_BYTE, &file_req); + if (rw_type == READ) + { + ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, + buf, mem_req, + &(pvfs_fs->credentials), &resp_io); + } + else + { + ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, + buf, mem_req, + &(pvfs_fs->credentials), &resp_io); + } + if (ret != 0) + { + fprintf(stderr, "ADIOI_PVFS2_StridedListIO: Warning - PVFS_sys_" + "read/write returned %d and completed %Ld bytes.\n", + ret, resp_io.total_completed); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_io \n", 0); + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + goto error_state; + } + total_bytes_accessed += resp_io.total_completed; + + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + } + +#ifdef DEBUG_LIST + fprintf(stderr, "ADIOI_PVFS2_StridedListIO: " + "total_bytes_accessed=%Ld,ret=%d\n", + total_bytes_accessed, ret); +#endif + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += total_bytes_accessed; + *error_code = MPI_SUCCESS; + +error_state: +#ifdef HAVE_STATUS_SET_BYTES + /* TODO: why the cast? */ + MPIR_Status_set_bytes(status, datatype, (int)total_bytes_accessed); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + if (buftype_is_contig == 0) + ADIOI_Delete_flattened(datatype); + else + { + ADIOI_Free(flat_buf_p->blocklens); + ADIOI_Free(flat_buf_p->indices); + ADIOI_Free(flat_buf_p); + } + + if (filetype_is_contig == 0) + ADIOI_Delete_flattened(fd->filetype); + else + { + ADIOI_Free(flat_file_p->blocklens); + ADIOI_Free(flat_file_p->indices); + ADIOI_Free(flat_file_p); + } + + return 0; +} + +/* To do: Fix the code to coalesce the offset-length pairs for memory + * and file. */ + +/* gen_listio_arr - fills in offset-length pairs for memory and file + * for list I/O */ +int gen_listio_arr(ADIOI_Flatlist_node *flat_buf_p, + int *flat_buf_index_p, + int64_t *cur_flat_buf_reg_off_p, + int flat_buf_size, + int flat_buf_extent, + ADIOI_Flatlist_node *flat_file_p, + int *flat_file_index_p, + int64_t *cur_flat_file_reg_off_p, + int flat_file_size, + int flat_file_extent, + int max_ol_count, + ADIO_Offset disp, + int bytes_into_filetype, + int64_t *bytes_completed, + int64_t total_io_size, + int64_t buf_off_arr[], + int32_t buf_len_arr[], + int32_t *buf_ol_count_p, + int64_t file_off_arr[], + int32_t file_len_arr[], + int32_t *file_ol_count_p) +{ + int region_size = -1; + + /* parameters for flattened memory and file datatypes*/ + int64_t cur_flat_buf_reg_left = 0; + int64_t cur_flat_file_reg_left = 0; + +#ifdef DEBUG_LIST2 + fprintf(stderr, "gen_list_arr:\n"); +#endif + + if ((*buf_ol_count_p) != 0 ||(*file_ol_count_p) != 0) + { + fprintf(stderr, "buf_ol_count != 0 || file_ol_count != 0\n"); + return -1; + } + + /* Start on a non-zero memory and file region + * Note this does not affect the bytes_completed + * since no data is in these regions. Initialize the + * first memory and file offsets. */ + while (flat_buf_p->blocklens[(*flat_buf_index_p)] == 0) + { + (*flat_buf_index_p) = ((*flat_buf_index_p) + 1) % + flat_buf_p->count; + } + buf_off_arr[*buf_ol_count_p] = + (*bytes_completed / flat_buf_size) * + flat_buf_extent + + flat_buf_p->indices[*flat_buf_index_p] + + *cur_flat_buf_reg_off_p; + buf_len_arr[*buf_ol_count_p] = 0; + + while (flat_file_p->blocklens[(*flat_file_index_p)] == 0) + { + (*flat_file_index_p) = ((*flat_file_index_p) + 1) % + flat_file_p->count; + } + file_off_arr[*file_ol_count_p] = disp + + (((bytes_into_filetype + *bytes_completed) / flat_file_size) * + flat_file_extent) + + flat_file_p->indices[*flat_file_index_p] + + *cur_flat_file_reg_off_p; + file_len_arr[*file_ol_count_p] = 0; + +#ifdef DEBUG_LIST2 + fprintf(stderr, "initial buf_off_arr[%d] = %Ld\n", *buf_ol_count_p, + buf_off_arr[*buf_ol_count_p]); + fprintf(stderr, "initial file_off_arr[%d] = %Ld\n", *file_ol_count_p, + file_off_arr[*file_ol_count_p]); +#endif + + while (*bytes_completed != total_io_size + && (*buf_ol_count_p) < max_ol_count + && (*file_ol_count_p) < max_ol_count) + { + /* How much data is left in the current piece in + * the flattened datatypes */ + cur_flat_buf_reg_left = flat_buf_p->blocklens[*flat_buf_index_p] + - *cur_flat_buf_reg_off_p; + cur_flat_file_reg_left = flat_file_p->blocklens[*flat_file_index_p] + - *cur_flat_file_reg_off_p; + +#ifdef DEBUG_LIST2 + fprintf(stderr, + "flat_buf_index=%d flat_buf->blocklens[%d]=%d\n" + "cur_flat_buf_reg_left=%Ld " + "*cur_flat_buf_reg_off_p=%Ld\n" + "flat_file_index=%d flat_file->blocklens[%d]=%d\n" + "cur_flat_file_reg_left=%Ld " + "*cur_flat_file_reg_off_p=%Ld\n" + "bytes_completed=%Ld\n" + "buf_ol_count=%d file_ol_count=%d\n" + "buf_len_arr[%d]=%d file_len_arr[%d]=%d\n\n", + *flat_buf_index_p, *flat_buf_index_p, + flat_buf_p->blocklens[*flat_buf_index_p], + cur_flat_buf_reg_left, + *cur_flat_buf_reg_off_p, + *flat_file_index_p, *flat_file_index_p, + flat_file_p->blocklens[*flat_file_index_p], + cur_flat_file_reg_left, + *cur_flat_file_reg_off_p, + *bytes_completed, + *buf_ol_count_p, *file_ol_count_p, + *buf_ol_count_p, + buf_len_arr[*buf_ol_count_p], + *file_ol_count_p, + file_len_arr[*file_ol_count_p]); +#endif + + /* What is the size of the next contiguous region agreed + * upon by both memory and file regions that does not + * surpass the file size */ + if (cur_flat_buf_reg_left > cur_flat_file_reg_left) + region_size = cur_flat_file_reg_left; + else + region_size = cur_flat_buf_reg_left; + + if (region_size > total_io_size - *bytes_completed) + region_size = total_io_size - *bytes_completed; + + /* Add this piece to both the mem and file arrays + * coalescing offset-length pairs if possible and advance + * the pointers through the flatten mem and file datatypes + * as well Note: no more than a single piece can be done + * since we take the smallest one possible */ + + if (cur_flat_buf_reg_left == region_size) + { +#ifdef DEBUG_LIST2 + fprintf(stderr, "reached end of memory block...\n"); +#endif + (*flat_buf_index_p) = ((*flat_buf_index_p) + 1) % + flat_buf_p->count; + while (flat_buf_p->blocklens[(*flat_buf_index_p)] == 0) + { + (*flat_buf_index_p) = ((*flat_buf_index_p) + 1) % + flat_buf_p->count; + } + *cur_flat_buf_reg_off_p = 0; + +#ifdef COALESCE_REGIONS + if (*buf_ol_count_p != 0) + { + if (buf_off_arr[(*buf_ol_count_p) - 1] + + buf_len_arr[(*buf_ol_count_p) - 1] == + buf_off_arr[*buf_ol_count_p]) + { + buf_len_arr[(*buf_ol_count_p) - 1] += + region_size; + } + else + { + buf_len_arr[*buf_ol_count_p] += region_size; + (*buf_ol_count_p)++; + } + } + else + { +#endif + buf_len_arr[*buf_ol_count_p] += region_size; + (*buf_ol_count_p)++; +#ifdef COALESCE_REGIONS + } +#endif + + /* Don't prepare for the next piece if we have reached + * the limit or else it will segment fault. */ + if ((*buf_ol_count_p) != max_ol_count) + { + buf_off_arr[*buf_ol_count_p] = + ((*bytes_completed + region_size) / flat_buf_size) * + flat_buf_extent + + flat_buf_p->indices[*flat_buf_index_p] + + (*cur_flat_buf_reg_off_p); + buf_len_arr[*buf_ol_count_p] = 0; + } + } + else if (cur_flat_buf_reg_left > region_size) + { +#ifdef DEBUG_LIST2 + fprintf(stderr, "advanced %d in memory block...\n", + region_size); +#endif + (*cur_flat_buf_reg_off_p) += region_size; + buf_len_arr[*buf_ol_count_p] += region_size; + } + else + { + fprintf(stderr, "gen_listio_arr: Error\n"); + } + + /* To calculate the absolute file offset we need to + * add the disp, how many filetypes we have gone through, + * the relative block offset in the filetype and how far + * into the block we have gone. */ + if (cur_flat_file_reg_left == region_size) + { +#ifdef DEBUG_LIST2 + fprintf(stderr, "reached end of file block...\n"); +#endif + (*flat_file_index_p) = ((*flat_file_index_p) + 1) % + flat_file_p->count; + while (flat_file_p->blocklens[(*flat_file_index_p)] == 0) + { + (*flat_file_index_p) = ((*flat_file_index_p) + 1) % + flat_file_p->count; + } + (*cur_flat_file_reg_off_p) = 0; + +#ifdef COALESCE_REGIONS + if (*file_ol_count_p != 0) + { + if (file_off_arr[(*file_ol_count_p) - 1] + + file_len_arr[(*file_ol_count_p) - 1] == + file_off_arr[*file_ol_count_p]) + { + file_len_arr[(*file_ol_count_p) - 1] += + region_size; + } + else + { + file_len_arr[*file_ol_count_p] += region_size; + (*file_ol_count_p)++; + } + } + else + { +#endif + file_len_arr[*file_ol_count_p] += region_size; + (*file_ol_count_p)++; +#ifdef COALESCE_REGIONS + } +#endif + + /* Don't prepare for the next piece if we have reached + * the limit or else it will segment fault. */ + if ((*file_ol_count_p) != max_ol_count) + { + file_off_arr[*file_ol_count_p] = disp + + (((bytes_into_filetype + *bytes_completed + region_size) + / flat_file_size) * + flat_file_extent) + + flat_file_p->indices[*flat_file_index_p] + + (*cur_flat_file_reg_off_p); + file_len_arr[*file_ol_count_p] = 0; + } + } + else if (cur_flat_file_reg_left > region_size) + { +#ifdef DEBUG_LIST2 + fprintf(stderr, "advanced %d in file block...\n", + region_size); +#endif + (*cur_flat_file_reg_off_p) += region_size; + file_len_arr[*file_ol_count_p] += region_size; + } + else + { + fprintf(stderr, "gen_listio_arr: Error\n"); + } +#ifdef DEBUG_LIST2 + fprintf(stderr, + "------------------------------\n\n"); +#endif + *bytes_completed += region_size; + } + /* Increment the count if we stopped in the middle of a + * memory or file region */ + if (*cur_flat_buf_reg_off_p != 0) + (*buf_ol_count_p)++; + if (*cur_flat_file_reg_off_p != 0) + (*file_ol_count_p)++; + + return 0; +} + +void print_buf_file_ol_pairs(int64_t buf_off_arr[], + int32_t buf_len_arr[], + int32_t buf_ol_count, + int64_t file_off_arr[], + int32_t file_len_arr[], + int32_t file_ol_count, + void *buf, + int rw_type) +{ + int i = -1; + + fprintf(stderr, "buf_ol_pairs(offset,length) count = %d\n", + buf_ol_count); + for (i = 0; i < buf_ol_count; i++) + { + fprintf(stderr, "(%Ld, %d) ", buf_off_arr[i], buf_len_arr[i]); + } + fprintf(stderr, "\n"); + + fprintf(stderr, "file_ol_pairs(offset,length) count = %d\n", + file_ol_count); + for (i = 0; i < file_ol_count; i++) + { + fprintf(stderr, "(%Ld, %d) ", file_off_arr[i], file_len_arr[i]); + } + fprintf(stderr, "\n\n"); + +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_open.c new file mode 100644 index 0000000000..1175fe252f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_open.c @@ -0,0 +1,246 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs2.h" +#include "ad_pvfs2_common.h" + +/* open_status is helpful for bcasting values around */ +struct open_status_s { + int error; + PVFS_object_ref object_ref; +}; +typedef struct open_status_s open_status; + + /* steps for getting a handle: (it gets a little convoluted, but at least + * it's deterministic) + * . lookup the file. + * . if lookup succeeds, but we were passed MPI_MODE_EXCL, that's an error + * . if lookup fails, the file might not exist. + * in that case, create the file if we were passed MPI_MODE_CREATE + * . if the create fails, that means someone else created the file between + * our call to lookup and our call to create (like if N processors all + * open the same file with MPI_COMM_SELF). Then we can just look up the + * file (which now exists). + * + * the good news is that only one processor does this and broadcasts the + * handle to everyone else in the communicator + */ +static void fake_an_open(PVFS_fs_id fs_id, char *pvfs_name, int access_mode, + int nr_datafiles, PVFS_size strip_size, + ADIOI_PVFS2_fs *pvfs2_fs, + open_status *o_status) +{ + int ret; + PVFS_sysresp_lookup resp_lookup; + PVFS_sysresp_getparent resp_getparent; + PVFS_sysresp_create resp_create; + PVFS_sys_attr attribs; + PVFS_sys_dist* dist; + + ADIOI_PVFS2_makeattribs(&attribs); + if (nr_datafiles > 0 ) { + attribs.dfile_count = nr_datafiles; + attribs.mask |= PVFS_ATTR_SYS_DFILE_COUNT; + } + + dist = NULL; + + memset(&resp_lookup, 0, sizeof(resp_lookup)); + memset(&resp_getparent, 0, sizeof(resp_getparent)); + memset(&resp_create, 0, sizeof(resp_create)); + + + ret = PVFS_sys_lookup(fs_id, pvfs_name, + &(pvfs2_fs->credentials), &resp_lookup, PVFS2_LOOKUP_LINK_FOLLOW); + if ( ret == (-PVFS_ENOENT)) { + if (access_mode & ADIO_CREATE) { + ret = PVFS_sys_getparent(fs_id, pvfs_name, + &(pvfs2_fs->credentials), &resp_getparent); + if (ret < 0) { + FPRINTF(stderr, "pvfs_sys_getparent returns with %d\n", ret); + o_status->error = ret; + return; + } + + /* Set the distribution strip size if specified */ + if (0 < strip_size) { + /* Note that the distribution is hardcoded here */ + dist = PVFS_sys_dist_lookup("simple_stripe"); + ret = PVFS_sys_dist_setparam(dist, + "strip_size", + &strip_size); + if (ret < 0) + { + FPRINTF(stderr, + "pvfs_sys_dist_setparam returns with %d\n", ret); + o_status->error = ret; + } + } + + /* Perform file creation */ +#ifdef HAVE_PVFS2_CREATE_WITHOUT_LAYOUT + ret = PVFS_sys_create(resp_getparent.basename, + resp_getparent.parent_ref, attribs, + &(pvfs2_fs->credentials), dist, &resp_create); +#else + ret = PVFS_sys_create(resp_getparent.basename, + resp_getparent.parent_ref, attribs, + &(pvfs2_fs->credentials), dist, NULL, &resp_create); +#endif + + /* if many creates are happening in this directory, the earlier + * sys_lookup may have returned ENOENT, but the sys_create could + * return EEXISTS. That means the file has been created anyway, so + * less work for us and we can just open it up and return the + * handle */ + if (ret == (-PVFS_EEXIST)) { + ret = PVFS_sys_lookup(fs_id, pvfs_name, + &(pvfs2_fs->credentials), &resp_lookup, + PVFS2_LOOKUP_LINK_FOLLOW); + if ( ret < 0 ) { + o_status->error = ret; + return; + } + o_status->error = ret; + o_status->object_ref = resp_lookup.ref; + return; + } + o_status->object_ref = resp_create.ref; + } else { + FPRINTF(stderr, "cannot create file without MPI_MODE_CREATE\n"); + o_status->error = ret; + return; + } + } else if (access_mode & ADIO_EXCL) { + /* lookup should not succeed if opened with EXCL */ + o_status->error = -PVFS_EEXIST; + return; + } else { + o_status->object_ref = resp_lookup.ref; + } + o_status->error = ret; + return; + +} + + +/* ADIOI_PVFS2_Open: + * one process opens (or creates) the file, then broadcasts the result to the + * remaining processors. + * + * ADIO_Open used to perform an optimization when MPI_MODE_CREATE (and before + * that, MPI_MODE_EXCL) was set. Because PVFS2 handles file lookup and + * creation more scalably than other file systems, ADIO_Open now skips any + * special handling when CREATE is set. */ +void ADIOI_PVFS2_Open(ADIO_File fd, int *error_code) +{ + int rank, ret; + PVFS_fs_id cur_fs; + static char myname[] = "ADIOI_PVFS2_OPEN"; + char pvfs_path[PVFS_NAME_MAX] = {0}; + + ADIOI_PVFS2_fs *pvfs2_fs; + + /* since one process is doing the open, that means one process is also + * doing the error checking. define a struct for both the object reference + * and the error code to broadcast to all the processors */ + + open_status o_status = {0, {0, 0}}; + MPI_Datatype open_status_type; + MPI_Datatype types[2] = {MPI_INT, MPI_BYTE}; + int lens[2] = {1, sizeof(PVFS_object_ref)}; + MPI_Aint offsets[2]; + + pvfs2_fs = (ADIOI_PVFS2_fs *) ADIOI_Malloc(sizeof(ADIOI_PVFS2_fs)); + + /* --BEGIN ERROR HANDLING-- */ + if (pvfs2_fs == NULL) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNKNOWN, + "Error allocating memory", 0); + return; + } + /* --END ERROR HANDLING-- */ + + MPI_Comm_rank(fd->comm, &rank); + + ADIOI_PVFS2_Init(error_code); + if (*error_code != MPI_SUCCESS) + { + /* ADIOI_PVFS2_INIT handles creating error codes on its own */ + return; + } + + /* currently everyone gets their own credentials */ + ADIOI_PVFS2_makecredentials(&(pvfs2_fs->credentials)); + + /* one process resolves name and will later bcast to others */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); +#endif + if (rank == fd->hints->ranklist[0] && fd->fs_ptr == NULL) { + /* given the filename, figure out which pvfs filesystem it is on */ + ret = PVFS_util_resolve(fd->filename, &cur_fs, + pvfs_path, PVFS_NAME_MAX); + if (ret < 0 ) { + PVFS_perror("PVFS_util_resolve", ret); + /* TODO: pick a good error for this */ + o_status.error = -1; + } else { + fake_an_open(cur_fs, pvfs_path, + fd->access_mode, fd->hints->striping_factor, + fd->hints->striping_unit, + pvfs2_fs, &o_status); + } + + /* store credentials and object reference in fd */ + pvfs2_fs->object_ref = o_status.object_ref; + fd->fs_ptr = pvfs2_fs; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); +#endif + + /* broadcast status and (possibly valid) object reference */ + MPI_Address(&o_status.error, &offsets[0]); + MPI_Address(&o_status.object_ref, &offsets[1]); + + MPI_Type_struct(2, lens, offsets, types, &open_status_type); + MPI_Type_commit(&open_status_type); + + /* Assertion: if we hit this Bcast, then all processes collectively + * called this open. + * + * That's because deferred open never happens with PVFS2. + */ + MPI_Bcast(MPI_BOTTOM, 1, open_status_type, fd->hints->ranklist[0], + fd->comm); + MPI_Type_free(&open_status_type); + + /* --BEGIN ERROR HANDLING-- */ + if (o_status.error != 0) + { + ADIOI_Free(pvfs2_fs); + fd->fs_ptr = NULL; + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(o_status.error), + "Unknown error", 0); + /* TODO: FIX STRING */ + return; + } + /* --END ERROR HANDLING-- */ + + pvfs2_fs->object_ref = o_status.object_ref; + fd->fs_ptr = pvfs2_fs; + + *error_code = MPI_SUCCESS; + return; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_read.c new file mode 100644 index 0000000000..48009f2537 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_read.c @@ -0,0 +1,168 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" +#include "ad_pvfs2_io.h" +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + int ret, datatype_size, len; + PVFS_Request file_req, mem_req; + PVFS_sysresp_io resp_io; + ADIOI_PVFS2_fs *pvfs_fs; + static char myname[] = "ADIOI_PVFS2_READCONTIG"; + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + MPI_Type_size(datatype, &datatype_size); + len = datatype_size * count; + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in pvfs_request_contig (memory)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in pvfs_request_contig (file)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* copy individual file pointer into offset variable, continue */ + offset = fd->fp_ind; + } + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif + ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, offset, buf, + mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0 ) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_read", 0); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += (int) resp_io.total_completed; + /* TODO: WHY THE INT CAST? */ + } + fd->fp_sys_posn = offset + (int)resp_io.total_completed; + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, (int)resp_io.total_completed); +#endif + + *error_code = MPI_SUCCESS; +fn_exit: + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + return; +} + +static int ADIOI_PVFS2_ReadStridedListIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + return ADIOI_PVFS2_StridedListIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, + error_code, READ); +} + +static int ADIOI_PVFS2_ReadStridedDtypeIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + return ADIOI_PVFS2_StridedDtypeIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, error_code, + READ); +} + +void ADIOI_PVFS2_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code) +{ + /* four ways (to date) that we can carry out strided i/o accesses: + * - naive posix + * - 'true' Datatype (from avery) + * - new List I/O (from avery) + * - classic List I/O (the one that's always been in ROMIO) + * I imagine we'll keep Datatype as an optional optimization, and afer a + * release or two promote it to the default + */ + int ret = -1; + + if (fd->hints->fs_hints.pvfs2.posix_read == ADIOI_HINT_ENABLE) { + ADIOI_GEN_ReadStrided(fd, buf, count, datatype, + file_ptr_type, offset, status, error_code); + return; + } + if (fd->hints->fs_hints.pvfs2.dtype_read == ADIOI_HINT_ENABLE) { + ret = ADIOI_PVFS2_ReadStridedDtypeIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, error_code); + + /* Fall back to list I/O if datatype I/O didn't work */ + if (ret != 0) + { + fprintf(stderr, + "Falling back to list I/O since datatype I/O failed\n"); + ret = ADIOI_PVFS2_ReadStridedListIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, error_code); + } + return; + } + if (fd->hints->fs_hints.pvfs2.listio_read == ADIOI_HINT_ENABLE) { + ret = ADIOI_PVFS2_ReadStridedListIO(fd, buf, count, datatype, + file_ptr_type, offset, status, error_code); + return; + } + /* Use classic list I/O if no hints given base case */ + + ADIOI_PVFS2_OldReadStrided(fd, buf, count, datatype, + file_ptr_type, offset, status, error_code); + return; +} + + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c new file mode 100644 index 0000000000..d5ceefa464 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c @@ -0,0 +1,909 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" + +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code) +{ + /* offset is in units of etype relative to the filetype. */ + ADIOI_Flatlist_node *flat_buf, *flat_file; + int i, j, k, brd_size, frd_size=0, st_index=0; + int bufsize, sum, n_etypes_in_filetype, size_in_filetype; + int n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype=0; + int filetype_size, etype_size, buftype_size; + MPI_Aint filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset off, disp, start_off, initial_off; + int flag, st_frd_size, st_n_filetypes; + + int mem_list_count, file_list_count; + PVFS_size *mem_offsets; + int64_t *file_offsets; + int *mem_lengths; + int32_t *file_lengths; + int total_blks_to_read; + + int max_mem_list, max_file_list; + + int b_blks_read; + int f_data_read; + int size_read=0, n_read_lists, extra_blks; + + int end_brd_size, end_frd_size; + int start_k, start_j, new_file_read, new_buffer_read; + int start_mem_offset; + PVFS_Request mem_req, file_req; + ADIOI_PVFS2_fs * pvfs_fs; + PVFS_sysresp_io resp_io; + int err_flag=0; + MPI_Offset total_bytes_read = 0; + static char myname[] = "ADIOI_PVFS2_ReadStrided"; + +#define MAX_ARRAY_SIZE 64 + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + /* the HDF5 tests showed a bug in this list processing code (see many many + * lines down below). We added a workaround, but common HDF5 file types + * are actually contiguous and do not need the expensive workarond */ + if (!filetype_is_contig) { + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + if (flat_file->count == 1 && !buftype_is_contig) + filetype_is_contig = 1; + } + + MPI_Type_size(fd->filetype, &filetype_size); + if ( ! filetype_size ) { + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + etype_size = fd->etype_size; + + bufsize = buftype_size * count; + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + int64_t file_offsets; + int32_t file_lengths; + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + etype_size * offset; + + file_list_count = 1; + file_offsets = off; + file_lengths = 0; + total_blks_to_read = count*flat_buf->count; + b_blks_read = 0; + + /* allocate arrays according to max usage */ + if (total_blks_to_read > MAX_ARRAY_SIZE) + mem_list_count = MAX_ARRAY_SIZE; + else mem_list_count = total_blks_to_read; + mem_offsets = (PVFS_size*)ADIOI_Malloc(mem_list_count*sizeof(PVFS_size)); + mem_lengths = (int*)ADIOI_Malloc(mem_list_count*sizeof(int)); + + /* TODO: CHECK RESULTS OF MEMORY ALLOCATION */ + + j = 0; + /* step through each block in memory, filling memory arrays */ + while (b_blks_read < total_blks_to_read) { + for (i=0; icount; i++) { + mem_offsets[b_blks_read % MAX_ARRAY_SIZE] = + /* TODO: fix this compiler warning */ + ((PVFS_size)buf + j*buftype_extent + flat_buf->indices[i]); + mem_lengths[b_blks_read % MAX_ARRAY_SIZE] = + flat_buf->blocklens[i]; + file_lengths += flat_buf->blocklens[i]; + b_blks_read++; + if (!(b_blks_read % MAX_ARRAY_SIZE) || + (b_blks_read == total_blks_to_read)) { + + /* in the case of the last read list call, + adjust mem_list_count */ + if (b_blks_read == total_blks_to_read) { + mem_list_count = total_blks_to_read % MAX_ARRAY_SIZE; + /* in case last read list call fills max arrays */ + if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; + } + err_flag = PVFS_Request_hindexed(mem_list_count, + mem_lengths, mem_offsets, PVFS_BYTE, &mem_req); + if (err_flag < 0) break; + err_flag = PVFS_Request_contiguous(file_lengths, + PVFS_BYTE, &file_req); + if (err_flag < 0) break; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif + err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, + file_offsets, PVFS_BOTTOM, mem_req, + &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_read", 0); + goto error_state; + } + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + total_bytes_read += resp_io.total_completed; + /* --END ERROR HANDLING-- */ + + /* in the case of error or the last read list call, + * leave here */ + if (err_flag || b_blks_read == total_blks_to_read) break; + + file_offsets += file_lengths; + file_lengths = 0; + } + } /* for (i=0; icount; i++) */ + j++; + } /* while (b_blks_read < total_blks_to_read) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += total_bytes_read; + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); + /* This isa temporary way of filling in status. The right way is to + keep tracke of how much data was actually read adn placed in buf + by ADIOI_BUFFERED_READ. */ +#endif + ADIOI_Delete_flattened(datatype); + + return; + } /* if (!buftype_is_contig && filetype_is_contig) */ + + /* know file is noncontiguous from above */ + /* noncontiguous in file */ + + /* filetype already flattened in ADIO_Open */ + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + + disp = fd->disp; + initial_off = offset; + + + /* for each case - ADIO_Individual pointer or explicit, find the file + offset in bytes (offset), n_filetypes (how many filetypes into + file to start), frd_size (remaining amount of data in present + file block), and st_index (start point in terms of blocks in + starting filetype) */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (i=0; icount; i++) { + if (disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes)*filetype_extent + + flat_file->blocklens[i] >= offset) { + st_index = i; + frd_size = (int) (disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes)*filetype_extent + + flat_file->blocklens[i] - offset); + flag = 1; + break; + } + } + } /* while (!flag) */ + } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ + else { + 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; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + frd_size = 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 */ + offset = disp + ((ADIO_Offset) n_filetypes)*filetype_extent + + abs_off_in_filetype; + } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ + + start_off = offset; + st_frd_size = frd_size; + st_n_filetypes = n_filetypes; + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + int mem_lengths; + char *mem_offsets; + + i = 0; + j = st_index; + n_filetypes = st_n_filetypes; + + mem_list_count = 1; + + /* determine how many blocks in file to read */ + f_data_read = ADIOI_MIN(st_frd_size, bufsize); + total_blks_to_read = 1; + if (j < (flat_file->count-1)) j++; + else { + j = 0; + n_filetypes++; + } + while (f_data_read < bufsize) { + f_data_read += flat_file->blocklens[j]; + total_blks_to_read++; + if (j<(flat_file->count-1)) j++; + else j = 0; + } + + j = st_index; + n_filetypes = st_n_filetypes; + n_read_lists = total_blks_to_read/MAX_ARRAY_SIZE; + extra_blks = total_blks_to_read%MAX_ARRAY_SIZE; + + mem_offsets = buf; + mem_lengths = 0; + + /* if at least one full readlist, allocate file arrays + at max array size and don't free until very end */ + if (n_read_lists) { + file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* + sizeof(int64_t)); + file_lengths = (int32_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* + sizeof(int32_t)); + } + /* if there's no full readlist allocate file arrays according + to needed size (extra_blks) */ + else { + file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* + sizeof(int64_t)); + file_lengths = (int32_t*)ADIOI_Malloc(extra_blks* + sizeof(int32_t)); + } + + /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ + for (i=0; iindices[j]; + file_lengths[k] = flat_file->blocklens[j]; + mem_lengths += file_lengths[k]; + } + if (j<(flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; kobject_ref, file_req, 0, + mem_offsets, mem_req, + &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_read", 0); + goto error_state; + } + /* --END ERROR HANDING-- */ + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + + total_bytes_read += resp_io.total_completed; + + mem_offsets += mem_lengths; + mem_lengths = 0; + } /* for (i=0; iindices[j]; + if (k == (extra_blks - 1)) { + file_lengths[k] = bufsize - (int32_t) mem_lengths + - (int32_t) mem_offsets + (int32_t) buf; + } + else file_lengths[k] = flat_file->blocklens[j]; + } /* if(i || k) */ + mem_lengths += file_lengths[k]; + if (j<(flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; kobject_ref, file_req, 0, + mem_offsets, mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_read", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + total_bytes_read += resp_io.total_completed; + } + } + else { +/* noncontiguous in memory as well as in file */ + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + size_read = 0; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + max_mem_list = 0; + max_file_list = 0; + + /* run through and file max_file_list and max_mem_list so that you + can allocate the file and memory arrays less than MAX_ARRAY_SIZE + if possible */ + + while (size_read < bufsize) { + k = start_k; + new_buffer_read = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) { + /* find mem_list_count and file_list_count such that both are + less than MAX_ARRAY_SIZE, the sum of their lengths are + equal, and the sum of all the data read and data to be + read in the next immediate read list is less than + bufsize */ + if(mem_list_count) { + if((new_buffer_read + flat_buf->blocklens[k] + + size_read) > bufsize) { + end_brd_size = new_buffer_read + + flat_buf->blocklens[k] - (bufsize - size_read); + new_buffer_read = bufsize - size_read; + } + else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } + else { + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + else new_buffer_read = brd_size; + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) */ + j = start_j; + new_file_read = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && + (new_file_read < new_buffer_read)) { + if(file_list_count) { + if((new_file_read + flat_file->blocklens[j]) > + new_buffer_read) { + end_frd_size = new_buffer_read - new_file_read; + new_file_read = new_buffer_read; + j--; + } + else { + new_file_read += flat_file->blocklens[j]; + end_frd_size = flat_file->blocklens[j]; + } + } + else { + if (frd_size > new_buffer_read) { + new_file_read = new_buffer_read; + frd_size = new_file_read; + } + else new_file_read = frd_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) j++; + else j = 0; + + k = start_k; + if ((new_file_read < new_buffer_read) && + (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_read = 0; + mem_list_count = 0; + while (new_buffer_read < new_file_read) { + if(mem_list_count) { + if((new_buffer_read + flat_buf->blocklens[k]) > + new_file_read) { + end_brd_size = new_file_read - new_buffer_read; + new_buffer_read = new_file_read; + k--; + } + else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } + else { + new_buffer_read = brd_size; + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while (new_buffer_read < new_file_read) */ + } /* if ((new_file_read < new_buffer_read) && (file_list_count + == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) */ + + /* fakes filling the readlist arrays of lengths found above */ + k = start_k; + j = start_j; + for (i=0; iblocklens[k] == end_brd_size) + brd_size = flat_buf->blocklens[(k+1)% + flat_buf->count]; + else { + brd_size = flat_buf->blocklens[k] - end_brd_size; + k--; + buf_count--; + } + } + } + buf_count++; + k = (k + 1)%flat_buf->count; + } /* for (i=0; iblocklens[j] == end_frd_size) + frd_size = flat_file->blocklens[(j+1)% + flat_file->count]; + else { + frd_size = flat_file->blocklens[j] - end_frd_size; + j--; + } + } + } + if (j < flat_file->count - 1) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; iblocklens[0] ) ) || + ((mem_list_count == 1) && + (new_buffer_read < flat_buf->blocklens[0]) ) || + ((file_list_count == MAX_ARRAY_SIZE) && + (new_file_read < flat_buf->blocklens[0]) ) || + ( (mem_list_count == MAX_ARRAY_SIZE) && + (new_buffer_read < flat_file->blocklens[0])) ) + { + + ADIOI_Delete_flattened(datatype); + ADIOI_GEN_ReadStrided_naive(fd, buf, count, datatype, + file_ptr_type, initial_off, status, error_code); + return; + } + + mem_offsets = (PVFS_size*)ADIOI_Malloc(max_mem_list*sizeof(PVFS_size)); + mem_lengths = (int *)ADIOI_Malloc(max_mem_list*sizeof(int)); + file_offsets = (int64_t *)ADIOI_Malloc(max_file_list*sizeof(int64_t)); + file_lengths = (int32_t *)ADIOI_Malloc(max_file_list*sizeof(int32_t)); + + size_read = 0; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + + /* this section calculates mem_list_count and file_list_count + and also finds the possibly odd sized last array elements + in new_frd_size and new_brd_size */ + + while (size_read < bufsize) { + k = start_k; + new_buffer_read = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) { + /* find mem_list_count and file_list_count such that both are + less than MAX_ARRAY_SIZE, the sum of their lengths are + equal, and the sum of all the data read and data to be + read in the next immediate read list is less than + bufsize */ + if(mem_list_count) { + if((new_buffer_read + flat_buf->blocklens[k] + + size_read) > bufsize) { + end_brd_size = new_buffer_read + + flat_buf->blocklens[k] - (bufsize - size_read); + new_buffer_read = bufsize - size_read; + } + else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } + else { + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + else new_buffer_read = brd_size; + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) */ + j = start_j; + new_file_read = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && + (new_file_read < new_buffer_read)) { + if(file_list_count) { + if((new_file_read + flat_file->blocklens[j]) > + new_buffer_read) { + end_frd_size = new_buffer_read - new_file_read; + new_file_read = new_buffer_read; + j--; + } + else { + new_file_read += flat_file->blocklens[j]; + end_frd_size = flat_file->blocklens[j]; + } + } + else { + if (frd_size > new_buffer_read) { + new_file_read = new_buffer_read; + frd_size = new_file_read; + } + else new_file_read = frd_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) j++; + else j = 0; + + k = start_k; + if ((new_file_read < new_buffer_read) && + (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_read = 0; + mem_list_count = 0; + while (new_buffer_read < new_file_read) { + if(mem_list_count) { + if((new_buffer_read + flat_buf->blocklens[k]) > + new_file_read) { + end_brd_size = new_file_read - new_buffer_read; + new_buffer_read = new_file_read; + k--; + } + else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } + else { + new_buffer_read = brd_size; + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while (new_buffer_read < new_file_read) */ + } /* if ((new_file_read < new_buffer_read) && (file_list_count + == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) */ + + /* fills the allocated readlist arrays */ + k = start_k; + j = start_j; + for (i=0; icount) + + (int)flat_buf->indices[k]); + if(!i) { + mem_lengths[0] = brd_size; + mem_offsets[0] += flat_buf->blocklens[k] - brd_size; + } + else { + if (i == (mem_list_count - 1)) { + mem_lengths[i] = end_brd_size; + if (flat_buf->blocklens[k] == end_brd_size) + brd_size = flat_buf->blocklens[(k+1)% + flat_buf->count]; + else { + brd_size = flat_buf->blocklens[k] - end_brd_size; + k--; + buf_count--; + } + } + else { + mem_lengths[i] = flat_buf->blocklens[k]; + } + } + buf_count++; + k = (k + 1)%flat_buf->count; + } /* for (i=0; iindices[j] + + ((ADIO_Offset)n_filetypes) * filetype_extent; + if (!i) { + file_lengths[0] = frd_size; + file_offsets[0] += flat_file->blocklens[j] - frd_size; + } + else { + if (i == (file_list_count - 1)) { + file_lengths[i] = end_frd_size; + if (flat_file->blocklens[j] == end_frd_size) + frd_size = flat_file->blocklens[(j+1)% + flat_file->count]; + else { + frd_size = flat_file->blocklens[j] - end_frd_size; + j--; + } + } + else file_lengths[i] = flat_file->blocklens[j]; + } + if (j < flat_file->count - 1) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; iobject_ref, file_req, 0, + PVFS_BOTTOM, mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_read", 0); + } + /* --END ERROR HANDLING-- */ + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + total_bytes_read += resp_io.total_completed; + size_read += new_buffer_read; + start_k = k; + start_j = j; + } /* while (size_read < bufsize) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + } + /* Other ADIO routines will convert absolute bytes into counts of datatypes */ + /* when incrementing fp_ind, need to also take into account the file type: + * consider an N-element 1-d subarray with a lb and ub: ( |---xxxxx-----| + * if we wrote N elements, offset needs to point at beginning of type, not + * at empty region at offset N+1) + * + * As we discussed on mpich-discuss in may/june 2009, the code below might + * look wierd, but by putting fp_ind at the last byte written, the next + * time we run through the strided code we'll update the fp_ind to the + * right location. */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind = file_offsets[file_list_count-1]+ + file_lengths[file_list_count-1]; + } + + ADIOI_Free(file_offsets); + ADIOI_Free(file_lengths); + + if (err_flag == 0) *error_code = MPI_SUCCESS; + +error_state: + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); + /* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually read and placed in buf + by ADIOI_BUFFERED_READ. */ +#endif + + if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); +} + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_resize.c new file mode 100644 index 0000000000..13533773b6 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_resize.c @@ -0,0 +1,56 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs2.h" +#include "ad_pvfs2_common.h" + +/* as with ADIOI_PVFS2_Flush, implement the resize operation in a scalable + * manner. one process does the work, then broadcasts the result to everyone + * else. fortunately, this operation is defined to be collective */ +void ADIOI_PVFS2_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + int ret, rank; + ADIOI_PVFS2_fs *pvfs_fs; + static char myname[] = "ADIOI_PVFS2_RESIZE"; + + *error_code = MPI_SUCCESS; + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + MPI_Comm_rank(fd->comm, &rank); + + /* We desginate one node in the communicator to be an 'io_worker' in + * ADIO_Open. This node can perform operations on files and then + * inform the other nodes of the result */ + + /* MPI-IO semantics treat conflicting MPI_File_set_size requests the + * same as conflicting write requests. Thus, a resize from one + * process does not have to be visible to the other processes until a + * syncronization point is reached */ + + if (rank == fd->hints->ranklist[0]) { + ret = PVFS_sys_truncate(pvfs_fs->object_ref, + size, &(pvfs_fs->credentials)); + MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + } else { + MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + } + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_truncate", 0); + return; + } + /* --END ERROR HANDLING-- */ +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_write.c new file mode 100644 index 0000000000..47f64ad2fd --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_write.c @@ -0,0 +1,181 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_pvfs2.h" +#include "adio_extern.h" +#include "ad_pvfs2_io.h" +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + int ret, datatype_size, len; + PVFS_Request file_req, mem_req; + PVFS_sysresp_io resp_io; + ADIOI_PVFS2_fs *pvfs_fs; + static char myname[] = "ADIOI_PVFS2_WRITECONTIG"; + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + MPI_Type_size(datatype, &datatype_size); + len = datatype_size * count; + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_Request_contiguous (memory)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ret = PVFS_Request_contiguous(len, PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_Request_contiguous (file)", 0); + return; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, offset, buf, + mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_write", 0); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + fd->fp_sys_posn = offset + (int) resp_io.total_completed; + } + else { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, fd->fp_ind, buf, + mem_req, &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(ret), + "Error in PVFS_sys_write", 0); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + fd->fp_ind += (int)resp_io.total_completed; + fd->fp_sys_posn = fd->fp_ind; + } +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, (int)resp_io.total_completed); +#endif + *error_code = MPI_SUCCESS; +fn_exit: + PVFS_Request_free(&file_req); + PVFS_Request_free(&mem_req); + return; +} + +int ADIOI_PVFS2_WriteStridedListIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + return ADIOI_PVFS2_StridedListIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, + error_code, WRITE); +} + +int ADIOI_PVFS2_WriteStridedDtypeIO(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + return ADIOI_PVFS2_StridedDtypeIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, error_code, + WRITE); +} + + +void ADIOI_PVFS2_WriteStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + /* four ways (to date) that we can carry out strided i/o accesses: + * - naive posix + * - 'true' Datatype (from avery) + * - new List I/O (from avery) + * - classic List I/O (the one that's always been in ROMIO) + * I imagine we'll keep Datatype as an optional optimization, and afer a + * release or two promote it to the default + */ + + /* a lot of near-duplication from ADIOI_PVFS2_ReadStrided: for + * debugging/testing it's helpful to be able to turn on and off these + * optimizations separately for the read and write cases */ + int ret = -1; + if ( fd->hints->fs_hints.pvfs2.posix_write == ADIOI_HINT_ENABLE) { + ADIOI_GEN_WriteStrided_naive(fd, buf, count, + datatype, file_ptr_type, + offset, status, error_code); + return; + } + if ( fd->hints->fs_hints.pvfs2.dtype_write == ADIOI_HINT_ENABLE) { + ret = ADIOI_PVFS2_WriteStridedDtypeIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, error_code); + + /* Fall back to list I/O if datatype I/O didn't work */ + if (ret != 0) + { + fprintf(stderr, + "Falling back to list I/O since datatype I/O failed\n"); + ret = ADIOI_PVFS2_WriteStridedListIO(fd, buf, count, + datatype, file_ptr_type, + offset, status, error_code); + } + return; + } + /* Use list I/O in the base case */ + if (fd->hints->fs_hints.pvfs2.listio_write == ADIOI_HINT_ENABLE) { + ret = ADIOI_PVFS2_WriteStridedListIO(fd, buf, count, datatype, + file_ptr_type, offset, status, error_code); + return; + } + + /* Use classic list I/O if no hints given base case */ + ADIOI_PVFS2_OldWriteStrided(fd, buf, count, datatype, + file_ptr_type, offset, status, error_code); + return; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c new file mode 100644 index 0000000000..413977eef3 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c @@ -0,0 +1,963 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_pvfs2.h" + +#include "ad_pvfs2_common.h" + +void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + /* as with all the other WriteStrided functions, offset is in units of + * etype relative to the filetype */ + + /* Since PVFS2 does not support file locking, can't do buffered writes + as on Unix */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + int i, j, k, bwr_size, fwr_size=0, st_index=0; + int bufsize, sum, n_etypes_in_filetype, size_in_filetype; + int n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype=0; + int filetype_size, etype_size, buftype_size; + MPI_Aint filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset off, disp, start_off, initial_off; + int flag, st_fwr_size, st_n_filetypes; + int err_flag=0; + + int mem_list_count, file_list_count; + PVFS_size * mem_offsets; + int64_t *file_offsets; + int *mem_lengths; + int32_t *file_lengths; + int total_blks_to_write; + + int max_mem_list, max_file_list; + + int b_blks_wrote; + int f_data_wrote; + int size_wrote=0, n_write_lists, extra_blks; + + int end_bwr_size, end_fwr_size; + int start_k, start_j, new_file_write, new_buffer_write; + int start_mem_offset; + PVFS_Request mem_req, file_req; + ADIOI_PVFS2_fs * pvfs_fs; + PVFS_sysresp_io resp_io; + MPI_Offset total_bytes_written=0; + static char myname[] = "ADIOI_PVFS2_WRITESTRIDED"; + + /* note: don't increase this: several parts of PVFS2 now + * assume this limit*/ +#define MAX_ARRAY_SIZE 64 + + /* --BEGIN ERROR HANDLING-- */ + if (fd->atomicity) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "Atomic noncontiguous writes are not supported by PVFS2", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + /* the HDF5 tests showed a bug in this list processing code (see many many + * lines down below). We added a workaround, but common HDF5 file types + * are actually contiguous and do not need the expensive workarond */ + if (!filetype_is_contig) { + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + if (flat_file->count == 1 && !buftype_is_contig) + filetype_is_contig = 1; + } + + MPI_Type_size(fd->filetype, &filetype_size); + if ( ! filetype_size ) { + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + etype_size = fd->etype_size; + + bufsize = buftype_size * count; + + pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr; + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + int64_t file_offsets; + int32_t file_lengths; + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + etype_size * offset; + } + else off = fd->fp_ind; + + file_list_count = 1; + file_offsets = off; + file_lengths = 0; + total_blks_to_write = count*flat_buf->count; + b_blks_wrote = 0; + + /* allocate arrays according to max usage */ + if (total_blks_to_write > MAX_ARRAY_SIZE) + mem_list_count = MAX_ARRAY_SIZE; + else mem_list_count = total_blks_to_write; + mem_offsets = (PVFS_size*)ADIOI_Malloc(mem_list_count*sizeof(PVFS_size)); + mem_lengths = (int*)ADIOI_Malloc(mem_list_count*sizeof(int)); + + j = 0; + /* step through each block in memory, filling memory arrays */ + while (b_blks_wrote < total_blks_to_write) { + for (i=0; icount; i++) { + mem_offsets[b_blks_wrote % MAX_ARRAY_SIZE] = + /* TODO: fix this warning by casting to an integer that's + * the same size as a char * and /then/ casting to + * PVFS_size */ + ((PVFS_size)buf + j*buftype_extent + flat_buf->indices[i]); + mem_lengths[b_blks_wrote % MAX_ARRAY_SIZE] = + flat_buf->blocklens[i]; + file_lengths += flat_buf->blocklens[i]; + b_blks_wrote++; + if (!(b_blks_wrote % MAX_ARRAY_SIZE) || + (b_blks_wrote == total_blks_to_write)) { + + /* in the case of the last write list call, + adjust mem_list_count */ + if (b_blks_wrote == total_blks_to_write) { + mem_list_count = total_blks_to_write % MAX_ARRAY_SIZE; + /* in case last write list call fills max arrays */ + if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; + } + err_flag = PVFS_Request_hindexed(mem_list_count, + mem_lengths, mem_offsets, + PVFS_BYTE, &mem_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_hindexed (memory)", 0); + break; + } + /* --END ERROR HANDLING-- */ + + err_flag = PVFS_Request_contiguous(file_lengths, + PVFS_BYTE, &file_req); + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_Request_contiguous (file)", 0); + break; + } + /* --END ERROR HANDLING-- */ + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, + file_offsets, PVFS_BOTTOM, + mem_req, + &(pvfs_fs->credentials), + &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + total_bytes_written += resp_io.total_completed; + + /* in the case of error or the last write list call, + * leave here */ + /* --BEGIN ERROR HANDLING-- */ + if (err_flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_write", 0); + break; + } + /* --END ERROR HANDLING-- */ + if (b_blks_wrote == total_blks_to_write) break; + + file_offsets += file_lengths; + file_lengths = 0; + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + } + } /* for (i=0; icount; i++) */ + j++; + } /* while (b_blks_wrote < total_blks_to_write) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += total_bytes_written; + + if (!err_flag) *error_code = MPI_SUCCESS; + + fd->fp_sys_posn = -1; /* clear this. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + ADIOI_Delete_flattened(datatype); + return; + } /* if (!buftype_is_contig && filetype_is_contig) */ + + /* already know that file is noncontiguous from above */ + /* noncontiguous in file */ + +/* filetype already flattened in ADIO_Open */ + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + + disp = fd->disp; + initial_off = offset; + + /* for each case - ADIO_Individual pointer or explicit, find offset + (file offset in bytes), n_filetypes (how many filetypes into file + to start), fwr_size (remaining amount of data in present file + block), and st_index (start point in terms of blocks in starting + filetype) */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (i=0; icount; i++) { + if (disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes)*filetype_extent + + flat_file->blocklens[i] >= offset) { + st_index = i; + fwr_size = disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes)*filetype_extent + + flat_file->blocklens[i] - offset; + flag = 1; + break; + } + } + } /* while (!flag) */ + } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ + else { + 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; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = 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 */ + offset = disp + ((ADIO_Offset) n_filetypes)*filetype_extent + + abs_off_in_filetype; + } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ + + start_off = offset; + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + int mem_lengths; + char *mem_offsets; + + i = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + + mem_list_count = 1; + + /* determine how many blocks in file to write */ + f_data_wrote = ADIOI_MIN(st_fwr_size, bufsize); + total_blks_to_write = 1; + if (j < (flat_file->count -1)) j++; + else { + j = 0; + n_filetypes++; + } + while (f_data_wrote < bufsize) { + f_data_wrote += flat_file->blocklens[j]; + total_blks_to_write++; + if (j<(flat_file->count-1)) j++; + else j = 0; + } + + j = st_index; + n_filetypes = st_n_filetypes; + n_write_lists = total_blks_to_write/MAX_ARRAY_SIZE; + extra_blks = total_blks_to_write%MAX_ARRAY_SIZE; + + mem_offsets = buf; + mem_lengths = 0; + + /* if at least one full writelist, allocate file arrays + at max array size and don't free until very end */ + if (n_write_lists) { + file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* + sizeof(int64_t)); + file_lengths = (int32_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* + sizeof(int32_t)); + } + /* if there's no full writelist allocate file arrays according + to needed size (extra_blks) */ + else { + file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* + sizeof(int64_t)); + file_lengths = (int32_t*)ADIOI_Malloc(extra_blks* + sizeof(int32_t)); + } + + /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ + for (i=0; iindices[j]; + file_lengths[k] = flat_file->blocklens[j]; + mem_lengths += file_lengths[k]; + } + if (j<(flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; kobject_ref, file_req, 0, + mem_offsets, mem_req, + &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_write", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + total_bytes_written += resp_io.total_completed; + + mem_offsets += mem_lengths; + mem_lengths = 0; + PVFS_Request_free(&file_req); + PVFS_Request_free(&mem_req); + + } /* for (i=0; iindices[j]; + if (k == (extra_blks - 1)) { + file_lengths[k] = bufsize - (int32_t) mem_lengths + - (int32_t) mem_offsets + (int32_t) buf; + } + else file_lengths[k] = flat_file->blocklens[j]; + } /* if(i || k) */ + mem_lengths += file_lengths[k]; + if (j<(flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; kobject_ref, file_req, 0, + mem_offsets, mem_req, + &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_write", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + total_bytes_written += resp_io.total_completed; + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + } + } + else { + /* noncontiguous in memory as well as in file */ + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + size_wrote = 0; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + max_mem_list = 0; + max_file_list = 0; + + /* run through and file max_file_list and max_mem_list so that you + can allocate the file and memory arrays less than MAX_ARRAY_SIZE + if possible */ + + while (size_wrote < bufsize) { + k = start_k; + new_buffer_write = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) { + /* find mem_list_count and file_list_count such that both are + less than MAX_ARRAY_SIZE, the sum of their lengths are + equal, and the sum of all the data written and data to be + written in the next immediate write list is less than + bufsize */ + if(mem_list_count) { + if((new_buffer_write + flat_buf->blocklens[k] + + size_wrote) > bufsize) { + end_bwr_size = new_buffer_write + + flat_buf->blocklens[k] - (bufsize - size_wrote); + new_buffer_write = bufsize - size_wrote; + } + else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } + else { + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + else new_buffer_write = bwr_size; + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) */ + j = start_j; + new_file_write = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && + (new_file_write < new_buffer_write)) { + if(file_list_count) { + if((new_file_write + flat_file->blocklens[j]) > + new_buffer_write) { + end_fwr_size = new_buffer_write - new_file_write; + new_file_write = new_buffer_write; + j--; + } + else { + new_file_write += flat_file->blocklens[j]; + end_fwr_size = flat_file->blocklens[j]; + } + } + else { + if (fwr_size > new_buffer_write) { + new_file_write = new_buffer_write; + fwr_size = new_file_write; + } + else new_file_write = fwr_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) j++; + else j = 0; + + k = start_k; + if ((new_file_write < new_buffer_write) && + (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_write = 0; + mem_list_count = 0; + while (new_buffer_write < new_file_write) { + if(mem_list_count) { + if((new_buffer_write + flat_buf->blocklens[k]) > + new_file_write) { + end_bwr_size = new_file_write - + new_buffer_write; + new_buffer_write = new_file_write; + k--; + } + else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } + else { + new_buffer_write = bwr_size; + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while (new_buffer_write < new_file_write) */ + } /* if ((new_file_write < new_buffer_write) && + (file_list_count == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) */ + + /* fakes filling the writelist arrays of lengths found above */ + k = start_k; + j = start_j; + for (i=0; iblocklens[k] == end_bwr_size) + bwr_size = flat_buf->blocklens[(k+1)% + flat_buf->count]; + else { + bwr_size = flat_buf->blocklens[k] - end_bwr_size; + k--; + buf_count--; + } + } + } + buf_count++; + k = (k + 1)%flat_buf->count; + } /* for (i=0; iblocklens[j] == end_fwr_size) + fwr_size = flat_file->blocklens[(j+1)% + flat_file->count]; + else { + fwr_size = flat_file->blocklens[j] - end_fwr_size; + j--; + } + } + } + if (j < flat_file->count - 1) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; iblocklens[0] ) ) || + ((mem_list_count == 1) && + (new_buffer_write < flat_buf->blocklens[0]) ) || + ((file_list_count == MAX_ARRAY_SIZE) && + (new_file_write < flat_buf->blocklens[0]) ) || + ( (mem_list_count == MAX_ARRAY_SIZE) && + (new_buffer_write < flat_file->blocklens[0])) ) + { + ADIOI_Delete_flattened(datatype); + ADIOI_GEN_WriteStrided_naive(fd, buf, count, datatype, + file_ptr_type, initial_off, status, error_code); + return; + } + + + mem_offsets = (PVFS_size*)ADIOI_Malloc(max_mem_list*sizeof(PVFS_size)); + mem_lengths = (int *)ADIOI_Malloc(max_mem_list*sizeof(int)); + file_offsets = (int64_t *)ADIOI_Malloc(max_file_list*sizeof(int64_t)); + file_lengths = (int32_t *)ADIOI_Malloc(max_file_list*sizeof(int32_t)); + + size_wrote = 0; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + + /* this section calculates mem_list_count and file_list_count + and also finds the possibly odd sized last array elements + in new_fwr_size and new_bwr_size */ + + while (size_wrote < bufsize) { + k = start_k; + new_buffer_write = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) { + /* find mem_list_count and file_list_count such that both are + less than MAX_ARRAY_SIZE, the sum of their lengths are + equal, and the sum of all the data written and data to be + written in the next immediate write list is less than + bufsize */ + if(mem_list_count) { + if((new_buffer_write + flat_buf->blocklens[k] + + size_wrote) > bufsize) { + end_bwr_size = new_buffer_write + + flat_buf->blocklens[k] - (bufsize - size_wrote); + new_buffer_write = bufsize - size_wrote; + } + else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } + else { + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + else new_buffer_write = bwr_size; + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) */ + j = start_j; + new_file_write = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && + (new_file_write < new_buffer_write)) { + if(file_list_count) { + if((new_file_write + flat_file->blocklens[j]) > + new_buffer_write) { + end_fwr_size = new_buffer_write - new_file_write; + new_file_write = new_buffer_write; + j--; + } + else { + new_file_write += flat_file->blocklens[j]; + end_fwr_size = flat_file->blocklens[j]; + } + } + else { + if (fwr_size > new_buffer_write) { + new_file_write = new_buffer_write; + fwr_size = new_file_write; + } + else new_file_write = fwr_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) j++; + else j = 0; + + k = start_k; + if ((new_file_write < new_buffer_write) && + (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_write = 0; + mem_list_count = 0; + while (new_buffer_write < new_file_write) { + if(mem_list_count) { + if((new_buffer_write + flat_buf->blocklens[k]) > + new_file_write) { + end_bwr_size = new_file_write - + new_buffer_write; + new_buffer_write = new_file_write; + k--; + } + else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } + else { + new_buffer_write = bwr_size; + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while (new_buffer_write < new_file_write) */ + } /* if ((new_file_write < new_buffer_write) && + (file_list_count == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) */ + + /* fills the allocated writelist arrays */ + k = start_k; + j = start_j; + for (i=0; icount) + + (int)flat_buf->indices[k]); + + if(!i) { + mem_lengths[0] = bwr_size; + mem_offsets[0] += flat_buf->blocklens[k] - bwr_size; + } + else { + if (i == (mem_list_count - 1)) { + mem_lengths[i] = end_bwr_size; + if (flat_buf->blocklens[k] == end_bwr_size) + bwr_size = flat_buf->blocklens[(k+1)% + flat_buf->count]; + else { + bwr_size = flat_buf->blocklens[k] - end_bwr_size; + k--; + buf_count--; + } + } + else { + mem_lengths[i] = flat_buf->blocklens[k]; + } + } + buf_count++; + k = (k + 1)%flat_buf->count; + } /* for (i=0; iindices[j] + + ((ADIO_Offset)n_filetypes) * filetype_extent; + if (!i) { + file_lengths[0] = fwr_size; + file_offsets[0] += flat_file->blocklens[j] - fwr_size; + } + else { + if (i == (file_list_count - 1)) { + file_lengths[i] = end_fwr_size; + if (flat_file->blocklens[j] == end_fwr_size) + fwr_size = flat_file->blocklens[(j+1)% + flat_file->count]; + else { + fwr_size = flat_file->blocklens[j] - end_fwr_size; + j--; + } + } + else file_lengths[i] = flat_file->blocklens[j]; + } + if (j < flat_file->count - 1) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; iobject_ref, file_req, 0, + PVFS_BOTTOM, mem_req, + &(pvfs_fs->credentials), &resp_io); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_PVFS2_error_convert(err_flag), + "Error in PVFS_sys_write", 0); + goto error_state; + } + /* --END ERROR HANDLING-- */ + + size_wrote += new_buffer_write; + total_bytes_written += resp_io.total_completed; + start_k = k; + start_j = j; + PVFS_Request_free(&mem_req); + PVFS_Request_free(&file_req); + } /* while (size_wrote < bufsize) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + } + /* when incrementing fp_ind, need to also take into account the file type: + * consider an N-element 1-d subarray with a lb and ub: ( |---xxxxx-----| + * if we wrote N elements, offset needs to point at beginning of type, not + * at empty region at offset N+1). + * + * As we discussed on mpich-discuss in may/june 2009, the code below might + * look wierd, but by putting fp_ind at the last byte written, the next + * time we run through the strided code we'll update the fp_ind to the + * right location. */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind = file_offsets[file_list_count-1]+ + file_lengths[file_list_count-1]; + } + ADIOI_Free(file_offsets); + ADIOI_Free(file_lengths); + + *error_code = MPI_SUCCESS; + +error_state: + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/.state-cache new file mode 100644 index 0000000000..df0d187201 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/.state-cache @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/Makefile.in index d05640b86d..a62fe2b846 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/Makefile.in @@ -3,15 +3,15 @@ AR = @AR@ LIBNAME = @LIBNAME@ srcdir = @srcdir@ -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) @VPATH@ -AD_SFS_OBJECTS = ad_sfs_close.o ad_sfs_read.o \ - ad_sfs_open.o ad_sfs_write.o ad_sfs_done.o \ - ad_sfs_fcntl.o ad_sfs_iread.o ad_sfs_iwrite.o ad_sfs_wait.o \ - ad_sfs_flush.o ad_sfs_resize.o \ +AD_SFS_OBJECTS = \ + ad_sfs_open.o \ + ad_sfs_fcntl.o \ + ad_sfs_flush.o \ ad_sfs.o default: $(LIBNAME) diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/README b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/README new file mode 100644 index 0000000000..933677b177 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/README @@ -0,0 +1 @@ +This code is no longer supported. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.c index a28668b911..a4d6cc1135 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -13,8 +12,8 @@ struct ADIOI_Fns_struct ADIO_SFS_operations = { ADIOI_SFS_Open, /* Open */ - ADIOI_SFS_ReadContig, /* ReadContig */ - ADIOI_SFS_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadContig, /* ReadContig */ + ADIOI_GEN_WriteContig, /* WriteContig */ ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ ADIOI_GEN_SeekIndividual, /* SeekIndividual */ @@ -22,16 +21,16 @@ struct ADIOI_Fns_struct ADIO_SFS_operations = { ADIOI_GEN_SetInfo, /* SetInfo */ ADIOI_GEN_ReadStrided, /* ReadStrided */ ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_SFS_Close, /* Close */ - ADIOI_SFS_IreadContig, /* IreadContig */ - ADIOI_SFS_IwriteContig, /* IwriteContig */ - ADIOI_SFS_ReadDone, /* ReadDone */ - ADIOI_SFS_WriteDone, /* WriteDone */ - ADIOI_SFS_ReadComplete, /* ReadComplete */ - ADIOI_SFS_WriteComplete, /* WriteComplete */ - ADIOI_SFS_IreadStrided, /* IreadStrided */ - ADIOI_SFS_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_SFS_Flush, /* Flush */ - ADIOI_SFS_Resize, /* Resize */ + ADIOI_GEN_Resize, /* Resize */ ADIOI_GEN_Delete, /* Delete */ }; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.h index 696465447a..875c77dfc3 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -14,4 +13,9 @@ #include #include "adio.h" +void ADIOI_SFS_Open(ADIO_File fd, int *error_code); +void ADIOI_SFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int + *error_code); +void ADIOI_SFS_Flush(ADIO_File fd, int *error_code); + #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_close.c deleted file mode 100644 index 146409b1ac..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_close.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_Close(ADIO_File fd, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_SFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_done.c deleted file mode 100644 index 8e879997f9..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_done.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -int ADIOI_SFS_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_SFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - return ADIOI_SFS_ReadDone(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_fcntl.c dissimilarity index 74% index cbc68d92f5..a18621b6db 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_fcntl.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_fcntl.c @@ -1,188 +1,64 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" -#include "adio_extern.h" - -void ADIOI_SFS_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, len; - 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_SFS_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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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; icount; 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: - /* On SFS, I find that a write from one process, which changes - the file size, does not automatically make the new file size - visible to other processes. Therefore, a sync-barrier-sync is - needed. (Other processes are able to read the data written - though; only file size is returned incorrectly.) */ - - fsync(fd->fd_sys); - MPI_Barrier(fd->comm); - fsync(fd->fd_sys); - - fcntl_struct->fsize = llseek(fd->fd_sys, 0, SEEK_END); - if (fd->fp_sys_posn != -1) - llseek(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); - } - else *error_code = MPI_SUCCESS; -#endif - break; - - case ADIO_FCNTL_SET_DISKSPACE: - /* will be called by one process only */ - - /* 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 = llseek(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 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; ifp_sys_posn != -1) - llseek(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; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_SFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_sfs.h" +#include "adio_extern.h" + +void ADIOI_SFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) +{ + int i, ntimes, len; + ADIO_Offset curr_fsize, alloc_size, size, done; + ADIO_Status status; + char *buf; +#ifndef PRINT_ERR_MSG + static char myname[] = "ADIOI_SFS_FCNTL"; +#endif + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + /* On SFS, I find that a write from one process, which changes + the file size, does not automatically make the new file size + visible to other processes. Therefore, a sync-barrier-sync is + needed. (Other processes are able to read the data written + though; only file size is returned incorrectly.) */ + + fsync(fd->fd_sys); + MPI_Barrier(fd->comm); + fsync(fd->fd_sys); + + fcntl_struct->fsize = llseek(fd->fd_sys, 0, SEEK_END); + if (fd->fp_sys_posn != -1) + llseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); + 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: + 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; + break; + + default: + FPRINTF(stderr, "Unknown flag passed to ADIOI_SFS_Fcntl\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_flush.c index 238e91a14b..a6820bea9d 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_flush.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_flush.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -15,9 +14,12 @@ void ADIOI_SFS_Flush(ADIO_File fd, int *error_code) #endif /* there is no fsync on SX-4 */ -#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 +#else /* MPICH-1 */ *error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 1, myname, (char *) 0, (char *) 0); ADIOI_Error(fd, *error_code, myname); diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_hints.c deleted file mode 100644 index ed856a16e7..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_hints.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - ADIOI_GEN_SetInfo(fd, users_info, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iread.c deleted file mode 100644 index a5cfa25c1a..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iread.c +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_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; - -/* Use blocking I/O for now. */ - - *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_SFS_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_SFS_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 - -/* Use blocking I/O for now. */ - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_READ; - (*request)->fd = fd; - (*request)->queued = 0; - (*request)->datatype = datatype; - - ADIOI_SFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iwrite.c deleted file mode 100644 index a9968e31dd..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_iwrite.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_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; - -/* Use blocking I/O for now. */ - - *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_SFS_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_SFS_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 - -/* Use blocking I/O for now. */ - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->queued = 0; - (*request)->datatype = datatype; - - ADIOI_SFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_open.c index f8532b023f..d73af425db 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_open.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -35,20 +34,24 @@ void ADIOI_SFS_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 = llseek(fd->fd_sys, 0, SEEK_END); fd->fp_sys_posn = fd->fp_ind; } -#ifdef PRINT_ERR_MSG - *error_code = (fd->fd_sys == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS; -#else 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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_rdcoll.c deleted file mode 100644 index b15a66aeda..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_rdcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_read.c deleted file mode 100644 index af55d86abf..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_read.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_ReadContig(ADIO_File fd, void *buf, int count, - 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_SFS_READCONTIG"; -#endif - - MPI_Type_size(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) - llseek(fd->fd_sys, offset, SEEK_SET); - err = read(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* read from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) - llseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - err = read(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - 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); - } - else *error_code = MPI_SUCCESS; -#endif -} - - - -void ADIOI_SFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_resize.c deleted file mode 100644 index 1a0fc52e26..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_resize.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_SFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_seek.c deleted file mode 100644 index a57a250134..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_seek.c +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -ADIO_Offset ADIOI_SFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code) -{ - return ADIOI_GEN_SeekIndividual(fd, offset, whence, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wait.c deleted file mode 100644 index 45497cd8bd..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wait.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_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_SFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - ADIOI_SFS_ReadComplete(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wrcoll.c deleted file mode 100644 index bc693d7668..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_wrcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_write.c deleted file mode 100644 index fee9ced047..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_sfs/ad_sfs_write.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_sfs.h" - -void ADIOI_SFS_WriteContig(ADIO_File fd, void *buf, int count, - 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_SFS_WRITECONTIG"; -#endif - - MPI_Type_size(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) - llseek(fd->fd_sys, offset, SEEK_SET); - err = write(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* write from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) - llseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - err = write(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - 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); - } - else *error_code = MPI_SUCCESS; -#endif -} - - -void ADIOI_SFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/.state-cache new file mode 100644 index 0000000000..6f99d64182 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/.state-cache @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/Makefile.in index 11c4fba1c8..b6b3997b37 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/Makefile.in @@ -1,10 +1,22 @@ CC = @CC@ AR = @AR@ +RANLIB = @RANLIB@ LIBNAME = @LIBNAME@ srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) +#DEFS = @DEFS@ -I. -I${srcdir} +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +#CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) +CFLAGS = @CFLAGS@ + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +C_COMPILE_SHL = $(CC_SHL) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +#C_COMPILE_SHL = $(CC_SHL) @VPATH@ @@ -16,12 +28,48 @@ AD_TESTFS_OBJECTS = ad_testfs_close.o ad_testfs_read.o ad_testfs_rdcoll.o \ ad_testfs_delete.o ad_testfs.o default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo +# $(CC) $(CFLAGS) -c $< .c.o: - $(CC) $(CFLAGS) -c $< + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE) -c $< ; \ + fi + @$(C_COMPILE) -c $< +# $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o +# @mv -f _s$*.o $*.lo +.c.lo: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE_SHL) -c $< -o _s$*.o ; \ + echo mv -f _s$*.o $*.lo ; \ + fi + @$(C_COMPILE_SHL) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo $(LIBNAME): $(AD_TESTFS_OBJECTS) $(AR) $(LIBNAME) $(AD_TESTFS_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_TESTFS_LOOBJECTS = $(AD_TESTFS_OBJECTS:.o=.lo) + +$(SHLIBNAME).la: $(AD_TESTFS_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_TESTFS_LOOBJECTS) clean: - @rm -f *.o + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg + +tags: TAGS +SOURCES = ${AD_TESTFS_OBJECTS:.o=.c} +HEADERS = +TAGS:${HEADERS} ${SOURCES} + here=`cd ../../../../.. && pwd` ; cd ${srcdir} && etags -o $$here/TAGS --append ${HEADERS} ${SOURCES} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.c index 320a99abec..36286c7a6e 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -13,6 +12,7 @@ struct ADIOI_Fns_struct ADIO_TESTFS_operations = { ADIOI_TESTFS_Open, /* Open */ + ADIOI_GEN_OpenColl, /* OpenColl */ ADIOI_TESTFS_ReadContig, /* ReadContig */ ADIOI_TESTFS_WriteContig, /* WriteContig */ ADIOI_TESTFS_ReadStridedColl, /* ReadStridedColl */ @@ -34,4 +34,5 @@ struct ADIOI_Fns_struct ADIO_TESTFS_operations = { ADIOI_TESTFS_Flush, /* Flush */ ADIOI_TESTFS_Resize, /* Resize */ ADIOI_TESTFS_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ }; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.h index 0bbed7c11a..409aae6722 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_close.c index 9532e05ba8..2c5076df00 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_close.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_close.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_delete.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_delete.c index 3924e16ac3..502b5f57f7 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_delete.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_delete.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_done.c dissimilarity index 68% index 9193d2605d..65ab055998 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_done.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_done.c @@ -1,64 +1,39 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_testfs.h" -#include "adioi.h" - -int ADIOI_TESTFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code) -{ - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - if (*request == ADIO_REQUEST_NULL) { - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadDone called on ADIO_REQUEST_NULL\n", - myrank, nprocs); - return 1; - } - - MPI_Comm_size((*request)->fd->comm, &nprocs); - MPI_Comm_rank((*request)->fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadDone called on %s\n", - myrank, nprocs, (*request)->fd->filename); - -#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; - return 1; -} - -int ADIOI_TESTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code) -{ - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - if (*request == ADIO_REQUEST_NULL) { - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteDone called on ADIO_REQUEST_NULL\n", - myrank, nprocs); - return 1; - } - - MPI_Comm_size((*request)->fd->comm, &nprocs); - MPI_Comm_rank((*request)->fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteDone called on %s\n", - myrank, nprocs, (*request)->fd->filename); - -#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; - return 1; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2001 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_testfs.h" +#include "adioi.h" + +int ADIOI_TESTFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int + *error_code) +{ + int myrank, nprocs; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); + MPI_Comm_rank( MPI_COMM_WORLD, &myrank ); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadDone called on ADIO_REQUEST_NULL\n", + myrank, nprocs); + return 1; +} + + +int ADIOI_TESTFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int + *error_code) +{ + int myrank, nprocs; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); + MPI_Comm_rank( MPI_COMM_WORLD, &myrank ); + FPRINTF(stdout, + "[%d/%d] ADIOI_TESTFS_WriteDone called on ADIO_REQUEST_NULL\n", + myrank, nprocs); + return 1; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_fcntl.c dissimilarity index 74% index 1e6a67acc6..7842a6b5fa 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_fcntl.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_fcntl.c @@ -1,117 +1,49 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_testfs.h" -#include "adioi.h" -#include "adio_extern.h" - -void ADIOI_TESTFS_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 myrank, nprocs; - - *error_code = MPI_SUCCESS; - - MPI_Comm_size(fd->comm, &nprocs); - MPI_Comm_rank(fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Fcntl called on %s\n", - myrank, nprocs, fd->filename); - - 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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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; icount; 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 = 0; - *error_code = MPI_SUCCESS; - break; - - case ADIO_FCNTL_SET_DISKSPACE: - *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; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_TESTFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2001 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_testfs.h" +#include "adioi.h" +#include "adio_extern.h" + +void ADIOI_TESTFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, + int *error_code) +{ + int myrank, nprocs; + static char myname[] = "ADIOI_TESTFS_FCNTL"; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_Fcntl called on %s\n", + myrank, nprocs, fd->filename); + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + fcntl_struct->fsize = 0; + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + *error_code = MPI_SUCCESS; + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + default: + /* --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-- */ + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_flush.c index 48eaed3f2b..84b041a8fb 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_flush.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_flush.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_getsh.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_getsh.c index f305fc8bbe..d087845792 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_getsh.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_getsh.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_hints.c index da749bdaf7..a7b1b7540f 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_hints.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_hints.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -8,7 +7,9 @@ #include "ad_testfs.h" #include "adioi.h" - +#ifdef ROMIO_BGL +#include "../ad_bgl/ad_bgl.h" +#endif void ADIOI_TESTFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) { int myrank, nprocs; @@ -22,5 +23,10 @@ void ADIOI_TESTFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) FPRINTF(stdout, "[%d/%d] calling ADIOI_GEN_SetInfo\n", myrank, nprocs); +#ifdef ROMIO_BGL /* BlueGene support for pvfs through ufs */ + /* BlueGene hack: force testfs to mimic BlueGene hints */ + ADIOI_BGL_SetInfo(fd, users_info, error_code); +#else ADIOI_GEN_SetInfo(fd, users_info, error_code); +#endif } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_iread.c index 58f1fdfcf8..09a744d5d7 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_iread.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_iread.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -23,15 +22,9 @@ void ADIOI_TESTFS_IreadContig(ADIO_File fd, void *buf, int count, *error_code = MPI_SUCCESS; - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->queued = 0; - (*request)->datatype = datatype; - - MPI_Type_size(datatype, &typesize); MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); + MPI_Type_size(datatype, &typesize); FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IreadContig called on %s\n", myrank, nprocs, fd->filename); FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_ReadContig\n", @@ -41,13 +34,7 @@ void ADIOI_TESTFS_IreadContig(ADIO_File fd, void *buf, int count, ADIOI_TESTFS_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++; + MPIO_Completed_request_create(&fd, len, error_code, request); } void ADIOI_TESTFS_IreadStrided(ADIO_File fd, void *buf, int count, @@ -57,34 +44,18 @@ void ADIOI_TESTFS_IreadStrided(ADIO_File fd, void *buf, int count, { ADIO_Status status; int myrank, nprocs; -#ifdef HAVE_STATUS_SET_BYTES int typesize; -#endif - - *error_code = MPI_SUCCESS; - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->queued = 0; - (*request)->datatype = datatype; MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); + MPI_Type_size(datatype, &typesize); FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IreadStrided called on %s\n", myrank, nprocs, fd->filename); FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_ReadStrided\n", myrank, nprocs); ADIOI_TESTFS_ReadStrided(fd, buf, count, datatype, file_ptr_type, - offset, &status, error_code); - -#ifdef HAVE_STATUS_SET_BYTES - if (*error_code == MPI_SUCCESS) { - MPI_Type_size(datatype, &typesize); - (*request)->nbytes = count * typesize; - } -#endif - fd->async_count++; + offset, &status, error_code); + MPIO_Completed_request_create(&fd, count*typesize, error_code, request); } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_iwrite.c index 67266470af..15e013104b 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_iwrite.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_iwrite.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -9,6 +8,9 @@ #include "ad_testfs.h" #include "adioi.h" +#include "mpiu_greq.h" +#include "../../mpi-io/mpioimpl.h" + /* ADIOI_TESTFS_IwriteContig() * * Implemented by immediately calling WriteContig() @@ -23,12 +25,6 @@ void ADIOI_TESTFS_IwriteContig(ADIO_File fd, void *buf, int count, *error_code = MPI_SUCCESS; - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->queued = 0; - (*request)->datatype = datatype; - MPI_Type_size(datatype, &typesize); MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); @@ -40,14 +36,8 @@ void ADIOI_TESTFS_IwriteContig(ADIO_File fd, void *buf, int count, len = count * typesize; ADIOI_TESTFS_WriteContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset, &status, error_code); + MPIO_Completed_request_create(&fd, len, error_code, request); -#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_TESTFS_IwriteStrided(ADIO_File fd, void *buf, int count, @@ -57,20 +47,14 @@ void ADIOI_TESTFS_IwriteStrided(ADIO_File fd, void *buf, int count, { ADIO_Status status; int myrank, nprocs; -#ifdef HAVE_STATUS_SET_BYTES int typesize; -#endif *error_code = MPI_SUCCESS; - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->queued = 0; - (*request)->datatype = datatype; - MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); + MPI_Type_size(datatype, &typesize); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IwriteStrided called on %s\n", myrank, nprocs, fd->filename); FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_WriteStrided\n", @@ -78,12 +62,6 @@ void ADIOI_TESTFS_IwriteStrided(ADIO_File fd, void *buf, int count, ADIOI_TESTFS_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, &status, error_code); + MPIO_Completed_request_create(&fd, count*typesize, error_code, request); -#ifdef HAVE_STATUS_SET_BYTES - if (*error_code == MPI_SUCCESS) { - MPI_Type_size(datatype, &typesize); - (*request)->nbytes = count * typesize; - } -#endif - fd->async_count++; } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_open.c index fbcfdb61e7..acd4b80315 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_open.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -14,6 +13,7 @@ void ADIOI_TESTFS_Open(ADIO_File fd, int *error_code) int myrank, nprocs; fd->fd_sys = 1; + fd->fd_direct = -1; *error_code = MPI_SUCCESS; MPI_Comm_size(fd->comm, &nprocs); diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_rdcoll.c index b60d51c26c..99e96d93df 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_rdcoll.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_rdcoll.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_read.c index 3bd870b773..bf911d460c 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_read.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_read.c @@ -1,7 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. */ @@ -28,17 +26,13 @@ void ADIOI_TESTFS_ReadContig(ADIO_File fd, void *buf, int count, offset = fd->fp_ind; fd->fp_ind += datatype_size * count; 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 + datatype_size * count; } - FPRINTF(stdout, "[%d/%d] reading (buf = 0x%x, loc = %Ld, sz = %Ld)\n", - myrank, nprocs, (int) buf, (long long) offset, + FPRINTF(stdout, "[%d/%d] reading (buf = %p, loc = %lld, sz = %lld)\n", + myrank, nprocs, buf, (long long) offset, (long long) datatype_size * count); #ifdef HAVE_STATUS_SET_BYTES diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_resize.c index 43406d1fd3..9e18ec7467 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_resize.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_resize.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_seek.c index 621eab3e15..e36e6b537d 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_seek.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_seek.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -27,8 +26,8 @@ ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, ADIO_Offset off; 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; + ADIO_Offset abs_off_in_filetype=0, sum; + int size_in_filetype; int filetype_size, etype_size, filetype_is_contig; MPI_Aint filetype_extent; @@ -44,7 +43,7 @@ ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, if (filetype_is_contig) off = fd->disp + etype_size * offset; else { - flat_file = ADIOI_Flatlist; + flat_file = CtvAccess(ADIOI_Flatlist); while (flat_file->type != fd->filetype) flat_file = flat_file->next; MPI_Type_extent(fd->filetype, &filetype_extent); @@ -55,6 +54,7 @@ ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, } n_etypes_in_filetype = filetype_size/etype_size; + ADIOI_Assert((offset / n_etypes_in_filetype) == (int) (offset / n_etypes_in_filetype)); 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; @@ -71,12 +71,11 @@ ADIO_Offset ADIOI_TESTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, } /* abs. offset in bytes in the file */ - off = fd->disp + (ADIO_Offset) n_filetypes * filetype_extent + + off = fd->disp + (ADIO_Offset)n_filetypes * (ADIO_Offset)filetype_extent + abs_off_in_filetype; } fd->fp_ind = off; - fd->fp_sys_posn = off; return off; } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_setsh.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_setsh.c index b60df14348..30cf7d65f9 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_setsh.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_setsh.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_wait.c dissimilarity index 70% index bb9bffafbe..ac520f7039 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_wait.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_wait.c @@ -1,60 +1,39 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 2001 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_testfs.h" -#include "adioi.h" - -void ADIOI_TESTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code) -{ - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - if (*request == ADIO_REQUEST_NULL) { - FPRINTF(stdout, "[xx/xx] ADIOI_TESTFS_ReadComplete called on ADIO_REQUEST_NULL\n"); - return; - } - - MPI_Comm_size((*request)->fd->comm, &nprocs); - MPI_Comm_rank((*request)->fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadComplete called on %s\n", - myrank, nprocs, (*request)->fd->filename); - -#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; -} - -void ADIOI_TESTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code) -{ - int myrank, nprocs; - - *error_code = MPI_SUCCESS; - - if (*request == ADIO_REQUEST_NULL) { - FPRINTF(stdout, "[xx/xx] ADIOI_TESTFS_WriteComplete called on ADIO_REQUEST_NULL\n"); - return; - } - - MPI_Comm_size((*request)->fd->comm, &nprocs); - MPI_Comm_rank((*request)->fd->comm, &myrank); - FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteComplete called on %s\n", - myrank, nprocs, (*request)->fd->filename); - -#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; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2001 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_testfs.h" +#include "adioi.h" + +void ADIOI_TESTFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int + *error_code) +{ + int myrank, nprocs; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &myrank); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadComplete called \n", + myrank, nprocs); + + /* do something with status set bytes? */ +} + +void ADIOI_TESTFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int + *error_code) +{ + int myrank, nprocs; + + *error_code = MPI_SUCCESS; + + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &myrank); + FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteComplete called\n", + myrank, nprocs); + + /* do something with status_set_bytes? */ +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_wrcoll.c index 5e7dc02281..c9c5f75d02 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_wrcoll.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_wrcoll.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_write.c index 26c977311f..c3eea50f60 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_write.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_testfs/ad_testfs_write.c @@ -1,7 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. */ @@ -23,15 +21,15 @@ void ADIOI_TESTFS_WriteContig(ADIO_File fd, void *buf, int count, MPI_Type_size(datatype, &datatype_size); FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteContig called on %s\n", myrank, nprocs, fd->filename); - FPRINTF(stdout, "[%d/%d] writing (buf = 0x%x, loc = %Ld, sz = %Ld)\n", - myrank, nprocs, (int) buf, (long long) offset, - (long long) datatype_size * count); + FPRINTF(stdout, "[%d/%d] writing (buf = %p, loc = %lld, sz = %lld)\n", + myrank, nprocs, buf, (long long) offset, + (long long)datatype_size * (long long)count); if (file_ptr_type != ADIO_EXPLICIT_OFFSET) { fd->fp_ind += datatype_size * count; fd->fp_sys_posn = fd->fp_ind; - FPRINTF(stdout, "[%d/%d] new file position is %Ld\n", myrank, + FPRINTF(stdout, "[%d/%d] new file position is %lld\n", myrank, nprocs, (long long) fd->fp_ind); } else { diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/.state-cache new file mode 100644 index 0000000000..4cc1420084 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/.state-cache @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/Makefile.in dissimilarity index 64% index e8d1d8b87e..bb47d2e398 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/Makefile.in @@ -1,27 +1,68 @@ -CC = @CC@ -AR = @AR@ -LIBNAME = @LIBNAME@ -srcdir = @srcdir@ - -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) - -@VPATH@ - -AD_UFS_OBJECTS = ad_ufs_close.o ad_ufs_read.o \ - ad_ufs_open.o ad_ufs_write.o ad_ufs_done.o \ - ad_ufs_fcntl.o ad_ufs_iread.o ad_ufs_iwrite.o ad_ufs_wait.o \ - ad_ufs_resize.o \ - ad_ufs.o - - -default: $(LIBNAME) - -.c.o: - $(CC) $(CFLAGS) -c $< - -$(LIBNAME): $(AD_UFS_OBJECTS) - $(AR) $(LIBNAME) $(AD_UFS_OBJECTS) - -clean: - @rm -f *.o +CC = @CC@ +AR = @AR@ +RANLIB = @RANLIB@ +LIBNAME = @LIBNAME@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +#DEFS = @DEFS@ -I. -I${srcdir} +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +#CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) +CFLAGS = @CFLAGS@ + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +C_COMPILE_SHL = $(CC_SHL) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +#C_COMPILE_SHL = $(CC_SHL) + +@VPATH@ + +AD_UFS_OBJECTS = ad_ufs_open.o ad_ufs.o + + +default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +# $(CC) $(CFLAGS) -c $< +.c.o: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE) -c $< ; \ + fi + @$(C_COMPILE) -c $< +# $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o +# @mv -f _s$*.o $*.lo +.c.lo: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE_SHL) -c $< -o _s$*.o ; \ + echo mv -f _s$*.o $*.lo ; \ + fi + @$(C_COMPILE_SHL) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + +$(LIBNAME): $(AD_UFS_OBJECTS) + $(AR) $(LIBNAME) $(AD_UFS_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_UFS_LOOBJECTS=$(AD_UFS_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_UFS_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_UFS_LOOBJECTS) + +coverage: + -@for file in ${AD_UFS_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.c index 994eb46071..014222a508 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -13,25 +12,32 @@ struct ADIOI_Fns_struct ADIO_UFS_operations = { ADIOI_UFS_Open, /* Open */ - ADIOI_UFS_ReadContig, /* ReadContig */ - ADIOI_UFS_WriteContig, /* WriteContig */ + ADIOI_GEN_OpenColl, /* OpenColl */ + ADIOI_GEN_ReadContig, /* ReadContig */ + ADIOI_GEN_WriteContig, /* WriteContig */ ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ ADIOI_GEN_SeekIndividual, /* SeekIndividual */ - ADIOI_UFS_Fcntl, /* Fcntl */ + ADIOI_GEN_Fcntl, /* Fcntl */ ADIOI_GEN_SetInfo, /* SetInfo */ ADIOI_GEN_ReadStrided, /* ReadStrided */ ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_UFS_Close, /* Close */ - ADIOI_UFS_IreadContig, /* IreadContig */ - ADIOI_UFS_IwriteContig, /* IwriteContig */ - ADIOI_UFS_ReadDone, /* ReadDone */ - ADIOI_UFS_WriteDone, /* WriteDone */ - ADIOI_UFS_ReadComplete, /* ReadComplete */ - ADIOI_UFS_WriteComplete, /* WriteComplete */ - ADIOI_UFS_IreadStrided, /* IreadStrided */ - ADIOI_UFS_IwriteStrided, /* IwriteStrided */ + ADIOI_GEN_Close, /* Close */ +#ifdef ROMIO_HAVE_WORKING_AIO + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif + 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_UFS_Resize, /* Resize */ + ADIOI_GEN_Resize, /* Resize */ ADIOI_GEN_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ }; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.h b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.h index 5463f10a39..56b988539c 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs.h @@ -1,7 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ @@ -14,18 +12,46 @@ #include #include "adio.h" -#ifndef NO_AIO -#ifdef AIO_SUN -#include -#else +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H #include -#ifdef NEEDS_ADIOCB_T -typedef struct adiocb adiocb_t; #endif +#ifdef HAVE_SYS_AIO_H +#include #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_UFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, int wr, void *handle); +void ADIOI_UFS_Open(ADIO_File fd, int *error_code); +void ADIOI_UFS_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_UFS_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_UFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int + *error_code); +int ADIOI_UFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int + *error_code); +void ADIOI_UFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int + *error_code); +void ADIOI_UFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, + int *error_code); +void ADIOI_UFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int + *error_code); + #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_close.c deleted file mode 100644 index 38d3e8b2c4..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_close.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_Close(ADIO_File fd, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_UFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_done.c deleted file mode 100644 index 1bfd7d6bca..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_done.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -int ADIOI_UFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ -#ifndef NO_AIO - int done=0; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_UFS_READDONE"; -#endif -#ifdef AIO_SUN - aio_result_t *result=0, *tmp; -#else - int err; -#endif -#ifdef AIO_HANDLE_IN_AIOCB - struct aiocb *tmp1; -#endif -#endif - - if (*request == ADIO_REQUEST_NULL) { - *error_code = MPI_SUCCESS; - return 1; - } - -#ifdef NO_AIO -/* HP, FreeBSD, Linux */ -#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; -#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 */ - if ((*request)->queued) { - tmp1 = (struct aiocb *) (*request)->handle; - errno = aio_error(tmp1->aio_handle); - if (errno == EINPROG) { - done = 0; - *error_code = MPI_SUCCESS; - } - else { - err = aio_return(tmp1->aio_handle); - (*request)->nbytes = err; - errno = aio_error(tmp1->aio_handle); - - 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - } - 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); -#endif - -#elif (!defined(NO_AIO) && !defined(AIO_SUN)) -/* DEC, SGI IRIX 5 and 6 */ - if ((*request)->queued) { - errno = aio_error((const struct aiocb *) (*request)->handle); - if (errno == EINPROGRESS) { - done = 0; - *error_code = MPI_SUCCESS; - } - else { - err = aio_return((struct aiocb *) (*request)->handle); - (*request)->nbytes = err; - errno = aio_error((struct aiocb *) (*request)->handle); - - 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - } - 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); -#endif - -#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. */ - if ((*request)->queued) ADIOI_Del_req_from_list(request); - - (*request)->fd->async_count--; - if ((*request)->handle) ADIOI_Free((*request)->handle); - ADIOI_Free_request((ADIOI_Req_node *) (*request)); - *request = ADIO_REQUEST_NULL; - } - return done; -#endif - -} - - -int ADIOI_UFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - return ADIOI_UFS_ReadDone(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_fcntl.c deleted file mode 100644 index 2100af3374..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_fcntl.c +++ /dev/null @@ -1,180 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" -#include "adio_extern.h" -#ifdef MPISGI -#include "mpisgi2.h" -#endif - -void ADIOI_UFS_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; - ADIO_Offset curr_fsize, alloc_size, size, len, done; - ADIO_Status status; - char *buf; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_UFS_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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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 = CtvAccess(ADIOI_Flatlist); - while (flat_file->type != fd->filetype) - flat_file = flat_file->next; - for (i=0; icount; 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 = lseek(fd->fd_sys, 0, SEEK_END); - 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); - } - 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 = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ; - buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ); - done = 0; - - for (i=0; i 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; ifp_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; - break; - - case ADIO_FCNTL_SET_ATOMICITY: - fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; - *error_code = MPI_SUCCESS; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_UFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_flush.c deleted file mode 100644 index bc463ce20b..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_flush.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_Flush(ADIO_File fd, int *error_code) -{ - ADIOI_GEN_Flush(fd, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_hints.c deleted file mode 100644 index 1261f6e332..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_hints.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) -{ - ADIOI_GEN_SetInfo(fd, users_info, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iread.c deleted file mode 100644 index 8ac8d97d13..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iread.c +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_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 len, typesize; -#ifdef NO_AIO - ADIO_Status status; -#else - int err=-1; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_UFS_IREADCONTIG"; -#endif -#endif - - (*request) = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_READ; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size(datatype, &typesize); - len = count * typesize; - -#ifdef NO_AIO - /* HP, FreeBSD, Linux */ - /* no support for nonblocking I/O. Use blocking I/O. */ - - ADIOI_UFS_ReadContig(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) { - MPI_Get_elements(&status, MPI_BYTE, &len); - (*request)->nbytes = len; - } -#endif - -#else - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - err = ADIOI_UFS_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); - } - else *error_code = MPI_SUCCESS; -#endif -#endif - - fd->fp_sys_posn = -1; /* set it to null. */ - fd->async_count++; -} - - - -void ADIOI_UFS_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_UFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iwrite.c deleted file mode 100644 index b3e3b04164..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_iwrite.c +++ /dev/null @@ -1,264 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code) -{ - int len, typesize; -#ifdef NO_AIO - ADIO_Status status; -#else - int err=-1; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_UFS_IWRITECONTIG"; -#endif -#endif - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size(datatype, &typesize); - len = count * typesize; - -#ifdef NO_AIO - /* HP, FreeBSD, Linux */ - /* no support for nonblocking I/O. Use blocking I/O. */ - - ADIOI_UFS_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) { - MPI_Get_elements(&status, MPI_BYTE, &len); - (*request)->nbytes = len; - } -#endif - -#else - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - err = ADIOI_UFS_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); - } - else *error_code = MPI_SUCCESS; -#endif -#endif - - fd->fp_sys_posn = -1; /* set it to null. */ - fd->async_count++; -} - - - - -void ADIOI_UFS_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_UFS_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. */ - -int ADIOI_UFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, void *handle) -{ - int err=-1, fd_sys; - -#ifndef NO_AIO - int error_code; -#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) err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result); - else err = aioread(fd_sys, buf, len, offset, SEEK_SET, result); - - if (err == -1) { - if (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) err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result); - else err = aioread(fd_sys, buf, len, offset, SEEK_SET, result); - - while (err == -1) { - if (errno == EAGAIN) { - /* sleep and try again */ - sleep(1); - if (wr) err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result); - else err = aioread(fd_sys, buf, len, offset, SEEK_SET, result); - } - else { - FPRINTF(stderr, "Unknown errno %d in ADIOI_UFS_aio\n", errno); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - } - else { - FPRINTF(stderr, "Unknown errno %d in ADIOI_UFS_aio\n", 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) err = aio_write(fd_sys, aiocbp); - else err = aio_read(fd_sys, aiocbp); - - if (err == -1) { - if (errno == EAGAIN) { - /* exceeded the max. no. of outstanding requests. - complete all previous async. requests and try again. */ - - ADIOI_Complete_async(&error_code); - if (wr) err = aio_write(fd_sys, aiocbp); - else err = aio_read(fd_sys, aiocbp); - - while (err == -1) { - if (errno == EAGAIN) { - /* sleep and try again */ - sleep(1); - if (wr) err = aio_write(fd_sys, aiocbp); - else err = aio_read(fd_sys, aiocbp); - } - else { - FPRINTF(stderr, "Unknown errno %d in ADIOI_UFS_aio\n", errno); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - } - else { - FPRINTF(stderr, "Unknown errno %d in ADIOI_UFS_aio\n", 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_nbytes = len; - -#ifdef AIO_PRIORITY_DEFAULT -/* DEC */ - aiocbp->aio_reqprio = AIO_PRIO_DFL; /* not needed in DEC Unix 4.0 */ - aiocbp->aio_sigevent.sigev_signo = 0; -#else - aiocbp->aio_reqprio = 0; -#endif - -#ifdef AIO_SIGNOTIFY_NONE -/* SGI IRIX 6 */ - aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE; -#else - aiocbp->aio_sigevent.sigev_signo = 0; -#endif - - if (wr) err = aio_write(aiocbp); - else err = aio_read(aiocbp); - - if (err == -1) { - if (errno == EAGAIN) { - /* exceeded the max. no. of outstanding requests. - complete all previous async. requests and try again. */ - - ADIOI_Complete_async(&error_code); - if (wr) err = aio_write(aiocbp); - else err = aio_read(aiocbp); - - while (err == -1) { - if (errno == EAGAIN) { - /* sleep and try again */ - sleep(1); - if (wr) err = aio_write(aiocbp); - else err = aio_read(aiocbp); - } - else { - FPRINTF(stderr, "Unknown errno %d in ADIOI_UFS_aio\n", errno); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - } - else { - FPRINTF(stderr, "Unknown errno %d in ADIOI_UFS_aio\n", errno); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - - *((struct aiocb **) handle) = aiocbp; -#endif - - return err; -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_open.c index fa63416489..1a154fa97e 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_open.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -11,9 +10,7 @@ void ADIOI_UFS_Open(ADIO_File fd, int *error_code) { int perm, old_mask, amode; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_UFS_OPEN"; -#endif if (fd->perm == ADIO_PERM_NULL) { old_mask = umask(022); @@ -34,19 +31,73 @@ void ADIOI_UFS_Open(ADIO_File fd, int *error_code) if (fd->access_mode & ADIO_EXCL) amode = amode | O_EXCL; + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); +#endif fd->fd_sys = open(fd->filename, amode, perm); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); +#endif + fd->fd_direct = -1; - if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) + if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } -#ifdef PRINT_ERR_MSG - *error_code = (fd->fd_sys == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS; -#else + /* --BEGIN ERROR HANDLING-- */ 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); + 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)); + } } + /* --END ERROR HANDLING-- */ else *error_code = MPI_SUCCESS; -#endif } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_rdcoll.c deleted file mode 100644 index 39d412620c..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_rdcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_read.c deleted file mode 100644 index 0315a504c9..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_read.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_ReadContig(ADIO_File fd, void *buf, int count, - 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_UFS_READCONTIG"; -#endif - - MPI_Type_size(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) - lseek(fd->fd_sys, offset, SEEK_SET); - err = read(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + len; - /* individual file pointer not updated */ - } - else { /* read from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) - lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - err = read(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - 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); - } - else *error_code = MPI_SUCCESS; -#endif -} - - - - -void ADIOI_UFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_resize.c deleted file mode 100644 index f8263e9a11..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_resize.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_UFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_seek.c deleted file mode 100644 index 08a7dcbdb4..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_seek.c +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -ADIO_Offset ADIOI_UFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code) -{ - return ADIOI_GEN_SeekIndividual(fd, offset, whence, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wait.c deleted file mode 100644 index baa57e3134..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wait.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ -#ifndef NO_AIO -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_UFS_READCOMPLETE"; -#endif -#ifdef AIO_SUN - aio_result_t *result=0, *tmp; -#else - int err; -#endif -#ifdef AIO_HANDLE_IN_AIOCB - struct aiocb *tmp1; -#endif -#endif - - if (*request == ADIO_REQUEST_NULL) { - *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 */ - if ((*request)->queued) { - do { - err = aio_suspend(1, (struct aiocb **) &((*request)->handle)); - } while ((err == -1) && (errno == EINTR)); - - tmp1 = (struct aiocb *) (*request)->handle; - if (err != -1) { - err = aio_return(tmp1->aio_handle); - (*request)->nbytes = err; - errno = aio_error(tmp1->aio_handle); - } - else (*request)->nbytes = -1; - -/* on DEC, it is required to call aio_return to dequeue the request. - IBM man pages don't indicate what function to use for dequeue. - I'm assuming it is aio_return! POSIX says aio_return may be called - only once on a given 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - else *error_code = MPI_SUCCESS; - -#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 */ - if ((*request)->queued) { - do { - err = aio_suspend((const struct aiocb **) &((*request)->handle), 1, 0); - } while ((err == -1) && (errno == EINTR)); - - if (err != -1) { - err = aio_return((struct aiocb *) (*request)->handle); - (*request)->nbytes = err; - errno = aio_error((struct aiocb *) (*request)->handle); - } - 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - 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 - -#ifndef NO_AIO - 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 - will call MPI_Wait later, which would require status to - be filled. Ugly but works. queued = -1 should be used only - in ADIOI_Complete_async. - This should not affect the user in any way. */ - - /* 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) ADIOI_Free((*request)->handle); - ADIOI_Free_request((ADIOI_Req_node *) (*request)); - *request = ADIO_REQUEST_NULL; - } - -#else -/* HP, FreeBSD, Linux */ - -#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; -#endif -} - - -void ADIOI_UFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - ADIOI_UFS_ReadComplete(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wrcoll.c deleted file mode 100644 index 0d00d1c651..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_wrcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_write.c deleted file mode 100644 index 1fa2ec20dc..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_ufs/ad_ufs_write.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_ufs.h" - -void ADIOI_UFS_WriteContig(ADIO_File fd, void *buf, int count, - 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_UFS_WRITECONTIG"; -#endif - - MPI_Type_size(datatype, &datatype_size); - len = datatype_size * count; - - if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - if (fd->fp_sys_posn != offset) - lseek(fd->fd_sys, offset, SEEK_SET); - err = write(fd->fd_sys, buf, len); - fd->fp_sys_posn = offset + err; - /* individual file pointer not updated */ - } - else { /* write from curr. location of ind. file pointer */ - if (fd->fp_sys_posn != fd->fp_ind) - lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); - err = write(fd->fd_sys, buf, len); - fd->fp_ind += err; - fd->fp_sys_posn = fd->fp_ind; - } - -#ifdef HAVE_STATUS_SET_BYTES - if (err != -1 && status) 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 -} - - - -void ADIOI_UFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/.state-cache new file mode 100644 index 0000000000..1ffb463358 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/.state-cache @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/Makefile.in index c6db4ca33d..45f613df80 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/Makefile.in @@ -1,26 +1,49 @@ CC = @CC@ AR = @AR@ +RANLIB = @RANLIB@ LIBNAME = @LIBNAME@ srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE_SHL = $(CC_SHL) @VPATH@ -AD_XFS_OBJECTS = ad_xfs_close.o ad_xfs_read.o \ +AD_XFS_OBJECTS = ad_xfs_read.o \ ad_xfs_open.o ad_xfs_write.o ad_xfs_done.o \ ad_xfs_fcntl.o ad_xfs_iread.o ad_xfs_iwrite.o ad_xfs_wait.o \ - ad_xfs_resize.o ad_xfs_seek.o ad_xfs_hints.o \ + ad_xfs_resize.o ad_xfs_hints.o \ ad_xfs.o default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo .c.o: $(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + $(LIBNAME): $(AD_XFS_OBJECTS) $(AR) $(LIBNAME) $(AD_XFS_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_XFS_LOOBJECTS=$(AD_XFS_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_XFS_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_XFS_LOOBJECTS) clean: - @rm -f *.o + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.c index 6c7a817de2..07730aa2d7 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -13,25 +12,32 @@ struct ADIOI_Fns_struct ADIO_XFS_operations = { ADIOI_XFS_Open, /* Open */ + ADIOI_GEN_OpenColl, /* OpenColl */ ADIOI_XFS_ReadContig, /* ReadContig */ ADIOI_XFS_WriteContig, /* WriteContig */ ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ - ADIOI_XFS_SeekIndividual, /* SeekIndividual */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ ADIOI_XFS_Fcntl, /* Fcntl */ ADIOI_XFS_SetInfo, /* SetInfo */ ADIOI_GEN_ReadStrided, /* ReadStrided */ ADIOI_GEN_WriteStrided, /* WriteStrided */ - ADIOI_XFS_Close, /* Close */ - ADIOI_XFS_IreadContig, /* IreadContig */ - ADIOI_XFS_IwriteContig, /* IwriteContig */ - ADIOI_XFS_ReadDone, /* ReadDone */ - ADIOI_XFS_WriteDone, /* WriteDone */ - ADIOI_XFS_ReadComplete, /* ReadComplete */ - ADIOI_XFS_WriteComplete, /* WriteComplete */ - ADIOI_XFS_IreadStrided, /* IreadStrided */ - ADIOI_XFS_IwriteStrided, /* IwriteStrided */ + ADIOI_GEN_Close, /* Close */ +#if defined(ROMIO_HAVE_WORKING_AIO) + ADIOI_GEN_IreadContig, /* IreadContig */ + ADIOI_GEN_IwriteContig, /* IwriteContig */ +#else + ADIOI_FAKE_IreadContig, /* IreadContig */ + ADIOI_FAKE_IwriteContig, /* IwriteContig */ +#endif /* ROMIO_HAVE_WORKING_AIO */ + 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_XFS_Resize, /* Resize */ ADIOI_GEN_Delete, /* Delete */ + ADIOI_GEN_Feature, /* Features */ }; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.h index e26c4fc35e..c529abcd91 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.h +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -9,19 +8,33 @@ #ifndef AD_XFS_INCLUDE #define AD_XFS_INCLUDE +#define _XOPEN_SOURCE 500 #include #include #include #include "adio.h" -#include -int ADIOI_XFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, void *handle); - -#if (defined(HAVE_PREAD64) && (_ABIO32 == 1)) -# define pread pread64 -# define pwrite pwrite64 +#if defined(MPISGI) +#include "xfs/xfs_fs.h" +#ifndef __USE_LARGEFILE64 +#define __USE_LARGEFILE64 +#endif +typedef struct aiocb64 aiocb64_t; #endif -/* above needed for IRIX 6.5 */ + +void ADIOI_XFS_Open(ADIO_File fd, int *error_code); +void ADIOI_XFS_Close(ADIO_File fd, int *error_code); +void ADIOI_XFS_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_XFS_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_XFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int + *error_code); +void ADIOI_XFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_close.c deleted file mode 100644 index 211af31b70..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_close.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -void ADIOI_XFS_Close(ADIO_File fd, int *error_code) -{ - int err, err1; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_XFS_CLOSE"; -#endif - - err = close(fd->fd_sys); - err1 = close(fd->fd_direct); - -#ifdef PRINT_ERR_MSG - *error_code = ((err == 0) && (err1 == 0)) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; -#else - if ((err == -1) || (err1 == -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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_done.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_done.c deleted file mode 100644 index 8ac1642645..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_done.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -int ADIOI_XFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - int err, done=0; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_XFS_READDONE"; -#endif - - if (*request == ADIO_REQUEST_NULL) { - *error_code = MPI_SUCCESS; - return 1; - } - - if ((*request)->queued) { - errno = aio_error64((const aiocb64_t *) (*request)->handle); - if (errno == EINPROGRESS) { - done = 0; - *error_code = MPI_SUCCESS; - } - else { - err = aio_return64((aiocb64_t *) (*request)->handle); - (*request)->nbytes = err; - errno = aio_error64((const aiocb64_t *) (*request)->handle); - - 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - } - 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); -#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) ADIOI_Free((*request)->handle); - ADIOI_Free_request((ADIOI_Req_node *) (*request)); - *request = ADIO_REQUEST_NULL; - /* status to be filled */ - } - return done; -} - - -int ADIOI_XFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - return ADIOI_XFS_ReadDone(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_fcntl.c dissimilarity index 72% index 589496d662..7c49da24da 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_fcntl.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_fcntl.c @@ -1,142 +1,81 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" -#include "adio_extern.h" -#ifdef MPISGI -#include "mpisgi2.h" -#endif - -void ADIOI_XFS_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; - struct flock64 fl; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_XFS_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, ©_etype); - MPI_Type_commit(©_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, ©_filetype); - MPI_Type_commit(©_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; icount; 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 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; -#endif - break; - - case ADIO_FCNTL_SET_DISKSPACE: - i = 0; - fl.l_start = 0; - fl.l_whence = SEEK_SET; - fl.l_len = fcntl_struct->diskspace; - err = fcntl(fd->fd_sys, F_RESVSP64, &fl); - if (err) i = 1; - if (fcntl_struct->diskspace > lseek64(fd->fd_sys, 0, SEEK_END)) { - /* also need to set the file size */ - err = ftruncate64(fd->fd_sys, fcntl_struct->diskspace); - if (err) i = 1; - } -#ifdef PRINT_ERR_MSG - *error_code = (i == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; -#else - if (i == 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 - 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; - break; - - default: - FPRINTF(stderr, "Unknown flag passed to ADIOI_XFS_Fcntl\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_xfs.h" +#include "adio_extern.h" +#include + +#ifndef HAVE_LSEEK64 +#define lseek64 lseek +#endif + +void ADIOI_XFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code) +{ + int i, err; +#if defined(LINUX) && defined(MPISGI) + struct xfs_flock64 fl; +#else + struct flock64 fl; +#endif + static char myname[] = "ADIOI_XFS_FCNTL"; + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + fcntl_struct->fsize = lseek64(fd->fd_sys, 0, SEEK_END); + if (fcntl_struct->fsize == -1) { + *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; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + i = 0; + fl.l_start = 0; + fl.l_whence = SEEK_SET; + fl.l_len = fcntl_struct->diskspace; + +#if defined(LINUX) && defined(MPISGI) + err = ioctl(fd->fd_sys, XFS_IOC_RESVSP64, &fl); +#else + err = fcntl(fd->fd_sys, F_RESVSP64, &fl); +#endif + + if (err) i = 1; + if (fcntl_struct->diskspace > lseek64(fd->fd_sys, 0, SEEK_END)) { + /* also need to set the file size */ + err = ftruncate64(fd->fd_sys, fcntl_struct->diskspace); + if (err) i = 1; + } + + if (i == 1) { + *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; + break; + + case ADIO_FCNTL_SET_ATOMICITY: + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1; + *error_code = MPI_SUCCESS; + break; + + default: + /* --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-- */ + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_flush.c deleted file mode 100644 index 34c3ca05cc..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_flush.c +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -void ADIOI_XFS_Flush(ADIO_File fd, int *error_code) -{ - ADIOI_GEN_Flush(fd, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_hints.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_hints.c index d4fac1015f..97909b3819 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_hints.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_hints.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -9,32 +8,76 @@ #include "ad_xfs.h" #include "adio_extern.h" +static unsigned xfs_direct_read_chunk_size; +static unsigned xfs_direct_write_chunk_size; + void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) { - char *value; + char *value, * c; int flag; + static char xfs_initialized = 0; - if (!(fd->info)) MPI_Info_create(&(fd->info)); + if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info)); - MPI_Info_set(fd->info, "direct_read", "false"); - MPI_Info_set(fd->info, "direct_write", "false"); + ADIOI_Info_set(fd->info, "direct_read", "false"); + ADIOI_Info_set(fd->info, "direct_write", "false"); fd->direct_read = fd->direct_write = 0; - - /* has user specified values for keys "direct_read" and "direct wirte"? */ + + if (!xfs_initialized) { + xfs_initialized = 1; + c = getenv("MPIO_DIRECT_READ_CHUNK_SIZE"); + if (c) { + int io; + io = atoi(c); + if (io <= 0) { + fprintf(stderr, +"MPI: Ignoring an invalid setting for MPIO_DIRECT_READ_CHUNK_SIZE.\n" +" It must be set to a positive integer value.\n"); + } else { + xfs_direct_read_chunk_size = io; + } + } else { + xfs_direct_read_chunk_size = 0; + } + + c = getenv("MPIO_DIRECT_WRITE_CHUNK_SIZE"); + if (c) { + int io; + io = atoi(c); + if (io <= 0) { + fprintf(stderr, +"MPI: Ignoring an invalid setting for MPIO_DIRECT_WRITE_CHUNK_SIZE.\n" +" It must be set to a positive integer value.\n"); + } else { + xfs_direct_write_chunk_size = io; + } + } else { + xfs_direct_write_chunk_size = 0; + } + } + + if (!fd->hints->initialized) { + fd->hints->fs_hints.xfs.read_chunk_sz = + xfs_direct_read_chunk_size; + fd->hints->fs_hints.xfs.write_chunk_sz = + xfs_direct_write_chunk_size; + } + + /* has user specified values for keys "direct_read" and "direct write"? */ if (users_info != MPI_INFO_NULL) { value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL, value, &flag); if (flag && !strcmp(value, "true")) { - MPI_Info_set(fd->info, "direct_read", "true"); + ADIOI_Info_set(fd->info, "direct_read", "true"); fd->direct_read = 1; } - MPI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL, value, &flag); if (flag && !strcmp(value, "true")) { - MPI_Info_set(fd->info, "direct_write", "true"); + ADIOI_Info_set(fd->info, "direct_write", "true"); fd->direct_write = 1; } @@ -44,8 +87,10 @@ void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) /* set the values for collective I/O and data sieving parameters */ ADIOI_GEN_SetInfo(fd, users_info, error_code); + /* Environment variables override MPI_Info hints */ if (ADIOI_Direct_read) fd->direct_read = 1; if (ADIOI_Direct_write) fd->direct_write = 1; + /* environment variables checked in ADIO_Init */ *error_code = MPI_SUCCESS; diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iread.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iread.c deleted file mode 100644 index d11c581b97..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iread.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -void ADIOI_XFS_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 len, typesize, err=-1; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_XFS_IREADCONTIG"; -#endif - - (*request) = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_READ; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size(datatype, &typesize); - len = count * typesize; - - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - err = ADIOI_XFS_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); - } - else *error_code = MPI_SUCCESS; -#endif - - fd->fp_sys_posn = -1; /* set it to null. */ - fd->async_count++; -} - - - -void ADIOI_XFS_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_XFS_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 -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iwrite.c deleted file mode 100644 index 810de3db34..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_iwrite.c +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -void ADIOI_XFS_IwriteContig(ADIO_File fd, void *buf, int count, - MPI_Datatype datatype, int file_ptr_type, - ADIO_Offset offset, ADIO_Request *request, int *error_code) -{ - int len, typesize, err=-1; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_XFS_IWRITECONTIG"; -#endif - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fd; - (*request)->datatype = datatype; - - MPI_Type_size(datatype, &typesize); - len = count * typesize; - - if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - err = ADIOI_XFS_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); - } - else *error_code = MPI_SUCCESS; -#endif - - fd->fp_sys_posn = -1; /* set it to null. */ - fd->async_count++; -} - - - -void ADIOI_XFS_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_XFS_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. */ - -int ADIOI_XFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, - int wr, void *handle) -{ - int err, error_code; - aiocb64_t *aiocbp; - - aiocbp = (aiocb64_t *) ADIOI_Calloc(sizeof(aiocb64_t), 1); - - if (((wr && fd->direct_write) || (!wr && fd->direct_read)) - && !(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz) && - !(len % fd->d_miniosz) && (len >= fd->d_miniosz) && - (len <= fd->d_maxiosz)) - aiocbp->aio_fildes = fd->fd_direct; - else aiocbp->aio_fildes = fd->fd_sys; - - aiocbp->aio_offset = offset; - aiocbp->aio_buf = buf; - aiocbp->aio_nbytes = len; - aiocbp->aio_reqprio = 0; - -#ifdef AIO_SIGNOTIFY_NONE -/* SGI IRIX 6 */ - aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE; -#else - aiocbp->aio_sigevent.sigev_signo = 0; -#endif - - if (wr) err = aio_write64(aiocbp); - else err = aio_read64(aiocbp); - - if (err == -1) { - if (errno == EAGAIN) { - /* exceeded the max. no. of outstanding requests. - complete all previous async. requests and try again. */ - - ADIOI_Complete_async(&error_code); - if (wr) err = aio_write64(aiocbp); - else err = aio_read64(aiocbp); - - while (err == -1) { - if (errno == EAGAIN) { - /* sleep and try again */ - sleep(1); - if (wr) err = aio_write64(aiocbp); - else err = aio_read64(aiocbp); - } - else { - FPRINTF(stderr, "Unknown errno %d in ADIOI_XFS_aio\n", errno); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - } - else { - FPRINTF(stderr, "Unknown errno %d in ADIOI_XFS_aio\n", errno); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } - - *((aiocb64_t **) handle) = aiocbp; - return err; -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_open.c index b0949d7e6a..fa073fb316 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_open.c @@ -1,20 +1,30 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ +#define _GNU_SOURCE // for O_DIRECT + #include "ad_xfs.h" +#include +#ifdef HAVE_STDDEF_H +#include +#endif + +#ifndef HAVE_LSEEK64 +#define lseek64 lseek +#endif void ADIOI_XFS_Open(ADIO_File fd, int *error_code) { - int perm, old_mask, amode, amode_direct; + int perm, amode, amode_direct, factor; + unsigned int old_mask; struct dioattr st; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_XFS_OPEN"; -#endif + unsigned read_chunk_sz = fd->hints->fs_hints.xfs.read_chunk_sz; + unsigned write_chunk_sz = fd->hints->fs_hints.xfs.write_chunk_sz; if (fd->perm == ADIO_PERM_NULL) { old_mask = umask(022); @@ -42,10 +52,51 @@ void ADIOI_XFS_Open(ADIO_File fd, int *error_code) fd->fd_direct = open(fd->filename, amode_direct, perm); if (fd->fd_direct != -1) { + +#if defined(MPISGI) + ioctl(fd->fd_direct, XFS_IOC_DIOINFO, &st); +#else fcntl(fd->fd_direct, F_DIOINFO, &st); +#endif + fd->d_mem = st.d_mem; fd->d_miniosz = st.d_miniosz; - fd->d_maxiosz = st.d_maxiosz; + + if (read_chunk_sz == 0) { + fd->hints->fs_hints.xfs.read_chunk_sz = st.d_maxiosz; + } else { + /* + * MPIO_DIRECT_READ_CHUNK_SIZE was set. + * Make read_chunk_sz a multiple of d_miniosz. + */ + factor = read_chunk_sz / fd->d_miniosz; + if (factor == 0 || read_chunk_sz != fd->d_miniosz * factor) { + fd->hints->fs_hints.xfs.read_chunk_sz = + fd->d_miniosz * (factor + 1); + } + } + + if (write_chunk_sz == 0) { + fd->hints->fs_hints.xfs.write_chunk_sz = st.d_maxiosz; + } else { + /* + * MPIO_DIRECT_WRITE_CHUNK_SIZE was set. + * Make write_chunk_sz a multiple of d_miniosz. + */ + factor = write_chunk_sz / fd->d_miniosz; + if (factor == 0 || write_chunk_sz != fd->d_miniosz * factor) { + fd->hints->fs_hints.xfs.write_chunk_sz = + fd->d_miniosz * (factor + 1); + } + } + + if (fd->d_mem > XFS_MEMALIGN) { + FPRINTF(stderr, "MPI: Run-time Direct-IO memory alignment, %d, does not match compile-time value, %d.\n", + fd->d_mem, XFS_MEMALIGN); + FPRINTF(stderr, "MPI: Report this error and rerun with Direct-IO disabled.\n"); + close(fd->fd_direct); + fd->fd_direct = -1; + } } if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) @@ -53,15 +104,10 @@ void ADIOI_XFS_Open(ADIO_File fd, int *error_code) fd->fp_sys_posn = -1; /* set it to null because we use pread/pwrite */ -#ifdef PRINT_ERR_MSG - *error_code = ((fd->fd_sys == -1) || (fd->fd_direct == -1)) ? - MPI_ERR_UNKNOWN : MPI_SUCCESS; -#else if ((fd->fd_sys == -1) || (fd->fd_direct == -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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_rdcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_rdcoll.c deleted file mode 100644 index c99bad403c..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_rdcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -void ADIOI_XFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_read.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_read.c index 9b4225f9e1..38b28f0e3b 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_read.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_read.c @@ -1,12 +1,16 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "ad_xfs.h" +#ifdef HAVE_MALLOC_H +#include +#endif + +/* style: allow:free:2 sig:0 */ static void ADIOI_XFS_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, ADIO_Offset offset, int *err); @@ -17,9 +21,7 @@ void ADIOI_XFS_ReadContig(ADIO_File fd, void *buf, int count, { int err=-1, datatype_size, len, diff, size, nbytes; void *newbuf; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_XFS_READCONTIG"; -#endif MPI_Type_size(datatype, &datatype_size); len = datatype_size * count; @@ -61,7 +63,7 @@ void ADIOI_XFS_ReadContig(ADIO_File fd, void *buf, int count, ADIOI_XFS_Aligned_Mem_File_Read(fd, newbuf, size, offset, &err); if (err > 0) memcpy(buf, newbuf, err); nbytes += err; - free(newbuf); + ADIOI_Free(newbuf); } else nbytes += pread(fd->fd_sys, buf, size, offset); } @@ -75,7 +77,7 @@ void ADIOI_XFS_ReadContig(ADIO_File fd, void *buf, int count, if (newbuf) { ADIOI_XFS_Aligned_Mem_File_Read(fd, newbuf, len, offset, &err); if (err > 0) memcpy(buf, newbuf, err); - free(newbuf); + ADIOI_Free(newbuf); } else err = pread(fd->fd_sys, buf, len, offset); } @@ -87,16 +89,12 @@ void ADIOI_XFS_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 } @@ -104,6 +102,7 @@ void ADIOI_XFS_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, ADIO_Offset offset, int *err) { int ntimes, rem, newrem, i, size, nbytes; + unsigned read_chunk_sz = fd->hints->fs_hints.xfs.read_chunk_sz; /* memory buffer is aligned, offset in file is aligned, io_size may or may not be of the right size. @@ -111,33 +110,33 @@ void ADIOI_XFS_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, use buffered I/O for remaining. */ if (!(len % fd->d_miniosz) && - (len >= fd->d_miniosz) && (len <= fd->d_maxiosz)) + (len >= fd->d_miniosz) && (len <= read_chunk_sz)) *err = pread(fd->fd_direct, buf, len, offset); else if (len < fd->d_miniosz) *err = pread(fd->fd_sys, buf, len, offset); - else if (len > fd->d_maxiosz) { - ntimes = len/(fd->d_maxiosz); - rem = len - ntimes * fd->d_maxiosz; + else if (len > read_chunk_sz) { + ntimes = len/(read_chunk_sz); + rem = len - ntimes * read_chunk_sz; nbytes = 0; for (i=0; ifd_direct, ((char *)buf) + i * fd->d_maxiosz, - fd->d_maxiosz, offset); - offset += fd->d_maxiosz; + nbytes += pread(fd->fd_direct, ((char *)buf) + i * read_chunk_sz, + read_chunk_sz, offset); + offset += read_chunk_sz; } if (rem) { if (!(rem % fd->d_miniosz)) nbytes += pread(fd->fd_direct, - ((char *)buf) + ntimes * fd->d_maxiosz, rem, offset); + ((char *)buf) + ntimes * read_chunk_sz, rem, offset); else { newrem = rem % fd->d_miniosz; size = rem - newrem; if (size) { nbytes += pread(fd->fd_direct, - ((char *)buf) + ntimes * fd->d_maxiosz, size, offset); + ((char *)buf) + ntimes * read_chunk_sz, size, offset); offset += size; } nbytes += pread(fd->fd_sys, - ((char *)buf) + ntimes*fd->d_maxiosz + size, newrem, offset); + ((char *)buf) + ntimes * read_chunk_sz + size, newrem, offset); } } *err = nbytes; @@ -150,13 +149,3 @@ void ADIOI_XFS_Aligned_Mem_File_Read(ADIO_File fd, void *buf, int len, *err = nbytes; } } - - -void ADIOI_XFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_resize.c index 9465f60532..9a840911ea 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_resize.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_resize.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -11,19 +10,13 @@ void ADIOI_XFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) { int err; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_XFS_RESIZE"; -#endif err = ftruncate64(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); + *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 } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_seek.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_seek.c deleted file mode 100644 index da9c36022b..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_seek.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" -#include "adio_extern.h" - -ADIO_Offset ADIOI_XFS_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 abs_off_in_filetype=0, off; - ADIOI_Flatlist_node *flat_file; - - int i, n_etypes_in_filetype, n_filetypes, etype_in_filetype; - 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; icount; 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; - } - - /* no need to lseek, since we use pread/pwrite */ - /* err = lseek64(fd->fd_sys, off, SEEK_SET); */ - - fd->fp_ind = off; - fd->fp_sys_posn = -1; /* null because we use pread/pwrite */ - - *error_code = MPI_SUCCESS; - return off; -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wait.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wait.c deleted file mode 100644 index dd5a91a167..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wait.c +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -void ADIOI_XFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - int err; -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_XFS_READCOMPLETE"; -#endif - - if (*request == ADIO_REQUEST_NULL) { - *error_code = MPI_SUCCESS; - return; - } - - if ((*request)->queued) { - do { - err = aio_suspend64((const aiocb64_t **) &((*request)->handle), 1, 0); - } while ((err == -1) && (errno == EINTR)); - - if (err != -1) { - err = aio_return64((aiocb64_t *) (*request)->handle); - (*request)->nbytes = err; - errno = aio_error64((aiocb64_t *) (*request)->handle); - } - 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); - } - else *error_code = MPI_SUCCESS; -#endif - } - else *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) { - - /* 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 - will call MPI_Wait later, which would require status to - be filled. Ugly but works. queued = -1 should be used only - in ADIOI_Complete_async. - This should not affect the user in any way. */ - - /* 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) ADIOI_Free((*request)->handle); - ADIOI_Free_request((ADIOI_Req_node *) (*request)); - *request = ADIO_REQUEST_NULL; - } -} - - -void ADIOI_XFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code) -{ - ADIOI_XFS_ReadComplete(request, status, error_code); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wrcoll.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wrcoll.c deleted file mode 100644 index 036973bf76..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_wrcoll.c +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "ad_xfs.h" - -void ADIOI_XFS_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); -} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_write.c b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_write.c index 95f3a71656..ecb9c7b801 100644 --- a/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_write.c +++ b/src/libs/ck-libs/ampi/romio/adio/ad_xfs/ad_xfs_write.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -8,18 +7,23 @@ #include "ad_xfs.h" -static void ADIOI_XFS_Aligned_Mem_File_Write(ADIO_File fd, void *buf, int len, - ADIO_Offset offset, int *err); +#ifdef HAVE_MALLOC_H +#include +#endif + +/* style: allow:free:2 sig:0 */ + +static int ADIOI_XFS_Aligned_Mem_File_Write(ADIO_File fd, void *buf, + ADIO_Offset len, ADIO_Offset offset); void ADIOI_XFS_WriteContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, int file_ptr_type, ADIO_Offset offset, ADIO_Status *status, int *error_code) { - int err=-1, datatype_size, len, diff, size, nbytes; + int err=-1, datatype_size, diff, size; + ssize_t len; void *newbuf; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_XFS_WRITECONTIG"; -#endif MPI_Type_size(datatype, &datatype_size); len = datatype_size * count; @@ -28,44 +32,48 @@ void ADIOI_XFS_WriteContig(ADIO_File fd, void *buf, int count, if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; - if (!(fd->direct_write)) /* direct I/O not enabled */ + if (!(fd->direct_write)) { /* direct I/O not enabled */ err = pwrite(fd->fd_sys, buf, len, offset); - else { /* direct I/O enabled */ + if (err < 0) {goto leaving;} + } else { /* direct I/O enabled */ /* (1) if mem_aligned && file_aligned use direct I/O to write up to correct io_size use buffered I/O for remaining */ - if (!(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz)) - ADIOI_XFS_Aligned_Mem_File_Write(fd, buf, len, offset, &err); + if (!(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz)) { + err = ADIOI_XFS_Aligned_Mem_File_Write(fd, buf, len, offset); + if (err < 0) {goto leaving;} /* (2) if !file_aligned use buffered I/O to write up to file_aligned At that point, if still mem_aligned, use (1) else copy into aligned buf and then use (1) */ - else if (offset % fd->d_miniosz) { + } else if (offset % fd->d_miniosz) { diff = fd->d_miniosz - (offset % fd->d_miniosz); diff = ADIOI_MIN(diff, len); - nbytes = pwrite(fd->fd_sys, buf, diff, offset); + err = pwrite(fd->fd_sys, buf, diff, offset); + if (err < 0) {goto leaving;} buf = ((char *) buf) + diff; offset += diff; size = len - diff; if (!(((long) buf) % fd->d_mem)) { - ADIOI_XFS_Aligned_Mem_File_Write(fd, buf, size, offset, &err); - nbytes += err; + err = ADIOI_XFS_Aligned_Mem_File_Write(fd, buf, size, offset); + if (err < 0) {goto leaving;} } else { newbuf = (void *) memalign(XFS_MEMALIGN, size); if (newbuf) { memcpy(newbuf, buf, size); - ADIOI_XFS_Aligned_Mem_File_Write(fd, newbuf, size, offset, &err); - nbytes += err; - free(newbuf); + err = ADIOI_XFS_Aligned_Mem_File_Write(fd, newbuf, size, offset); + ADIOI_Free(newbuf); + if (err < 0) {goto leaving;} + } else { + err = pwrite(fd->fd_sys, buf, size, offset); + if (err < 0) {goto leaving;} } - else nbytes += pwrite(fd->fd_sys, buf, size, offset); } - err = nbytes; } /* (3) if !mem_aligned && file_aligned @@ -74,36 +82,38 @@ void ADIOI_XFS_WriteContig(ADIO_File fd, void *buf, int count, newbuf = (void *) memalign(XFS_MEMALIGN, len); if (newbuf) { memcpy(newbuf, buf, len); - ADIOI_XFS_Aligned_Mem_File_Write(fd, newbuf, len, offset, &err); - free(newbuf); + err = ADIOI_XFS_Aligned_Mem_File_Write(fd, newbuf, len, offset); + ADIOI_Free(newbuf); + } else { + err = pwrite(fd->fd_sys, buf, len, offset); } - else err = pwrite(fd->fd_sys, buf, len, offset); + + if (err < 0) {goto leaving;} } } - if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += err; + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; #ifdef HAVE_STATUS_SET_BYTES - if (err != -1) MPIR_Status_set_bytes(status, datatype, err); + if (err != -1) MPIR_Status_set_bytes(status, datatype, len); #endif - -#ifdef PRINT_ERR_MSG - *error_code = (err == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS; -#else +leaving: 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_XFS_Aligned_Mem_File_Write(ADIO_File fd, void *buf, int len, - ADIO_Offset offset, int *err) +static int +ADIOI_XFS_Aligned_Mem_File_Write(ADIO_File fd, void *buf, ADIO_Offset len, + ADIO_Offset offset) { - int ntimes, rem, newrem, i, size, nbytes; + unsigned write_chunk_sz = fd->hints->fs_hints.xfs.write_chunk_sz; + ADIO_Offset nbytes, rem, newrem, size; + int ntimes, i; /* memory buffer is aligned, offset in file is aligned, io_size may or may not be of the right size. @@ -111,52 +121,50 @@ void ADIOI_XFS_Aligned_Mem_File_Write(ADIO_File fd, void *buf, int len, use buffered I/O for remaining. */ if (!(len % fd->d_miniosz) && - (len >= fd->d_miniosz) && (len <= fd->d_maxiosz)) - *err = pwrite(fd->fd_direct, buf, len, offset); - else if (len < fd->d_miniosz) - *err = pwrite(fd->fd_sys, buf, len, offset); - else if (len > fd->d_maxiosz) { - ntimes = len/(fd->d_maxiosz); - rem = len - ntimes * fd->d_maxiosz; + (len >= fd->d_miniosz) && (len <= write_chunk_sz)) { + nbytes = pwrite(fd->fd_direct, buf, len, offset); + if (nbytes < 0) {return -1;} + } else if (len < fd->d_miniosz) { + nbytes = pwrite(fd->fd_sys, buf, len, offset); + if (nbytes < 0) {return -1;} + } else if (len > write_chunk_sz) { + ntimes = len/(write_chunk_sz); + rem = len - ntimes * write_chunk_sz; nbytes = 0; for (i=0; ifd_direct, ((char *)buf) + i * fd->d_maxiosz, - fd->d_maxiosz, offset); - offset += fd->d_maxiosz; + nbytes = pwrite(fd->fd_direct, ((char *)buf) + i * write_chunk_sz, + write_chunk_sz, offset); + offset += write_chunk_sz; + if (nbytes < 0) {return -1;} } if (rem) { - if (!(rem % fd->d_miniosz)) - nbytes += pwrite(fd->fd_direct, - ((char *)buf) + ntimes * fd->d_maxiosz, rem, offset); - else { + if (!(rem % fd->d_miniosz)) { + nbytes = pwrite(fd->fd_direct, + ((char *)buf) + ntimes * write_chunk_sz, rem, offset); + if (nbytes < 0) {return -1;} + } else { newrem = rem % fd->d_miniosz; size = rem - newrem; if (size) { - nbytes += pwrite(fd->fd_direct, - ((char *)buf) + ntimes * fd->d_maxiosz, size, offset); + nbytes = pwrite(fd->fd_direct, + ((char *)buf) + ntimes * write_chunk_sz, size, offset); offset += size; + if (nbytes < 0) {return -1;} } - nbytes += pwrite(fd->fd_sys, - ((char *)buf) + ntimes*fd->d_maxiosz + size, newrem, offset); + nbytes = pwrite(fd->fd_sys, + ((char *)buf) + ntimes * write_chunk_sz + size, newrem, offset); + if (nbytes < 0) {return -1;} } } - *err = nbytes; } else { rem = len % fd->d_miniosz; size = len - rem; nbytes = pwrite(fd->fd_direct, buf, size, offset); - nbytes += pwrite(fd->fd_sys, (char *)buf + size, rem, offset+size); - *err = nbytes; + if (nbytes < 0) {return -1;} + nbytes = pwrite(fd->fd_sys, (char *)buf + size, rem, offset+size); + if (nbytes < 0) {return -1;} } -} - -void ADIOI_XFS_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); + return 0; } diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/.state-cache b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/.state-cache new file mode 100644 index 0000000000..2b751d7dad --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/.state-cache @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/Makefile.in new file mode 100644 index 0000000000..af0d5c8f42 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/Makefile.in @@ -0,0 +1,52 @@ +CC = @CC@ +AR = @AR@ +RANLIB = @RANLIB@ +LIBNAME = @LIBNAME@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include -I${srcdir}/../../../../include -I../../../../include +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE_SHL = $(CC_SHL) + +@VPATH@ + +AD_ZOIDFS_OBJECTS = ad_zoidfs.o ad_zoidfs_close.o ad_zoidfs_common.o \ + ad_zoidfs_delete.o ad_zoidfs_fcntl.o ad_zoidfs_flush.o \ + ad_zoidfs_io.o ad_zoidfs_open.o ad_zoidfs_resize.o ad_zoidfs_features.o\ + ad_zoidfs_read_list.o ad_zoidfs_write_list.o + +default: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +.c.o: + $(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + + +$(LIBNAME): $(AD_ZOIDFS_OBJECTS) + $(AR) $(LIBNAME) $(AD_ZOIDFS_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_ZOIDFS_LOOBJECTS=$(AD_ZOIDFS_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(AD_ZOIDFS_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_ZOIDFS_LOOBJECTS) + +coverage: + -@for file in ${AD_ZOIDFS_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.c new file mode 100644 index 0000000000..28b8ea54e6 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.c @@ -0,0 +1,42 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2003 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_zoidfs.h" + +/* adioi.h has the ADIOI_Fns_struct define */ +#include "adioi.h" + +struct ADIOI_Fns_struct ADIO_ZOIDFS_operations = { + ADIOI_ZOIDFS_Open, /* Open */ + ADIOI_SCALEABLE_OpenColl, /* OpenColl */ + ADIOI_ZOIDFS_ReadContig, /* ReadContig */ + ADIOI_ZOIDFS_WriteContig, /* WriteContig */ + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */ + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */ + ADIOI_GEN_SeekIndividual, /* SeekIndividual */ + ADIOI_ZOIDFS_Fcntl, /* Fcntl */ + ADIOI_GEN_SetInfo, /* SetInfo */ + ADIOI_GEN_ReadStrided, /* ReadStrided */ + ADIOI_ZOIDFS_WriteStrided, /* WriteStrided */ + ADIOI_ZOIDFS_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_ZOIDFS_Flush, /* Flush */ + ADIOI_ZOIDFS_Resize, /* Resize */ + ADIOI_ZOIDFS_Delete, /* Delete */ + ADIOI_ZOIDFS_Feature, +}; + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.h b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.h new file mode 100644 index 0000000000..03b2a57662 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs.h @@ -0,0 +1,44 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#ifndef AD_ZOIDFS_INCLUDE +#define AD_ZOIDFS_INCLUDE + +#include "adio.h" +#ifdef HAVE_ZOIDFS_H +#include "zoidfs.h" +#endif + + +typedef zoidfs_handle_t ADIOI_ZOIDFS_object; + +void ADIOI_ZOIDFS_Open(ADIO_File fd, int *error_code); +void ADIOI_ZOIDFS_Close(ADIO_File fd, int *error_code); +void ADIOI_ZOIDFS_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_ZOIDFS_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_ZOIDFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int + *error_code); +void ADIOI_ZOIDFS_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_ZOIDFS_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_ZOIDFS_Flush(ADIO_File fd, int *error_code); +void ADIOI_ZOIDFS_Delete(char *filename, int *error_code); +void ADIOI_ZOIDFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); +void ADIOI_ZOIDFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +int ADIOI_ZOIDFS_Feature(ADIO_File fd, int flag); +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_close.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_close.c new file mode 100644 index 0000000000..1bee6b83e9 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_close.c @@ -0,0 +1,25 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_zoidfs.h" + +void ADIOI_ZOIDFS_Close(ADIO_File fd, int *error_code) +{ + ADIOI_Free(fd->fs_ptr); + fd->fs_ptr = NULL; + + /* At some point or another it was decided that ROMIO would not + * explicitly flush (other than any local cache) on close, because + * there is no way to *avoid* that overhead if you implement it here + * and don't actually want it. + */ + + *error_code = MPI_SUCCESS; +} +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.c new file mode 100644 index 0000000000..3437359da7 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.c @@ -0,0 +1,126 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2003 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_zoidfs.h" +#include "ad_zoidfs_common.h" +#include +#include + +/* keyval hack to both tell us if we've already initialized zoidfs and also + * close it down when mpi exits */ +int ADIOI_ZOIDFS_Initialized = MPI_KEYVAL_INVALID; + +void ADIOI_ZOIDFS_End(int *error_code) +{ + int ret; + static char myname[] = "ADIOI_ZOIDFS_END"; + + ret = zoidfs_finalize(); + + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0 ) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(ret), + "Error in zoidfs_finalize", 0); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; +} + +int ADIOI_ZOIDFS_End_call(MPI_Comm comm, int keyval, + void *attribute_val, void *extra_state) +{ + int error_code; + ADIOI_ZOIDFS_End(&error_code); + MPI_Keyval_free(&keyval); + return error_code; +} + +void ADIOI_ZOIDFS_Init(int rank, int *error_code ) +{ + int ret; + static char myname[] = "ADIOI_ZOIDFS_INIT"; + + /* do nothing if we've already fired up the zoidfs interface */ + if (ADIOI_ZOIDFS_Initialized != MPI_KEYVAL_INVALID) { + *error_code = MPI_SUCCESS; + return; + } + + ret = zoidfs_init(); + if (ret < 0 ) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(ret), + "Error in zoidfs_init", + 0); + return; + } + + MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_ZOIDFS_End_call, + &ADIOI_ZOIDFS_Initialized, (void *)0); + /* just like romio does, we make a dummy attribute so we + * get cleaned up */ + MPI_Attr_put(MPI_COMM_SELF, ADIOI_ZOIDFS_Initialized, (void *)0); +} + +void ADIOI_ZOIDFS_makeattribs(zoidfs_sattr_t * attribs) +{ + memset(attribs, 0, sizeof(zoidfs_sattr_t)); + + attribs->mask = ZOIDFS_ATTR_MODE; + attribs->mode = 0644; +} + +int ADIOI_ZOIDFS_error_convert(int error) +{ + switch (error) + { + case ZFSERR_PERM: /* ??? */ + case ZFSERR_ACCES: + return MPI_ERR_ACCESS; + case ZFSERR_NOENT: + case ZFSERR_NXIO: /* ??? */ + case ZFSERR_NODEV: /* ??? */ + return MPI_ERR_NO_SUCH_FILE; + case ZFSERR_IO: + return MPI_ERR_IO; + case ZFSERR_EXIST: + return MPI_ERR_FILE_EXISTS; + case ZFSERR_NOTDIR: /* ??? */ + case ZFSERR_ISDIR: /* ??? */ + case ZFSERR_NAMETOOLONG: + return MPI_ERR_BAD_FILE; + case ZFSERR_INVAL: + case ZFSERR_STALE: + return MPI_ERR_FILE; + case ZFSERR_FBIG: /* ??? */ + case ZFSERR_NOSPC: + return MPI_ERR_NO_SPACE; + case ZFSERR_ROFS: + return MPI_ERR_READ_ONLY; + case ZFSERR_NOTIMPL: + return MPI_ERR_UNSUPPORTED_OPERATION; + case ZFSERR_DQUOT: + return MPI_ERR_QUOTA; + /* case ZFSERR_NOTEMPTY: */ + /* case ZFSERR_WFLUSH: */ + /* case ZFSERR_OTHER: */ + case ZFSERR_NOMEM: + return MPI_ERR_INTERN; + default: + return MPI_UNDEFINED; + } +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.h b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.h new file mode 100644 index 0000000000..b519f791dd --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_common.h @@ -0,0 +1,43 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#ifndef _AD_ZOIDFS_COMMON_H +#define _AD_ZOIDFS_COMMON_H +#include "ad_zoidfs.h" + +/* The ESTALE problem: + * The IO forwarding protocol can respond to any call with ESTALE, which means + * the handle upon which that call operates has expired from the metadata + * cache. We thus wrap any zoidfs routine (expr) in this macro. + * + * ROMIO stores the filename in the ADIOI_File structrue (fd), so we can always + * re-lookup in response to ESTALE */ + +#define NO_STALE(ret, fd, handle_p, expr) \ + do { \ + (ret) = (expr); \ + while ((ret) == ZFSERR_STALE) { \ + /* lookup again */ \ + (ret) = zoidfs_lookup(NULL, NULL, (fd)->filename, \ + (zoidfs_handle_t*)((fd)->fs_ptr), ZOIDFS_NO_OP_HINT); \ + if ((ret) == ZFS_OK) { \ + *((ADIOI_ZOIDFS_object*)handle_p) \ + = *((ADIOI_ZOIDFS_object*)((fd)->fs_ptr)); \ + /* re-execute the expr with new handle */ \ + (ret) = (expr); \ + } \ + } \ + } while (0) + +void ADIOI_ZOIDFS_Init(int rank, int *error_code ); +void ADIOI_ZOIDFS_makeattribs(zoidfs_sattr_t * attribs); +void ADIOI_ZOIDFS_End(int *error_code); +int ADIOI_ZOIDFS_End_call(MPI_Comm comm, int keyval, + void *attribute_val, void *extra_state); +int ADIOI_ZOIDFS_error_convert(int error); + +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_delete.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_delete.c new file mode 100644 index 0000000000..58d3bc0bb9 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_delete.c @@ -0,0 +1,45 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2003 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_zoidfs.h" +#include "adio.h" + +#include "ad_zoidfs_common.h" + +void ADIOI_ZOIDFS_Delete(char *filename, int *error_code) +{ + int ret; + static char myname[] = "ADIOI_ZOIDFS_DELETE"; + + ADIOI_ZOIDFS_Init(0, error_code); + /* --BEGIN ERROR HANDLING-- */ + if (*error_code != MPI_SUCCESS) + { + /* ADIOI_ZOIDFS_INIT handles creating error codes itself */ + return; + } + /* --END ERROR HANDLING-- */ + + ret = zoidfs_remove(NULL, NULL, filename, NULL, ZOIDFS_NO_OP_HINT); + /* --BEGIN ERROR HANDLING-- */ + if (ret != ZFS_OK) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(ret), + "Error in zoidfs_remove", 0); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; + return; +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_fcntl.c new file mode 100644 index 0000000000..04cd2b8f9c --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_fcntl.c @@ -0,0 +1,60 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_zoidfs.h" +#include "adio_extern.h" +#include "ad_zoidfs_common.h" + +void ADIOI_ZOIDFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, + int *error_code) +{ + int ret; + zoidfs_attr_t attr; + ADIOI_ZOIDFS_object *zoidfs_obj_ptr; + static char myname[] = "ADIOI_ZOIDFS_FCNTL"; + + zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr; + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: + attr.mask = ZOIDFS_ATTR_SIZE; + NO_STALE(ret, fd, zoidfs_obj_ptr, + zoidfs_getattr(zoidfs_obj_ptr, &attr, ZOIDFS_NO_OP_HINT)); + if ( !(attr.mask & ZOIDFS_ATTR_SIZE) || (ret != ZFS_OK ) ) { + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(ret), + "Error in zoidfs_getattr", 0); + /* --END ERROR HANDLING-- */ + } + else { + *error_code = MPI_SUCCESS; + } + fcntl_struct->fsize = attr.size; + return; + + case ADIO_FCNTL_SET_DISKSPACE: + ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code); + break; + + /* --BEGIN ERROR HANDLING-- */ + 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); + /* --END ERROR HANDLING-- */ + } +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_features.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_features.c new file mode 100644 index 0000000000..892e4ca548 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_features.c @@ -0,0 +1,16 @@ +#include "adio.h" +#include "ad_zoidfs.h" + +int ADIOI_ZOIDFS_Feature(ADIO_File fd, int flag) +{ + switch(flag) { + case ADIO_SCALABLE_OPEN: + return 1; + case ADIO_SHARED_FP: + case ADIO_LOCKS: + case ADIO_SEQUENTIAL: + case ADIO_DATA_SIEVING_WRITES: + default: + return 0; + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_flush.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_flush.c new file mode 100644 index 0000000000..6191dada1d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_flush.c @@ -0,0 +1,52 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_zoidfs.h" +#include "ad_zoidfs_common.h" + +/* we want to be a bit clever here: at scale, if every client sends a + * flush request, it will stress the file system with redundant + * commit requests. Instead, one process should wait for + * everyone to catch up, do the sync, then broadcast the result. + */ + +void ADIOI_ZOIDFS_Flush(ADIO_File fd, int *error_code) +{ + int ret, rank, dummy=0, dummy_in=0; + ADIOI_ZOIDFS_object *zoidfs_obj_ptr; + static char myname[] = "ADIOI_ZOIDFS_FLUSH"; + + *error_code = MPI_SUCCESS; + + zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr; + + MPI_Comm_rank(fd->comm, &rank); + + /* collective call to ensure no outstanding write requests. reduce is + * slightly less expensvie than barrier */ + MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, + fd->hints->ranklist[0], fd->comm); + + if (rank == fd->hints->ranklist[0]) { + ret = zoidfs_commit(zoidfs_obj_ptr, ZOIDFS_NO_OP_HINT); + } + MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + + /* --BEGIN ERROR HANDLING-- */ + if (ret != 0) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(ret), + "Error in zoidfs_commit", 0); + } + /* --END ERROR HANDLING-- */ +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_io.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_io.c new file mode 100644 index 0000000000..f785d0da84 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_io.c @@ -0,0 +1,95 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_zoidfs.h" + +#include "ad_zoidfs_common.h" + +#define ZOIDFS_READ 0 +#define ZOIDFS_WRITE 1 + +static void ZOIDFS_IOContig(ADIO_File fd, void * buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int flag, int *error_code) +{ + int ret, datatype_size; + uint64_t file_len; + size_t mem_len; + ADIOI_ZOIDFS_object *zoidfs_obj_ptr; + uint64_t file_offset = offset; + static char myname[] = "ADIOI_ZOIDFS_IOCONTIG"; + + zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr; + + MPI_Type_size(datatype, &datatype_size); + file_len = mem_len = datatype_size * count; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + file_offset = fd->fp_ind; + } + + if (flag == ZOIDFS_READ) { + NO_STALE(ret, fd, zoidfs_obj_ptr, + zoidfs_read(zoidfs_obj_ptr, + 1, &buf, &mem_len, + 1, &file_offset, &file_len, ZOIDFS_NO_OP_HINT)); + } else { + NO_STALE(ret, fd, zoidfs_obj_ptr, + zoidfs_write(zoidfs_obj_ptr, + 1, (const void **)&buf, &mem_len, + 1, &file_offset, &file_len, ZOIDFS_NO_OP_HINT)); + } + /* --BEGIN ERROR HANDLING-- */ + if (ret != ZFS_OK ) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(ret), + "Error in ZOIDFS I/O", 0); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += file_len; + } + fd->fp_sys_posn = file_offset + file_len; + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, file_len); +#endif + + *error_code = MPI_SUCCESS; + +fn_exit: + return; +} + +void ADIOI_ZOIDFS_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + ZOIDFS_IOContig(fd, buf, count, datatype, file_ptr_type, + offset, status, ZOIDFS_READ, error_code); +} + +void ADIOI_ZOIDFS_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + ZOIDFS_IOContig(fd, buf, count, datatype, file_ptr_type, + offset, status, ZOIDFS_WRITE, error_code); +} + + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_open.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_open.c new file mode 100644 index 0000000000..f0d5484223 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_open.c @@ -0,0 +1,153 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 2007 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_zoidfs.h" +#include "ad_zoidfs_common.h" + +/* open_status is helpful for bcasting values around */ +struct open_status_s { + int error; + zoidfs_handle_t handle; +}; +typedef struct open_status_s open_status; + +static void fake_an_open(char *fname, int access_mode, + int nr_datafiles, MPI_Offset strip_size, + ADIOI_ZOIDFS_object *zoidfs_ptr, + open_status *o_status) +{ + int ret, created; + zoidfs_sattr_t attribs; + zoidfs_handle_t handle; + + ADIOI_ZOIDFS_makeattribs(&attribs); + + /* zoidfs_create succeeds even if a file already exists, so we can do + * our job with fewer calls than in other cases. However, we need to + * be careful with ADIO_EXCL. + */ + if (access_mode & ADIO_CREATE) { + ret = zoidfs_create(NULL, NULL, + fname, &attribs, &handle, &created, ZOIDFS_NO_OP_HINT); + if ((ret == ZFS_OK) && !created && (access_mode & ADIO_EXCL)) { + /* lookup should not succeed if opened with EXCL */ + o_status->error = ZFSERR_EXIST; + return; + } + } + else { + ret = zoidfs_lookup(NULL, NULL, fname, &handle, ZOIDFS_NO_OP_HINT); + } + + o_status->error = ret; + o_status->handle = handle; + return; +} + + +/* ADIOI_ZOIDFS_Open: + * one process opens (or creates) the file, then broadcasts the result to the + * remaining processors. + * + * ADIO_Open used to perform an optimization when MPI_MODE_CREATE (and before + * that, MPI_MODE_EXCL) was set. Because ZoidFS handles file lookup and + * creation more scalably than traditional file systems, ADIO_Open now skips any + * special handling when CREATE is set. */ +void ADIOI_ZOIDFS_Open(ADIO_File fd, int *error_code) +{ + int rank; + static char myname[] = "ADIOI_ZOIDFS_OPEN"; + ADIOI_ZOIDFS_object *zoidfs_obj_ptr; + + /* since one process is doing the open, that means one process is also + * doing the error checking. define a struct for both the object reference + * and the error code to broadcast to all the processors */ + + open_status o_status; + MPI_Datatype open_status_type; + MPI_Datatype types[2] = {MPI_INT, MPI_BYTE}; + int lens[2] = {1, sizeof(ADIOI_ZOIDFS_object)}; + MPI_Aint offsets[2]; + + memset(&o_status, 0, sizeof(o_status)); + zoidfs_obj_ptr = (ADIOI_ZOIDFS_object *) + ADIOI_Malloc(sizeof(ADIOI_ZOIDFS_object)); + /* --BEGIN ERROR HANDLING-- */ + if (zoidfs_obj_ptr == NULL) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNKNOWN, + "Error allocating memory", 0); + return; + } + /* --END ERROR HANDLING-- */ + + MPI_Comm_rank(fd->comm, &rank); + + ADIOI_ZOIDFS_Init(rank, error_code); + if (*error_code != MPI_SUCCESS) + { + /* ADIOI_ZOIDFS_INIT handles creating error codes on its own */ + ADIOI_Free(zoidfs_obj_ptr); + return; + } + + /* one process resolves name and will later bcast to others */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_a, 0, NULL ); +#endif + if (rank == fd->hints->ranklist[0] && fd->fs_ptr == NULL) { + fake_an_open(fd->filename, fd->access_mode, + fd->hints->striping_factor, + fd->hints->striping_unit, + zoidfs_obj_ptr, &o_status); + /* store credentials and object reference in fd */ + *zoidfs_obj_ptr = o_status.handle; + fd->fs_ptr = zoidfs_obj_ptr; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_open_b, 0, NULL ); +#endif + + /* broadcast status and (possibly valid) object reference */ + MPI_Address(&o_status.error, &offsets[0]); + MPI_Address(&o_status.handle, &offsets[1]); + + MPI_Type_struct(2, lens, offsets, types, &open_status_type); + MPI_Type_commit(&open_status_type); + + /* Assertion: if we hit this Bcast, then all processes collectively + * called this open. + * + * That's because deferred open never happens with this fs. + */ + MPI_Bcast(MPI_BOTTOM, 1, open_status_type, fd->hints->ranklist[0], + fd->comm); + MPI_Type_free(&open_status_type); + + /* --BEGIN ERROR HANDLING-- */ + if (o_status.error != ZFS_OK) + { + ADIOI_Free(zoidfs_obj_ptr); + fd->fs_ptr = NULL; + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(o_status.error), + "Unknown error", 0); + /* TODO: FIX STRING */ + return; + } + /* --END ERROR HANDLING-- */ + + *zoidfs_obj_ptr = o_status.handle; + fd->fs_ptr = zoidfs_obj_ptr; + + *error_code = MPI_SUCCESS; + return; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c new file mode 100644 index 0000000000..ac3bf5d6bd --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c @@ -0,0 +1,826 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_zoidfs.h" + +#include "ad_zoidfs_common.h" + +/* Copied from ADIOI_PVFS2_OldReadStrided. It would be good to have fewer + * copies of this code... */ +void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code) +{ + /* offset is in units of etype relative to the filetype. */ + ADIOI_Flatlist_node *flat_buf, *flat_file; + int i, j, k, brd_size, frd_size=0, st_index=0; + int bufsize, sum, n_etypes_in_filetype, size_in_filetype; + int n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype=0; + int filetype_size, etype_size, buftype_size; + MPI_Aint filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset off, disp, start_off, initial_off; + int flag, st_frd_size, st_n_filetypes; + + size_t mem_list_count, file_list_count; + void ** mem_offsets; + uint64_t *file_offsets; + size_t *mem_lengths; + uint64_t *file_lengths; + int total_blks_to_read; + + int max_mem_list, max_file_list; + + int b_blks_read; + int f_data_read; + int size_read=0, n_read_lists, extra_blks; + + int end_brd_size, end_frd_size; + int start_k, start_j, new_file_read, new_buffer_read; + int start_mem_offset; + ADIOI_ZOIDFS_object * zoidfs_obj_ptr; + int err_flag=0; + MPI_Offset total_bytes_read = 0; + static char myname[] = "ADIOI_ZOIDFS_ReadStrided"; + + /* note: I don't know what zoidfs will do if you pass it a super-long list, + * so let's keep with the PVFS limit for now */ +#define MAX_ARRAY_SIZE 64 + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + /* the HDF5 tests showed a bug in this list processing code (see many many + * lines down below). We added a workaround, but common HDF5 file types + * are actually contiguous and do not need the expensive workarond */ + if (!filetype_is_contig) { + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + if (flat_file->count == 1 && !buftype_is_contig) + filetype_is_contig = 1; + } + + MPI_Type_size(fd->filetype, &filetype_size); + if ( ! filetype_size ) { + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + etype_size = fd->etype_size; + + bufsize = buftype_size * count; + + zoidfs_obj_ptr = (ADIOI_ZOIDFS_object *)fd->fs_ptr; + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + uint64_t file_offsets; + uint64_t file_lengths; + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + etype_size * offset; + + file_list_count = 1; + file_offsets = off; + file_lengths = 0; + total_blks_to_read = count*flat_buf->count; + b_blks_read = 0; + + /* allocate arrays according to max usage */ + if (total_blks_to_read > MAX_ARRAY_SIZE) + mem_list_count = MAX_ARRAY_SIZE; + else mem_list_count = total_blks_to_read; + mem_offsets = (void*)ADIOI_Malloc(mem_list_count*sizeof(void*)); + mem_lengths = (size_t*)ADIOI_Malloc(mem_list_count*sizeof(size_t)); + + /* TODO: CHECK RESULTS OF MEMORY ALLOCATION */ + + j = 0; + /* step through each block in memory, filling memory arrays */ + while (b_blks_read < total_blks_to_read) { + for (i=0; icount; i++) { + mem_offsets[b_blks_read % MAX_ARRAY_SIZE] = + buf + j*buftype_extent + flat_buf->indices[i]; + mem_lengths[b_blks_read % MAX_ARRAY_SIZE] = + flat_buf->blocklens[i]; + file_lengths += flat_buf->blocklens[i]; + b_blks_read++; + if (!(b_blks_read % MAX_ARRAY_SIZE) || + (b_blks_read == total_blks_to_read)) { + + /* in the case of the last read list call, + adjust mem_list_count */ + if (b_blks_read == total_blks_to_read) { + mem_list_count = total_blks_to_read % MAX_ARRAY_SIZE; + /* in case last read list call fills max arrays */ + if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif + NO_STALE(err_flag, fd, zoidfs_obj_ptr, + zoidfs_read(zoidfs_obj_ptr, + mem_list_count, + mem_offsets, mem_lengths, + 1, &file_offsets, &file_lengths, ZOIDFS_NO_OP_HINT)); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != ZFS_OK) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(err_flag), + "Error in zoidfs_read", 0); + goto error_state; + } + total_bytes_read += file_lengths; + /* --END ERROR HANDLING-- */ + + /* in the case of error or the last read list call, + * leave here */ + if (err_flag || b_blks_read == total_blks_to_read) break; + + file_offsets += file_lengths; + file_lengths = 0; + } + } /* for (i=0; icount; i++) */ + j++; + } /* while (b_blks_read < total_blks_to_read) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += total_bytes_read; + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); + /* This isa temporary way of filling in status. The right way is to + keep tracke of how much data was actually read adn placed in buf + by ADIOI_BUFFERED_READ. */ +#endif + ADIOI_Delete_flattened(datatype); + + return; + } /* if (!buftype_is_contig && filetype_is_contig) */ + + /* know file is noncontiguous from above */ + /* noncontiguous in file */ + + /* filetype already flattened in ADIO_Open */ + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + + disp = fd->disp; + initial_off = offset; + + + /* for each case - ADIO_Individual pointer or explicit, find the file + offset in bytes (offset), n_filetypes (how many filetypes into + file to start), frd_size (remaining amount of data in present + file block), and st_index (start point in terms of blocks in + starting filetype) */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (i=0; icount; i++) { + if (disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes)*filetype_extent + + flat_file->blocklens[i] >= offset) { + st_index = i; + frd_size = disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes)*filetype_extent + + flat_file->blocklens[i] - offset; + flag = 1; + break; + } + } + } /* while (!flag) */ + } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ + else { + 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; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + frd_size = 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 */ + offset = disp + ((ADIO_Offset) n_filetypes)*filetype_extent + + abs_off_in_filetype; + } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ + + start_off = offset; + st_frd_size = frd_size; + st_n_filetypes = n_filetypes; + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + /* only one memory off-len pair, so no array here */ + size_t mem_lengths; + size_t mem_offsets; + + i = 0; + j = st_index; + n_filetypes = st_n_filetypes; + + mem_list_count = 1; + + /* determine how many blocks in file to read */ + f_data_read = ADIOI_MIN(st_frd_size, bufsize); + total_blks_to_read = 1; + if (j < (flat_file->count-1)) j++; + else { + j = 0; + n_filetypes++; + } + while (f_data_read < bufsize) { + f_data_read += flat_file->blocklens[j]; + total_blks_to_read++; + if (j<(flat_file->count-1)) j++; + else j = 0; + } + + j = st_index; + n_filetypes = st_n_filetypes; + n_read_lists = total_blks_to_read/MAX_ARRAY_SIZE; + extra_blks = total_blks_to_read%MAX_ARRAY_SIZE; + + mem_offsets = (size_t)buf; + mem_lengths = 0; + + /* if at least one full readlist, allocate file arrays + at max array size and don't free until very end */ + if (n_read_lists) { + file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* + sizeof(int64_t)); + file_lengths = (uint64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* + sizeof(uint64_t)); + } + /* if there's no full readlist allocate file arrays according + to needed size (extra_blks) */ + else { + file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* + sizeof(int64_t)); + file_lengths = (uint64_t*)ADIOI_Malloc(extra_blks* + sizeof(uint64_t)); + } + + /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ + for (i=0; iindices[j]; + file_lengths[k] = flat_file->blocklens[j]; + mem_lengths += file_lengths[k]; + } + if (j<(flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; kindices[j]; + if (k == (extra_blks - 1)) { + file_lengths[k] = bufsize - mem_lengths + - mem_offsets + (size_t)buf; + } + else file_lengths[k] = flat_file->blocklens[j]; + } /* if(i || k) */ + mem_lengths += file_lengths[k]; + if (j<(flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; ktype != datatype) flat_buf = flat_buf->next; + + size_read = 0; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + max_mem_list = 0; + max_file_list = 0; + + /* run through and file max_file_list and max_mem_list so that you + can allocate the file and memory arrays less than MAX_ARRAY_SIZE + if possible */ + + while (size_read < bufsize) { + k = start_k; + new_buffer_read = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) { + /* find mem_list_count and file_list_count such that both are + less than MAX_ARRAY_SIZE, the sum of their lengths are + equal, and the sum of all the data read and data to be + read in the next immediate read list is less than + bufsize */ + if(mem_list_count) { + if((new_buffer_read + flat_buf->blocklens[k] + + size_read) > bufsize) { + end_brd_size = new_buffer_read + + flat_buf->blocklens[k] - (bufsize - size_read); + new_buffer_read = bufsize - size_read; + } + else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } + else { + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + else new_buffer_read = brd_size; + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) */ + j = start_j; + new_file_read = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && + (new_file_read < new_buffer_read)) { + if(file_list_count) { + if((new_file_read + flat_file->blocklens[j]) > + new_buffer_read) { + end_frd_size = new_buffer_read - new_file_read; + new_file_read = new_buffer_read; + j--; + } + else { + new_file_read += flat_file->blocklens[j]; + end_frd_size = flat_file->blocklens[j]; + } + } + else { + if (frd_size > new_buffer_read) { + new_file_read = new_buffer_read; + frd_size = new_file_read; + } + else new_file_read = frd_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) j++; + else j = 0; + + k = start_k; + if ((new_file_read < new_buffer_read) && + (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_read = 0; + mem_list_count = 0; + while (new_buffer_read < new_file_read) { + if(mem_list_count) { + if((new_buffer_read + flat_buf->blocklens[k]) > + new_file_read) { + end_brd_size = new_file_read - new_buffer_read; + new_buffer_read = new_file_read; + k--; + } + else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } + else { + new_buffer_read = brd_size; + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while (new_buffer_read < new_file_read) */ + } /* if ((new_file_read < new_buffer_read) && (file_list_count + == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) */ + + /* fakes filling the readlist arrays of lengths found above */ + k = start_k; + j = start_j; + for (i=0; iblocklens[k] == end_brd_size) + brd_size = flat_buf->blocklens[(k+1)% + flat_buf->count]; + else { + brd_size = flat_buf->blocklens[k] - end_brd_size; + k--; + buf_count--; + } + } + } + buf_count++; + k = (k + 1)%flat_buf->count; + } /* for (i=0; iblocklens[j] == end_frd_size) + frd_size = flat_file->blocklens[(j+1)% + flat_file->count]; + else { + frd_size = flat_file->blocklens[j] - end_frd_size; + j--; + } + } + } + if (j < flat_file->count - 1) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; iblocklens[0] ) ) || + ((mem_list_count == 1) && + (new_buffer_read < flat_buf->blocklens[0]) ) || + ((file_list_count == MAX_ARRAY_SIZE) && + (new_file_read < flat_buf->blocklens[0]) ) || + ( (mem_list_count == MAX_ARRAY_SIZE) && + (new_buffer_read < flat_file->blocklens[0])) ) + { + + ADIOI_Delete_flattened(datatype); + ADIOI_GEN_ReadStrided_naive(fd, buf, count, datatype, + file_ptr_type, initial_off, status, error_code); + return; + } + + mem_offsets = (void *)ADIOI_Malloc(max_mem_list*sizeof(void *)); + mem_lengths = (size_t*)ADIOI_Malloc(max_mem_list*sizeof(size_t)); + file_offsets = (uint64_t *)ADIOI_Malloc(max_file_list*sizeof(uint64_t)); + file_lengths = (uint64_t *)ADIOI_Malloc(max_file_list*sizeof(uint64_t)); + + size_read = 0; + n_filetypes = st_n_filetypes; + frd_size = st_frd_size; + brd_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + + /* this section calculates mem_list_count and file_list_count + and also finds the possibly odd sized last array elements + in new_frd_size and new_brd_size */ + + while (size_read < bufsize) { + k = start_k; + new_buffer_read = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) { + /* find mem_list_count and file_list_count such that both are + less than MAX_ARRAY_SIZE, the sum of their lengths are + equal, and the sum of all the data read and data to be + read in the next immediate read list is less than + bufsize */ + if(mem_list_count) { + if((new_buffer_read + flat_buf->blocklens[k] + + size_read) > bufsize) { + end_brd_size = new_buffer_read + + flat_buf->blocklens[k] - (bufsize - size_read); + new_buffer_read = bufsize - size_read; + } + else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } + else { + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + else new_buffer_read = brd_size; + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) */ + j = start_j; + new_file_read = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && + (new_file_read < new_buffer_read)) { + if(file_list_count) { + if((new_file_read + flat_file->blocklens[j]) > + new_buffer_read) { + end_frd_size = new_buffer_read - new_file_read; + new_file_read = new_buffer_read; + j--; + } + else { + new_file_read += flat_file->blocklens[j]; + end_frd_size = flat_file->blocklens[j]; + } + } + else { + if (frd_size > new_buffer_read) { + new_file_read = new_buffer_read; + frd_size = new_file_read; + } + else new_file_read = frd_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) j++; + else j = 0; + + k = start_k; + if ((new_file_read < new_buffer_read) && + (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_read = 0; + mem_list_count = 0; + while (new_buffer_read < new_file_read) { + if(mem_list_count) { + if((new_buffer_read + flat_buf->blocklens[k]) > + new_file_read) { + end_brd_size = new_file_read - new_buffer_read; + new_buffer_read = new_file_read; + k--; + } + else { + new_buffer_read += flat_buf->blocklens[k]; + end_brd_size = flat_buf->blocklens[k]; + } + } + else { + new_buffer_read = brd_size; + if (brd_size > (bufsize - size_read)) { + new_buffer_read = bufsize - size_read; + brd_size = new_buffer_read; + } + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while (new_buffer_read < new_file_read) */ + } /* if ((new_file_read < new_buffer_read) && (file_list_count + == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_read < bufsize-size_read)) */ + + /* fills the allocated readlist arrays */ + k = start_k; + j = start_j; + for (i=0; icount) + + flat_buf->indices[k]; + if(!i) { + mem_lengths[0] = brd_size; + mem_offsets[0] += flat_buf->blocklens[k] - brd_size; + } + else { + if (i == (mem_list_count - 1)) { + mem_lengths[i] = end_brd_size; + if (flat_buf->blocklens[k] == end_brd_size) + brd_size = flat_buf->blocklens[(k+1)% + flat_buf->count]; + else { + brd_size = flat_buf->blocklens[k] - end_brd_size; + k--; + buf_count--; + } + } + else { + mem_lengths[i] = flat_buf->blocklens[k]; + } + } + buf_count++; + k = (k + 1)%flat_buf->count; + } /* for (i=0; iindices[j] + + ((ADIO_Offset)n_filetypes) * filetype_extent; + if (!i) { + file_lengths[0] = frd_size; + file_offsets[0] += flat_file->blocklens[j] - frd_size; + } + else { + if (i == (file_list_count - 1)) { + file_lengths[i] = end_frd_size; + if (flat_file->blocklens[j] == end_frd_size) + frd_size = flat_file->blocklens[(j+1)% + flat_file->count]; + else { + frd_size = flat_file->blocklens[j] - end_frd_size; + j--; + } + } + else file_lengths[i] = flat_file->blocklens[j]; + } + if (j < flat_file->count - 1) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; ifp_ind = file_offsets[file_list_count-1]+ + file_lengths[file_list_count-1]; + } + + ADIOI_Free(file_offsets); + ADIOI_Free(file_lengths); + + if (err_flag == 0) *error_code = MPI_SUCCESS; + +error_state: + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); + /* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually read and placed in buf + by ADIOI_BUFFERED_READ. */ +#endif + + if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); +} + diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_resize.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_resize.c new file mode 100644 index 0000000000..de000f1e6e --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_resize.c @@ -0,0 +1,53 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "ad_zoidfs.h" +#include "ad_zoidfs_common.h" + +/* as with flush, implement the resize operation in a scalable + * manner. one process does the work, then broadcasts the result to everyone + * else. fortunately, this operation is defined to be collective */ +void ADIOI_ZOIDFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + int ret, rank; + ADIOI_ZOIDFS_object *zoidfs_obj_ptr; + static char myname[] = "ADIOI_ZOIDFS_RESIZE"; + + *error_code = MPI_SUCCESS; + + zoidfs_obj_ptr = (ADIOI_ZOIDFS_object *)fd->fs_ptr; + + MPI_Comm_rank(fd->comm, &rank); + + + /* MPI-IO semantics treat conflicting MPI_File_set_size requests the + * same as conflicting write requests. Thus, a resize from one + * process does not have to be visible to the other processes until a + * syncronization point is reached */ + + if (rank == fd->hints->ranklist[0]) { + NO_STALE(ret, fd, zoidfs_obj_ptr, + zoidfs_resize(zoidfs_obj_ptr, size, ZOIDFS_NO_OP_HINT)); + MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + } else { + MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + } + /* --BEGIN ERROR HANDLING-- */ + if (ret != ZFS_OK) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(ret), + "Error in zoidfs_resize", 0); + return; + } + /* --END ERROR HANDLING-- */ +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c new file mode 100644 index 0000000000..5ecf0c82ed --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c @@ -0,0 +1,857 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" +#include "ad_zoidfs.h" + +#include "ad_zoidfs_common.h" + +/* Copied from ADIOI_PVFS2_OldWriteStrided. It would be good to have fewer + * copies of this code... */ +void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + /* as with all the other WriteStrided functions, offset is in units of + * etype relative to the filetype */ + + /* Since zoidfs does not support file locking, can't do buffered writes + as on Unix */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + int i, j, k, bwr_size, fwr_size=0, st_index=0; + int bufsize, sum, n_etypes_in_filetype, size_in_filetype; + int n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype=0; + int filetype_size, etype_size, buftype_size; + MPI_Aint filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset off, disp, start_off, initial_off; + int flag, st_fwr_size, st_n_filetypes; + int err_flag=0; + + size_t mem_list_count, file_list_count; + const void ** mem_offsets; + uint64_t *file_offsets; + size_t *mem_lengths; + uint64_t *file_lengths; + int total_blks_to_write; + + int max_mem_list, max_file_list; + + int b_blks_wrote; + int f_data_wrote; + int size_wrote=0, n_write_lists, extra_blks; + + int end_bwr_size, end_fwr_size; + int start_k, start_j, new_file_write, new_buffer_write; + int start_mem_offset; + ADIOI_ZOIDFS_object *zoidfs_obj_ptr; + MPI_Offset total_bytes_written=0; + static char myname[] = "ADIOI_ZOIDFS_WRITESTRIDED"; + + /* note: I don't know what zoidfs will do if you pass it a super-long list, + * so let's keep with the PVFS limit for now */ +#define MAX_ARRAY_SIZE 64 + + /* --BEGIN ERROR HANDLING-- */ + if (fd->atomicity) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "Atomic noncontiguous writes are not supported by ZOIDFS", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + /* the HDF5 tests showed a bug in this list processing code (see many many + * lines down below). We added a workaround, but common HDF5 file types + * are actually contiguous and do not need the expensive workarond */ + if (!filetype_is_contig) { + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + if (flat_file->count == 1 && !buftype_is_contig) + filetype_is_contig = 1; + } + + MPI_Type_size(fd->filetype, &filetype_size); + if ( ! filetype_size ) { + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + etype_size = fd->etype_size; + + bufsize = buftype_size * count; + + zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr; + + if (!buftype_is_contig && filetype_is_contig) { + +/* noncontiguous in memory, contiguous in file. */ + uint64_t file_offsets; + uint64_t file_lengths; + + ADIOI_Flatten_datatype(datatype); + flat_buf = ADIOI_Flatlist; + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + etype_size * offset; + } + else off = fd->fp_ind; + + file_list_count = 1; + file_offsets = off; + file_lengths = 0; + total_blks_to_write = count*flat_buf->count; + b_blks_wrote = 0; + + /* allocate arrays according to max usage */ + if (total_blks_to_write > MAX_ARRAY_SIZE) + mem_list_count = MAX_ARRAY_SIZE; + else mem_list_count = total_blks_to_write; + mem_offsets = (void*)ADIOI_Malloc(mem_list_count*sizeof(void*)); + mem_lengths = (size_t*)ADIOI_Malloc(mem_list_count*sizeof(size_t)); + + j = 0; + /* step through each block in memory, filling memory arrays */ + while (b_blks_wrote < total_blks_to_write) { + for (i=0; icount; i++) { + mem_offsets[b_blks_wrote % MAX_ARRAY_SIZE] = + buf + + j*buftype_extent + + flat_buf->indices[i]; + mem_lengths[b_blks_wrote % MAX_ARRAY_SIZE] = + flat_buf->blocklens[i]; + file_lengths += flat_buf->blocklens[i]; + b_blks_wrote++; + if (!(b_blks_wrote % MAX_ARRAY_SIZE) || + (b_blks_wrote == total_blks_to_write)) { + + /* in the case of the last write list call, + adjust mem_list_count */ + if (b_blks_wrote == total_blks_to_write) { + mem_list_count = total_blks_to_write % MAX_ARRAY_SIZE; + /* in case last write list call fills max arrays */ + if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + NO_STALE(err_flag, fd, zoidfs_obj_ptr, + zoidfs_write(zoidfs_obj_ptr, + mem_list_count, + mem_offsets, mem_lengths, + 1, &file_offsets, &file_lengths, ZOIDFS_NO_OP_HINT)); + + /* --BEGIN ERROR HANDLING-- */ + if (err_flag != ZFS_OK) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(err_flag), + "Error in zoidfs_write", 0); + break; + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + total_bytes_written += file_lengths; + + /* in the case of error or the last write list call, + * leave here */ + /* --BEGIN ERROR HANDLING-- */ + if (err_flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + ADIOI_ZOIDFS_error_convert(err_flag), + "Error in zoidfs_write", 0); + break; + } + /* --END ERROR HANDLING-- */ + if (b_blks_wrote == total_blks_to_write) break; + + file_offsets += file_lengths; + file_lengths = 0; + } + } /* for (i=0; icount; i++) */ + j++; + } /* while (b_blks_wrote < total_blks_to_write) */ + ADIOI_Free(mem_offsets); + ADIOI_Free(mem_lengths); + + if (file_ptr_type == ADIO_INDIVIDUAL) + fd->fp_ind += total_bytes_written; + + if (!err_flag) *error_code = MPI_SUCCESS; + + fd->fp_sys_posn = -1; /* clear this. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + ADIOI_Delete_flattened(datatype); + return; + } /* if (!buftype_is_contig && filetype_is_contig) */ + + /* already know that file is noncontiguous from above */ + /* noncontiguous in file */ + +/* filetype already flattened in ADIO_Open */ + flat_file = ADIOI_Flatlist; + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + + disp = fd->disp; + initial_off = offset; + + /* for each case - ADIO_Individual pointer or explicit, find offset + (file offset in bytes), n_filetypes (how many filetypes into file + to start), fwr_size (remaining amount of data in present file + block), and st_index (start point in terms of blocks in starting + filetype) */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (i=0; icount; i++) { + if (disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes)*filetype_extent + + flat_file->blocklens[i] >= offset) { + st_index = i; + fwr_size = disp + flat_file->indices[i] + + ((ADIO_Offset) n_filetypes)*filetype_extent + + flat_file->blocklens[i] - offset; + flag = 1; + break; + } + } + } /* while (!flag) */ + } /* if (file_ptr_type == ADIO_INDIVIDUAL) */ + else { + 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; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = 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 */ + offset = disp + ((ADIO_Offset) n_filetypes)*filetype_extent + + abs_off_in_filetype; + } /* else [file_ptr_type != ADIO_INDIVIDUAL] */ + + start_off = offset; + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + /* only one memory off-len pair, so no array */ + size_t mem_lengths; + size_t mem_offsets; + + i = 0; + j = st_index; + off = offset; + n_filetypes = st_n_filetypes; + + mem_list_count = 1; + + /* determine how many blocks in file to write */ + f_data_wrote = ADIOI_MIN(st_fwr_size, bufsize); + total_blks_to_write = 1; + if (j < (flat_file->count -1)) j++; + else { + j = 0; + n_filetypes++; + } + while (f_data_wrote < bufsize) { + f_data_wrote += flat_file->blocklens[j]; + total_blks_to_write++; + if (j<(flat_file->count-1)) j++; + else j = 0; + } + + j = st_index; + n_filetypes = st_n_filetypes; + n_write_lists = total_blks_to_write/MAX_ARRAY_SIZE; + extra_blks = total_blks_to_write%MAX_ARRAY_SIZE; + + mem_offsets = (size_t)buf; + mem_lengths = 0; + + /* if at least one full writelist, allocate file arrays + at max array size and don't free until very end */ + if (n_write_lists) { + file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* + sizeof(int64_t)); + file_lengths = (uint64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE* + sizeof(uint64_t)); + } + /* if there's no full writelist allocate file arrays according + to needed size (extra_blks) */ + else { + file_offsets = (int64_t*)ADIOI_Malloc(extra_blks* + sizeof(int64_t)); + file_lengths = (uint64_t*)ADIOI_Malloc(extra_blks* + sizeof(uint64_t)); + } + + /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */ + for (i=0; iindices[j]; + file_lengths[k] = flat_file->blocklens[j]; + mem_lengths += file_lengths[k]; + } + if (j<(flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; kindices[j]; + /* XXX: double-check these casts */ + if (k == (extra_blks - 1)) { + file_lengths[k] = bufsize + - mem_lengths - mem_offsets + (size_t)buf; + } + else file_lengths[k] = flat_file->blocklens[j]; + } /* if(i || k) */ + mem_lengths += file_lengths[k]; + if (j<(flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (k=0; ktype != datatype) flat_buf = flat_buf->next; + + size_wrote = 0; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + max_mem_list = 0; + max_file_list = 0; + + /* run through and file max_file_list and max_mem_list so that you + can allocate the file and memory arrays less than MAX_ARRAY_SIZE + if possible */ + + while (size_wrote < bufsize) { + k = start_k; + new_buffer_write = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) { + /* find mem_list_count and file_list_count such that both are + less than MAX_ARRAY_SIZE, the sum of their lengths are + equal, and the sum of all the data written and data to be + written in the next immediate write list is less than + bufsize */ + if(mem_list_count) { + if((new_buffer_write + flat_buf->blocklens[k] + + size_wrote) > bufsize) { + end_bwr_size = new_buffer_write + + flat_buf->blocklens[k] - (bufsize - size_wrote); + new_buffer_write = bufsize - size_wrote; + } + else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } + else { + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + else new_buffer_write = bwr_size; + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) */ + j = start_j; + new_file_write = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && + (new_file_write < new_buffer_write)) { + if(file_list_count) { + if((new_file_write + flat_file->blocklens[j]) > + new_buffer_write) { + end_fwr_size = new_buffer_write - new_file_write; + new_file_write = new_buffer_write; + j--; + } + else { + new_file_write += flat_file->blocklens[j]; + end_fwr_size = flat_file->blocklens[j]; + } + } + else { + if (fwr_size > new_buffer_write) { + new_file_write = new_buffer_write; + fwr_size = new_file_write; + } + else new_file_write = fwr_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) j++; + else j = 0; + + k = start_k; + if ((new_file_write < new_buffer_write) && + (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_write = 0; + mem_list_count = 0; + while (new_buffer_write < new_file_write) { + if(mem_list_count) { + if((new_buffer_write + flat_buf->blocklens[k]) > + new_file_write) { + end_bwr_size = new_file_write - + new_buffer_write; + new_buffer_write = new_file_write; + k--; + } + else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } + else { + new_buffer_write = bwr_size; + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while (new_buffer_write < new_file_write) */ + } /* if ((new_file_write < new_buffer_write) && + (file_list_count == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) */ + + /* fakes filling the writelist arrays of lengths found above */ + k = start_k; + j = start_j; + for (i=0; iblocklens[k] == end_bwr_size) + bwr_size = flat_buf->blocklens[(k+1)% + flat_buf->count]; + else { + bwr_size = flat_buf->blocklens[k] - end_bwr_size; + k--; + buf_count--; + } + } + } + buf_count++; + k = (k + 1)%flat_buf->count; + } /* for (i=0; iblocklens[j] == end_fwr_size) + fwr_size = flat_file->blocklens[(j+1)% + flat_file->count]; + else { + fwr_size = flat_file->blocklens[j] - end_fwr_size; + j--; + } + } + } + if (j < flat_file->count - 1) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; iblocklens[0] ) ) || + ((mem_list_count == 1) && + (new_buffer_write < flat_buf->blocklens[0]) ) || + ((file_list_count == MAX_ARRAY_SIZE) && + (new_file_write < flat_buf->blocklens[0]) ) || + ( (mem_list_count == MAX_ARRAY_SIZE) && + (new_buffer_write < flat_file->blocklens[0])) ) + { + ADIOI_Delete_flattened(datatype); + ADIOI_GEN_WriteStrided_naive(fd, buf, count, datatype, + file_ptr_type, initial_off, status, error_code); + return; + } + + + mem_offsets = (void *)ADIOI_Malloc(max_mem_list*sizeof(void *)); + mem_lengths = (size_t*)ADIOI_Malloc(max_mem_list*sizeof(size_t)); + file_offsets = (uint64_t *)ADIOI_Malloc(max_file_list*sizeof(uint64_t)); + file_lengths = (uint64_t*)ADIOI_Malloc(max_file_list*sizeof(uint64_t)); + + size_wrote = 0; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + buf_count = 0; + start_mem_offset = 0; + start_k = k = 0; + start_j = st_index; + + /* this section calculates mem_list_count and file_list_count + and also finds the possibly odd sized last array elements + in new_fwr_size and new_bwr_size */ + + while (size_wrote < bufsize) { + k = start_k; + new_buffer_write = 0; + mem_list_count = 0; + while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) { + /* find mem_list_count and file_list_count such that both are + less than MAX_ARRAY_SIZE, the sum of their lengths are + equal, and the sum of all the data written and data to be + written in the next immediate write list is less than + bufsize */ + if(mem_list_count) { + if((new_buffer_write + flat_buf->blocklens[k] + + size_wrote) > bufsize) { + end_bwr_size = new_buffer_write + + flat_buf->blocklens[k] - (bufsize - size_wrote); + new_buffer_write = bufsize - size_wrote; + } + else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } + else { + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + else new_buffer_write = bwr_size; + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) */ + j = start_j; + new_file_write = 0; + file_list_count = 0; + while ((file_list_count < MAX_ARRAY_SIZE) && + (new_file_write < new_buffer_write)) { + if(file_list_count) { + if((new_file_write + flat_file->blocklens[j]) > + new_buffer_write) { + end_fwr_size = new_buffer_write - new_file_write; + new_file_write = new_buffer_write; + j--; + } + else { + new_file_write += flat_file->blocklens[j]; + end_fwr_size = flat_file->blocklens[j]; + } + } + else { + if (fwr_size > new_buffer_write) { + new_file_write = new_buffer_write; + fwr_size = new_file_write; + } + else new_file_write = fwr_size; + } + file_list_count++; + if (j < (flat_file->count - 1)) j++; + else j = 0; + + k = start_k; + if ((new_file_write < new_buffer_write) && + (file_list_count == MAX_ARRAY_SIZE)) { + new_buffer_write = 0; + mem_list_count = 0; + while (new_buffer_write < new_file_write) { + if(mem_list_count) { + if((new_buffer_write + flat_buf->blocklens[k]) > + new_file_write) { + end_bwr_size = new_file_write - + new_buffer_write; + new_buffer_write = new_file_write; + k--; + } + else { + new_buffer_write += flat_buf->blocklens[k]; + end_bwr_size = flat_buf->blocklens[k]; + } + } + else { + new_buffer_write = bwr_size; + if (bwr_size > (bufsize - size_wrote)) { + new_buffer_write = bufsize - size_wrote; + bwr_size = new_buffer_write; + } + } + mem_list_count++; + k = (k + 1)%flat_buf->count; + } /* while (new_buffer_write < new_file_write) */ + } /* if ((new_file_write < new_buffer_write) && + (file_list_count == MAX_ARRAY_SIZE)) */ + } /* while ((mem_list_count < MAX_ARRAY_SIZE) && + (new_buffer_write < bufsize-size_wrote)) */ + + /* fills the allocated writelist arrays */ + k = start_k; + j = start_j; + for (i=0; icount) + + flat_buf->indices[k]; + + if(!i) { + mem_lengths[0] = bwr_size; + mem_offsets[0] += flat_buf->blocklens[k] - bwr_size; + } + else { + if (i == (mem_list_count - 1)) { + mem_lengths[i] = end_bwr_size; + if (flat_buf->blocklens[k] == end_bwr_size) + bwr_size = flat_buf->blocklens[(k+1)% + flat_buf->count]; + else { + bwr_size = flat_buf->blocklens[k] - end_bwr_size; + k--; + buf_count--; + } + } + else { + mem_lengths[i] = flat_buf->blocklens[k]; + } + } + buf_count++; + k = (k + 1)%flat_buf->count; + } /* for (i=0; iindices[j] + + ((ADIO_Offset)n_filetypes) * filetype_extent; + if (!i) { + file_lengths[0] = fwr_size; + file_offsets[0] += flat_file->blocklens[j] - fwr_size; + } + else { + if (i == (file_list_count - 1)) { + file_lengths[i] = end_fwr_size; + if (flat_file->blocklens[j] == end_fwr_size) + fwr_size = flat_file->blocklens[(j+1)% + flat_file->count]; + else { + fwr_size = flat_file->blocklens[j] - end_fwr_size; + j--; + } + } + else file_lengths[i] = flat_file->blocklens[j]; + } + if (j < flat_file->count - 1) j++; + else { + j = 0; + n_filetypes++; + } + } /* for (i=0; ifp_ind = file_offsets[file_list_count-1]+ + file_lengths[file_list_count-1]; + } + ADIOI_Free(file_offsets); + ADIOI_Free(file_lengths); + + *error_code = MPI_SUCCESS; + +error_state: + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/.state-cache b/src/libs/ck-libs/ampi/romio/adio/common/.state-cache new file mode 100644 index 0000000000..2fa0ebe590 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/.state-cache @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/common/Makefile.in b/src/libs/ck-libs/ampi/romio/adio/common/Makefile.in index 9356580a10..32044ec5b3 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/adio/common/Makefile.in @@ -1,26 +1,89 @@ CC = @CC@ AR = @AR@ +RANLIB = @RANLIB@ LIBNAME = @LIBNAME@ -MPI = @MPI@ srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ -INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -CFLAGS = @CFLAGS@ $(INCLUDE_DIR) $(OPTS) +#DEFS = @DEFS@ -I. -I${srcdir} +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include \ + -I../../include -I${srcdir}/../../../../../src/include \ + -I../../../../../src/include +#CFLAGS = @CPPFLAGS@ @CFLAGS@ $(INCLUDES) +CFLAGS = @CFLAGS@ +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +C_COMPILE_SHL = $(CC_SHL) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +#C_COMPILE_SHL = $(CC_SHL) @VPATH@ -AD_OBJECTS = ad_close.o ad_init.o ad_end.o ad_open.o setfn.o flatten.o \ - async_list.o req_malloc.o malloc.o ad_read_coll.o eof_offset.o \ +AD_OBJECTS = ad_close.o ad_init.o ad_end.o ad_open.o flatten.o \ + malloc.o ad_read_coll.o eof_offset.o \ ad_write_coll.o lock.o ad_read_str.o ad_write_str.o iscontig.o \ get_fp_posn.o ad_seek.o ad_delete.o ad_flush.o ad_hints.o error.o \ ad_fstype.o ad_get_sh_fp.o ad_set_sh_fp.o shfp_fname.o byte_offset.o \ status_setb.o ad_aggregate.o cb_config_list.o \ - ad_read_str_naive.o gencheck.o ad_set_view.o + ad_read_str_naive.o ad_set_view.o ad_iopen.o \ + ad_write_str_naive.o ad_resize.o ad_read.o ad_write.o ad_iread.o \ + ad_iwrite.o ad_done.o ad_wait.o adi_close.o ad_prealloc.o ad_fcntl.o \ + ad_iread_fake.o ad_iwrite_fake.o ad_done_fake.o ad_wait_fake.o \ + ad_subarray.o ad_darray.o strfns.o greq_fns.o system_hints.o \ + ad_write_nolock.o \ + ad_coll_exch_new.o ad_coll_build_req_new.o ad_io_coll.o \ + ad_aggregate_new.o heap-sort.o \ + ad_opencoll.o ad_opencoll_scalable.o ad_opencoll_failsafe.o ad_features.o all: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi +.SUFFIXES: $(SUFFIXES) .p .lo + +# $(CC) $(CFLAGS) $(INC) -c $< .c.o: - $(CC) $(CFLAGS) $(INC) -c $< + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE) -c $< ; \ + fi + @$(C_COMPILE) -c $< +# $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o +# @mv -f _s$*.o $*.lo +.c.lo: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE_SHL) -c $< -o _s$*.o ; \ + echo mv -f _s$*.o $*.lo ; \ + fi + @$(C_COMPILE_SHL) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo $(LIBNAME): $(AD_OBJECTS) $(AR) $(LIBNAME) $(AD_OBJECTS) + $(RANLIB) $(LIBNAME) + +AD_LOOBJECTS = $(AD_OBJECTS:.o=.lo) + +$(SHLIBNAME).la: $(AD_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(AD_LOOBJECTS) + +coverage: + -@for file in ${AD_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg + +tags: TAGS +SOURCES = ${AD_OBJECTS:.o=.c} +HEADERS = +TAGS:${HEADERS} ${SOURCES} + here=`cd ../../../../.. && pwd` ; cd ${srcdir} && etags -o $$here/TAGS --append ${HEADERS} ${SOURCES} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_aggregate.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_aggregate.c index 3913906855..ab5d3636e4 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_aggregate.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_aggregate.c @@ -1,14 +1,13 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997-2001 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "adio.h" #include "adio_extern.h" -#ifdef PROFILE + +#ifdef AGGREGATION_PROFILE #include "mpe.h" #endif @@ -82,16 +81,29 @@ int ADIOI_Calc_aggregator(ADIO_File fd, int rank_index, rank; ADIO_Offset avail_bytes; -#ifdef AGG_DEBUG -#if 0 - FPRINTF(stdout, "off = %Ld, min_off = %Ld, len = %Ld, fd_size = %Ld\n", - off, min_off, *len, fd_size); -#endif -#endif - + ADIOI_UNREFERENCED_ARG(fd_start); + /* get an index into our array of aggregators */ rank_index = (int) ((off - min_off + fd_size)/ fd_size - 1); + if (fd->hints->striping_unit > 0) { + /* wkliao: implementation for file domain alignment + fd_start[] and fd_end[] have been aligned with file lock + boundaries when returned from ADIOI_Calc_file_domains() so cannot + just use simple arithmatic as above */ + rank_index = 0; + while (off > fd_end[rank_index]) rank_index++; + } + + /* we index into fd_end with rank_index, and fd_end was allocated to be no + * bigger than fd->hins->cb_nodes. If we ever violate that, we're + * overrunning arrays. Obviously, we should never ever hit this abort */ + if (rank_index >= fd->hints->cb_nodes || rank_index < 0) { + FPRINTF(stderr, "Error in ADIOI_Calc_aggregator(): rank_index(%d) >= fd->hints->cb_nodes (%d) fd_size=%lld off=%lld\n", + rank_index,fd->hints->cb_nodes,fd_size,off); + MPI_Abort(MPI_COMM_WORLD, 1); + } + /* remember here that even in Rajeev's original code it was the case that * different aggregators could end up with different amounts of data to * aggregate. here we use fd_end[] to make sure that we know how much @@ -116,7 +128,9 @@ void ADIOI_Calc_file_domains(ADIO_Offset *st_offsets, ADIO_Offset *end_offsets, int nprocs, int nprocs_for_coll, ADIO_Offset *min_st_offset_ptr, ADIO_Offset **fd_start_ptr, ADIO_Offset - **fd_end_ptr, ADIO_Offset *fd_size_ptr) + **fd_end_ptr, int min_fd_size, + ADIO_Offset *fd_size_ptr, + int striping_unit) { /* Divide the I/O workload among "nprocs_for_coll" processes. This is done by (logically) dividing the file into file domains (FDs); each @@ -125,6 +139,10 @@ void ADIOI_Calc_file_domains(ADIO_Offset *st_offsets, ADIO_Offset ADIO_Offset min_st_offset, max_end_offset, *fd_start, *fd_end, fd_size; int i; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5004, 0, NULL); +#endif + #ifdef AGG_DEBUG FPRINTF(stderr, "ADIOI_Calc_file_domains: %d aggregator(s)\n", nprocs_for_coll); @@ -149,6 +167,14 @@ void ADIOI_Calc_file_domains(ADIO_Offset *st_offsets, ADIO_Offset 1)/nprocs_for_coll; /* ceiling division as in HPF block distribution */ + /* Tweak the file domains so that no fd is smaller than a threshold. We + * have to strike a balance between efficency and parallelism: somewhere + * between 10k processes sending 32-byte requests and one process sending a + * 320k request is a (system-dependent) sweet spot */ + + if (fd_size < min_fd_size) + fd_size = min_fd_size; + *fd_start_ptr = (ADIO_Offset *) ADIOI_Malloc(nprocs_for_coll*sizeof(ADIO_Offset)); *fd_end_ptr = (ADIO_Offset *) @@ -157,12 +183,46 @@ void ADIOI_Calc_file_domains(ADIO_Offset *st_offsets, ADIO_Offset fd_start = *fd_start_ptr; fd_end = *fd_end_ptr; - fd_start[0] = min_st_offset; - fd_end[0] = min_st_offset + fd_size - 1; - - for (i=1; i 0) { + ADIO_Offset end_off; + int rem_front, rem_back; + + /* align fd_end[0] to the nearest file lock boundary */ + fd_start[0] = min_st_offset; + end_off = fd_start[0] + fd_size; + rem_front = end_off % striping_unit; + rem_back = striping_unit - rem_front; + if (rem_front < rem_back) + end_off -= rem_front; + else + end_off += rem_back; + fd_end[0] = end_off - 1; + + /* align fd_end[i] to the nearest file lock boundary */ + for (i=1; icomm, &recv_requests[j]); + ADIO_OFFSET, i, i+myrank, fd->comm, &requests[j]); j++; MPI_Irecv(others_req[i].lens, others_req[i].count, - MPI_INT, i, i+myrank+1, fd->comm, &recv_requests[j]); + MPI_INT, i, i+myrank+1, fd->comm, &requests[j]); j++; } } - j = 0; for (i=0; i < nprocs; i++) { if (my_req[i].count) { MPI_Isend(my_req[i].offsets, my_req[i].count, - ADIO_OFFSET, i, i+myrank, fd->comm, &send_requests[j]); + ADIO_OFFSET, i, i+myrank, fd->comm, &requests[j]); j++; MPI_Isend(my_req[i].lens, my_req[i].count, - MPI_INT, i, i+myrank+1, fd->comm, &send_requests[j]); + MPI_INT, i, i+myrank+1, fd->comm, &requests[j]); j++; } } - statuses = (MPI_Status *) ADIOI_Malloc((1 + 2* \ - ADIOI_MAX(count_my_req_procs,count_others_req_procs)) * \ - sizeof(MPI_Status)); -/* +1 to avoid a 0-size malloc */ - - MPI_Waitall(2*count_my_req_procs, send_requests, statuses); - MPI_Waitall(2*count_others_req_procs, recv_requests, statuses); + if (j) { + statuses = (MPI_Status *) ADIOI_Malloc(j * sizeof(MPI_Status)); + MPI_Waitall(j, requests, statuses); + ADIOI_Free(statuses); + } - ADIOI_Free(send_requests); - ADIOI_Free(recv_requests); - ADIOI_Free(statuses); + ADIOI_Free(requests); ADIOI_Free(count_others_req_per_proc); *count_others_req_procs_ptr = count_others_req_procs; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5027, 0, NULL); +#endif } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_aggregate_new.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_aggregate_new.c new file mode 100644 index 0000000000..5f0802be9b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_aggregate_new.c @@ -0,0 +1,284 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif +#include +/* #define DEBUG */ + +void ADIOI_Calc_file_realms_user_size (ADIO_File fd, int fr_size, + int nprocs_for_coll, + ADIO_Offset *file_realm_st_offs, + MPI_Datatype *file_realm_types); +void ADIOI_Calc_file_realms_aar (ADIO_File fd, int nprocs_for_coll, + int pfr_enabled, + ADIO_Offset min_st_offset, + ADIO_Offset max_end_offset, + ADIO_Offset *file_realm_st_offs, + MPI_Datatype *file_realm_types); +void ADIOI_Calc_file_realms_fsize (ADIO_File fd, + int nprocs_for_coll, + ADIO_Offset max_end_offset, + ADIO_Offset *file_realm_st_offs, + MPI_Datatype *file_realm_types); +void ADIOI_Create_fr_simpletype (int size, int nprocs_for_coll, + MPI_Datatype *simpletype); +static void align_fr (int fr_size, ADIO_Offset fr_off, int alignment, + int *aligned_fr_size, ADIO_Offset *aligned_fr_off); +void ADIOI_Verify_fr (int nprocs_for_coll, ADIO_Offset *file_realm_st_offs, + MPI_Datatype *file_realm_types); + +void ADIOI_Calc_file_realms (ADIO_File fd, ADIO_Offset min_st_offset, + ADIO_Offset max_end_offset) +{ + int nprocs_for_coll; + int file_realm_calc_type; + + MPI_Datatype *file_realm_types = NULL; + ADIO_Offset *file_realm_st_offs = NULL; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5004, 0, NULL); +#endif +#ifdef DEBUG + printf ("ADIOI_Calc_file_realms\n"); +#endif + + nprocs_for_coll = fd->hints->cb_nodes; + file_realm_calc_type = fd->hints->cb_fr_type; + + /* If PFRs are disabled we know these pointers are not allocated */ + if (fd->hints->cb_pfr != ADIOI_HINT_ENABLE) { + fd->file_realm_st_offs = NULL; + fd->file_realm_types = NULL; + } + + if (nprocs_for_coll == 1) { + /* if there's only one aggregator, we can reset the file + * realms every single time */ + if (fd->file_realm_st_offs == NULL) + { + file_realm_st_offs = (ADIO_Offset *) + ADIOI_Malloc (sizeof(ADIO_Offset)); + file_realm_types = (MPI_Datatype *) + ADIOI_Malloc (sizeof(MPI_Datatype)); + } + else + { + file_realm_st_offs = fd->file_realm_st_offs; + file_realm_types = fd->file_realm_types; + } + *file_realm_st_offs = min_st_offset; + MPI_Type_contiguous ((max_end_offset - min_st_offset + 1), MPI_BYTE, + file_realm_types); + MPI_Type_commit (file_realm_types); + ADIOI_Add_contig_flattened (*file_realm_types); + } + else if (fd->file_realm_st_offs == NULL) { + file_realm_st_offs = (ADIO_Offset *) + ADIOI_Malloc (nprocs_for_coll * sizeof(ADIO_Offset)); + file_realm_types = (MPI_Datatype *) + ADIOI_Malloc (nprocs_for_coll * sizeof(MPI_Datatype)); + + if (file_realm_calc_type == ADIOI_FR_AAR) { + ADIOI_Calc_file_realms_aar (fd, nprocs_for_coll, + fd->hints->cb_pfr, + min_st_offset, max_end_offset, + file_realm_st_offs, file_realm_types); + /* flatten file realm datatype for future use - only one + * because all are the same*/ + ADIOI_Flatten_datatype (file_realm_types[0]); + } + else if (file_realm_calc_type == ADIOI_FR_FSZ) { + ADIOI_Calc_file_realms_fsize (fd, nprocs_for_coll, max_end_offset, + file_realm_st_offs, + file_realm_types); + /* flatten file realm datatype for future use - only one + * because all are the same*/ + ADIOI_Flatten_datatype (file_realm_types[0]); + } + else if (file_realm_calc_type == ADIOI_FR_USR_REALMS) { + /* copy user provided realm datatypes and realm offsets in + * hints to file descriptor. may also want to verify that + * the provided file realms are covering (for pfr at + * least) and non-overlapping */ + } + else if (file_realm_calc_type > 0) { + ADIOI_Calc_file_realms_user_size (fd, file_realm_calc_type, + nprocs_for_coll, + file_realm_st_offs, + file_realm_types); + /* flatten file realm datatype for future use - only one + * because all are the same */ + ADIOI_Flatten_datatype (file_realm_types[0]); + } + } + fd->file_realm_st_offs = file_realm_st_offs; + fd->file_realm_types = file_realm_types; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5005, 0, NULL); +#endif +} + +void ADIOI_Calc_file_realms_user_size (ADIO_File fd, int fr_size, + int nprocs_for_coll, + ADIO_Offset *file_realm_st_offs, + MPI_Datatype *file_realm_types) +{ + int i; + int aligned_fr_size; + ADIO_Offset aligned_fr_off; + MPI_Datatype simpletype; + + align_fr(fr_size, 0, fd->hints->cb_fr_alignment, &aligned_fr_size, + &aligned_fr_off); + fr_size = aligned_fr_size; + ADIOI_Create_fr_simpletype (fr_size, nprocs_for_coll, &simpletype); + + if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) + file_realm_st_offs[0] = 0; + else + file_realm_st_offs[0] = aligned_fr_off; + file_realm_types[0] = simpletype; +#ifdef DEBUG + printf ("file_realm[0] = (%lld, %d)\n", file_realm_st_offs[0], + fr_size); +#endif + + for (i=1; i < nprocs_for_coll; i++) + { + file_realm_st_offs[i] = file_realm_st_offs[i-1] + fr_size; + file_realm_types[i] = simpletype; +#ifdef DEBUG + printf ("file_realm[%d] = (%lld, %d)\n", i, file_realm_st_offs[i], + aligned_fr_size); +#endif + } +} + +/* takes an extra romio_cb_pfr param to decide whether file realms + * should start at byte 0 of the file*/ +void ADIOI_Calc_file_realms_aar (ADIO_File fd, int nprocs_for_coll, int cb_pfr, + ADIO_Offset min_st_offset, + ADIO_Offset max_end_offset, + ADIO_Offset *file_realm_st_offs, + MPI_Datatype *file_realm_types) +{ + int fr_size, aligned_fr_size, i; + MPI_Datatype simpletype; + ADIO_Offset aligned_start_off; + char value[9]; + + fr_size = (max_end_offset - min_st_offset + nprocs_for_coll) / + nprocs_for_coll; + align_fr(fr_size, min_st_offset, fd->hints->cb_fr_alignment, + &aligned_fr_size, &aligned_start_off); + fr_size = aligned_fr_size; + ADIOI_Create_fr_simpletype (fr_size, nprocs_for_coll, &simpletype); + if (cb_pfr == ADIOI_HINT_ENABLE) + file_realm_st_offs[0] = 0; + else + file_realm_st_offs[0] = aligned_start_off; + file_realm_types[0] = simpletype; + +#ifdef DEBUG + printf ("file_realm[0] = (%lld, %d)\n", file_realm_st_offs[0], + fr_size); +#endif + for (i=1; i < nprocs_for_coll; i++) + { + file_realm_st_offs[i] = file_realm_st_offs[i-1] + fr_size; + file_realm_types[i] = simpletype; +#ifdef DEBUG + printf ("file_realm[%d] = (%lld, %d)\n", i, file_realm_st_offs[i], + fr_size); +#endif + } + if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) { + sprintf (value, "%d", fr_size); + ADIOI_Info_set (fd->info, "romio_cb_fr_type", value); + } +} + +void ADIOI_Calc_file_realms_fsize (ADIO_File fd, int nprocs_for_coll, + ADIO_Offset max_end_offset, + ADIO_Offset *file_realm_st_offs, + MPI_Datatype *file_realm_types) +{ + int fr_size, aligned_fr_size, error_code, i; + int fsize; + ADIO_Offset aligned_fr_off; + ADIO_Fcntl_t fcntl_struct; + MPI_Datatype simpletype; + + ADIO_Fcntl (fd, ADIO_FCNTL_GET_FSIZE, &fcntl_struct, &error_code); + + /* use impending file size since a write call may lengthen the file */ + fsize = ADIOI_MAX (fcntl_struct.fsize, max_end_offset+1); + fr_size = (fsize + nprocs_for_coll - 1) / nprocs_for_coll; + align_fr(fr_size, 0, fd->hints->cb_fr_alignment, + &aligned_fr_size, &aligned_fr_off); + ADIOI_Create_fr_simpletype (fr_size, nprocs_for_coll, &simpletype); + + for (i=0; i < nprocs_for_coll; i++) + { + file_realm_st_offs[i] = fr_size * i; + file_realm_types[i] = simpletype; + } +} + +/* creates a datatype with an empty trailing edge */ +void ADIOI_Create_fr_simpletype (int size, int nprocs_for_coll, + MPI_Datatype *simpletype) +{ + int count=2, blocklens[2]; + MPI_Aint indices[2]; + MPI_Datatype old_types[2]; + + blocklens[0] = size; + blocklens[1] = 1; + indices[0] = 0; + indices[1] = size*nprocs_for_coll; + old_types[0] = MPI_BYTE; + old_types[1] = MPI_UB; + + MPI_Type_struct (count, blocklens, indices, old_types, simpletype); + + MPI_Type_commit (simpletype); +} + +/* Verify that file realms are covering (PFRs) and non-overlapping */ +void ADIOI_Verify_fr (int nprocs_for_coll, ADIO_Offset *file_realm_st_offs, + MPI_Datatype *file_realm_types) +{ +} + +int ADIOI_Agg_idx (int rank, ADIO_File fd) { + int i, cb_nodes, *ranklist; + cb_nodes = fd->hints->cb_nodes; + ranklist = fd->hints->ranklist; + + for (i=0; i #endif void ADIO_Close(ADIO_File fd, int *error_code) { int i, j, k, combiner, myrank, err, is_contig; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIO_CLOSE"; -#endif if (fd->async_count) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_Close: Error! There are outstanding nonblocking I/O operations on this file.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ASYNC_OUTSTANDING, - myname, (char *) 0, (char *) 0); - ADIOI_Error(fd, *error_code, myname); - return; -#endif + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, "**io", + "**io %s", strerror(errno)); + return; } - (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); + /* because of deferred open, this warants a bit of explaining. First, if + * we've done aggregation (fd->agg_comm has a non-nulll communicator ), + * then close the file. Then, if any process left has done independent + * i/o, close the file. Otherwise, we'll skip the fs-specific close and + * just say everything is a-ok. + * + * XXX: is it ok for those processes with a "real" communicator and those + * with "MPI_COMM_SELF" to both call ADIOI_xxx_Close at the same time ? + * everyone who ever opened the file will close it. Is order important? Is + * timing important? + */ + if (fd->agg_comm != MPI_COMM_NULL) { + (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); + } else { + if(fd->is_open) { + (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); + } else { + *error_code = MPI_SUCCESS; + } + + } if (fd->access_mode & ADIO_DELETE_ON_CLOSE) { + /* if we are doing aggregation and deferred open, then it's possible + * that rank 0 does not have access to the file. make sure only an + * aggregator deletes the file.*/ MPI_Comm_rank(fd->comm, &myrank); + if (myrank == fd->hints->ranklist[0]) { + ADIO_Delete(fd->filename, &err); + } MPI_Barrier(fd->comm); - if (!myrank) ADIO_Delete(fd->filename, &err); } - ADIOI_Free(fd->fns); + if (fd->fortran_handle != -1) { + CtvAccess(ADIOI_Ftable)[fd->fortran_handle] = MPI_FILE_NULL; + } + + if (fd->hints && fd->hints->ranklist) ADIOI_Free(fd->hints->ranklist); + if (fd->hints && fd->hints->cb_config_list) ADIOI_Free(fd->hints->cb_config_list); + + /* Persistent File Realms */ + if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) { + /* AAR, FSIZE, and User provided uniform File realms */ + if (1) { + ADIOI_Delete_flattened (fd->file_realm_types[0]); + MPI_Type_free (&fd->file_realm_types[0]); + } + else { + for (i=0; ihints->cb_nodes; i++) { + ADIOI_Datatype_iscontig(fd->file_realm_types[i], &is_contig); + if (!is_contig) + ADIOI_Delete_flattened(fd->file_realm_types[i]); + MPI_Type_free (&fd->file_realm_types[i]); + } + } + ADIOI_Free(fd->file_realm_st_offs); + ADIOI_Free(fd->file_realm_types); + } + if (fd->hints) ADIOI_Free(fd->hints); + + + MPI_Comm_free(&(fd->comm)); - free(fd->filename); /* should not use ADIOI_Free here, because - it was strdup'ed */ + /* deferred open: if we created an aggregator communicator, free it */ + if (fd->agg_comm != MPI_COMM_NULL) { + MPI_Comm_free(&(fd->agg_comm)); + } + ADIOI_Free(fd->filename); MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner); if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype)); @@ -54,5 +104,5 @@ void ADIO_Close(ADIO_File fd, int *error_code) MPI_Info_free(&(fd->info)); - ADIOI_Free(fd); + /* memory for fd is freed in MPI_File_close */ } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_coll_build_req_new.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_coll_build_req_new.c new file mode 100644 index 0000000000..8de28621c4 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_coll_build_req_new.c @@ -0,0 +1,2086 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include +#include "adio.h" +#include "adio_extern.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif +#include "heap-sort.h" + +/* +#define DEBUG1 +#define DEBUG2 +#define DEBUG3 +*/ +/* #define DEBUG_HEAP */ + +#define DTYPE_SKIP + +#ifdef DEBUG3 +static char *off_type_name[MAX_OFF_TYPE] = {"TEMP_OFFSETS", + "REAL_OFFSETS"}; +#endif + +/* Simple function to return the size of the view_state. */ +static inline ADIO_Offset view_state_get_cur_sz(view_state *tmp_view_state_p, + int op_type) +{ + flatten_state *tmp_state_p = NULL; + switch(op_type) + { + case TEMP_OFF: + tmp_state_p = &(tmp_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(tmp_view_state_p->cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + return tmp_state_p->cur_sz; +} + +/* Simple function to return the len of the next piece of the view_state. */ +static inline ADIO_Offset view_state_get_next_len(view_state *tmp_view_state_p, + int op_type) +{ + flatten_state *tmp_state_p = NULL; + switch(op_type) + { + case TEMP_OFF: + tmp_state_p = &(tmp_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(tmp_view_state_p->cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + return (ADIO_Offset) + tmp_view_state_p->flat_type_p->blocklens[tmp_state_p->idx] - + tmp_state_p->cur_reg_off; +} + +/* Add up to a region of a file view and no larger than a max size. + * The view_state is always consistent with the abs_off and where the + * index and cur_reg_off point to. The regions should be coalesced if + * possible later on. */ +static inline int view_state_add_region( + ADIO_Offset max_sz, + view_state *tmp_view_state_p, + ADIO_Offset *st_reg_p, + ADIO_Offset *tmp_reg_sz_p, + int op_type) +{ + ADIOI_Flatlist_node *tmp_flat_type_p = NULL; + flatten_state *tmp_state_p = NULL; + int64_t data_sz = 0; + +#ifdef AGGREGATION_PROFILE + /* MPE_Log_event (5020, 0, NULL); */ +#endif + + switch(op_type) + { + case TEMP_OFF: + tmp_state_p = &(tmp_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(tmp_view_state_p->cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + + tmp_flat_type_p = tmp_view_state_p->flat_type_p; + + *st_reg_p = tmp_state_p->abs_off; + + /* Should be looking at some data (or it's a zero len blocklens + * (i.e. placeholder). */ + assert(tmp_state_p->cur_reg_off != + tmp_flat_type_p->blocklens[tmp_state_p->idx]); + /* Shouldn't have been called if the view_state is done. */ + assert(tmp_state_p->cur_sz != tmp_view_state_p->sz); + + /* Make sure we are not in a non-zero region in the flat_type */ + assert(tmp_flat_type_p->blocklens[tmp_state_p->idx] != 0); + +#ifdef DEBUG3 + fprintf(stderr, "view_state:(blocklens[%Ld]=%d,cur_reg_off=%Ld," + "max_sz=%Ld)\n", tmp_state_p->idx, + tmp_flat_type_p->blocklens[tmp_state_p->idx], + tmp_state_p->cur_reg_off, max_sz); +#endif + + /* Can it add the whole piece? */ + if (tmp_flat_type_p->blocklens[tmp_state_p->idx] - + tmp_state_p->cur_reg_off <= max_sz) + { + data_sz = tmp_flat_type_p->blocklens[tmp_state_p->idx] - + tmp_state_p->cur_reg_off; + + tmp_state_p->cur_sz += data_sz; + + /* Advance the abs_off to the beginning of the next piece */ + if (tmp_flat_type_p->count == 1) + { + assert(tmp_flat_type_p->blocklens[tmp_state_p->idx] != 0); + tmp_state_p->abs_off += data_sz; +#ifdef DEBUG3 + fprintf(stderr, "view_state_add_region: %s contig type " + "(old abs_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld)\n", + off_type_name[op_type], tmp_state_p->abs_off - data_sz, + tmp_state_p->abs_off, tmp_state_p->cur_sz, data_sz); +#endif + } + else + { + /* Is this the last region in the datatype? */ + if (tmp_state_p->idx == (tmp_flat_type_p->count - 1)) + { + tmp_state_p->abs_off += data_sz - + tmp_flat_type_p->indices[tmp_flat_type_p->count-1] - + tmp_flat_type_p->blocklens[tmp_flat_type_p->count-1] + + tmp_view_state_p->ext; +#ifdef DEBUG3 + fprintf(stderr, "view_state_add_region: %s last region for type " + "(old abs_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld)\n", + off_type_name[op_type], tmp_state_p->abs_off - data_sz, + tmp_state_p->abs_off, tmp_state_p->cur_sz, data_sz); +#endif + } + else + { + tmp_state_p->abs_off += + tmp_flat_type_p->indices[tmp_state_p->idx + 1] - + (tmp_flat_type_p->indices[tmp_state_p->idx] + + tmp_state_p->cur_reg_off); +#ifdef DEBUG3 + fprintf(stderr, "view_state_add_region: %s inner region type " + "(old abs_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld)\n", + off_type_name[op_type], tmp_state_p->abs_off - + (tmp_flat_type_p->indices[tmp_state_p->idx + 1] - + (tmp_flat_type_p->indices[tmp_state_p->idx] + + tmp_state_p->cur_reg_off)), tmp_state_p->abs_off, + tmp_state_p->cur_sz, data_sz); +#endif + } + /* Increment idx to next non-zero region in the flat_type */ + do { + tmp_state_p->idx = + (tmp_state_p->idx + 1) % tmp_flat_type_p->count; + } while (tmp_flat_type_p->blocklens[tmp_state_p->idx] == 0); + } + tmp_state_p->cur_reg_off = 0; + } + else /* Add part of the piece */ + { + data_sz = max_sz; + tmp_state_p->cur_reg_off += data_sz; + tmp_state_p->abs_off += data_sz; + tmp_state_p->cur_sz += data_sz; +#ifdef DEBUG3 + fprintf(stderr, "view_state_add_region: %s partial region type " + "(cur_reg_off=%Ld,abs_off=%Ld,cur_sz=%Ld,reg size=%Ld\n", + off_type_name[op_type], tmp_state_p->cur_reg_off, + tmp_state_p->abs_off, tmp_state_p->cur_sz, data_sz); +#endif + } + + *tmp_reg_sz_p = data_sz; +#ifdef AGGREGATION_PROFILE + /* MPE_Log_event (5021, 0, NULL); */ +#endif + return 0; +} + +/* Set up the abs_off, idx, and cur_reg_off of a view_state for the + * tmp_state or the cur_state. */ +int ADIOI_init_view_state(int file_ptr_type, + int nprocs, + view_state *view_state_arr, + int op_type) +{ + ADIOI_Flatlist_node *tmp_flat_type_p = NULL; + ADIO_Offset tmp_off_used = 0, st_reg = 0, tmp_reg_sz = 0; + int i; + flatten_state *tmp_state_p = NULL; + view_state *tmp_view_p = NULL; + + for (i = 0; i < nprocs; i++) + { + switch(op_type) + { + case TEMP_OFF: + tmp_state_p = &(view_state_arr[i].tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(view_state_arr[i].cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + + tmp_view_p = &(view_state_arr[i]); + tmp_flat_type_p = tmp_view_p->flat_type_p; + + if (file_ptr_type == ADIO_INDIVIDUAL) + tmp_state_p->abs_off = tmp_view_p->fp_ind; + else + tmp_state_p->abs_off = tmp_view_p->disp; + + tmp_off_used = 0; + + /* initialize tmp_state idx */ + while (tmp_flat_type_p->blocklens[tmp_state_p->idx] == 0) + tmp_state_p->idx = (tmp_state_p->idx + 1) % tmp_flat_type_p->count; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) + tmp_state_p->abs_off += tmp_flat_type_p->indices[tmp_state_p->idx]; + + /* Initialize the abs_off by moving into the datatype + * byte_off bytes. Since we only do this in the beginning, we + * make the assumption that pieces are added whole until the last + * piece which MAY be partial. */ + while (tmp_off_used != tmp_view_p->byte_off) + { + view_state_add_region( + tmp_view_p->byte_off - tmp_off_used, + &(view_state_arr[i]), &st_reg, &tmp_reg_sz, + op_type); + } + + /* Re-initialize the cur_size so that the abs_off was set to + * the proper position while the actual size = 0.*/ + tmp_state_p->cur_sz = 0; +#ifdef DEBUG1 + fprintf(stderr, "init_view_state: %s (idx=%d,byte_off=%Ld," + "abs_off=%Ld,reg_off=%Ld,sz=%Ld)\n", off_type_name[op_type], + i, tmp_view_p->byte_off, tmp_state_p->abs_off, + tmp_state_p->cur_reg_off, tmp_view_p->sz); +#endif + + } + return 0; +} + +/* Return the next file realm offset and length for this datatype state + * within a particular file realm. */ +static inline int get_next_fr_off(ADIO_File fd, + ADIO_Offset off, + ADIO_Offset fr_st_off, + MPI_Datatype *fr_type_p, + ADIO_Offset *fr_next_off_p, + ADIO_Offset *fr_max_len_p) +{ + MPI_Aint fr_extent = -1; + ADIO_Offset tmp_off, off_rem; + ADIOI_Flatlist_node *fr_node_p = CtvAccess(ADIOI_Flatlist); + int i = -1, fr_dtype_ct = 0; + + /* Should have already been flattened in calc_file_realms() */ + while (fr_node_p->type != (*fr_type_p)) + fr_node_p = fr_node_p->next; + assert(fr_node_p != NULL); + + /* Did we get to the first region of the file realm? */ + if (off - fr_st_off < 0) + { + *fr_next_off_p = fr_st_off + fr_node_p->indices[0]; + *fr_max_len_p = fr_node_p->blocklens[0]; + return 0; + } + + /* Calculate how many times to loop through the fr_type + * and where the next fr_off is. */ + MPI_Type_extent(*fr_type_p, &fr_extent); + tmp_off = off - fr_st_off; + fr_dtype_ct = tmp_off / fr_extent; + off_rem = tmp_off % fr_extent; + for (i = 0; i < fr_node_p->count; i++) + { + if (off_rem < fr_node_p->indices[i]) + { + *fr_next_off_p = fr_st_off + + (fr_dtype_ct * fr_extent) + fr_node_p->indices[i]; + *fr_max_len_p = fr_node_p->blocklens[i]; + return 0; + } + else if (off_rem < fr_node_p->indices[i] + fr_node_p->blocklens[i]) + { + *fr_next_off_p = off; + *fr_max_len_p = fr_node_p->blocklens[i] - + (off_rem - fr_node_p->indices[i]); + return off; + } + } + + /* Shouldn't get here. */ + fprintf(stderr, "get_next_fr_off: Couldn't find the correct " + "location of the next offset for this file realm.\n"); + return -1; +} + +/* Look in all the view states for the first offset within a given + * file realm. Report the end of a contiguous region within the file + * realm (possibly more than the actual view state may be able to + * process contiguously). */ +static inline int find_next_off(ADIO_File fd, + view_state *view_state_p, + ADIO_Offset fr_st_off, + MPI_Datatype *fr_type_p, + int op_type, + ADIO_Offset *cur_off_p, + ADIO_Offset *cur_reg_max_len_p) +{ + ADIOI_Flatlist_node *tmp_flat_type_p = NULL; + ADIO_Offset tmp_off = -1, fr_next_off = -1, fr_max_len = -1, + tmp_fr_max_len = -1; + int ret = -1; + flatten_state *tmp_state_p = NULL; + ADIO_Offset tmp_st_off = 0, tmp_reg_sz = 0; +#ifdef DTYPE_SKIP + int skip_type_ct; +#endif + +#ifdef AGGREGATION_PROFILE + /* MPE_Log_event (5022, 0, NULL); */ +#endif + + switch(op_type) + { + case TEMP_OFF: + tmp_state_p = &(view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_state_p = &(view_state_p->cur_state); + break; + default: + fprintf(stderr, "op_type invalid\n"); + } + + tmp_flat_type_p = view_state_p->flat_type_p; + + /* Can we use this proc? */ + if (tmp_state_p->cur_sz < view_state_p->sz) { + tmp_st_off = 0; + tmp_reg_sz = 0; + /* If the current region is not within the file realm, advance + * the state until it is and calculate the end of the next file + * realm in fr_max_len. */ + ret = get_next_fr_off(fd, + tmp_state_p->abs_off, + fr_st_off, + fr_type_p, + &fr_next_off, + &fr_max_len); + + while ((tmp_state_p->abs_off < fr_next_off) && + (tmp_state_p->cur_sz != view_state_p->sz)) + { + + /* While this might appear to be erroneous at first, + * view_state_add_region can only add a single piece at a + * time. Therefore, it will never overshoot the beginning + * of the next file realm. When it finally does enter the + * next file realm it will not be able to go beyond its + * first piece. */ + +#ifdef DTYPE_SKIP + if (tmp_flat_type_p->count > 1) { + /* let's see if we can skip whole datatypes */ + skip_type_ct = (fr_next_off - tmp_state_p->abs_off) / + view_state_p->ext; + if (skip_type_ct > 0) { + /* before we go on, let's check if we've actually + * finished up already */ + tmp_state_p->cur_sz += skip_type_ct * + view_state_p->type_sz; + if (tmp_state_p->cur_sz >= view_state_p->sz) { + tmp_state_p->cur_sz = view_state_p->sz; + break; + } + tmp_state_p->abs_off += skip_type_ct * view_state_p->ext; + } + } +#endif + view_state_add_region( + fr_next_off - tmp_state_p->abs_off, + view_state_p, + &tmp_st_off, + &tmp_reg_sz, + op_type); + + ret = get_next_fr_off(fd, + tmp_state_p->abs_off, + fr_st_off, + fr_type_p, + &fr_next_off, + &fr_max_len); + } + + if (tmp_state_p->cur_sz != view_state_p->sz) { + tmp_off = tmp_state_p->abs_off; + /* Calculate how much of the remaining file realm there is from the + * current offset */ + tmp_fr_max_len = fr_next_off + fr_max_len - tmp_off; + } + } + + *cur_off_p = tmp_off; + *cur_reg_max_len_p = tmp_fr_max_len; +#ifdef AGGREGATION_PROFILE + /* MPE_Log_event (5023, 0, NULL); */ +#endif + return 0; +} + +/* Upon completion of a full collective buffer, end of a file realm + * region (data sieving), or the end of all I/O for an aggregator, we + * should return a list of MPI_Datatypes that correspond to client + * communication into a collective buffer, a list of corresponding + * sizes, and an aggregate MPI_Datatype which will be used as a + * filetype in MPI_File_write/read on the aggregator. */ +int ADIOI_Build_agg_reqs(ADIO_File fd, int rw_type, int nprocs, + view_state *client_file_view_state_arr, + MPI_Datatype *client_comm_dtype_arr, + ADIO_Offset *client_comm_sz_arr, + ADIO_Offset *agg_dtype_offset_p, + MPI_Datatype *agg_dtype_p) +{ + MPI_Aint **client_disp_arr = NULL, *agg_disp_arr = NULL; + int **client_blk_arr = NULL, *agg_blk_arr = NULL; + ADIO_Offset tmp_coll_buf_sz = 0, st_reg = 0, act_reg_sz = 0; + ADIO_Offset cur_off = -1, cur_reg_max_len = -1; + ADIO_Offset ds_fr_end = -1; + ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; + MPI_Datatype *fr_type_arr = fd->file_realm_types; + int *client_ol_ct_arr = NULL; + int *client_ol_cur_ct_arr = NULL; + int agg_ol_ct = 0, agg_ol_cur_ct = 0; + int cur_off_proc = -1; + int next_off_idx = -1; + int i = 0, j = 0, all_done = -1; + int agg_idx = fd->my_cb_nodes_index; + heap_t offset_heap; + ADIO_Offset next_off = -1, next_reg_max_len = -1; + + /* Used for coalescing ol pairs next to each other. */ + ADIO_Offset *client_comm_next_off_arr = NULL; + ADIO_Offset agg_next_off = -1; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5016, 0, NULL); +#endif + + memset(client_comm_sz_arr, 0, nprocs*sizeof(ADIO_Offset)); + + if ((client_comm_next_off_arr = (ADIO_Offset *) + ADIOI_Malloc(nprocs*sizeof(ADIO_Offset))) == NULL) + { + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc client_next_off_arr " + "failed\n"); + return -1; + } + + if ((client_ol_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) == NULL) + { + fprintf(stderr, "ADIOI_Build_agg_reqs: " + "malloc client_ol_ct_arr failed\n"); + return -1; + } + if ((client_ol_cur_ct_arr = + (int *) ADIOI_Calloc(nprocs, sizeof(int))) == NULL) + { + fprintf(stderr, "ADIOI_Build_agg_reqs: " + "malloc client_ol_cur_ct_arr failed\n"); + return -1; + } + + /* On the first pass see how many offset-length pairs are + * necessary for each client. Then allocate the correct amount of + * offset-length pairs for describing the collective buffer. All + * data is processed in order by the aggregator's file realm. On + * the second pass, set the offset-length pairs to the correct + * values. */ + for (i = 0; i < MAX_OFF_TYPE; i++) + { + memset(client_comm_next_off_arr, -1, nprocs*sizeof(ADIO_Offset)); + tmp_coll_buf_sz = 0; + ds_fr_end = -1; + + /* initialize heap */ + ADIOI_Heap_create(&offset_heap, nprocs); + offset_heap.size = 0; + + for (j=0; j 0)) { + ADIOI_Heap_insert(&offset_heap, cur_off, j, cur_reg_max_len); +#ifdef DEBUG_HEAP + printf ("initial: inserting offset %lld with " + "cur_reg_max_len = %lld for p%d\n", + cur_off, cur_reg_max_len, j); +#endif + } + + } + if (!offset_heap.size) + ADIOI_Heap_insert(&offset_heap, -1, -1, -1); + + while (tmp_coll_buf_sz < fd->hints->cb_buffer_size) + { + /* Find the next process with the next region within the + * file realm and the maximum amount that can be added for + * this particular file realm as a contiguous region. */ + ADIOI_Heap_extract_min(&offset_heap, &cur_off, &cur_off_proc, + &cur_reg_max_len); +#ifdef DEBUG_HEAP + printf ("extracted cur_off %lld from proc %d\n", + cur_off, cur_off_proc); +#endif + + if (cur_off == -1) + break; + +#ifdef DEBUG3 + fprintf(stderr, "ADIOI_Build_agg_reqs: %s proc %d start/add to" + " list (max_reg_fr=%Ld,tmp_coll_buf_sz=%Ld," + "cb_buffer_size=%d)\n", off_type_name[i], cur_off_proc, + cur_reg_max_len, tmp_coll_buf_sz, + fd->hints->cb_buffer_size); +#endif + + /* We process only contiguous file realm regions if we are + * using data sieving. Note that we only do this for + * writes since reads can be data sieved across each other + * without consistency issues. */ + if ((fd->hints->ds_write == ADIOI_HINT_ENABLE || + fd->hints->ds_write == ADIOI_HINT_AUTO) && + rw_type == ADIOI_WRITE && fd->hints->cb_nodes > 1) + { +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_agg_reqs: " + "Warning - Data sieving writes on\n"); +#endif + if (ds_fr_end == -1) + { + ds_fr_end = cur_off + cur_reg_max_len; +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_agg_reqs: " + "cur_off=%Ld, cur_reg_max_len=%Ld\n" + "Data sieving file realm end initialized to %Ld\n", + cur_off, + cur_reg_max_len, + ds_fr_end); +#endif + } + else + { + /* The next off switched file realms, so we will stop + * here. */ + if (ds_fr_end != cur_off + cur_reg_max_len) + { +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_agg_reqs: " + "Data sieving file realm end changed from " + "%Ld to %Ld\n", ds_fr_end, + cur_off + cur_reg_max_len); +#endif + break; + } + } + } + + /* Add up to the end of the file realm or the collective + * buffer. */ + if (cur_reg_max_len > (fd->hints->cb_buffer_size - + tmp_coll_buf_sz)) + cur_reg_max_len = fd->hints->cb_buffer_size - tmp_coll_buf_sz; + + view_state_add_region( + cur_reg_max_len, + &(client_file_view_state_arr[cur_off_proc]), + &st_reg, &act_reg_sz, i); + + switch(i) + { + case TEMP_OFF: + /* Increment the ol list count for each proc and + * the used part of the collective buffer if the + * next region is not adjacent to the previous + * region. */ + if (client_comm_next_off_arr[cur_off_proc] != + tmp_coll_buf_sz) + { + (client_ol_ct_arr[cur_off_proc])++; + } + client_comm_next_off_arr[cur_off_proc] = + tmp_coll_buf_sz + act_reg_sz; + + if (agg_next_off != st_reg) + agg_ol_ct++; + agg_next_off = st_reg + act_reg_sz; + break; + case REAL_OFF: + /* Add this region to the proper client ol list if + * the next region is not adjacent to the previous + * region. */ + next_off_idx = client_ol_cur_ct_arr[cur_off_proc]; + if (client_comm_next_off_arr[cur_off_proc] != + tmp_coll_buf_sz) + { + client_disp_arr[cur_off_proc][next_off_idx] = + tmp_coll_buf_sz; + client_blk_arr[cur_off_proc][next_off_idx] = + act_reg_sz; + (client_ol_cur_ct_arr[cur_off_proc])++; + } + else + { + client_blk_arr[cur_off_proc][next_off_idx - 1] + += act_reg_sz; + } + client_comm_sz_arr[cur_off_proc] += act_reg_sz; + client_comm_next_off_arr[cur_off_proc] = + tmp_coll_buf_sz + act_reg_sz; + + /* Add to the aggregator filetype if the next + * region is not adjacent to the previous + * region. */ + if (agg_next_off != st_reg) + { + /* this will enable initial offsets much further into + * the file than an MPI_Aint */ + if (!agg_ol_cur_ct) + *agg_dtype_offset_p = st_reg; + agg_disp_arr[agg_ol_cur_ct] = st_reg - + (MPI_Aint) *agg_dtype_offset_p; + agg_blk_arr[agg_ol_cur_ct] = act_reg_sz; + agg_ol_cur_ct++; + } + else + { + agg_blk_arr[agg_ol_cur_ct - 1] += act_reg_sz; + } + agg_next_off = st_reg + act_reg_sz; + + break; + default: + fprintf(stderr, "ADIOI_Build_agg_reqs: Impossible type\n"); + } + tmp_coll_buf_sz += act_reg_sz; + + find_next_off(fd, + &client_file_view_state_arr[cur_off_proc], + fr_st_off_arr[agg_idx], + &(fr_type_arr[agg_idx]), + i, + &next_off, + &next_reg_max_len); + + if ((next_off != -1) || (!offset_heap.size)) { + ADIOI_Heap_insert(&offset_heap, next_off, cur_off_proc, + next_reg_max_len); +#ifdef DEBUG_HEAP + printf ("inserting offset %lld for p%d\n", next_off, + cur_off_proc); +#endif + } + } + + if (i == TEMP_OFF) + { + /* Allocate offset-length pairs for creating hindexed + * MPI_Datatypes for both the client and the aggregator. */ + if ((client_disp_arr = (MPI_Aint **) + ADIOI_Malloc(nprocs*sizeof(MPI_Aint *))) == NULL) + { + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " + "client_disp_arr failed\n"); + return -1; + } + if ((client_blk_arr = (int **) ADIOI_Malloc( + nprocs*sizeof(int *))) == NULL) + { + ADIOI_Free(client_disp_arr); + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " + "client_blk_arr failed\n"); + return -1; + } + for (j = 0; j < nprocs; j++) + { + if ((client_disp_arr[j] = (MPI_Aint *) ADIOI_Malloc( + client_ol_ct_arr[j]*sizeof(MPI_Aint))) == NULL) + { + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " + "client_disp_arr[%d] failed\n", j); + return -1; + } + if ((client_blk_arr[j] = (int *) + ADIOI_Malloc(client_ol_ct_arr[j]*sizeof(int))) == NULL) + { + ADIOI_Free(client_disp_arr[j]); + fprintf(stderr, "ADIOI_Build_agg_reqs: malloc " + "client_blk_arr[%d] failed\n", j); + return -1; + } + } + + if (agg_ol_ct > 0) + { + if ((agg_disp_arr = (MPI_Aint *) ADIOI_Malloc( + agg_ol_ct*sizeof(MPI_Aint))) == NULL) + { + fprintf(stderr, + "ADIOI_Build_agg_reqs: malloc disp_arr failed\n"); + return -1; + } + if ((agg_blk_arr = (int *) + ADIOI_Malloc(agg_ol_ct*sizeof(int))) == NULL) + { + ADIOI_Free(agg_disp_arr); + fprintf(stderr, + "ADIOI_Build_agg_reqs: malloc blk_arr failed\n"); + return -1; + } + } + } + ADIOI_Heap_free(&offset_heap); + } + + /* Let the clients know if this aggregator is totally finished + * with all possible client requests. */ + all_done = 1; + for (i = 0; i < nprocs; i++) + { + if ((client_file_view_state_arr[i].cur_state.cur_sz != + client_file_view_state_arr[i].sz) || + client_comm_sz_arr[i] != 0) + { + all_done = 0; + break; + } + } + if (all_done == 1) + { + for (i = 0; i < nprocs; i++) + { + client_comm_sz_arr[i] = -1; + } + } + + /* Quick check to make sure we found all the ol pairs we thought + * we did */ + for (i = 0; i < nprocs; i++) + { + if (client_ol_cur_ct_arr[i] != client_ol_ct_arr[i]) + { + fprintf(stderr, "ADIOI_Build_agg_reqs: ERROR Process %d " + "processed only %d out of %d ol pairs\n", i, + client_ol_cur_ct_arr[i], + client_ol_ct_arr[i]); + return -1; + } + } +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_agg_reqs:(client,ol_pairs,size_req)="); + for (i = 0; i < nprocs; i++) + { + fprintf(stderr, "(%d,%d,%Ld)", i, client_ol_ct_arr[i], + client_comm_sz_arr[i]); + if (i != nprocs - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "\n"); +#endif +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_agg_reqs: Generated %d of %d " + "aggregate offset-length pairs\n", agg_ol_cur_ct, agg_ol_ct); +#endif +#ifdef DEBUG2 + for (i = 0; i < nprocs; i++) + { + if (client_ol_ct_arr[i] > 0) + { + fprintf(stderr, "ADIOI_Build_agg_reqs: p %d (off,len) = ", i); + for (j = 0; j < client_ol_ct_arr[i]; j++) + { + fprintf(stderr, "[%d](%d,%d) ", j, + client_disp_arr[i][j], + client_blk_arr[i][j]); + } + fprintf(stderr, "\n"); + } + } + if (agg_ol_ct) { + fprintf(stderr, "ADIOI_Build_agg_reqs:agg_type(off,len)="); + for (i = 0; i < agg_ol_ct; i++) + { + fprintf(stderr, "[%d](%d,%d)", + i, agg_disp_arr[i], agg_blk_arr[i]); + if (i != agg_ol_ct - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "\n"); + } +#endif + + assert(agg_ol_cur_ct == agg_ol_ct); + + /* Create all the client and aggregate MPI_Datatypes */ + for (i = 0; i < nprocs; i++) + { + if (client_comm_sz_arr[i] > 0) + { + MPI_Type_hindexed(client_ol_ct_arr[i], client_blk_arr[i], + client_disp_arr[i], MPI_BYTE, + &(client_comm_dtype_arr[i])); + MPI_Type_commit(&(client_comm_dtype_arr[i])); + } + else + { + client_comm_dtype_arr[i] = MPI_BYTE; + } + ADIOI_Free(client_blk_arr[i]); + ADIOI_Free(client_disp_arr[i]); + } + ADIOI_Free(client_blk_arr); + ADIOI_Free(client_disp_arr); + + if (agg_ol_ct > 0) { + if (agg_ol_ct == 1) + MPI_Type_contiguous (agg_blk_arr[0], MPI_BYTE, agg_dtype_p); + else if (agg_ol_ct > 1) + MPI_Type_hindexed(agg_ol_ct, agg_blk_arr, agg_disp_arr, MPI_BYTE, + agg_dtype_p); + + MPI_Type_commit(agg_dtype_p); + + ADIOI_Free(agg_disp_arr); + ADIOI_Free(agg_blk_arr); + } + ADIOI_Free(client_ol_ct_arr); + ADIOI_Free(client_ol_cur_ct_arr); + ADIOI_Free(client_comm_next_off_arr); +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5017, 0, NULL); +#endif + return 0; +} + +/* All sizes from all aggregators are gathered on the clients, which + * then call this function, which will generate the comm datatypes for + * each aggregator (agg_comm_dtype_arr) in the upcoming + * MPI_Alltoallw() */ +int ADIOI_Build_client_reqs(ADIO_File fd, + int nprocs, + view_state *my_mem_view_state_arr, + view_state *agg_file_view_state_arr, + ADIO_Offset *agg_comm_sz_arr, + MPI_Datatype *agg_comm_dtype_arr) +{ + MPI_Aint **agg_disp_arr = NULL; + int **agg_blk_arr = NULL; + view_state *tmp_mem_state_p = NULL, *tmp_file_state_p = NULL; + ADIO_Offset total_agg_comm_sz = 0, cur_total_agg_comm_sz = 0; + ADIO_Offset st_reg = 0, act_reg_sz = 0, tmp_reg_sz = 0; + ADIO_Offset cur_off = -1, cur_reg_max_len = -1; + ADIO_Offset tmp_cur_off = -1, tmp_cur_reg_max_len = -1; + ADIO_Offset agg_mem_st_reg = 0, agg_mem_act_reg_sz = 0; + ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; + ADIO_Offset *agg_comm_cur_sz_arr = NULL; + MPI_Datatype *fr_type_arr = fd->file_realm_types; + int cb_node_ct = fd->hints->cb_nodes; + int *agg_ol_ct_arr = NULL; + int *agg_ol_cur_ct_arr = NULL; + int agg_fr_idx = -1, tmp_agg_fr_idx = -1; + int cur_off_proc = -1; + int i = 0, j = 0; + int agg_next_off_idx = -1; + /* Used for coalescing ol pairs next to each other. */ + ADIO_Offset *agg_mem_next_off_arr = NULL; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5018, 0, NULL); +#endif + +#ifdef DEBUG + fprintf(stderr, "ADIOI_Build_client_reqs:(agg,size_req)="); + for (i = 0; i < nprocs; i++) + { + int tmp_agg_idx = ADIOI_Agg_idx(i, fd); + if (tmp_agg_idx >= 0) + { + fprintf(stderr, "(%d,%Ld)", i, agg_comm_sz_arr[i]); + if (i != fd->hints->cb_nodes - 1) + fprintf(stderr, ","); + } + fprintf(stderr, "\n"); + } +#endif + + if ((agg_mem_next_off_arr = (ADIO_Offset *) ADIOI_Malloc( + nprocs*sizeof(ADIO_Offset))) == NULL) + { + fprintf(stderr, "ADIOI_Build_client_reqs: malloc agg_mem_next_off_arr" + "failed\n"); + return -1; + } + + if ((agg_comm_cur_sz_arr = (ADIO_Offset *) + ADIOI_Malloc(nprocs*sizeof(ADIO_Offset))) == NULL) + { + fprintf(stderr, "ADIOI_Build_client_reqs: malloc agg_comm_cur_sz_arr" + " failed\n"); + return -1; + } + if ((agg_ol_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) + == NULL) + { + fprintf(stderr, "ADIOI_Build_client_reqs: " + "malloc agg_ol_ct_arr failed\n"); + return -1; + } + if ((agg_ol_cur_ct_arr = (int *) ADIOI_Calloc(nprocs, sizeof(int))) + == NULL) + { + fprintf(stderr, "ADIOI_Build_client_reqs: " + "malloc agg_ol_cur_ct_arr failed\n"); + return -1; + } + + for (i = 0; i < nprocs; i++) + { + if (agg_comm_sz_arr[i] > 0) + total_agg_comm_sz += agg_comm_sz_arr[i]; + } + + /* On the first pass see how many offset-length pairs are + * necessary for each aggregator. Then allocate the correct + * amount of offset-length pairs for handling each aggregator's + * particular data size. On the last pass, we actually create the + * offset-length pairs. */ + for (i = 0; i < MAX_OFF_TYPE; i++) + { + cur_total_agg_comm_sz = 0; + memset(agg_comm_cur_sz_arr, 0, nprocs*sizeof(ADIO_Offset)); + memset(agg_mem_next_off_arr, -1, nprocs*sizeof(ADIO_Offset)); + while (total_agg_comm_sz > cur_total_agg_comm_sz) + { + /* Look for the next aggregator offset among all the + * aggregators and their respective file realms. */ + cur_off = -1; + for (j = 0; j < nprocs; j++) + { + tmp_agg_fr_idx = ADIOI_Agg_idx(j, fd); + assert(tmp_agg_fr_idx < cb_node_ct); + + /* If this process is not an aggregator or we have + * finished all the bytes for this aggregator, move + * along. */ + if (tmp_agg_fr_idx < 0 || + agg_comm_cur_sz_arr[j] == agg_comm_sz_arr[j]) + { + continue; + } + + find_next_off(fd, + &(agg_file_view_state_arr[j]), + fr_st_off_arr[tmp_agg_fr_idx], + &(fr_type_arr[tmp_agg_fr_idx]), + i, + &tmp_cur_off, + &tmp_cur_reg_max_len); + if (tmp_cur_off == -1) + continue; + + if ((cur_off == -1) || + (cur_off > tmp_cur_off)) + { + agg_fr_idx = tmp_agg_fr_idx; + cur_off_proc = j; + cur_off = tmp_cur_off; + cur_reg_max_len = tmp_cur_reg_max_len; + } + } + + assert(cur_off_proc != -1); + + /* Add up to the end of the file realm or as many bytes + * are left for this particular aggregator in the client's + * filetype */ + if (cur_reg_max_len > agg_comm_sz_arr[cur_off_proc] - + agg_comm_cur_sz_arr[cur_off_proc]) + { + cur_reg_max_len = agg_comm_sz_arr[cur_off_proc] - + agg_comm_cur_sz_arr[cur_off_proc]; + } + assert(cur_reg_max_len > 0); + + view_state_add_region( + cur_reg_max_len, + &(agg_file_view_state_arr[cur_off_proc]), + &st_reg, &act_reg_sz, i); + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_reqs: %s File region" + " (proc=%d,off=%Ld,sz=%Ld)\n", + off_type_name[i], cur_off_proc, + cur_off, act_reg_sz); +#endif + + /* Before translating the file regions to memory regions, + * we first must advance to the proper point in the + * mem_view_state for this aggregator to match the + * file_view_state. */ + tmp_file_state_p = &(agg_file_view_state_arr[cur_off_proc]); + tmp_mem_state_p = &(my_mem_view_state_arr[cur_off_proc]); + assert(view_state_get_cur_sz(tmp_file_state_p, i) - act_reg_sz >= + view_state_get_cur_sz(tmp_mem_state_p, i)); + while (view_state_get_cur_sz(tmp_file_state_p, i) - act_reg_sz != + view_state_get_cur_sz(tmp_mem_state_p, i)) + { + ADIO_Offset fill_st_reg = -1, fill_reg_sz = -1; + view_state_add_region( + view_state_get_cur_sz(tmp_file_state_p, i) - act_reg_sz - + view_state_get_cur_sz(tmp_mem_state_p, i), + tmp_mem_state_p, + &fill_st_reg, + &fill_reg_sz, i); + } + + /* Based on how large the act_reg_sz 1. Figure out how + * many memory offset-length pairs are necessary. 2. Set + * the offset-length pairs. */ + tmp_reg_sz = 0; + while (tmp_reg_sz != act_reg_sz) + { + view_state_add_region( + act_reg_sz - tmp_reg_sz, + tmp_mem_state_p, + &agg_mem_st_reg, &agg_mem_act_reg_sz, + i); + tmp_reg_sz += agg_mem_act_reg_sz; + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_reqs: Mem region %s" + "(proc=%d,off=%Ld,sz=%Ld)\n", + off_type_name[i], cur_off_proc, + agg_mem_st_reg, agg_mem_act_reg_sz); +#endif + agg_comm_cur_sz_arr[cur_off_proc] += agg_mem_act_reg_sz; + cur_total_agg_comm_sz += agg_mem_act_reg_sz; + switch(i) + { + case TEMP_OFF: + /* Increment the ol list count a particular + * aggregator if next region is not adjacent + * to the previous region. */ + if (agg_mem_next_off_arr[cur_off_proc] != + agg_mem_st_reg) + { + agg_ol_ct_arr[cur_off_proc]++; + } + agg_mem_next_off_arr[cur_off_proc] = + agg_mem_st_reg + agg_mem_act_reg_sz; + break; + case REAL_OFF: + /* Set the ol list for the memtypes that will + * map to each aggregator, coaslescing if + * possible. */ + agg_next_off_idx = agg_ol_cur_ct_arr[cur_off_proc]; + if (agg_mem_next_off_arr[cur_off_proc] != + agg_mem_st_reg) + { + agg_disp_arr[cur_off_proc][agg_next_off_idx] = + agg_mem_st_reg; + agg_blk_arr[cur_off_proc][agg_next_off_idx] = + agg_mem_act_reg_sz; + (agg_ol_cur_ct_arr[cur_off_proc])++; + } + else + { + agg_blk_arr[cur_off_proc][agg_next_off_idx - 1] + += agg_mem_act_reg_sz; + } + agg_mem_next_off_arr[cur_off_proc] = + agg_mem_st_reg + agg_mem_act_reg_sz; + break; + default: + fprintf(stderr, "ADIOI_Build_client_reqs: " + "Impossible type\n"); + } + } + } + + /* On the first pass, allocate the memory structures for + * creating the MPI_hindexed type. */ + if (i == TEMP_OFF) + { + /* Allocate offset-length pairs for creating hindexed + * MPI_Datatypes for each aggregator */ + if ((agg_disp_arr = (MPI_Aint **) + ADIOI_Malloc(nprocs*sizeof(MPI_Aint *))) == NULL) + { + fprintf(stderr, + "ADIOI_Build_client_reqs: malloc agg_disp_arr failed\n"); + return -1; + } + if ((agg_blk_arr = (int **) ADIOI_Malloc(nprocs*sizeof(int *))) + == NULL) + { + ADIOI_Free(agg_disp_arr); + fprintf(stderr, + "ADIOI_Build_client_reqs: malloc agg_blk_arr failed\n"); + return -1; + } + for (j = 0; j < nprocs; j++) + { + if ((agg_disp_arr[j] = (MPI_Aint *) + ADIOI_Malloc(agg_ol_ct_arr[j]*sizeof(MPI_Aint))) == NULL) + { + fprintf(stderr, "ADIOI_Build_client_reqs: malloc " + "agg_disp_arr[%d] failed\n", j); + return -1; + } + if ((agg_blk_arr[j] = (int *) + ADIOI_Malloc(agg_ol_ct_arr[j]*sizeof(int))) == NULL) + { + ADIOI_Free(agg_disp_arr[j]); + fprintf(stderr, "ADIOI_Build_client_reqs: malloc " + "agg_blk_arr[%d] failed\n", j); + return -1; + } + } + } + } + +#ifdef DEBUG + fprintf(stderr, "ADIOI_Build_client_reqs:(agg,cur_ol_count=ol_count)="); + for (i = 0; i < nprocs; i++) + { + int tmp_agg_idx = ADIOI_Agg_idx(i, fd); + if (tmp_agg_idx >= 0) + { + fprintf(stderr, "(%d,%d=%d)", i, agg_ol_cur_ct_arr[i], + agg_ol_ct_arr[i]); + assert(agg_ol_ct_arr[i] == agg_ol_cur_ct_arr[i]); + if (tmp_agg_idx != fd->hints->cb_nodes - 1) + fprintf(stderr, ","); + } + } + fprintf(stderr, "\n"); +#endif + +#ifdef DEBUG2 + for (i = 0; i < nprocs; i++) + { + if (agg_ol_ct_arr[i] > 0) + { + fprintf(stderr, "ADIOI_Build_client_reqs: p %d (off,len) = ", i); + for (j = 0; j < agg_ol_ct_arr[i]; j++) + { + fprintf(stderr, "[%d](%d,%d) ", j, + agg_disp_arr[i][j], + agg_blk_arr[i][j]); + } + fprintf(stderr, "\n"); + } + } +#endif + + /* Create all the aggregator MPI_Datatypes */ + for (i = 0; i < nprocs; i++) + { + if (agg_comm_sz_arr[i] > 0) + { + MPI_Type_hindexed(agg_ol_ct_arr[i], agg_blk_arr[i], + agg_disp_arr[i], MPI_BYTE, + &(agg_comm_dtype_arr[i])); + MPI_Type_commit(&(agg_comm_dtype_arr[i])); + } + else + { + agg_comm_dtype_arr[i] = MPI_BYTE; + } + ADIOI_Free(agg_blk_arr[i]); + ADIOI_Free(agg_disp_arr[i]); + } + ADIOI_Free(agg_blk_arr); + ADIOI_Free(agg_disp_arr); + + ADIOI_Free(agg_mem_next_off_arr); + ADIOI_Free(agg_comm_cur_sz_arr); + ADIOI_Free(agg_ol_ct_arr); + ADIOI_Free(agg_ol_cur_ct_arr); +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5019, 0, NULL); +#endif + return 0; +} +/* ADIOI_Build_client_pre_req allows a client to calculate the memtype + * offset-length pairs up (up to a limit - max_pre_req_sz or max + * ol_ct). It basically allows ADIOI_Build_client_req to do less work. + * If it called and there already exist some preprocessed memtype + * offset-length pairs, it will exit immediately if a limit has been + * reached or if will add on the old limites to reach the new + * limits. */ + +int ADIOI_Build_client_pre_req(ADIO_File fd, + int agg_rank, int agg_idx, + view_state *my_mem_view_state_p, + view_state *agg_file_view_state_p, + ADIO_Offset max_pre_req_sz, + int max_ol_ct) +{ + ADIO_Offset act_reg_sz = 0, tmp_reg_sz = 0; + ADIO_Offset cur_off = -1, cur_reg_max_len = -1; + ADIO_Offset agg_mem_st_reg = 0, agg_mem_act_reg_sz = 0; + int agg_ol_ct = 0, agg_ol_cur_ct = 0; + int i, agg_next_off_idx = -1; + + ADIO_Offset cur_sz = 0, max_sz = 0, agg_mem_next_off = -1; + ADIO_Offset fill_st_reg = -1, fill_reg_sz = -1; + ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; + MPI_Datatype *fr_type_arr = fd->file_realm_types; + MPI_Aint *tmp_disp_arr = NULL; + int *tmp_blk_arr = NULL, exit_loop = -1; + flatten_state *tmp_mem_state_p = NULL, *tmp_file_state_p = NULL; +#ifdef DTYPE_SKIP + int skip_type_ct; +#endif + if (agg_idx < 0 || agg_idx >= fd->hints->cb_nodes) + { + fprintf(stderr, "ADIOI_Build_client_pre_req: Invalid agg_idx %d\n", + agg_idx); + return -1; + } + + if (agg_file_view_state_p->cur_state.cur_sz == + agg_file_view_state_p->sz || max_pre_req_sz <= 0 || + max_ol_ct <= 0) + { +#ifdef DEBUG1 + fprintf(stderr, + "ADIOI_Build_client_pre_req: Nothing to preprocess\n"); +#endif + return 0; + } + + /* The new limits have already been surpassed by what already + * exists. Otherwise we will use the next restrictions */ + if ((my_mem_view_state_p->pre_sz >= max_pre_req_sz) || + (my_mem_view_state_p->pre_ol_ct >= max_ol_ct)) + { +#ifdef DEBUG1 + fprintf(stderr, + "ADIOI_Build_client_pre_req: Old values surpass new " + "pre_req values\n"); +#endif + return 0; + } + + /* General idea is to first advance the filetype to the file realm + * and then the memtype to the filetype. The memtype is advanced + * further by peeking at the filetype and then the filetype is + * advanced. */ + for (i = 0; i < MAX_OFF_TYPE; i++) + { + switch(i) + { + case TEMP_OFF: + tmp_mem_state_p = &(my_mem_view_state_p->tmp_state); + tmp_file_state_p = &(agg_file_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_mem_state_p = &(my_mem_view_state_p->cur_state); + tmp_file_state_p = &(agg_file_view_state_p->cur_state); + break; + default: + fprintf(stderr, "ADIOI_Build_client_pre_req: " + "Invalid off type %d\n", i); + } + + if (i == TEMP_OFF && my_mem_view_state_p->pre_sz > 0) + { + cur_sz = my_mem_view_state_p->pre_sz; + agg_ol_ct = my_mem_view_state_p->pre_ol_ct; + /* Save the old arrays */ + tmp_disp_arr = my_mem_view_state_p->pre_disp_arr; + tmp_blk_arr = my_mem_view_state_p->pre_blk_arr; + my_mem_view_state_p->pre_disp_arr = NULL; + my_mem_view_state_p->pre_blk_arr = NULL; + agg_mem_next_off = + tmp_disp_arr[agg_ol_ct - 1] + tmp_blk_arr[agg_ol_ct - 1]; + } + else if (i == REAL_OFF && my_mem_view_state_p->pre_sz > 0) + { + cur_sz = my_mem_view_state_p->pre_sz; + agg_ol_cur_ct = my_mem_view_state_p->pre_ol_ct; + + /* Copy the old data to the new data, freeing the old + * arrays */ + memcpy(my_mem_view_state_p->pre_disp_arr, tmp_disp_arr, + my_mem_view_state_p->pre_ol_ct * sizeof(MPI_Aint)); + memcpy(my_mem_view_state_p->pre_blk_arr, tmp_blk_arr, + my_mem_view_state_p->pre_ol_ct * sizeof(int)); + + ADIOI_Free(tmp_disp_arr); + ADIOI_Free(tmp_blk_arr); + + agg_mem_next_off = + my_mem_view_state_p->pre_disp_arr[agg_ol_cur_ct - 1] + + my_mem_view_state_p->pre_blk_arr[agg_ol_cur_ct - 1]; + } + else + { + cur_sz = 0; + } + + /* Max_pre_req_sz may be larger than the amount of data left + * to preprocess */ + if (max_pre_req_sz - cur_sz > + agg_file_view_state_p->sz - tmp_file_state_p->cur_sz) + { + max_sz = cur_sz + + agg_file_view_state_p->sz - tmp_file_state_p->cur_sz; + } + else + max_sz = max_pre_req_sz; + + assert(cur_sz != max_sz); +#ifdef DEBUG1 + fprintf(stderr, + "ADIOI_Build_client_pre_req: (cur_sz=%Ld,agg_ol_ct=%d," + "agg_mem_next_off=%Ld,max_sz=%Ld,max_ol_ct=%d)\n", + cur_sz, agg_ol_ct, agg_mem_next_off, max_sz, max_ol_ct); +#endif + while (cur_sz < max_sz) + { + find_next_off(fd, agg_file_view_state_p, + fr_st_off_arr[agg_rank], + &(fr_type_arr[agg_rank]), + i, + &cur_off, + &cur_reg_max_len); + + /* find_next_off may show that the file_view_state is done + * even if cur_sz != max_sz since find_next_off may + * advance the file_view_state to the end here and realize + * that it is done. */ + if (cur_off == -1) + break; + + assert(cur_off != -1); + + /* Before translating the file regions to memory regions, + * we first must advance to the proper point in the + * mem_view_state for this aggregator to match the + * file_view_state. */ + while (tmp_file_state_p->cur_sz != tmp_mem_state_p->cur_sz) + { +#ifdef DTYPE_SKIP + if (my_mem_view_state_p->flat_type_p->count > 1) { + /* let's see if we can skip whole memory datatypes */ + skip_type_ct = + (tmp_file_state_p->cur_sz - tmp_mem_state_p->cur_sz) / + my_mem_view_state_p->type_sz; + if (skip_type_ct > 0) { + tmp_mem_state_p->cur_sz += + skip_type_ct * my_mem_view_state_p->type_sz; + tmp_mem_state_p->abs_off += + skip_type_ct * my_mem_view_state_p->ext; + if (tmp_mem_state_p->cur_sz == + tmp_file_state_p->cur_sz) + break; + } + } +#endif + view_state_add_region( + tmp_file_state_p->cur_sz - tmp_mem_state_p->cur_sz, + my_mem_view_state_p, + &fill_st_reg, + &fill_reg_sz, i); + } + + /* Now that the filetype and memtype are advanced to the + * same position, add memtype ol-pairs while we have not + * overstepped the min(end of the current piece in the + * file view, end of the file realm, data left in + * max_sz) */ + + if (cur_reg_max_len > + view_state_get_next_len(agg_file_view_state_p, i)) + cur_reg_max_len = + view_state_get_next_len(agg_file_view_state_p, i); + + if (cur_reg_max_len > max_sz - cur_sz) + cur_reg_max_len = max_sz - cur_sz; + + assert(cur_reg_max_len > 0); + + /* Add memtype ol pairs while we have not passed + * cur_reg_max_len or the max number of ol pairs + * allowed */ + act_reg_sz = 0; + exit_loop = 0; + while ((act_reg_sz < cur_reg_max_len) && + (exit_loop == 0)) + { + view_state_add_region( + cur_reg_max_len - act_reg_sz, + my_mem_view_state_p, + &agg_mem_st_reg, &agg_mem_act_reg_sz, + i); + act_reg_sz += agg_mem_act_reg_sz; + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_pre_req: %s Mem region" + "(proc=%d,off=%Ld,sz=%Ld)\n", + off_type_name[i], agg_rank, agg_mem_st_reg, + agg_mem_act_reg_sz); +#endif + switch(i) + { + case TEMP_OFF: + /* Increment the ol list count if the next + * region is not adjacent to the previous + * region. */ + if (agg_mem_next_off != agg_mem_st_reg) + { + agg_ol_ct++; + if (agg_ol_ct == max_ol_ct) + exit_loop = 1; + } + agg_mem_next_off = + agg_mem_st_reg + agg_mem_act_reg_sz; + break; + case REAL_OFF: + /* Set the ol list for the memtype that + * will map to our aggregator, coaslescing + * if possible. */ + agg_next_off_idx = agg_ol_cur_ct; + if (agg_mem_next_off != agg_mem_st_reg) + { + my_mem_view_state_p-> + pre_disp_arr[agg_next_off_idx] = + agg_mem_st_reg; + my_mem_view_state_p-> + pre_blk_arr[agg_next_off_idx] = + agg_mem_act_reg_sz; + agg_ol_cur_ct++; + if (agg_ol_cur_ct == agg_ol_ct) + exit_loop = 1; + } + else + { + my_mem_view_state_p-> + pre_blk_arr[agg_next_off_idx - 1] + += agg_mem_act_reg_sz; + } + agg_mem_next_off = + agg_mem_st_reg + agg_mem_act_reg_sz; + break; + default: + fprintf(stderr, "ADIOI_Build_client_pre_req: " + "Impossible type\n"); + } + } + + /* Advance the filetype flatten state appropriately to + * match the data advanced in the memtype flatten state. + * Should only take at most a single view_state_add_region + * call since the memtype cannot proceed beyond the end of + * a contig piece in the file type. */ + view_state_add_region(act_reg_sz - tmp_reg_sz, + agg_file_view_state_p, + &fill_st_reg, &fill_reg_sz, i); +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_pre_req: %s File region" + " (proc=%d,off=%Ld,sz=%Ld)\n", + off_type_name[i], agg_rank, fill_st_reg, fill_reg_sz); +#endif + if (fill_reg_sz != act_reg_sz) + { + fprintf(stderr, "ADIOI_Build_client_pre_req: " + "view_state_add_region failed to match the memtype\n"); + return -1; + } + + cur_sz += act_reg_sz; + } + + /* On the first pass, allocate the memory structures for + * storing the preprocessed information */ + if (i == TEMP_OFF) + { + if ((my_mem_view_state_p->pre_disp_arr = (MPI_Aint *) + ADIOI_Malloc(agg_ol_ct * sizeof(MPI_Aint))) == NULL) + { + fprintf(stderr, "ADIOI_Build_client_pre_req: malloc " + "pre_disp_arr of size %ld failed\n", + (long int)agg_ol_ct * sizeof(MPI_Aint)); + return -1; + } + if ((my_mem_view_state_p->pre_blk_arr = (int *) + ADIOI_Malloc(agg_ol_ct * sizeof(int))) == NULL) + { + ADIOI_Free(my_mem_view_state_p->pre_disp_arr); + fprintf(stderr, "ADIOI_Build_client_pre_req: malloc " + "agg_blk_arr of size %ld failed\n", + (long int)agg_ol_ct * sizeof(int)); + return -1; + } + } + } + + my_mem_view_state_p->pre_sz = cur_sz; + my_mem_view_state_p->pre_ol_ct = agg_ol_ct; + +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_client_pre_req:(agg=%d,cur_ol_count=%d" + "=ol_count=%d)\n", + agg_rank, my_mem_view_state_p->pre_ol_ct, agg_ol_ct); +#endif + +#ifdef DEBUG2 + if (agg_ol_ct > 0) + { + fprintf(stderr, "ADIOI_Build_client_pre_req: agg=%d,pre_sz=%Ld " + "(off,len) = \n", agg_rank, my_mem_view_state_p->pre_sz); + for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) + { + fprintf(stderr, "[%d](%d,%d) ", i, + my_mem_view_state_p->pre_disp_arr[i], + my_mem_view_state_p->pre_blk_arr[i]); + if (i % 5 == 0 && i != 0) + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); + } +#endif + + return 0; +} + +/* process_pre_req() allows ADIOI_Build_client_req to use the pre_req + * information. */ + +static int process_pre_req(ADIO_File fd, + int agg_rank, + int agg_idx, + view_state *my_mem_view_state_p, + view_state *agg_file_view_state_p, + ADIO_Offset agg_comm_sz, + int off_type, + MPI_Aint *agg_disp_arr, + int *agg_blk_arr, + ADIO_Offset *agg_comm_pre_sz_p, + ADIO_Offset *agg_comm_cur_sz_p, + ADIO_Offset *agg_comm_sz_p, + int *agg_ol_cur_ct_p, + int *agg_ol_ct_p, + ADIO_Offset *agg_mem_next_off_p) +{ + int i, has_partial = 0; + MPI_Aint partial_disp = 0; + int partial_len = 0; + ADIO_Offset tmp_agg_comm_pre_sz = 0; + + assert (my_mem_view_state_p->pre_sz > 0); + switch(off_type) + { + case TEMP_OFF: + /* Use only some of the precalculated data */ + if (my_mem_view_state_p->pre_sz > *agg_comm_sz_p) + { + for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) + { + if ((my_mem_view_state_p->pre_blk_arr[i] + + *agg_comm_pre_sz_p) > *agg_comm_sz_p) + { + has_partial = 1; + partial_len = *agg_comm_sz_p - *agg_comm_pre_sz_p; + *agg_comm_pre_sz_p = *agg_comm_sz_p; + i++; + break; + } + else if ((my_mem_view_state_p->pre_blk_arr[i] + + *agg_comm_pre_sz_p) == *agg_comm_sz_p) + { + *agg_comm_pre_sz_p += + my_mem_view_state_p->pre_blk_arr[i]; + i++; + break; + } + else + *agg_comm_pre_sz_p += + my_mem_view_state_p->pre_blk_arr[i]; + } + + if (has_partial == 1) + { + *agg_mem_next_off_p = + my_mem_view_state_p->pre_disp_arr[i - 1] + + partial_len; + } + else + { + *agg_mem_next_off_p = + my_mem_view_state_p->pre_disp_arr[i - 1] + + my_mem_view_state_p->pre_blk_arr[i - 1]; + } + + *agg_comm_cur_sz_p = *agg_comm_pre_sz_p; + *agg_ol_ct_p = i; + + } + else /* Use all the precalculated data */ + { + *agg_comm_pre_sz_p = my_mem_view_state_p->pre_sz; + *agg_comm_cur_sz_p = *agg_comm_pre_sz_p; + *agg_ol_ct_p = my_mem_view_state_p->pre_ol_ct; + *agg_mem_next_off_p = + my_mem_view_state_p->pre_disp_arr[ + my_mem_view_state_p->pre_ol_ct - 1] + + my_mem_view_state_p->pre_blk_arr[ + my_mem_view_state_p->pre_ol_ct - 1]; + } +#ifdef DEBUG1 + fprintf(stderr, "process_pre_req: TEMP_OFF " + "agg_comm_pre_sz=%Ld,agg_comm_cur_sz=%Ld,agg_ol_ct=%d\n", + *agg_comm_pre_sz_p, *agg_comm_cur_sz_p, *agg_ol_ct_p); +#endif + assert(*agg_comm_cur_sz_p <= *agg_comm_sz_p); + break; + case REAL_OFF: + /* Set the ol list for the memtype that will map to our + * aggregator, coaslescing if possible. */ + for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) + { + agg_disp_arr[i] = my_mem_view_state_p->pre_disp_arr[i]; + agg_blk_arr[i] = my_mem_view_state_p->pre_blk_arr[i]; + + if ((my_mem_view_state_p->pre_blk_arr[i] + + tmp_agg_comm_pre_sz) > *agg_comm_pre_sz_p) + { + has_partial = 1; + agg_blk_arr[i] = *agg_comm_pre_sz_p - tmp_agg_comm_pre_sz; + tmp_agg_comm_pre_sz = *agg_comm_pre_sz_p; + partial_disp = my_mem_view_state_p->pre_disp_arr[i] + + agg_blk_arr[i]; + partial_len = my_mem_view_state_p->pre_blk_arr[i] - + agg_blk_arr[i]; + i++; + break; + } + else if ((my_mem_view_state_p->pre_blk_arr[i] + + tmp_agg_comm_pre_sz) == *agg_comm_pre_sz_p) + { + tmp_agg_comm_pre_sz += + my_mem_view_state_p->pre_blk_arr[i]; + i++; + break; + } + else + tmp_agg_comm_pre_sz += + my_mem_view_state_p->pre_blk_arr[i]; + } + *agg_mem_next_off_p = agg_disp_arr[i - 1] + agg_blk_arr[i - 1]; + *agg_ol_cur_ct_p = i; + *agg_comm_cur_sz_p = *agg_comm_pre_sz_p; + + /* Clean up the ol pairs we used */ + if ((i < my_mem_view_state_p->pre_ol_ct) || (has_partial == 1)) + { + int remain_ol_ct = + my_mem_view_state_p->pre_ol_ct - i + has_partial; + MPI_Aint *new_pre_disp_arr = NULL; + int *new_pre_blk_arr = NULL; + + if ((new_pre_disp_arr = (MPI_Aint *) + ADIOI_Malloc(remain_ol_ct * sizeof(MPI_Aint))) == NULL) + { + fprintf(stderr, "process_pre_req: malloc " + "new_pre_disp_arr failed\n"); + return -1; + } + if ((new_pre_blk_arr = (int *) + ADIOI_Malloc(remain_ol_ct * sizeof(int))) == NULL) + { + fprintf(stderr, "process_pre_req: malloc " + "new_pre_blk_arr failed\n"); + return -1; + } + + memcpy(new_pre_disp_arr, + &(my_mem_view_state_p->pre_disp_arr[i - has_partial]), + remain_ol_ct * sizeof(MPI_Aint)); + memcpy(new_pre_blk_arr, + &(my_mem_view_state_p->pre_blk_arr[i - has_partial]), + remain_ol_ct * sizeof(int)); + + /* Set the partial len of the first piece */ + if (has_partial == 1) + { + /* new_pre_disp_arr[remain_ol_ct - 1] = partial_disp; + new_pre_blk_arr[remain_ol_ct - 1] = partial_len; */ + new_pre_disp_arr[0] = partial_disp; + new_pre_blk_arr[0] = partial_len; + } + + ADIOI_Free(my_mem_view_state_p->pre_disp_arr); + ADIOI_Free(my_mem_view_state_p->pre_blk_arr); + + my_mem_view_state_p->pre_disp_arr = new_pre_disp_arr; + my_mem_view_state_p->pre_blk_arr = new_pre_blk_arr; + my_mem_view_state_p->pre_ol_ct = remain_ol_ct; + my_mem_view_state_p->pre_sz -= *agg_comm_pre_sz_p; + } + else /* Used all the precalculated ol pairs */ + { + ADIOI_Free(my_mem_view_state_p->pre_disp_arr); + ADIOI_Free(my_mem_view_state_p->pre_blk_arr); + + my_mem_view_state_p->pre_disp_arr = NULL; + my_mem_view_state_p->pre_blk_arr = NULL; + my_mem_view_state_p->pre_ol_ct = 0; + my_mem_view_state_p->pre_sz = 0; + } +#ifdef DEBUG1 + fprintf(stderr, "process_pre_req: REAL_OFF " + "agg_comm_pre_sz=%Ld,agg_comm_cur_sz=%Ld,agg_ol_ct=%d," + "agg_ol_cur_ct=%d\n", + *agg_comm_pre_sz_p, *agg_comm_cur_sz_p, *agg_ol_ct_p, + *agg_ol_cur_ct_p); +#endif + break; + default: + fprintf(stderr, "process_pre_req: Invalid off_type %d\n", + off_type); + } + return 0; +} + +/* ADIOI_Build_client_req() creates a memory datatype to transfer data + * to/from a particular aggregator. */ + +int ADIOI_Build_client_req(ADIO_File fd, + int agg_rank, + int agg_idx, + view_state *my_mem_view_state_p, + view_state *agg_file_view_state_p, + ADIO_Offset agg_comm_sz, + MPI_Datatype *agg_comm_dtype_p) +{ + MPI_Aint *agg_disp_arr = NULL; + int *agg_blk_arr = NULL; + ADIO_Offset st_reg = 0, act_reg_sz = 0, tmp_reg_sz = 0; + ADIO_Offset cur_off = -1, cur_reg_max_len = -1; + ADIO_Offset agg_mem_st_reg = 0, agg_mem_act_reg_sz = 0; + int agg_ol_ct = 0, agg_ol_cur_ct = 0; + int i = 0, agg_next_off_idx = -1; + ADIO_Offset agg_mem_next_off = 0, agg_comm_cur_sz = 0, agg_comm_pre_sz = 0; + ADIO_Offset *fr_st_off_arr = fd->file_realm_st_offs; + MPI_Datatype *fr_type_arr = fd->file_realm_types; + flatten_state *tmp_mem_state_p = NULL, *tmp_file_state_p = NULL; +#ifdef DTYPE_SKIP + int skip_type_ct; +#endif + + if (agg_idx < 0 || agg_idx >= fd->hints->cb_nodes) + { +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_client_req: agg_rank %d does not map " + "to a valid node in cb_node\n", agg_rank); +#endif + return 0; + } + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5018, 0, NULL); +#endif + +#ifdef DEBUG1 + fprintf(stderr, "ADIOI_Build_client_req:(agg=%d,size_req=%Ld)\n", + agg_idx, agg_comm_sz); +#endif + + /* On the first pass see how many offset-length pairs are + * necessary for each aggregator. Then allocate the correct + * amount of offset-length pairs for handling each aggregator's + * particular data size. On the last pass, we actually create the + * offset-length pairs. */ + for (i = 0; i < MAX_OFF_TYPE; i++) + { + switch(i) + { + case TEMP_OFF: + tmp_mem_state_p = &(my_mem_view_state_p->tmp_state); + tmp_file_state_p = &(agg_file_view_state_p->tmp_state); + break; + case REAL_OFF: + tmp_mem_state_p = &(my_mem_view_state_p->cur_state); + tmp_file_state_p = &(agg_file_view_state_p->cur_state); + break; + default: + fprintf(stderr, "ADIOI_Build_client_pre_req: " + "Invalid off type %d\n", i); + } + + agg_comm_cur_sz = 0; + agg_mem_next_off = -1; + + /* First try to preprocess anything we can */ + if (my_mem_view_state_p->pre_sz > 0) + { + process_pre_req(fd, + agg_rank, + agg_idx, + my_mem_view_state_p, + agg_file_view_state_p, + agg_comm_sz, + i, + agg_disp_arr, + agg_blk_arr, + &agg_comm_pre_sz, + &agg_comm_cur_sz, + &agg_comm_sz, + &agg_ol_cur_ct, + &agg_ol_ct, + &agg_mem_next_off); + } + + while (agg_comm_cur_sz < agg_comm_sz) + { + find_next_off(fd, agg_file_view_state_p, + fr_st_off_arr[agg_idx], + &(fr_type_arr[agg_idx]), + i, + &cur_off, + &cur_reg_max_len); + + assert(cur_off != -1); + + /* Add up to the end of the file realm or as many bytes + * are left for this particular aggregator in the client's + * filetype */ + if (cur_reg_max_len > (agg_comm_sz - agg_comm_cur_sz)) + { + cur_reg_max_len = agg_comm_sz - agg_comm_cur_sz; + } + assert(cur_reg_max_len > 0); + + view_state_add_region( + cur_reg_max_len, + agg_file_view_state_p, + &st_reg, &act_reg_sz, i); + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_req: %s File region" + " (proc=%d,off=%Ld,sz=%Ld)\n", + off_type_name[i], agg_rank, cur_off, act_reg_sz); +#endif + + /* Before translating the file regions to memory regions, + * we first must advance to the proper point in the + * mem_view_state for this aggregator to match the + * file_view_state. */ + + assert(tmp_file_state_p->cur_sz - act_reg_sz >= + tmp_mem_state_p->cur_sz); + + while (tmp_file_state_p->cur_sz - act_reg_sz != + tmp_mem_state_p->cur_sz) + { + ADIO_Offset fill_st_reg = -1, fill_reg_sz = -1; +#ifdef DTYPE_SKIP + if (my_mem_view_state_p->flat_type_p->count > 1) { + /* let's see if we can skip whole memory datatypes */ + skip_type_ct = + (tmp_file_state_p->cur_sz - act_reg_sz - + tmp_mem_state_p->cur_sz) / + my_mem_view_state_p->type_sz; + if (skip_type_ct > 0) { + tmp_mem_state_p->cur_sz += + skip_type_ct * my_mem_view_state_p->type_sz; + tmp_mem_state_p->abs_off += + skip_type_ct * my_mem_view_state_p->ext; + if ((tmp_mem_state_p->cur_sz - act_reg_sz) == + tmp_file_state_p->cur_sz) + break; + } + } +#endif + view_state_add_region( + tmp_file_state_p->cur_sz - + act_reg_sz - tmp_mem_state_p->cur_sz, + my_mem_view_state_p, + &fill_st_reg, + &fill_reg_sz, i); + } + + /* Based on how large the act_reg_sz is, first figure + * out how many memory offset-length pairs are + * necessary and then set the offset-length pairs. */ + tmp_reg_sz = 0; + while (tmp_reg_sz != act_reg_sz) + { + view_state_add_region( + act_reg_sz - tmp_reg_sz, + my_mem_view_state_p, + &agg_mem_st_reg, &agg_mem_act_reg_sz, + i); + tmp_reg_sz += agg_mem_act_reg_sz; + +#ifdef DEBUG2 + fprintf(stderr, "ADIOI_Build_client_req: %s Mem region" + "(off=%Ld,sz=%Ld)\n", + off_type_name[i], agg_mem_st_reg, + agg_mem_act_reg_sz); +#endif + agg_comm_cur_sz += agg_mem_act_reg_sz; + switch(i) + { + case TEMP_OFF: + /* Increment the ol list count if the next + * region is not adjacent to the previous + * region. */ + if (agg_mem_next_off != agg_mem_st_reg) + { + agg_ol_ct++; + } + agg_mem_next_off = + agg_mem_st_reg + agg_mem_act_reg_sz; + break; + case REAL_OFF: + /* Set the ol list for the memtype that + * will map to our aggregator, coaslescing + * if possible. */ + agg_next_off_idx = agg_ol_cur_ct; + if (agg_mem_next_off != agg_mem_st_reg) + { + agg_disp_arr[agg_next_off_idx] = + agg_mem_st_reg; + agg_blk_arr[agg_next_off_idx] = + agg_mem_act_reg_sz; + agg_ol_cur_ct++; + } + else + { + agg_blk_arr[agg_next_off_idx - 1] + += agg_mem_act_reg_sz; + } + agg_mem_next_off = + agg_mem_st_reg + agg_mem_act_reg_sz; + break; + default: + fprintf(stderr, "ADIOI_Build_client_req: " + "Impossible type\n"); + } + } + } + + /* On the first pass, allocate the memory structures for + * creating the MPI_hindexed type. */ + if (i == TEMP_OFF) + { + /* Allocate offset-length pairs for creating hindexed + * MPI_Datatypes for each aggregator */ + if ((agg_disp_arr = (MPI_Aint *) + ADIOI_Malloc(agg_ol_ct * sizeof(MPI_Aint))) == NULL) + { + fprintf(stderr, "ADIOI_Build_client_req: malloc " + "agg_disp_arr of size %ld failed\n", + (long int)agg_ol_ct * sizeof(MPI_Aint)); + return -1; + } + if ((agg_blk_arr = (int *) + ADIOI_Malloc(agg_ol_ct * sizeof(int))) == NULL) + { + ADIOI_Free(agg_disp_arr); + fprintf(stderr, "ADIOI_Build_client_req: malloc " + "agg_blk_arr of size %ld failed\n", + (long int)agg_ol_ct * sizeof(int)); + return -1; + } + } + } + + assert(agg_ol_ct == agg_ol_cur_ct); +#ifdef DEBUG1 + fprintf(stderr, + "ADIOI_Build_client_req:(agg=%d,cur_ol_count=%d=ol_count=%d)\n", + agg_rank, agg_ol_cur_ct, agg_ol_ct); +#endif + +#ifdef DEBUG2 + if (agg_ol_ct > 0) + { + fprintf(stderr, "ADIOI_Build_client_req: p %d (off,len) = ", agg_rank); + for (i = 0; i < agg_ol_ct; i++) + { + fprintf(stderr, "[%d](%d,%d) ", i, + agg_disp_arr[i], agg_blk_arr[i]); + if (i % 5 == 0 && i != 0) + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); + } +#endif +#ifdef DEBUG1 + fprintf(stderr, + "ADIOI_Build_client_req:(agg=%d,pre_ol_count=%d)\n", + agg_idx, my_mem_view_state_p->pre_ol_ct); +#endif + +#ifdef DEBUG2 + if (my_mem_view_state_p->pre_sz > 0) + { + fprintf(stderr, "ADIOI_Build_client_req: p %d pre(off,len) = ", + agg_idx); + for (i = 0; i < my_mem_view_state_p->pre_ol_ct; i++) + { + fprintf(stderr, "[%d](%d,%d) ", i, + my_mem_view_state_p->pre_disp_arr[i], + my_mem_view_state_p->pre_blk_arr[i]); + if (i % 5 == 0 && i != 0) + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); + } +#endif + + /* Create the aggregator MPI_Datatype */ + if (agg_comm_sz > 0) + { + MPI_Type_hindexed(agg_ol_ct, agg_blk_arr, agg_disp_arr, MPI_BYTE, + agg_comm_dtype_p); + MPI_Type_commit(agg_comm_dtype_p); + } + else + { + *agg_comm_dtype_p = MPI_BYTE; + } + + ADIOI_Free(agg_blk_arr); + ADIOI_Free(agg_disp_arr); + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5019, 0, NULL); +#endif + return 0; +} + + diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_coll_exch_new.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_coll_exch_new.c new file mode 100644 index 0000000000..dd04ab7929 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_coll_exch_new.c @@ -0,0 +1,510 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include +#include "adio.h" +#include "adio_extern.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +/* +#define DEBUG +#define DEBUG2 +*/ + +#define COUNT_EXCH 0 +#define BLOCK_LENS 1 +#define INDICES 2 +#define FPIND_DISP_OFF_SZ 3 + + +typedef struct { + int count; + ADIO_Offset fp_ind; + ADIO_Offset disp; + ADIO_Offset byte_off; + ADIO_Offset sz; + ADIO_Offset ext; + ADIO_Offset type_sz; +} amount_and_extra_data_t; + +/* Debugging function to print out an ADIOI_Flatlist_node. */ +void ADIOI_Print_flatlist_node(ADIOI_Flatlist_node *flatlist_node_p) +{ + int i; + if (flatlist_node_p == NULL) + { + fprintf(stderr, "print flatlist node of NULL ptr\n"); + return; + } + fprintf(stderr, "print flatlist node count = %d (idx,blocklen)\n", + flatlist_node_p->count); + for (i = 0; i < flatlist_node_p->count; i++) + { + if (i % 5 == 0 && i != 0) + { + fprintf(stderr, "%d=(%Ld,%Ld)\n", i, flatlist_node_p->indices[i], + flatlist_node_p->blocklens[i]); + } + else + fprintf(stderr, "%d=(%Ld,%Ld) ", i, flatlist_node_p->indices[i], + flatlist_node_p->blocklens[i]); + } + fprintf(stderr, "\n"); +} + +/* Since ADIOI_Flatten_datatype won't add a contig datatype to the + * ADIOI_Flatlist, we can force it to do so with this function. */ +ADIOI_Flatlist_node * ADIOI_Add_contig_flattened(MPI_Datatype contig_type) +{ + int contig_type_sz = -1; + ADIOI_Flatlist_node *flat_node_p = CtvAccess(ADIOI_Flatlist); + + /* Add contig type to the end of the list if it doesn't already + * exist. */ + while (flat_node_p->next) + { + if (flat_node_p->type == contig_type) + return flat_node_p; + flat_node_p = flat_node_p->next; + } + if (flat_node_p->type == contig_type) + return flat_node_p; + + MPI_Type_size(contig_type, &contig_type_sz); + if ((flat_node_p->next = (ADIOI_Flatlist_node *) ADIOI_Malloc + (sizeof(ADIOI_Flatlist_node))) == NULL) + { + fprintf(stderr, "ADIOI_Add_contig_flattened: malloc next failed\n"); + } + flat_node_p = flat_node_p->next; + flat_node_p->type = contig_type; + if ((flat_node_p->blocklens = (ADIO_Offset *) ADIOI_Malloc(sizeof(ADIO_Offset))) == NULL) + { + fprintf(stderr, "ADIOI_Flatlist_node: malloc blocklens failed\n"); + } + if ((flat_node_p->indices = (ADIO_Offset *) + ADIOI_Malloc(sizeof(ADIO_Offset))) == NULL) + { + fprintf(stderr, "ADIOI_Flatlist_node: malloc indices failed\n"); + } + flat_node_p->blocklens[0] = contig_type_sz; + flat_node_p->indices[0] = 0; + flat_node_p->count = 1; + flat_node_p->next = NULL; + return flat_node_p; +} + +/* ADIOI_Exchange_file_views - Sends all the aggregators the file + * views and file view states of the clients. It fills in the + * client_file_view_state_arr for the aggregators and the + * my_mem_view_state for the client. It also initializes the + * agg_file_view_state for all clients, which is the view for each + * aggregator of a client's filetype. */ +void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type, + ADIO_File fd, int count, + MPI_Datatype datatype, ADIO_Offset off, + view_state *my_mem_view_state_arr, + view_state *agg_file_view_state_arr, + view_state *client_file_view_state_arr) +{ + /* Convert my own fileview to an ADIOI_Flattened type and a + * disp. MPI_Alltoall the count of ADIOI_Flatlist nodes. + * MPI_Isend/Irecv the block_lens, indices of ADIOI_Flatlist node + * to/from each of the aggregators with the rest of the file view + * state. */ + + int i = -1, j = -1; + amount_and_extra_data_t *send_count_arr = NULL; + amount_and_extra_data_t *recv_count_arr = NULL; + int send_req_arr_sz = 0; + int recv_req_arr_sz = 0; + MPI_Request *send_req_arr = NULL, *recv_req_arr = NULL; + MPI_Status *statuses = NULL; + ADIO_Offset disp_off_sz_ext_typesz[6]; + MPI_Aint memtype_extent, filetype_extent; + int ret = -1; + + /* parameters for datatypes */ + ADIOI_Flatlist_node *flat_mem_p = NULL, *flat_file_p = NULL; + int memtype_sz = -1; + int memtype_is_contig = -1, filetype_is_contig = -1; + int filetype_sz = -1; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5014, 0, NULL); +#endif + /* The memtype will be freed after the call. The filetype will be + * freed in the close and should have been flattened in the file + * view. */ + MPI_Type_size(datatype, &memtype_sz); + MPI_Type_extent(datatype, &memtype_extent); + if (memtype_sz == memtype_extent) { + memtype_is_contig = 1; + flat_mem_p = ADIOI_Add_contig_flattened(datatype); + flat_mem_p->blocklens[0] = memtype_sz*count; + } + else { + ADIOI_Flatten_datatype(datatype); + flat_mem_p = CtvAccess(ADIOI_Flatlist); + while (flat_mem_p->type != datatype) + flat_mem_p = flat_mem_p->next; + } + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(fd->filetype, &filetype_sz); + if (filetype_extent == filetype_sz) { + filetype_is_contig = 1; + flat_file_p = ADIOI_Add_contig_flattened(fd->filetype); + flat_file_p->blocklens[0] = memtype_sz*count; + filetype_extent = memtype_sz*count; + filetype_sz = filetype_extent; + } + else { + flat_file_p = CtvAccess(ADIOI_Flatlist); + while (flat_file_p->type != fd->filetype) + flat_file_p = flat_file_p->next; + } + + disp_off_sz_ext_typesz[0] = fd->fp_ind; + disp_off_sz_ext_typesz[1] = fd->disp; + disp_off_sz_ext_typesz[2] = off; + disp_off_sz_ext_typesz[3] = memtype_sz*count; + disp_off_sz_ext_typesz[4] = (ADIO_Offset) filetype_extent; + disp_off_sz_ext_typesz[5] = (ADIO_Offset) filetype_sz; + + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + recv_count_arr = ADIOI_Calloc(nprocs, sizeof(amount_and_extra_data_t)); + send_count_arr = ADIOI_Calloc(nprocs, sizeof(amount_and_extra_data_t)); + } else { + send_count_arr = ADIOI_Calloc(fd->hints->cb_nodes, + sizeof(amount_and_extra_data_t)); + + /* only aggregators receive data */ + if (fd->is_agg) { + recv_count_arr = ADIOI_Calloc(nprocs, + sizeof(amount_and_extra_data_t)); + recv_req_arr = ADIOI_Malloc (nprocs * sizeof(MPI_Request)); + for (i=0; i < nprocs; i++) + MPI_Irecv (&recv_count_arr[i], sizeof(amount_and_extra_data_t), + MPI_BYTE, i, COUNT_EXCH, fd->comm, &recv_req_arr[i]); + } + + /* only send data to aggregators */ + send_req_arr = ADIOI_Calloc (fd->hints->cb_nodes, sizeof(MPI_Request)); + for (i=0; i < fd->hints->cb_nodes; i++) { + send_count_arr[i].count = flat_file_p->count; + send_count_arr[i].fp_ind = disp_off_sz_ext_typesz[0]; + send_count_arr[i].disp = disp_off_sz_ext_typesz[1]; + send_count_arr[i].byte_off = disp_off_sz_ext_typesz[2]; + send_count_arr[i].sz = disp_off_sz_ext_typesz[3]; + send_count_arr[i].ext = disp_off_sz_ext_typesz[4]; + send_count_arr[i].type_sz = disp_off_sz_ext_typesz[5]; + MPI_Isend (&send_count_arr[i], sizeof(amount_and_extra_data_t), + MPI_BYTE, fd->hints->ranklist[i], COUNT_EXCH, fd->comm, + &send_req_arr[i]); + } + } + + + /* Every client has to build mem and file view_states for each aggregator. + * We initialize their values here. and we also initialize + * send_count_arr */ + + if (memtype_is_contig) { + /* if memory is contigous, we now replace memtype_sz and + * memtype_extent with the full access size */ + memtype_sz *= count; + memtype_extent = memtype_sz; + } + + for (i = 0; i < fd->hints->cb_nodes; i++) + { + int tmp_agg_idx = fd->hints->ranklist[i]; + memset(&(my_mem_view_state_arr[tmp_agg_idx]), 0, sizeof(view_state)); + my_mem_view_state_arr[tmp_agg_idx].sz = + disp_off_sz_ext_typesz[3]; + my_mem_view_state_arr[tmp_agg_idx].ext = + (ADIO_Offset) memtype_extent; + my_mem_view_state_arr[tmp_agg_idx].type_sz = + (ADIO_Offset) memtype_sz; + my_mem_view_state_arr[tmp_agg_idx].flat_type_p = flat_mem_p; + ADIOI_init_view_state(file_ptr_type, + 1, + &(my_mem_view_state_arr[tmp_agg_idx]), + TEMP_OFF); + ADIOI_init_view_state(file_ptr_type, + 1, + &(my_mem_view_state_arr[tmp_agg_idx]), + REAL_OFF); + + memset(&(agg_file_view_state_arr[tmp_agg_idx]), 0, sizeof(view_state)); + agg_file_view_state_arr[tmp_agg_idx].fp_ind = + disp_off_sz_ext_typesz[0]; + agg_file_view_state_arr[tmp_agg_idx].disp = + disp_off_sz_ext_typesz[1]; + agg_file_view_state_arr[tmp_agg_idx].byte_off = + disp_off_sz_ext_typesz[2]; + agg_file_view_state_arr[tmp_agg_idx].sz = + disp_off_sz_ext_typesz[3]; + agg_file_view_state_arr[tmp_agg_idx].ext = + disp_off_sz_ext_typesz[4]; + agg_file_view_state_arr[tmp_agg_idx].type_sz = + disp_off_sz_ext_typesz[5]; + agg_file_view_state_arr[tmp_agg_idx].flat_type_p = flat_file_p; + + ADIOI_init_view_state(file_ptr_type, + 1, + &(agg_file_view_state_arr[tmp_agg_idx]), + TEMP_OFF); + ADIOI_init_view_state(file_ptr_type, + 1, + &(agg_file_view_state_arr[tmp_agg_idx]), + REAL_OFF); + + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + send_count_arr[tmp_agg_idx].count = flat_file_p->count; + send_count_arr[tmp_agg_idx].fp_ind = disp_off_sz_ext_typesz[0]; + send_count_arr[tmp_agg_idx].disp = disp_off_sz_ext_typesz[1]; + send_count_arr[tmp_agg_idx].byte_off = disp_off_sz_ext_typesz[2]; + send_count_arr[tmp_agg_idx].sz = disp_off_sz_ext_typesz[3]; + send_count_arr[tmp_agg_idx].ext = disp_off_sz_ext_typesz[4]; + send_count_arr[tmp_agg_idx].type_sz = disp_off_sz_ext_typesz[5]; + } + } + +#ifdef DEBUG2 + fprintf(stderr, "my own flattened memtype: "); + ADIOI_Print_flatlist_node(flat_mem_p); + fprintf(stderr, "my own flattened filetype: "); + ADIOI_Print_flatlist_node(flat_file_p); +#endif + + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + ret = MPI_Alltoall(send_count_arr, sizeof(amount_and_extra_data_t), + MPI_BYTE, + recv_count_arr, sizeof(amount_and_extra_data_t), + MPI_BYTE, fd->comm); + if (ret != MPI_SUCCESS) + { + fprintf(stderr, "ADIOI_Exchange_file_views: MPI_Alltoall failed " + "with error %d", ret); + return; + } + } else { + statuses = (MPI_Status *) ADIOI_Malloc(1 + nprocs * sizeof(MPI_Status)); + if (fd->is_agg) { + MPI_Waitall(nprocs, recv_req_arr, statuses); + ADIOI_Free(recv_req_arr); + } + MPI_Waitall(fd->hints->cb_nodes, send_req_arr, statuses); + ADIOI_Free(statuses); + ADIOI_Free(send_req_arr); + } +#ifdef DEBUG2 + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + fprintf(stderr, "send_count_arr:"); + for (i = 0; i < nprocs; i++) + { + fprintf(stderr, "[%d]=%d ", i, send_count_arr[i].count); + } + fprintf(stderr, "\n"); + fprintf(stderr, "recv_count_arr:"); + for (i = 0; i < nprocs; i++) + { + fprintf(stderr, "[%d]=%d ", i, recv_count_arr[i].count); + } + fprintf(stderr, "\n"); + } else { + fprintf(stderr, "send_count_arr:"); + for (i = 0; i < fd->hints->cb_nodes; i++) + { + fprintf(stderr, "[%d]=%d ", i, send_count_arr[i].count); + } + fprintf(stderr, "\n"); + if (fd->is_agg) { + fprintf(stderr, "recv_count_arr:"); + for (i = 0; i < nprocs; i++) + { + fprintf(stderr, "[%d]=%d ", i, recv_count_arr[i].count); + } + fprintf(stderr, "\n"); + } + } +#endif + + if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { + for (i=0; i < fd->hints->cb_nodes; i++) + if (send_count_arr[i].count > 0) + send_req_arr_sz++; + } + /* Figure out how many counts to send/recv */ + for (i = 0; i < nprocs; i++) + { + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + if (send_count_arr[i].count > 0) + send_req_arr_sz++; + } + /* Only aggregators should recv*/ + if (fd->is_agg) { + if (recv_count_arr[i].count > 0) + { + if ((client_file_view_state_arr[i].flat_type_p = + (ADIOI_Flatlist_node *) ADIOI_Malloc( + sizeof(ADIOI_Flatlist_node))) == NULL) + { + fprintf(stderr, "ADIOI_Exchange_file_views: malloc " + "flat_type_p failed\n"); + } + client_file_view_state_arr[i].flat_type_p->count = + recv_count_arr[i].count; + client_file_view_state_arr[i].flat_type_p->indices = + (ADIO_Offset *) ADIOI_Calloc(recv_count_arr[i].count, + sizeof(ADIO_Offset)); + client_file_view_state_arr[i].flat_type_p->blocklens = + (ADIO_Offset *) ADIOI_Calloc(recv_count_arr[i].count, + sizeof(ADIO_Offset)); + + /* Copy the extra data out of the stuff we Alltoall'd */ + memcpy (&client_file_view_state_arr[i].fp_ind, + &recv_count_arr[i].fp_ind, + 6*sizeof(ADIO_Offset)); + + recv_req_arr_sz++; + } + } + } + + /* Since ADIOI_Calloc may do other things we add the +1 + * to avoid a 0-size malloc */ + send_req_arr = (MPI_Request *) ADIOI_Calloc(2*(send_req_arr_sz)+1, + sizeof(MPI_Request)); + + j = 0; + if (recv_req_arr_sz > 0) { + assert (fd->is_agg); + recv_req_arr = (MPI_Request *) ADIOI_Calloc(2*(recv_req_arr_sz), + sizeof(MPI_Request)); + for (i = 0; i < nprocs; i++) { + if (recv_count_arr[i].count > 0) { + MPI_Irecv(client_file_view_state_arr[i].flat_type_p->indices, + recv_count_arr[i].count, ADIO_OFFSET, i, + INDICES, fd->comm, &recv_req_arr[j]); + j++; + MPI_Irecv(client_file_view_state_arr[i].flat_type_p->blocklens, + recv_count_arr[i].count, MPI_INT, i, + BLOCK_LENS, fd->comm, &recv_req_arr[j]); + j++; + } + } + } + + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + j = 0; + for (i = 0; i < nprocs; i++) { + if (send_count_arr[i].count > 0) { + MPI_Isend(flat_file_p->indices, + send_count_arr[i].count, ADIO_OFFSET, i, + INDICES, fd->comm, &send_req_arr[j]); + j++; + MPI_Isend(flat_file_p->blocklens, + send_count_arr[i].count, MPI_INT, i, + BLOCK_LENS, fd->comm, &send_req_arr[j]); + j++; + } + } + } else { + j = 0; + for (i = 0; i < fd->hints->cb_nodes; i++) { + if (send_count_arr[i].count > 0) { + MPI_Isend(flat_file_p->indices, + send_count_arr[i].count, ADIO_OFFSET, + fd->hints->ranklist[i], INDICES, fd->comm, + &send_req_arr[j]); + j++; + MPI_Isend(flat_file_p->blocklens, + send_count_arr[i].count, MPI_INT, + fd->hints->ranklist[i], BLOCK_LENS, fd->comm, + &send_req_arr[j]); + j++; + } + } + } + + /* Since ADIOI_Malloc may do other things we add the +1 + * to avoid a 0-size malloc */ + statuses = (MPI_Status *) + ADIOI_Malloc(1 + 2 * ADIOI_MAX(send_req_arr_sz,recv_req_arr_sz) + * sizeof(MPI_Status)); + + if (send_req_arr_sz > 0) { + MPI_Waitall(2 * send_req_arr_sz, send_req_arr, statuses); + ADIOI_Free(send_count_arr); + ADIOI_Free(send_req_arr); + } + if (recv_req_arr_sz > 0) { + MPI_Waitall(2 * recv_req_arr_sz, recv_req_arr, statuses); + ADIOI_Free(recv_count_arr); + ADIOI_Free(recv_req_arr); + } + ADIOI_Free(statuses); + + if (fd->is_agg == 1) + { + ADIOI_init_view_state(file_ptr_type, + nprocs, + client_file_view_state_arr, + TEMP_OFF); + ADIOI_init_view_state(file_ptr_type, + nprocs, + client_file_view_state_arr, + REAL_OFF); + } + +#ifdef DEBUG + if (fd->is_agg == 1) + { + ADIOI_Flatlist_node *fr_node_p = CtvAccess(ADIOI_Flatlist); + for (i = 0; i < nprocs; i++) + { + fprintf(stderr, "client_file_view_state_arr[%d]=(fp_ind=%Ld," + "disp=%Ld,byte_off=%Ld,sz=%Ld,ext=%Ld\n", i, + client_file_view_state_arr[i].fp_ind, + client_file_view_state_arr[i].disp, + client_file_view_state_arr[i].byte_off, + client_file_view_state_arr[i].sz, + client_file_view_state_arr[i].ext); + } + + while (fr_node_p->type != + fd->file_realm_types[fd->my_cb_nodes_index]) + fr_node_p = fr_node_p->next; + assert(fr_node_p != NULL); + + fprintf(stderr, "my file realm (idx=%d,st_off=%Ld) ", + fd->my_cb_nodes_index, + fd->file_realm_st_offs[fd->my_cb_nodes_index]); + ADIOI_Print_flatlist_node(fr_node_p); + } +#endif + +#ifdef DEBUG2 + if (fd->is_agg == 1) + { + for (i = 0; i < nprocs; i++) + { + fprintf(stderr, "client_file_view_state_arr[%d]: ", i); + ADIOI_Print_flatlist_node( + client_file_view_state_arr[i].flat_type_p); + } + } +#endif +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5015, 0, NULL); +#endif +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_darray.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_darray.c new file mode 100644 index 0000000000..faa2cf694d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_darray.c @@ -0,0 +1,295 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" + +static int MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, int nprocs, + int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype *type_new, + MPI_Aint *st_offset); +static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, + int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype *type_new, + MPI_Aint *st_offset); + + +int ADIO_Type_create_darray(int size, int rank, int ndims, + int *array_of_gsizes, int *array_of_distribs, + int *array_of_dargs, int *array_of_psizes, + int order, MPI_Datatype oldtype, + MPI_Datatype *newtype) +{ + MPI_Datatype type_old, type_new=MPI_DATATYPE_NULL, types[3]; + int procs, tmp_rank, i, tmp_size, blklens[3], *coords; + MPI_Aint *st_offsets, orig_extent, disps[3]; + + MPI_Type_extent(oldtype, &orig_extent); + +/* calculate position in Cartesian grid as MPI would (row-major + ordering) */ + coords = (int *) ADIOI_Malloc(ndims*sizeof(int)); + procs = size; + tmp_rank = rank; + for (i=0; i=0; i--) { + switch(array_of_distribs[i]) { + case MPI_DISTRIBUTE_BLOCK: + MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], + coords[i], array_of_dargs[i], order, + orig_extent, type_old, &type_new, + st_offsets+i); + break; + case MPI_DISTRIBUTE_CYCLIC: + MPIOI_Type_cyclic(array_of_gsizes, i, ndims, + array_of_psizes[i], coords[i], + array_of_dargs[i], order, + orig_extent, type_old, &type_new, + st_offsets+i); + break; + case MPI_DISTRIBUTE_NONE: + /* treat it as a block distribution on 1 process */ + MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], + coords[i], MPI_DISTRIBUTE_DFLT_DARG, order, orig_extent, + type_old, &type_new, st_offsets+i); + break; + } + if (i != ndims-1) MPI_Type_free(&type_old); + type_old = type_new; + } + + /* add displacement and UB */ + disps[1] = st_offsets[ndims-1]; + tmp_size = 1; + for (i=ndims-2; i>=0; i--) { + tmp_size *= array_of_gsizes[i+1]; + disps[1] += (MPI_Aint)tmp_size*st_offsets[i]; + } + } + + disps[1] *= orig_extent; + + disps[2] = orig_extent; + for (i=0; idim; i--) stride *= (MPI_Aint)array_of_gsizes[i]; + MPI_Type_hvector(mysize, 1, stride, type_old, type_new); + } + + } + + *st_offset = (MPI_Aint)blksize * (MPI_Aint)rank; + /* in terms of no. of elements of type oldtype in this dimension */ + if (mysize == 0) *st_offset = 0; + + return MPI_SUCCESS; +} + + +/* Returns MPI_SUCCESS on success, an MPI error code on failure. Code above + * needs to call MPIO_Err_return_xxx. + */ +static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, + int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype *type_new, + MPI_Aint *st_offset) +{ +/* nprocs = no. of processes in dimension dim of grid + rank = coordinate of this process in dimension dim */ + int blksize, i, blklens[3], st_index, end_index, local_size, rem, count; + MPI_Aint stride, disps[3]; + MPI_Datatype type_tmp, types[3]; + + if (darg == MPI_DISTRIBUTE_DFLT_DARG) blksize = 1; + else blksize = darg; + + /* --BEGIN ERROR HANDLING-- */ + if (blksize <= 0) { + return MPI_ERR_ARG; + } + /* --END ERROR HANDLING-- */ + + st_index = rank*blksize; + end_index = array_of_gsizes[dim] - 1; + + if (end_index < st_index) local_size = 0; + else { + local_size = ((end_index - st_index + 1)/(nprocs*blksize))*blksize; + rem = (end_index - st_index + 1) % (nprocs*blksize); + local_size += ADIOI_MIN(rem, blksize); + } + + count = local_size/blksize; + rem = local_size % blksize; + + stride = (MPI_Aint)nprocs*(MPI_Aint)blksize*orig_extent; + if (order == MPI_ORDER_FORTRAN) + for (i=0; idim; i--) stride *= (MPI_Aint)array_of_gsizes[i]; + + MPI_Type_hvector(count, blksize, stride, type_old, type_new); + + if (rem) { + /* if the last block is of size less than blksize, include + it separately using MPI_Type_struct */ + + types[0] = *type_new; + types[1] = type_old; + disps[0] = 0; + disps[1] = (MPI_Aint)count*stride; + blklens[0] = 1; + blklens[1] = rem; + + MPI_Type_struct(2, blklens, disps, types, &type_tmp); + + MPI_Type_free(type_new); + *type_new = type_tmp; + } + + /* In the first iteration, we need to set the displacement in that + dimension correctly. */ + if ( ((order == MPI_ORDER_FORTRAN) && (dim == 0)) || + ((order == MPI_ORDER_C) && (dim == ndims-1)) ) { + types[0] = MPI_LB; + disps[0] = 0; + types[1] = *type_new; + disps[1] = (MPI_Aint)rank * (MPI_Aint)blksize * orig_extent; + types[2] = MPI_UB; + disps[2] = orig_extent * (MPI_Aint)array_of_gsizes[dim]; + blklens[0] = blklens[1] = blklens[2] = 1; + MPI_Type_struct(3, blklens, disps, types, &type_tmp); + MPI_Type_free(type_new); + *type_new = type_tmp; + + *st_offset = 0; /* set it to 0 because it is taken care of in + the struct above */ + } + else { + *st_offset = (MPI_Aint)rank * (MPI_Aint)blksize; + /* st_offset is in terms of no. of elements of type oldtype in + * this dimension */ + } + + if (local_size == 0) *st_offset = 0; + + return MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_delete.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_delete.c index 18519797d4..bc00d7294c 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_delete.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_delete.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -15,18 +14,14 @@ void ADIOI_GEN_Delete(char *filename, int *error_code) { int err; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_GEN_DELETE"; -#endif + err = unlink(filename); -#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(MPI_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)); + return; } else *error_code = MPI_SUCCESS; -#endif } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_done.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_done.c new file mode 100644 index 0000000000..43d7a66b1d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_done.c @@ -0,0 +1,47 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#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 + +/* ADIOI_GEN_IODone + * + * This code handles two distinct cases. If ROMIO_HAVE_WORKING_AIO is not + * defined, then I/O was done as a blocking call earlier. In that case + * we have nothing much to do other than set the bytes transferred and + * free the request. + * + * If ROMIO_HAVE_WORKING_AIO is defined, then we may need to wait for I/O + * to complete. + */ +int ADIOI_GEN_IODone(ADIO_Request *request, ADIO_Status *status, + int *error_code) +{ + return 0; + +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_done_fake.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_done_fake.c new file mode 100644 index 0000000000..0f707f2fde --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_done_fake.c @@ -0,0 +1,20 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +/* Generic implementation of ReadDone/WriteDone simply sets the + * bytes field in the status structure and frees the request. + * + * Same function is used for both reads and writes. + */ +int ADIOI_FAKE_IODone(ADIO_Request *request, ADIO_Status *status, + int *error_code) +{ + /* should not ever get called now */ + return 1; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_end.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_end.c index 994b23a26f..48b7e6f789 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_end.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_end.c @@ -1,22 +1,28 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "adio.h" #include "adio_extern.h" +#ifdef ROMIO_INSIDE_MPICH2 +#include "mpiimpl.h" +#endif void ADIO_End(int *error_code) { ADIOI_Flatlist_node *curr, *next; - ADIOI_Malloc_async *tmp; - ADIOI_Malloc_req *tmp1; + ADIOI_Datarep *datarep, *datarep_next; /* FPRINTF(stderr, "reached end\n"); */ + /* if a default errhandler was set on MPI_FILE_NULL then we need to ensure + * that our reference to that errhandler is released */ + #if 0 + PMPI_File_set_errhandler(MPI_FILE_NULL, MPI_ERRORS_RETURN); + #endif + /* delete the flattened datatype list */ curr = CtvAccess(ADIOI_Flatlist); while (curr) { @@ -28,50 +34,56 @@ void ADIO_End(int *error_code) } CtvAccess(ADIOI_Flatlist) = NULL; - if (CtvAccess(ADIOI_Async_list_head)) { - FPRINTF(stderr, "ADIO_End: Error! There are outstanding nonblocking I/O operations!\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - -/* free list of available ADIOI_Async_nodes. */ - while (CtvAccess(ADIOI_Malloc_async_head)) { - ADIOI_Free(CtvAccess(ADIOI_Malloc_async_head)->ptr); - tmp = CtvAccess(ADIOI_Malloc_async_head); - CtvAccess(ADIOI_Malloc_async_head) = CtvAccess(ADIOI_Malloc_async_head)->next; - ADIOI_Free(tmp); - } - CtvAccess(ADIOI_Async_avail_head) = CtvAccess(ADIOI_Async_avail_tail) = NULL; - CtvAccess(ADIOI_Malloc_async_head) = CtvAccess(ADIOI_Malloc_async_tail) = NULL; - -/* free all available request objects */ - while (CtvAccess(ADIOI_Malloc_req_head)) { - ADIOI_Free(CtvAccess(ADIOI_Malloc_req_head)->ptr); - tmp1 = CtvAccess(ADIOI_Malloc_req_head); - CtvAccess(ADIOI_Malloc_req_head) = CtvAccess(ADIOI_Malloc_req_head)->next; - ADIOI_Free(tmp1); - } - CtvAccess(ADIOI_Malloc_req_head) = CtvAccess(ADIOI_Malloc_req_tail) = NULL; - -/* free file, request, and info tables used for Fortran interface */ +/* free file and info tables used for Fortran interface */ if (CtvAccess(ADIOI_Ftable)) ADIOI_Free(CtvAccess(ADIOI_Ftable)); - if (CtvAccess(ADIOI_Reqtable)) ADIOI_Free(CtvAccess(ADIOI_Reqtable)); #ifndef HAVE_MPI_INFO if (MPIR_Infotable) ADIOI_Free(MPIR_Infotable); #endif + +/* free the memory allocated for a new data representation, if any */ + datarep = CtvAccess(ADIOI_Datarep_head); + while (datarep) { + datarep_next = datarep->next; +#ifdef HAVE_MPIU_FUNCS + MPIU_Free(datarep->name); +#else + ADIOI_Free(datarep->name); +#endif + ADIOI_Free(datarep); + datarep = datarep_next; + } + + if( CtvAccess(ADIOI_syshints) != MPI_INFO_NULL) + MPI_Info_free(&CtvAccess(ADIOI_syshints)); + + MPI_Op_free(&CtvAccess(ADIO_same_amode)); + *error_code = MPI_SUCCESS; } /* This is the delete callback function associated with - ADIO_Init_keyval when MPI_COMM_WORLD is freed */ + ADIO_Init_keyval when MPI_COMM_SELF is freed */ int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state) { int error_code; + ADIOI_UNREFERENCED_ARG(comm); + ADIOI_UNREFERENCED_ARG(attribute_val); + ADIOI_UNREFERENCED_ARG(extra_state); + + MPI_Keyval_free(&keyval); + + /* The end call will be called after all possible uses of this keyval, even + * if a file was opened with MPI_COMM_SELF. Note, this assumes LIFO + * MPI_COMM_SELF attribute destruction behavior mandated by MPI-2.2. */ + if (CtvAccess(ADIOI_cb_config_list_keyval) != MPI_KEYVAL_INVALID) + MPI_Keyval_free(&CtvAccess(ADIOI_cb_config_list_keyval)); + ADIO_End(&error_code); return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_fcntl.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_fcntl.c new file mode 100644 index 0000000000..f526c71d76 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_fcntl.c @@ -0,0 +1,64 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2005 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include +#endif + +void ADIOI_GEN_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, + int *error_code) +{ + static char myname[] = "ADIOI_GEN_FCNTL"; + + switch(flag) { + case ADIO_FCNTL_GET_FSIZE: +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + if (fd->fp_sys_posn != -1) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + } + if (fcntl_struct->fsize == -1) { + *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; + break; + + case ADIO_FCNTL_SET_DISKSPACE: + 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; + break; + + /* --BEGIN ERROR HANDLING-- */ + default: + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "**flag", "**flag %d", flag); + /* --END ERROR HANDLING-- */ + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_features.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_features.c new file mode 100644 index 0000000000..339c54d52b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_features.c @@ -0,0 +1,18 @@ +#include "adio.h" + +int ADIOI_GEN_Feature(ADIO_File fd, int flag) +{ + switch(flag) { + case ADIO_LOCKS: + case ADIO_SHARED_FP: + case ADIO_ATOMIC_MODE: + case ADIO_DATA_SIEVING_WRITES: + case ADIO_UNLINK_AFTER_CLOSE: + return 1; + break; + case ADIO_SCALABLE_OPEN: + default: + return 0; + break; + } +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_flush.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_flush.c index e798c691aa..8494d37522 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_flush.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_flush.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -15,18 +14,18 @@ void ADIOI_GEN_Flush(ADIO_File fd, int *error_code) { int err; -#ifndef PRINT_ERR_MSG static char myname[] = "ADIOI_GEN_FLUSH"; -#endif + err = fsync(fd->fd_sys); -#ifdef PRINT_ERR_MSG - *error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; -#else + /* --BEGIN ERROR HANDLING-- */ 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); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**io", + "**io %s", strerror(errno)); + return; } - else *error_code = MPI_SUCCESS; -#endif + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_fstype.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_fstype.c index ec4d362d17..5cd9ae2b26 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_fstype.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_fstype.c @@ -1,7 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ @@ -12,42 +10,105 @@ #include "adio.h" -#if (defined(HPUX) || defined(SPPUX) || defined(IRIX) || defined(SOLARIS) || defined(AIX) || defined(DEC) || defined(CRAY)) -#include -#endif -#ifdef LINUX -#include -/* #include this file is broken in newer versions of linux */ -#define NFS_SUPER_MAGIC 0x6969 +#ifdef HAVE_UNISTD_H +#include #endif -#ifdef FREEBSD + +#ifdef HAVE_SYS_PARAM_H #include -#include #endif -#ifdef PARAGON -#include -#include -#include + +#ifdef HAVE_PVFS_H +#include "pvfs.h" #endif -#ifdef SX4 -#include + +#ifdef HAVE_PVFS2_H +#include "pvfs2.h" #endif -#ifdef ROMIO_PVFS -#include "pvfs_config.h" -#include + +#ifdef HAVE_ZOIDFS_H +#include "zoidfs.h" #endif -#ifdef tflops -#include + +/* Notes on detection process: + * + * There are three more "general" mechanisms that we use for detecting + * file system type: + * - struct statfs's f_type field + * - struct statvfs's f_basetype field + * - struct stat's st_fstype field + * + * Otherwise we'll fall back on some OS-specific approach. + */ + +#ifdef HAVE_STRUCT_STATFS +# ifdef HAVE_SYS_VFS_H +# include +# endif +# ifdef HAVE_SYS_STATVFS_H +# include +# endif +# ifdef HAVE_SYS_PARAM_H +# include +# endif +# ifdef HAVE_SYS_MOUNT_H +# include +# endif + /* On Linux platforms, linux/nfs_fs.h is all messed up and cannot be + * reliably included. + */ +# if defined(ROMIO_NFS) && !defined(NFS_SUPER_MAGIC) +# define NFS_SUPER_MAGIC 0x6969 +# endif + +# if defined(ROMIO_PANFS) && !defined(PAN_KERNEL_FS_CLIENT_SUPER_MAGIC) +# define PAN_KERNEL_FS_CLIENT_SUPER_MAGIC 0xAAD7AAEA +# endif #endif -#ifdef HAVE_UNISTD_H -/* Needed for readlink */ -#include +# if defined(ROMIO_XFS) && !defined(XFS_SUPER_MAGIC) +# define XFS_SUPER_MAGIC 0x58465342 +# endif + +#if !defined(PVFS2_SUPER_MAGIC) +#define PVFS2_SUPER_MAGIC (0x20030528) #endif +#ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE +# ifdef HAVE_SYS_STATVFS_H +# include +# endif +# ifdef HAVE_SYS_VFS_H +# include +# endif +# ifdef HAVE_SYS_PARAM_H +# include +# endif +# ifdef HAVE_SYS_MOUNT_H +# include +# endif +#endif + +#ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE +# ifdef HAVE_SYS_TYPES_H +# include +# endif +# ifdef HAVE_SYS_STAT_H +# include +# endif +#endif + +/* ADIO_FileSysType_parentdir is only used if one of these is defined. + By including this test, we avoid warnings about unused static functions + from the compiler */ +#if defined(ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE) || \ + defined(HAVE_STRUCT_STATFS) || \ + defined(ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE) #ifndef ROMIO_NTFS +#define ROMIO_NEEDS_ADIOPARENTDIR static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep); #endif +#endif static void ADIO_FileSysType_prefix(char *filename, int *fstype, int *error_code); static void ADIO_FileSysType_fncall(char *filename, int *fstype, @@ -66,14 +127,35 @@ Output Parameters: Note that the caller should free the memory located at the pointer returned after the string is no longer needed. */ -#ifndef ROMIO_NTFS +#ifdef ROMIO_NEEDS_ADIOPARENTDIR + #ifndef PATH_MAX #define PATH_MAX 65535 #endif + +/* In a strict ANSI environment, S_ISLNK may not be defined. Fix that + here. We assume that S_ISLNK is *always* defined as a macro. If + that is not universally true, then add a test to the romio + configure that trys to link a program that references S_ISLNK */ +#if !defined(S_ISLNK) +# if defined(S_IFLNK) + /* Check for the link bit */ +# define S_ISLNK(mode) ((mode) & S_IFLNK) +# else + /* no way to check if it is a link, so say false */ +# define S_ISLNK(mode) 0 +# endif +#endif /* !(S_ISLNK) */ + +/* ADIO_FileSysType_parentdir + * + * Returns pointer to string in dirnamep; that string is allocated with + * strdup and must be free()'d. + */ static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep) { int err; - char *dir, *slash; + char *dir = NULL, *slash; struct stat statbuf; err = lstat(filename, &statbuf); @@ -82,7 +164,7 @@ static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep) /* no such file, or file is not a link; these are the "normal" * cases where we can just return the parent directory. */ - dir = strdup(filename); + dir = ADIOI_Strdup(filename); } else { /* filename is a symlink. we've presumably already tried @@ -90,28 +172,30 @@ static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep) * but this code doesn't care if the target is really there * or not. */ + int namelen; char *linkbuf; linkbuf = ADIOI_Malloc(PATH_MAX+1); - err = readlink(filename, linkbuf, PATH_MAX+1); - if (err) { + namelen = readlink(filename, linkbuf, PATH_MAX+1); + if (namelen == -1) { /* something strange has happened between the time that * we determined that this was a link and the time that * we attempted to read it; punt and use the old name. */ - dir = strdup(filename); + dir = ADIOI_Strdup(filename); } else { /* successfully read the link */ - dir = strdup(linkbuf); + linkbuf[namelen] = '\0'; /* readlink doesn't null terminate */ + dir = ADIOI_Strdup(linkbuf); ADIOI_Free(linkbuf); } } slash = strrchr(dir, '/'); - if (!slash) strcpy(dir, "."); + if (!slash) ADIOI_Strncpy(dir, ".", 2); else { - if (slash == dir) *(dir + 1) = 0; + if (slash == dir) *(dir + 1) = '\0'; else *slash = '\0'; } @@ -120,6 +204,25 @@ static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep) } #endif /* ROMIO_NTFS */ +#ifdef ROMIO_BGL /* BlueGene support for lockless i/o (necessary for PVFS. + possibly beneficial for others, unless data sieving + writes desired) */ + +/* BlueGene environment variables can override lockless selection.*/ +extern void ad_bgl_get_env_vars(); +extern long bglocklessmpio_f_type; + +static void check_for_lockless_exceptions(long stat_type, int *fstype) +{ + /* exception for lockless file systems. (PVFS2 is the default in ad_bgl_tuning.) + * The BGLOCKLESS_F_TYPE environment variable will override it by specifying + * the appropriate file system magic number here. + */ + if (stat_type == bglocklessmpio_f_type) + /* use lock-free driver on bluegene to support specified fs (defaults to pvfs2) */ + *fstype = ADIO_BGLOCKLESS; +} +#endif /* ADIO_FileSysType_fncall - determines the file system type for a given file using a system-dependent function call @@ -143,51 +246,71 @@ static void ADIO_FileSysType_fncall(char *filename, int *fstype, int *error_code char *dir; int err; #endif -#if (defined(HPUX) || defined(SPPUX) || defined(IRIX) || defined(SOLARIS) || defined(AIX) || defined(DEC) || defined(CRAY)) + +#ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE struct statvfs vfsbuf; #endif -#if (defined(LINUX) || defined(FREEBSD) || defined(tflops)) +#ifdef HAVE_STRUCT_STATFS struct statfs fsbuf; #endif -#ifdef PARAGON - struct estatfs ebuf; -#endif -#ifdef SX4 +#ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE struct stat sbuf; #endif + static char myname[] = "ADIO_RESOLVEFILETYPE_FNCALL"; *error_code = MPI_SUCCESS; -#if (defined(HPUX) || defined(SPPUX) || defined(IRIX) || defined(SOLARIS) || defined(AIX) || defined(DEC) || defined(CRAY)) +#ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE do { err = statvfs(filename, &vfsbuf); } while (err && (errno == ESTALE)); if (err && (errno == ENOENT)) { + /* ENOENT may be returned in two cases: + * 1) no directory entry for "filename" + * 2) "filename" is a dangling symbolic link + * + * ADIO_FileSysType_parentdir tries to deal with both cases. + */ ADIO_FileSysType_parentdir(filename, &dir); err = statvfs(dir, &vfsbuf); - free(dir); + + ADIOI_Free(dir); } - if (err) *error_code = MPI_ERR_UNKNOWN; - else { - /* FPRINTF(stderr, "%s\n", vfsbuf.f_basetype); */ - if (!strncmp(vfsbuf.f_basetype, "nfs", 3)) *fstype = ADIO_NFS; - else { -# if (defined(HPUX) || defined(SPPUX)) -# ifdef HFS - *fstype = ADIO_HFS; -# else - *fstype = ADIO_UFS; -# endif -# else - if (!strncmp(vfsbuf.f_basetype, "xfs", 3)) *fstype = ADIO_XFS; - else if (!strncmp(vfsbuf.f_basetype, "piofs", 4)) *fstype = ADIO_PIOFS; - else *fstype = ADIO_UFS; -# endif - } + /* --BEGIN ERROR HANDLING-- */ + if (err) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + return; } -#elif defined(LINUX) + /* --END ERROR HANDLING-- */ + + /* FPRINTF(stderr, "%s\n", vfsbuf.f_basetype); */ + if (!strncmp(vfsbuf.f_basetype, "nfs", 3)) { + *fstype = ADIO_NFS; + return; + } + if (!strncmp(vfsbuf.f_basetype, "xfs", 3)) { + *fstype = ADIO_XFS; + return; + } + +# ifdef ROMIO_UFS + /* if UFS support is enabled, default to that */ + *fstype = ADIO_UFS; + return; +# endif + + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + /* --END ERROR HANDLING-- */ +#endif /* STATVFS APPROACH */ + +#ifdef HAVE_STRUCT_STATFS do { err = statfs(filename, &fsbuf); } while (err && (errno == ESTALE)); @@ -195,73 +318,111 @@ static void ADIO_FileSysType_fncall(char *filename, int *fstype, int *error_code if (err && (errno == ENOENT)) { ADIO_FileSysType_parentdir(filename, &dir); err = statfs(dir, &fsbuf); - free(dir); + ADIOI_Free(dir); } - if (err) *error_code = MPI_ERR_UNKNOWN; - else { - /* FPRINTF(stderr, "%d\n", fsbuf.f_type);*/ - if (fsbuf.f_type == NFS_SUPER_MAGIC) *fstype = ADIO_NFS; -# ifdef ROMIO_PVFS - else if (fsbuf.f_type == PVFS_SUPER_MAGIC) *fstype = ADIO_PVFS; + /* --BEGIN ERROR HANDLING-- */ + if (err) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + return; + } + /* --END ERROR HANDLING-- */ + +# ifdef ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME + if ( !strncmp("nfs",fsbuf.f_fstypename,3) ) { + *fstype = ADIO_NFS; + return; + } # endif - else *fstype = ADIO_UFS; + +# ifdef ROMIO_BGL + /* BlueGene is a special case: all file systems are AD_BGL, except for + * certain exceptions */ + + /* Bluegene needs to read enviroment variables before selecting the file system*/ + ad_bgl_get_env_vars(); + + *fstype = ADIO_BGL; + check_for_lockless_exceptions(fsbuf.f_type, fstype); + *error_code = MPI_SUCCESS; + return; +# endif + + /* FPRINTF(stderr, "%d\n", fsbuf.f_type);*/ +# ifdef NFS_SUPER_MAGIC + if (fsbuf.f_type == NFS_SUPER_MAGIC) { + *fstype = ADIO_NFS; + return; } -#elif (defined(FREEBSD) && defined(HAVE_MOUNT_NFS)) - do { - err = statfs(filename, &fsbuf); - } while (err && (errno == ESTALE)); +# endif - if (err && (errno == ENOENT)) { - ADIO_FileSysType_parentdir(filename, &dir); - err = statfs(dir, &fsbuf); - free(dir); +#ifdef ROMIO_LUSTRE +# ifndef LL_SUPER_MAGIC +# define LL_SUPER_MAGIC 0x0BD00BD0 +# endif + if (fsbuf.f_type == LL_SUPER_MAGIC) { + *fstype = ADIO_LUSTRE; + return; } +#endif - if (err) *error_code = MPI_ERR_UNKNOWN; - else { -# if (__FreeBSD_version>300004) - if ( !strncmp("nfs",fsbuf.f_fstypename,3) ) *fstype = ADIO_NFS; -# else - if (fsbuf.f_type == MOUNT_NFS) *fstype = ADIO_NFS; +# ifdef PAN_KERNEL_FS_CLIENT_SUPER_MAGIC + if (fsbuf.f_type == PAN_KERNEL_FS_CLIENT_SUPER_MAGIC) { + *fstype = ADIO_PANFS; + return; + } # endif - else *fstype = ADIO_UFS; + +# ifdef MOUNT_NFS + if (fsbuf.f_type == MOUNT_NFS) { + *fstype = ADIO_NFS; + return; } -#elif defined(PARAGON) - do { - err = statpfs(filename, &ebuf, 0, 0); - } while (err && (errno == ESTALE)); +# endif - if (err && (errno == ENOENT)) { - ADIO_FileSysType_parentdir(filename, &dir); - err = statpfs(dir, &ebuf, 0, 0); - free(dir); +# ifdef MOUNT_PFS + if (fsbuf.f_type == MOUNT_PFS) { + *fstype = ADIO_PFS; + return; } +# endif - if (err) *error_code = MPI_ERR_UNKNOWN; - else { - if (ebuf.f_type == MOUNT_NFS) *fstype = ADIO_NFS; - else if (ebuf.f_type == MOUNT_PFS) *fstype = ADIO_PFS; - else *fstype = ADIO_UFS; +# ifdef PVFS_SUPER_MAGIC + if (fsbuf.f_type == PVFS_SUPER_MAGIC) { + *fstype = ADIO_PVFS; + return; } -#elif defined(tflops) - do { - err = statfs(filename, &fsbuf); - } while (err && (errno == ESTALE)); +# endif - if (err && (errno == ENOENT)) { - ADIO_FileSysType_parentdir(filename, &dir); - err = statfs(dir, &fsbuf); - free(dir); +# ifdef PVFS2_SUPER_MAGIC + if (fsbuf.f_type == PVFS2_SUPER_MAGIC) { + *fstype = ADIO_PVFS2; + return; } +# endif - if (err) *error_code = MPI_ERR_UNKNOWN; - else { - if (fsbuf.f_type == MOUNT_NFS) *fstype = ADIO_NFS; - else if (fsbuf.f_type == MOUNT_PFS) *fstype = ADIO_PFS; - else *fstype = ADIO_UFS; +# ifdef XFS_SUPER_MAGIC + if (fsbuf.f_type == XFS_SUPER_MAGIC) { + *fstype = ADIO_XFS; + return; } -#elif defined(SX4) +# endif + +# ifdef ROMIO_UFS + /* if UFS support is enabled, default to that */ + *fstype = ADIO_UFS; + return; +# endif + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + /* --END ERROR HANDLING-- */ +#endif /* STATFS APPROACH */ + +#ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE do { err = stat(filename, &sbuf); } while (err && (errno == ESTALE)); @@ -269,25 +430,62 @@ static void ADIO_FileSysType_fncall(char *filename, int *fstype, int *error_code if (err && (errno == ENOENT)) { ADIO_FileSysType_parentdir(filename, &dir); err = stat(dir, &sbuf); - free(dir); + ADIOI_Free(dir); } - if (err) *error_code = MPI_ERR_UNKNOWN; + if (err) { + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + /* --END ERROR HANDLING-- */ + return; + } else { if (!strcmp(sbuf.st_fstype, "nfs")) *fstype = ADIO_NFS; - else *fstype = ADIO_SFS; + else *fstype = ADIO_SFS; /* assuming SX4 for now */ } +#endif /* STAT APPROACH */ + +#ifdef ROMIO_NTFS + ADIOI_UNREFERENCED_ARG(filename); + ADIOI_UNREFERENCED_ARG(error_code); + *fstype = ADIO_NTFS; /* only supported FS on Windows */ +#elif defined(ROMIO_NFS) + *fstype = ADIO_NFS; +#elif defined(ROMIO_UFS) + *fstype = ADIO_UFS; #else - /* on other systems, make NFS the default */ -# ifdef ROMIO_NTFS - *fstype = ADIO_NTFS; -# else - *fstype = ADIO_NFS; -# endif - *error_code = MPI_SUCCESS; + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + /* --END ERROR HANDLING-- */ #endif } +/* all proceeses opening, creating, or deleting a file end up invoking several + * stat system calls (unless a fs prefix is given). Cary out this file system + * detection in a more scalable way by having rank 0 stat the file and broadcast the result (fs type and error code) to the other mpi processes */ + +static void ADIO_FileSysType_fncall_scalable(MPI_Comm comm, char *filename, int * file_system, int * error_code) +{ + int rank; + int buf[2]; + MPI_Comm_rank(comm, &rank); + + if (rank == 0) { + ADIO_FileSysType_fncall(filename, file_system, error_code); + buf[0] = *file_system; + buf[1] = *error_code; + } + MPI_Bcast(buf, 2, MPI_INT, 0, comm); + *file_system = buf[0]; + *error_code = buf[1]; +} + + + /* ADIO_FileSysType_prefix - determines file system type for a file using a prefix on the file name. upper layer should have already determined @@ -306,6 +504,7 @@ Output Parameters: */ static void ADIO_FileSysType_prefix(char *filename, int *fstype, int *error_code) { + static char myname[] = "ADIO_RESOLVEFILETYPE_PREFIX"; *error_code = MPI_SUCCESS; if (!strncmp(filename, "pfs:", 4) || !strncmp(filename, "PFS:", 4)) { @@ -320,6 +519,9 @@ static void ADIO_FileSysType_prefix(char *filename, int *fstype, int *error_code else if (!strncmp(filename, "nfs:", 4) || !strncmp(filename, "NFS:", 4)) { *fstype = ADIO_NFS; } + else if (!strncmp(filename, "panfs:", 6) || !strncmp(filename, "PANFS:", 6)) { + *fstype = ADIO_PANFS; + } else if (!strncmp(filename, "hfs:", 4) || !strncmp(filename, "HFS:", 4)) { *fstype = ADIO_HFS; } @@ -332,17 +534,45 @@ static void ADIO_FileSysType_prefix(char *filename, int *fstype, int *error_code else if (!strncmp(filename, "pvfs:", 5) || !strncmp(filename, "PVFS:", 5)) { *fstype = ADIO_PVFS; } + else if (!strncmp(filename, "pvfs2:", 6)||!strncmp(filename, "PVFS2:", 6)) { + *fstype = ADIO_PVFS2; + } + else if (!strncmp(filename, "zoidfs:", 7)|| + !strncmp(filename, "ZOIDFS:", 7)) { + *fstype = ADIO_ZOIDFS; + } else if (!strncmp(filename, "testfs:", 7) || !strncmp(filename, "TESTFS:", 7)) { *fstype = ADIO_TESTFS; } + else if (!strncmp(filename, "ftp:", 4) + || !strncmp(filename, "gsiftp:", 7)) + { + *fstype = ADIO_GRIDFTP; + } + else if (!strncmp(filename, "lustre:", 7) + || !strncmp(filename, "LUSTRE:", 7)) + { + *fstype = ADIO_LUSTRE; + } + else if (!strncmp(filename, "bgl:", 4) || !strncmp(filename, "BGL:", 4)) { + *fstype = ADIO_BGL; + } + else if (!strncmp(filename, "bglockless:", 11) || + !strncmp(filename, "BGLOCKLESS:", 11)) { + *fstype = ADIO_BGLOCKLESS; + } else { #ifdef ROMIO_NTFS *fstype = ADIO_NTFS; #else *fstype = 0; - *error_code = MPI_ERR_UNKNOWN; + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_NO_SUCH_FILE, + "**filename", "**filename %s", filename); + /* --END ERROR HANDLING-- */ #endif } } @@ -369,33 +599,70 @@ tables in a reasonable way. -- Rob, 06/06/2001 void ADIO_ResolveFileType(MPI_Comm comm, char *filename, int *fstype, ADIOI_Fns **ops, int *error_code) { -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIO_RESOLVEFILETYPE"; -#endif - int myerrcode, file_system, min_code; + int myerrcode, file_system, min_code, max_code; char *tmp; + static char myname[] = "ADIO_RESOLVEFILETYPE"; file_system = -1; tmp = strchr(filename, ':'); if (!tmp) { + int have_nfs_enabled=0; + *error_code = MPI_SUCCESS; /* no prefix; use system-dependent function call to determine type */ - ADIO_FileSysType_fncall(filename, &file_system, &myerrcode); - if (myerrcode != MPI_SUCCESS) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: Can't determine the file-system type. Check the filename/path you provided and try again. Otherwise, prefix the filename with a string to indicate the type of file sytem (piofs:, pfs:, nfs:, ufs:, hfs:, xfs:, sfs:, pvfs:).\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_FSTYPE, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); - return; + /* Optimization: we can reduce the 'storm of stats' that result from + * thousands of mpi processes determinig file type this way. Let us + * have just one process stat the file and broadcast the result to + * everyone else. + * - Note that we will not catch cases like + * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html + * (edit: now http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html) + * + * where file systems are not mounted or available on other processes, + * but we'll catch those a few functions later in ADIO_Open + * - Note that if we have NFS enabled, we might have a situation where, + * for example, /home/user/data.out is UFS on one process but NFS on + * others, so we won't perform this optimization if NFS is enabled. + * - Another point: error codes and file system types are broadcast to + * all members of the communicator, so we get to skip the allreduce + * steps*/ + +#ifdef ROMIO_NFS + have_nfs_enabled=1; #endif + if (!have_nfs_enabled) { + ADIO_FileSysType_fncall_scalable(comm, filename, &file_system, &myerrcode); + if (myerrcode != MPI_SUCCESS) { + *error_code = myerrcode; + return; + } + } else { + ADIO_FileSysType_fncall(filename, &file_system, &myerrcode); + if (myerrcode != MPI_SUCCESS) { + *error_code = myerrcode; + + /* the check for file system type will hang if any process got + * an error in ADIO_FileSysType_fncall. Processes encountering + * an error will return early, before the collective file + * system type check below. This case could happen if a full + * path exists on one node but not on others, and no prefix + * like ufs: was provided. see discussion at + * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html + * (edit: now + * http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html) + */ + + MPI_Allreduce(error_code, &max_code, 1, MPI_INT, MPI_MAX, comm); + if (max_code != MPI_SUCCESS) { + *error_code = max_code; + return; + } + /* ensure everyone came up with the same file system type */ + MPI_Allreduce(&file_system, &min_code, 1, MPI_INT, + MPI_MIN, comm); + if (min_code == ADIO_NFS) file_system = ADIO_NFS; + } } - /* ensure that everyone came up with the same file system type */ - MPI_Allreduce(&file_system, &min_code, 1, MPI_INT, MPI_MIN, comm); - if (min_code == ADIO_NFS) file_system = ADIO_NFS; - } else { /* prefix specified; just match via prefix and assume everyone got @@ -405,170 +672,185 @@ void ADIO_ResolveFileType(MPI_Comm comm, char *filename, int *fstype, */ ADIO_FileSysType_prefix(filename, &file_system, &myerrcode); if (myerrcode != MPI_SUCCESS) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: Can't determine the file-system type from the specified prefix. Check the filename/path and prefix you provided and try again.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_FSTYPE, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); + *error_code = myerrcode; return; -#endif } } /* verify that we support this file system type and set ops pointer */ if (file_system == ADIO_PFS) { -#ifndef PFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the PFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_PFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); +#ifndef ROMIO_PFS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_PFS_operations; #endif } if (file_system == ADIO_PIOFS) { -#ifndef PIOFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the PIOFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_PIOFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); +#ifndef ROMIO_PIOFS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_PIOFS_operations; #endif } if (file_system == ADIO_UFS) { -#ifndef UFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the UFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_UFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); +#ifndef ROMIO_UFS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_UFS_operations; #endif } if (file_system == ADIO_NFS) { -#ifndef NFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the NFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_NFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); +#ifndef ROMIO_NFS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_NFS_operations; #endif } + if (file_system == ADIO_PANFS) { +#ifndef ROMIO_PANFS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); + return; +#else + *ops = &ADIO_PANFS_operations; +#endif + } if (file_system == ADIO_HFS) { -#ifndef HFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the HFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_HFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); +#ifndef ROMIO_HFS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_HFS_operations; #endif } if (file_system == ADIO_XFS) { -#ifndef XFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the XFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_XFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); +#ifndef ROMIO_XFS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_XFS_operations; #endif } if (file_system == ADIO_SFS) { -#ifndef SFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the SFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); +#ifndef ROMIO_SFS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_SFS_operations; #endif } if (file_system == ADIO_PVFS) { #ifndef ROMIO_PVFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the PVFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_PVFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_PVFS_operations; #endif } + if (file_system == ADIO_PVFS2) { +#ifndef ROMIO_PVFS2 + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); + return; +#else + *ops = &ADIO_PVFS2_operations; +#endif + } if (file_system == ADIO_NTFS) { #ifndef ROMIO_NTFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the NTFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_NTFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_NTFS_operations; #endif } if (file_system == ADIO_TESTFS) { #ifndef ROMIO_TESTFS -# ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the TESTFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -# else - myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_TESTFS, - myname, (char *) 0, (char *) 0); - *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); return; -# endif #else *ops = &ADIO_TESTFS_operations; #endif } + if (file_system == ADIO_BGL) { +#ifndef ROMIO_BGL + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); + return; +#else + *ops = &ADIO_BGL_operations; +#endif + } + if (file_system == ADIO_BGLOCKLESS) { +#ifndef ROMIO_BGLOCKLESS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); + return; +#else + *ops = &ADIO_BGLOCKLESS_operations; +#endif + } + + if (file_system == ADIO_GRIDFTP) { +#ifndef ROMIO_GRIDFTP + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); + return; +#else + *ops = &ADIO_GRIDFTP_operations; +#endif + } + if (file_system == ADIO_LUSTRE) { +#ifndef ROMIO_LUSTRE + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**iofstypeunsupported", 0); + return; +#else + *ops = &ADIO_LUSTRE_operations; +#endif + } + if (file_system == ADIO_ZOIDFS) { +#ifndef ROMIO_ZOIDFS + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iofstypeunsupported", 0); + return; +#else + *ops = &ADIO_ZOIDFS_operations; +#endif + } *error_code = MPI_SUCCESS; *fstype = file_system; return; } +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_get_sh_fp.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_get_sh_fp.c index 53271f215a..2fb519781f 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_get_sh_fp.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_get_sh_fp.c @@ -1,7 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ @@ -13,6 +11,9 @@ shared_fp by the number of etypes to be accessed (incr) in the read or write following this function. */ +void ADIOI_NFS_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp, + int *error_code); + void ADIO_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp, int *error_code) { @@ -20,20 +21,29 @@ void ADIO_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp, ADIO_Offset new_fp; MPI_Comm dupcommself; -#ifdef NFS +#ifdef ROMIO_NFS if (fd->file_system == ADIO_NFS) { ADIOI_NFS_Get_shared_fp(fd, incr, shared_fp, error_code); return; } #endif +#ifdef ROMIO_BGL + /* BGLOCKLESS won't support shared fp */ + if (fd->file_system == ADIO_BGL) { + ADIOI_BGL_Get_shared_fp(fd, incr, shared_fp, error_code); + return; + } +#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, + fd->file_system, + fd->fns, ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, - 0, MPI_BYTE, MPI_BYTE, M_ASYNC, + 0, MPI_BYTE, MPI_BYTE, MPI_INFO_NULL, ADIO_PERM_NULL, error_code); if (*error_code != MPI_SUCCESS) return; @@ -55,9 +65,12 @@ void ADIO_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp, } } + if (incr == 0) {goto done;} + new_fp = *shared_fp + incr; ADIO_WriteContig(fd->shared_fp_fd, &new_fp, sizeof(ADIO_Offset), MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code); +done: ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset)); } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_hints.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_hints.c index 0e3b7fc5a0..cd755d4a7f 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_hints.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_hints.c @@ -1,12 +1,12 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "adio.h" +#include "adio_extern.h" void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) { @@ -18,7 +18,18 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) MPI_Info info; char *value; - int flag, intval, tmp_val, nprocs; + int flag, intval, tmp_val, nprocs=0, nprocs_is_valid = 0, len; + int ok_to_override_cb_nodes=0; + static char myname[] = "ADIOI_GEN_SETINFO"; + + + /* if we've already set up default hints and the user has not asked us to + * process any hints (MPI_INFO_NULL), then we can short-circuit hint + * processing */ + if (fd->hints->initialized && fd->info == MPI_INFO_NULL) { + *error_code = MPI_SUCCESS; + return; + } if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info)); info = fd->info; @@ -36,127 +47,325 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) * previously initialized */ if (!fd->hints->initialized) { + /* buffer size for collective I/O */ - MPI_Info_set(info, "cb_buffer_size", ADIOI_CB_BUFFER_SIZE_DFLT); + ADIOI_Info_set(info, "cb_buffer_size", ADIOI_CB_BUFFER_SIZE_DFLT); fd->hints->cb_buffer_size = atoi(ADIOI_CB_BUFFER_SIZE_DFLT); /* default is to let romio automatically decide when to use * collective buffering */ - MPI_Info_set(info, "romio_cb_read", "automatic"); + ADIOI_Info_set(info, "romio_cb_read", "automatic"); fd->hints->cb_read = ADIOI_HINT_AUTO; - MPI_Info_set(info, "romio_cb_write", "automatic"); + ADIOI_Info_set(info, "romio_cb_write", "automatic"); fd->hints->cb_write = ADIOI_HINT_AUTO; fd->hints->cb_config_list = NULL; /* number of processes that perform I/O in collective I/O */ MPI_Comm_size(fd->comm, &nprocs); - sprintf(value, "%d", nprocs); - MPI_Info_set(info, "cb_nodes", value); + nprocs_is_valid = 1; + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs); + ADIOI_Info_set(info, "cb_nodes", value); fd->hints->cb_nodes = nprocs; /* hint indicating that no indep. I/O will be performed on this file */ - MPI_Info_set(info, "romio_no_indep_rw", "false"); + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); fd->hints->no_indep_rw = 0; + /* hint instructing the use of persistent file realms */ + ADIOI_Info_set(info, "romio_cb_pfr", "disable"); + fd->hints->cb_pfr = ADIOI_HINT_DISABLE; + + /* hint guiding the assignment of persistent file realms */ + ADIOI_Info_set(info, "romio_cb_fr_types", "aar"); + fd->hints->cb_fr_type = ADIOI_FR_AAR; + + /* hint to align file realms with a certain byte value */ + ADIOI_Info_set(info, "romio_cb_fr_alignment", "1"); + fd->hints->cb_fr_alignment = 1; + + /* hint to set a threshold percentage for a datatype's size/extent at + * which data sieving should be done in collective I/O */ + ADIOI_Info_set(info, "romio_cb_ds_threshold", "0"); + fd->hints->cb_ds_threshold = 0; + + /* hint to switch between point-to-point or all-to-all for two-phase */ + ADIOI_Info_set(info, "romio_cb_alltoall", "automatic"); + fd->hints->cb_alltoall = ADIOI_HINT_AUTO; + + /* deferred_open derived from no_indep_rw and cb_{read,write} */ + fd->hints->deferred_open = 0; + /* buffer size for data sieving in independent reads */ - MPI_Info_set(info, "ind_rd_buffer_size", ADIOI_IND_RD_BUFFER_SIZE_DFLT); + ADIOI_Info_set(info, "ind_rd_buffer_size", ADIOI_IND_RD_BUFFER_SIZE_DFLT); fd->hints->ind_rd_buffer_size = atoi(ADIOI_IND_RD_BUFFER_SIZE_DFLT); /* buffer size for data sieving in independent writes */ - MPI_Info_set(info, "ind_wr_buffer_size", ADIOI_IND_WR_BUFFER_SIZE_DFLT); + ADIOI_Info_set(info, "ind_wr_buffer_size", ADIOI_IND_WR_BUFFER_SIZE_DFLT); fd->hints->ind_wr_buffer_size = atoi(ADIOI_IND_WR_BUFFER_SIZE_DFLT); /* default is to let romio automatically decide when to use data * sieving */ - MPI_Info_set(info, "romio_ds_read", "automatic"); + ADIOI_Info_set(info, "romio_ds_read", "automatic"); fd->hints->ds_read = ADIOI_HINT_AUTO; - MPI_Info_set(info, "romio_ds_write", "automatic"); + ADIOI_Info_set(info, "romio_ds_write", "automatic"); fd->hints->ds_write = ADIOI_HINT_AUTO; + /* still to do: tune this a bit for a variety of file systems. there's + * no good default value so just leave it unset */ + fd->hints->min_fdomain_size = 0; + fd->hints->striping_unit = 0; + fd->hints->initialized = 1; + + /* ADIO_Open sets up collective buffering arrays. If we are in this + * path from say set_file_view, then we've don't want to adjust the + * array: we'll get a segfault during collective i/o. We only want to + * look at the users cb_nodes if it's open time */ + ok_to_override_cb_nodes = 1; + } /* add in user's info if supplied */ if (users_info != MPI_INFO_NULL) { - MPI_Info_get(users_info, "cb_buffer_size", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, &flag); if (flag && ((intval=atoi(value)) > 0)) { tmp_val = intval; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ if (tmp_val != intval) { - FPRINTF(stderr, "ADIOI_GEN_SetInfo: the value for key \"cb_buffer_size\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "cb_buffer_size", + error_code); + return; } - else { - MPI_Info_set(info, "cb_buffer_size", value); - fd->hints->cb_buffer_size = intval; + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(info, "cb_buffer_size", value); + fd->hints->cb_buffer_size = intval; + + } + /* aligning file realms to certain sizes (e.g. stripe sizes) + * may benefit I/O performance */ + ADIOI_Info_get(users_info, "romio_cb_fr_alignment", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval=atoi(value)) > 0)) { + tmp_val = intval; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != intval) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_fr_alignment", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(info, "romio_cb_fr_alignment", value); + fd->hints->cb_fr_alignment = intval; + + } + + /* for collective I/O, try to be smarter about when to do data sieving + * using a specific threshold for the datatype size/extent + * (percentage 0-100%) */ + ADIOI_Info_get(users_info, "romio_cb_ds_threshold", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval=atoi(value)) > 0)) { + tmp_val = intval; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != intval) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_ds_threshold", + error_code); + return; } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(info, "romio_cb_ds_threshold", value); + fd->hints->cb_ds_threshold = intval; + + } + ADIOI_Info_get(users_info, "romio_cb_alltoall", MPI_MAX_INFO_VAL, value, + &flag); + if (flag) { + if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { + ADIOI_Info_set(info, "romio_cb_alltoall", value); + fd->hints->cb_read = ADIOI_HINT_ENABLE; + } + else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { + ADIOI_Info_set(info, "romio_cb_alltoall", value); + fd->hints->cb_read = ADIOI_HINT_DISABLE; + } + else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(info, "romio_cb_alltoall", value); + fd->hints->cb_read = ADIOI_HINT_AUTO; + } + + tmp_val = fd->hints->cb_alltoall; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != fd->hints->cb_alltoall) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_alltoall", + error_code); + return; + } + /* --END ERROR HANDLING-- */ } /* new hints for enabling/disabling coll. buffering on * reads/writes */ - MPI_Info_get(users_info, "romio_cb_read", MPI_MAX_INFO_VAL, value, &flag); + ADIOI_Info_get(users_info, "romio_cb_read", MPI_MAX_INFO_VAL, value, + &flag); if (flag) { if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { - MPI_Info_set(info, "romio_cb_read", value); + ADIOI_Info_set(info, "romio_cb_read", value); fd->hints->cb_read = ADIOI_HINT_ENABLE; } else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { - MPI_Info_set(info, "romio_cb_read", value); + /* romio_cb_read overrides no_indep_rw */ + ADIOI_Info_set(info, "romio_cb_read", value); + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); fd->hints->cb_read = ADIOI_HINT_DISABLE; + fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; } else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) { - MPI_Info_set(info, "romio_cb_read", value); + ADIOI_Info_set(info, "romio_cb_read", value); fd->hints->cb_read = ADIOI_HINT_AUTO; } tmp_val = fd->hints->cb_read; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ if (tmp_val != fd->hints->cb_read) { - FPRINTF(stderr, "ADIOI_GEN_SetInfo: the value for key \"romio_cb_read\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_read", + error_code); + return; } + /* --END ERROR HANDLING-- */ } - MPI_Info_get(users_info, "romio_cb_write", MPI_MAX_INFO_VAL, value, &flag); + ADIOI_Info_get(users_info, "romio_cb_write", MPI_MAX_INFO_VAL, value, + &flag); if (flag) { if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { - MPI_Info_set(info, "romio_cb_write", value); + ADIOI_Info_set(info, "romio_cb_write", value); fd->hints->cb_write = ADIOI_HINT_ENABLE; } - else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { - MPI_Info_set(info, "romio_cb_write", value); + else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) + { + /* romio_cb_write overrides no_indep_rw, too */ + ADIOI_Info_set(info, "romio_cb_write", value); + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); fd->hints->cb_write = ADIOI_HINT_DISABLE; + fd->hints->no_indep_rw = ADIOI_HINT_DISABLE; } - else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + else if (!strcmp(value, "automatic") || + !strcmp(value, "AUTOMATIC")) { - MPI_Info_set(info, "romio_cb_write", value); + ADIOI_Info_set(info, "romio_cb_write", value); fd->hints->cb_write = ADIOI_HINT_AUTO; } tmp_val = fd->hints->cb_write; + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ if (tmp_val != fd->hints->cb_write) { - FPRINTF(stderr, "ADIOI_GEN_SetInfo: the value for key \"romio_cb_write\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_write", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + } + + /* enable/disable persistent file realms for collective I/O */ + /* may want to check for no_indep_rdwr hint as well */ + ADIOI_Info_get(users_info, "romio_cb_pfr", MPI_MAX_INFO_VAL, value, + &flag); + if (flag) { + if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { + ADIOI_Info_set(info, "romio_cb_pfr", value); + fd->hints->cb_pfr = ADIOI_HINT_ENABLE; + } + else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { + ADIOI_Info_set(info, "romio_cb_pfr", value); + fd->hints->cb_pfr = ADIOI_HINT_DISABLE; + } + else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) + { + ADIOI_Info_set(info, "romio_cb_pfr", value); + fd->hints->cb_pfr = ADIOI_HINT_AUTO; } + + tmp_val = fd->hints->cb_pfr; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != fd->hints->cb_pfr) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_pfr", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + } + + /* file realm assignment types ADIOI_FR_AAR(0), + ADIOI_FR_FSZ(-1), ADIOI_FR_USR_REALMS(-2), all others specify + a regular fr size in bytes. probably not the best way... */ + ADIOI_Info_get(users_info, "romio_cb_fr_type", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval=atoi(value)) >= -2)) { + tmp_val = intval; + + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != intval) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_cb_fr_type", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Info_set(info, "romio_cb_fr_type", value); + fd->hints->cb_fr_type = intval; + } /* new hint for specifying no indep. read/write will be performed */ - MPI_Info_get(users_info, "romio_no_indep_rw", MPI_MAX_INFO_VAL, value, + ADIOI_Info_get(users_info, "romio_no_indep_rw", MPI_MAX_INFO_VAL, value, &flag); if (flag) { if (!strcmp(value, "true") || !strcmp(value, "TRUE")) { - MPI_Info_set(info, "romio_no_indep_rw", value); + /* if 'no_indep_rw' set, also hint that we will do + * collective buffering: if we aren't doing independent io, + * then we have to do collective */ + ADIOI_Info_set(info, "romio_no_indep_rw", value); + ADIOI_Info_set(info, "romio_cb_write", "enable"); + ADIOI_Info_set(info, "romio_cb_read", "enable"); fd->hints->no_indep_rw = 1; + fd->hints->cb_read = 1; + fd->hints->cb_write = 1; tmp_val = 1; } else if (!strcmp(value, "false") || !strcmp(value, "FALSE")) { - MPI_Info_set(info, "romio_no_indep_rw", value); + ADIOI_Info_set(info, "romio_no_indep_rw", value); fd->hints->no_indep_rw = 0; tmp_val = 0; } @@ -164,84 +373,105 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) /* default is above */ tmp_val = 0; } + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ if (tmp_val != fd->hints->no_indep_rw) { - FPRINTF(stderr, "ADIOI_GEN_SetInfo: the value for key \"romio_no_indep_rw\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "romio_no_indep_rw", + error_code); + return; } + /* --END ERROR HANDLING-- */ } /* new hints for enabling/disabling data sieving on * reads/writes */ - MPI_Info_get(users_info, "romio_ds_read", MPI_MAX_INFO_VAL, value, + ADIOI_Info_get(users_info, "romio_ds_read", MPI_MAX_INFO_VAL, value, &flag); if (flag) { if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { - MPI_Info_set(info, "romio_ds_read", value); + ADIOI_Info_set(info, "romio_ds_read", value); fd->hints->ds_read = ADIOI_HINT_ENABLE; } else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { - MPI_Info_set(info, "romio_ds_read", value); + ADIOI_Info_set(info, "romio_ds_read", value); fd->hints->ds_read = ADIOI_HINT_DISABLE; } else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) { - MPI_Info_set(info, "romio_ds_read", value); + ADIOI_Info_set(info, "romio_ds_read", value); fd->hints->ds_read = ADIOI_HINT_AUTO; } /* otherwise ignore */ } - MPI_Info_get(users_info, "romio_ds_write", MPI_MAX_INFO_VAL, value, + ADIOI_Info_get(users_info, "romio_ds_write", MPI_MAX_INFO_VAL, value, &flag); if (flag) { if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) { - MPI_Info_set(info, "romio_ds_write", value); + ADIOI_Info_set(info, "romio_ds_write", value); fd->hints->ds_write = ADIOI_HINT_ENABLE; } else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) { - MPI_Info_set(info, "romio_ds_write", value); + ADIOI_Info_set(info, "romio_ds_write", value); fd->hints->ds_write = ADIOI_HINT_DISABLE; } else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC")) { - MPI_Info_set(info, "romio_ds_write", value); + ADIOI_Info_set(info, "romio_ds_write", value); fd->hints->ds_write = ADIOI_HINT_AUTO; } /* otherwise ignore */ } - MPI_Info_get(users_info, "cb_nodes", MPI_MAX_INFO_VAL, - value, &flag); - if (flag && ((intval=atoi(value)) > 0)) { - tmp_val = intval; - MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); - if (tmp_val != intval) { - FPRINTF(stderr, "ADIOI_GEN_SetInfo: the value for key \"cb_nodes\" must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - else { - if (intval < nprocs) { - MPI_Info_set(info, "cb_nodes", value); - fd->hints->cb_nodes = intval; - } - } - } + if (ok_to_override_cb_nodes) { + /* MPI_File_open path sets up some data structrues that don't + * get resized in the MPI_File_set_view path, so ignore + * cb_nodes in the set_view case */ + ADIOI_Info_get(users_info, "cb_nodes", MPI_MAX_INFO_VAL, + value, &flag); + if (flag && ((intval=atoi(value)) > 0)) { + tmp_val = intval; - MPI_Info_get(users_info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_val != intval) { + MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, + "cb_nodes", + error_code); + return; + } + /* --END ERROR HANDLING-- */ + + if (!nprocs_is_valid) { + /* if hints were already initialized, we might not + * have already gotten this? + */ + MPI_Comm_size(fd->comm, &nprocs); + nprocs_is_valid = 1; + } + if (intval <= nprocs) { + ADIOI_Info_set(info, "cb_nodes", value); + fd->hints->cb_nodes = intval; + } + } + } /* if (ok_to_override_cb_nodes) */ + + ADIOI_Info_get(users_info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, &flag); if (flag && ((intval = atoi(value)) > 0)) { - MPI_Info_set(info, "ind_wr_buffer_size", value); + ADIOI_Info_set(info, "ind_wr_buffer_size", value); fd->hints->ind_wr_buffer_size = intval; } - MPI_Info_get(users_info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, &flag); if (flag && ((intval = atoi(value)) > 0)) { - MPI_Info_set(info, "ind_rd_buffer_size", value); + ADIOI_Info_set(info, "ind_rd_buffer_size", value); fd->hints->ind_rd_buffer_size = intval; } - MPI_Info_get(users_info, "cb_config_list", MPI_MAX_INFO_VAL, + ADIOI_Info_get(users_info, "cb_config_list", MPI_MAX_INFO_VAL, value, &flag); if (flag) { if (fd->hints->cb_config_list == NULL) { @@ -250,43 +480,78 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code) * the cb_config_list hint will be set at file open time * either by the user or to the default */ - MPI_Info_set(info, "cb_config_list", value); - fd->hints->cb_config_list = ADIOI_Malloc((strlen(value)+1) * sizeof(char)); + ADIOI_Info_set(info, "cb_config_list", value); + len = (strlen(value)+1) * sizeof(char); + fd->hints->cb_config_list = ADIOI_Malloc(len); if (fd->hints->cb_config_list == NULL) { /* NEED TO HANDLE ENOMEM */ } - strcpy(fd->hints->cb_config_list, value); + ADIOI_Strncpy(fd->hints->cb_config_list, value, len); } /* if it has been set already, we ignore it the second time. * otherwise we would get an error if someone used the same * info value with a cb_config_list value in it in a couple * of calls, which would be irritating. */ } + ADIOI_Info_get(users_info, "romio_min_fdomain_size", MPI_MAX_INFO_VAL, + value, &flag); + if ( flag && ((intval = atoi(value)) > 0) ) { + ADIOI_Info_set(info, "romio_min_fdomain_size", value); + fd->hints->min_fdomain_size = intval; + } + /* Now we use striping unit in common code so we should + process hints for it. */ + ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, + value, &flag); + if ( flag && ((intval = atoi(value)) > 0) ) { + ADIOI_Info_set(info, "striping_unit", value); + fd->hints->striping_unit = intval; + } } /* handle cb_config_list default value here; avoids an extra * free/alloc and insures it is always set */ if (fd->hints->cb_config_list == NULL) { - MPI_Info_set(info, "cb_config_list", ADIOI_CB_CONFIG_LIST_DFLT); - fd->hints->cb_config_list = ADIOI_Malloc((strlen(ADIOI_CB_CONFIG_LIST_DFLT)+1) * sizeof(char)); + ADIOI_Info_set(info, "cb_config_list", ADIOI_CB_CONFIG_LIST_DFLT); + len = (strlen(ADIOI_CB_CONFIG_LIST_DFLT)+1) * sizeof(char); + fd->hints->cb_config_list = ADIOI_Malloc(len); if (fd->hints->cb_config_list == NULL) { /* NEED TO HANDLE ENOMEM */ } - strcpy(fd->hints->cb_config_list, ADIOI_CB_CONFIG_LIST_DFLT); + ADIOI_Strncpy(fd->hints->cb_config_list, ADIOI_CB_CONFIG_LIST_DFLT, len); + } + /* deferred_open won't be set by callers, but if the user doesn't + * explicitly disable collecitve buffering (two-phase) and does hint that + * io w/o independent io is going on, we'll set this internal hint as a + * convenience */ + if ( ( (fd->hints->cb_read != ADIOI_HINT_DISABLE) \ + && (fd->hints->cb_write != ADIOI_HINT_DISABLE)\ + && fd->hints->no_indep_rw ) ) { + fd->hints->deferred_open = 1; + } else { + /* setting romio_no_indep_rw enable and romio_cb_{read,write} + * disable at the same time doesn't make sense. honor + * romio_cb_{read,write} and force the no_indep_rw hint to + * 'disable' */ + ADIOI_Info_set(info, "romio_no_indep_rw", "false"); + fd->hints->no_indep_rw = 0; + fd->hints->deferred_open = 0; } - if ((fd->file_system == ADIO_PIOFS) || (fd->file_system == ADIO_PVFS)) { - /* no data sieving for writes in PIOFS and PVFS, because they do not + if (ADIO_Feature(fd, ADIO_DATA_SIEVING_WRITES) == 0) { + /* disable data sieving for fs that do not support file locking */ - MPI_Info_get(info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, + ADIOI_Info_get(info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, &flag); if (flag) { /* get rid of this value if it is set */ - MPI_Info_delete(info, "ind_wr_buffer_size"); + ADIOI_Info_delete(info, "ind_wr_buffer_size"); } - fd->hints->ind_wr_buffer_size = -1; - MPI_Info_set(info, "romio_ds_write", "disable"); + /* note: leave ind_wr_buffer_size alone; used for other cases + * as well. -- Rob Ross, 04/22/2003 + */ + ADIOI_Info_set(info, "romio_ds_write", "disable"); fd->hints->ds_write = ADIOI_HINT_DISABLE; } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_init.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_init.c dissimilarity index 64% index 527d27e889..3ddcd04dd7 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_init.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_init.c @@ -1,134 +1,164 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" -#include "converse.h" //For Ctv* - -CtvDeclare(ADIOI_Flatlist_node*, ADIOI_Flatlist); - -CtvDeclare(ADIOI_Async_node*, ADIOI_Async_list_head); -CtvDeclare(ADIOI_Async_node*, ADIOI_Async_list_tail); - -CtvDeclare(ADIOI_Async_node*, ADIOI_Async_avail_head); -CtvDeclare(ADIOI_Async_node*, ADIOI_Async_avail_tail); - -CtvDeclare(ADIOI_Malloc_async*, ADIOI_Malloc_async_head); -CtvDeclare(ADIOI_Malloc_async*, ADIOI_Malloc_async_tail); -// ADIOI_Async_node *ADIOI_Async_list_head, *ADIOI_Async_list_tail; - /* list of outstanding asynchronous requests */ -// ADIOI_Async_node *ADIOI_Async_avail_head, *ADIOI_Async_avail_tail; - /* list of available (already malloced) nodes for above async list */ -// ADIOI_Malloc_async *ADIOI_Malloc_async_head, *ADIOI_Malloc_async_tail; - /* list of malloced areas for async_list, which must be freed in ADIO_End */ - -CtvDeclare(ADIOI_Req_node*, ADIOI_Req_avail_head); -CtvDeclare(ADIOI_Req_node*, ADIOI_Req_avail_tail); - -CtvDeclare(ADIOI_Malloc_req*, ADIOI_Malloc_req_head); -CtvDeclare(ADIOI_Malloc_req*, ADIOI_Malloc_req_tail); -// ADIOI_Req_node *ADIOI_Req_avail_head, *ADIOI_Req_avail_tail; - /* list of available (already malloced) request objects */ -// ADIOI_Malloc_req *ADIOI_Malloc_req_head, *ADIOI_Malloc_req_tail; - /* list of malloced areas for requests, which must be freed in ADIO_End */ - -/* for f2c and c2f conversion */ -CtvDeclare(ADIO_File*, ADIOI_Ftable); -CtvDeclare(int, ADIOI_Ftable_ptr); -CtvDeclare(int, ADIOI_Ftable_max); -CtvDeclare(ADIO_Request*, ADIOI_Reqtable); -CtvDeclare(int, ADIOI_Reqtable_ptr); -CtvDeclare(int, ADIOI_Reqtable_max); -#ifndef HAVE_MPI_INFO -MPI_Info *MPIR_Infotable; -int MPIR_Infotable_ptr, MPIR_Infotable_max; -#endif - -#ifdef XFS -int ADIOI_Direct_read, ADIOI_Direct_write; -#endif - -CtvDeclare(int, ADIO_Init_keyval); //=MPI_KEYVAL_INVALID; -CtvDeclare(int, ADIO_Init_keyval_done); // accessed in open.c, delete.c - -CtvDeclare(MPI_Errhandler, ADIOI_DFLT_ERR_HANDLER); // = MPI_ERRORS_RETURN; - -void ADIO_Init(int *argc, char ***argv, int *error_code) -{ -#ifdef XFS - char *c; -#endif - CtvInitialize(ADIOI_Flatlist_node*, ADIOI_Flatlist); - - CtvInitialize(ADIOI_Async_node*, ADIOI_Async_list_head); - CtvInitialize(ADIOI_Async_node*, ADIOI_Async_list_tail); - - CtvInitialize(ADIOI_Async_node*, ADIOI_Async_avail_head); - CtvInitialize(ADIOI_Async_node*, ADIOI_Async_avail_tail); - - CtvInitialize(ADIOI_Malloc_async*, ADIOI_Malloc_async_head); - CtvInitialize(ADIOI_Malloc_async*, ADIOI_Malloc_async_tail); - - CtvInitialize(ADIOI_Req_node*, ADIOI_Req_avail_head); - CtvInitialize(ADIOI_Req_node*, ADIOI_Req_avail_tail); - - CtvInitialize(ADIOI_Malloc_req*, ADIOI_Malloc_req_head); - CtvInitialize(ADIOI_Malloc_req*, ADIOI_Malloc_req_tail); - - CtvInitialize(ADIO_File*, ADIOI_Ftable); - CtvInitialize(int, ADIOI_Ftable_ptr); - CtvInitialize(int, ADIOI_Ftable_max); - CtvInitialize(ADIO_Request*, ADIOI_Reqtable); - CtvInitialize(int, ADIOI_Reqtable_ptr); - CtvInitialize(int, ADIOI_Reqtable_max); - - CtvInitialize(int, ADIO_Init_keyval); - // ADIO_Init_keyval is initialized to MPI_KEYVAL_INVALID in open.c/delete.c - - CtvInitialize(int, ADIO_Init_keyval_done); - - CtvInitialize(MPI_Errhandler, ADIOI_DFLT_ERR_HANDLER); - CtvAccess(ADIOI_DFLT_ERR_HANDLER) = MPI_ERRORS_RETURN; - -/* initialize the linked list containing flattened datatypes */ - CtvAccess(ADIOI_Flatlist) = (ADIOI_Flatlist_node *) ADIOI_Malloc(sizeof(ADIOI_Flatlist_node)); - CtvAccess(ADIOI_Flatlist)->type = MPI_DATATYPE_NULL; - CtvAccess(ADIOI_Flatlist)->next = NULL; - CtvAccess(ADIOI_Flatlist)->blocklens = NULL; - CtvAccess(ADIOI_Flatlist)->indices = NULL; - - CtvAccess(ADIOI_Async_list_head) = CtvAccess(ADIOI_Async_list_tail) = NULL; - CtvAccess(ADIOI_Async_avail_head) = CtvAccess(ADIOI_Async_avail_tail) = NULL; - CtvAccess(ADIOI_Malloc_async_head) = CtvAccess(ADIOI_Malloc_async_tail) = NULL; - - CtvAccess(ADIOI_Req_avail_head) = CtvAccess(ADIOI_Req_avail_tail) = NULL; - CtvAccess(ADIOI_Malloc_req_head) = CtvAccess(ADIOI_Malloc_req_tail) = NULL; - - CtvAccess(ADIOI_Ftable) = NULL; - CtvAccess(ADIOI_Ftable_ptr) = CtvAccess(ADIOI_Ftable_max) = 0; - - CtvAccess(ADIOI_Reqtable) = NULL; - CtvAccess(ADIOI_Reqtable_ptr) = CtvAccess(ADIOI_Reqtable_max) = 0; - -#ifndef HAVE_MPI_INFO - MPIR_Infotable = NULL; - MPIR_Infotable_ptr = MPIR_Infotable_max = 0; -#endif - -#ifdef XFS - c = getenv("MPIO_DIRECT_READ"); - if (c && (!strcmp(c, "true") || !strcmp(c, "TRUE"))) - ADIOI_Direct_read = 1; - else ADIOI_Direct_read = 0; - c = getenv("MPIO_DIRECT_WRITE"); - if (c && (!strcmp(c, "true") || !strcmp(c, "TRUE"))) - ADIOI_Direct_write = 1; - else ADIOI_Direct_write = 0; -#endif - - *error_code = MPI_SUCCESS; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "converse.h" //For Ctv* + +CtvDeclare(ADIOI_Flatlist_node*, ADIOI_Flatlist); +CtvDeclare(ADIOI_Datarep *, ADIOI_Datarep_head); + /* list of datareps registered by the user */ + +/* for f2c and c2f conversion */ +CtvDeclare(ADIO_File *, ADIOI_Ftable); +CtvDeclare(int, ADIOI_Ftable_ptr); +CtvDeclare(int, ADIOI_Ftable_max); +CtvDeclare(ADIO_Request *, ADIOI_Reqtable); +CtvDeclare(int, ADIOI_Reqtable_ptr); +CtvDeclare(int, ADIOI_Reqtable_max); +#ifndef HAVE_MPI_INFO +MPI_Info *MPIR_Infotable = NULL; +int MPIR_Infotable_ptr = 0, MPIR_Infotable_max = 0; +#endif + +CtvDeclare(MPI_Info, ADIOI_syshints); + +CtvDeclare(MPI_Op, ADIO_same_amode); + +#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) +int ADIOI_Direct_read = 0, ADIOI_Direct_write = 0; +#endif + +CtvDeclare(int, ADIO_Init_keyval); + +CtvDeclare(MPI_Errhandler, ADIOI_DFLT_ERR_HANDLER); + + +static void my_consensus(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype) +{ + int i, *in, *inout; + in = (int*)invec; + inout = (int*)inoutvec; + + for (i=0; i< *len; i++) { + if (in[i] != inout[i]) + inout[i] = ADIO_AMODE_NOMATCH; + } + return; +} + +void ADIO_Init(int *argc, char ***argv, int *error_code) +{ +#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) + char *c; +#endif + + ADIOI_UNREFERENCED_ARG(argc); + ADIOI_UNREFERENCED_ARG(argv); + + CtvInitialize(ADIOI_Flatlist_node*, ADIOI_Flatlist); + CtvInitialize(ADIOI_Datarep *, ADIOI_Datarep_head); + CtvInitialize(ADIO_File *, ADIOI_Ftable); + CtvInitialize(int, ADIOI_Ftable_ptr); + CtvInitialize(int, ADIOI_Ftable_max); + CtvInitialize(ADIO_Request *, ADIOI_Reqtable); + CtvInitialize(int, ADIOI_Reqtable_ptr); + CtvInitialize(int, ADIOI_Reqtable_max); + CtvInitialize(MPI_Info, ADIOI_syshints); + CtvInitialize(MPI_Op, ADIO_same_amode); + CtvInitialize(int, ADIO_Init_keyval); + CtvInitialize(MPI_Errhandler, ADIOI_DFLT_ERR_HANDLER); + + CtvAccess(ADIOI_Flatlist) = NULL; + CtvAccess(ADIOI_Datarep_head) = NULL; + CtvAccess(ADIOI_Ftable) = NULL; + CtvAccess(ADIOI_Ftable_ptr) = 0; + CtvAccess(ADIOI_Ftable_max) = 0; + CtvAccess(ADIOI_Reqtable) = NULL; + CtvAccess(ADIOI_Reqtable_ptr) = 0; + CtvAccess(ADIOI_Reqtable_max) = 0; + CtvAccess(ADIOI_syshints) = MPI_INFO_NULL; + CtvAccess(ADIO_same_amode) = MPI_OP_NULL; + CtvAccess(ADIO_Init_keyval) = MPI_KEYVAL_INVALID; + CtvAccess(ADIOI_DFLT_ERR_HANDLER) = MPI_ERRORS_RETURN; + +/* initialize the linked list containing flattened datatypes */ + CtvAccess(ADIOI_Flatlist) = (ADIOI_Flatlist_node *) ADIOI_Malloc(sizeof(ADIOI_Flatlist_node)); + CtvAccess(ADIOI_Flatlist)->type = MPI_DATATYPE_NULL; + CtvAccess(ADIOI_Flatlist)->next = NULL; + CtvAccess(ADIOI_Flatlist)->blocklens = NULL; + CtvAccess(ADIOI_Flatlist)->indices = NULL; + +#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) + c = getenv("MPIO_DIRECT_READ"); + if (c && (!strcmp(c, "true") || !strcmp(c, "TRUE"))) + ADIOI_Direct_read = 1; + else ADIOI_Direct_read = 0; + c = getenv("MPIO_DIRECT_WRITE"); + if (c && (!strcmp(c, "true") || !strcmp(c, "TRUE"))) + ADIOI_Direct_write = 1; + else ADIOI_Direct_write = 0; +#endif + + /* Assume system-wide hints won't change between runs: move hint processing + * from ADIO_Open to here */ + /* FIXME should be checking error code from MPI_Info_create here */ + MPI_Info_create(&CtvAccess(ADIOI_syshints)); + ADIOI_process_system_hints(CtvAccess(ADIOI_syshints)); + +#ifdef ADIOI_MPE_LOGGING + { + MPE_Log_get_state_eventIDs( &ADIOI_MPE_open_a, &ADIOI_MPE_open_b ); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_read_a, &ADIOI_MPE_read_b ); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_write_a, &ADIOI_MPE_write_b ); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_lseek_a, &ADIOI_MPE_lseek_b ); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_close_a, &ADIOI_MPE_close_b ); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_writelock_a, + &ADIOI_MPE_writelock_b ); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_readlock_a, + &ADIOI_MPE_readlock_b ); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_unlock_a, &ADIOI_MPE_unlock_b ); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_postwrite_a, + &ADIOI_MPE_postwrite_b ); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_openinternal_a, + &ADIOI_MPE_openinternal_b); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_stat_a, &ADIOI_MPE_stat_b); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_iread_a, &ADIOI_MPE_iread_b); + MPE_Log_get_state_eventIDs( &ADIOI_MPE_iwrite_a, &ADIOI_MPE_iwrite_b); + + int comm_world_rank; + MPI_Comm_rank( MPI_COMM_WORLD, &comm_world_rank ); + + if ( comm_world_rank == 0 ) { + MPE_Describe_state( ADIOI_MPE_open_a, ADIOI_MPE_open_b, + "open", "orange" ); + MPE_Describe_state( ADIOI_MPE_read_a, ADIOI_MPE_read_b, + "read", "green" ); + MPE_Describe_state( ADIOI_MPE_write_a, ADIOI_MPE_write_b, + "write", "blue" ); + MPE_Describe_state( ADIOI_MPE_lseek_a, ADIOI_MPE_lseek_b, + "lseek", "red" ); + MPE_Describe_state( ADIOI_MPE_close_a, ADIOI_MPE_close_b, + "close", "grey" ); + MPE_Describe_state( ADIOI_MPE_writelock_a, ADIOI_MPE_writelock_b, + "writelock", "plum" ); + MPE_Describe_state( ADIOI_MPE_readlock_a, ADIOI_MPE_readlock_b, + "readlock", "magenta" ); + MPE_Describe_state( ADIOI_MPE_unlock_a, ADIOI_MPE_unlock_b, + "unlock", "purple" ); + MPE_Describe_state( ADIOI_MPE_postwrite_a, ADIOI_MPE_postwrite_b, + "postwrite", "ivory" ); + MPE_Describe_state( ADIOI_MPE_openinternal_a, ADIOI_MPE_openinternal_b, "open system", "blue"); + MPE_Describe_state( ADIOI_MPE_stat_a, ADIOI_MPE_stat_b, "stat", "purple"); + MPE_Describe_state( ADIOI_MPE_iread_a, ADIOI_MPE_iread_b, "iread", "purple"); + MPE_Describe_state( ADIOI_MPE_iwrite_a, ADIOI_MPE_iwrite_b, "iwrite", "purple"); + } + } +#endif + + *error_code = MPI_SUCCESS; + MPI_Op_create(my_consensus, 1, &CtvAccess(ADIO_same_amode)); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_io_coll.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_io_coll.c new file mode 100644 index 0000000000..3452db0fa0 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_io_coll.c @@ -0,0 +1,1131 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "assert.h" +#include "adio.h" +#include "adio_extern.h" +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +/* #define ALLTOALL */ + +/* #define DEBUG */ +/* #define DEBUG2 */ /* print buffers */ + +#define USE_PRE_REQ + +static void Exch_data_amounts (ADIO_File fd, int nprocs, + ADIO_Offset *client_comm_sz_arr, + ADIO_Offset *agg_comm_sz_arr, + int *client_alltoallw_counts, + int *agg_alltoallw_counts, + int *aggregators_done); +static void post_aggregator_comm (MPI_Comm comm, int rw_type, int nproc, + void *cb_buf, + MPI_Datatype *client_comm_dtype_arr, + ADIO_Offset *client_comm_sz_arr, + MPI_Request **requests, + int *aggregators_client_count_p); + +static void post_client_comm (ADIO_File fd, int rw_type, + int agg_rank, void *buf, + MPI_Datatype agg_comm_dtype, + int agg_alltoallw_count, + MPI_Request *request); + +/* Avery Ching and Kenin Columa's reworked two-phase algorithm. Key features + * - persistent file domains + * - an option to use alltoall instead of point-to-point + */ +void ADIOI_IOStridedColl (ADIO_File fd, void *buf, int count, int rdwr, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + ADIO_Offset min_st_offset=0, max_end_offset=0; + ADIO_Offset st_end_offset[2]; + ADIO_Offset *all_st_end_offsets = NULL; + int filetype_is_contig, buftype_is_contig, is_contig; + ADIO_Offset orig_fp, off; + int interleave_count = 0, i, nprocs, myrank, nprocs_for_coll; + int cb_enable; + ADIO_Offset bufsize; + MPI_Aint extent, bufextent; + int size; + int agg_rank; + + ADIO_Offset agg_disp; /* aggregated file offset */ + MPI_Datatype agg_dtype; /* aggregated file datatype */ + + int aggregators_done = 0; + ADIO_Offset buffered_io_size = 0; + + int *alltoallw_disps; + + int *alltoallw_counts; + int *client_alltoallw_counts; + int *agg_alltoallw_counts; + + char *cb_buf = NULL; + + MPI_Datatype *client_comm_dtype_arr; /* aggregator perspective */ + MPI_Datatype *agg_comm_dtype_arr; /* client perspective */ + ADIO_Offset *client_comm_sz_arr; /* aggregator perspective */ + ADIO_Offset *agg_comm_sz_arr; /* client perspective */ + + /* file views for each client and aggregator */ + view_state *client_file_view_state_arr = NULL; + view_state *agg_file_view_state_arr = NULL; + /* mem views for local process */ + view_state *my_mem_view_state_arr = NULL; + + MPI_Status *agg_comm_statuses = NULL; + MPI_Request *agg_comm_requests = NULL; + MPI_Status *client_comm_statuses = NULL; + MPI_Request *client_comm_requests = NULL; + int aggs_client_count = 0; + int clients_agg_count = 0; + + MPI_Comm_size (fd->comm, &nprocs); + MPI_Comm_rank (fd->comm, &myrank); +#ifdef DEBUG + fprintf (stderr, "p%d: entering ADIOI_IOStridedColl\n", myrank); +#endif +#ifdef AGGREGATION_PROFILE + if (rdwr == ADIOI_READ) + MPE_Log_event (5010, 0, NULL); + else + MPE_Log_event (5012, 0, NULL); +#endif + + /* I need to check if there are any outstanding nonblocking writes + to the file, which could potentially interfere with the writes + taking place in this collective write call. Since this is not + likely to be common, let me do the simplest thing possible here: + Each process completes all pending nonblocking operations before + completing. */ + + nprocs_for_coll = fd->hints->cb_nodes; + orig_fp = fd->fp_ind; + + if (rdwr == ADIOI_READ) + cb_enable = fd->hints->cb_read; + else + cb_enable = fd->hints->cb_write; + + /* only check for interleaving if cb_read isn't disabled */ + if (cb_enable != ADIOI_HINT_DISABLE) { + /* find the starting and ending byte of my I/O access */ + ADIOI_Calc_bounds (fd, count, datatype, file_ptr_type, offset, + &st_end_offset[0], &st_end_offset[1]); + + /* allocate an array of start/end pairs */ + all_st_end_offsets = (ADIO_Offset *) + ADIOI_Malloc (2*nprocs*sizeof(ADIO_Offset)); + MPI_Allgather (st_end_offset, 2, ADIO_OFFSET, all_st_end_offsets, 2, + ADIO_OFFSET, fd->comm); + + min_st_offset = all_st_end_offsets[0]; + max_end_offset = all_st_end_offsets[1]; + + for (i=1; ifiletype, &filetype_is_contig); + + if ((cb_enable == ADIOI_HINT_DISABLE + || (!interleave_count && (cb_enable == ADIOI_HINT_AUTO))) + && (fd->hints->cb_pfr != ADIOI_HINT_ENABLE)){ + if (cb_enable != ADIOI_HINT_DISABLE) { + ADIOI_Free (all_st_end_offsets); + } + + if (buftype_is_contig && filetype_is_contig) { + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + (fd->etype_size) * offset; + if (rdwr == ADIOI_READ) + ADIO_ReadContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, off, status, + error_code); + else + ADIO_WriteContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, off, status, + error_code); + } + else { + if (rdwr == ADIOI_READ) + ADIO_ReadContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, + 0, status, error_code); + else + ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, + 0, status, error_code); + } + } + else { + if (rdwr == ADIOI_READ) + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, + offset, status, error_code); + else + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, + offset, status, error_code); + } + return; + } + + MPI_Type_extent(datatype, &extent); + bufextent = extent * count; + MPI_Type_size(datatype, &size); + bufsize = size * count; + + /* Calculate file realms */ + if ((fd->hints->cb_pfr != ADIOI_HINT_ENABLE) || + (fd->file_realm_types == NULL)) + ADIOI_Calc_file_realms (fd, min_st_offset, max_end_offset); + + my_mem_view_state_arr = (view_state *) + ADIOI_Calloc (1, nprocs * sizeof(view_state)); + agg_file_view_state_arr = (view_state *) + ADIOI_Calloc (1, nprocs * sizeof(view_state)); + client_comm_sz_arr = (ADIO_Offset *) + ADIOI_Calloc (1, nprocs * sizeof(ADIO_Offset)); + + if (fd->is_agg) { + client_file_view_state_arr = (view_state *) + ADIOI_Calloc (1, nprocs * sizeof(view_state)); + } + else { + client_file_view_state_arr = NULL; + } + + /* Alltoallw doesn't like a null array even if the counts are + * zero. If you do not include this code, it will fail. */ + client_comm_dtype_arr = (MPI_Datatype *) + ADIOI_Calloc (1, nprocs * sizeof(MPI_Datatype)); + if (!fd->is_agg) + for (i = 0; i < nprocs; i++) + client_comm_dtype_arr[i] = MPI_BYTE; + + ADIOI_Exch_file_views (myrank, nprocs, file_ptr_type, fd, count, + datatype, offset, my_mem_view_state_arr, + agg_file_view_state_arr, + client_file_view_state_arr); + + agg_comm_sz_arr = (ADIO_Offset *) + ADIOI_Calloc (1, nprocs * sizeof(ADIO_Offset)); + agg_comm_dtype_arr = (MPI_Datatype *) + ADIOI_Malloc (nprocs * sizeof(MPI_Datatype)); + if (fd->is_agg) { + ADIOI_Build_agg_reqs (fd, rdwr, nprocs, + client_file_view_state_arr, + client_comm_dtype_arr, + client_comm_sz_arr, + &agg_disp, + &agg_dtype); + buffered_io_size = 0; + for (i=0; i 0) + buffered_io_size += client_comm_sz_arr[i]; + } + } +#ifdef USE_PRE_REQ + else + { + /* Example use of ADIOI_Build_client_pre_req. to an + * appropriate section */ + + for (i = 0; i < fd->hints->cb_nodes; i++) + { + agg_rank = fd->hints->ranklist[(i+myrank)%fd->hints->cb_nodes]; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5040, 0, NULL); +#endif + ADIOI_Build_client_pre_req( + fd, agg_rank, (i+myrank)%fd->hints->cb_nodes, + &(my_mem_view_state_arr[agg_rank]), + &(agg_file_view_state_arr[agg_rank]), + 2*1024*1024, + 64*1024); +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5041, 0, NULL); +#endif + } + } +#endif + + + if (fd->is_agg) + cb_buf = (char *) ADIOI_Malloc (fd->hints->cb_buffer_size); + alltoallw_disps = (int *) ADIOI_Calloc (nprocs, sizeof(int)); + alltoallw_counts = client_alltoallw_counts = (int *) + ADIOI_Calloc (2*nprocs, sizeof(int)); + agg_alltoallw_counts = &alltoallw_counts[nprocs]; + + if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { + /* aggregators pre-post all Irecv's for incoming data from clients */ + if ((fd->is_agg) && (rdwr == ADIOI_WRITE)) + post_aggregator_comm(fd->comm, rdwr, nprocs, cb_buf, + client_comm_dtype_arr, + client_comm_sz_arr, + &agg_comm_requests, + &aggs_client_count); + } + /* Aggregators send amounts for data requested to clients */ + Exch_data_amounts (fd, nprocs, client_comm_sz_arr, agg_comm_sz_arr, + client_alltoallw_counts, agg_alltoallw_counts, + &aggregators_done); + +#ifdef DEBUG + fprintf (stderr, "client_alltoallw_counts[ "); + for (i=0; ihints->cb_alltoall == ADIOI_HINT_DISABLE) { + /* clients should build datatypes for local memory locations + for data communication with aggregators and post + communication as the datatypes are built */ + + client_comm_requests = (MPI_Request *) + ADIOI_Calloc (fd->hints->cb_nodes, sizeof(MPI_Request)); + + for (i = 0; i < fd->hints->cb_nodes; i++) + { + clients_agg_count = 0; + agg_rank = fd->hints->ranklist[(i+myrank)%fd->hints->cb_nodes]; + if (agg_comm_sz_arr[agg_rank] > 0) { + ADIOI_Build_client_req(fd, agg_rank, + (i+myrank)%fd->hints->cb_nodes, + &(my_mem_view_state_arr[agg_rank]), + &(agg_file_view_state_arr[agg_rank]), + agg_comm_sz_arr[agg_rank], + &(agg_comm_dtype_arr[agg_rank])); + +#ifdef AGGREGATION_PROFILE + if (i == 0) + MPE_Log_event (5038, 0, NULL); +#endif + post_client_comm (fd, rdwr, agg_rank, buf, + agg_comm_dtype_arr[agg_rank], + agg_alltoallw_counts[agg_rank], + &client_comm_requests[clients_agg_count]); + clients_agg_count++; + } + } +#ifdef AGGREGATION_PROFILE + if (!clients_agg_count) + MPE_Log_event(5039, 0, NULL); +#endif + + if (rdwr == ADIOI_READ) { + if (fd->is_agg && buffered_io_size) { + ADIOI_IOFiletype (fd, cb_buf, buffered_io_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, + ADIOI_READ, status, error_code); + if (*error_code != MPI_SUCCESS) return; + MPI_Type_free (&agg_dtype); + } + +#ifdef DEBUG + fprintf (stderr, "expecting from [agg](disp,size,cnt)="); + for (i=0; i < nprocs; i++) { + MPI_Type_size (agg_comm_dtype_arr[i], &size); + fprintf (stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], + size, agg_alltoallw_counts[i]); + if (i != nprocs - 1) + fprintf(stderr, ","); + } + fprintf (stderr, "]\n"); + if (fd->is_agg) { + fprintf (stderr, "sending to [client](disp,size,cnt)="); + for (i=0; i < nprocs; i++) { + if (fd->is_agg) + MPI_Type_size (client_comm_dtype_arr[i], &size); + else + size = -1; + + fprintf (stderr, "[%d](%d,%d,%d)", i, alltoallw_disps[i], + size, client_alltoallw_counts[i]); + if (i != nprocs - 1) + fprintf(stderr, ","); + } + fprintf (stderr,"\n"); + } + fflush (NULL); +#endif + /* aggregators post all Isends for outgoing data to clients */ + if (fd->is_agg) + post_aggregator_comm(fd->comm, rdwr, nprocs, cb_buf, + client_comm_dtype_arr, + client_comm_sz_arr, + &agg_comm_requests, + &aggs_client_count); + + if (fd->is_agg && aggs_client_count) { + agg_comm_statuses = ADIOI_Malloc(aggs_client_count * + sizeof(MPI_Status)); + MPI_Waitall(aggs_client_count, agg_comm_requests, + agg_comm_statuses); +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5033, 0, NULL); +#endif + ADIOI_Free (agg_comm_requests); + ADIOI_Free (agg_comm_statuses); + } + + if (clients_agg_count) { + client_comm_statuses = ADIOI_Malloc(clients_agg_count * + sizeof(MPI_Status)); + MPI_Waitall(clients_agg_count, client_comm_requests, + client_comm_statuses); +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5039, 0, NULL); +#endif + ADIOI_Free (client_comm_requests); + ADIOI_Free (client_comm_statuses); + } + +#ifdef DEBUG2 + fprintf (stderr, "buffered_io_size = %lld\n", buffered_io_size); + if (fd->is_agg && buffered_io_size) { + fprintf (stderr, "buf = ["); + for (i=0; iis_agg && buffered_io_size) { + assert (aggs_client_count != 0); + /* make sure we actually have the data to write out */ + agg_comm_statuses = (MPI_Status *) + ADIOI_Malloc (aggs_client_count*sizeof(MPI_Status)); + + MPI_Waitall (aggs_client_count, agg_comm_requests, + agg_comm_statuses); +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5033, 0, NULL); +#endif + ADIOI_Free (agg_comm_requests); + ADIOI_Free (agg_comm_statuses); +#ifdef DEBUG2 + fprintf (stderr, "cb_buf = ["); + for (i=0; iis_agg && buffered_io_size) { + ADIOI_IOFiletype (fd, cb_buf, buffered_io_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, + ADIOI_READ, status, error_code); + if (*error_code != MPI_SUCCESS) return; + MPI_Type_free (&agg_dtype); + } + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5032, 0, NULL); +#endif + MPI_Alltoallw (cb_buf, client_alltoallw_counts, alltoallw_disps, + client_comm_dtype_arr, + buf, agg_alltoallw_counts , alltoallw_disps, + agg_comm_dtype_arr, + fd->comm); +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5033, 0, NULL); +#endif + } + else { /* Write Case */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5032, 0, NULL); +#endif + MPI_Alltoallw (buf, agg_alltoallw_counts, alltoallw_disps, + agg_comm_dtype_arr, + cb_buf, client_alltoallw_counts, alltoallw_disps, + client_comm_dtype_arr, + fd->comm); +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5033, 0, NULL); +#endif + if (fd->is_agg && buffered_io_size) { + ADIOI_IOFiletype (fd, cb_buf, buffered_io_size, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, agg_disp, agg_dtype, + ADIOI_WRITE, status, error_code); + if (*error_code != MPI_SUCCESS) return; + MPI_Type_free (&agg_dtype); + } + } + } + + /* Free (uncommit) datatypes for reuse */ + if (fd->is_agg) { + if (buffered_io_size > 0) { + for (i=0; i 0) + MPI_Type_free (&client_comm_dtype_arr[i]); + } + } + } + for (i=0; i 0) + MPI_Type_free (&agg_comm_dtype_arr[i]); + } + + /* figure out next set up requests */ + if (fd->is_agg) { + ADIOI_Build_agg_reqs (fd, rdwr, nprocs, + client_file_view_state_arr, + client_comm_dtype_arr, + client_comm_sz_arr, + &agg_disp, + &agg_dtype); + buffered_io_size = 0; + for (i=0; i 0) + buffered_io_size += client_comm_sz_arr[i]; + } + } +#ifdef USE_PRE_REQ + else { + /* Example use of ADIOI_Build_client_pre_req. to an + * appropriate section */ + for (i = 0; i < fd->hints->cb_nodes; i++) + { + agg_rank = fd->hints->ranklist[(i+myrank)%fd->hints->cb_nodes]; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5040, 0, NULL); +#endif + ADIOI_Build_client_pre_req( + fd, agg_rank, (i+myrank)%fd->hints->cb_nodes, + &(my_mem_view_state_arr[agg_rank]), + &(agg_file_view_state_arr[agg_rank]), + 2*1024*1024, + 64*1024); +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5041, 0, NULL); +#endif + } + } +#endif + + /* aggregators pre-post all Irecv's for incoming data from + * clients. if nothing is needed, agg_comm_requests is not + * allocated */ + if (fd->hints->cb_alltoall == ADIOI_HINT_DISABLE) { + if ((fd->is_agg) && (rdwr == ADIOI_WRITE)) + post_aggregator_comm(fd->comm, rdwr, nprocs, cb_buf, + client_comm_dtype_arr, + client_comm_sz_arr, + &agg_comm_requests, + &aggs_client_count); + } + + /* Aggregators send amounts for data requested to clients */ + Exch_data_amounts (fd, nprocs, client_comm_sz_arr, agg_comm_sz_arr, + client_alltoallw_counts, agg_alltoallw_counts, + &aggregators_done); + + } + + /* Clean up */ + + if (fd->hints->cb_pfr != ADIOI_HINT_ENABLE) { + /* AAR, FSIZE, and User provided uniform File realms */ + if (1) { + ADIOI_Delete_flattened (fd->file_realm_types[0]); + MPI_Type_free (&fd->file_realm_types[0]); + } + else { + for (i=0; ihints->cb_nodes; i++) { + ADIOI_Datatype_iscontig(fd->file_realm_types[i], &is_contig); + if (!is_contig) + ADIOI_Delete_flattened(fd->file_realm_types[i]); + MPI_Type_free (&fd->file_realm_types[i]); + } + } + ADIOI_Free (fd->file_realm_types); + ADIOI_Free (fd->file_realm_st_offs); + } + + /* This memtype must be deleted from the ADIOI_Flatlist or else it + * will match incorrectly with other datatypes which use this + * pointer. */ + ADIOI_Delete_flattened(datatype); + ADIOI_Delete_flattened(fd->filetype); + + if (fd->is_agg) { + if (buffered_io_size > 0) + MPI_Type_free (&agg_dtype); + for (i=0; iindices); + ADIOI_Free (client_file_view_state_arr[i].flat_type_p->blocklens); + ADIOI_Free (client_file_view_state_arr[i].flat_type_p); + } + ADIOI_Free (client_file_view_state_arr); + ADIOI_Free (cb_buf); + } + for (i = 0; i 0) + MPI_Type_free (&agg_comm_dtype_arr[i]); + + ADIOI_Free (client_comm_sz_arr); + ADIOI_Free (client_comm_dtype_arr); + ADIOI_Free (my_mem_view_state_arr); + ADIOI_Free (agg_file_view_state_arr); + ADIOI_Free (agg_comm_sz_arr); + ADIOI_Free (agg_comm_dtype_arr); + ADIOI_Free (alltoallw_disps); + ADIOI_Free (alltoallw_counts); + ADIOI_Free (all_st_end_offsets); + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); + /* This is a temporary way of filling in status. The right way is + * to keep track of how much data was actually read and placed in + * buf during collective I/O. */ +#endif + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef AGGREGATION_PROFILE + if (rdwr == ADIOI_READ) + MPE_Log_event (5011, 0, NULL); + else + MPE_Log_event (5013, 0, NULL); +#endif +} + + +/* Some of this code is from the old Calc_my_off_len() function. + * It calculates the 1st and last byte accessed */ +void ADIOI_Calc_bounds (ADIO_File fd, int count, MPI_Datatype buftype, + int file_ptr_type, ADIO_Offset offset, + ADIO_Offset *st_offset, ADIO_Offset *end_offset) +{ + int filetype_size, buftype_size, etype_size; + int i, sum; + MPI_Aint filetype_extent; + ADIO_Offset total_io; + int filetype_is_contig; + int remainder; + ADIOI_Flatlist_node *flat_file; + + ADIO_Offset st_byte_off, end_byte_off; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5000, 0, NULL); +#endif + + if (!count) { + /* Max signed positive value for ADIO_Offset + * (arch. dependent?). is there a better way? */ + memset (st_offset, 8, sizeof(ADIO_Offset)); + *st_offset = *st_offset / 2; + *end_offset = -1; + return; + } + + ADIOI_Datatype_iscontig (fd->filetype, &filetype_is_contig); + + MPI_Type_size (fd->filetype, &filetype_size); + MPI_Type_extent (fd->filetype, &filetype_extent); + MPI_Type_size (fd->etype, &etype_size); + MPI_Type_size (buftype, &buftype_size); + + total_io = buftype_size * count; + + if (filetype_is_contig) { + if (file_ptr_type == ADIO_INDIVIDUAL) + st_byte_off = fd->fp_ind; + else + st_byte_off = fd->disp + etype_size * offset; + + end_byte_off = st_byte_off + total_io - 1; + } + else { + flat_file = CtvAccess(ADIOI_Flatlist); + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + + /* we need to take care of some weirdness since fd->fp_ind + points at an accessible byte in file. the first accessible + byte in the file is not necessarily the first byte, nor is + it necessarily the first off/len pair in the filetype. */ + if (file_ptr_type == ADIO_INDIVIDUAL) { + st_byte_off = fd->fp_ind; + /* find end byte of I/O (may be in middle of an etype) */ + + /* calculate byte starting point of first filetype */ + end_byte_off = (ADIO_Offset) + ((fd->fp_ind - fd->disp - flat_file->indices[0]) / + filetype_extent) * filetype_extent + fd->disp + + flat_file->indices[0]; + /* number of absolute bytes into first filetype */ + remainder = (fd->fp_ind - fd->disp - flat_file->indices[0]) % + filetype_extent; + if (remainder) { + /* find how many file viewable bytes into first filetype */ + sum = 0; + for (i=0; icount; i++) { + sum += flat_file->blocklens[i]; + if ((flat_file->indices[i] - flat_file->indices[0] + + flat_file->blocklens[i]) >= remainder) { + sum -= (flat_file->blocklens[i] - (sum - remainder)); + break; + } + } + total_io += sum; + } + /* byte starting point of last filetype */ + end_byte_off += (total_io - 1) / filetype_size * filetype_extent; + /* number of bytes into last filetype */ + remainder = total_io % filetype_size; + if (!remainder) { + for (i=flat_file->count - 1; i>=0; i--) { + if (flat_file->blocklens[i]) break; + } + assert (i > -1); + end_byte_off += flat_file->indices[i] + + flat_file->blocklens[i] - 1; + end_byte_off -= flat_file->indices[0]; + } + else { + sum = 0; + for (i=0; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum >= remainder) { + end_byte_off += flat_file->indices[i] + + flat_file->blocklens[i] - sum + remainder - 1; + break; + } + } + end_byte_off -= flat_file->indices[0]; + } + } + else { + /* find starting byte of I/O (must be aligned with an etype) */ + /* byte starting point of starting filetype */ + st_byte_off = fd->disp + ((offset * etype_size) / filetype_size) * + filetype_extent; + /* number of file viewable bytes into starting filetype */ + remainder = (etype_size * offset) % filetype_size; + + sum = 0; + for (i=0; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum >= remainder) { + if (sum == remainder) + st_byte_off += flat_file->indices[i+1]; + else + st_byte_off += flat_file->indices[i] + + flat_file->blocklens[i] - sum + remainder; + break; + } + } + + /* find end byte of I/O (may be in middle of an etype) */ + /* byte starting point of last filetype */ + end_byte_off = fd->disp + (offset * etype_size + total_io) / + filetype_size * filetype_extent; + /* number of bytes into last filetype */ + remainder = (offset * etype_size + total_io) % filetype_size; + + if (!remainder) { + /* the last non-zero off/len pair */ + for (i=flat_file->count-1; i>=0; i--) { + if (flat_file->blocklens[i]) break; + } + assert (i >= 0); + /* back up a whole filetype, and put back up to the + * last byte of the last non-zero offlen pair */ + /* end_byte_off = (end_byte_off - filetype_extent) + + flat_file->indices[i] + + flat_file->blocklens[i] - 1; */ + /* equivalent of above commented out equation */ + end_byte_off -= filetype_extent - flat_file->indices[i] - + flat_file->blocklens[i] + 1; + } + else { + sum = 0; + for (i=0; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum >= remainder) { + end_byte_off += flat_file->indices[i] + + flat_file->blocklens[i] - sum + remainder - 1; + break; + } + } + } + } + } + + *st_offset = st_byte_off; + *end_offset = end_byte_off; +#ifdef DEBUG + printf ("st_offset = %lld\nend_offset = %lld\n", + st_byte_off, end_byte_off); +#endif +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5001, 0, NULL); +#endif +} + +/* wrapper function for ADIO_WriteStrided and ADIO_ReadStrided. Used + * by new 2 phase code to pass an arbitrary file type directly to + * WriteStrided call without affecting existing code. For the new 2 + * phase code, we really only need to set a custom_ftype, and we can + * assume that this uses MPI_BYTE for the etype, and disp is 0 */ +void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Datatype custom_ftype, + int rdwr, ADIO_Status *status, int *error_code) +{ + MPI_Datatype user_filetype; + MPI_Datatype user_etype; + ADIO_Offset user_disp; + int user_ind_wr_buffer_size; + int user_ind_rd_buffer_size; + int f_is_contig, m_is_contig; + int user_ds_read, user_ds_write; + MPI_Aint f_extent; + int f_size; + int f_ds_percent; /* size/extent */ + +#ifdef AGGREGATION_PROFILE + if (rdwr == ADIOI_READ) + MPE_Log_event(5006, 0, NULL); + else + MPE_Log_event(5008, 0, NULL); +#endif + MPI_Type_extent(custom_ftype, &f_extent); + MPI_Type_size(custom_ftype, &f_size); + f_ds_percent = 100 * f_size / f_extent; + + /* temporarily store file view information */ + user_filetype = fd->filetype; + user_etype = fd->etype; + user_disp = fd->disp; + user_ds_read = fd->hints->ds_read; + user_ds_write = fd->hints->ds_write; + /* temporarily override the independent I/O datasieve buffer size */ + user_ind_wr_buffer_size = fd->hints->ind_wr_buffer_size; + user_ind_rd_buffer_size = fd->hints->ind_rd_buffer_size; + + /* set new values for temporary file view */ + fd->filetype = custom_ftype; + fd->etype = MPI_BYTE; + /* set new values for independent I/O datasieve buffer size */ + fd->hints->ind_wr_buffer_size = fd->hints->cb_buffer_size; + fd->hints->ind_rd_buffer_size = fd->hints->cb_buffer_size; + /* decide whether or not to do datasieving */ +#ifdef DEBUG + printf ("f_ds_percent = %d cb_ds_threshold = %d\n", f_ds_percent, + fd->hints->cb_ds_threshold); +#endif + if (f_ds_percent >= fd->hints->cb_ds_threshold) { + fd->hints->ds_read = ADIOI_HINT_ENABLE; + fd->hints->ds_write = ADIOI_HINT_ENABLE; + } + else { + fd->hints->ds_read = ADIOI_HINT_DISABLE; + fd->hints->ds_write = ADIOI_HINT_DISABLE; + } + + /* flatten the new filetype since the strided calls expect it to + * have been flattened in set file view. in the two phase code, + * the datatype passed down should always be MPI_BYTE, and + * therefore contiguous, but just for completeness sake, we'll + * check the memory datatype anyway */ + ADIOI_Datatype_iscontig(custom_ftype, &f_is_contig); + ADIOI_Datatype_iscontig(datatype, &m_is_contig); + if (!f_is_contig) + ADIOI_Flatten_datatype (custom_ftype); + + /* make appropriate Read/Write calls. Let ROMIO figure out file + * system specific stuff. */ + if (f_is_contig && m_is_contig) { + fd->disp = 0; + if (rdwr == ADIOI_READ) + ADIO_ReadContig(fd, buf, count, datatype, file_ptr_type, offset, + status, error_code); + else + ADIO_WriteContig(fd, buf, count, datatype, file_ptr_type, offset, + status, error_code); + } + else { + fd->disp = offset; + if (rdwr == ADIOI_READ) + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, 0, + status, error_code); + else + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, 0, + status, error_code); + } + + /* Delete flattened temporary filetype */ + if (!f_is_contig) + ADIOI_Delete_flattened (custom_ftype); + + /* restore the user specified file view to cover our tracks */ + fd->filetype = user_filetype; + fd->etype = user_etype; + fd->disp = user_disp; + fd->hints->ds_read = user_ds_read; + fd->hints->ds_write = user_ds_write; + fd->hints->ind_wr_buffer_size = user_ind_wr_buffer_size; + fd->hints->ind_rd_buffer_size = user_ind_rd_buffer_size; +#ifdef AGGREGATION_PROFILE + if (rdwr == ADIOI_READ) + MPE_Log_event (5007, 0, NULL); + else + MPE_Log_event (5009, 0, NULL); +#endif +} + +static void Exch_data_amounts (ADIO_File fd, int nprocs, + ADIO_Offset *client_comm_sz_arr, + ADIO_Offset *agg_comm_sz_arr, + int *client_alltoallw_counts, + int *agg_alltoallw_counts, + int *aggregators_done) +{ + int i; + int recv_idx; + MPI_Request *recv_requests; + MPI_Request *send_requests; + MPI_Status status; + MPI_Status *send_statuses; + /* Aggregators send amounts for data requested to clients */ + if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) { + MPI_Alltoall (client_comm_sz_arr, sizeof(ADIO_Offset), MPI_BYTE, + agg_comm_sz_arr, sizeof(ADIO_Offset), MPI_BYTE, + fd->comm); + + if (fd->is_agg) { + for (i=0; i 0) + client_alltoallw_counts[i] = 1; + else + client_alltoallw_counts[i] = 0; + } + *aggregators_done = 0; + for (i=0; i 0) + agg_alltoallw_counts[i] = 1; + else + agg_alltoallw_counts[i] = 0; + } + } else { + /* let's see if we can't reduce some communication as well as + * overlap some communication and work */ + + recv_requests = ADIOI_Malloc (fd->hints->cb_nodes * sizeof(MPI_Request)); + /* post all receives - only receive from aggregators */ + for (i = 0; i < fd->hints->cb_nodes; i++) + MPI_Irecv (&agg_comm_sz_arr[fd->hints->ranklist[i]], + sizeof(ADIO_Offset), MPI_BYTE, fd->hints->ranklist[i], + AMT_TAG, fd->comm, &recv_requests[i]); + + /* Barrier is needed here if we're worried about unexpected + * messages being dropped */ + /* MPI_Barrier (fd->comm); */ + send_requests = NULL; + if (fd->is_agg) { + /* only aggregators send data */ + send_requests = ADIOI_Malloc (nprocs * sizeof(MPI_Request)); + + /* post all sends */ + for (i = 0; i < nprocs; i++) { + MPI_Isend (&client_comm_sz_arr[i], sizeof(ADIO_Offset), + MPI_BYTE, i, AMT_TAG, fd->comm, &send_requests[i]); + + if (client_comm_sz_arr[i] > 0) + client_alltoallw_counts[i] = 1; + else + client_alltoallw_counts[i] = 0; + } + } + + *aggregators_done = 0; + for (i=0; i < fd->hints->cb_nodes; i++) { + MPI_Waitany (fd->hints->cb_nodes, recv_requests, &recv_idx, &status); + if (agg_comm_sz_arr[fd->hints->ranklist[recv_idx]] == -1) + *aggregators_done = *aggregators_done + 1; + else if (agg_comm_sz_arr[fd->hints->ranklist[recv_idx]] > 0) + agg_alltoallw_counts[fd->hints->ranklist[recv_idx]] = 1; + else + agg_alltoallw_counts[fd->hints->ranklist[recv_idx]] = 0; + } + + ADIOI_Free (recv_requests); + if (fd->is_agg) { + /* wait for all sends to complete */ + send_statuses = ADIOI_Malloc (nprocs * sizeof (MPI_Status)); + MPI_Waitall (nprocs, send_requests, send_statuses); + ADIOI_Free (send_requests); + ADIOI_Free (send_statuses); + } + } +} + +static void post_aggregator_comm (MPI_Comm comm, int rw_type, + int nproc, void *cb_buf, + MPI_Datatype *client_comm_dtype_arr, + ADIO_Offset *client_comm_sz_arr, + MPI_Request **requests_p, + int *aggs_client_count_p) +{ + int aggs_client_count = 0; + MPI_Request *requests; + int i; + +#ifdef DEBUG + printf ("posting aggregator communication\n"); +#endif + + for (i=0; i < nproc; i++) + if (client_comm_sz_arr[i] > 0) + aggs_client_count++; +#ifdef DEBUG + printf ("aggregator needs to talk to %d clients\n", + aggs_client_count); +#endif + *aggs_client_count_p = aggs_client_count; + if (aggs_client_count) { + requests = (MPI_Request *) + ADIOI_Malloc (aggs_client_count * sizeof(MPI_Request)); + aggs_client_count = 0; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5032, 0, NULL); +#endif + for (i=0; i < nproc; i++) { + if (client_comm_sz_arr[i] > 0) { + if (rw_type == ADIOI_WRITE) + MPI_Irecv (cb_buf, 1, client_comm_dtype_arr[i], i, + DATA_TAG, comm, + &requests[aggs_client_count]); + else + MPI_Isend (cb_buf, 1, client_comm_dtype_arr[i], i, + DATA_TAG, comm, + &requests[aggs_client_count]); + + aggs_client_count++; + } + } + *requests_p = requests; + } +} + +static void post_client_comm (ADIO_File fd, int rw_type, + int agg_rank, void *buf, + MPI_Datatype agg_comm_dtype, + int agg_alltoallw_count, + MPI_Request *request) +{ + if (agg_alltoallw_count) { + if (rw_type == ADIOI_READ) + MPI_Irecv (buf, 1, agg_comm_dtype, agg_rank, DATA_TAG, fd->comm, + request); + else + MPI_Isend (buf, 1, agg_comm_dtype, agg_rank, DATA_TAG, fd->comm, + request); + } +} + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_iopen.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_iopen.c new file mode 100644 index 0000000000..add0121604 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_iopen.c @@ -0,0 +1,21 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2002 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +void ADIO_ImmediateOpen(ADIO_File fd, int *error_code) +{ + int nprocs, myrank; + (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); + fd->is_open = 1; + + /* DEBUG: remove following lines */ + MPI_Comm_size(fd->comm, &nprocs); + MPI_Comm_rank(fd->comm, &myrank); + FPRINTF(stdout, "[%d/%d] DEBUG: ADIOI_ImmediateOpen called on %s\n", + myrank, nprocs, fd->filename); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_iread.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_iread.c new file mode 100644 index 0000000000..2a38295348 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_iread.c @@ -0,0 +1,91 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + +#include "mpiu_greq.h" + +#ifdef ROMIO_HAVE_WORKING_AIO +/* ADIOI_GEN_IreadContig + * + * This code handles two distinct cases. If ROMIO_HAVE_WORKING_AIO is not + * defined, then I/O is performed in a blocking manner. Otherwise we post + * an asynchronous I/O operation using the appropriate aio routines. + * + * In the aio case we rely on ADIOI_GEN_aio(), which is implemented in + * common/ad_iwrite.c. + */ +void ADIOI_GEN_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request *request, + int *error_code) +{ + int len, typesize; + int aio_errno = 0; + static char myname[] = "ADIOI_GEN_IREADCONTIG"; + + MPI_Type_size(datatype, &typesize); + ADIOI_Assert((count * typesize) == ((ADIO_Offset)(unsigned)count * (ADIO_Offset)typesize)); + len = count * typesize; + + if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; + aio_errno = ADIOI_GEN_aio(fd, buf, len, offset, 0, request); + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; + + fd->fp_sys_posn = -1; + + /* --BEGIN ERROR HANDLING-- */ + if (aio_errno != 0) { + MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; +} +#endif + +/* Generic implementation of IreadStrided calls the blocking ReadStrided + * immediately. + */ +void ADIOI_GEN_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; + int typesize; + MPI_Offset nbytes=0; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, + offset, &status, error_code); + + if (*error_code == MPI_SUCCESS) { + MPI_Type_size(datatype, &typesize); + nbytes = (MPI_Offset)count*(MPI_Offset)typesize; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_iread_fake.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_iread_fake.c new file mode 100644 index 0000000000..c6a2562bd8 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_iread_fake.c @@ -0,0 +1,61 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "mpiu_greq.h" + +/* Generic implementation of IreadContig calls the blocking ReadContig + * immediately. + */ +void ADIOI_FAKE_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 typesize; + MPI_Offset len; + + MPI_Type_size(datatype, &typesize); + len = (MPI_Offset)count * (MPI_Offset)typesize; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIOI_Assert(len == (int) len); /* the count is an int parm */ + ADIO_ReadContig(fd, buf, (int)len, MPI_BYTE, file_ptr_type, offset, + &status, error_code); + if (*error_code != MPI_SUCCESS) { + len=0; + } + MPIO_Completed_request_create(&fd, len, error_code, request); +} + + +/* Generic implementation of IreadStrided calls the blocking ReadStrided + * immediately. + */ +void ADIOI_FAKE_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; + int typesize; + MPI_Offset nbytes=0; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, + offset, &status, error_code); + if (*error_code == MPI_SUCCESS) { + MPI_Type_size(datatype, &typesize); + nbytes = (MPI_Offset)count*(MPI_Offset)typesize; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_iwrite.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_iwrite.c new file mode 100644 index 0000000000..5a18198fb1 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_iwrite.c @@ -0,0 +1,338 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif +#include + +#include "../../mpi-io/mpioimpl.h" +#include "../../mpi-io/mpioprof.h" +#include "mpiu_greq.h" +/* 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 + +#ifdef ROMIO_HAVE_WORKING_AIO + +static MPIX_Grequest_class ADIOI_GEN_greq_class = 0; + +/* ADIOI_GEN_IwriteContig + * + * This code handles only the case where ROMIO_HAVE_WORKING_AIO is + * defined. We post an asynchronous I/O operations using the appropriate aio + * routines. Otherwise, the ADIOI_Fns_struct will point to the FAKE + * version. + */ +void ADIOI_GEN_IwriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Request *request, + int *error_code) +{ + int len, typesize; + int aio_errno = 0; + static char myname[] = "ADIOI_GEN_IWRITECONTIG"; + + MPI_Type_size(datatype, &typesize); + len = count * typesize; + ADIOI_Assert(len == (int)((ADIO_Offset)count * (ADIO_Offset)typesize)); /* the count is an int parm */ + + if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind; + aio_errno = ADIOI_GEN_aio(fd, buf, len, offset, 1, request); + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len; + + fd->fp_sys_posn = -1; + + /* --BEGIN ERROR HANDLING-- */ + if (aio_errno != 0) { + MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code); + return; + } + /* --END ERROR HANDLING-- */ + + *error_code = MPI_SUCCESS; +} +/* This function is for implementation convenience. + * 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. + */ +int ADIOI_GEN_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, + int wr, MPI_Request *request) +{ + int err=-1, fd_sys; + + int error_code; + struct aiocb *aiocbp; + ADIOI_AIO_Request *aio_req; + MPI_Status status; +#if defined(ROMIO_XFS) + unsigned maxiosz = wr ? fd->hints->fs_hints.xfs.write_chunk_sz : + fd->hints->fs_hints.xfs.read_chunk_sz; +#endif /* ROMIO_XFS */ + + fd_sys = fd->fd_sys; + +#if defined(ROMIO_XFS) + /* Use Direct I/O if desired and properly aligned */ + if (fd->fns == &ADIO_XFS_operations && + ((wr && fd->direct_write) || (!wr && fd->direct_read)) && + !(((long) buf) % fd->d_mem) && !(offset % fd->d_miniosz) && + !(len % fd->d_miniosz) && (len >= fd->d_miniosz) && + (len <= maxiosz)) { + fd_sys = fd->fd_direct; + } +#endif /* ROMIO_XFS */ + + aio_req = (ADIOI_AIO_Request*)ADIOI_Calloc(sizeof(ADIOI_AIO_Request), 1); + aiocbp = (struct aiocb *) ADIOI_Calloc(sizeof(struct aiocb), 1); + aiocbp->aio_offset = offset; + aiocbp->aio_buf = buf; + aiocbp->aio_nbytes = len; + +#ifdef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_WHENCE + aiocbp->aio_whence = SEEK_SET; +#endif +#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; +# 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 + +#ifndef ROMIO_HAVE_AIO_CALLS_NEED_FILEDES +#ifndef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES +#error 'No fildes set for aio structure' +#endif + 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 + + if (err == -1) { + if (errno == EAGAIN) { + /* exceeded the max. no. of outstanding requests. + treat this as a blocking request and return. */ + if (wr) + ADIO_WriteContig(fd, buf, len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, offset, &status, &error_code); + else + ADIO_ReadContig(fd, buf, len, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, offset, &status, &error_code); + + MPIO_Completed_request_create(&fd, len, &error_code, request); + return 0; + } else { + return -errno; + } + } + aio_req->aiocbp = aiocbp; + if (ADIOI_GEN_greq_class == 0) { + MPIX_Grequest_class_create(ADIOI_GEN_aio_query_fn, + ADIOI_GEN_aio_free_fn, MPIU_Greq_cancel_fn, + ADIOI_GEN_aio_poll_fn, ADIOI_GEN_aio_wait_fn, + &ADIOI_GEN_greq_class); + } + MPIX_Grequest_class_allocate(ADIOI_GEN_greq_class, aio_req, request); + memcpy(&(aio_req->req), request, sizeof(MPI_Request)); + return 0; +} +#endif + + +/* Generic implementation of IwriteStrided calls the blocking WriteStrided + * immediately. + */ +void ADIOI_GEN_IwriteStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Request *request, + int *error_code) +{ + ADIO_Status status; + int typesize; + MPI_Offset nbytes=0; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, + offset, &status, error_code); + + if (*error_code == MPI_SUCCESS) { + MPI_Type_size(datatype, &typesize); + nbytes = (MPI_Offset)count * (MPI_Offset)typesize; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); +} + +#ifdef ROMIO_HAVE_WORKING_AIO +/* generic POSIX aio completion test routine */ +int ADIOI_GEN_aio_poll_fn(void *extra_state, MPI_Status *status) +{ + ADIOI_AIO_Request *aio_req; + int errcode=MPI_SUCCESS; + + aio_req = (ADIOI_AIO_Request *)extra_state; + + /* aio_error returns an ERRNO value */ + errno = aio_error(aio_req->aiocbp); + if (errno == EINPROGRESS) { + /* TODO: need to diddle with status somehow */ + } + else if (errno == ECANCELED) { + /* TODO: unsure how to handle this */ + } else if (errno == 0) { + int n = aio_return(aio_req->aiocbp); + aio_req->nbytes = n; + errcode = MPI_Grequest_complete(aio_req->req); + /* --BEGIN ERROR HANDLING-- */ + if (errcode != MPI_SUCCESS) { + errcode = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + "ADIOI_GEN_aio_poll_fn", __LINE__, + MPI_ERR_IO, "**mpi_grequest_complete", + 0); + } + /* --END ERROR HANDLING-- */ + } + return errcode; +} + +/* wait for multiple requests to complete */ +int ADIOI_GEN_aio_wait_fn(int count, void ** array_of_states, + double timeout, MPI_Status *status) +{ + const struct aiocb **cblist; + int err, errcode=MPI_SUCCESS; + int nr_complete=0; + double starttime; + struct timespec aio_timer; + struct timespec *aio_timer_p = NULL; + + ADIOI_AIO_Request **aio_reqlist; + int i; + + aio_reqlist = (ADIOI_AIO_Request **)array_of_states; + + cblist = (const struct aiocb**) ADIOI_Calloc(count, sizeof(struct aiocb*)); + + starttime = MPI_Wtime(); + if (timeout >0) { + aio_timer.tv_sec = (time_t)timeout; + aio_timer.tv_nsec = timeout - aio_timer.tv_sec; + aio_timer_p = &aio_timer; + } + for (i=0; i< count; i++) + { + cblist[i] = aio_reqlist[i]->aiocbp; + } + + while(nr_complete < count) { + do { + err = aio_suspend(cblist, count, aio_timer_p); + } while (err < 0 && errno == EINTR); + if (err == 0) + { /* run through the list of requests, and mark all the completed + ones as done */ + for (i=0; i< count; i++) + { + /* aio_error returns an ERRNO value */ + if (aio_reqlist[i]->aiocbp == NULL) + continue; + errno = aio_error(aio_reqlist[i]->aiocbp); + if (errno == 0) { + int n = aio_return(aio_reqlist[i]->aiocbp); + aio_reqlist[i]->nbytes = n; + errcode = MPI_Grequest_complete(aio_reqlist[i]->req); + if (errcode != MPI_SUCCESS) { + errcode = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + "ADIOI_GEN_aio_wait_fn", + __LINE__, MPI_ERR_IO, + "**mpi_grequest_complete", 0); + } + ADIOI_Free(aio_reqlist[i]->aiocbp); + aio_reqlist[i]->aiocbp = NULL; + cblist[i] = NULL; + nr_complete++; + } + /* TODO: need to handle error conditions somehow*/ + } + } /* TODO: also need to handle errors here */ + if ( (timeout > 0) && (timeout < (MPI_Wtime() - starttime) )) + break; + } + + if (cblist != NULL) ADIOI_Free(cblist); + return errcode; +} + +int ADIOI_GEN_aio_free_fn(void *extra_state) +{ + ADIOI_AIO_Request *aio_req; + aio_req = (ADIOI_AIO_Request*)extra_state; + + if (aio_req->aiocbp != NULL) + ADIOI_Free(aio_req->aiocbp); + ADIOI_Free(aio_req); + + return MPI_SUCCESS; +} +#endif /* working AIO */ + +int ADIOI_GEN_aio_query_fn(void *extra_state, MPI_Status *status) +{ + ADIOI_AIO_Request *aio_req; + + aio_req = (ADIOI_AIO_Request *)extra_state; + + + MPI_Status_set_elements(status, MPI_BYTE, aio_req->nbytes); + + /* can never cancel so always true */ + MPI_Status_set_cancelled(status, 0); + + /* choose not to return a value for this */ + status->MPI_SOURCE = MPI_UNDEFINED; + /* tag has no meaning for this generalized request */ + status->MPI_TAG = MPI_UNDEFINED; + /* this generalized request never fails */ + return MPI_SUCCESS; +} +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_iwrite_fake.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_iwrite_fake.c new file mode 100644 index 0000000000..1df7d9d436 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_iwrite_fake.c @@ -0,0 +1,65 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +#include "mpiu_greq.h" + +/* Generic implementation of IwriteContig calls the blocking WriteContig + * immediately. + */ +void ADIOI_FAKE_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; + MPI_Offset len; + int typesize; + MPI_Offset nbytes=0; + + MPI_Type_size(datatype, &typesize); + len = (MPI_Offset)count * (MPI_Offset)typesize; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIOI_Assert(len == (int) len); /* the count is an int parm */ + ADIO_WriteContig(fd, buf, (int)len, MPI_BYTE, file_ptr_type, offset, + &status, error_code); + if (*error_code == MPI_SUCCESS) { + MPI_Type_size(datatype, &typesize); + nbytes = (MPI_Offset)count*(MPI_Offset)typesize; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); + +} + + +/* Generic implementation of IwriteStrided calls the blocking WriteStrided + * immediately. + */ +void ADIOI_FAKE_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; + int typesize; + MPI_Offset nbytes=0; + + /* Call the blocking function. It will create an error code + * if necessary. + */ + ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, + offset, &status, error_code); + if (*error_code == MPI_SUCCESS) { + MPI_Type_size(datatype, &typesize); + nbytes = (MPI_Offset)count * (MPI_Offset)typesize; + } + MPIO_Completed_request_create(&fd, nbytes, error_code, request); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_open.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_open.c index 0f1a16204a..2cad14a50d 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_open.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_open.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -9,61 +8,72 @@ #include "adio.h" #include "adio_extern.h" #include "adio_cb_config_list.h" -#ifdef MPISGI -#include "mpisgi2.h" -#endif - -ADIO_File ADIO_Open(MPI_Comm orig_comm, - MPI_Comm comm, char *filename, int file_system, - int access_mode, ADIO_Offset disp, MPI_Datatype etype, - MPI_Datatype filetype, int iomode, - MPI_Info info, int perm, int *error_code) + +#include "mpio.h" + +static int is_aggregator(int rank, ADIO_File fd); +static int uses_generic_read(ADIO_File fd); +static int uses_generic_write(ADIO_File fd); +static int build_cb_config_list(ADIO_File fd, + MPI_Comm orig_comm, MPI_Comm comm, + int rank, int procs, int *error_code); + +MPI_File ADIO_Open(MPI_Comm orig_comm, + MPI_Comm comm, char *filename, int file_system, + ADIOI_Fns *ops, + int access_mode, ADIO_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, + MPI_Info info, int perm, int *error_code) { + MPI_File mpi_fh; ADIO_File fd; - ADIO_cb_name_array array; - int orig_amode, err, rank, procs; - char *value; -#ifndef PRINT_ERR_MSG + int err, rank, procs; static char myname[] = "ADIO_OPEN"; -#endif - - int rank_ct; - int *tmp_ranklist; + int max_error_code; + MPI_Info dupinfo; + MPI_Comm aggregator_comm = MPI_COMM_NULL; /* just for deferred opens */ *error_code = MPI_SUCCESS; - fd = (ADIO_File) ADIOI_Malloc(sizeof(struct ADIOI_FileD)); - if (fd == NULL) { - /* NEED TO HANDLE ENOMEM ERRORS */ + /* obtain MPI_File handle */ + mpi_fh = MPIO_File_create(sizeof(struct ADIOI_FileD)); + if (mpi_fh == MPI_FILE_NULL) { } + fd = MPIO_File_resolve(mpi_fh); fd->cookie = ADIOI_FILE_COOKIE; fd->fp_ind = disp; fd->fp_sys_posn = 0; fd->comm = comm; /* dup'ed in MPI_File_open */ - fd->filename = strdup(filename); + fd->filename = ADIOI_Strdup(filename); fd->file_system = file_system; + fd->fs_ptr = NULL; + + fd->fns = ops; + fd->disp = disp; fd->split_coll_count = 0; fd->shared_fp_fd = ADIO_FILE_NULL; fd->atomicity = 0; - fd->etype = etype; /* MPI_BYTE by default */ fd->filetype = filetype; /* MPI_BYTE by default */ fd->etype_size = 1; /* default etype is MPI_BYTE */ + fd->file_realm_st_offs = NULL; + fd->file_realm_types = NULL; + fd->perm = perm; - fd->iomode = iomode; fd->async_count = 0; - fd->err_handler = CtvAccess(ADIOI_DFLT_ERR_HANDLER); + fd->fortran_handle = -1; -/* set I/O function pointers */ - ADIOI_SetFunctions(fd); + fd->err_handler = CtvAccess(ADIOI_DFLT_ERR_HANDLER); + MPI_Comm_rank(comm, &rank); + MPI_Comm_size(comm, &procs); /* create and initialize info object */ - fd->hints = (ADIOI_Hints *)ADIOI_Malloc(sizeof(struct ADIOI_Hints_struct)); + fd->hints = (ADIOI_Hints *)ADIOI_Calloc(1, sizeof(struct ADIOI_Hints_struct)); if (fd->hints == NULL) { /* NEED TO HANDLE ENOMEM ERRORS */ } @@ -71,20 +81,177 @@ ADIO_File ADIO_Open(MPI_Comm orig_comm, fd->hints->ranklist = NULL; fd->hints->initialized = 0; fd->info = MPI_INFO_NULL; - ADIO_SetInfo(fd, info, &err); -/* gather the processor name array if we don't already have it */ + ADIOI_incorporate_system_hints(info, CtvAccess(ADIOI_syshints), &dupinfo); + ADIO_SetInfo(fd, dupinfo, &err); + if (dupinfo != MPI_INFO_NULL) { + *error_code = MPI_Info_free(&dupinfo); + if (*error_code != MPI_SUCCESS) + goto fn_exit; + } + + /* deferred open: + * we can only do this optimization if 'fd->hints->deferred_open' is set + * (which means the user hinted 'no_indep_rw' and collective buffering). + * Furthermore, we only do this if our collective read/write routines use + * our generic function, and not an fs-specific routine (we can defer opens + * only if we use our aggreagation code). */ + if (fd->hints->deferred_open && + !(uses_generic_read(fd) \ + && uses_generic_write(fd))) { + fd->hints->deferred_open = 0; + } + if (ADIO_Feature(fd, ADIO_SCALABLE_OPEN)) + /* disable deferred open on these fs so that scalable broadcast + * will always use the propper communicator */ + fd->hints->deferred_open = 0; -/* this has to be done here so that we can cache the name array in both - * the dup'd communicator (in case we want it later) and the original - * communicator + + /* on BlueGene, the cb_config_list is built when hints are processed. No + * one else does that right now */ + if (fd->hints->ranklist == NULL) { + build_cb_config_list(fd, orig_comm, comm, rank, procs, error_code); + if (*error_code != MPI_SUCCESS) + goto fn_exit; + } + + /* deferred open: if we are an aggregator, create a new communicator. + * we'll use this aggregator communicator for opens and closes. + * otherwise, we have a NULL communicator until we try to do independent + * IO */ + fd->agg_comm = MPI_COMM_NULL; + fd->is_open = 0; + fd->my_cb_nodes_index = -2; + fd->is_agg = is_aggregator(rank, fd); + if (fd->hints->deferred_open) { + /* MPI_Comm_split will create a communication group of aggregators. + * for non-aggregators it will return MPI_COMM_NULL . we rely on + * fd->agg_comm == MPI_COMM_NULL for non-aggregators in several + * tests in the code */ + if (fd->is_agg) { + MPI_Comm_split(fd->comm, 1, 0, &aggregator_comm); + fd->agg_comm = aggregator_comm; + } else { + MPI_Comm_split(fd->comm, MPI_UNDEFINED, 0, &aggregator_comm); + fd->agg_comm = aggregator_comm; + } + + } + + /* actual opens start here */ + /* generic open: one process opens to create the file, all others open */ + /* nfs open: everybody opens or else you'll end up with "file not found" + * due to stupid nfs consistency semantics */ + /* scalable open: one process opens and broadcasts results to everyone */ + + ADIOI_OpenColl(fd, rank, access_mode, error_code); + + fn_exit: + MPI_Allreduce(error_code, &max_error_code, 1, MPI_INT, MPI_MAX, comm); + if (max_error_code != MPI_SUCCESS) { + + /* If the file was successfully opened, close it */ + if (*error_code == MPI_SUCCESS) { + + /* in the deferred open case, only those who have actually + opened the file should close it */ + if (fd->hints->deferred_open) { + if (fd->agg_comm != MPI_COMM_NULL) { + (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); + } + } + else { + (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); + } + } + if (fd->filename) ADIOI_Free(fd->filename); + if (fd->hints->ranklist) ADIOI_Free(fd->hints->ranklist); + if (fd->hints->cb_config_list) ADIOI_Free(fd->hints->cb_config_list); + if (fd->hints) ADIOI_Free(fd->hints); + if (fd->info != MPI_INFO_NULL) MPI_Info_free(&(fd->info)); + ADIOI_Free(fd); + fd = ADIO_FILE_NULL; + if (*error_code == MPI_SUCCESS) + { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, + "**oremote_fail", 0); + } + } + + return fd; +} + +/* a simple linear search. possible enancement: add a my_cb_nodes_index member + * ( index into cb_nodes, else -1 if not aggregator ) for faster lookups + * + * fd->hints->cb_nodes is the number of aggregators + * fd->hints->ranklist[] is an array of the ranks of aggregators + * + * might want to move this to adio/common/cb_config_list.c */ +int is_aggregator(int rank, ADIO_File fd ) { + int i; + + if (fd->my_cb_nodes_index == -2) { + for (i=0; i< fd->hints->cb_nodes; i++ ) { + if ( rank == fd->hints->ranklist[i] ) { + fd->my_cb_nodes_index = i; + return 1; + } + } + fd->my_cb_nodes_index = -1; + } + else if (fd->my_cb_nodes_index != -1) + return 1; + + return 0; +} + +/* + * we special-case TESTFS because all it does is wrap logging info around GEN + */ +static int uses_generic_read(ADIO_File fd) +{ + ADIOI_Fns *fns = fd->fns; + if (fns->ADIOI_xxx_ReadStridedColl == ADIOI_GEN_ReadStridedColl || + fd->file_system == ADIO_TESTFS ) + { + return 1; + } + return 0; +} + +static int uses_generic_write(ADIO_File fd) +{ + ADIOI_Fns *fns = fd->fns; + if (fns->ADIOI_xxx_WriteStridedColl == ADIOI_GEN_WriteStridedColl || + fd->file_system == ADIO_TESTFS ) + { + return 1; + } + return 0; +} + +static int build_cb_config_list(ADIO_File fd, + MPI_Comm orig_comm, MPI_Comm comm, + int rank, int procs, int *error_code) +{ + ADIO_cb_name_array array; + int *tmp_ranklist; + int rank_ct; + char *value; + static char myname[] = "ADIO_OPEN cb_config_list"; + + /* gather the processor name array if we don't already have it */ + /* this has to be done early in ADIO_Open so that we can cache the name + * array in both the dup'd communicator (in case we want it later) and the + * original communicator */ ADIOI_cb_gather_name_array(orig_comm, comm, &array); /* parse the cb_config_list and create a rank map on rank 0 */ - MPI_Comm_rank(comm, &rank); if (rank == 0) { - MPI_Comm_size(comm, &procs); tmp_ranklist = (int *) ADIOI_Malloc(sizeof(int) * procs); if (tmp_ranklist == NULL) { /* NEED TO HANDLE ENOMEM ERRORS */ @@ -103,57 +270,21 @@ ADIO_File ADIO_Open(MPI_Comm orig_comm, fd->hints->cb_nodes = rank_ct; /* TEMPORARY -- REMOVE WHEN NO LONGER UPDATING INFO FOR FS-INDEP. */ value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - sprintf(value, "%d", rank_ct); - MPI_Info_set(fd->info, "cb_nodes", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", rank_ct); + ADIOI_Info_set(fd->info, "cb_nodes", value); ADIOI_Free(value); } -/* bcast the rank map (could do an allgather above and avoid - * this...would that really be any better?) - */ + ADIOI_cb_bcast_rank_map(fd); if (fd->hints->cb_nodes <= 0) { -#ifdef PRINT_ERR_MSG - *error_code = MPI_ERR_UNKNOWN; -#else - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, myname, - "Open Error", "%s", - "No aggregators match"); - ADIOI_Error(MPI_FILE_NULL, *error_code, myname); -#endif - fd = ADIO_FILE_NULL; - return fd; - } - -/* For writing with data sieving, a read-modify-write is needed. If - the file is opened for write_only, the read will fail. Therefore, - if write_only, open the file as read_write, but record it as write_only - in fd, so that get_amode returns the right answer. */ - - orig_amode = access_mode; - if (access_mode & ADIO_WRONLY) { - access_mode = access_mode ^ ADIO_WRONLY; - access_mode = access_mode | ADIO_RDWR; - } - fd->access_mode = access_mode; - - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - - fd->access_mode = orig_amode; - - /* if error, may be it was due to the change in amode above. - therefore, reopen with access mode provided by the user.*/ - if (*error_code != MPI_SUCCESS) - (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); - - /* if error, free and set fd to NULL */ - if (*error_code != MPI_SUCCESS) { - ADIOI_Free(fd->fns); - MPI_Comm_free(&(fd->comm)); - free(fd->filename); - MPI_Info_free(&(fd->info)); - ADIOI_Free(fd); + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**ioagnomatch", 0); fd = ADIO_FILE_NULL; } - - return fd; + return 0; } + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll.c new file mode 100644 index 0000000000..243fe84b84 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll.c @@ -0,0 +1,108 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2007 UChicago/Argonne LLC + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +/* Generic version of a "collective open". Assumes a "real" underlying + * file system (meaning no wonky consistency semantics like NFS). + * + * optimization: by having just one process create a file, close it, + * then have all N processes open it, we can possibly avoid contention + * for write locks on a directory for some file systems. + * + * Happy side-effect: exclusive create (error if file already exists) + * just falls out + * + * Note: this is not a "scalable open" (c.f. "The impact of file systems + * on MPI-IO scalability"). + */ + +void ADIOI_GEN_OpenColl(ADIO_File fd, int rank, + int access_mode, int *error_code) +{ + int orig_amode_excl, orig_amode_wronly; + MPI_Comm tmp_comm; + + orig_amode_excl = access_mode; + + if (access_mode & ADIO_CREATE ){ + if(rank == fd->hints->ranklist[0]) { + /* remove delete_on_close flag if set */ + if (access_mode & ADIO_DELETE_ON_CLOSE) + fd->access_mode = access_mode ^ ADIO_DELETE_ON_CLOSE; + else + fd->access_mode = access_mode; + + tmp_comm = fd->comm; + fd->comm = MPI_COMM_SELF; + (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); + fd->comm = tmp_comm; + MPI_Bcast(error_code, 1, MPI_INT, \ + fd->hints->ranklist[0], fd->comm); + /* if no error, close the file and reopen normally below */ + if (*error_code == MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); + + fd->access_mode = access_mode; /* back to original */ + } + else MPI_Bcast(error_code, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + + if (*error_code != MPI_SUCCESS) { + return; + } + else { + /* turn off CREAT (and EXCL if set) for real multi-processor open */ + access_mode ^= ADIO_CREATE; + if (access_mode & ADIO_EXCL) + access_mode ^= ADIO_EXCL; + } + } + + /* if we are doing deferred open, non-aggregators should return now */ + if (fd->hints->deferred_open ) { + if (fd->agg_comm == MPI_COMM_NULL) { + /* we might have turned off EXCL for the aggregators. + * restore access_mode that non-aggregators get the right + * value from get_amode */ + fd->access_mode = orig_amode_excl; + *error_code = MPI_SUCCESS; + return; + } + } + +/* For writing with data sieving, a read-modify-write is needed. If + the file is opened for write_only, the read will fail. Therefore, + if write_only, open the file as read_write, but record it as write_only + in fd, so that get_amode returns the right answer. */ + + orig_amode_wronly = access_mode; + if (access_mode & ADIO_WRONLY) { + access_mode = access_mode ^ ADIO_WRONLY; + access_mode = access_mode | ADIO_RDWR; + } + fd->access_mode = access_mode; + + (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); + + /* if error, may be it was due to the change in amode above. + therefore, reopen with access mode provided by the user.*/ + fd->access_mode = orig_amode_wronly; + if (*error_code != MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); + + /* if we turned off EXCL earlier, then we should turn it back on */ + if (fd->access_mode != orig_amode_excl) fd->access_mode = orig_amode_excl; + + /* for deferred open: this process has opened the file (because if we are + * not an aggregaor and we are doing deferred open, we returned earlier)*/ + fd->is_open = 1; + +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll_failsafe.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll_failsafe.c new file mode 100644 index 0000000000..4dcdfc729d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll_failsafe.c @@ -0,0 +1,89 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2007 UChicago/Argonne LLC + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + + +/* this "collective" open is useful for frankly broken file systems such + * as NFS where a create from one client might not be immediately + * visible on another */ + +void ADIOI_FAILSAFE_OpenColl(ADIO_File fd, int rank, + int access_mode, int *error_code) +{ + int orig_amode_excl, orig_amode_wronly; + + orig_amode_excl = access_mode; + if ((access_mode & ADIO_CREATE) && (access_mode & ADIO_EXCL)) { + /* the open should fail if the file exists. Only *1* process + * should check this. Otherwise, if all processes try to check + * and the file does not exist, one process will create the file + * and others who reach later will return error. */ + if(rank == fd->hints->ranklist[0]) { + fd->access_mode = access_mode; + (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); + MPI_Bcast(error_code, 1, MPI_INT, \ + fd->hints->ranklist[0], fd->comm); + /* if no error, close the file and reopen normally below */ + if (*error_code == MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Close))(fd, error_code); + } + else MPI_Bcast(error_code, 1, MPI_INT, + fd->hints->ranklist[0], fd->comm); + if (*error_code != MPI_SUCCESS) { + return; + } + else { + /* turn off EXCL for real open */ + access_mode = access_mode ^ ADIO_EXCL; + } + } + /* if we are doing deferred open, non-aggregators should return now */ + if (fd->hints->deferred_open ) { + if (fd->agg_comm == MPI_COMM_NULL) { + /* we might have turned off EXCL for the aggregators. + * restore access_mode that non-aggregators get the right + * value from get_amode */ + fd->access_mode = orig_amode_excl; + *error_code = MPI_SUCCESS; + return; + } + } + +/* For writing with data sieving, a read-modify-write is needed. If + the file is opened for write_only, the read will fail. Therefore, + if write_only, open the file as read_write, but record it as write_only + in fd, so that get_amode returns the right answer. */ + + orig_amode_wronly = access_mode; + if (access_mode & ADIO_WRONLY) { + access_mode = access_mode ^ ADIO_WRONLY; + access_mode = access_mode | ADIO_RDWR; + } + fd->access_mode = access_mode; + + (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); + + /* if error, may be it was due to the change in amode above. + therefore, reopen with access mode provided by the user.*/ + fd->access_mode = orig_amode_wronly; + if (*error_code != MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); + + /* if we turned off EXCL earlier, then we should turn it back on */ + if (fd->access_mode != orig_amode_excl) fd->access_mode = orig_amode_excl; + + /* for deferred open: this process has opened the file (because if we are + * not an aggregaor and we are doing deferred open, we returned earlier)*/ + fd->is_open = 1; +} + + + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll_scalable.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll_scalable.c new file mode 100644 index 0000000000..eee8520c6d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_opencoll_scalable.c @@ -0,0 +1,57 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2007 UChicago/Argonne LLC + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +/* + * Scalable open: for file systems capable of having one process + * create/open a file and broadcast the result to everyone else. + * - Does not need one process to create the file + * - Does not need special handling for CREATE|EXCL + */ +void ADIOI_SCALEABLE_OpenColl(ADIO_File fd, int rank, + int access_mode, int *error_code) +{ + int orig_amode_wronly; + + /* if we are doing deferred open, non-aggregators should return now */ + if (fd->hints->deferred_open ) { + if (fd->agg_comm == MPI_COMM_NULL) { + *error_code = MPI_SUCCESS; + return; + } + } + + /* For writing with data sieving, a read-modify-write is needed. If + the file is opened for write_only, the read will fail. Therefore, + if write_only, open the file as read_write, but record it as + write_only in fd, so that get_amode returns the right answer. */ + + orig_amode_wronly = access_mode; + if (access_mode & ADIO_WRONLY) { + access_mode = access_mode ^ ADIO_WRONLY; + access_mode = access_mode | ADIO_RDWR; + } + fd->access_mode = access_mode; + + (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); + + /* if error, may be it was due to the change in amode above. + therefore, reopen with access mode provided by the user.*/ + fd->access_mode = orig_amode_wronly; + if (*error_code != MPI_SUCCESS) + (*(fd->fns->ADIOI_xxx_Open))(fd, error_code); + + /* for deferred open: this process has opened the file (because if we are + * not an aggregaor and we are doing deferred open, we returned earlier)*/ + fd->is_open = 1; + +} + +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_prealloc.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_prealloc.c new file mode 100644 index 0000000000..cd18dbb283 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_prealloc.c @@ -0,0 +1,91 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" + +/* this used to be implemented in every file system as an fcntl, but the code + * is identical for all file systems without a real "preallocate" system call. + * This naive approach will get the job done, but not in a terribly efficient + * manner. + */ +void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset diskspace, int *error_code) +{ + ADIO_Offset curr_fsize, alloc_size, size, len, done; + ADIO_Status status; + int i, ntimes; + char *buf; + ADIO_Fcntl_t *fcntl_struct; + static char myname[] = "ADIOI_GEN_PREALLOC"; + + /* will be called by one process only */ + /* On file systems with no preallocation function, we have to + explicitly write + to allocate space. Since there could be holes in the file, + we 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 = fd->fp_ind; */ + fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t)); + ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, fcntl_struct, error_code); + + curr_fsize = fcntl_struct->fsize; /* don't rely on fd->fp_ind: might be + working on a pre-existing file */ + alloc_size = 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 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 +#endif +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +void ADIOI_GEN_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + int err = -1, datatype_size; + ADIO_Offset len; + static char myname[] = "ADIOI_GEN_READCONTIG"; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5034, 0, NULL); +#endif + MPI_Type_size(datatype, &datatype_size); + len = (ADIO_Offset)datatype_size * (ADIO_Offset)count; + ADIOI_Assert(len == (unsigned int) len); /* read takes an unsigned int parm */ + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + if (fd->fp_sys_posn != offset) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + err = lseek(fd->fd_sys, offset, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + /* --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)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + } + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_a, 0, NULL ); +#endif + err = read(fd->fd_sys, buf, (unsigned int)len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_read_b, 0, NULL ); +#endif + /* --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)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + + fd->fp_sys_posn = offset + err; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += err; + } + +#ifdef HAVE_STATUS_SET_BYTES + if (err != -1) MPIR_Status_set_bytes(status, datatype, err); +#endif + + *error_code = MPI_SUCCESS; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5035, 0, NULL); +#endif +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_read_coll.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_read_coll.c index ca87e00600..28cc5622c4 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_read_coll.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_read_coll.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -8,7 +7,11 @@ #include "adio.h" #include "adio_extern.h" -#ifdef PROFILE + +#ifdef USE_DBG_LOGGING + #define RDCOLL_DEBUG 1 +#endif +#ifdef AGGREGATION_PROFILE #include "mpe.h" #endif @@ -17,13 +20,13 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype datatype, int nprocs, int myrank, ADIOI_Access *others_req, ADIO_Offset *offset_list, - int *len_list, int contig_access_count, + ADIO_Offset *len_list, int contig_access_count, ADIO_Offset min_st_offset, ADIO_Offset fd_size, ADIO_Offset *fd_start, ADIO_Offset *fd_end, int *buf_idx, int *error_code); static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node - *flat_buf, ADIO_Offset *offset_list, int + *flat_buf, ADIO_Offset *offset_list, ADIO_Offset *len_list, int *send_size, int *recv_size, int *count, int *start_pos, int *partial_send, @@ -38,8 +41,8 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node MPI_Aint buftype_extent, int *buf_idx); static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node *flat_buf, char **recv_buf, ADIO_Offset - *offset_list, int *len_list, - int *recv_size, + *offset_list, ADIO_Offset *len_list, + unsigned *recv_size, MPI_Request *requests, MPI_Status *statuses, int *recd_from_proc, int nprocs, int contig_access_count, @@ -69,60 +72,71 @@ void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count, whose request lies in this process's file domain. */ int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; - int *len_list, contig_access_count, interleave_count; + int contig_access_count=0, interleave_count = 0, buftype_is_contig; int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; - int buftype_is_contig, *buf_idx; - ADIO_Offset *offset_list, start_offset, end_offset, *st_offsets, orig_fp; - ADIO_Offset *fd_start, *fd_end, fd_size, min_st_offset, *end_offsets; - ADIO_Offset off; + ADIO_Offset start_offset, end_offset, orig_fp, fd_size, min_st_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, + *fd_end = NULL, *end_offsets = NULL; + ADIO_Offset *len_list = NULL; + int *buf_idx = NULL; + #ifdef HAVE_STATUS_SET_BYTES int bufsize, size; #endif -#ifdef PROFILE - MPE_Log_event(13, 0, "start computation"); -#endif + if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { + ADIOI_IOStridedColl (fd, buf, count, ADIOI_READ, datatype, + file_ptr_type, offset, status, error_code); + return; + } + MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); /* number of aggregators, cb_nodes, is stored in the hints */ nprocs_for_coll = fd->hints->cb_nodes; + orig_fp = fd->fp_ind; -/* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ + /* only check for interleaving if cb_read isn't disabled */ + if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + lengths in the file and determine the start and end offsets. */ -/* Note: end_offset points to the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ + /* Note: end_offset points to the last byte-offset that will be accessed. + e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ - orig_fp = fd->fp_ind; - ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, - &offset_list, &len_list, &start_offset, - &end_offset, &contig_access_count); + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); -/* for (i=0; icomm); - MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, ADIO_OFFSET, - fd->comm); +#ifdef RDCOLL_DEBUG + for (i=0; icomm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, + ADIO_OFFSET, fd->comm); + + /* are the accesses of different processes interleaved? */ + for (i=1; ihints->cb_read == ADIOI_HINT_AUTO))) { /* don't do aggregation */ - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); + if (fd->hints->cb_read != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(len_list); + ADIOI_Free(st_offsets); + ADIOI_Free(end_offsets); + } fd->fp_ind = orig_fp; ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); @@ -171,7 +187,9 @@ void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count, */ ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, &fd_size); + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, + fd->hints->striping_unit); /* calculate where the portions of the access requests of this process * are located in terms of the file domains. this could be on the same @@ -258,20 +276,30 @@ void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count, void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype datatype, int file_ptr_type, ADIO_Offset - offset, ADIO_Offset **offset_list_ptr, int + offset, ADIO_Offset **offset_list_ptr, ADIO_Offset **len_list_ptr, ADIO_Offset *start_offset_ptr, ADIO_Offset *end_offset_ptr, int *contig_access_count_ptr) { - int filetype_size, buftype_size, etype_size; - int i, j, k, frd_size=0, old_frd_size=0, st_index=0; - int n_filetypes, etype_in_filetype; + int filetype_size, etype_size; + unsigned buftype_size; + int i, j, k; + ADIO_Offset i_offset; + ADIO_Offset frd_size=0, old_frd_size=0; + int st_index=0; + ADIO_Offset n_filetypes, etype_in_filetype; ADIO_Offset abs_off_in_filetype=0; - int bufsize, sum, n_etypes_in_filetype, size_in_filetype; - int contig_access_count, *len_list, flag, filetype_is_contig; + ADIO_Offset bufsize; + ADIO_Offset sum, n_etypes_in_filetype, size_in_filetype; + int contig_access_count, filetype_is_contig; + ADIO_Offset *len_list; MPI_Aint filetype_extent, filetype_lb; ADIOI_Flatlist_node *flat_file; ADIO_Offset *offset_list, off, end_offset=0, disp; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5028, 0, NULL); +#endif /* For this process's request, calculate the list of offsets and lengths in the file and determine the start and end offsets. */ @@ -281,19 +309,19 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype MPI_Type_size(fd->filetype, &filetype_size); MPI_Type_extent(fd->filetype, &filetype_extent); MPI_Type_lb(fd->filetype, &filetype_lb); - MPI_Type_size(datatype, &buftype_size); + MPI_Type_size(datatype, (int*)&buftype_size); etype_size = fd->etype_size; if ( ! filetype_size ) { *contig_access_count_ptr = 0; *offset_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset)); - *len_list_ptr = (int *) ADIOI_Malloc(2*sizeof(int)); + *len_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset)); /* 2 is for consistency. everywhere I malloc one more than needed */ offset_list = *offset_list_ptr; len_list = *len_list_ptr; offset_list[0] = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; + fd->disp + (ADIO_Offset)etype_size * offset; len_list[0] = 0; *start_offset_ptr = offset_list[0]; *end_offset_ptr = offset_list[0] + len_list[0] - 1; @@ -304,14 +332,14 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype if (filetype_is_contig) { *contig_access_count_ptr = 1; *offset_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset)); - *len_list_ptr = (int *) ADIOI_Malloc(2*sizeof(int)); + *len_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset)); /* 2 is for consistency. everywhere I malloc one more than needed */ offset_list = *offset_list_ptr; len_list = *len_list_ptr; offset_list[0] = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; - len_list[0] = bufcount * buftype_size; + fd->disp + (ADIO_Offset)etype_size * offset; + len_list[0] = (ADIO_Offset)bufcount * (ADIO_Offset)buftype_size; *start_offset_ptr = offset_list[0]; *end_offset_ptr = offset_list[0] + len_list[0] - 1; @@ -328,31 +356,47 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype while (flat_file->type != fd->filetype) flat_file = flat_file->next; disp = fd->disp; +#ifdef RDCOLL_DEBUG + { + int ii; + DBG_FPRINTF(stderr, "flattened %3d : ", flat_file->count ); + for (ii=0; iicount; ii++) { + DBG_FPRINTF(stderr, "%16qd:%-16qd", flat_file->indices[ii], flat_file->blocklens[ii] ); + } + DBG_FPRINTF(stderr, "\n" ); + } +#endif if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; icount; i++) { - if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + - flat_file->blocklens[i] >= offset) - { - st_index = i; - frd_size = (int) (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - offset); - flag = 1; + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset)n_filetypes * filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i=0; icount; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* frd_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + frd_size = flat_file->blocklens[i]; break; - } + } + if (dist > 0) { + frd_size = dist; + break; } } - } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; + } else { 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); + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; size_in_filetype = etype_in_filetype * etype_size; sum = 0; @@ -368,29 +412,29 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype } /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + + offset = disp + n_filetypes* (ADIO_Offset)filetype_extent + abs_off_in_filetype; } /* calculate how much space to allocate for offset_list, len_list */ old_frd_size = frd_size; - contig_access_count = i = 0; + contig_access_count = i_offset = 0; j = st_index; - bufsize = buftype_size * bufcount; + bufsize = (ADIO_Offset)buftype_size * (ADIO_Offset)bufcount; frd_size = ADIOI_MIN(frd_size, bufsize); - while (i < bufsize) { + while (i_offset < bufsize) { if (frd_size) contig_access_count++; - i += frd_size; + i_offset += frd_size; j = (j + 1) % flat_file->count; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); + frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); } /* allocate space for offset_list and len_list */ *offset_list_ptr = (ADIO_Offset *) ADIOI_Malloc((contig_access_count+1)*sizeof(ADIO_Offset)); - *len_list_ptr = (int *) ADIOI_Malloc((contig_access_count+1)*sizeof(int)); + *len_list_ptr = (ADIO_Offset *) ADIOI_Malloc((contig_access_count+1)*sizeof(ADIO_Offset)); /* +1 to avoid a 0-size malloc */ offset_list = *offset_list_ptr; @@ -400,17 +444,17 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype *start_offset_ptr = offset; /* calculated above */ - i = k = 0; + i_offset = k = 0; j = st_index; off = offset; frd_size = ADIOI_MIN(old_frd_size, bufsize); - while (i < bufsize) { + while (i_offset < bufsize) { if (frd_size) { offset_list[k] = off; len_list[k] = frd_size; k++; } - i += frd_size; + i_offset += frd_size; end_offset = off + frd_size - 1; /* Note: end_offset points to the last byte-offset that will be accessed. @@ -418,7 +462,7 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype if (off + frd_size < disp + flat_file->indices[j] + flat_file->blocklens[j] + - (ADIO_Offset) n_filetypes*filetype_extent) + n_filetypes* (ADIO_Offset)filetype_extent) { off += frd_size; /* did not reach end of contiguous block in filetype. @@ -426,17 +470,17 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype */ } else { - if (j < (flat_file->count - 1)) j++; - else { - /* hit end of flattened filetype; - * start at beginning again - */ - j = 0; - n_filetypes++; + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + /* hit end of flattened filetype; start at beginning + * again */ } off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); + n_filetypes* (ADIO_Offset)filetype_extent; + frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); } } @@ -444,15 +488,18 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; *contig_access_count_ptr = contig_access_count; - *end_offset_ptr = end_offset; + *end_offset_ptr = end_offset; } +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5029, 0, NULL); +#endif } static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype datatype, int nprocs, int myrank, ADIOI_Access *others_req, ADIO_Offset *offset_list, - int *len_list, int contig_access_count, ADIO_Offset + ADIO_Offset *len_list, int contig_access_count, ADIO_Offset min_st_offset, ADIO_Offset fd_size, ADIO_Offset *fd_start, ADIO_Offset *fd_end, int *buf_idx, int *error_code) @@ -467,12 +514,14 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype array from a file, where each local array is 8Mbytes, requiring at least another 8Mbytes of temp space is unacceptable. */ - int i, j, m, size, ntimes, max_ntimes, buftype_is_contig; + int i, j, m, ntimes, max_ntimes, buftype_is_contig; ADIO_Offset st_loc=-1, end_loc=-1, off, done, real_off, req_off; char *read_buf = NULL, *tmp_buf; int *curr_offlen_ptr, *count, *send_size, *recv_size; - int *partial_send, *recd_from_proc, *start_pos, for_next_iter; - int real_size, req_len, flag, for_curr_iter, rank; + int *partial_send, *recd_from_proc, *start_pos; + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ + ADIO_Offset real_size, size, for_curr_iter, for_next_iter; + int req_len, flag, rank; MPI_Status status; ADIOI_Flatlist_node *flat_buf=NULL; MPI_Aint buftype_extent; @@ -564,10 +613,6 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype MPI_Comm_rank(fd->comm, &rank); -#ifdef PROFILE - MPE_Log_event(14, 0, "end computation"); -#endif - for (m=0; mcomm, requests+j); j++; - /* FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", - myrank, recv_size[i], myrank+i+100*iter); */ +#ifdef RDCOLL_DEBUG + DBG_FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", + myrank, recv_size[i], myrank+i+100*iter); +#endif } } @@ -845,7 +883,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node /* if noncontiguous, to the copies from the recv buffers */ if (!buftype_is_contig) ADIOI_Fill_user_buffer(fd, buf, flat_buf, recv_buf, - offset_list, len_list, recv_size, + offset_list, len_list, (unsigned*)recv_size, requests, statuses, recd_from_proc, nprocs, contig_access_count, min_st_offset, fd_size, fd_start, fd_end, @@ -863,9 +901,11 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node if (recv_size[i]) ADIOI_Free(recv_buf[i]); ADIOI_Free(recv_buf); } +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5033, 0, NULL); +#endif } - #define ADIOI_BUF_INCR \ { \ while (buf_incr) { \ @@ -879,7 +919,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node n_buftypes++; \ } \ user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - n_buftypes*buftype_extent; \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ } \ buf_incr -= size_in_buf; \ @@ -891,9 +931,11 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node { \ while (size) { \ size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ memcpy(((char *) buf) + user_buf_idx, \ &(recv_buf[p][recv_buf_idx[p]]), size_in_buf); \ - recv_buf_idx[p] += size_in_buf; \ + recv_buf_idx[p] += size_in_buf; /* already tested (size_t)size_in_buf*/ \ user_buf_idx += size_in_buf; \ flat_buf_sz -= size_in_buf; \ if (!flat_buf_sz) { \ @@ -903,7 +945,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node n_buftypes++; \ } \ user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - n_buftypes*buftype_extent; \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ } \ size -= size_in_buf; \ @@ -912,11 +954,10 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node ADIOI_BUF_INCR \ } - static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node *flat_buf, char **recv_buf, ADIO_Offset - *offset_list, int *len_list, - int *recv_size, + *offset_list, ADIO_Offset *len_list, + unsigned *recv_size, MPI_Request *requests, MPI_Status *statuses, int *recd_from_proc, int nprocs, int contig_access_count, @@ -925,13 +966,18 @@ static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node ADIO_Offset *fd_end, MPI_Aint buftype_extent) { + /* this function is only called if buftype is not contig */ - int i, p, flat_buf_idx, size, buf_incr; - int flat_buf_sz, size_in_buf, n_buftypes; + int i, p, flat_buf_idx; + ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; + int n_buftypes; ADIO_Offset off, len, rem_len, user_buf_idx; + /* Not sure unsigned is necessary, but it makes the math safer */ + unsigned *curr_from_proc, *done_from_proc, *recv_buf_idx; - int *curr_from_proc, *done_from_proc, *recv_buf_idx; + ADIOI_UNREFERENCED_ARG(requests); + ADIOI_UNREFERENCED_ARG(statuses); /* curr_from_proc[p] = amount of data recd from proc. p that has already been accounted for so far @@ -939,9 +985,9 @@ static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node filled into user buffer in previous iterations user_buf_idx = current location in user buffer recv_buf_idx[p] = current location in recv_buf of proc. p */ - curr_from_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - done_from_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int)); - recv_buf_idx = (int *) ADIOI_Malloc(nprocs * sizeof(int)); + curr_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); + done_from_proc = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); + recv_buf_idx = (unsigned *) ADIOI_Malloc(nprocs * sizeof(unsigned)); for (i=0; i < nprocs; i++) { recv_buf_idx[i] = curr_from_proc[i] = 0; @@ -959,7 +1005,7 @@ static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node for (i=0; i done_from_proc[p]) { if (done_from_proc[p] > curr_from_proc[p]) { - size = (int)ADIOI_MIN(curr_from_proc[p] + len - + size = ADIOI_MIN(curr_from_proc[p] + len - done_from_proc[p], recv_size[p]-recv_buf_idx[p]); buf_incr = done_from_proc[p] - curr_from_proc[p]; ADIOI_BUF_INCR - buf_incr = (int)(curr_from_proc[p]+len-done_from_proc[p]); + buf_incr = curr_from_proc[p]+len-done_from_proc[p]; + ADIOI_Assert((done_from_proc[p] + size) == (unsigned)((ADIO_Offset)done_from_proc[p] + size)); curr_from_proc[p] = done_from_proc[p] + size; ADIOI_BUF_COPY } else { - size = (int)ADIOI_MIN(len,recv_size[p]-recv_buf_idx[p]); - buf_incr = (int)len; - curr_from_proc[p] += size; + size = ADIOI_MIN(len,recv_size[p]-recv_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_from_proc[p] + size) == (unsigned)((ADIO_Offset)curr_from_proc[p] + size)); + curr_from_proc[p] += (unsigned) size; ADIOI_BUF_COPY } } else { - curr_from_proc[p] += (int)len; - buf_incr = (int)len; + ADIOI_Assert((curr_from_proc[p] + len) == (unsigned)((ADIO_Offset)curr_from_proc[p] + len)); + curr_from_proc[p] += (unsigned) len; + buf_incr = len; ADIOI_BUF_INCR } } else { - buf_incr = (int)len; + buf_incr = len; ADIOI_BUF_INCR } off += len; diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_read_str.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_read_str.c index 74d1aee3b7..47f3efcc0a 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_read_str.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_read_str.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -13,12 +12,13 @@ { \ if (req_off >= readbuf_off + readbuf_len) { \ readbuf_off = req_off; \ - readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\ + readbuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\ ADIO_ReadContig(fd, readbuf, readbuf_len, MPI_BYTE, \ ADIO_EXPLICIT_OFFSET, readbuf_off, &status1, error_code); \ if (*error_code != MPI_SUCCESS) return; \ } \ while (req_len > readbuf_off + readbuf_len - req_off) { \ + ADIOI_Assert((readbuf_off + readbuf_len - req_off) == (int) (readbuf_off + readbuf_len - req_off));\ partial_read = (int) (readbuf_off + readbuf_len - req_off); \ tmp_buf = (char *) ADIOI_Malloc(partial_read); \ memcpy(tmp_buf, readbuf+readbuf_len-partial_read, partial_read); \ @@ -27,13 +27,14 @@ memcpy(readbuf, tmp_buf, partial_read); \ ADIOI_Free(tmp_buf); \ readbuf_off += readbuf_len-partial_read; \ - readbuf_len = (int) (partial_read + ADIOI_MIN(max_bufsize, \ + readbuf_len = (unsigned) (partial_read + ADIOI_MIN(max_bufsize, \ end_offset-readbuf_off+1)); \ ADIO_ReadContig(fd, readbuf+partial_read, readbuf_len-partial_read, \ MPI_BYTE, ADIO_EXPLICIT_OFFSET, readbuf_off+partial_read, \ &status1, error_code); \ if (*error_code != MPI_SUCCESS) return; \ } \ + ADIOI_Assert(req_len == (size_t)req_len); \ memcpy((char *)buf + userbuf_off, readbuf+req_off-readbuf_off, req_len); \ } @@ -43,21 +44,25 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, ADIO_Offset offset, ADIO_Status *status, int *error_code) { + + /* offset is in units of etype relative to the filetype. */ ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, brd_size, frd_size=0, st_index=0; - int bufsize, num, size, sum, n_etypes_in_filetype, size_in_filetype; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - int filetype_size, etype_size, buftype_size, req_len, partial_read; + ADIO_Offset i_offset, new_brd_size, brd_size, size; + int i, j, k, st_index=0; + unsigned num, bufsize; + int n_etypes_in_filetype; + ADIO_Offset n_filetypes, etype_in_filetype, st_n_filetypes, size_in_filetype; + ADIO_Offset abs_off_in_filetype=0, new_frd_size, frd_size=0, st_frd_size; + int filetype_size, etype_size, buftype_size, partial_read; MPI_Aint filetype_extent, buftype_extent; int buf_count, buftype_is_contig, filetype_is_contig; - ADIO_Offset userbuf_off; + ADIO_Offset userbuf_off, req_len, sum; ADIO_Offset off, req_off, disp, end_offset=0, readbuf_off, start_off; char *readbuf, *tmp_buf, *value; - int flag, st_frd_size, st_n_filetypes, readbuf_len; - int new_brd_size, new_frd_size, info_flag, max_bufsize; + int info_flag; + unsigned max_bufsize, readbuf_len; ADIO_Status status1; if (fd->hints->ds_read == ADIOI_HINT_DISABLE) { @@ -91,12 +96,13 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, MPI_Type_extent(datatype, &buftype_extent); etype_size = fd->etype_size; + ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); bufsize = buftype_size * count; /* get max_bufsize from the info object. */ value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, + ADIOI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); max_bufsize = atoi(value); ADIOI_Free(value); @@ -111,16 +117,16 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, while (flat_buf->type != datatype) flat_buf = flat_buf->next; off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; + fd->disp + (ADIO_Offset)etype_size * offset; start_off = off; end_offset = off + bufsize - 1; readbuf_off = off; readbuf = (char *) ADIOI_Malloc(max_bufsize); - readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1)); + readbuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1)); /* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && (fd->file_system != ADIO_PVFS)) + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); ADIO_ReadContig(fd, readbuf, readbuf_len, MPI_BYTE, @@ -128,15 +134,17 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, if (*error_code != MPI_SUCCESS) return; for (j=0; jcount; i++) { - userbuf_off = j*buftype_extent + flat_buf->indices[i]; - req_off = off; - req_len = flat_buf->blocklens[i]; - ADIOI_BUFFERED_READ - off += flat_buf->blocklens[i]; - } - - if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && (fd->file_system != ADIO_PVFS)) + { + for (i=0; icount; i++) { + userbuf_off = (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_READ + off += flat_buf->blocklens[i]; + } + } + + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; @@ -152,29 +160,36 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, disp = fd->disp; if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; icount; i++) { - if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + flat_file->blocklens[i] - >= offset) { - st_index = i; - frd_size = (int) (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - offset); - flag = 1; - break; - } + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset)n_filetypes * filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i=0; icount; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* frd_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + frd_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + frd_size = dist; + break; } } - } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; + } else { 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); + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; size_in_filetype = etype_in_filetype * etype_size; sum = 0; @@ -190,36 +205,67 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, } /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; + offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + + abs_off_in_filetype; } start_off = offset; + /* Wei-keng Liao: read request is within a single flat_file contig + * block e.g. with subarray types that actually describe the whole + * array */ + if (buftype_is_contig && bufsize <= frd_size) { + ADIO_ReadContig(fd, buf, bufsize, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte that + * can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == frd_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + n_filetypes*filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + return; + } + /* Calculate end_offset, the last byte-offset that will be accessed. e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ st_frd_size = frd_size; st_n_filetypes = n_filetypes; - i = 0; + i_offset = 0; j = st_index; off = offset; frd_size = ADIOI_MIN(st_frd_size, bufsize); - while (i < bufsize) { - i += frd_size; + while (i_offset < bufsize) { + i_offset += frd_size; end_offset = off + frd_size - 1; - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; } - - off = disp + flat_file->indices[j] + (ADIO_Offset) n_filetypes*filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); + off = disp + flat_file->indices[j] + n_filetypes*(ADIO_Offset)filetype_extent; + frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); } /* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && (fd->file_system != ADIO_PVFS)) + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); readbuf_off = 0; @@ -231,12 +277,12 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, /* contiguous in memory, noncontiguous in file. should be the most common case. */ - i = 0; + i_offset = 0; j = st_index; off = offset; n_filetypes = st_n_filetypes; frd_size = ADIOI_MIN(st_frd_size, bufsize); - while (i < bufsize) { + while (i_offset < bufsize) { if (frd_size) { /* TYPE_UB and TYPE_LB can result in frd_size = 0. save system call in such cases */ @@ -245,25 +291,26 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, req_off = off; req_len = frd_size; - userbuf_off = i; + userbuf_off = i_offset; ADIOI_BUFFERED_READ } - i += frd_size; + i_offset += frd_size; if (off + frd_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + (ADIO_Offset) n_filetypes*filetype_extent) + flat_file->blocklens[j] + n_filetypes*(ADIO_Offset)filetype_extent) off += frd_size; /* did not reach end of contiguous block in filetype. no more I/O needed. off is incremented by frd_size. */ else { - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); + n_filetypes*(ADIO_Offset)filetype_extent; + frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); } } } @@ -275,7 +322,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, while (flat_buf->type != datatype) flat_buf = flat_buf->next; k = num = buf_count = 0; - i = (int) (flat_buf->indices[0]); + i_offset = flat_buf->indices[0]; j = st_index; off = offset; n_filetypes = st_n_filetypes; @@ -290,7 +337,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, req_off = off; req_len = size; - userbuf_off = i; + userbuf_off = i_offset; ADIOI_BUFFERED_READ } @@ -299,18 +346,18 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, if (size == frd_size) { /* reached end of contiguous block in file */ - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } - + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; + n_filetypes*(ADIO_Offset)filetype_extent; new_frd_size = flat_file->blocklens[j]; if (size != brd_size) { - i += size; + i_offset += size; new_brd_size -= size; } } @@ -320,7 +367,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, k = (k + 1)%flat_buf->count; buf_count++; - i = (int) (buftype_extent*(buf_count/flat_buf->count) + + i_offset = ((ADIO_Offset)buftype_extent*(ADIO_Offset)(buf_count/flat_buf->count) + flat_buf->indices[k]); new_brd_size = flat_buf->blocklens[k]; if (size != frd_size) { @@ -328,13 +375,14 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count, new_frd_size -= size; } } + ADIOI_Assert(((ADIO_Offset)num + size) == (unsigned)(num + size)); num += size; frd_size = new_frd_size; brd_size = new_brd_size; } } - if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && (fd->file_system != ADIO_PVFS)) + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_read_str_naive.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_read_str_naive.c index 0bba2d3e43..04b39362c2 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_read_str_naive.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_read_str_naive.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -17,11 +16,13 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, /* offset is in units of etype relative to the filetype. */ ADIOI_Flatlist_node *flat_buf, *flat_file; - int brd_size, frd_size=0, b_index; - int bufsize, size, sum, n_etypes_in_filetype, size_in_filetype; - int n_filetypes, etype_in_filetype; + ADIO_Offset size, brd_size, frd_size=0, req_len, sum; + int b_index; + int n_etypes_in_filetype; + ADIO_Offset n_filetypes, etype_in_filetype; ADIO_Offset abs_off_in_filetype=0; - int filetype_size, etype_size, buftype_size, req_len; + unsigned bufsize, filetype_size, buftype_size, size_in_filetype; + int etype_size; MPI_Aint filetype_extent, buftype_extent; int buf_count, buftype_is_contig, filetype_is_contig; ADIO_Offset userbuf_off; @@ -33,17 +34,18 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, ADIOI_Datatype_iscontig(buftype, &buftype_is_contig); ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); - MPI_Type_size(fd->filetype, &filetype_size); + MPI_Type_size(fd->filetype, (int*)&filetype_size); if ( ! filetype_size ) { *error_code = MPI_SUCCESS; return; } MPI_Type_extent(fd->filetype, &filetype_extent); - MPI_Type_size(buftype, &buftype_size); + MPI_Type_size(buftype,(int*) &buftype_size); MPI_Type_extent(buftype, &buftype_extent); etype_size = fd->etype_size; + ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)buftype_size * (ADIO_Offset)count)); bufsize = buftype_size * count; /* contiguous in buftype and filetype is handled elsewhere */ @@ -63,8 +65,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, end_offset = off + bufsize - 1; /* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && - (fd->file_system != ADIO_PVFS)) + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); } @@ -74,11 +75,13 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, */ for (b_count=0; b_count < count; b_count++) { for (b_index=0; b_index < flat_buf->count; b_index++) { - userbuf_off = b_count*buftype_extent + + userbuf_off = (ADIO_Offset)b_count*(ADIO_Offset)buftype_extent + flat_buf->indices[b_index]; req_off = off; req_len = flat_buf->blocklens[b_index]; + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + userbuf_off)); + ADIOI_Assert(req_len == (int) req_len); ADIO_ReadContig(fd, (char *) buf + userbuf_off, req_len, @@ -94,8 +97,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, } } - if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && - (fd->file_system != ADIO_PVFS)) + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); } @@ -105,7 +107,9 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, } else { /* noncontiguous in file */ - int f_index, st_frd_size, st_index = 0, st_n_filetypes; + int f_index, st_index = 0; + ADIO_Offset st_n_filetypes; + ADIO_Offset st_frd_size; int flag; /* First we're going to calculate a set of values for use in all @@ -135,15 +139,15 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, n_filetypes++; for (f_index=0; f_index < flat_file->count; f_index++) { if (disp + flat_file->indices[f_index] + - (ADIO_Offset) n_filetypes*filetype_extent + + n_filetypes*(ADIO_Offset)filetype_extent + flat_file->blocklens[f_index] >= start_off) { /* this block contains our starting position */ st_index = f_index; - frd_size = (int) (disp + flat_file->indices[f_index] + - (ADIO_Offset) n_filetypes*filetype_extent + - flat_file->blocklens[f_index] - start_off); + frd_size = disp + flat_file->indices[f_index] + + n_filetypes*(ADIO_Offset)filetype_extent + + flat_file->blocklens[f_index] - start_off; flag = 1; break; } @@ -152,9 +156,9 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, } else { n_etypes_in_filetype = filetype_size/etype_size; - n_filetypes = (int) (offset / n_etypes_in_filetype); + n_filetypes = offset / n_etypes_in_filetype; etype_in_filetype = (int) (offset % n_etypes_in_filetype); - size_in_filetype = etype_in_filetype * etype_size; + size_in_filetype = (unsigned)etype_in_filetype * (unsigned)etype_size; sum = 0; for (f_index=0; f_index < flat_file->count; f_index++) { @@ -170,7 +174,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, } /* abs. offset in bytes in the file */ - start_off = disp + (ADIO_Offset) n_filetypes*filetype_extent + + start_off = disp + n_filetypes*(ADIO_Offset)filetype_extent + abs_off_in_filetype; } @@ -199,9 +203,9 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, } off = disp + flat_file->indices[f_index] + - (ADIO_Offset) n_filetypes*filetype_extent; + n_filetypes*(ADIO_Offset)filetype_extent; frd_size = ADIOI_MIN(flat_file->blocklens[f_index], - bufsize-(int)userbuf_off); + bufsize-(unsigned)userbuf_off); } /* End of calculations. At this point the following values have @@ -214,8 +218,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, */ /* if atomicity is true, lock (exclusive) the region to be accessed */ - if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && - (fd->file_system != ADIO_PVFS)) + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) { ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); } @@ -239,6 +242,8 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, req_off = off; req_len = frd_size; + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + userbuf_off)); + ADIOI_Assert(req_len == (int) req_len); ADIO_ReadContig(fd, (char *) buf + userbuf_off, req_len, @@ -253,7 +258,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, if (off + frd_size < disp + flat_file->indices[f_index] + flat_file->blocklens[f_index] + - (ADIO_Offset) n_filetypes*filetype_extent) + n_filetypes*(ADIO_Offset)filetype_extent) { /* important that this value be correct, as it is * used to set the offset in the fd near the end of @@ -271,14 +276,14 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, n_filetypes++; } off = disp + flat_file->indices[f_index] + - (ADIO_Offset) n_filetypes*filetype_extent; + n_filetypes*(ADIO_Offset)filetype_extent; frd_size = ADIOI_MIN(flat_file->blocklens[f_index], - bufsize-(int)userbuf_off); + bufsize-(unsigned)userbuf_off); } } } else { - int i, tmp_bufsize = 0; + ADIO_Offset i_offset, tmp_bufsize = 0; /* noncontiguous in memory as well as in file */ ADIOI_Flatten_datatype(buftype); @@ -286,7 +291,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, while (flat_buf->type != buftype) flat_buf = flat_buf->next; b_index = buf_count = 0; - i = (int) (flat_buf->indices[0]); + i_offset = flat_buf->indices[0]; f_index = st_index; off = start_off; n_filetypes = st_n_filetypes; @@ -295,14 +300,16 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, /* while we haven't read size * count bytes, keep going */ while (tmp_bufsize < bufsize) { - int new_brd_size = brd_size, new_frd_size = frd_size; + ADIO_Offset new_brd_size = brd_size, new_frd_size = frd_size; size = ADIOI_MIN(frd_size, brd_size); if (size) { req_off = off; req_len = size; - userbuf_off = i; + userbuf_off = i_offset; + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + userbuf_off)); + ADIOI_Assert(req_len == (int) req_len); ADIO_ReadContig(fd, (char *) buf + userbuf_off, req_len, @@ -323,11 +330,11 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, } off = disp + flat_file->indices[f_index] + - (ADIO_Offset) n_filetypes*filetype_extent; + n_filetypes*(ADIO_Offset)filetype_extent; new_frd_size = flat_file->blocklens[f_index]; if (size != brd_size) { - i += size; + i_offset += size; new_brd_size -= size; } } @@ -337,8 +344,8 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, b_index = (b_index + 1)%flat_buf->count; buf_count++; - i = (int) (buftype_extent*(buf_count/flat_buf->count) + - flat_buf->indices[b_index]); + i_offset = buftype_extent*(buf_count/flat_buf->count) + + flat_buf->indices[b_index]; new_brd_size = flat_buf->blocklens[b_index]; if (size != frd_size) { off += size; @@ -353,7 +360,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, /* unlock the file region if we locked it */ if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && - (fd->file_system != ADIO_PVFS)) + (fd->file_system != ADIO_PVFS) && (fd->file_system != ADIO_PVFS2)) { ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_resize.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_resize.c new file mode 100644 index 0000000000..bf38296c58 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_resize.c @@ -0,0 +1,40 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include +#endif + +void ADIOI_GEN_Resize(ADIO_File fd, ADIO_Offset size, int *error_code) +{ + int err, rank; + static char myname[] = "ADIOI_GEN_RESIZE"; + + MPI_Comm_rank(fd->comm, &rank); + + /* first aggregator performs ftruncate() */ + if (rank == fd->hints->ranklist[0]) { + ADIOI_Assert(size == (off_t) size); + err = ftruncate(fd->fd_sys, (off_t)size); + } + + /* bcast return value */ + MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm); + + /* --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-- */ + + *error_code = MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_seek.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_seek.c index cad0bea50d..115e856177 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_seek.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_seek.c @@ -1,59 +1,47 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "adio.h" #include "adio_extern.h" -#ifdef PROFILE -#include "mpe.h" -#endif - -#ifdef SX4 -#define lseek llseek -#endif - -#ifdef tflops -#define lseek eseek -#endif #ifdef HAVE_UNISTD_H #include #endif ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code) + 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 */ -#ifndef PRINT_ERR_MSG - static char myname[] = "ADIOI_GEN_SEEKINDIVIDUAL"; -#endif - ADIO_Offset off, err; + ADIO_Offset off; ADIOI_Flatlist_node *flat_file; - int i, n_etypes_in_filetype, n_filetypes, etype_in_filetype; + int i; + ADIO_Offset 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; + ADIO_Offset size_in_filetype, sum; + unsigned filetype_size; + int etype_size, filetype_is_contig; MPI_Aint filetype_extent; + ADIOI_UNREFERENCED_ARG(whence); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); etype_size = fd->etype_size; - if (filetype_is_contig) off = fd->disp + etype_size * offset; + if (filetype_is_contig) off = fd->disp + (ADIO_Offset)etype_size * offset; else { flat_file = CtvAccess(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); + MPI_Type_size(fd->filetype, (int*)&filetype_size); if ( ! filetype_size ) { /* Since offset relative to the filetype size, we can't do compute the offset when that result is zero. @@ -63,8 +51,8 @@ ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset, } 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); + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; size_in_filetype = etype_in_filetype * etype_size; sum = 0; @@ -78,30 +66,21 @@ ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset, } /* abs. offset in bytes in the file */ - off = fd->disp + (ADIO_Offset) n_filetypes * filetype_extent + + off = fd->disp + n_filetypes * filetype_extent + abs_off_in_filetype; } -#ifdef PROFILE - MPE_Log_event(11, 0, "start seek"); -#endif - err = lseek(fd->fd_sys, off, SEEK_SET); -#ifdef PROFILE - MPE_Log_event(12, 0, "end seek"); -#endif +/* + * we used to call lseek here and update both fp_ind and fp_sys_posn, but now + * we don't seek and only update fp_ind (ROMIO's idea of where we are in the + * file). We leave the system file descriptor and fp_sys_posn alone. + * The fs-specifc ReadContig and WriteContig will seek to the correct place in + * the file before reading/writing if the 'offset' parameter doesn't match + * fp_sys_posn + */ 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 + *error_code = MPI_SUCCESS; return off; } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_set_sh_fp.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_set_sh_fp.c index 9b0abcf582..8e87912fc9 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_set_sh_fp.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_set_sh_fp.c @@ -1,7 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ @@ -11,25 +9,36 @@ /* set the shared file pointer to "offset" etypes relative to the current view */ +void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); + void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code) { ADIO_Status status; MPI_Comm dupcommself; -#ifdef NFS +#ifdef ROMIO_NFS if (fd->file_system == ADIO_NFS) { ADIOI_NFS_Set_shared_fp(fd, offset, error_code); return; } #endif +#ifdef ROMIO_BGL + /* BGLOCKLESS won't support shared fp */ + if (fd->file_system == ADIO_BGL) { + ADIOI_BGL_Set_shared_fp(fd, offset, error_code); + return; + } +#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, + fd->fns, ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE, - 0, MPI_BYTE, MPI_BYTE, M_ASYNC, + 0, MPI_BYTE, MPI_BYTE, MPI_INFO_NULL, ADIO_PERM_NULL, error_code); } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_set_view.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_set_view.c index e88c78b041..f007fc149c 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_set_view.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_set_view.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -9,6 +8,10 @@ #include "adio.h" #include "adio_extern.h" +/* this used to be implemented in every file system as an fcntl. It makes + * deferred open easier if we know ADIO_Fcntl will always need a file to really + * be open. set_view doesn't modify anything related to the open files. + */ void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, MPI_Info info, int *error_code) { diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_subarray.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_subarray.c new file mode 100644 index 0000000000..f9a32e3c02 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_subarray.c @@ -0,0 +1,98 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" + +int ADIO_Type_create_subarray(int ndims, + int *array_of_sizes, + int *array_of_subsizes, + int *array_of_starts, + int order, + MPI_Datatype oldtype, + MPI_Datatype *newtype) +{ + MPI_Aint extent, disps[3], size; + int i, blklens[3]; + MPI_Datatype tmp1, tmp2, types[3]; + + MPI_Type_extent(oldtype, &extent); + + if (order == MPI_ORDER_FORTRAN) { + /* dimension 0 changes fastest */ + if (ndims == 1) { + MPI_Type_contiguous(array_of_subsizes[0], oldtype, &tmp1); + } + else { + MPI_Type_vector(array_of_subsizes[1], + array_of_subsizes[0], + array_of_sizes[0], oldtype, &tmp1); + + size = (MPI_Aint)array_of_sizes[0]*extent; + for (i=2; i=0; i--) { + size *= (MPI_Aint)array_of_sizes[i+1]; + MPI_Type_hvector(array_of_subsizes[i], 1, size, tmp1, &tmp2); + MPI_Type_free(&tmp1); + tmp1 = tmp2; + } + } + + /* add displacement and UB */ + disps[1] = array_of_starts[ndims-1]; + size = 1; + for (i=ndims-2; i>=0; i--) { + size *= (MPI_Aint)array_of_sizes[i+1]; + disps[1] += size*(MPI_Aint)array_of_starts[i]; + } + } + + disps[1] *= extent; + + disps[2] = extent; + for (i=0; i +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#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 + +/* ADIOI_GEN_IOComplete + * + * This code handles two distinct cases. If ROMIO_HAVE_WORKING_AIO is + * not defined, then I/O was performed by a blocking call already. In + * that case all we need to do is optionally set the bytes in the + * status structure and free the request. + * + * If ROMIO_HAVE_WORKING_AIO is defined, then we may need to wait for I/O + * to complete. + */ +void ADIOI_GEN_IOComplete(ADIO_Request *request, ADIO_Status *status, + int *error_code) +{ + return; + +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_wait_fake.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_wait_fake.c new file mode 100644 index 0000000000..f0be5ecbf7 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_wait_fake.c @@ -0,0 +1,20 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +/* Generic implementation of ReadComplete/WriteComplete simply sets the + * bytes field in the status structure and frees the request. + * + * Same function is used for both reads and writes. + */ +void ADIOI_FAKE_IOComplete(ADIO_Request *request, ADIO_Status *status, + int *error_code) +{ + *error_code = MPI_SUCCESS; + return; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_write.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_write.c new file mode 100644 index 0000000000..3c1eefb09a --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_write.c @@ -0,0 +1,92 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef AGGREGATION_PROFILE +#include "mpe.h" +#endif + +void ADIOI_GEN_WriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code) +{ + int err = -1, datatype_size; + ADIO_Offset len; + static char myname[] = "ADIOI_GEN_WRITECONTIG"; + +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5036, 0, NULL); +#endif + + MPI_Type_size(datatype, &datatype_size); + len = (ADIO_Offset)datatype_size * (ADIO_Offset)count; + ADIOI_Assert(len == (unsigned int) len); /* read takes an unsigned int parm */ + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; + } + + if (fd->fp_sys_posn != offset) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + err = lseek(fd->fd_sys, offset, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + /* --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)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + } + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + err = write(fd->fd_sys, buf, (unsigned int)len); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + /* --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)); + fd->fp_sys_posn = -1; + return; + } + /* --END ERROR HANDLING-- */ + + fd->fp_sys_posn = offset + err; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + fd->fp_ind += err; + } + +#ifdef HAVE_STATUS_SET_BYTES + if (err != -1 && status) MPIR_Status_set_bytes(status, datatype, err); +#endif + + *error_code = MPI_SUCCESS; +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5037, 0, NULL); +#endif +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_write_coll.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_write_coll.c index 616919fc21..51b2573b39 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_write_coll.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_write_coll.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -8,21 +7,23 @@ #include "adio.h" #include "adio_extern.h" -#ifdef PROFILE + +#ifdef AGGREGATION_PROFILE #include "mpe.h" #endif /* prototypes of functions used for collective writes only. */ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype - datatype, int nprocs, int myrank, ADIOI_Access + datatype, int nprocs, int myrank, + ADIOI_Access *others_req, ADIO_Offset *offset_list, - int *len_list, int contig_access_count, ADIO_Offset + ADIO_Offset *len_list, int contig_access_count, ADIO_Offset min_st_offset, ADIO_Offset fd_size, ADIO_Offset *fd_start, ADIO_Offset *fd_end, int *buf_idx, int *error_code); static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, ADIOI_Flatlist_node *flat_buf, ADIO_Offset - *offset_list, int *len_list, int *send_size, + *offset_list, ADIO_Offset *len_list, int *send_size, int *recv_size, ADIO_Offset off, int size, int *count, int *start_pos, int *partial_recv, int *sent_to_proc, int nprocs, @@ -34,8 +35,9 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, int *send_buf_idx, int *curr_to_proc, int *done_to_proc, int *hole, int iter, MPI_Aint buftype_extent, int *buf_idx, int *error_code); -static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node *flat_buf, char **send_buf, ADIO_Offset - *offset_list, int *len_list, int *send_size, +static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node + *flat_buf, char **send_buf, ADIO_Offset + *offset_list, ADIO_Offset *len_list, int *send_size, MPI_Request *requests, int *sent_to_proc, int nprocs, int myrank, int contig_access_count, ADIO_Offset @@ -44,7 +46,7 @@ static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node int *send_buf_idx, int *curr_to_proc, int *done_to_proc, int iter, MPI_Aint buftype_extent); -static void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, +void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, ADIO_Offset *srt_off, int *srt_len, int *start_pos, int nprocs, int nprocs_recv, int total_elements); @@ -69,16 +71,20 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, void *buf, int count, whose request lies in this process's file domain. */ int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank; - int *len_list, contig_access_count, interleave_count; - int buftype_is_contig, *buf_idx; + int contig_access_count=0, interleave_count = 0, buftype_is_contig; int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs; - ADIO_Offset *offset_list, start_offset, end_offset, *st_offsets, orig_fp; - ADIO_Offset *fd_start, *fd_end, fd_size, min_st_offset, *end_offsets; - ADIO_Offset off; - -#ifdef PROFILE - MPE_Log_event(13, 0, "start computation"); -#endif + ADIO_Offset orig_fp, start_offset, end_offset, fd_size, min_st_offset, off; + ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL, + *fd_end = NULL, *end_offsets = NULL; + int *buf_idx = NULL; + ADIO_Offset *len_list = NULL; + int old_error, tmp_error; + + if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { + ADIOI_IOStridedColl (fd, buf, count, ADIOI_WRITE, datatype, + file_ptr_type, offset, status, error_code); + return; + } MPI_Comm_size(fd->comm, &nprocs); MPI_Comm_rank(fd->comm, &myrank); @@ -87,37 +93,40 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, void *buf, int count, * is stored in the hints off the ADIO_File structure */ nprocs_for_coll = fd->hints->cb_nodes; + orig_fp = fd->fp_ind; + /* only check for interleaving if cb_write isn't disabled */ + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + /* For this process's request, calculate the list of offsets and + lengths in the file and determine the start and end offsets. */ -/* For this process's request, calculate the list of offsets and - lengths in the file and determine the start and end offsets. */ - -/* Note: end_offset points to the last byte-offset that will be accessed. - e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ + /* Note: end_offset points to the last byte-offset that will be accessed. + e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/ - orig_fp = fd->fp_ind; - ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, - &offset_list, &len_list, &start_offset, - &end_offset, &contig_access_count); + ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset, + &offset_list, &len_list, &start_offset, + &end_offset, &contig_access_count); -/* each process communicates its start and end offsets to other - processes. The result is an array each of start and end offsets stored - in order of process rank. */ + /* each process communicates its start and end offsets to other + processes. The result is an array each of start and end offsets stored + in order of process rank. */ - st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset)); - - MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, ADIO_OFFSET, - fd->comm); - MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, ADIO_OFFSET, - fd->comm); - -/* are the accesses of different processes interleaved? */ - interleave_count = 0; - for (i=1; icomm); + MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, + ADIO_OFFSET, fd->comm); + + /* are the accesses of different processes interleaved? */ + for (i=1; ihints->cb_write == ADIOI_HINT_AUTO))) { /* use independent accesses */ - ADIOI_Free(offset_list); - ADIOI_Free(len_list); - ADIOI_Free(st_offsets); - ADIOI_Free(end_offsets); + if (fd->hints->cb_write != ADIOI_HINT_DISABLE) { + ADIOI_Free(offset_list); + ADIOI_Free(len_list); + ADIOI_Free(st_offsets); + ADIOI_Free(end_offsets); + } fd->fp_ind = orig_fp; ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); if (buftype_is_contig && filetype_is_contig) { if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { - off = fd->disp + (fd->etype_size) * offset; - ADIO_WriteContig(fd, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, status, error_code); + off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset; + ADIO_WriteContig(fd, buf, count, datatype, + ADIO_EXPLICIT_OFFSET, + off, status, error_code); } else ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, error_code); + 0, status, error_code); } else ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, - offset, status, error_code); + offset, status, error_code); return; } @@ -154,17 +166,19 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, void *buf, int count, ADIOI_Calc_file_domains(st_offsets, end_offsets, nprocs, nprocs_for_coll, &min_st_offset, - &fd_start, &fd_end, &fd_size); + &fd_start, &fd_end, + fd->hints->min_fdomain_size, &fd_size, + fd->hints->striping_unit); /* calculate what portions of the access requests of this process are located in what file domains */ ADIOI_Calc_my_req(fd, offset_list, len_list, contig_access_count, - min_st_offset, fd_start, fd_end, fd_size, - nprocs, &count_my_req_procs, - &count_my_req_per_proc, &my_req, - &buf_idx); + min_st_offset, fd_start, fd_end, fd_size, + nprocs, &count_my_req_procs, + &count_my_req_per_proc, &my_req, + &buf_idx); /* based on everyone's my_req, calculate what requests of other processes lie in this process's file domain. @@ -174,10 +188,10 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, void *buf, int count, requests of proc. i lie in this process's file domain. */ ADIOI_Calc_others_req(fd, count_my_req_procs, - count_my_req_per_proc, my_req, - nprocs, myrank, - &count_others_req_procs, &others_req); - + count_my_req_per_proc, my_req, + nprocs, myrank, + &count_others_req_procs, &others_req); + ADIOI_Free(count_my_req_per_proc); for (i=0; i < nprocs; i++) { if (my_req[i].count) { @@ -193,6 +207,44 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, void *buf, int count, len_list, contig_access_count, min_st_offset, fd_size, fd_start, fd_end, buf_idx, error_code); + /* If this collective write is followed by an independent write, + * it's possible to have those subsequent writes on other processes + * race ahead and sneak in before the read-modify-write completes. + * We carry out a collective communication at the end here so no one + * can start independent i/o before collective I/O completes. + * + * need to do some gymnastics with the error codes so that if something + * went wrong, all processes report error, but if a process has a more + * specific error code, we can still have that process report the + * additional information */ + + old_error = *error_code; + if (*error_code != MPI_SUCCESS) *error_code = MPI_ERR_IO; + + /* optimization: if only one process performing i/o, we can perform + * a less-expensive Bcast */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_postwrite_a, 0, NULL ); +#endif + if (fd->hints->cb_nodes == 1) + MPI_Bcast(error_code, 1, MPI_INT, + fd->hints->ranklist[0], fd->comm); + else { + tmp_error = *error_code; + MPI_Allreduce(&tmp_error, error_code, 1, MPI_INT, + MPI_MAX, fd->comm); + } +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_postwrite_b, 0, NULL ); +#endif +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5012, 0, NULL); +#endif + + if ( (old_error != MPI_SUCCESS) && (old_error != MPI_ERR_IO) ) + *error_code = old_error; + + if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); /* free all memory allocated for collective I/O */ @@ -227,17 +279,25 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, void *buf, int count, #endif fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5013, 0, NULL); +#endif } +/* If successful, error_code is set to MPI_SUCCESS. Otherwise an error + * code is created and returned in error_code. + */ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype - datatype, int nprocs, int myrank, ADIOI_Access - *others_req, ADIO_Offset *offset_list, - int *len_list, int contig_access_count, ADIO_Offset - min_st_offset, ADIO_Offset fd_size, - ADIO_Offset *fd_start, ADIO_Offset *fd_end, - int *buf_idx, int *error_code) + datatype, int nprocs, + int myrank, + ADIOI_Access + *others_req, ADIO_Offset *offset_list, + ADIO_Offset *len_list, int contig_access_count, + ADIO_Offset min_st_offset, ADIO_Offset fd_size, + ADIO_Offset *fd_start, ADIO_Offset *fd_end, + int *buf_idx, int *error_code) { /* Send data to appropriate processes and write in sizes of no more than coll_bufsize. @@ -248,7 +308,9 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype array to a file, where each local array is 8Mbytes, requiring at least another 8Mbytes of temp space is unacceptable. */ - int hole, i, j, m, size=0, ntimes, max_ntimes, buftype_is_contig; + /* Not convinced end_loc-st_loc couldn't be > int, so make these offsets*/ + ADIO_Offset size=0; + int hole, i, j, m, ntimes, max_ntimes, buftype_is_contig; ADIO_Offset st_loc=-1, end_loc=-1, off, done, req_off; char *write_buf=NULL; int *curr_offlen_ptr, *count, *send_size, req_len, *recv_size; @@ -259,6 +321,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype MPI_Aint buftype_extent; int info_flag, coll_bufsize; char *value; + static char myname[] = "ADIOI_EXCH_AND_WRITE"; *error_code = MPI_SUCCESS; /* changed below if error */ /* only I/O errors are currently reported */ @@ -268,7 +331,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype That gives the no. of communication phases as well. */ value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(fd->info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, + ADIOI_Info_get(fd->info, "cb_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag); coll_bufsize = atoi(value); ADIOI_Free(value); @@ -293,7 +356,9 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype ntimes = (int) ((end_loc - st_loc + coll_bufsize)/coll_bufsize); - if ((st_loc==-1) && (end_loc==-1)) ntimes = 0; /* this process does no I/O. */ + if ((st_loc==-1) && (end_loc==-1)) { + ntimes = 0; /* this process does no writing. */ + } MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, fd->comm); @@ -347,17 +412,14 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype common, let me do the simplest thing possible here: Each process completes all pending nonblocking operations before completing. */ - ADIOI_Complete_async(error_code); + /*ADIOI_Complete_async(error_code); if (*error_code != MPI_SUCCESS) return; MPI_Barrier(fd->comm); + */ done = 0; off = st_loc; -#ifdef PROFILE - MPE_Log_event(14, 0, "end computation"); -#endif - for (m=0; m < ntimes; m++) { /* go through all others_req and check which will be satisfied by the current write */ @@ -376,12 +438,9 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype /* first calculate what should be communicated */ -#ifdef PROFILE - MPE_Log_event(13, 0, "start computation"); -#endif for (i=0; i < nprocs; i++) count[i] = recv_size[i] = 0; - size = (int) (ADIOI_MIN(coll_bufsize, end_loc-st_loc+1-done)); + size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); for (i=0; i < nprocs; i++) { if (others_req[i].count) { @@ -405,19 +464,32 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype } if (req_off < off + size) { count[i]++; + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)write_buf)+req_off-off) == (ADIO_Offset)(MPIR_Upint)(write_buf+req_off-off)); MPI_Address(write_buf+req_off-off, &(others_req[i].mem_ptrs[j])); - recv_size[i] += (int)(ADIOI_MIN(off + (ADIO_Offset)size - - req_off, req_len)); + ADIOI_Assert((off + size - req_off) == (int)(off + size - req_off)); + recv_size[i] += (int)(ADIOI_MIN(off + size - req_off, + (unsigned)req_len)); - if (off+size-req_off < req_len) { + if (off+size-req_off < (unsigned)req_len) + { partial_recv[i] = (int) (off + size - req_off); + + /* --BEGIN ERROR HANDLING-- */ if ((j+1 < others_req[i].count) && - (others_req[i].offsets[j+1] < - off+size)) { - FPRINTF(stderr, "Error: the filetype specifies an overlapping write\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + (others_req[i].offsets[j+1] < off+size)) + { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, + __LINE__, + MPI_ERR_ARG, + "Filetype specifies overlapping write regions (which is illegal according to the MPI-2 specification)", 0); + /* allow to continue since additional + * communication might have to occur + */ } + /* --END ERROR HANDLING-- */ break; } } @@ -427,10 +499,6 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype } } -#ifdef PROFILE - MPE_Log_event(14, 0, "end computation"); - MPE_Log_event(7, 0, "start communication"); -#endif ADIOI_W_Exchange_data(fd, buf, write_buf, flat_buf, offset_list, len_list, send_size, recv_size, off, size, count, start_pos, partial_recv, @@ -441,16 +509,14 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype done_to_proc, &hole, m, buftype_extent, buf_idx, error_code); if (*error_code != MPI_SUCCESS) return; -#ifdef PROFILE - MPE_Log_event(8, 0, "end communication"); -#endif flag = 0; for (i=0; i srt_len[0]) srt_len[0] = new_len; + } + else + break; + } + if (i < sum || size != srt_len[0]) /* hole in middle or end */ + *hole = 1; } - ADIOI_Free(srt_off); - ADIOI_Free(srt_len); + ADIOI_Free(srt_off); + ADIOI_Free(srt_len); + } if (nprocs_recv) { if (*hole) { ADIO_ReadContig(fd, write_buf, size, MPI_BYTE, - ADIO_EXPLICIT_OFFSET, off, &status, &err); + ADIO_EXPLICIT_OFFSET, off, &status, &err); + /* --BEGIN ERROR HANDLING-- */ if (err != MPI_SUCCESS) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "ADIOI_GEN_WriteStridedColl: 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); -#else - *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_READ_PERM, - myname, (char *) 0, (char *) 0); - ADIOI_Error(fd, *error_code, myname); - return; -#endif + *error_code = MPIO_Err_create_code(err, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_IO, + "**ioRMWrdwr", 0); + return; } + /* --END ERROR HANDLING-- */ } } nprocs_send = 0; for (i=0; i < nprocs; i++) if (send_size[i]) nprocs_send++; - requests = (MPI_Request *) - ADIOI_Malloc((nprocs_send+nprocs_recv+1)*sizeof(MPI_Request)); -/* +1 to avoid a 0-size malloc */ - -/* post receives */ - j = 0; - for (i=0; icomm, requests+j); - j++; - } + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send+1)*sizeof(MPI_Request)); + send_req = requests; + } + else { + requests = (MPI_Request *) + ADIOI_Malloc((nprocs_send+nprocs_recv+1)*sizeof(MPI_Request)); + /* +1 to avoid a 0-size malloc */ + + /* post receives */ + j = 0; + for (i=0; icomm, requests+j); + j++; + } + } + send_req = requests + nprocs_recv; } /* post sends. if buftype_is_contig, data can be directly sent from user buf at location given by buf_idx. else use send_buf. */ +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5032, 0, NULL); +#endif if (buftype_is_contig) { j = 0; for (i=0; i < nprocs; i++) if (send_size[i]) { MPI_Isend(((char *) buf) + buf_idx[i], send_size[i], MPI_BYTE, i, myrank+i+100*iter, fd->comm, - requests+nprocs_recv+j); + send_req+j); j++; buf_idx[i] += send_size[i]; } @@ -645,7 +738,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, ADIOI_Fill_send_buffer(fd, buf, flat_buf, send_buf, offset_list, len_list, send_size, - requests+nprocs_recv, + send_req, sent_to_proc, nprocs, myrank, contig_access_count, min_st_offset, fd_size, fd_start, fd_end, @@ -654,20 +747,54 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, /* the send is done in ADIOI_Fill_send_buffer */ } + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + j = 0; + for (i=0; icomm, &wkl_status); + j++; + } + } + } + for (i=0; iatomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+1) * \ + sizeof(MPI_Status)); + /* +1 to avoid a 0-size malloc */ + } + else { + statuses = (MPI_Status *) ADIOI_Malloc((nprocs_send+nprocs_recv+1) * \ sizeof(MPI_Status)); - /* +1 to avoid a 0-size malloc */ + /* +1 to avoid a 0-size malloc */ + } #ifdef NEEDS_MPI_TEST i = 0; - while (!i) MPI_Testall(nprocs_send+nprocs_recv, requests, &i, statuses); + if (fd->atomicity) { + /* bug fix from Wei-keng Liao and Kenin Coloma */ + while (!i) MPI_Testall(nprocs_send, send_req, &i, statuses); + } + else { + while (!i) MPI_Testall(nprocs_send+nprocs_recv, requests, &i, statuses); + } #else - MPI_Waitall(nprocs_send+nprocs_recv, requests, statuses); + if (fd->atomicity) + /* bug fix from Wei-keng Liao and Kenin Coloma */ + MPI_Waitall(nprocs_send, send_req, statuses); + else + MPI_Waitall(nprocs_send+nprocs_recv, requests, statuses); #endif +#ifdef AGGREGATION_PROFILE + MPE_Log_event (5033, 0, NULL); +#endif ADIOI_Free(statuses); ADIOI_Free(requests); if (!buftype_is_contig && nprocs_send) { @@ -677,7 +804,6 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, } } - #define ADIOI_BUF_INCR \ { \ while (buf_incr) { \ @@ -691,7 +817,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, n_buftypes++; \ } \ user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - n_buftypes*buftype_extent; \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ } \ buf_incr -= size_in_buf; \ @@ -703,6 +829,8 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, { \ while (size) { \ size_in_buf = ADIOI_MIN(size, flat_buf_sz); \ + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + user_buf_idx)); \ + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ memcpy(&(send_buf[p][send_buf_idx[p]]), \ ((char *) buf) + user_buf_idx, size_in_buf); \ send_buf_idx[p] += size_in_buf; \ @@ -715,7 +843,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, n_buftypes++; \ } \ user_buf_idx = flat_buf->indices[flat_buf_idx] + \ - n_buftypes*buftype_extent; \ + (ADIO_Offset)n_buftypes*(ADIO_Offset)buftype_extent; \ flat_buf_sz = flat_buf->blocklens[flat_buf_idx]; \ } \ size -= size_in_buf; \ @@ -726,9 +854,11 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, + + static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node *flat_buf, char **send_buf, ADIO_Offset - *offset_list, int *len_list, int *send_size, + *offset_list, ADIO_Offset *len_list, int *send_size, MPI_Request *requests, int *sent_to_proc, int nprocs, int myrank, int contig_access_count, @@ -740,8 +870,9 @@ static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node { /* this function is only called if buftype is not contig */ - int i, p, flat_buf_idx, size; - int flat_buf_sz, buf_incr, size_in_buf, jj, n_buftypes; + int i, p, flat_buf_idx; + ADIO_Offset flat_buf_sz, size_in_buf, buf_incr, size; + int jj, n_buftypes; ADIO_Offset off, len, rem_len, user_buf_idx; /* curr_to_proc[p] = amount of data sent to proc. p that has already @@ -768,7 +899,7 @@ static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node for (i=0; i done_to_proc[p]) { if (done_to_proc[p] > curr_to_proc[p]) { - size = (int)ADIOI_MIN(curr_to_proc[p] + len - + size = ADIOI_MIN(curr_to_proc[p] + len - done_to_proc[p], send_size[p]-send_buf_idx[p]); buf_incr = done_to_proc[p] - curr_to_proc[p]; ADIOI_BUF_INCR - buf_incr = (int)(curr_to_proc[p] + len - done_to_proc[p]); + ADIOI_Assert((curr_to_proc[p] + len - done_to_proc[p]) == (unsigned)(curr_to_proc[p] + len - done_to_proc[p])); + buf_incr = curr_to_proc[p] + len - done_to_proc[p]; + ADIOI_Assert((done_to_proc[p] + size) == (unsigned)(done_to_proc[p] + size)); curr_to_proc[p] = done_to_proc[p] + size; ADIOI_BUF_COPY } else { - size = (int)ADIOI_MIN(len,send_size[p]-send_buf_idx[p]); - buf_incr = (int)len; + size = ADIOI_MIN(len,send_size[p]-send_buf_idx[p]); + buf_incr = len; + ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size)); curr_to_proc[p] += size; ADIOI_BUF_COPY } @@ -809,13 +943,14 @@ static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node } } else { - curr_to_proc[p] += (int)len; - buf_incr = (int)len; + ADIOI_Assert((curr_to_proc[p] + len) == (unsigned)((ADIO_Offset)curr_to_proc[p] + len)); + curr_to_proc[p] += len; + buf_incr = len; ADIOI_BUF_INCR } } else { - buf_incr = (int)len; + buf_incr = len; ADIOI_BUF_INCR } off += len; @@ -828,7 +963,7 @@ static void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node -static void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, +void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, ADIO_Offset *srt_off, int *srt_len, int *start_pos, int nprocs, int nprocs_recv, int total_elements) { @@ -862,7 +997,7 @@ static void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, removed the recursion so that there are no function calls. Function calls are too expensive. */ k = i; - while (1) { + for(;;) { l = 2*(k+1) - 1; r = 2*(k+1); @@ -913,7 +1048,7 @@ static void ADIOI_Heap_merge(ADIOI_Access *others_req, int *count, /* Heapify(a, 0, heapsize); */ k = 0; - while (1) { + for (;;) { l = 2*(k+1) - 1; r = 2*(k+1); diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_write_nolock.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_write_nolock.c new file mode 100644 index 0000000000..c4baa5e64c --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_write_nolock.c @@ -0,0 +1,406 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include + +#include "adio.h" +#include "adio_extern.h" + + +/* #define IO_DEBUG 1 */ +void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code) +{ +/* borrowed from old-school PVFS (v1) code. A driver for file systems that + * cannot or do not support client-side buffering + * Does not do data sieving optimization + * Does contain write-combining optimization for noncontig in memory, contig in + * file + */ + +/* offset is in units of etype relative to the filetype. */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + int j, k, err=-1, st_index=0; + ADIO_Offset fwr_size=0, bwr_size, new_bwr_size, new_fwr_size, i_offset, num; + unsigned bufsize; + int n_etypes_in_filetype; + ADIO_Offset n_filetypes, etype_in_filetype, size, sum; + ADIO_Offset abs_off_in_filetype=0, size_in_filetype; + int filetype_size, etype_size, buftype_size; + MPI_Aint filetype_extent, buftype_extent, indx; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset off, disp; + int flag, err_flag=0; + static char myname[] = "ADIOI_NOLOCK_WRITESTRIDED"; +#ifdef IO_DEBUG + int rank,nprocs; +#endif + + /* --BEGIN ERROR HANDLING-- */ + if (fd->atomicity) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_INTERN, + "Atomic mode set in I/O function", 0); + return; + } + /* --END ERROR HANDLING-- */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size(fd->filetype, &filetype_size); + if ( ! filetype_size ) { + *error_code = MPI_SUCCESS; + return; + } + +#ifdef IO_DEBUG + MPI_Comm_rank(fd->comm, &rank); + MPI_Comm_size(fd->comm, &nprocs); +#endif + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(datatype, &buftype_size); + MPI_Type_extent(datatype, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); + bufsize = buftype_size * count; + + if (!buftype_is_contig && filetype_is_contig) { + char *combine_buf, *combine_buf_ptr; + ADIO_Offset combine_buf_remain; +/* noncontiguous in memory, contiguous in file. use writev */ + + ADIOI_Flatten_datatype(datatype); + flat_buf = CtvAccess(ADIOI_Flatlist); + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + /* allocate our "combine buffer" to pack data into before writing */ + combine_buf = (char *) ADIOI_Malloc(fd->hints->ind_wr_buffer_size); + combine_buf_ptr = combine_buf; + combine_buf_remain = fd->hints->ind_wr_buffer_size; + + /* seek to the right spot in the file */ + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fd->disp + etype_size * offset; + lseek(fd->fd_sys, off, SEEK_SET); + } + else off = lseek(fd->fd_sys, fd->fp_ind, SEEK_SET); + + /* loop through all the flattened pieces. combine into buffer until + * no more will fit, then write. + * + * special case of a given piece being bigger than the combine buffer + * is also handled. + */ + for (j=0; jcount; i++) { + if (flat_buf->blocklens[i] > combine_buf_remain && combine_buf != combine_buf_ptr) { + /* there is data in the buffer; write out the buffer so far */ +#ifdef IO_DEBUG + printf("[%d/%d] nc mem c file (0) writing loc = %Ld sz = %Ld\n", + rank, nprocs, off, + fd->hints->ind_wr_buffer_size-combine_buf_remain); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + err = write(fd->fd_sys, + combine_buf, + fd->hints->ind_wr_buffer_size - combine_buf_remain); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + if (err == -1) err_flag = 1; + + /* reset our buffer info */ + combine_buf_ptr = combine_buf; + combine_buf_remain = fd->hints->ind_wr_buffer_size; + } + + /* TODO: heuristic for when to not bother to use combine buffer? */ + if (flat_buf->blocklens[i] >= combine_buf_remain) { + /* special case: blocklen is as big as or bigger than the combine buf; + * write directly + */ +#ifdef IO_DEBUG + printf("[%d/%d] nc mem c file (1) writing loc = %Ld sz = %d\n", + rank, nprocs, off, + flat_buf->blocklens[i]); +#endif + ADIOI_Assert(flat_buf->blocklens[i] == (unsigned)flat_buf->blocklens[i]); + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i]) == (ADIO_Offset)((MPIR_Upint)buf + (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i])); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + err = write(fd->fd_sys, + ((char *) buf) + (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i], + (unsigned)flat_buf->blocklens[i]); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + if (err == -1) err_flag = 1; + off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ + } + else { + /* copy more data into combine buffer */ + memcpy(combine_buf_ptr, + ((char *) buf) + j*buftype_extent + flat_buf->indices[i], + flat_buf->blocklens[i]); + combine_buf_ptr += flat_buf->blocklens[i]; + combine_buf_remain -= flat_buf->blocklens[i]; + off += flat_buf->blocklens[i]; /* keep up with the final file offset too */ + } + } + } + + if (combine_buf_ptr != combine_buf) { + /* data left in buffer to write */ +#ifdef IO_DEBUG + printf("[%d/%d] nc mem c file (2) writing loc = %Ld sz = %Ld\n", + rank, nprocs, off, + fd->hints->ind_wr_buffer_size-combine_buf_remain); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + err = write(fd->fd_sys, + combine_buf, + fd->hints->ind_wr_buffer_size - combine_buf_remain); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + if (err == -1) err_flag = 1; + } + + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; + + ADIOI_Free(combine_buf); + + if (err_flag) { + *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; + } /* if (!buftype_is_contig && filetype_is_contig) ... */ + + else { /* noncontiguous in file */ + +/* split up into several contiguous writes */ + +/* find starting location in the file */ + +/* filetype already flattened in ADIO_Open */ + flat_file = CtvAccess(ADIOI_Flatlist); + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + offset = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + int i; + n_filetypes++; + for (i=0; icount; i++) { + if (disp + flat_file->indices[i] + + n_filetypes*(ADIO_Offset)filetype_extent + flat_file->blocklens[i] + >= offset) { + st_index = i; + fwr_size = disp + flat_file->indices[i] + + n_filetypes*(ADIO_Offset)filetype_extent + + flat_file->blocklens[i] - offset; + flag = 1; + break; + } + } + } + } + else { + int i; + n_etypes_in_filetype = filetype_size/etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (i=0; icount; i++) { + sum += flat_file->blocklens[i]; + if (sum > size_in_filetype) { + st_index = i; + fwr_size = 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 */ + offset = disp + n_filetypes*(ADIO_Offset)filetype_extent + abs_off_in_filetype; + } + + if (buftype_is_contig && !filetype_is_contig) { + +/* contiguous in memory, noncontiguous in file. should be the most + common case. */ + + i_offset = 0; + j = st_index; + off = offset; + fwr_size = ADIOI_MIN(fwr_size, bufsize); + while (i_offset < bufsize) { + if (fwr_size) { + /* TYPE_UB and TYPE_LB can result in + fwr_size = 0. save system call in such cases */ +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL); +#endif +#ifdef IO_DEBUG + printf("[%d/%d] c mem nc file writing loc = %Ld sz = %d\n", + rank, nprocs, off, fwr_size); +#endif + err = lseek(fd->fd_sys, off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL); +#endif + if (err == -1) err_flag = 1; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_a, 0, NULL); +#endif + err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event(ADIOI_MPE_write_b, 0, NULL); +#endif + if (err == -1) err_flag = 1; + } + i_offset += fwr_size; + + if (off + fwr_size < disp + flat_file->indices[j] + + flat_file->blocklens[j] + n_filetypes*(ADIO_Offset)filetype_extent) + off += fwr_size; + /* did not reach end of contiguous block in filetype. + no more I/O needed. off is incremented by fwr_size. */ + else { + if (j < (flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); + } + } + } + else { +/* noncontiguous in memory as well as in file */ + + ADIOI_Flatten_datatype(datatype); + flat_buf = CtvAccess(ADIOI_Flatlist); + while (flat_buf->type != datatype) flat_buf = flat_buf->next; + + k = num = buf_count = 0; + indx = flat_buf->indices[0]; + j = st_index; + off = offset; + bwr_size = flat_buf->blocklens[0]; + + while (num < bufsize) { + size = ADIOI_MIN(fwr_size, bwr_size); + if (size) { +#ifdef IO_DEBUG + printf("[%d/%d] nc mem nc file writing loc = %Ld sz = %d\n", + rank, nprocs, off, size); +#endif +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); +#endif + lseek(fd->fd_sys, off, SEEK_SET); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); +#endif + if (err == -1) err_flag = 1; +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_a, 0, NULL ); +#endif + ADIOI_Assert(size == (size_t) size); + ADIOI_Assert(off == (off_t) off); + err = write(fd->fd_sys, ((char *) buf) + indx, size); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_write_b, 0, NULL ); +#endif + if (err == -1) err_flag = 1; + } + + new_fwr_size = fwr_size; + new_bwr_size = bwr_size; + + if (size == fwr_size) { +/* reached end of contiguous block in file */ + if (j < (flat_file->count - 1)) j++; + else { + j = 0; + n_filetypes++; + } + + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + + new_fwr_size = flat_file->blocklens[j]; + if (size != bwr_size) { + indx += size; + new_bwr_size -= size; + } + } + + if (size == bwr_size) { +/* reached end of contiguous block in memory */ + + k = (k + 1)%flat_buf->count; + buf_count++; + indx = buftype_extent*(buf_count/flat_buf->count) + + flat_buf->indices[k]; + new_bwr_size = flat_buf->blocklens[k]; + if (size != fwr_size) { + off += size; + new_fwr_size -= size; + } + } + num += size; + fwr_size = new_fwr_size; + bwr_size = new_bwr_size; + } + } + + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; + if (err_flag) { + *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; + } + + fd->fp_sys_posn = -1; /* set it to null. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +/* This is a temporary way of filling in status. The right way is to + keep track of how much data was actually written by ADIOI_BUFFERED_WRITE. */ +#endif + + if (!buftype_is_contig) ADIOI_Delete_flattened(datatype); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_write_str.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_write_str.c index 50dca21332..81392070c7 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/ad_write_str.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_write_str.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -16,35 +15,54 @@ ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (*error_code != MPI_SUCCESS) return; \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + return; \ + } \ } \ writebuf_off = req_off; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ if (*error_code != MPI_SUCCESS) { \ - FPRINTF(stderr, "ADIOI_GEN_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(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowsrc", 0); \ + return; \ } \ } \ - write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + write_sz = (unsigned) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off));\ memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ while (write_sz != req_len) { \ ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ - if (*error_code != MPI_SUCCESS) return; \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + return; \ + } \ req_len -= write_sz; \ userbuf_off += write_sz; \ writebuf_off += writebuf_len; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \ ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \ ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ if (*error_code != MPI_SUCCESS) { \ - FPRINTF(stderr, "ADIOI_GEN_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(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowsrc", 0); \ + return; \ } \ write_sz = ADIOI_MIN(req_len, writebuf_len); \ memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ @@ -59,47 +77,78 @@ if (req_off >= writebuf_off + writebuf_len) { \ ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) return; \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + return; \ + } \ writebuf_off = req_off; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ } \ - write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + write_sz = (unsigned) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \ + ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off));\ memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\ while (write_sz != req_len) { \ ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \ ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \ - if (*error_code != MPI_SUCCESS) return; \ + if (*error_code != MPI_SUCCESS) { \ + *error_code = MPIO_Err_create_code(*error_code, \ + MPIR_ERR_RECOVERABLE, myname, \ + __LINE__, MPI_ERR_IO, \ + "**iowswc", 0); \ + return; \ + } \ req_len -= write_sz; \ userbuf_off += write_sz; \ writebuf_off += writebuf_len; \ - writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\ write_sz = ADIOI_MIN(req_len, writebuf_len); \ memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\ } \ } - - void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, int file_ptr_type, ADIO_Offset offset, ADIO_Status *status, int *error_code) { + /* offset is in units of etype relative to the filetype. */ ADIOI_Flatlist_node *flat_buf, *flat_file; - int i, j, k, bwr_size, fwr_size=0, st_index=0; - int bufsize, num, size, sum, n_etypes_in_filetype, size_in_filetype; - int n_filetypes, etype_in_filetype; + ADIO_Offset i_offset, sum, size_in_filetype; + int i, j, k, st_index=0; + int n_etypes_in_filetype; + ADIO_Offset num, size, n_filetypes, etype_in_filetype, st_n_filetypes; ADIO_Offset abs_off_in_filetype=0; - int filetype_size, etype_size, buftype_size, req_len; + int filetype_size, etype_size, buftype_size; MPI_Aint filetype_extent, buftype_extent; int buf_count, buftype_is_contig, filetype_is_contig; ADIO_Offset userbuf_off; ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off; - char *writebuf, *value; - int flag, st_fwr_size, st_n_filetypes, writebuf_len, write_sz; + char *writebuf; + unsigned bufsize, writebuf_len, max_bufsize, write_sz; ADIO_Status status1; - int new_bwr_size, new_fwr_size, info_flag, max_bufsize; + ADIO_Offset new_bwr_size, new_fwr_size, st_fwr_size, fwr_size=0, bwr_size, req_len; + static char myname[] = "ADIOI_GEN_WriteStrided"; + + if (fd->hints->ds_write == ADIOI_HINT_DISABLE) { + /* if user has disabled data sieving on reads, use naive + * approach instead. + */ + + ADIOI_GEN_WriteStrided_naive(fd, + buf, + count, + datatype, + file_ptr_type, + offset, + status, + error_code); + return; + } + *error_code = MPI_SUCCESS; /* changed below if error */ @@ -117,15 +166,12 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, MPI_Type_extent(datatype, &buftype_extent); etype_size = fd->etype_size; + ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); bufsize = buftype_size * count; /* get max_bufsize from the info object. */ - value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - MPI_Info_get(fd->info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, - &info_flag); - max_bufsize = atoi(value); - ADIOI_Free(value); + max_bufsize = fd->hints->ind_wr_buffer_size; if (!buftype_is_contig && filetype_is_contig) { @@ -136,26 +182,28 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, while (flat_buf->type != datatype) flat_buf = flat_buf->next; off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : - fd->disp + etype_size * offset; + fd->disp + (ADIO_Offset)etype_size * offset; start_off = off; end_offset = off + bufsize - 1; writebuf_off = off; writebuf = (char *) ADIOI_Malloc(max_bufsize); - writebuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-writebuf_off+1)); + writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-writebuf_off+1)); /* if atomicity is true, lock the region to be accessed */ if (fd->atomicity) ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); for (j=0; jcount; i++) { - userbuf_off = j*buftype_extent + flat_buf->indices[i]; - req_off = off; - req_len = flat_buf->blocklens[i]; - ADIOI_BUFFERED_WRITE_WITHOUT_READ - off += flat_buf->blocklens[i]; - } + { + for (i=0; icount; i++) { + userbuf_off = (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i]; + req_off = off; + req_len = flat_buf->blocklens[i]; + ADIOI_BUFFERED_WRITE_WITHOUT_READ + off += flat_buf->blocklens[i]; + } + } /* write the buffer out finally */ ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, @@ -179,29 +227,36 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, disp = fd->disp; if (file_ptr_type == ADIO_INDIVIDUAL) { - offset = fd->fp_ind; /* in bytes */ - n_filetypes = -1; - flag = 0; - while (!flag) { - n_filetypes++; - for (i=0; icount; i++) { - if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + flat_file->blocklens[i] - >= offset) { - st_index = i; - fwr_size = (int) (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - offset); - flag = 1; - break; - } - } - } - } + /* Wei-keng reworked type processing to be a bit more efficient */ + offset = fd->fp_ind - disp; + n_filetypes = (offset - flat_file->indices[0]) / filetype_extent; + offset -= (ADIO_Offset)n_filetypes * filetype_extent; + /* now offset is local to this extent */ + + /* find the block where offset is located, skip blocklens[i]==0 */ + for (i=0; icount; i++) { + ADIO_Offset dist; + if (flat_file->blocklens[i] == 0) continue; + dist = flat_file->indices[i] + flat_file->blocklens[i] - offset; + /* fwr_size is from offset to the end of block i */ + if (dist == 0) { + i++; + offset = flat_file->indices[i]; + fwr_size = flat_file->blocklens[i]; + break; + } + if (dist > 0) { + fwr_size = dist; + break; + } + } + st_index = i; /* starting index in flat_file->indices[] */ + offset += disp + (ADIO_Offset)n_filetypes*filetype_extent; + } else { 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); + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; size_in_filetype = etype_in_filetype * etype_size; sum = 0; @@ -217,32 +272,65 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, } /* abs. offset in bytes in the file */ - offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; + offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + + abs_off_in_filetype; } start_off = offset; + /* Wei-keng Liao:write request is within single flat_file contig block*/ + /* this could happen, for example, with subarray types that are + * actually fairly contiguous */ + if (buftype_is_contig && bufsize <= fwr_size) { + ADIO_WriteContig(fd, buf, bufsize, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + offset, status, error_code); + + if (file_ptr_type == ADIO_INDIVIDUAL) { + /* update MPI-IO file pointer to point to the first byte + * that can be accessed in the fileview. */ + fd->fp_ind = offset + bufsize; + if (bufsize == fwr_size) { + do { + st_index++; + if (st_index == flat_file->count) { + st_index = 0; + n_filetypes++; + } + } while (flat_file->blocklens[st_index] == 0); + fd->fp_ind = disp + flat_file->indices[st_index] + + (ADIO_Offset)n_filetypes*filetype_extent; + } + } + fd->fp_sys_posn = -1; /* set it to null. */ +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, bufsize); +#endif + return; + } + /* Calculate end_offset, the last byte-offset that will be accessed. e.g., if start_offset=0 and 100 bytes to be write, end_offset=99*/ st_fwr_size = fwr_size; st_n_filetypes = n_filetypes; - i = 0; + i_offset = 0; j = st_index; off = offset; fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - while (i < bufsize) { - i += fwr_size; + while (i_offset < bufsize) { + i_offset += fwr_size; end_offset = off + fwr_size - 1; - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } - off = disp + flat_file->indices[j] + (ADIO_Offset) n_filetypes*filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); + off = disp + flat_file->indices[j] + + n_filetypes*(ADIO_Offset)filetype_extent; + fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset); } /* if atomicity is true, lock the region to be accessed */ @@ -252,45 +340,48 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, writebuf_off = 0; writebuf_len = 0; writebuf = (char *) ADIOI_Malloc(max_bufsize); + memset(writebuf, -1, max_bufsize); if (buftype_is_contig && !filetype_is_contig) { /* contiguous in memory, noncontiguous in file. should be the most common case. */ - i = 0; + i_offset = 0; j = st_index; off = offset; n_filetypes = st_n_filetypes; fwr_size = ADIOI_MIN(st_fwr_size, bufsize); - while (i < bufsize) { + while (i_offset < bufsize) { if (fwr_size) { /* TYPE_UB and TYPE_LB can result in fwr_size = 0. save system call in such cases */ /* lseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + i, fwr_size);*/ + err = write(fd->fd_sys, ((char *) buf) + i_offset, fwr_size);*/ req_off = off; req_len = fwr_size; - userbuf_off = i; + userbuf_off = i_offset; ADIOI_BUFFERED_WRITE } - i += fwr_size; + i_offset += fwr_size; if (off + fwr_size < disp + flat_file->indices[j] + - flat_file->blocklens[j] + (ADIO_Offset) n_filetypes*filetype_extent) + flat_file->blocklens[j] + n_filetypes*(ADIO_Offset)filetype_extent) off += fwr_size; /* did not reach end of contiguous block in filetype. no more I/O needed. off is incremented by fwr_size. */ else { - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; - } + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + } off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; - fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i); + n_filetypes*(ADIO_Offset)filetype_extent; + fwr_size = ADIOI_MIN(flat_file->blocklens[j], + bufsize-i_offset); } } } @@ -302,7 +393,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, while (flat_buf->type != datatype) flat_buf = flat_buf->next; k = num = buf_count = 0; - i = (int) (flat_buf->indices[0]); + i_offset = flat_buf->indices[0]; j = st_index; off = offset; n_filetypes = st_n_filetypes; @@ -313,11 +404,11 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, size = ADIOI_MIN(fwr_size, bwr_size); if (size) { /* lseek(fd->fd_sys, off, SEEK_SET); - err = write(fd->fd_sys, ((char *) buf) + i, size); */ + err = write(fd->fd_sys, ((char *) buf) + i_offset, size); */ req_off = off; req_len = size; - userbuf_off = i; + userbuf_off = i_offset; ADIOI_BUFFERED_WRITE } @@ -326,18 +417,19 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, if (size == fwr_size) { /* reached end of contiguous block in file */ - if (j < (flat_file->count - 1)) j++; - else { - j = 0; - n_filetypes++; + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; + while (flat_file->blocklens[j]==0) { + j = (j+1) % flat_file->count; + n_filetypes += (j == 0) ? 1 : 0; } off = disp + flat_file->indices[j] + - (ADIO_Offset) n_filetypes*filetype_extent; + n_filetypes*(ADIO_Offset)filetype_extent; new_fwr_size = flat_file->blocklens[j]; if (size != bwr_size) { - i += size; + i_offset += size; new_bwr_size -= size; } } @@ -347,8 +439,8 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count, k = (k + 1)%flat_buf->count; buf_count++; - i = (int) (buftype_extent*(buf_count/flat_buf->count) + - flat_buf->indices[k]); + i_offset = (ADIO_Offset)buftype_extent*(ADIO_Offset)(buf_count/flat_buf->count) + + flat_buf->indices[k]; new_bwr_size = flat_buf->blocklens[k]; if (size != fwr_size) { off += size; diff --git a/src/libs/ck-libs/ampi/romio/adio/common/ad_write_str_naive.c b/src/libs/ck-libs/ampi/romio/adio/common/ad_write_str_naive.c new file mode 100644 index 0000000000..0ae8f78fcb --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/ad_write_str_naive.c @@ -0,0 +1,380 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2001 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "adio_extern.h" + +void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, void *buf, int count, + MPI_Datatype buftype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code) +{ + /* offset is in units of etype relative to the filetype. */ + + ADIOI_Flatlist_node *flat_buf, *flat_file; + /* bwr == buffer write; fwr == file write */ + ADIO_Offset bwr_size, fwr_size=0, sum, size_in_filetype; + int b_index; + unsigned bufsize; + int n_etypes_in_filetype; + ADIO_Offset size, n_filetypes, etype_in_filetype; + ADIO_Offset abs_off_in_filetype=0, req_len; + int filetype_size, etype_size, buftype_size; + MPI_Aint filetype_extent, buftype_extent; + int buf_count, buftype_is_contig, filetype_is_contig; + ADIO_Offset userbuf_off; + ADIO_Offset off, req_off, disp, end_offset=0, start_off; + ADIO_Status status1; + + *error_code = MPI_SUCCESS; /* changed below if error */ + + ADIOI_Datatype_iscontig(buftype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); + + MPI_Type_size(fd->filetype, &filetype_size); + if ( ! filetype_size ) { + *error_code = MPI_SUCCESS; + return; + } + + MPI_Type_extent(fd->filetype, &filetype_extent); + MPI_Type_size(buftype, &buftype_size); + MPI_Type_extent(buftype, &buftype_extent); + etype_size = fd->etype_size; + + ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count)); + bufsize = buftype_size * count; + + /* contiguous in buftype and filetype is handled elsewhere */ + + if (!buftype_is_contig && filetype_is_contig) { + int b_count; + /* noncontiguous in memory, contiguous in file. */ + + ADIOI_Flatten_datatype(buftype); + flat_buf = CtvAccess(ADIOI_Flatlist); + while (flat_buf->type != buftype) flat_buf = flat_buf->next; + + off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : + fd->disp + (ADIO_Offset)etype_size * offset; + + start_off = off; + end_offset = off + bufsize - 1; + + /* if atomicity is true, lock (exclusive) the region to be accessed */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) + { + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + } + + /* for each region in the buffer, grab the data and put it in + * place + */ + for (b_count=0; b_count < count; b_count++) { + for (b_index=0; b_index < flat_buf->count; b_index++) { + userbuf_off = (ADIO_Offset)b_count*(ADIO_Offset)buftype_extent + + flat_buf->indices[b_index]; + req_off = off; + req_len = flat_buf->blocklens[b_index]; + + ADIOI_Assert(req_len == (int) req_len); + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + userbuf_off)); + ADIO_WriteContig(fd, + (char *) buf + userbuf_off, + (int)req_len, + MPI_BYTE, + ADIO_EXPLICIT_OFFSET, + req_off, + &status1, + error_code); + if (*error_code != MPI_SUCCESS) return; + + /* off is (potentially) used to save the final offset later */ + off += flat_buf->blocklens[b_index]; + } + } + + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) + { + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + } + + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; + + } + + else { /* noncontiguous in file */ + int f_index, st_index = 0; + ADIO_Offset st_fwr_size, st_n_filetypes; + int flag; + + /* First we're going to calculate a set of values for use in all + * the noncontiguous in file cases: + * start_off - starting byte position of data in file + * end_offset - last byte offset to be acessed in the file + * st_n_filetypes - how far into the file we start in terms of + * whole filetypes + * st_index - index of block in first filetype that we will be + * starting in (?) + * st_fwr_size - size of the data in the first filetype block + * that we will write (accounts for being part-way + * into writing this block of the filetype + * + */ + + /* filetype already flattened in ADIO_Open */ + flat_file = CtvAccess(ADIOI_Flatlist); + while (flat_file->type != fd->filetype) flat_file = flat_file->next; + disp = fd->disp; + + if (file_ptr_type == ADIO_INDIVIDUAL) { + start_off = fd->fp_ind; /* in bytes */ + n_filetypes = -1; + flag = 0; + while (!flag) { + n_filetypes++; + for (f_index=0; f_index < flat_file->count; f_index++) { + if (disp + flat_file->indices[f_index] + + n_filetypes*(ADIO_Offset)filetype_extent + + flat_file->blocklens[f_index] >= start_off) + { + /* this block contains our starting position */ + + st_index = f_index; + fwr_size = disp + flat_file->indices[f_index] + + n_filetypes*(ADIO_Offset)filetype_extent + + flat_file->blocklens[f_index] - start_off; + flag = 1; + break; + } + } + } + } + else { + n_etypes_in_filetype = filetype_size/etype_size; + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; + size_in_filetype = etype_in_filetype * etype_size; + + sum = 0; + for (f_index=0; f_index < flat_file->count; f_index++) { + sum += flat_file->blocklens[f_index]; + if (sum > size_in_filetype) { + st_index = f_index; + fwr_size = sum - size_in_filetype; + abs_off_in_filetype = flat_file->indices[f_index] + + size_in_filetype - + (sum - flat_file->blocklens[f_index]); + break; + } + } + + /* abs. offset in bytes in the file */ + start_off = disp + n_filetypes*(ADIO_Offset)filetype_extent + + abs_off_in_filetype; + } + + st_fwr_size = fwr_size; + st_n_filetypes = n_filetypes; + + /* start_off, st_n_filetypes, st_index, and st_fwr_size are + * all calculated at this point + */ + + /* Calculate end_offset, the last byte-offset that will be accessed. + * e.g., if start_off=0 and 100 bytes to be written, end_offset=99 + */ + userbuf_off = 0; + f_index = st_index; + off = start_off; + fwr_size = ADIOI_MIN(st_fwr_size, bufsize); + while (userbuf_off < bufsize) { + userbuf_off += fwr_size; + end_offset = off + fwr_size - 1; + + if (f_index < (flat_file->count - 1)) f_index++; + else { + f_index = 0; + n_filetypes++; + } + + off = disp + flat_file->indices[f_index] + + n_filetypes*(ADIO_Offset)filetype_extent; + fwr_size = ADIOI_MIN(flat_file->blocklens[f_index], + bufsize-(unsigned)userbuf_off); + } + + /* End of calculations. At this point the following values have + * been calculated and are ready for use: + * - start_off + * - end_offset + * - st_n_filetypes + * - st_index + * - st_fwr_size + */ + + /* if atomicity is true, lock (exclusive) the region to be accessed */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) + { + ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + } + + if (buftype_is_contig && !filetype_is_contig) { + /* contiguous in memory, noncontiguous in file. should be the + * most common case. + */ + + userbuf_off = 0; + f_index = st_index; + off = start_off; + n_filetypes = st_n_filetypes; + fwr_size = ADIOI_MIN(st_fwr_size, bufsize); + + /* while there is still space in the buffer, write more data */ + while (userbuf_off < bufsize) { + if (fwr_size) { + /* TYPE_UB and TYPE_LB can result in + fwr_size = 0. save system call in such cases */ + req_off = off; + req_len = fwr_size; + + ADIOI_Assert(req_len == (int) req_len); + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + userbuf_off)); + ADIO_WriteContig(fd, + (char *) buf + userbuf_off, + (int)req_len, + MPI_BYTE, + ADIO_EXPLICIT_OFFSET, + req_off, + &status1, + error_code); + if (*error_code != MPI_SUCCESS) return; + } + userbuf_off += fwr_size; + + if (off + fwr_size < disp + flat_file->indices[f_index] + + flat_file->blocklens[f_index] + + n_filetypes*(ADIO_Offset)filetype_extent) + { + /* important that this value be correct, as it is + * used to set the offset in the fd near the end of + * this function. + */ + off += fwr_size; + } + /* did not reach end of contiguous block in filetype. + * no more I/O needed. off is incremented by fwr_size. + */ + else { + if (f_index < (flat_file->count - 1)) f_index++; + else { + f_index = 0; + n_filetypes++; + } + off = disp + flat_file->indices[f_index] + + n_filetypes*(ADIO_Offset)filetype_extent; + fwr_size = ADIOI_MIN(flat_file->blocklens[f_index], + bufsize-(unsigned)userbuf_off); + } + } + } + else { + ADIO_Offset i_offset, tmp_bufsize = 0; + /* noncontiguous in memory as well as in file */ + + ADIOI_Flatten_datatype(buftype); + flat_buf = CtvAccess(ADIOI_Flatlist); + while (flat_buf->type != buftype) flat_buf = flat_buf->next; + + b_index = buf_count = 0; + i_offset = flat_buf->indices[0]; + f_index = st_index; + off = start_off; + n_filetypes = st_n_filetypes; + fwr_size = st_fwr_size; + bwr_size = flat_buf->blocklens[0]; + + /* while we haven't read size * count bytes, keep going */ + while (tmp_bufsize < bufsize) { + ADIO_Offset new_bwr_size = bwr_size, new_fwr_size = fwr_size; + + size = ADIOI_MIN(fwr_size, bwr_size); + if (size) { + req_off = off; + req_len = size; + userbuf_off = i_offset; + + ADIOI_Assert(req_len == (int) req_len); + ADIOI_Assert((((ADIO_Offset)(MPIR_Upint)buf) + userbuf_off) == (ADIO_Offset)(MPIR_Upint)((MPIR_Upint)buf + userbuf_off)); + ADIO_WriteContig(fd, + (char *) buf + userbuf_off, + (int)req_len, + MPI_BYTE, + ADIO_EXPLICIT_OFFSET, + req_off, + &status1, + error_code); + if (*error_code != MPI_SUCCESS) return; + } + + if (size == fwr_size) { + /* reached end of contiguous block in file */ + if (f_index < (flat_file->count - 1)) f_index++; + else { + f_index = 0; + n_filetypes++; + } + + off = disp + flat_file->indices[f_index] + + n_filetypes*(ADIO_Offset)filetype_extent; + + new_fwr_size = flat_file->blocklens[f_index]; + if (size != bwr_size) { + i_offset += size; + new_bwr_size -= size; + } + } + + if (size == bwr_size) { + /* reached end of contiguous block in memory */ + + b_index = (b_index + 1)%flat_buf->count; + buf_count++; + i_offset = (ADIO_Offset)buftype_extent*(ADIO_Offset)(buf_count/flat_buf->count) + + flat_buf->indices[b_index]; + new_bwr_size = flat_buf->blocklens[b_index]; + if (size != fwr_size) { + off += size; + new_fwr_size -= size; + } + } + tmp_bufsize += size; + fwr_size = new_fwr_size; + bwr_size = new_bwr_size; + } + } + + /* unlock the file region if we locked it */ + if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS)) + { + ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1); + } + + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off; + } /* end of (else noncontiguous in file) */ + + fd->fp_sys_posn = -1; /* mark it as invalid. */ + +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, buftype, bufsize); + /* This is a temporary way of filling in status. The right way is to + * keep track of how much data was actually written and placed in buf + */ +#endif + + if (!buftype_is_contig) ADIOI_Delete_flattened(buftype); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/adi_close.c b/src/libs/ck-libs/ampi/romio/adio/common/adi_close.c new file mode 100644 index 0000000000..ce82d31652 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/adi_close.c @@ -0,0 +1,48 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +#ifdef HAVE_UNISTD_H +#include +#endif + + + +void ADIOI_GEN_Close(ADIO_File fd, int *error_code) +{ + int err, derr=0; + static char myname[] = "ADIOI_GEN_CLOSE"; + +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_close_a, 0, NULL ); +#endif + err = close(fd->fd_sys); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_close_b, 0, NULL ); +#endif + if (fd->fd_direct >= 0) { +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_close_a, 0, NULL ); +#endif + derr = close(fd->fd_direct); +#ifdef ADIOI_MPE_LOGGING + MPE_Log_event( ADIOI_MPE_close_b, 0, NULL ); +#endif + } + + fd->fd_sys = -1; + fd->fd_direct = -1; + + if (err == -1 || derr == -1) { + *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; +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/async_list.c b/src/libs/ck-libs/ampi/romio/adio/common/async_list.c index 06d730f719..cd4c48d0c3 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/async_list.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/async_list.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -22,37 +21,37 @@ ADIOI_Async_node *ADIOI_Malloc_async_node(void) ADIOI_Async_node *curr, *ptr; int i; - if (!CtvAccess(ADIOI_Async_avail_head)) { - CtvAccess(ADIOI_Async_avail_head) = (ADIOI_Async_node *) + if (!ADIOI_Async_avail_head) { + ADIOI_Async_avail_head = (ADIOI_Async_node *) ADIOI_Malloc(NUM*sizeof(ADIOI_Async_node)); - curr = CtvAccess(ADIOI_Async_avail_head); + curr = ADIOI_Async_avail_head; for (i=1; inext = CtvAccess(ADIOI_Async_avail_head)+i; + curr->next = ADIOI_Async_avail_head+i; curr = curr->next; } curr->next = NULL; - CtvAccess(ADIOI_Async_avail_tail) = curr; + ADIOI_Async_avail_tail = curr; /* keep track of malloced area that needs to be freed later */ - if (!CtvAccess(ADIOI_Malloc_async_tail)) { - CtvAccess(ADIOI_Malloc_async_tail) = (ADIOI_Malloc_async *) + if (!ADIOI_Malloc_async_tail) { + ADIOI_Malloc_async_tail = (ADIOI_Malloc_async *) ADIOI_Malloc(sizeof(ADIOI_Malloc_async)); - CtvAccess(ADIOI_Malloc_async_head) = CtvAccess(ADIOI_Malloc_async_tail); - CtvAccess(ADIOI_Malloc_async_head)->ptr = CtvAccess(ADIOI_Async_avail_head); - CtvAccess(ADIOI_Malloc_async_head)->next = NULL; + ADIOI_Malloc_async_head = ADIOI_Malloc_async_tail; + ADIOI_Malloc_async_head->ptr = ADIOI_Async_avail_head; + ADIOI_Malloc_async_head->next = NULL; } else { - CtvAccess(ADIOI_Malloc_async_tail)->next = (ADIOI_Malloc_async *) + ADIOI_Malloc_async_tail->next = (ADIOI_Malloc_async *) ADIOI_Malloc(sizeof(ADIOI_Malloc_async)); - CtvAccess(ADIOI_Malloc_async_tail) = CtvAccess(ADIOI_Malloc_async_tail)->next; - CtvAccess(ADIOI_Malloc_async_tail)->ptr = CtvAccess(ADIOI_Async_avail_head); - CtvAccess(ADIOI_Malloc_async_tail)->next = NULL; + ADIOI_Malloc_async_tail = ADIOI_Malloc_async_tail->next; + ADIOI_Malloc_async_tail->ptr = ADIOI_Async_avail_head; + ADIOI_Malloc_async_tail->next = NULL; } } - ptr = CtvAccess(ADIOI_Async_avail_head); - CtvAccess(ADIOI_Async_avail_head) = CtvAccess(ADIOI_Async_avail_head)->next; - if (!CtvAccess(ADIOI_Async_avail_head)) CtvAccess(ADIOI_Async_avail_tail) = NULL; + ptr = ADIOI_Async_avail_head; + ADIOI_Async_avail_head = ADIOI_Async_avail_head->next; + if (!ADIOI_Async_avail_head) ADIOI_Async_avail_tail = NULL; return ptr; } @@ -62,11 +61,11 @@ void ADIOI_Free_async_node(ADIOI_Async_node *node) { /* moves this node to available pool. does not actually free it. */ - if (!CtvAccess(ADIOI_Async_avail_tail)) - CtvAccess(ADIOI_Async_avail_head) = CtvAccess(ADIOI_Async_avail_tail) = node; + if (!ADIOI_Async_avail_tail) + ADIOI_Async_avail_head = ADIOI_Async_avail_tail = node; else { - CtvAccess(ADIOI_Async_avail_tail)->next = node; - CtvAccess(ADIOI_Async_avail_tail) = node; + ADIOI_Async_avail_tail->next = node; + ADIOI_Async_avail_tail = node; } node->next = NULL; } @@ -78,25 +77,27 @@ void ADIOI_Add_req_to_list(ADIO_Request *request) ADIOI_Async_node *curr; - if (!CtvAccess(ADIOI_Async_list_head)) { - CtvAccess(ADIOI_Async_list_head) = ADIOI_Malloc_async_node(); - CtvAccess(ADIOI_Async_list_head)->request = request; - CtvAccess(ADIOI_Async_list_head)->prev = CtvAccess(ADIOI_Async_list_head)->next = NULL; - CtvAccess(ADIOI_Async_list_tail) = CtvAccess(ADIOI_Async_list_head); - (*request)->ptr_in_async_list = CtvAccess(ADIOI_Async_list_head); + if (!ADIOI_Async_list_head) { + ADIOI_Async_list_head = ADIOI_Malloc_async_node(); + ADIOI_Async_list_head->request = request; + ADIOI_Async_list_head->prev = ADIOI_Async_list_head->next = NULL; + ADIOI_Async_list_tail = ADIOI_Async_list_head; + (*request)->ptr_in_async_list = ADIOI_Async_list_head; } else { - curr = CtvAccess(ADIOI_Async_list_tail); + curr = ADIOI_Async_list_tail; curr->next = ADIOI_Malloc_async_node(); - CtvAccess(ADIOI_Async_list_tail) = curr->next; - CtvAccess(ADIOI_Async_list_tail)->request = request; - CtvAccess(ADIOI_Async_list_tail)->prev = curr; - CtvAccess(ADIOI_Async_list_tail)->next = NULL; - (*request)->ptr_in_async_list = CtvAccess(ADIOI_Async_list_tail); + ADIOI_Async_list_tail = curr->next; + ADIOI_Async_list_tail->request = request; + ADIOI_Async_list_tail->prev = curr; + ADIOI_Async_list_tail->next = NULL; + (*request)->ptr_in_async_list = ADIOI_Async_list_tail; } } - +/* Sets error_code to MPI_SUCCESS on success, creates an error code on + * failure. + */ void ADIOI_Complete_async(int *error_code) { /* complete all outstanding async I/O operations so that new ones can be @@ -105,10 +106,12 @@ void ADIOI_Complete_async(int *error_code) ADIO_Status status; ADIO_Request *request; ADIOI_Async_node *tmp; + static char myname[] = "ADIOI_Complete_async"; - if (!CtvAccess(ADIOI_Async_list_head)) *error_code = MPI_SUCCESS; - while (CtvAccess(ADIOI_Async_list_head)) { - request = CtvAccess(ADIOI_Async_list_head)->request; + *error_code = MPI_SUCCESS; + + while (ADIOI_Async_list_head) { + request = ADIOI_Async_list_head->request; (*request)->queued = -1; /* ugly internal hack that prevents ADIOI_xxxComplete from freeing the request object. This is required, because the user will call MPI_Wait @@ -125,17 +128,23 @@ void ADIOI_Complete_async(int *error_code) ADIO_WriteComplete(request, &status, error_code); break; default: - FPRINTF(stderr, "Error in ADIOI_Complete_Async\n"); - break; + /* --BEGIN ERROR HANDLING-- */ + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_INTERN, + "Unknown request optype", 0); + return; + /* --END ERROR HANDLING-- */ } (*request)->queued = 0; /* dequeued, but request object not freed */ - tmp = CtvAccess(ADIOI_Async_list_head); - CtvAccess(ADIOI_Async_list_head) = CtvAccess(ADIOI_Async_list_head)->next; + tmp = ADIOI_Async_list_head; + ADIOI_Async_list_head = ADIOI_Async_list_head->next; ADIOI_Free_async_node(tmp); } - CtvAccess(ADIOI_Async_list_tail) = NULL; + ADIOI_Async_list_tail = NULL; } @@ -151,11 +160,11 @@ void ADIOI_Del_req_from_list(ADIO_Request *request) prev = curr->prev; if (prev) prev->next = curr->next; - else CtvAccess(ADIOI_Async_list_head) = curr->next; + else ADIOI_Async_list_head = curr->next; next = curr->next; if (next) next->prev = prev; - else CtvAccess(ADIOI_Async_list_tail) = prev; + else ADIOI_Async_list_tail = prev; ADIOI_Free_async_node(curr); } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/byte_offset.c b/src/libs/ck-libs/ampi/romio/adio/common/byte_offset.c index 27c682f926..12be8188a1 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/byte_offset.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/byte_offset.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -15,10 +14,10 @@ void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, ADIO_Offset *disp) { ADIOI_Flatlist_node *flat_file; - int i, sum, n_etypes_in_filetype, size_in_filetype; - int n_filetypes, etype_in_filetype; - ADIO_Offset abs_off_in_filetype=0; - int filetype_size, etype_size, filetype_is_contig; + int i; + ADIO_Offset n_filetypes, etype_in_filetype, sum, abs_off_in_filetype=0, size_in_filetype; + unsigned n_etypes_in_filetype, filetype_size, etype_size; + int filetype_is_contig; MPI_Aint filetype_extent; ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); @@ -30,10 +29,10 @@ void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, ADIO_Offset *disp) flat_file = CtvAccess(ADIOI_Flatlist); while (flat_file->type != fd->filetype) flat_file = flat_file->next; - MPI_Type_size(fd->filetype, &filetype_size); + MPI_Type_size(fd->filetype, (int*)&filetype_size); 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); + n_filetypes = offset / n_etypes_in_filetype; + etype_in_filetype = offset % n_etypes_in_filetype; size_in_filetype = etype_in_filetype * etype_size; sum = 0; @@ -48,6 +47,6 @@ void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, ADIO_Offset *disp) /* abs. offset in bytes in the file */ MPI_Type_extent(fd->filetype, &filetype_extent); - *disp = fd->disp + (ADIO_Offset) n_filetypes*filetype_extent + abs_off_in_filetype; + *disp = fd->disp + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent + abs_off_in_filetype; } } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/cb_config_list.c b/src/libs/ck-libs/ampi/romio/adio/common/cb_config_list.c index 2ea93ab7f1..c872a17e52 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/cb_config_list.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/cb_config_list.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -38,9 +37,8 @@ #undef CB_CONFIG_LIST_DEBUG /* a couple of globals keep things simple */ - // AMPI: make variables thread-private -CtvStaticDeclare(int, cb_config_list_keyval); //=MPI_KEYVAL_INVALID +CtvStaticDeclare(int, ADIOI_cb_config_list_keyval); //=MPI_KEYVAL_INVALID CtvStaticDeclare(char*, yylval); CtvStaticDeclare(char*, token_ptr); @@ -91,8 +89,8 @@ int ADIOI_cb_bcast_rank_map(ADIO_File fd) /* TEMPORARY -- REMOVE WHEN NO LONGER UPDATING INFO FOR * FS-INDEP. */ value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char)); - sprintf(value, "%d", fd->hints->cb_nodes); - MPI_Info_set(fd->info, "cb_nodes", value); + ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", fd->hints->cb_nodes); + ADIOI_Info_set(fd->info, "cb_nodes", value); ADIOI_Free(value); return 0; @@ -118,25 +116,28 @@ int ADIOI_cb_gather_name_array(MPI_Comm comm, int *procname_len = NULL, my_procname_len, *disp = NULL, i; int commsize, commrank, found; ADIO_cb_name_array array = NULL; + int alloc_size; // AMPI: on first CtvInitialize(), value will be zero; // subsequent initializations will not change the value CtvInitialize(int, cb_config_list_keyval_init_done); if (CtvAccess(cb_config_list_keyval_init_done) != 1) { - CtvAccess(cb_config_list_keyval_init_done) = 1; - CtvInitialize(int, cb_config_list_keyval); - CtvAccess(cb_config_list_keyval) = MPI_KEYVAL_INVALID; + CtvAccess(cb_config_list_keyval_init_done) = 1; + CtvInitialize(int, ADIOI_cb_config_list_keyval); + CtvAccess(ADIOI_cb_config_list_keyval) = MPI_KEYVAL_INVALID; } - if (CtvAccess(cb_config_list_keyval) == MPI_KEYVAL_INVALID) { + if (CtvAccess(ADIOI_cb_config_list_keyval) == MPI_KEYVAL_INVALID) { + /* cleaned up by ADIOI_End_call */ MPI_Keyval_create((MPI_Copy_function *) ADIOI_cb_copy_name_array, (MPI_Delete_function *) ADIOI_cb_delete_name_array, - &CtvAccess(cb_config_list_keyval), NULL); + &CtvAccess(ADIOI_cb_config_list_keyval), NULL); } else { - MPI_Attr_get(comm, CtvAccess(cb_config_list_keyval), (void *) &array, &found); - if (found) { + MPI_Attr_get(comm, CtvAccess(ADIOI_cb_config_list_keyval), (void *) &array, &found); + if (found) { + ADIOI_Assert(array != NULL); *arrayp = array; return 0; } @@ -185,25 +186,27 @@ int ADIOI_cb_gather_name_array(MPI_Comm comm, } #endif + alloc_size = 0; for (i=0; i < commsize; i++) { /* add one to the lengths because we need to count the * terminator, and we are going to use this list of lengths * again in the gatherv. */ - procname_len[i]++; - procname[i] = ADIOI_Malloc(procname_len[i]); - if (procname[i] == NULL) { - return -1; - } + alloc_size += ++procname_len[i]; + } + + procname[0] = ADIOI_Malloc(alloc_size); + if (procname[0] == NULL) { + return -1; + } + + for (i=1; i < commsize; i++) { + procname[i] = procname[i-1] + procname_len[i-1]; } /* create our list of displacements for the gatherv. we're going * to do everything relative to the start of the region allocated * for procname[0] - * - * I suppose it is theoretically possible that the distance between - * malloc'd regions could be more than will fit in an int. We don't - * cover that case. */ disp = ADIOI_Malloc(commsize * sizeof(int)); disp[0] = 0; @@ -247,8 +250,8 @@ int ADIOI_cb_gather_name_array(MPI_Comm comm, * it next time an open is performed on this same comm, and on the * dupcomm, so we can use it in I/O operations. */ - MPI_Attr_put(comm, CtvAccess(cb_config_list_keyval), array); - MPI_Attr_put(dupcomm, CtvAccess(cb_config_list_keyval), array); + MPI_Attr_put(comm, CtvAccess(ADIOI_cb_config_list_keyval), array); + MPI_Attr_put(dupcomm, CtvAccess(ADIOI_cb_config_list_keyval), array); *arrayp = array; return 0; } @@ -349,7 +352,7 @@ int ADIOI_cb_config_list_parse(char *config_list, else { /* AGG_STRING is the only remaining case */ /* save procname (for now) */ - strcpy(cur_procname, CtvAccess(yylval)); + ADIOI_Strncpy(cur_procname, CtvAccess(yylval), MPI_MAX_INFO_VAL+1); cur_procname_p = cur_procname; } @@ -379,7 +382,7 @@ int ADIOI_cb_config_list_parse(char *config_list, /* ADIOI_cb_copy_name_array() - attribute copy routine */ int ADIOI_cb_copy_name_array(MPI_Comm comm, - int *keyval, + int keyval, void *extra, void *attr_in, void **attr_out, @@ -387,8 +390,12 @@ int ADIOI_cb_copy_name_array(MPI_Comm comm, { ADIO_cb_name_array array; + ADIOI_UNREFERENCED_ARG(comm); + ADIOI_UNREFERENCED_ARG(keyval); + ADIOI_UNREFERENCED_ARG(extra); + array = (ADIO_cb_name_array) attr_in; - array->refct++; + if (array != NULL) array->refct++; *attr_out = attr_in; *flag = 1; /* make a copy in the new communicator */ @@ -399,26 +406,31 @@ int ADIOI_cb_copy_name_array(MPI_Comm comm, /* ADIOI_cb_delete_name_array() - attribute destructor */ int ADIOI_cb_delete_name_array(MPI_Comm comm, - int *keyval, + int keyval, void *attr_val, void *extra) { - int i; ADIO_cb_name_array array; + ADIOI_UNREFERENCED_ARG(comm); + ADIOI_UNREFERENCED_ARG(extra); + array = (ADIO_cb_name_array) attr_val; + ADIOI_Assert(array != NULL); array->refct--; if (array->refct <= 0) { - /* time to free the structures (names, array of ptrs to names, struct) + /* time to free the structures (names, array of ptrs to names, struct) */ - for (i=0; i < array->namect; i++) { - ADIOI_Free(array->names[i]); + if (array->namect) { + /* Note that array->names[i], where i > 0, + * are just pointers into the allocated region array->names[0] + */ + ADIOI_Free(array->names[0]); } if (array->names != NULL) ADIOI_Free(array->names); ADIOI_Free(array); } - return MPI_SUCCESS; } @@ -686,19 +698,32 @@ static int get_max_procs(int cb_nodes) * * Returns a token of types defined at top of this file. */ +#ifdef ROMIO_BGL +/* On BlueGene, the ',' character shows up in get_processor_name, so we have to + * use a different delimiter */ +#define COLON ':' +#define COMMA ';' +#define DELIMS ":;" +#else +/* these tokens work for every other platform */ +#define COLON ':' +#define COMMA ',' +#define DELIMS ":," +#endif + static int cb_config_list_lex(void) { int slen; if (*CtvAccess(token_ptr) == '\0') return AGG_EOS; - slen = strcspn(CtvAccess(token_ptr), ":,"); + slen = (int)strcspn(CtvAccess(token_ptr), DELIMS); - if (*CtvAccess(token_ptr) == ':') { + if (*CtvAccess(token_ptr) == COLON) { CtvAccess(token_ptr)++; return AGG_COLON; } - if (*CtvAccess(token_ptr) == ',') { + if (*CtvAccess(token_ptr) == COMMA) { CtvAccess(token_ptr)++; return AGG_COMMA; } @@ -719,7 +744,7 @@ static int cb_config_list_lex(void) * should ensure that no one tries to use wildcards with strings * (e.g. "ccn*"). */ - strncpy(CtvAccess(yylval), CtvAccess(token_ptr), slen); + ADIOI_Strncpy(CtvAccess(yylval), CtvAccess(token_ptr), slen); CtvAccess(yylval)[slen] = '\0'; CtvAccess(token_ptr) += slen; return AGG_STRING; diff --git a/src/libs/ck-libs/ampi/romio/adio/common/eof_offset.c b/src/libs/ck-libs/ampi/romio/adio/common/eof_offset.c index bea8aac6e1..d7d18ff3d5 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/eof_offset.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/eof_offset.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -14,9 +13,10 @@ void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset) { - int error_code, filetype_is_contig, etype_size, filetype_size; - ADIO_Offset fsize, disp, sum, size_in_file; - int n_filetypes, flag, i, rem; + unsigned filetype_size; + int error_code, filetype_is_contig, etype_size; + ADIO_Offset fsize, disp, sum=0, size_in_file, n_filetypes, rem; + int flag, i; ADIO_Fcntl_t *fcntl_struct; MPI_Aint filetype_extent; ADIOI_Flatlist_node *flat_file; @@ -44,7 +44,7 @@ void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset) while (flat_file->type != fd->filetype) flat_file = flat_file->next; - MPI_Type_size(fd->filetype, &filetype_size); + MPI_Type_size(fd->filetype, (int*)&filetype_size); MPI_Type_extent(fd->filetype, &filetype_extent); disp = fd->disp; @@ -56,14 +56,14 @@ void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset) for (i=0; icount; i++) { sum += flat_file->blocklens[i]; if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + + n_filetypes* ADIOI_AINT_CAST_TO_OFFSET filetype_extent + flat_file->blocklens[i] >= fsize) { if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent >= fsize) + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent >= fsize) sum -= flat_file->blocklens[i]; else { - rem = (int) (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + rem = (disp + flat_file->indices[i] + + n_filetypes* ADIOI_AINT_CAST_TO_OFFSET filetype_extent + flat_file->blocklens[i] - fsize); sum -= rem; } @@ -72,7 +72,7 @@ void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset) } } } - size_in_file = (ADIO_Offset) n_filetypes*filetype_size + sum; + size_in_file = n_filetypes*(ADIO_Offset)filetype_size + sum; *eof_offset = (size_in_file+etype_size-1)/etype_size; /* ceiling division */ } } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/error.c b/src/libs/ck-libs/ampi/romio/adio/common/error.c index 2231a01c8e..ce0bc44116 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/error.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/error.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -9,6 +8,9 @@ #include "adio.h" #include "adio_extern.h" +/* NOTE: THIS FUNCTION IS DEPRECATED AND ONLY EXISTS HERE BECAUSE + * SOME DEPRECATED ADIO IMPLEMENTATIONS STILL CALL IT (SFS, HFS, PIOFS). + */ int ADIOI_Error(ADIO_File fd, int error_code, char *string) { char buf[MPI_MAX_ERROR_STRING]; diff --git a/src/libs/ck-libs/ampi/romio/adio/common/flatten.c b/src/libs/ck-libs/ampi/romio/adio/common/flatten.c index e2596ee4c8..b3c9615b7b 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/flatten.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/flatten.c @@ -1,35 +1,53 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * +/* * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "adio.h" #include "adio_extern.h" -#ifdef MPISGI +/* #ifdef MPISGI #include "mpisgi2.h" +#endif */ +#ifdef ROMIO_INSIDE_MPICH2 +#include "mpid_datatype.h" #endif -void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type); +#ifdef USE_DBG_LOGGING + #define FLATTEN_DEBUG 1 +#endif +void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type); /* flatten datatype and add it to Flatlist */ void ADIOI_Flatten_datatype(MPI_Datatype datatype) { +#ifdef HAVE_MPIR_TYPE_FLATTEN + MPI_Aint flatten_idx; +#endif int curr_index=0, is_contig; ADIOI_Flatlist_node *flat, *prev=0; +#ifdef ROMIO_INSIDE_MPICH2 + if(MPIU_DBG_SELECTED(DATATYPE,TYPICAL)) MPIDU_Datatype_debug(datatype, 4); /* use -env MPICH_DBG_OUTPUT=stdout */ +#endif /* check if necessary to flatten. */ /* is it entirely contiguous? */ ADIOI_Datatype_iscontig(datatype, &is_contig); + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: is_contig %#X\n",is_contig); + #endif if (is_contig) return; /* has it already been flattened? */ flat = CtvAccess(ADIOI_Flatlist); while (flat) { - if (flat->type == datatype) return; + if (flat->type == datatype) { + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: found datatype %#X\n", datatype); + #endif + return; + } else { prev = flat; flat = flat->next; @@ -47,52 +65,94 @@ void ADIOI_Flatten_datatype(MPI_Datatype datatype) flat->indices = NULL; flat->count = ADIOI_Count_contiguous_blocks(datatype, &curr_index); -/* FPRINTF(stderr, "%d\n", flat->count);*/ +#ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: count %#X, cur_idx = %#X\n",flat->count,curr_index); +#endif +/* DBG_FPRINTF(stderr, "%d\n", flat->count);*/ if (flat->count) { - flat->blocklens = (int *) ADIOI_Malloc(flat->count * sizeof(int)); - flat->indices = (ADIO_Offset *) ADIOI_Malloc(flat->count * \ - sizeof(ADIO_Offset)); + flat->blocklens = (ADIO_Offset *) ADIOI_Malloc(flat->count * sizeof(ADIO_Offset)); + flat->indices = (ADIO_Offset *) ADIOI_Malloc(flat->count * sizeof(ADIO_Offset)); } curr_index = 0; - +#ifdef HAVE_MPIR_TYPE_FLATTEN + flatten_idx = (MPI_Aint) flat->count; + MPIR_Type_flatten(datatype, flat->indices, flat->blocklens, &flatten_idx); + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: MPIR_Type_flatten\n"); + #endif +#else ADIOI_Flatten(datatype, flat, 0, &curr_index); + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: ADIOI_Flatten\n"); + #endif ADIOI_Optimize_flattened(flat); +#endif /* debug */ - /*FPRINTF(stderr, "blens: "); - for (i=0; icount; i++) - FPRINTF(stderr, "%d ", flat->blocklens[i]); - FPRINTF(stderr, "\n\n"); - FPRINTF(stderr, "indices: "); - for (i=0; icount; i++) - FPRINTF(stderr, "%ld ", flat->indices[i]); - FPRINTF(stderr, "\n\n");*/ +#ifdef FLATTEN_DEBUG + { + int i; + for (i=0; icount; i++) + DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: i %#X, blocklens %#llX, indices %#llX\n", + i, + flat->blocklens[i], + flat->indices[i] + ); + } +#endif } - +/* ADIOI_Flatten() + * + * Assumption: input datatype is not a basic!!!! + */ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, ADIO_Offset st_offset, int *curr_index) { int i, j, k, m, n, num, basic_num, prev_index; - int top_count, combiner, old_combiner, old_is_contig; - int old_size, nints, nadds, ntypes, old_nints, old_nadds, old_ntypes; - MPI_Aint old_extent; + int combiner, old_combiner, old_is_contig; + int nints, nadds, ntypes, old_nints, old_nadds, old_ntypes; + /* By using ADIO_Offset we preserve +/- sign and + avoid >2G integer arithmetic problems */ + ADIO_Offset top_count; + /* By using unsigned we avoid >2G integer arithmetic problems */ + unsigned old_size; + MPI_Aint old_extent;/* Assume extents are non-negative */ int *ints; - MPI_Aint *adds; + MPI_Aint *adds; /* Make no assumptions about +/- sign on these */ MPI_Datatype *types; - MPI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner); ints = (int *) ADIOI_Malloc((nints+1)*sizeof(int)); adds = (MPI_Aint *) ADIOI_Malloc((nadds+1)*sizeof(MPI_Aint)); types = (MPI_Datatype *) ADIOI_Malloc((ntypes+1)*sizeof(MPI_Datatype)); MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints, adds, types); + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: st_offset %#llX, curr_index %#X\n",st_offset,*curr_index); + DBG_FPRINTF(stderr,"ADIOI_Flatten:: nints %#X, nadds %#X, ntypes %#X\n",nints, nadds, ntypes); + for(i=0; i< nints; ++i) + { + DBG_FPRINTF(stderr,"ADIOI_Flatten:: ints[%d]=%#X\n",i,ints[i]); + } + for(i=0; i< nadds; ++i) + { + DBG_FPRINTF(stderr,"ADIOI_Flatten:: adds[%d]="MPI_AINT_FMT_HEX_SPEC"\n",i,adds[i]); + } + for(i=0; i< ntypes; ++i) + { + DBG_FPRINTF(stderr,"ADIOI_Flatten:: types[%d]=%#llX\n",i,(unsigned long long)(unsigned long)types[i]); + } + if(MPIU_DBG_SELECTED(DATATYPE,TYPICAL)) MPIDU_Datatype_debug(datatype, 4); /* use -env MPICH_DBG_OUTPUT=stdout */ + #endif switch (combiner) { -#ifdef MPICH2 +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DUP case MPI_COMBINER_DUP: + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_DUP\n"); + #endif MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); ADIOI_Datatype_iscontig(types[0], &old_is_contig); @@ -100,7 +160,63 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, ADIOI_Flatten(types[0], flat, st_offset, curr_index); break; #endif +#ifdef MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY + case MPI_COMBINER_SUBARRAY: + { + int dims = ints[0]; + MPI_Datatype stype; + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_SUBARRAY\n"); + #endif + + ADIO_Type_create_subarray(dims, + &ints[1], /* sizes */ + &ints[dims+1], /* subsizes */ + &ints[2*dims+1], /* starts */ + ints[3*dims+1], /* order */ + types[0], /* type */ + &stype); + ADIOI_Flatten(stype, flat, st_offset, curr_index); + MPI_Type_free(&stype); + } + break; +#endif +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY + case MPI_COMBINER_DARRAY: + { + int dims = ints[2]; + MPI_Datatype dtype; + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_DARRAY\n"); + #endif + + ADIO_Type_create_darray(ints[0], /* size */ + ints[1], /* rank */ + dims, + &ints[3], /* gsizes */ + &ints[dims+3], /* distribs */ + &ints[2*dims+3], /* dargs */ + &ints[3*dims+3], /* psizes */ + ints[4*dims+3], /* order */ + types[0], + &dtype); + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_DARRAY indices[%#X] %#llX, flat->blocklens[%#X] %#llX, st_offset %#llX, curr_index %#X);\n", + 0, flat->indices[0], 0, flat->blocklens[0], st_offset, *curr_index); + #endif + ADIOI_Flatten(dtype, flat, st_offset, curr_index); + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_DARRAY >ADIOI_Flatten(dtype, flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX, st_offset %#llX, curr_index %#X);\n", + 0, flat->indices[0], 0, flat->blocklens[0], st_offset, *curr_index); + #endif + MPI_Type_free(&dtype); + } + break; +#endif case MPI_COMBINER_CONTIGUOUS: + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_CONTIGUOUS\n"); + #endif top_count = ints[0]; MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); @@ -114,8 +230,11 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, /* simplest case, made up of basic or contiguous types */ j = *curr_index; flat->indices[j] = st_offset; - MPI_Type_size(types[0], &old_size); + MPI_Type_size(types[0], (int*)&old_size); flat->blocklens[j] = top_count * old_size; + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX\n",j, flat->indices[j], j, flat->blocklens[j]); + #endif (*curr_index)++; } else { @@ -127,8 +246,11 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, MPI_Type_extent(types[0], &old_extent); for (m=1; mindices[j] = flat->indices[j-num] + old_extent; + flat->indices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-num]; + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: derived flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX\n",j, flat->indices[j], j, flat->blocklens[j]); + #endif j++; } } @@ -137,6 +259,9 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, break; case MPI_COMBINER_VECTOR: + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_VECTOR\n"); + #endif top_count = ints[0]; MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); @@ -148,18 +273,24 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, if (prev_index == *curr_index) { /* simplest case, vector of basic or contiguous types */ + /* By using ADIO_Offset we preserve +/- sign and + avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1], stride = ints[2]; j = *curr_index; flat->indices[j] = st_offset; - MPI_Type_size(types[0], &old_size); - flat->blocklens[j] = ints[1] * old_size; + MPI_Type_size(types[0], (int*)&old_size); + flat->blocklens[j] = blocklength * old_size; for (i=j+1; iindices[i] = flat->indices[i-1] + ints[2]*old_size; + flat->indices[i] = flat->indices[i-1] + stride * old_size; flat->blocklens[i] = flat->blocklens[j]; } *curr_index = i; } else { /* vector of noncontiguous derived types */ + /* By using ADIO_Offset we preserve +/- sign and + avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1], stride = ints[2]; j = *curr_index; num = *curr_index - prev_index; @@ -167,9 +298,9 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, /* The noncontiguous types have to be replicated blocklen times and then strided. Replicate the first one. */ MPI_Type_extent(types[0], &old_extent); - for (m=1; mindices[j] = flat->indices[j-num] + old_extent; + flat->indices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-num]; j++; } @@ -180,8 +311,7 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, num = *curr_index - prev_index; for (i=1; iindices[j] = flat->indices[j-num] + ints[2] - *old_extent; + flat->indices[j] = flat->indices[j-num] + stride * ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-num]; j++; } @@ -191,6 +321,10 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, break; case MPI_COMBINER_HVECTOR: + case MPI_COMBINER_HVECTOR_INTEGER: + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_HVECTOR_INTEGER\n"); + #endif top_count = ints[0]; MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); @@ -202,10 +336,13 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, if (prev_index == *curr_index) { /* simplest case, vector of basic or contiguous types */ + /* By using ADIO_Offset we preserve +/- sign and + avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1]; j = *curr_index; flat->indices[j] = st_offset; - MPI_Type_size(types[0], &old_size); - flat->blocklens[j] = ints[1] * old_size; + MPI_Type_size(types[0], (int*)&old_size); + flat->blocklens[j] = blocklength * old_size; for (i=j+1; iindices[i] = flat->indices[i-1] + adds[0]; flat->blocklens[i] = flat->blocklens[j]; @@ -214,6 +351,9 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, } else { /* vector of noncontiguous derived types */ + /* By using ADIO_Offset we preserve +/- sign and + avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1]; j = *curr_index; num = *curr_index - prev_index; @@ -221,9 +361,9 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, /* The noncontiguous types have to be replicated blocklen times and then strided. Replicate the first one. */ MPI_Type_extent(types[0], &old_extent); - for (m=1; mindices[j] = flat->indices[j-num] + old_extent; + flat->indices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-num]; j++; } @@ -244,6 +384,9 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, break; case MPI_COMBINER_INDEXED: + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_INDEXED\n"); + #endif top_count = ints[0]; MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); @@ -252,15 +395,23 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, prev_index = *curr_index; if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - ADIOI_Flatten(types[0], flat, - st_offset+ints[top_count+1]*old_extent, curr_index); + { + /* By using ADIO_Offset we preserve +/- sign and + avoid >2G integer arithmetic problems */ + ADIO_Offset stride = ints[top_count+1]; + ADIOI_Flatten(types[0], flat, + st_offset+stride* ADIOI_AINT_CAST_TO_OFFSET old_extent, curr_index); + } if (prev_index == *curr_index) { /* simplest case, indexed type made up of basic or contiguous types */ j = *curr_index; for (i=j; iindices[i] = st_offset + ints[top_count+1+i-j]*old_extent; - flat->blocklens[i] = (int) (ints[1+i-j]*old_extent); + /* By using ADIO_Offset we preserve +/- sign and + avoid >2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1+i-j], stride = ints[top_count+1+i-j]; + flat->indices[i] = st_offset + stride* ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[i] = blocklength* ADIOI_AINT_CAST_TO_OFFSET old_extent; } *curr_index = i; } @@ -275,7 +426,7 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, and then strided. Replicate the first one. */ for (m=1; mindices[j] = flat->indices[j-num] + old_extent; + flat->indices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-num]; j++; } @@ -287,15 +438,17 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, num = *curr_index - prev_index; prev_index = *curr_index; for (m=0; mindices[j] = flat->indices[j-num] + - (ints[top_count+1+i]-ints[top_count+i])*old_extent; + /* By using ADIO_Offset we preserve +/- sign and + avoid >2G integer arithmetic problems */ + ADIO_Offset stride = ints[top_count+1+i]-ints[top_count+i]; + flat->indices[j] = flat->indices[j-num] + stride* ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-num]; j++; } *curr_index = j; for (m=1; mindices[j] = flat->indices[j-basic_num] + old_extent; + flat->indices[j] = flat->indices[j-basic_num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-basic_num]; j++; } @@ -305,7 +458,76 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, } break; + case MPI_COMBINER_INDEXED_BLOCK: + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_INDEXED_BLOCK\n"); + #endif + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, + &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + MPI_Type_extent(types[0], &old_extent); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + { + /* By using ADIO_Offset we preserve +/- sign and + avoid >2G integer arithmetic problems */ + ADIO_Offset stride = ints[1+1]; + ADIOI_Flatten(types[0], flat, + st_offset+stride* ADIOI_AINT_CAST_TO_OFFSET old_extent, curr_index); + } + + if (prev_index == *curr_index) { +/* simplest case, indexed type made up of basic or contiguous types */ + j = *curr_index; + for (i=j; i2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1], stride = ints[1+1+i-j]; + flat->indices[i] = st_offset + stride* ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[i] = blocklength* ADIOI_AINT_CAST_TO_OFFSET old_extent; + } + *curr_index = i; + } + else { +/* vector of noncontiguous derived types */ + + j = *curr_index; + num = *curr_index - prev_index; + +/* The noncontiguous types have to be replicated blocklens[i] times + and then strided. Replicate the first one. */ + for (m=1; mindices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[j] = flat->blocklens[j-num]; + j++; + } + } + *curr_index = j; + +/* Now repeat with strides. */ + num = *curr_index - prev_index; + for (i=1; i2G integer arithmetic problems */ + ADIO_Offset stride = ints[2+i]-ints[1+i]; + flat->indices[j] = flat->indices[j-num] + stride* ADIOI_AINT_CAST_TO_OFFSET old_extent; + flat->blocklens[j] = flat->blocklens[j-num]; + j++; + } + } + *curr_index = j; + } + break; + case MPI_COMBINER_HINDEXED: + case MPI_COMBINER_HINDEXED_INTEGER: + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_HINDEXED_INTEGER\n"); + #endif top_count = ints[0]; MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); @@ -313,15 +535,20 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, prev_index = *curr_index; if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) - ADIOI_Flatten(types[0], flat, st_offset+adds[0], curr_index); + { + ADIOI_Flatten(types[0], flat, st_offset+adds[0], curr_index); + } if (prev_index == *curr_index) { /* simplest case, indexed type made up of basic or contiguous types */ j = *curr_index; - MPI_Type_size(types[0], &old_size); + MPI_Type_size(types[0], (int*)&old_size); for (i=j; i2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1+i-j]; flat->indices[i] = st_offset + adds[i-j]; - flat->blocklens[i] = ints[1+i-j]*old_size; + flat->blocklens[i] = blocklength*old_size; } *curr_index = i; } @@ -337,7 +564,7 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, MPI_Type_extent(types[0], &old_extent); for (m=1; mindices[j] = flat->indices[j-num] + old_extent; + flat->indices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-num]; j++; } @@ -356,7 +583,7 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, *curr_index = j; for (m=1; mindices[j] = flat->indices[j-basic_num] + old_extent; + flat->indices[j] = flat->indices[j-basic_num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-basic_num]; j++; } @@ -367,6 +594,10 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, break; case MPI_COMBINER_STRUCT: + case MPI_COMBINER_STRUCT_INTEGER: + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_STRUCT_INTEGER\n"); + #endif top_count = ints[0]; for (n=0; n2G integer arithmetic problems */ + ADIO_Offset blocklength = ints[1+n]; j = *curr_index; flat->indices[j] = st_offset + adds[n]; - MPI_Type_size(types[n], &old_size); - flat->blocklens[j] = ints[1+n] * old_size; + MPI_Type_size(types[n], (int*)&old_size); + flat->blocklens[j] = blocklength * old_size; + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX\n",n,adds[n],j, flat->indices[j], j, flat->blocklens[j]); + #endif (*curr_index)++; } else { @@ -395,8 +632,11 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, MPI_Type_extent(types[n], &old_extent); for (m=1; mindices[j] = flat->indices[j-num] + old_extent; + flat->indices[j] = flat->indices[j-num] + ADIOI_AINT_CAST_TO_OFFSET old_extent; flat->blocklens[j] = flat->blocklens[j-num]; + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple old_extent "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX\n",old_extent,j, flat->indices[j], j, flat->blocklens[j]); + #endif j++; } } @@ -405,8 +645,63 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, } break; + case MPI_COMBINER_RESIZED: + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: MPI_COMBINER_RESIZED\n"); + #endif + + /* This is done similar to a type_struct with an lb, datatype, ub */ + + /* handle the Lb */ + j = *curr_index; + flat->indices[j] = st_offset + adds[0]; + flat->blocklens[j] = 0; + + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX\n",0,adds[0],j, flat->indices[j], j, flat->blocklens[j]); + #endif + + (*curr_index)++; + + /* handle the datatype */ + + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, + &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) { + ADIOI_Flatten(types[0], flat, st_offset+adds[0], curr_index); + } + else { + /* current type is basic or contiguous */ + j = *curr_index; + flat->indices[j] = st_offset; + MPI_Type_size(types[0], (int*)&old_size); + flat->blocklens[j] = old_size; + + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX\n",0,adds[0],j, flat->indices[j], j, flat->blocklens[j]); + #endif + + (*curr_index)++; + } + + /* take care of the extent as a UB */ + j = *curr_index; + flat->indices[j] = st_offset + adds[0] + adds[1]; + flat->blocklens[j] = 0; + + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#X] %#llX, flat->blocklens[%#X] %#llX\n",1,adds[1],j, flat->indices[j], j, flat->blocklens[j]); + #endif + + (*curr_index)++; + + break; + default: - FPRINTF(stderr, "Error: Unsupported datatype passed to ADIOI_Flatten\n"); + /* TODO: FIXME (requires changing prototypes to return errors...) */ + DBG_FPRINTF(stderr, "Error: Unsupported datatype passed to ADIOI_Flatten\n"); MPI_Abort(MPI_COMM_WORLD, 1); } @@ -423,20 +718,36 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat, ADIOI_Free(ints); ADIOI_Free(adds); ADIOI_Free(types); -} - -/********************************************************/ + #ifdef FLATTEN_DEBUG + DBG_FPRINTF(stderr,"ADIOI_Flatten:: return st_offset %#llX, curr_index %#X\n",st_offset,*curr_index); + #endif +} +/********************************************************/ +/* ADIOI_Count_contiguous_blocks + * + * Returns number of contiguous blocks in type, and also updates + * curr_index to reflect the space for the additional blocks. + * + * ASSUMES THAT TYPE IS NOT A BASIC!!! + */ int ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, int *curr_index) { +#ifdef HAVE_MPIR_TYPE_GET_CONTIG_BLOCKS + /* MPICH2 can get us this value without all the envelope/contents calls */ + int blks; + MPIR_Type_get_contig_blocks(datatype, &blks); + *curr_index = blks; + return blks; +#else int count=0, i, n, num, basic_num, prev_index; int top_count, combiner, old_combiner, old_is_contig; int nints, nadds, ntypes, old_nints, old_nadds, old_ntypes; int *ints; - MPI_Aint *adds; + MPI_Aint *adds; /* Make no assumptions about +/- sign on these */ MPI_Datatype *types; MPI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner); @@ -446,16 +757,65 @@ int ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, int *curr_index) MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints, adds, types); switch (combiner) { -#ifdef MPICH2 +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DUP case MPI_COMBINER_DUP: MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); ADIOI_Datatype_iscontig(types[0], &old_is_contig); if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) count = ADIOI_Count_contiguous_blocks(types[0], curr_index); - else count = 1; + else { + count = 1; + (*curr_index)++; + } break; #endif +#ifdef MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY + case MPI_COMBINER_SUBARRAY: + { + int dims = ints[0]; + MPI_Datatype stype; + + ADIO_Type_create_subarray(dims, + &ints[1], /* sizes */ + &ints[dims+1], /* subsizes */ + &ints[2*dims+1], /* starts */ + ints[3*dims+1], /* order */ + types[0], /* type */ + &stype); + count = ADIOI_Count_contiguous_blocks(stype, curr_index); + /* curr_index will have already been updated; just pass + * count back up. + */ + MPI_Type_free(&stype); + + } + break; +#endif +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY + case MPI_COMBINER_DARRAY: + { + int dims = ints[2]; + MPI_Datatype dtype; + + ADIO_Type_create_darray(ints[0], /* size */ + ints[1], /* rank */ + dims, + &ints[3], /* gsizes */ + &ints[dims+3], /* distribs */ + &ints[2*dims+3], /* dargs */ + &ints[3*dims+3], /* psizes */ + ints[4*dims+3], /* order */ + types[0], + &dtype); + count = ADIOI_Count_contiguous_blocks(dtype, curr_index); + /* curr_index will have already been updated; just pass + * count back up. + */ + MPI_Type_free(&dtype); + } + break; +#endif case MPI_COMBINER_CONTIGUOUS: top_count = ints[0]; MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, @@ -480,6 +840,7 @@ int ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, int *curr_index) case MPI_COMBINER_VECTOR: case MPI_COMBINER_HVECTOR: + case MPI_COMBINER_HVECTOR_INTEGER: top_count = ints[0]; MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); @@ -514,6 +875,7 @@ int ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, int *curr_index) case MPI_COMBINER_INDEXED: case MPI_COMBINER_HINDEXED: + case MPI_COMBINER_HINDEXED_INTEGER: top_count = ints[0]; MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, &old_ntypes, &old_combiner); @@ -546,7 +908,39 @@ int ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, int *curr_index) } break; + case MPI_COMBINER_INDEXED_BLOCK: + top_count = ints[0]; + MPI_Type_get_envelope(types[0], &old_nints, &old_nadds, + &old_ntypes, &old_combiner); + ADIOI_Datatype_iscontig(types[0], &old_is_contig); + + prev_index = *curr_index; + if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig)) + count = ADIOI_Count_contiguous_blocks(types[0], curr_index); + else count = 1; + + if (prev_index == *curr_index) { +/* simplest case, indexed type made up of basic or contiguous types */ + count = top_count; + *curr_index += count; + } + else { +/* indexed type made up of noncontiguous derived types */ + basic_num = *curr_index - prev_index; + +/* The noncontiguous types have to be replicated blocklens[i] times + and then strided. */ + *curr_index += (ints[1]-1) * basic_num; + count *= ints[1]; + +/* Now repeat with strides. */ + *curr_index += (top_count-1) * count; + count *= top_count; + } + break; + case MPI_COMBINER_STRUCT: + case MPI_COMBINER_STRUCT_INTEGER: top_count = ints[0]; count = 0; for (n=0; ncount <= 2) return; + + opt_blocks = 2; /* LB and UB */ + for (i=1; i < flat_type->count -1; i++) { + if(flat_type->blocklens[i] != 0) + opt_blocks++; + } + /* no optimization possible */ + if (opt_blocks == flat_type->count) return; + opt_blocklens = (ADIO_Offset *) ADIOI_Malloc(opt_blocks * sizeof(ADIO_Offset)); + opt_indices = (ADIO_Offset *)ADIOI_Malloc(opt_blocks*sizeof(ADIO_Offset)); + + /* fill in new blocklists, keeping first and last no matter what */ + opt_blocklens[0] = flat_type->blocklens[0]; + opt_indices[0] = flat_type->indices[0]; + j = 1; /* always two entries: one for LB and UB ([0] and [j])*/ + for (i=1; i< flat_type->count -1; i++) { + if( flat_type->blocklens[i] != 0) { + opt_indices[j] = flat_type->indices[i]; + opt_blocklens[j] = flat_type->blocklens[i]; + j++; + } + } + opt_indices[j] = flat_type->indices[flat_type->count -1]; + opt_blocklens[j] = flat_type->blocklens[flat_type->count -1]; + + flat_type->count = opt_blocks; + ADIOI_Free(flat_type->blocklens); + ADIOI_Free(flat_type->indices); + flat_type->blocklens = opt_blocklens; + flat_type->indices = opt_indices; + return; +} /****************************************************************/ @@ -602,13 +1068,18 @@ int ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, int *curr_index) * Scans the blocks of a flattened type and merges adjacent blocks * together, resulting in a shorter blocklist (and thus fewer * contiguous operations). + * + * NOTE: a further optimization would be to remove zero length blocks. However, + * the first and last blocks must remain as zero length first or last block + * indicates UB and LB. + * */ void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type) { int i, j, opt_blocks; - int *opt_blocklens; + ADIO_Offset *opt_blocklens; ADIO_Offset *opt_indices; - + opt_blocks = 1; /* save number of noncontiguous blocks in opt_blocks */ @@ -621,7 +1092,7 @@ void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type) /* if we can't reduce the number of blocks, quit now */ if (opt_blocks == flat_type->count) return; - opt_blocklens = (int *) ADIOI_Malloc(opt_blocks * sizeof(int)); + opt_blocklens = (ADIO_Offset *) ADIOI_Malloc(opt_blocks * sizeof(ADIO_Offset)); opt_indices = (ADIO_Offset *)ADIOI_Malloc(opt_blocks*sizeof(ADIO_Offset)); /* fill in new blocklists */ @@ -643,11 +1114,10 @@ void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type) ADIOI_Free(flat_type->indices); flat_type->blocklens = opt_blocklens; flat_type->indices = opt_indices; + removezeros(flat_type); return; } -/****************************************************************/ - void ADIOI_Delete_flattened(MPI_Datatype datatype) { ADIOI_Flatlist_node *flat, *prev; @@ -664,4 +1134,3 @@ void ADIOI_Delete_flattened(MPI_Datatype datatype) ADIOI_Free(flat); } } - diff --git a/src/libs/ck-libs/ampi/romio/adio/common/gencheck.c b/src/libs/ck-libs/ampi/romio/adio/common/gencheck.c deleted file mode 100644 index cb85215d3c..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/common/gencheck.c +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 2002 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -/* we special-case TESTFS because all it does is wrap logging info around GEN */ -int ADIOI_Uses_generic_read(ADIO_File fd) -{ - ADIOI_Fns *fns = fd->fns; - if (fns->ADIOI_xxx_ReadStridedColl == ADIOI_GEN_ReadStridedColl || - fd->file_system == ADIO_TESTFS ) - { - return 1; - } - return 0; -} - -int ADIOI_Uses_generic_write(ADIO_File fd) -{ - ADIOI_Fns *fns = fd->fns; - if (fns->ADIOI_xxx_WriteStridedColl == ADIOI_GEN_WriteStridedColl || - fd->file_system == ADIO_TESTFS ) - { - return 1; - } - return 0; -} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/get_fp_posn.c b/src/libs/ck-libs/ampi/romio/adio/common/get_fp_posn.c index 48f4f9b5de..50ffc7b045 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/get_fp_posn.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/get_fp_posn.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -8,6 +7,7 @@ #include "adio.h" #include "adio_extern.h" +#include "adioi.h" /* returns the current position of the individual file pointer in etype units relative to the current view. */ @@ -15,10 +15,11 @@ void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset) { ADIOI_Flatlist_node *flat_file; - int i, n_filetypes, flag, frd_size; - int filetype_size, etype_size, filetype_is_contig; + int i, flag; + unsigned filetype_size; + int etype_size, filetype_is_contig; MPI_Aint filetype_extent; - ADIO_Offset disp, byte_offset, sum, size_in_file; + ADIO_Offset disp, byte_offset, sum=0, size_in_file, n_filetypes, frd_size; ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig); etype_size = fd->etype_size; @@ -29,7 +30,7 @@ void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset) flat_file = CtvAccess(ADIOI_Flatlist); while (flat_file->type != fd->filetype) flat_file = flat_file->next; - MPI_Type_size(fd->filetype, &filetype_size); + MPI_Type_size(fd->filetype, (int*)&filetype_size); MPI_Type_extent(fd->filetype, &filetype_extent); disp = fd->disp; @@ -42,18 +43,18 @@ void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset) for (i=0; icount; i++) { sum += flat_file->blocklens[i]; if (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent + flat_file->blocklens[i] + n_filetypes* ADIOI_AINT_CAST_TO_OFFSET filetype_extent + flat_file->blocklens[i] >= byte_offset) { - frd_size = (int) (disp + flat_file->indices[i] + - (ADIO_Offset) n_filetypes*filetype_extent - + flat_file->blocklens[i] - byte_offset); + frd_size = disp + flat_file->indices[i] + + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent + + flat_file->blocklens[i] - byte_offset; sum -= frd_size; flag = 1; break; } } } - size_in_file = (ADIO_Offset) n_filetypes*filetype_size + sum; + size_in_file = n_filetypes * (ADIO_Offset)filetype_size + sum; *offset = size_in_file/etype_size; } } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/greq_fns.c b/src/libs/ck-libs/ampi/romio/adio/common/greq_fns.c new file mode 100644 index 0000000000..8c2154eb0f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/greq_fns.c @@ -0,0 +1,31 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" +#include "mpiu_greq.h" + +/* In cases where nonblocking operation will carry out blocking version, + * instantiate and complete a generalized request */ + +void MPIO_Completed_request_create(MPI_File *fh, MPI_Offset bytes, + int *error_code, MPI_Request *request) +{ + MPI_Status *status; + status = (MPI_Status *)ADIOI_Malloc(sizeof(MPI_Status)); + + status->MPI_ERROR = *error_code; +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, MPI_BYTE, bytes); +#endif + /* --BEGIN ERROR HANDLING-- */ + if (*error_code != MPI_SUCCESS) + *error_code = MPIO_Err_return_file(*fh, *error_code); + /* --END ERROR HANDLING-- */ + MPI_Grequest_start(MPIU_Greq_query_fn, MPIU_Greq_free_fn, + MPIU_Greq_cancel_fn, status, request); + MPI_Grequest_complete(*request); +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/heap-sort.c b/src/libs/ck-libs/ampi/romio/adio/common/heap-sort.c new file mode 100644 index 0000000000..63b6c1c8b5 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/heap-sort.c @@ -0,0 +1,133 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include +#include +#include +#include +#include "heap-sort.h" + +#define NOEXP2 + +static void heapify(heap_t *heap, int i); + +/* From Introduction To Algorithms by Cormen, Leiserson, and Rivest */ + +static inline int parent(int i) { + return (i/2); +} + +static inline int left(int i) { + return (2*i); +} + +static inline int right(int i) { + return (2*i + 1); +} + +int ADIOI_Heap_create(heap_t *heap, int size) { + heap->size = size; + heap->nodes = (heap_node_t *) ADIOI_Calloc (size, sizeof(heap_node_t)); + if (heap->nodes == NULL) + return 1; + else + return 0; +} + +void ADIOI_Heap_free(heap_t *heap) { + ADIOI_Free(heap->nodes); +} + +/* should suppress unused warnings on GCC */ +static void build_heap(heap_t *heap) ATTRIBUTE((unused, used)); + +static void build_heap(heap_t *heap) +{ + int i; + for (i=(heap->size/2-1); i >= 0; i--) + heapify(heap, i); +} + +static void heapify(heap_t *heap, int i) { + int l, r, smallest; + heap_node_t *nodes; + heap_node_t tmp_node; + + nodes = heap->nodes; + + l = left(i); + r = right(i); + + if ((l <= heap->size) && (nodes[l].offset < nodes[i].offset)) + smallest = l; + else + smallest = i; + + if ((r <= heap->size) && (nodes[r].offset < nodes[smallest].offset)) + smallest = r; + + if (smallest != i) { + tmp_node = nodes[i]; + nodes[i] = nodes[smallest]; + nodes[smallest] = tmp_node; + heapify(heap, smallest); + } +} + +void ADIOI_Heap_insert(heap_t *heap, ADIO_Offset offset, int proc, + ADIO_Offset reg_max_len) { + heap_node_t *nodes; + int i; + nodes = heap->nodes; + i = ++heap->size - 1; + while ((i > 0) && (nodes[parent(i)].offset > offset)) { + nodes[i] = nodes[parent(i)]; + i = parent(i); + } + nodes[i].offset = offset; + nodes[i].proc = proc; + nodes[i].reg_max_len = reg_max_len; +} + +void ADIOI_Heap_extract_min(heap_t *heap, ADIO_Offset* offset, int *proc, + ADIO_Offset *reg_max_len) { + heap_node_t *nodes; + nodes = heap->nodes; + + assert (heap->size > 0); + *offset = nodes[0].offset; + *proc = nodes[0].proc; + *reg_max_len = nodes[0].reg_max_len; + nodes[0] = nodes[heap->size-1]; + heap->size--; + heapify(heap, 0); +} + +/* should suppress unused warnings on GCC */ +static void print_heap(heap_t *heap) ATTRIBUTE((unused, used)); + +static void print_heap(heap_t *heap) +{ +#ifndef NOEXP2 + int i; + double level = 0; + int next_level_idx = 1; + + printf ("heap->size = %d\n", heap->size); + printf ("offsets:\n"); + for (i=0; i < heap->size; i++) { + printf ("%lld ", heap->nodes[i].offset); + + if ((i+1) == next_level_idx) { + printf ("\n"); + next_level_idx += (int) exp2(level+1); + level++; + } + } + printf ("\n"); +#endif +} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/iscontig.c b/src/libs/ck-libs/ampi/romio/adio/common/iscontig.c index bd23d70dbc..c16cece41f 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/iscontig.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/iscontig.c @@ -1,15 +1,13 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "adio.h" -#ifdef MPISGI +/* #ifdef MPISGI #include "mpisgi2.h" -#endif +#endif */ #ifdef AMPI void MPIR_Datatype_iscontig(MPI_Datatype datatype, int *flag){ @@ -23,13 +21,25 @@ void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) #elif (defined(MPICH) || defined(MPICH2)) /* MPICH2 also provides this routine */ -void MPIR_Datatype_iscontig(MPI_Datatype datatype, int *flag){ - MPI_Datatype_iscontig(datatype, flag); -} +void MPIR_Datatype_iscontig(MPI_Datatype datatype, int *flag); void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) { MPIR_Datatype_iscontig(datatype, flag); + + /* if it is MPICH2 and the datatype is reported as contigous, + check if the true_lb is non-zero, and if so, mark the + datatype as noncontiguous */ +#ifdef MPICH2 + if (*flag) { + MPI_Aint true_extent, true_lb; + + MPI_Type_get_true_extent(datatype, &true_lb, &true_extent); + + if (true_lb > 0) + *flag = 0; + } +#endif } #elif (defined(MPIHP) && defined(HAVE_MPI_INFO)) @@ -48,9 +58,21 @@ int MPI_SGI_type_is_contig(MPI_Datatype datatype); void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) { - *flag = MPI_SGI_type_is_contig(datatype); + MPI_Aint displacement; + MPI_Type_lb(datatype, &distplacement); + + /* SGI's MPI_SGI_type_is_contig() returns true for indexed + * datatypes with holes at the beginning, which causes + * problems with ROMIO's use of this function. + */ + *flag = MPI_SGI_type_is_contig(datatype) && (displacement == 0); } +#elif defined(OMPI_BUILDING) && OMPI_BUILDING + +/* void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) is defined + * and implemented in OpenMPI itself */ + #else void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) diff --git a/src/libs/ck-libs/ampi/romio/adio/common/lock.c b/src/libs/ck-libs/ampi/romio/adio/common/lock.c index f72eb6b4ad..fda652c524 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/lock.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/lock.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -9,81 +8,187 @@ #include "adio.h" #ifdef ROMIO_NTFS +/* This assumes that lock will always remain in the common directory and + * that the ntfs directory will always be called ad_ntfs. */ +#include "..\ad_ntfs\ad_ntfs.h" int ADIOI_Set_lock(FDTYPE fd, int cmd, int type, ADIO_Offset offset, int whence, ADIO_Offset len) { - int ret_val, error_code; - OVERLAPPED Overlapped; - DWORD dwFlags; - - dwFlags = type; + static char myname[] = "ADIOI_Set_lock"; + int ret_val, error_code = MPI_SUCCESS; + OVERLAPPED Overlapped; + DWORD dwFlags; - Overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + ADIOI_UNREFERENCED_ARG(whence); + + if (len == 0) return MPI_SUCCESS; + + dwFlags = type; + + Overlapped.hEvent = /*0;*/CreateEvent(NULL, TRUE, FALSE, NULL); #ifdef HAVE_INT64 - Overlapped.Offset = ( (DWORD) ( offset & (__int64) 0xFFFFFFFF ) ); - Overlapped.OffsetHigh = ( (DWORD) ( (offset >> 32) & (__int64) 0xFFFFFFFF ) ); - - if (cmd == ADIOI_LOCK_CMD) - ret_val = LockFileEx(fd, dwFlags, 0, - ( (DWORD) ( len & (__int64) 0xFFFFFFFF ) ), - ( (DWORD) ( (len >> 32) & (__int64) 0xFFFFFFFF ) ), - &Overlapped); - else - ret_val = UnlockFileEx(fd, 0, - ( (DWORD) ( len & (__int64) 0xFFFFFFFF ) ), - ( (DWORD) ( (len >> 32) & (__int64) 0xFFFFFFFF ) ), - &Overlapped); + Overlapped.Offset = ( (DWORD) ( offset & (__int64) 0xFFFFFFFF ) ); + Overlapped.OffsetHigh = ( (DWORD) ( (offset >> 32) & (__int64) 0xFFFFFFFF ) ); + + if (cmd == ADIOI_LOCK_CMD) + { + /*printf("locking %d\n", (int)fd);fflush(stdout);*/ + ret_val = LockFileEx(fd, dwFlags, 0, + ( (DWORD) ( len & (__int64) 0xFFFFFFFF ) ), + ( (DWORD) ( (len >> 32) & (__int64) 0xFFFFFFFF ) ), + &Overlapped); + } + else + { + /*printf("unlocking %d\n", (int)fd);fflush(stdout);*/ + ret_val = UnlockFileEx(fd, 0, + ( (DWORD) ( len & (__int64) 0xFFFFFFFF ) ), + ( (DWORD) ( (len >> 32) & (__int64) 0xFFFFFFFF ) ), + &Overlapped); + } #else - Overlapped.Offset = offset; - Overlapped.OffsetHigh = 0; + Overlapped.Offset = offset; + Overlapped.OffsetHigh = 0; - if (cmd == ADIOI_LOCK_CMD) - ret_val = LockFileEx(fd, dwFlags, 0, len, 0, &Overlapped); - else - ret_val = UnlockFileEx(fd, 0, len, 0, &Overlapped); + if (cmd == ADIOI_LOCK_CMD) + { + /*printf("locking %d\n", (int)fd);fflush(stdout);*/ + ret_val = LockFileEx(fd, dwFlags, 0, len, 0, &Overlapped); + } + else + { + /*printf("unlocking %d\n", (int)fd);fflush(stdout);*/ + ret_val = UnlockFileEx(fd, 0, len, 0, &Overlapped); + } #endif - if (!ret_val) { + if (!ret_val) + { + char errMsg[ADIOI_NTFS_ERR_MSG_MAX]; + /* FPRINTF(stderr, "File locking failed in ADIOI_Set_lock.\n"); MPI_Abort(MPI_COMM_WORLD, 1); + */ + ret_val = GetLastError(); + if (ret_val == ERROR_IO_PENDING) + { + DWORD dummy; + ret_val = GetOverlappedResult(fd, &Overlapped, &dummy, TRUE); + if (ret_val) + { + CloseHandle(Overlapped.hEvent); + return MPI_SUCCESS; + } + ret_val = GetLastError(); + } + ADIOI_NTFS_Strerror(ret_val, errMsg, ADIOI_NTFS_ERR_MSG_MAX); + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_IO, "**io", "**io %s", errMsg); } + CloseHandle(Overlapped.hEvent); - error_code = (ret_val) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; return error_code; } #else int ADIOI_Set_lock(FDTYPE fd, int cmd, int type, ADIO_Offset offset, int whence, ADIO_Offset len) { - int err, error_code; + int err, error_code, err_count = 0, sav_errno; struct flock lock; - lock.l_type = type; - lock.l_start = offset; + if (len == 0) return MPI_SUCCESS; + + + /* Depending on the compiler flags and options, struct flock + may not be defined with types that are the same size as + ADIO_Offsets. */ +/* FIXME: This is a temporary hack until we use flock64 where + available. It also doesn't fix the broken Solaris header sys/types.h + header file, which declars off_t as a UNION ! Configure tests to + see if the off64_t is a union if large file support is requested; + if so, it does not select large file support. +*/ +#ifdef NEEDS_INT_CAST_WITH_FLOCK + lock.l_type = type; + lock.l_start = (int)offset; lock.l_whence = whence; - lock.l_len = len; + lock.l_len = (int)len; +#else + lock.l_type = type; + lock.l_whence = whence; + lock.l_start = offset; + lock.l_len = len; +#endif + sav_errno = errno; /* save previous errno in case we recover from retryable errors */ + errno = 0; do { err = fcntl(fd, cmd, &lock); - } while (err && (errno == EINTR)); +#ifdef USE_DBG_LOGGING +/* if (MPIU_DBG_SELECTED(ROMIO,TERSE)) */ + { + if (err && ((errno == EINTR) || (errno == EINPROGRESS))) + { + if((err_count < 5) || (err_count > 9995)) + { + fprintf(stderr, "File locking failed in ADIOI_Set_lock(fd %#X,cmd %s/%#X,type %s/%#X,whence %#X) with return value %#X and errno %#X. Retry (%d).\n", + fd, + ((cmd == F_GETLK )? "F_GETLK" : + ((cmd == F_SETLK )? "F_SETLK" : + ((cmd == F_SETLKW )? "F_SETLKW" : "UNEXPECTED"))), + cmd, + ((type == F_RDLCK )? "F_RDLCK" : + ((type == F_WRLCK )? "F_WRLCK" : + ((type == F_UNLCK )? "F_UNLOCK" : "UNEXPECTED"))), + type, + whence, err, errno, err_count); + perror("ADIOI_Set_lock:"); + fprintf(stderr,"ADIOI_Set_lock:offset %#llx, length %#llx\n",(unsigned long long)offset, (unsigned long long)len); + } + } + } +#endif + } while (err && ((errno == EINTR) || ((errno == EINPROGRESS) && (++err_count < 10000)))); if (err && (errno != EBADF)) { - FPRINTF(stderr, "File locking failed in ADIOI_Set_lock. If the file system is NFS, you need to use NFS version 3 and mount the directory with the 'noac' option (no attribute caching).\n"); + /* FIXME: This should use the error message system, + especially for MPICH2 */ + FPRINTF(stderr, "File locking failed in ADIOI_Set_lock(fd %X,cmd %s/%X,type %s/%X,whence %X) with return value %X and errno %X.\n" + "- If the file system is NFS, you need to use NFS version 3, ensure that the lockd daemon is running on all the machines, and mount the directory with the 'noac' option (no attribute caching).\n" + "- If the file system is LUSTRE, ensure that the directory is mounted with the 'flock' option.\n", + fd, + ((cmd == F_GETLK )? "F_GETLK" : + ((cmd == F_SETLK )? "F_SETLK" : + ((cmd == F_SETLKW )? "F_SETLKW" : "UNEXPECTED"))), + cmd, + ((type == F_RDLCK )? "F_RDLCK" : + ((type == F_WRLCK )? "F_WRLCK" : + ((type == F_UNLCK )? "F_UNLOCK" : "UNEXPECTED"))), + type, + whence, err, errno); + perror("ADIOI_Set_lock:"); + FPRINTF(stderr,"ADIOI_Set_lock:offset %llu, length %llu\n",(unsigned long long)offset, (unsigned long long)len); MPI_Abort(MPI_COMM_WORLD, 1); } + if(!err) /* report fcntl failure errno's (EBADF), otherwise */ + errno = sav_errno; /* restore previous errno in case we recovered from retryable errors */ + error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN; return error_code; } #endif -#if (defined(HFS) || defined(XFS)) -int ADIOI_Set_lock64(FDTYPE fd, int cmd, int type, ADIO_Offset offset, int whence, - ADIO_Offset len) +#if (defined(ROMIO_HFS) || defined(ROMIO_XFS)) +int ADIOI_Set_lock64(FDTYPE fd, int cmd, int type, ADIO_Offset offset, + int whence, + ADIO_Offset len) { int err, error_code; struct flock64 lock; + if (len == 0) return MPI_SUCCESS; + lock.l_type = type; lock.l_start = offset; lock.l_whence = whence; @@ -94,7 +199,23 @@ int ADIOI_Set_lock64(FDTYPE fd, int cmd, int type, ADIO_Offset offset, int whenc } while (err && (errno == EINTR)); if (err && (errno != EBADF)) { - FPRINTF(stderr, "File locking failed in ADIOI_Set_lock64\n"); + FPRINTF(stderr, "File locking failed in ADIOI_Set_lock64(fd %X,cmd %s/%X,type %s/%X,whence %X) with return value %X and errno %X.\n" + "If the file system is NFS, you need to use NFS version 3, ensure that the lockd daemon is running on all the machines, and mount the directory with the 'noac' option (no attribute caching).\n", + fd, + ((cmd == F_GETLK )? "F_GETLK" : + ((cmd == F_SETLK )? "F_SETLK" : + ((cmd == F_SETLKW )? "F_SETLKW" : + ((cmd == F_GETLK64 )? "F_GETLK64" : + ((cmd == F_SETLK64 )? "F_SETLK64" : + ((cmd == F_SETLKW64)? "F_SETLKW64" : "UNEXPECTED")))))), + cmd, + ((type == F_RDLCK )? "F_RDLCK" : + ((type == F_WRLCK )? "F_WRLCK" : + ((type == F_UNLCK )? "F_UNLOCK" : "UNEXPECTED"))), + type, + whence, err, errno); + perror("ADIOI_Set_lock64:"); + FPRINTF(stderr,"ADIOI_Set_lock:offset %llu, length %llu\n",(unsigned long long)offset, (unsigned long long)len); MPI_Abort(MPI_COMM_WORLD, 1); } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/malloc.c b/src/libs/ck-libs/ampi/romio/adio/common/malloc.c index 372079082a..55306842bd 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/malloc.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/malloc.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -15,73 +14,100 @@ Later on, add some tracing and error checking, similar to MPID_trmalloc. */ -/* can't include adio.h here, because of the macro, so - * include romioconf.h to make sure config-time defines get included */ - -#include "romioconf.h" +#include "adio.h" #include "mpi.h" #include #include #include "mpipr.h" +#ifdef HAVE_MALLOC_H +#include +#endif + +/* for the style checker */ +/* style: allow:malloc:1 sig:0 */ +/* style: allow:free:1 sig:0 */ +/* style: allow:calloc:1 sig:0 */ +/* style: allow:realloc:1 sig:0 */ + #define FPRINTF fprintf -void *ADIOI_Malloc_fn(size_t size, int lineno, char *fname); -void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, char *fname); -void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, char *fname); -void ADIOI_Free_fn(void *ptr, int lineno, char *fname); -void *ADIOI_Malloc_fn(size_t size, int lineno, char *fname) +void *ADIOI_Malloc_fn(size_t size, int lineno, const char *fname); +void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, const char *fname); +void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, const char *fname); +void ADIOI_Free_fn(void *ptr, int lineno, const char *fname); + +void *ADIOI_Malloc_fn(size_t size, int lineno, const char *fname) { void *new; -#ifdef XFS +#ifdef ROMIO_XFS new = (void *) memalign(XFS_MEMALIGN, size); #else +#ifdef HAVE_MPIU_FUNCS + new = (void *) MPIU_Malloc(size); +#else new = (void *) malloc(size); #endif +#endif if (!new) { FPRINTF(stderr, "Out of memory in file %s, line %d\n", fname, lineno); MPI_Abort(MPI_COMM_WORLD, 1); } - + DBG_FPRINTF(stderr, "ADIOI_Malloc %s:<%d> %p (%#zX)\n", fname, lineno, new, size); return new; } -void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, char *fname) +void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, const char *fname) { void *new; +#ifdef HAVE_MPIU_FUNCS + new = (void *) MPIU_Calloc(nelem, elsize); +#else new = (void *) calloc(nelem, elsize); +#endif if (!new) { FPRINTF(stderr, "Out of memory in file %s, line %d\n", fname, lineno); MPI_Abort(MPI_COMM_WORLD, 1); } - + DBG_FPRINTF(stderr, "ADIOI_Calloc %s:<%d> %p\n", fname, lineno, new); return new; } -void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, char *fname) +void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, const char *fname) { void *new; +#ifdef HAVE_MPIU_FUNCS + new = (void *) MPIU_Realloc(ptr, size); +#else new = (void *) realloc(ptr, size); +#endif if (!new) { FPRINTF(stderr, "realloc failed in file %s, line %d\n", fname, lineno); MPI_Abort(MPI_COMM_WORLD, 1); } + DBG_FPRINTF(stderr, "ADIOI_Realloc %s:<%d> %p\n", fname, lineno, new); return new; } -void ADIOI_Free_fn(void *ptr, int lineno, char *fname) +void ADIOI_Free_fn(void *ptr, int lineno, const char *fname) { + DBG_FPRINTF(stderr, "ADIOI_Free %s:<%d> %p\n", fname, lineno, ptr); if (!ptr) { FPRINTF(stderr, "Attempt to free null pointer in file %s, line %d\n", fname, lineno); MPI_Abort(MPI_COMM_WORLD, 1); } +#ifdef HAVE_MPIU_FUNCS + MPIU_Free(ptr); +#else free(ptr); +#endif } + diff --git a/src/libs/ck-libs/ampi/romio/adio/common/req_malloc.c b/src/libs/ck-libs/ampi/romio/adio/common/req_malloc.c index fb08028321..80e78b6861 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/req_malloc.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/req_malloc.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -22,37 +21,42 @@ struct ADIOI_RequestD *ADIOI_Malloc_request(void) ADIOI_Req_node *curr, *ptr; int i; - if (!CtvAccess(ADIOI_Req_avail_head)) { - CtvAccess(ADIOI_Req_avail_head) = (ADIOI_Req_node *) - ADIOI_Malloc(NUM*sizeof(ADIOI_Req_node)); - curr = CtvAccess(ADIOI_Req_avail_head); + if (!ADIOI_Req_avail_head) { + ADIOI_Req_avail_head = (ADIOI_Req_node *) + ADIOI_Malloc(NUM*sizeof(ADIOI_Req_node)); + if (ADIOI_Req_avail_head == NULL) + { + /* FIXME: Insert error here */ + return NULL; + } + curr = ADIOI_Req_avail_head; for (i=1; inext = CtvAccess(ADIOI_Req_avail_head)+i; + curr->next = ADIOI_Req_avail_head+i; curr = curr->next; } curr->next = NULL; - CtvAccess(ADIOI_Req_avail_tail) = curr; + ADIOI_Req_avail_tail = curr; /* keep track of malloced area that needs to be freed later */ - if (!CtvAccess(ADIOI_Malloc_req_tail)) { - CtvAccess(ADIOI_Malloc_req_tail) = (ADIOI_Malloc_req *) + if (!ADIOI_Malloc_req_tail) { + ADIOI_Malloc_req_tail = (ADIOI_Malloc_req *) ADIOI_Malloc(sizeof(ADIOI_Malloc_req)); - CtvAccess(ADIOI_Malloc_req_head) = CtvAccess(ADIOI_Malloc_req_tail); - CtvAccess(ADIOI_Malloc_req_head)->ptr = CtvAccess(ADIOI_Req_avail_head); - CtvAccess(ADIOI_Malloc_req_head)->next = NULL; + ADIOI_Malloc_req_head = ADIOI_Malloc_req_tail; + ADIOI_Malloc_req_head->ptr = ADIOI_Req_avail_head; + ADIOI_Malloc_req_head->next = NULL; } else { - CtvAccess(ADIOI_Malloc_req_tail)->next = (ADIOI_Malloc_req *) + ADIOI_Malloc_req_tail->next = (ADIOI_Malloc_req *) ADIOI_Malloc(sizeof(ADIOI_Malloc_req)); - CtvAccess(ADIOI_Malloc_req_tail) = CtvAccess(ADIOI_Malloc_req_tail)->next; - CtvAccess(ADIOI_Malloc_req_tail)->ptr = CtvAccess(ADIOI_Req_avail_head); - CtvAccess(ADIOI_Malloc_req_tail)->next = NULL; + ADIOI_Malloc_req_tail = ADIOI_Malloc_req_tail->next; + ADIOI_Malloc_req_tail->ptr = ADIOI_Req_avail_head; + ADIOI_Malloc_req_tail->next = NULL; } } - ptr = CtvAccess(ADIOI_Req_avail_head); - CtvAccess(ADIOI_Req_avail_head) = CtvAccess(ADIOI_Req_avail_head)->next; - if (!CtvAccess(ADIOI_Req_avail_head)) CtvAccess(ADIOI_Req_avail_tail) = NULL; + ptr = ADIOI_Req_avail_head; + ADIOI_Req_avail_head = ADIOI_Req_avail_head->next; + if (!ADIOI_Req_avail_head) ADIOI_Req_avail_tail = NULL; (ptr->reqd).cookie = ADIOI_REQ_COOKIE; return &(ptr->reqd); diff --git a/src/libs/ck-libs/ampi/romio/adio/common/setfn.c b/src/libs/ck-libs/ampi/romio/adio/common/setfn.c deleted file mode 100644 index 5e4b18eb25..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/common/setfn.c +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "adio.h" - -void ADIOI_SetFunctions(ADIO_File fd) -{ - /* NOTE: soon we want to get rid of this malloc and instead just point - * straight to the appropriate table - */ - fd->fns = (ADIOI_Fns *) ADIOI_Malloc(sizeof(ADIOI_Fns)); - switch(fd->file_system) { - case ADIO_PFS: -#ifdef PFS - *(fd->fns) = ADIO_PFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the PFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - case ADIO_PIOFS: -#ifdef PIOFS - *(fd->fns) = ADIO_PIOFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the PIOFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - case ADIO_UFS: -#ifdef UFS - *(fd->fns) = ADIO_UFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the UFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - case ADIO_NTFS: -#ifdef ROMIO_NTFS - *(fd->fns) = ADIO_NTFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the NTFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - case ADIO_NFS: -#ifdef NFS - *(fd->fns) = ADIO_NFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the NFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - case ADIO_HFS: -#ifdef HFS - *(fd->fns) = ADIO_HFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the HFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - case ADIO_XFS: -#ifdef XFS - *(fd->fns) = ADIO_XFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the XFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - case ADIO_SFS: -#ifdef SFS - *(fd->fns) = ADIO_SFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the SFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - case ADIO_PVFS: -#ifdef ROMIO_PVFS - *(fd->fns) = ADIO_PVFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the PVFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - case ADIO_TESTFS: -#ifdef ROMIO_TESTFS - *(fd->fns) = ADIO_TESTFS_operations; -#else - FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the TESTFS file system\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#endif - break; - - default: - FPRINTF(stderr, "ADIOI_SetFunctions: Unsupported file system type\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - break; - } -} diff --git a/src/libs/ck-libs/ampi/romio/adio/common/shfp_fname.c b/src/libs/ck-libs/ampi/romio/adio/common/shfp_fname.c index 4093638d20..344d184d7a 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/shfp_fname.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/shfp_fname.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -33,7 +32,7 @@ void ADIOI_Shfp_fname(ADIO_File fd, int rank) tm *= 1000000.0; i = (int) tm; - strcpy(fd->shared_fp_fname, fd->filename); + ADIOI_Strncpy(fd->shared_fp_fname, fd->filename, 256); #ifdef ROMIO_NTFS slash = strrchr(fd->filename, '\\'); @@ -41,8 +40,8 @@ void ADIOI_Shfp_fname(ADIO_File fd, int rank) slash = strrchr(fd->filename, '/'); #endif if (!slash) { - strcpy(fd->shared_fp_fname, "."); - strcpy(fd->shared_fp_fname + 1, fd->filename); + ADIOI_Strncpy(fd->shared_fp_fname, ".", 2); + ADIOI_Strncpy(fd->shared_fp_fname + 1, fd->filename, 255); } else { ptr = slash; @@ -51,14 +50,15 @@ void ADIOI_Shfp_fname(ADIO_File fd, int rank) #else slash = strrchr(fd->shared_fp_fname, '/'); #endif - strcpy(slash + 1, "."); - strcpy(slash + 2, ptr + 1); + ADIOI_Strncpy(slash + 1, ".", 2); + len = 256 - (slash+2 - fd->shared_fp_fname); + ADIOI_Strncpy(slash + 2, ptr + 1, len); } - sprintf(tmp, ".shfp.%d", i); - strcat(fd->shared_fp_fname, tmp); + ADIOI_Snprintf(tmp, 128, ".shfp.%d", i); + ADIOI_Strnapp(fd->shared_fp_fname, tmp, 256); - len = strlen(fd->shared_fp_fname); + len = (int)strlen(fd->shared_fp_fname); MPI_Bcast(&len, 1, MPI_INT, 0, fd->comm); MPI_Bcast(fd->shared_fp_fname, len+1, MPI_CHAR, 0, fd->comm); } diff --git a/src/libs/ck-libs/ampi/romio/adio/common/status_setb.c b/src/libs/ck-libs/ampi/romio/adio/common/status_setb.c index e5b8bec8bf..37d150fe4a 100644 --- a/src/libs/ck-libs/ampi/romio/adio/common/status_setb.c +++ b/src/libs/ck-libs/ampi/romio/adio/common/status_setb.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -9,20 +8,17 @@ #include "adio.h" #include "mpi.h" -int MPIR_Status_set_bytes(MPI_Status *status, MPI_Datatype datatype, - int nbytes) -{ - if (status != MPI_STATUS_IGNORE) - status->MPI_LENGTH=nbytes; - return MPI_SUCCESS; -} - -#if 0 #if defined(MPICH2) /* Not quite correct, but much closer for MPI2 */ +/* TODO: still needs to handle partial datatypes and situations where the mpi + * implementation fills status with something other than bytes (globus2 might + * do this) */ int MPIR_Status_set_bytes(MPI_Status *status, MPI_Datatype datatype, int nbytes) { + ADIOI_UNREFERENCED_ARG(datatype); + /* it's ok that ROMIO stores number-of-bytes in status, not + * count-of-copies, as long as MPI_GET_COUNT knows what to do */ if (status != MPI_STATUS_IGNORE) MPI_Status_set_elements(status, MPI_BYTE, nbytes); return MPI_SUCCESS; @@ -41,5 +37,15 @@ int MPIR_Status_set_bytes(MPI_Status *status, MPI_Datatype datatype, return MPI_SUCCESS; } -#endif +#elif defined(MPILAM) || defined(MPISGI) +int MPIR_Status_set_bytes(MPI_Status *status, MPI_Datatype datatype, + int nbytes) +{ + /* Bogusness to silence compiler warnings */ + if (datatype == MPI_DATATYPE_NULL); + + if (status != MPI_STATUS_IGNORE) + status->st_length = nbytes; + return MPI_SUCCESS; +} #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/common/strfns.c b/src/libs/ck-libs/ampi/romio/adio/common/strfns.c new file mode 100644 index 0000000000..08aeb4a8b1 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/strfns.c @@ -0,0 +1,315 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "adio.h" + +/* style: allow:sprintf:3 sig:0 */ + +/* + * Below are the "safe" versions of the various string and printf + * operations. They are directly taken from MPICH2, with MPIU replaced by ADIOI. + */ + +/* + * ADIOI_Strncpy - Copy at most n character. Stop once a null is reached. + * + * This is different from strncpy, which null pads so that exactly + * n characters are copied. The strncpy behavior is correct for many + * applications because it guarantees that the string has no uninitialized + * data. + * + * If n characters are copied without reaching a null, return an error. + * Otherwise, return 0. + * + */ +/*@ ADIOI_Strncpy - Copy a string with a maximum length + + Input Parameters: ++ instr - String to copy +- maxlen - Maximum total length of 'outstr' + + Output Parameter: +. outstr - String to copy into + + Notes: + This routine is the routine that you wish 'strncpy' was. In copying + 'instr' to 'outstr', it stops when either the end of 'outstr' (the + null character) is seen or the maximum length 'maxlen' is reached. + Unlike 'strncpy', it does not add enough nulls to 'outstr' after + copying 'instr' in order to move precisely 'maxlen' characters. + Thus, this routine may be used anywhere 'strcpy' is used, without any + performance cost related to large values of 'maxlen'. + + Module: + Utility + @*/ +int ADIOI_Strncpy( char *dest, const char *src, size_t n ) +{ + char * restrict d_ptr = dest; + const char * restrict s_ptr = src; + register int i; + + i = (int)n; + while (*s_ptr && i-- > 0) { + *d_ptr++ = *s_ptr++; + } + + if (i > 0) { + *d_ptr = 0; + return 0; + } + else + /* We may want to force an error message here, at least in the + debugging version */ + return 1; +} + +/* Append src to dest, but only allow dest to contain n characters (including + any null, which is always added to the end of the line */ +/*@ ADIOI_Strnapp - Append to a string with a maximum length + + Input Parameters: ++ instr - String to copy +- maxlen - Maximum total length of 'outstr' + + Output Parameter: +. outstr - String to copy into + + Notes: + This routine is similar to 'strncat' except that the 'maxlen' argument + is the maximum total length of 'outstr', rather than the maximum + number of characters to move from 'instr'. Thus, this routine is + easier to use when the declared size of 'instr' is known. + + Module: + Utility + @*/ +int ADIOI_Strnapp( char *dest, const char *src, size_t n ) +{ + char * restrict d_ptr = dest; + const char * restrict s_ptr = src; + register int i; + + /* Get to the end of dest */ + i = (int)n; + while (i-- > 0 && *d_ptr) d_ptr++; + if (i <= 0) return 1; + + /* Append. d_ptr points at first null and i is remaining space. */ + while (*s_ptr && i-- > 0) { + *d_ptr++ = *s_ptr++; + } + + /* We allow i >= (not just >) here because the first while decrements + i by one more than there are characters, leaving room for the null */ + if (i >= 0) { + *d_ptr = 0; + return 0; + } + else { + /* Force the null at the end */ + *--d_ptr = 0; + + /* We may want to force an error message here, at least in the + debugging version */ + return 1; + } +} + +/*@ + ADIOI_Strdup - Duplicate a string + + Synopsis: +.vb + char *ADIOI_Strdup( const char *str ) +.ve + + Input Parameter: +. str - null-terminated string to duplicate + + Return value: + A pointer to a copy of the string, including the terminating null. A + null pointer is returned on error, such as out-of-memory. + + Notes: + Like 'ADIOI_Malloc' and 'ADIOI_Free', this will often be implemented as a + macro but may use 'ADIOI_trstrdup' to provide a tracing version. + + Module: + Utility + @*/ +char *ADIOI_Strdup( const char *str ) +{ + char *p = ADIOI_Malloc( strlen(str) + 1 ); + char *in_p = (char *)str; + char *save_p; + + save_p = p; + if (p) { + while (*in_p) { + *p++ = *in_p++; + } + *p = '\0'; + } + return save_p; +} + + +/* + * We need an snprintf replacement for systems without one + */ +#ifndef HAVE_SNPRINTF +#include +/* FIXME: Really need a check for varargs.h vs stdarg.h */ +#include +/* + * This is an approximate form which is suitable for most uses within + * the MPICH code + */ +int ADIOI_Snprintf( char *str, size_t size, const char *format, ... ) +{ + int n; + const char *p; + char *out_str = str; + va_list list; + + va_start(list, format); + + p = format; + while (*p && size > 0) { + char *nf; + + nf = strchr(p, '%'); + if (!nf) { + /* No more format characters */ + while (size-- > 0 && *p) { + *out_str++ = *p++; + } + } + else { + int nc; + int width = -1; + + /* Copy until nf */ + while (p < nf && size-- > 0) { + *out_str++ = *p++; + } + /* p now points at nf */ + /* Handle the format character */ + nc = nf[1]; + if (isdigit(nc)) { + /* Get the field width */ + /* FIXME : Assumes ASCII */ + width = nc - '0'; + p = nf + 2; + while (*p && isdigit(*p)) { + width = 10 * width + (*p++ - '0'); + } + /* When there is no longer a digit, get the format + character */ + nc = *p++; + } + else { + /* Skip over the format string */ + p += 2; + } + + switch (nc) { + case '%': + *out_str++ = '%'; + size--; + break; + + case 'd': + { + int val; + char tmp[20]; + char *t = tmp; + /* Get the argument, of integer type */ + val = va_arg( list, int ); + sprintf( tmp, "%d", val ); + if (width > 0) { + int tmplen = strlen(tmp); + /* If a width was specified, pad with spaces on the + left (on the right if %-3d given; not implemented yet */ + while (size-- > 0 && width-- > tmplen) + *out_str++ = ' '; + } + while (size-- > 0 && *t) { + *out_str++ = *t++; + } + } + break; + + case 'x': + { + int val; + char tmp[20]; + char *t = tmp; + /* Get the argument, of integer type */ + val = va_arg( list, int ); + sprintf( tmp, "%x", val ); + if (width > 0) { + int tmplen = strlen(tmp); + /* If a width was specified, pad with spaces on the + left (on the right if %-3d given; not implemented yet */ + while (size-- > 0 && width-- > tmplen) + *out_str++ = ' '; + } + while (size-- > 0 && *t) { + *out_str++ = *t++; + } + } + break; + + case 'p': + { + void *val; + char tmp[20]; + char *t = tmp; + val = va_arg( list, void * ); + sprintf( tmp, "%p", val ); + if (width > 0) { + int tmplen = strlen(tmp); + /* If a width was specified, pad with spaces on the + left (on the right if %-3d given; not implemented yet */ + while (size-- > 0 && width-- > tmplen) + *out_str++ = ' '; + } + while (size-- > 0 && *t) { + *out_str++ = *t++; + } + } + break; + + case 's': + { + char *s_arg; + /* Get the argument, of pointer to char type */ + s_arg = va_arg( list, char * ); + while (size-- > 0 && s_arg && *s_arg) { + *out_str++ = *s_arg++; + } + } + break; + + default: + /* Error, unknown case */ + return -1; + break; + } + } + } + + va_end(list); + + if (size-- > 0) *out_str++ = '\0'; + + n = (int)(out_str - str); + return n; +} +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/common/system_hints.c b/src/libs/ck-libs/ampi/romio/adio/common/system_hints.c new file mode 100644 index 0000000000..bd01d3b005 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/common/system_hints.c @@ -0,0 +1,190 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * Copyright (C) 2007 UChicago/Argonne LLC. + * See COPYRIGHT notice in top-level directory. + */ + +#include + +#include + +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_IO_H +#include +#endif + +#ifndef PATH_MAX +#define PATH_MAX 65535 +#endif + +/*#define SYSHINT_DEBUG 1 */ + +#define ROMIO_HINT_DEFAULT_CFG "/etc/romio-hints" +#define ROMIO_HINT_ENV_VAR "ROMIO_HINTS" + + /* should suppress unused warnings on GCC */ +static void dump_keys(MPI_Info info) ATTRIBUTE((unused, used)); + +/* debug function: a routine I want in the library to make my life easier when + * using a source debugger. please ignore any "defined but not used" warnings + */ +static void dump_keys(MPI_Info info) +{ + int i, nkeys, flag; + char key[MPI_MAX_INFO_KEY]; + char value[MPI_MAX_INFO_VAL]; + + MPI_Info_get_nkeys(info, &nkeys); + + for (i=0; i \n". + * A # in collumn zero is a comment and the line will be ignored. Do our best + * to ignore badly formed lines too. + * + * The caller provides an 'info' object. Each key-value pair found by the + * parser will get added to the info object. any keys already set will be left + * alone on the assumption that the caller knows best. + * + * because MPI-IO hints are optional, we can get away with limited error + * reporting. */ +static int file_to_info(int fd, MPI_Info info) +{ + char *buffer, *token, *key, *val, *garbage; + char *pos1=NULL, *pos2=NULL; + int flag, ret; + char dummy; + struct stat statbuf; + + /* assumption: config files will be small (less than 1MB) */ + fstat(fd, &statbuf); + /* add 1 to size to make room for NULL termination */ + buffer = (char *)ADIOI_Calloc(statbuf.st_size + 1, sizeof (char)); + if (buffer == NULL) return -1; + + ret = read(fd, buffer, statbuf.st_size); + if (ret < 0) return -1; + token = strtok_r(buffer, "\n", &pos1); + do { + if ( (key = strtok_r(token, " \t", &pos2)) == NULL) + /* malformed line: found no items */ + continue; + if (token[0] == '#') + /* ignore '#'-delimited comments */ + continue; + if ( (val = strtok_r(NULL, " \t", &pos2)) == NULL) + /* malformed line: found key without value */ + continue; + if ( (garbage = strtok_r(NULL, " \t", &pos2)) != NULL) + /* malformed line: more than two items */ + continue; + +#ifdef SYSHINT_DEBUG + printf("found: key=%s val=%s\n", key, val); +#endif + /* don't actually care what the value is. only want to know if key + * exists: we leave it alone if so*/ + ADIOI_Info_get(info, key, 1, &dummy, &flag); + if (flag == 1) continue; + ADIOI_Info_set(info, key, val); + } while ((token = strtok_r(NULL, "\n", &pos1)) != NULL); + ADIOI_Free(buffer); + return 0; +} + +void ADIOI_process_system_hints(MPI_Info info) +{ + int hintfd; + + hintfd = find_file(); + if (hintfd < 0) { +#ifdef SYSHINT_DEBUG + perror("ADIOI_process_system_hints"); +#endif + return; + } + file_to_info(hintfd, info); + close(hintfd); +} + +/* given 'info', incorporate any hints in 'sysinfo' that are not already set + * into 'new_info'. Caller must free 'new_info' later. */ +void ADIOI_incorporate_system_hints(MPI_Info info, + MPI_Info sysinfo, + MPI_Info *new_info) +{ + int i, nkeys_sysinfo, flag; + char val[MPI_MAX_INFO_VAL], key[MPI_MAX_INFO_KEY]; + + if (sysinfo == MPI_INFO_NULL) + nkeys_sysinfo = 0; + else + MPI_Info_get_nkeys(sysinfo, &nkeys_sysinfo); + + /* short-circuit: return immediately if no hints to process */ + if (info == MPI_INFO_NULL && nkeys_sysinfo == 0) { + *new_info = MPI_INFO_NULL; + return; + } + + if (info == MPI_INFO_NULL) + MPI_Info_create(new_info); + else + MPI_Info_dup(info, new_info); + + for (i=0; i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/adio/include/BaseIOErrMsgs.msg b/src/libs/ck-libs/ampi/romio/adio/include/BaseIOErrMsgs.msg index ddc258be04..0ca0526619 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/BaseIOErrMsgs.msg +++ b/src/libs/ck-libs/ampi/romio/adio/include/BaseIOErrMsgs.msg @@ -25,7 +25,7 @@ $set 32 MPI_ERR_IO 32 1 "I/O Error" 32 2 "%s" 1 32 3 "Only an integral number of etypes can be accessed" -32 5 "Can't determine the file-system type. Check the filename/path you provided and try again. Otherwise, prefix the filename with a string to indicate the type of file sytem (piofs:, pfs:, nfs:, ufs:, hfs:, xfs:, sfs:, pvfs:)" +32 5 "Can't determine the file-system type. Check the filename/path you provided and try again. Otherwise, prefix the filename with a string to indicate the type of file system (piofs:, pfs:, nfs:, ufs:, hfs:, xfs:, sfs:, pvfs:, pvfs2:, ftp:, gsiftp:)" 32 7 "ROMIO has not been configured to use the PFS file system" 32 9 "ROMIO has not been configured to use the PIOFS file system" 32 11 "ROMIO has not been configured to use the UFS file system" diff --git a/src/libs/ck-libs/ampi/romio/adio/include/adio.h b/src/libs/ck-libs/ampi/romio/adio/include/adio.h index cf1390e336..f1e040301e 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/adio.h +++ b/src/libs/ck-libs/ampi/romio/adio/include/adio.h @@ -1,7 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ @@ -23,6 +21,8 @@ #ifndef ADIO_INCLUDE #define ADIO_INCLUDE +#include "converse.h" + #ifdef SPPUX #define _POSIX_SOURCE #endif @@ -57,12 +57,28 @@ # define FORTRAN_API #endif +/* Use this macro for each parameter to a function that is not referenced in the body of the function */ +#ifdef HAVE_WINDOWS_H +#define ADIOI_UNREFERENCED_ARG(a) a +#else +#define ADIOI_UNREFERENCED_ARG(a) +#endif + +/* Include romioconf.h if we haven't already (some include files may + need to include romioconf before some system includes) */ +#ifndef ROMIOCONF_H_INCLUDED #include "romioconf.h" +#define ROMIOCONF_H_INCLUDED +#endif #include "mpi.h" #include "mpio.h" +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_SYS_TYPES_H #include +#endif #include #include #include @@ -98,14 +114,6 @@ # define ADIO_OFFSET MPI_LONG #endif -#ifdef SX4 -# if (defined(_SX) && !defined(_LONG64)) -# define MPI_AINT MPI_LONG_LONG_INT -# else -# define MPI_AINT MPI_LONG -# endif -#endif - #define ADIO_Status MPI_Status #ifndef MPIO_INCLUDE @@ -156,13 +164,31 @@ MPI_Info PMPI_Info_f2c(MPI_Fint info); #endif +/* style: allow:strdup:1 sig:0 */ + +#if defined(HAVE_STRDUP) && defined(NEEDS_STRDUP_DECL) && !defined(strdup) +char *strdup(const char *s); +# endif +#if defined(HAVE_READLINK) && defined(NEEDS_READLINK_DECL) && !defined(readlink) +int readlink(const char *path, char *buf, size_t bufsiz); +# endif +#if defined(HAVE_LSTAT) && defined(NEEDS_LSTAT_DECL) && !defined(lstat) +int lstat(const char *file_name, struct stat *buf); +# endif +#if defined(HAVE_FSYNC) && defined(NEEDS_FSYNC_DECL) && !defined(fsync) +int fsync(int fd); +# endif +#if defined(HAVE_FTRUNCATE) && defined(NEEDS_FTRUNCATE_DECL) && !defined(ftruncate) +int ftruncate(int fd, off_t length); +# endif + + typedef struct ADIOI_Fns_struct ADIOI_Fns; typedef struct ADIOI_Hints_struct ADIOI_Hints; -struct ADIOI_FileD { +typedef struct ADIOI_FileD { int cookie; /* for error checking */ FDTYPE fd_sys; /* system file descriptor */ -#ifdef XFS int fd_direct; /* On XFS, this is used for direct I/O; fd_sys is used for buffered I/O */ int direct_read; /* flag; 1 means use direct read */ @@ -171,58 +197,56 @@ struct ADIOI_FileD { unsigned d_mem; /* data buffer memory alignment */ unsigned d_miniosz; /* min xfer size, xfer size multiple, and file seek offset alignment */ - unsigned d_maxiosz; /* max xfer size */ -#endif ADIO_Offset fp_ind; /* individual file pointer in MPI-IO (in bytes)*/ ADIO_Offset fp_sys_posn; /* current location of the system file-pointer in bytes */ ADIOI_Fns *fns; /* struct of I/O functions to use */ MPI_Comm comm; /* communicator indicating who called open */ + MPI_Comm agg_comm; /* deferred open: aggregators who called open */ + int is_open; /* deferred open: 0: not open yet 1: is open */ + int is_agg; /* bool: if I am an aggregator */ char *filename; int file_system; /* type of file system */ - int access_mode; + int access_mode; /* Access mode (sequential, append, etc.) */ ADIO_Offset disp; /* reqd. for MPI-IO */ MPI_Datatype etype; /* reqd. for MPI-IO */ MPI_Datatype filetype; /* reqd. for MPI-IO */ int etype_size; /* in bytes */ ADIOI_Hints *hints; /* structure containing fs-indep. info values */ MPI_Info info; + + /* The following support the split collective operations */ int split_coll_count; /* count of outstanding split coll. ops. */ + MPI_Status split_status; /* status used for split collectives */ + MPI_Datatype split_datatype; /* datatype used for split collectives */ + + /* The following support the shared file operations */ char *shared_fp_fname; /* name of file containing shared file pointer */ struct ADIOI_FileD *shared_fp_fd; /* file handle of file containing shared fp */ int async_count; /* count of outstanding nonblocking operations */ int perm; int atomicity; /* true=atomic, false=nonatomic */ - int iomode; /* reqd. to implement Intel PFS modes */ + int fortran_handle; /* handle for Fortran interface if needed */ MPI_Errhandler err_handler; -}; + void *fs_ptr; /* file-system specific information */ + + /* Two phase collective I/O support */ + ADIO_Offset *file_realm_st_offs; /* file realm starting offsets */ + MPI_Datatype *file_realm_types; /* file realm datatypes */ + int my_cb_nodes_index; /* my index into cb_config_list. -1 if N/A */ +} ADIOI_FileD; typedef struct ADIOI_FileD *ADIO_File; -struct ADIOI_RequestD { - int cookie; /* for error checking */ - void *handle; /* return handle */ - int optype; /* ADIOI_READ or ADIOI_WRITE */ - ADIO_File fd; /* associated file descriptor */ - MPI_Datatype datatype; /* datatype for read/write operation */ - int queued; /* 1 = request still queued in the system, - 0 = request already dequeued */ - int nbytes; /* no. of bytes read/written in async I/O operation */ - struct ADIOI_Async *ptr_in_async_list; /* pointer to location in list of - asynchronous requests */ -}; - -typedef struct ADIOI_RequestD *ADIO_Request; +typedef MPI_Request ADIO_Request; /* fcntl structure */ typedef struct { - ADIO_Offset disp; + ADIO_Offset disp; MPI_Datatype etype; MPI_Datatype filetype; - MPI_Info info; - int iomode; /* to change PFS I/O mode. for MPI-IO - implementation, just set it to M_ASYNC. */ + MPI_Info info; int atomicity; ADIO_Offset fsize; /* for get_fsize only */ ADIO_Offset diskspace; /* for file preallocation */ @@ -240,6 +264,8 @@ typedef struct { #define ADIO_APPEND 128 #define ADIO_SEQUENTIAL 256 +#define ADIO_AMODE_NOMATCH ~(ADIO_CREATE|ADIO_RDONLY|ADIO_WRONLY|ADIO_RDWR|ADIO_DELETE_ON_CLOSE|ADIO_UNIQUE_OPEN|ADIO_EXCL|ADIO_APPEND|ADIO_SEQUENTIAL) + /* file-pointer types */ #define ADIO_EXPLICIT_OFFSET 100 #define ADIO_INDIVIDUAL 101 @@ -259,30 +285,37 @@ typedef struct { #define ADIO_PVFS 157 /* PVFS for Linux Clusters from Clemson Univ. */ #define ADIO_NTFS 158 /* NTFS for Windows NT */ #define ADIO_TESTFS 159 /* fake file system for testing */ +#define ADIO_PVFS2 160 /* PVFS2: 2nd generation PVFS */ +#define ADIO_PANFS 161 /* Panasas FS */ +#define ADIO_GRIDFTP 162 /* Globus GridFTP */ +#define ADIO_LUSTRE 163 /* Lustre */ +#define ADIO_BGL 164 /* IBM BGL */ +#define ADIO_BGLOCKLESS 165 /* IBM BGL (lock-free) */ +#define ADIO_ZOIDFS 167 /* ZoidFS: the I/O forwarding fs */ #define ADIO_SEEK_SET SEEK_SET #define ADIO_SEEK_CUR SEEK_CUR #define ADIO_SEEK_END SEEK_END -#define ADIO_FCNTL_SET_VIEW 176 #define ADIO_FCNTL_SET_ATOMICITY 180 -#define ADIO_FCNTL_SET_IOMODE 184 #define ADIO_FCNTL_SET_DISKSPACE 188 #define ADIO_FCNTL_GET_FSIZE 200 +/* file system feature tests */ +#define ADIO_LOCKS 300 /* file system supports fcntl()-style locking */ +#define ADIO_SHARED_FP 301 /* file system supports shared file pointers */ +#define ADIO_ATOMIC_MODE 302 /* file system supports atomic mode */ +#define ADIO_DATA_SIEVING_WRITES 303 /* file system supports data sieving for writes */ +#define ADIO_SCALABLE_OPEN 304 /* one process can open the file and + broadcast result to all other + processors */ +#define ADIO_UNLINK_AFTER_CLOSE 305 /* supports posix semantic of keeping a + deleted file around until all + processors have closed it */ + /* for default file permissions */ #define ADIO_PERM_NULL -1 -/* PFS file-pointer modes */ -#ifndef M_ASYNC -#define M_UNIX 0 -/*#define M_LOG 1 redefined in malloc.h on SGI! */ -#define M_SYNC 2 -#define M_RECORD 3 -#define M_GLOBAL 4 -#define M_ASYNC 5 -#endif - #define ADIOI_FILE_COOKIE 2487376 #define ADIOI_REQ_COOKIE 3493740 @@ -293,11 +326,13 @@ typedef struct { void ADIO_Init(int *argc, char ***argv, int *error_code); void ADIO_End(int *error_code); -ADIO_File ADIO_Open(MPI_Comm orig_comm, MPI_Comm comm, char *filename, - int file_system, - int access_mode, ADIO_Offset disp, MPI_Datatype etype, - MPI_Datatype filetype, int iomode, - MPI_Info info, int perm, int *error_code); +MPI_File ADIO_Open(MPI_Comm orig_comm, MPI_Comm comm, char *filename, + int file_system, ADIOI_Fns *ops, + int access_mode, ADIO_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, + MPI_Info info, int perm, int *error_code); +void ADIOI_OpenColl(ADIO_File fd, int rank, int acces_mode, int *error_code); +void ADIO_ImmediateOpen(ADIO_File fd, int *error_code); void ADIO_Close(ADIO_File fd, int *error_code); void ADIO_ReadContig(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, int file_ptr_type, ADIO_Offset offset, @@ -365,10 +400,45 @@ void ADIO_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp, void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code); void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, MPI_Info info, int *error_code); - +int ADIO_Feature(ADIO_File fd, int flag); + +/* functions to help deal with the array datatypes */ +int ADIO_Type_create_subarray(int ndims, + int *array_of_sizes, + int *array_of_subsizes, + int *array_of_starts, + int order, + MPI_Datatype oldtype, + MPI_Datatype *newtype); +int ADIO_Type_create_darray(int size, int rank, int ndims, + int *array_of_gsizes, int *array_of_distribs, + int *array_of_dargs, int *array_of_psizes, + int order, MPI_Datatype oldtype, + MPI_Datatype *newtype); + +/* MPI_File management functions (in mpio_file.c) */ +MPI_File MPIO_File_create(int size); +ADIO_File MPIO_File_resolve(MPI_File mpi_fh); +void MPIO_File_free(MPI_File *mpi_fh); +MPI_File MPIO_File_f2c(MPI_Fint fh); +MPI_Fint MPIO_File_c2f(MPI_File fh); +int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], + int line, int error_class, const char generic_msg[], + const char specific_msg[], ... ); +int MPIO_Err_return_file(MPI_File mpi_fh, int error_code); +int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code); + +/* request managment helper functions */ +void MPIO_Completed_request_create(MPI_File *fh, MPI_Offset nbytes, + int * error_code, MPI_Request *request); #include "adioi.h" #include "adioi_fs_proto.h" #include "mpio_error.h" #include "mpipr.h" + +/* these two defines don't appear to be in any other header file */ +#define MPIR_ERR_FATAL 1 +#define MPIR_ERR_RECOVERABLE 0 + #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/include/adio_cb_config_list.h b/src/libs/ck-libs/ampi/romio/adio/include/adio_cb_config_list.h index 9d393f1b84..cf9fc541f1 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/adio_cb_config_list.h +++ b/src/libs/ck-libs/ampi/romio/adio/include/adio_cb_config_list.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 2001 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -18,10 +17,10 @@ typedef struct ADIO_cb_name_arrayD *ADIO_cb_name_array; int ADIOI_cb_gather_name_array(MPI_Comm comm, MPI_Comm dupcomm, ADIO_cb_name_array *arrayp); -int ADIOI_cb_copy_name_array(MPI_Comm comm, int *keyval, void *extra, +int ADIOI_cb_copy_name_array(MPI_Comm comm, int keyval, void *extra, void *attr_in, void **attr_out, int *flag); -int ADIOI_cb_delete_name_array(MPI_Comm comm, int *keyval, void *attr_val, +int ADIOI_cb_delete_name_array(MPI_Comm comm, int keyval, void *attr_val, void *extra); int ADIOI_cb_config_list_parse(char *config_list, ADIO_cb_name_array array, int ranklist[], int cb_nodes); diff --git a/src/libs/ck-libs/ampi/romio/adio/include/adio_extern.h b/src/libs/ck-libs/ampi/romio/adio/include/adio_extern.h dissimilarity index 72% index 9807369e69..98e6a8b502 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/adio_extern.h +++ b/src/libs/ck-libs/ampi/romio/adio/include/adio_extern.h @@ -1,59 +1,33 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "converse.h" //For Ctv* - -CtvExtern(ADIOI_Flatlist_node*, ADIOI_Flatlist); - -CtvExtern(ADIOI_Async_node*, ADIOI_Async_list_head); -CtvExtern(ADIOI_Async_node*, ADIOI_Async_list_tail); - -CtvExtern(ADIOI_Async_node*, ADIOI_Async_avail_head); -CtvExtern(ADIOI_Async_node*, ADIOI_Async_avail_tail); - -CtvExtern(ADIOI_Malloc_async*, ADIOI_Malloc_async_head); -CtvExtern(ADIOI_Malloc_async*, ADIOI_Malloc_async_tail); - -CtvExtern(ADIOI_Req_node*, ADIOI_Req_avail_head); -CtvExtern(ADIOI_Req_node*, ADIOI_Req_avail_tail); - -CtvExtern(ADIOI_Malloc_req*, ADIOI_Malloc_req_head); -CtvExtern(ADIOI_Malloc_req*, ADIOI_Malloc_req_tail); -// extern ADIOI_Async_node *ADIOI_Async_list_head, *ADIOI_Async_list_tail; -// /* list of outstanding asynchronous requests */ - -// extern ADIOI_Async_node *ADIOI_Async_avail_head, *ADIOI_Async_avail_tail; -// /* list of available (already malloced) nodes for the async list */ -// extern ADIOI_Malloc_async *ADIOI_Malloc_async_head, *ADIOI_Malloc_async_tail; -// /* list of malloced areas in memory, which must be freed in ADIO_End */ - -// extern ADIOI_Req_node *ADIOI_Req_avail_head, *ADIOI_Req_avail_tail; -// /* list of available (already malloced) request objects */ -// extern ADIOI_Malloc_req *ADIOI_Malloc_req_head, *ADIOI_Malloc_req_tail; -// /* list of malloced areas for requests, which must be freed in ADIO_End */ - -/* for f2c and c2f conversion */ -// extern ADIO_File *ADIOI_Ftable; -// extern int ADIOI_Ftable_ptr, ADIOI_Ftable_max; -// extern ADIO_Request *ADIOI_Reqtable; -// extern int ADIOI_Reqtable_ptr, ADIOI_Reqtable_max; -CtvExtern(ADIO_File*, ADIOI_Ftable); -CtvExtern(int, ADIOI_Ftable_ptr); -CtvExtern(int, ADIOI_Ftable_max); -CtvExtern(ADIO_Request*, ADIOI_Reqtable); -CtvExtern(int, ADIOI_Reqtable_ptr); -CtvExtern(int, ADIOI_Reqtable_max); -#ifndef HAVE_MPI_INFO -extern MPI_Info *MPIR_Infotable; -extern int MPIR_Infotable_ptr, MPIR_Infotable_max; -#endif -#ifdef XFS -extern int ADIOI_Direct_read, ADIOI_Direct_write; -#endif - -CtvExtern(MPI_Errhandler, ADIOI_DFLT_ERR_HANDLER); +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +CtvExtern(ADIOI_Flatlist_node*, ADIOI_Flatlist); + +CtvExtern(ADIOI_Datarep *, ADIOI_Datarep_head); + +/* for f2c and c2f conversion */ +CtvExtern(ADIO_File *, ADIOI_Ftable); +CtvExtern(int, ADIOI_Ftable_ptr); +CtvExtern(int, ADIOI_Ftable_max); +CtvExtern(ADIO_Request *, ADIOI_Reqtable); +CtvExtern(int, ADIOI_Reqtable_ptr); +CtvExtern(int, ADIOI_Reqtable_max); +#ifndef HAVE_MPI_INFO +extern MPI_Info *MPIR_Infotable; +extern int MPIR_Infotable_ptr, MPIR_Infotable_max; +#endif +#if defined(ROMIO_XFS) || defined(ROMIO_LUSTRE) +extern int ADIOI_Direct_read, ADIOI_Direct_write; +#endif + +CtvExtern(MPI_Errhandler, ADIOI_DFLT_ERR_HANDLER); + +CtvExtern(MPI_Info, ADIOI_syshints); + +CtvExtern(MPI_Op, ADIO_same_amode); + +CtvExtern(int, ADIOI_cb_config_list_keyval); diff --git a/src/libs/ck-libs/ampi/romio/adio/include/adioi.h b/src/libs/ck-libs/ampi/romio/adio/include/adioi.h index 002876caf9..c4d710b852 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/adioi.h +++ b/src/libs/ck-libs/ampi/romio/adio/include/adioi.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -24,32 +23,6 @@ #ifndef ADIOI_INCLUDE #define ADIOI_INCLUDE - -/* each pending nonblocking request is stored on a linked list */ -typedef struct ADIOI_Async { - ADIO_Request *request; - struct ADIOI_Async *prev, *next; -} ADIOI_Async_node; - -/* list to keep track of memory regions that have been malloced - for above async list */ -typedef struct ADIOI_Malloc_async_ptr { - ADIOI_Async_node *ptr; /* ptr to malloced region */ - struct ADIOI_Malloc_async_ptr *next; -} ADIOI_Malloc_async; - -/* used to malloc request objects in bulk */ -typedef struct ADIOI_Req_n { - struct ADIOI_RequestD reqd; - struct ADIOI_Req_n *next; -} ADIOI_Req_node; - -/* used to keep track of the malloced requests that need to be freed */ -typedef struct ADIOI_Malloc_req_ptr { - ADIOI_Req_node *ptr; /* ptr to malloced region */ - struct ADIOI_Malloc_req_ptr *next; -} ADIOI_Malloc_req; - /* used to keep track of hint/info values. * Note that there are a lot of int-sized values in here...they are * used as int-sized entities other places as well. This would be a @@ -57,15 +30,24 @@ typedef struct ADIOI_Malloc_req_ptr { */ struct ADIOI_Hints_struct { int initialized; + int striping_factor; + int striping_unit; int cb_read; int cb_write; int cb_nodes; int cb_buffer_size; + int cb_pfr; + int cb_fr_type; + int cb_fr_alignment; + int cb_ds_threshold; + int cb_alltoall; int ds_read; int ds_write; int no_indep_rw; int ind_rd_buffer_size; int ind_wr_buffer_size; + int deferred_open; + int min_fdomain_size; char *cb_config_list; int *ranklist; union { @@ -73,10 +55,38 @@ struct ADIOI_Hints_struct { int listio_read; int listio_write; } pvfs; + struct { + int debugmask; + int posix_read; + int posix_write; + int listio_read; + int listio_write; + int dtype_read; + int dtype_write; + } pvfs2; + struct { + int start_iodevice; + int co_ratio; + int coll_threshold; + int ds_in_coll; + } lustre; + struct { + unsigned read_chunk_sz; /* chunk size for direct reads */ + unsigned write_chunk_sz; /* chunk size for direct writes */ + } xfs; } fs_hints; }; +typedef struct ADIOI_Datarep { + char *name; + void *state; + MPI_Datarep_extent_function *extent_fn; + MPI_Datarep_conversion_function *read_conv_fn; + MPI_Datarep_conversion_function *write_conv_fn; + struct ADIOI_Datarep *next; /* pointer to next datarep */ +} ADIOI_Datarep; + /* Values for use with cb_read, cb_write, ds_read, and ds_write * and some fs-specific hints (IBM xlc, Compaq Tru64 compilers object to a comma after the last item) @@ -95,15 +105,41 @@ enum { typedef struct ADIOI_Fl_node { MPI_Datatype type; int count; /* no. of contiguous blocks */ - int *blocklens; /* array of contiguous block lengths (bytes)*/ - /* may need to make it ADIO_Offset *blocklens */ + ADIO_Offset *blocklens; /* array of contiguous block lengths (bytes)*/ ADIO_Offset *indices; /* array of byte offsets of each block */ struct ADIOI_Fl_node *next; /* pointer to next node */ } ADIOI_Flatlist_node; +#ifdef ROMIO_PVFS2 +#include +#endif +typedef struct ADIOI_AIO_req_str { + /* very wierd: if this MPI_Request is a pointer, some C++ compilers + * will clobber it when the MPICH2 C++ bindings are used */ + MPI_Request req; + MPI_Offset nbytes; + /* should probably make this a union */ +#ifdef ROMIO_HAVE_WORKING_AIO + struct aiocb *aiocbp; +#endif +#ifdef ROMIO_PVFS2 + PVFS_sys_op_id op_id; + PVFS_sysresp_io resp_io; + PVFS_Request file_req; + PVFS_Request mem_req; +#endif +#ifdef ROMIO_NTFS + /* Ptr to Overlapped struct */ + LPOVERLAPPED lpOvl; + /* Ptr to file handle */ + HANDLE fd; +#endif +} ADIOI_AIO_Request; struct ADIOI_Fns_struct { void (*ADIOI_xxx_Open) (ADIO_File fd, int *error_code); + void (*ADIOI_xxx_OpenColl) (ADIO_File fd, int rank, + int access_mode, int *error_code); void (*ADIOI_xxx_ReadContig) (ADIO_File fd, void *buf, int count, MPI_Datatype datatype, int file_ptr_type, ADIO_Offset offset, ADIO_Status *status, int *error_code); @@ -152,6 +188,7 @@ struct ADIOI_Fns_struct { void (*ADIOI_xxx_Flush) (ADIO_File fd, int *error_code); void (*ADIOI_xxx_Resize) (ADIO_File fd, ADIO_Offset size, int *error_code); void (*ADIOI_xxx_Delete) (char *filename, int *error_code); + int (*ADIOI_xxx_Feature) (ADIO_File fd, int flag); }; /* optypes for ADIO_RequestD */ @@ -161,13 +198,13 @@ struct ADIOI_Fns_struct { #define ADIOI_MIN(a, b) ((a) < (b) ? (a) : (b)) #define ADIOI_MAX(a, b) ((a) > (b) ? (a) : (b)) -#define ADIOI_PREALLOC_BUFSZ 4194304 /* buffer size used to +#define ADIOI_PREALLOC_BUFSZ 16777216 /* buffer size used to preallocate disk space */ /* default values for some hints */ - /* buffer size for collective I/O = 4MB */ -#define ADIOI_CB_BUFFER_SIZE_DFLT "4194304" + /* buffer size for collective I/O = 16 MB */ +#define ADIOI_CB_BUFFER_SIZE_DFLT "16777216" /* buffer size for data sieving in independent reads = 4MB */ #define ADIOI_IND_RD_BUFFER_SIZE_DFLT "4194304" /* buffer size for data sieving in independent writes = 512KB. default is @@ -181,6 +218,9 @@ struct ADIOI_Fns_struct { /* some of the ADIO functions are macro-replaced */ +#define ADIOI_OpenColl(fd, rank, access_mode, error_code) \ + (*(fd->fns->ADIOI_xxx_OpenColl))(fd, rank, access_mode, error_code) + #define ADIO_ReadContig(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) \ (*(fd->fns->ADIOI_xxx_ReadContig))(fd,buf,count,datatype,file_ptr_type,offset,status,error_code) @@ -247,19 +287,31 @@ struct ADIOI_Fns_struct { #define ADIO_SetInfo(fd, users_info, error_code) \ (*(fd->fns->ADIOI_xxx_SetInfo))(fd, users_info, error_code) +#define ADIO_Feature(fd, flag) \ + (*(fd->fns->ADIOI_xxx_Feature))(fd, flag) + /* structure for storing access info of this process's request from the file domain of other processes, and vice-versa. used as array of structures indexed by process number. */ typedef struct { ADIO_Offset *offsets; /* array of offsets */ - int *lens; /* array of lengths */ + int *lens; /* array of lengths */ + /* consider aints or offsets for lens? Seems to be used as in-memory + buffer lengths, so it should be < 2G and ok as an int */ MPI_Aint *mem_ptrs; /* array of pointers. used in the read/write phase to indicate where the data is stored in memory */ int count; /* size of above arrays */ } ADIOI_Access; +/* structure for storing generic offset/length pairs. used to describe + file realms among other things */ +typedef struct { + ADIO_Offset *offsets; /* array of offsets */ + int *lens; /* array of lengths */ + int count; /* size of above arrays */ +} ADIOI_Offlen; /* prototypes for ADIO internal functions */ @@ -269,29 +321,72 @@ void ADIOI_Flatten(MPI_Datatype type, ADIOI_Flatlist_node *flat, ADIO_Offset st_offset, int *curr_index); void ADIOI_Delete_flattened(MPI_Datatype datatype); int ADIOI_Count_contiguous_blocks(MPI_Datatype type, int *curr_index); -ADIOI_Async_node *ADIOI_Malloc_async_node(void); -void ADIOI_Free_async_node(ADIOI_Async_node *node); -void ADIOI_Add_req_to_list(ADIO_Request *request); void ADIOI_Complete_async(int *error_code); -void ADIOI_Del_req_from_list(ADIO_Request *request); -struct ADIOI_RequestD *ADIOI_Malloc_request(void); -void ADIOI_Free_request(ADIOI_Req_node *node); -void *ADIOI_Malloc_fn(size_t size, int lineno, char *fname); -void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, char *fname); -void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, char *fname); -void ADIOI_Free_fn(void *ptr, int lineno, char *fname); +void *ADIOI_Malloc_fn(size_t size, int lineno, const char *fname); +void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, const char *fname); +void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, const char *fname); +void ADIOI_Free_fn(void *ptr, int lineno, const char *fname); void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag); void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset); void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset); -void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, ADIO_Offset *disp); +void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, + ADIO_Offset *disp); +void ADIOI_process_system_hints(MPI_Info info); +void ADIOI_incorporate_system_hints(MPI_Info info, MPI_Info sysinfo, + MPI_Info *new_info); + +void ADIOI_GEN_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, + int *error_code); void ADIOI_GEN_Flush(ADIO_File fd, int *error_code); +void ADIOI_GEN_OpenColl(ADIO_File fd, int rank, + int access_mode, int *error_code); +void ADIOI_SCALEABLE_OpenColl(ADIO_File fd, int rank, + int access_mode, int *error_code); +void ADIOI_FAILSAFE_OpenColl(ADIO_File fd, int rank, + int access_mode, int *error_code); void ADIOI_GEN_Delete(char *filename, int *error_code); - +void ADIOI_GEN_ReadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, + int *error_code); +int ADIOI_GEN_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset, + int wr, MPI_Request *request); +void ADIOI_GEN_IreadContig(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_GEN_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_GEN_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_GEN_ReadStrided(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); +void ADIOI_GEN_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_GEN_IwriteStrided(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_GEN_IODone(ADIO_Request *request, ADIO_Status *status, + int *error_code); +void ADIOI_GEN_IOComplete(ADIO_Request *request, ADIO_Status *status, + int *error_code); +int ADIOI_GEN_aio_poll_fn(void *extra_state, ADIO_Status *status); +int ADIOI_GEN_aio_wait_fn(int count, void **array_of_states, double timeout, + ADIO_Status *status); +int ADIOI_GEN_aio_query_fn(void *extra_state, ADIO_Status *status); +int ADIOI_GEN_aio_free_fn(void *extra_state); +int ADIOI_GEN_Feature(ADIO_File fd, int feature); + void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count, MPI_Datatype buftype, int file_ptr_type, ADIO_Offset offset, ADIO_Status *status, int @@ -300,6 +395,14 @@ void ADIOI_GEN_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_GEN_WriteStrided_naive(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_NOLOCK_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_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count, MPI_Datatype datatype, int file_ptr_type, ADIO_Offset offset, ADIO_Status *status, int @@ -310,7 +413,7 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, void *buf, int count, *error_code); void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype datatype, int file_ptr_type, ADIO_Offset - offset, ADIO_Offset **offset_list_ptr, int + offset, ADIO_Offset **offset_list_ptr, ADIO_Offset **len_list_ptr, ADIO_Offset *start_offset_ptr, ADIO_Offset *end_offset_ptr, int *contig_access_count_ptr); @@ -318,7 +421,9 @@ void ADIOI_Calc_file_domains(ADIO_Offset *st_offsets, ADIO_Offset *end_offsets, int nprocs, int nprocs_for_coll, ADIO_Offset *min_st_offset_ptr, ADIO_Offset **fd_start_ptr, ADIO_Offset - **fd_end_ptr, ADIO_Offset *fd_size_ptr); + **fd_end_ptr, int min_fd_size, + ADIO_Offset *fd_size_ptr, + int striping_unit); int ADIOI_Calc_aggregator(ADIO_File fd, ADIO_Offset off, ADIO_Offset min_off, @@ -327,7 +432,7 @@ int ADIOI_Calc_aggregator(ADIO_File fd, ADIO_Offset *fd_start, ADIO_Offset *fd_end); void ADIOI_Calc_my_req(ADIO_File fd, ADIO_Offset *offset_list, - int *len_list, int + ADIO_Offset *len_list, int contig_access_count, ADIO_Offset min_st_offset, ADIO_Offset *fd_start, ADIO_Offset *fd_end, ADIO_Offset fd_size, @@ -342,10 +447,114 @@ void ADIOI_Calc_others_req(ADIO_File fd, int count_my_req_procs, int nprocs, int myrank, int *count_others_req_procs_ptr, ADIOI_Access **others_req_ptr); + +/* KC && AC - New Collective I/O internals*/ + +#define TEMP_OFF 0 +#define REAL_OFF 1 +#define MAX_OFF_TYPE 2 + +/* Communication Tags */ +#define DATA_TAG 30 +#define AMT_TAG 31 + +/* cb_fr_type user size is non-zero */ +#define ADIOI_FR_AAR 0 +#define ADIOI_FR_FSZ -1 +#define ADIOI_FR_USR_REALMS -2 + +typedef struct flatten_state +{ + ADIO_Offset abs_off; + ADIO_Offset cur_sz; + ADIO_Offset idx; + ADIO_Offset cur_reg_off; +} flatten_state; + +typedef struct view_state +{ + ADIO_Offset fp_ind; /* file view params*/ + ADIO_Offset disp; /* file view params*/ + ADIO_Offset byte_off; + ADIO_Offset sz; + ADIO_Offset ext; /* preserved extent from MPI_Type_extent */ + ADIO_Offset type_sz; + + /* Current state */ + flatten_state cur_state; + /* Scratch state for counting up ol pairs */ + flatten_state tmp_state; + + /* Preprocessed data amount and ol pairs */ + ADIO_Offset pre_sz; + int pre_ol_ct; + MPI_Aint *pre_disp_arr; + int *pre_blk_arr; + + ADIOI_Flatlist_node *flat_type_p; +} view_state; + +void ADIOI_Calc_bounds (ADIO_File fd, int count, MPI_Datatype buftype, + int file_ptr_type, ADIO_Offset offset, + ADIO_Offset *st_offset, ADIO_Offset *end_offset); +int ADIOI_Agg_idx (int rank, ADIO_File fd); +void ADIOI_Calc_file_realms (ADIO_File fd, ADIO_Offset min_st_offset, + ADIO_Offset max_end_offset); +void ADIOI_IOFiletype(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, MPI_Datatype custom_ftype, + int rdwr, ADIO_Status *status, int + *error_code); +void ADIOI_IOStridedColl(ADIO_File fd, void *buf, int count, int rdwr, + MPI_Datatype datatype, int file_ptr_type, + ADIO_Offset offset, ADIO_Status *status, int + *error_code); +void ADIOI_Print_flatlist_node(ADIOI_Flatlist_node *flatlist_node_p); +ADIOI_Flatlist_node * ADIOI_Add_contig_flattened(MPI_Datatype contig_type); +void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type, + ADIO_File fd, int count, + MPI_Datatype datatype, ADIO_Offset off, + view_state *my_mem_view_state_arr, + view_state *agg_file_view_state_arr, + view_state *client_file_view_state_arr); +int ADIOI_init_view_state(int file_ptr_type, + int nprocs, + view_state *view_state_arr, + int op_type); +int ADIOI_Build_agg_reqs(ADIO_File fd, int rw_type, int nprocs, + view_state *client_file_view_state_arr, + MPI_Datatype *client_comm_dtype_arr, + ADIO_Offset *client_comm_sz_arr, + ADIO_Offset *agg_dtype_offset_p, + MPI_Datatype *agg_dtype_p); +int ADIOI_Build_client_reqs(ADIO_File fd, + int nprocs, + view_state *my_mem_view_state_arr, + view_state *agg_file_view_state_arr, + ADIO_Offset *agg_comm_sz_arr, + MPI_Datatype *agg_comm_dtype_arr); +int ADIOI_Build_client_pre_req(ADIO_File fd, + int agg_rank, + int agg_idx, + view_state *my_mem_view_state_p, + view_state *agg_file_view_state_p, + ADIO_Offset max_pre_req_sz, + int max_ol_ct); +int ADIOI_Build_client_req(ADIO_File fd, + int agg_rank, + int agg_idx, + view_state *my_mem_view_state_p, + view_state *agg_file_view_state_p, + ADIO_Offset agg_comm_sz, + MPI_Datatype *agg_comm_dtype_p); + ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); + int whence, int *error_code); +void ADIOI_GEN_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); +void ADIOI_GEN_Close(ADIO_File fd, int *error_code); void ADIOI_Shfp_fname(ADIO_File fd, int rank); +void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset size, int *error_code); int ADIOI_Error(ADIO_File fd, int error_code, char *string); int MPIR_Err_setmsg( int, int, const char *, const char *, const char *, ... ); int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void *extra_state); @@ -354,24 +563,120 @@ int ADIOI_Uses_generic_read(ADIO_File fd); int ADIOI_Uses_generic_write(ADIO_File fd); +int ADIOI_FAKE_IODone(ADIO_Request *request, ADIO_Status *status, + int *error_code); +void ADIOI_FAKE_IreadContig(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_FAKE_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_FAKE_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_FAKE_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_FAKE_IOComplete(ADIO_Request *request, ADIO_Status *status, + int *error_code); + + +/* File I/O common functionality */ +int MPIOI_File_read(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Status *status); +int MPIOI_File_write(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Status *status); +int MPIOI_File_read_all(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Status *status); +int MPIOI_File_write_all(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Status *status); +int MPIOI_File_read_all_begin(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname); +int MPIOI_File_write_all_begin(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname); +int MPIOI_File_read_all_end(MPI_File fh, + void *buf, + char *myname, + MPI_Status *status); +int MPIOI_File_write_all_end(MPI_File fh, + void *buf, + char *myname, + MPI_Status *status); +int MPIOI_File_iwrite(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Request *request); +int MPIOI_File_iread(MPI_File fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Request *request); + + + /* Unix-style file locking */ -#if (defined(HFS) || defined(XFS)) +#if (defined(ROMIO_HFS) || defined(ROMIO_XFS)) # define ADIOI_WRITE_LOCK(fd, offset, whence, len) \ - if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \ + do {if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \ ADIOI_Set_lock64((fd)->fd_sys, F_SETLKW64, F_WRLCK, offset, whence, len);\ - else ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len) + else ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len); } while (0) # define ADIOI_READ_LOCK(fd, offset, whence, len) \ - if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \ + do {if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \ ADIOI_Set_lock64((fd)->fd_sys, F_SETLKW64, F_RDLCK, offset, whence, len);\ - else ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len) + else ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len); }while (0) # define ADIOI_UNLOCK(fd, offset, whence, len) \ - if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \ + do {if (((fd)->file_system == ADIO_XFS) || ((fd)->file_system == ADIO_HFS)) \ ADIOI_Set_lock64((fd)->fd_sys, F_SETLK64, F_UNLCK, offset, whence, len); \ - else ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len) + else ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len); }while (0) #elif (defined(ROMIO_NTFS)) @@ -381,18 +686,33 @@ int ADIOI_Uses_generic_write(ADIO_File fd); # define ADIOI_WRITE_LOCK(fd, offset, whence, len) \ ADIOI_Set_lock((fd)->fd_sys, ADIOI_LOCK_CMD, LOCKFILE_EXCLUSIVE_LOCK, offset, whence, len) # define ADIOI_READ_LOCK(fd, offset, whence, len) \ - ADIOI_Set_lock((fd)->fd_sys, ADIOLOCK, 0, offset, whence, len) + ADIOI_Set_lock((fd)->fd_sys, ADIOI_LOCK_CMD, 0, offset, whence, len) # define ADIOI_UNLOCK(fd, offset, whence, len) \ ADIOI_Set_lock((fd)->fd_sys, ADIOI_UNLOCK_CMD, LOCKFILE_FAIL_IMMEDIATELY, offset, whence, len) #else +#ifdef ADIOI_MPE_LOGGING +# define ADIOI_WRITE_LOCK(fd, offset, whence, len) do { \ + MPE_Log_event( ADIOI_MPE_writelock_a, 0, NULL ); \ + ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len); \ + MPE_Log_event( ADIOI_MPE_writelock_b, 0, NULL ); } while( 0 ) +# define ADIOI_READ_LOCK(fd, offset, whence, len) \ + MPE_Log_event( ADIOI_MPE_readlock_a, 0, NULL ); do { \ + ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len); \ + MPE_Log_event( ADIOI_MPE_readlock_b, 0, NULL ); } while( 0 ) +# define ADIOI_UNLOCK(fd, offset, whence, len) do { \ + MPE_Log_event( ADIOI_MPE_unlock_a, 0, NULL ); \ + ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len); \ + MPE_Log_event( ADIOI_MPE_unlock_b, 0, NULL ); } while( 0 ) +#else # define ADIOI_WRITE_LOCK(fd, offset, whence, len) \ ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_WRLCK, offset, whence, len) # define ADIOI_READ_LOCK(fd, offset, whence, len) \ ADIOI_Set_lock((fd)->fd_sys, F_SETLKW, F_RDLCK, offset, whence, len) # define ADIOI_UNLOCK(fd, offset, whence, len) \ ADIOI_Set_lock((fd)->fd_sys, F_SETLK, F_UNLCK, offset, whence, len) +#endif #endif @@ -404,11 +724,52 @@ int ADIOI_Set_lock64(FDTYPE fd_sys, int cmd, int type, ADIO_Offset offset, int w #define ADIOI_Realloc(a,b) ADIOI_Realloc_fn(a,b,__LINE__,__FILE__) #define ADIOI_Free(a) ADIOI_Free_fn(a,__LINE__,__FILE__) -#define FPRINTF fprintf +int ADIOI_Strncpy( char *outstr, const char *instr, size_t maxlen ); +int ADIOI_Strnapp( char *, const char *, size_t ); +char *ADIOI_Strdup( const char * ); -#ifdef AMPI -#define PRINT_ERR_MSG +/* the current MPI standard is not const-correct, and modern compilers warn + * about the following sort of code: + * + * MPI_Info_set(info, "key", "val"); + * + * reminding us that "key" and "val" are const. We use the following macros to + * cast away the const and suppress the warning. */ +#define ADIOI_Info_set(info_,key_str_,val_) \ + MPI_Info_set((info_),((char*)key_str_),(char*)(val_)) +#define ADIOI_Info_get(info_,key_str_,val_len_,val_,flag_) \ + MPI_Info_get((info_),((char*)key_str_),(val_len_),(val_),(flag_)) +#define ADIOI_Info_get_valuelen(info_,key_str_,val_len_,flag_) \ + MPI_Info_get_valuelen((info_),((char*)key_str_),(val_len_),(flag_)) +#define ADIOI_Info_delete(info_,key_str_) \ + MPI_Info_delete((info_),((char*)key_str_)) + + +/* Provide a fallback snprintf for systems that do not have one */ +/* Define attribute as empty if it has no definition */ +#ifndef ATTRIBUTE +#ifdef HAVE_GCC_ATTRIBUTE +#define ATTRIBUTE(a) __attribute__(a) #else +#define ATTRIBUTE(a) +#endif +#endif + +/* style: allow:snprintf:1 sig:0 */ + +#ifdef HAVE_SNPRINTF +#define ADIOI_Snprintf snprintf +/* Sometimes systems don't provide prototypes for snprintf */ +#ifdef NEEDS_SNPRINTF_DECL +extern int snprintf( char *, size_t, const char *, ... ) ATTRIBUTE((format(printf,3,4))); +#endif +#else +int ADIOI_Snprintf( char *str, size_t size, const char *format, ... ) + ATTRIBUTE((format(printf,3,4))); +#endif /* HAVE_SNPRINTF */ + +#define FPRINTF fprintf + #ifndef HAVE_STRERROR # ifdef HAVE_SYSERRLIST extern char *sys_errlist[]; @@ -417,8 +778,85 @@ int ADIOI_Set_lock64(FDTYPE fd_sys, int cmd, int type, ADIO_Offset offset, int w # define PRINT_ERR_MSG # endif #endif -#endif //AMPI #include "adioi_error.h" +/* MPE logging variables */ + +#ifdef ADIOI_MPE_LOGGING +#include "mpe.h" + +int ADIOI_MPE_open_a; +int ADIOI_MPE_open_b; +int ADIOI_MPE_read_a; +int ADIOI_MPE_read_b; +int ADIOI_MPE_write_a; +int ADIOI_MPE_write_b; +int ADIOI_MPE_lseek_a; +int ADIOI_MPE_lseek_b; +int ADIOI_MPE_close_a; +int ADIOI_MPE_close_b; +int ADIOI_MPE_writelock_a; +int ADIOI_MPE_writelock_b; +int ADIOI_MPE_readlock_a; +int ADIOI_MPE_readlock_b; +int ADIOI_MPE_unlock_a; +int ADIOI_MPE_unlock_b; +int ADIOI_MPE_postwrite_a; +int ADIOI_MPE_postwrite_b; +int ADIOI_MPE_openinternal_a; +int ADIOI_MPE_openinternal_b; +int ADIOI_MPE_stat_a; +int ADIOI_MPE_stat_b; +int ADIOI_MPE_iread_a; +int ADIOI_MPE_iread_b; +int ADIOI_MPE_iwrite_a; +int ADIOI_MPE_iwrite_b; #endif + +#ifdef ROMIO_INSIDE_MPICH2 +/* Assert that this MPI_Aint value can be cast to a ptr value without problem.*/ +/* Basic idea is the value should be unchanged after casting + (no loss of (meaningful) high order bytes in 8 byte MPI_Aint + to (possible) 4 byte ptr cast) */ +/* Should work even on 64bit or old 32bit configs */ + /* Use MPID_Ensure_Aint_fits_in_pointer from mpiutil.h and + MPI_AINT_CAST_TO_VOID_PTR from configure (mpi.h) */ + #include "mpiimpl.h" + + #define ADIOI_AINT_CAST_TO_VOID_PTR (void*)(MPIR_Pint) + /* The next two casts are only used when you don't want sign extension + when casting a (possible 4 byte) aint to a (8 byte) long long or offset */ + #define ADIOI_AINT_CAST_TO_LONG_LONG (long long) + #define ADIOI_AINT_CAST_TO_OFFSET ADIOI_AINT_CAST_TO_LONG_LONG + + #define ADIOI_ENSURE_AINT_FITS_IN_PTR(aint_value) MPID_Ensure_Aint_fits_in_pointer(aint_value) + #define ADIOI_Assert MPIU_Assert +#else + #include + #define ADIOI_AINT_CAST_TO_VOID_PTR (void*) + #define ADIOI_AINT_CAST_TO_LONG_LONG (long long) + #define ADIOI_AINT_CAST_TO_OFFSET ADIOI_AINT_CAST_TO_LONG_LONG + #define ADIOI_ENSURE_AINT_FITS_IN_PTR(aint_value) + #define ADIOI_Assert assert + #define MPIR_Upint unsigned long + #define MPIU_THREADPRIV_DECL +#endif + +#ifdef USE_DBG_LOGGING /*todo fix dependency on mpich?*/ +/* DBGT_FPRINTF terse level printing */ +#define DBGT_FPRINTF if (MPIU_DBG_SELECTED(ROMIO,VERBOSE)) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \ +if (MPIU_DBG_SELECTED(ROMIO,TERSE)) fprintf +/* DBG_FPRINTF default (typical level) printing */ +#define DBG_FPRINTF if (MPIU_DBG_SELECTED(ROMIO,VERBOSE)) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \ +if (MPIU_DBG_SELECTED(ROMIO,TYPICAL)) fprintf +/* DBGV_FPRINTF verbose level printing */ +#define DBGV_FPRINTF if (MPIU_DBG_SELECTED(ROMIO,VERBOSE)) fprintf(stderr,"%s:%d:",__FILE__,__LINE__); \ + if (MPIU_DBG_SELECTED(ROMIO,VERBOSE)) fprintf +#else /* compile it out */ +#define DBGT_FPRINTF if (0) fprintf +#define DBG_FPRINTF if (0) fprintf +#define DBGV_FPRINTF if (0) fprintf +#endif +#endif + diff --git a/src/libs/ck-libs/ampi/romio/adio/include/adioi_errmsg.h b/src/libs/ck-libs/ampi/romio/adio/include/adioi_errmsg.h index 0b40e4397a..79f9c9e1cd 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/adioi_errmsg.h +++ b/src/libs/ck-libs/ampi/romio/adio/include/adioi_errmsg.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* $Id$ - * +/* * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ @@ -43,7 +42,7 @@ MPI_ERR_REQUEST MPI_ERR_IO MPIR_ERR_ETYPE_FRACTIONAL "Only an integral number of etypes can be accessed" - MPIR_ERR_NO_FSTYPE "Can't determine the file-system type. Check the filename/path you provided and try again. Otherwise, prefix the filename with a string to indicate the type of file sytem (piofs:, pfs:, nfs:, ufs:, hfs:, xfs:, sfs:, pvfs:)" + MPIR_ERR_NO_FSTYPE "Can't determine the file-system type. Check the filename/path you provided and try again. Otherwise, prefix the filename with a string to indicate the type of file sytem (piofs:, pfs:, nfs:, ufs:, hfs:, xfs:, sfs:, pvfs:, panfs: ftp: gsiftp:)" MPIR_ERR_NO_PFS "ROMIO has not been configured to use the PFS file system" MPIR_ERR_NO_PIOFS "ROMIO has not been configured to use the PIOFS file system" MPIR_ERR_NO_UFS "ROMIO has not been configured to use the UFS file system" @@ -52,6 +51,7 @@ MPI_ERR_IO MPIR_ERR_NO_XFS "ROMIO has not been configured to use the XFS file system" MPIR_ERR_NO_SFS "ROMIO has not been configured to use the SFS file system" MPIR_ERR_NO_PVFS "ROMIO has not been configured to use the PVFS file system" + MPIR_ERR_NO_PANFS "ROMIO has not been configured to use the PANFS file system" MPIR_ERR_MULTIPLE_SPLIT_COLL "Only one active split collective I/O operation allowed per file handle" MPIR_ERR_NO_SPLIT_COLL "No previous split collective begin" MPIR_ERR_ASYNC_OUTSTANDING "There are outstanding nonblocking I/O operations on this file" @@ -60,6 +60,8 @@ MPI_ERR_IO MPIR_PREALLOC_PERM "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." MPIR_ERR_FILETYPE "Filetype must be constructed out of one or more etypes" MPIR_ERR_NO_TESTFS "ROMIO has not been configured to use the TESTFS file system" + MPIR_ERR_DEFERRED "independent IO attempted even though no_indep_rw hint given" + MPIR_ERR_NO_BGL "ROMIO has not been configured to use the BGL file system" MPI_ERR_COMM MPIR_ERR_COMM_NULL (null communicator. from MPICH) diff --git a/src/libs/ck-libs/ampi/romio/adio/include/adioi_error.h b/src/libs/ck-libs/ampi/romio/adio/include/adioi_error.h dissimilarity index 76% index 6647b877f5..d7c3ad233a 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/adioi_error.h +++ b/src/libs/ck-libs/ampi/romio/adio/include/adioi_error.h @@ -1,14 +1,140 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* $Id$ - * - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#define ADIOI_TEST_FILE_HANDLE(fh, myname) \ -{if (!(fh)) { \ - error_code = MPIR_Err_setmsg(MPI_ERR_FILE, MPIR_ERR_FILE_NULL, myname, (char *) 0, (char *) 0); \ - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); } \ - else if ((fh)->cookie != ADIOI_FILE_COOKIE) { \ - error_code = MPIR_Err_setmsg(MPI_ERR_FILE, MPIR_ERR_FILE_CORRUPT, myname, (char *) 0, (char *) 0); \ - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); } } - +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include /* for strerror() */ + +/* MPIO_CHECK_XXX macros are used to clean up error checking and + * handling in many of the romio/mpi-io/ source files. + */ +#define MPIO_CHECK_FILE_HANDLE(fh, myname, error_code) \ +if ((fh <= (ADIO_File) 0) || \ + ((fh)->cookie != ADIOI_FILE_COOKIE)) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_ARG, \ + "**iobadfh", 0); \ + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code);\ + goto fn_exit; \ +} + +#define MPIO_CHECK_COUNT(fh, count, myname, error_code) \ +if (count < 0) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_ARG, \ + "**iobadcount", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ +} + +#define MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code) \ +if (count*datatype_size != (ADIO_Offset)(unsigned)count*(ADIO_Offset)(unsigned)datatype_size) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_ARG, \ + "**iobadcount", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ +} + +#define MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code) \ +if (datatype == MPI_DATATYPE_NULL) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_TYPE, \ + "**dtypenull", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ +} + +#define MPIO_CHECK_READABLE(fh, myname, error_code) \ +if (fh->access_mode & ADIO_WRONLY) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_ACCESS, \ + "**iowronly", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ +} + +#define MPIO_CHECK_WRITABLE(fh, myname, error_code) \ +if (fh->access_mode & ADIO_RDONLY) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_READ_ONLY, \ + "**iordonly", \ + 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ +} + +#define MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code) \ +if (fh->access_mode & ADIO_SEQUENTIAL) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_UNSUPPORTED_OPERATION, \ + "**ioamodeseq", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ +} + +#define MPIO_CHECK_INTEGRAL_ETYPE(fh, count, dtype_size, myname, error_code) \ +if ((count*dtype_size) % fh->etype_size != 0) { \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, MPI_ERR_IO, \ + "**ioetype", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ +} + +#define MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code) \ +if ((fh->file_system == ADIO_PIOFS) || \ + (fh->file_system == ADIO_PVFS) || \ + (fh->file_system == ADIO_PVFS2)) \ +{ \ + error_code = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_UNSUPPORTED_OPERATION, \ + "**iosharedunsupported", 0); \ + error_code = MPIO_Err_return_file(fh, error_code); \ + goto fn_exit; \ +} + +/* MPIO_ERR_CREATE_CODE_XXX macros are used to clean up creation of + * error codes for common cases in romio/adio/ + */ +#define MPIO_ERR_CREATE_CODE_ERRNO(myname, myerrno, error_code_p) \ +*(error_code_p) = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_IO, \ + "System call I/O error", \ + "Syscall error from %s: %s", \ + myname, \ + strerror(myerrno)); + +#define MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, key, error_code_p) \ +*(error_code_p) = MPIO_Err_create_code(MPI_SUCCESS, \ + MPIR_ERR_RECOVERABLE, \ + myname, __LINE__, \ + MPI_ERR_NOT_SAME, \ + "Value for info key not same across processes", \ + "Value for info key %s not same across processes",\ + key); + + +/* TODO: handle the independent io case more gracefully */ +#define ADIOI_TEST_DEFERRED(fh, myname, error_code)\ + if(! (fh)->is_open ) {\ + ADIO_ImmediateOpen((fh), (error_code)); } diff --git a/src/libs/ck-libs/ampi/romio/adio/include/adioi_fs_proto.h b/src/libs/ck-libs/ampi/romio/adio/include/adioi_fs_proto.h dissimilarity index 96% index ed51b20e91..88c3a838fc 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/adioi_fs_proto.h +++ b/src/libs/ck-libs/ampi/romio/adio/include/adioi_fs_proto.h @@ -1,582 +1,97 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - - -#ifndef ADIO_PROTO -#define ADIO_PROTO - -#ifdef NFS -extern struct ADIOI_Fns_struct ADIO_NFS_operations; - -void ADIOI_NFS_Open(ADIO_File fd, int *error_code); -void ADIOI_NFS_Close(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_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_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); -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); -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); -void ADIOI_NFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_NFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -ADIO_Offset ADIOI_NFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, 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 - -#ifdef PFS -extern struct ADIOI_Fns_struct ADIO_PFS_operations; - -void ADIOI_PFS_Open(ADIO_File fd, int *error_code); -void ADIOI_PFS_Close(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_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_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); -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); -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); -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); -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); -void ADIOI_PFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_PFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -ADIO_Offset ADIOI_PFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_PFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -#endif - -#ifdef PIOFS -extern struct ADIOI_Fns_struct ADIO_PIOFS_operations; - -void ADIOI_PIOFS_Open(ADIO_File fd, int *error_code); -void ADIOI_PIOFS_Close(ADIO_File fd, int *error_code); -void ADIOI_PIOFS_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_PIOFS_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_PIOFS_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_PIOFS_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_PIOFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_PIOFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_PIOFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_PIOFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_PIOFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_PIOFS_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_PIOFS_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_PIOFS_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_PIOFS_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_PIOFS_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_PIOFS_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_PIOFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_PIOFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -ADIO_Offset ADIOI_PIOFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -#endif - -#ifdef UFS -extern struct ADIOI_Fns_struct ADIO_UFS_operations; - -void ADIOI_UFS_Open(ADIO_File fd, int *error_code); -void ADIOI_UFS_Close(ADIO_File fd, int *error_code); -void ADIOI_UFS_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_UFS_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_UFS_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_UFS_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_UFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_UFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_UFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_UFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_UFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_UFS_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_UFS_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_UFS_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_UFS_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_UFS_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_UFS_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_UFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_UFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -ADIO_Offset ADIOI_UFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_UFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -#endif - -#ifdef ROMIO_NTFS -extern struct ADIOI_Fns_struct ADIO_NTFS_operations; - -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_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_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); -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); -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); -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); -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); -ADIO_Offset ADIOI_NTFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_NTFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -#endif - - -#ifdef HFS -extern struct ADIOI_Fns_struct ADIO_HFS_operations; - -void ADIOI_HFS_Open(ADIO_File fd, int *error_code); -void ADIOI_HFS_Close(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_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_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); -int ADIOI_HFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_HFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_HFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_HFS_WriteComplete(ADIO_Request *request, 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_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_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); -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); -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); -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); -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); -void ADIOI_HFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_HFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -ADIO_Offset ADIOI_HFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_HFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -#endif - -#ifdef XFS -extern struct ADIOI_Fns_struct ADIO_XFS_operations; - -void ADIOI_XFS_Open(ADIO_File fd, int *error_code); -void ADIOI_XFS_Close(ADIO_File fd, int *error_code); -void ADIOI_XFS_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_XFS_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_XFS_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_XFS_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_XFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_XFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_XFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_XFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_XFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_XFS_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_XFS_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_XFS_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_XFS_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_XFS_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_XFS_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_XFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_XFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -ADIO_Offset ADIOI_XFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -#endif - -#ifdef SFS -extern struct ADIOI_Fns_struct ADIO_SFS_operations; - -void ADIOI_SFS_Open(ADIO_File fd, int *error_code); -void ADIOI_SFS_Close(ADIO_File fd, int *error_code); -void ADIOI_SFS_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_SFS_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_SFS_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_SFS_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_SFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_SFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_SFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_SFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_SFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_SFS_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_SFS_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_SFS_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_SFS_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_SFS_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_SFS_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_SFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_SFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -ADIO_Offset ADIOI_SFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_SFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -#endif - -#ifdef ROMIO_PVFS -extern struct ADIOI_Fns_struct ADIO_PVFS_operations; - -void ADIOI_PVFS_Open(ADIO_File fd, int *error_code); -void ADIOI_PVFS_Close(ADIO_File fd, int *error_code); -void ADIOI_PVFS_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_PVFS_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_PVFS_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_PVFS_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_PVFS_ReadDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -int ADIOI_PVFS_WriteDone(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int - *error_code); -void ADIOI_PVFS_WriteComplete(ADIO_Request *request, ADIO_Status *status, - int *error_code); -void ADIOI_PVFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int - *error_code); -void ADIOI_PVFS_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_PVFS_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_PVFS_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_PVFS_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_PVFS_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_PVFS_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_PVFS_Flush(ADIO_File fd, int *error_code); -void ADIOI_PVFS_Delete(char *filename, int *error_code); -void ADIOI_PVFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code); -ADIO_Offset ADIOI_PVFS_SeekIndividual(ADIO_File fd, ADIO_Offset offset, - int whence, int *error_code); -void ADIOI_PVFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code); -#endif - -#ifdef ROMIO_TESTFS -extern struct ADIOI_Fns_struct ADIO_TESTFS_operations; - -/* prototypes are in adio/ad_testfs/ad_testfs.h */ -#endif - -#endif +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + + +#ifndef ADIO_PROTO +#define ADIO_PROTO + +#ifdef ROMIO_NFS +extern struct ADIOI_Fns_struct ADIO_NFS_operations; +/* prototypes are in adio/ad_nfs/ad_nfs.h */ +#endif + +#ifdef ROMIO_PANFS +extern struct ADIOI_Fns_struct ADIO_PANFS_operations; +/* prototypes are in adio/ad_panfs/ad_panfs.h */ +#endif + +#ifdef ROMIO_PFS +extern struct ADIOI_Fns_struct ADIO_PFS_operations; +/* prototypes are in adio/ad_pfs/ad_pfs.h */ +#endif + +#ifdef ROMIO_PIOFS +extern struct ADIOI_Fns_struct ADIO_PIOFS_operations; +/* prototypes are in adio/ad_piofs/ad_piofs.h */ +#endif + +#ifdef ROMIO_UFS +extern struct ADIOI_Fns_struct ADIO_UFS_operations; +/* prototypes are in adio/ad_ufs/ad_ufs.h */ +#endif + +#ifdef ROMIO_HFS +extern struct ADIOI_Fns_struct ADIO_HFS_operations; +/* prototypes are in adio/ad_hfs/ad_hfs.h */ +#endif + +#ifdef ROMIO_XFS +extern struct ADIOI_Fns_struct ADIO_XFS_operations; +/* prototypes are in adio/ad_xfs/ad_xfs.h */ +#endif + +#ifdef ROMIO_SFS +extern struct ADIOI_Fns_struct ADIO_SFS_operations; +/* prototypes are in adio/ad_sfs/ad_sfs.h */ +#endif + +#ifdef ROMIO_LUSTRE +extern struct ADIOI_Fns_struct ADIO_LUSTRE_operations; +/* prototypes are in adio/ad_lustre/ad_lustre.h */ +#endif + +#ifdef ROMIO_NTFS +extern struct ADIOI_Fns_struct ADIO_NTFS_operations; +/* prototypes are in adio/ad_ntfs/ad_ntfs.h */ +#endif + +#ifdef ROMIO_PVFS +extern struct ADIOI_Fns_struct ADIO_PVFS_operations; +/* prototypes are in adio/ad_pvfs/ad_pvfs.h */ +#endif + +#ifdef ROMIO_PVFS2 +extern struct ADIOI_Fns_struct ADIO_PVFS2_operations; +/* prototypes are in adio/ad_pvfs2/ad_pvfs2.h */ +#endif + +#ifdef ROMIO_TESTFS +extern struct ADIOI_Fns_struct ADIO_TESTFS_operations; +/* prototypes are in adio/ad_testfs/ad_testfs.h */ +#endif + +#ifdef ROMIO_BGL +extern struct ADIOI_Fns_struct ADIO_BGL_operations; +/* prototypes are in adio/ad_bgl/ad_bgl.h */ +#endif + +#ifdef ROMIO_BGLOCKLESS +extern struct ADIOI_Fns_struct ADIO_BGLOCKLESS_operations; +/* no extra prototypes for this fs at this time */ +#endif + +#ifdef ROMIO_GRIDFTP +/* prototypes are in adio/ad_gridftp/ad_gridftp.h */ +extern struct ADIOI_Fns_struct ADIO_GRIDFTP_operations; +#endif + +#ifdef ROMIO_ZOIDFS +/* prototypes are in adio/ad_zoidfs/ad_zoidfs.h */ +extern struct ADIOI_Fns_struct ADIO_ZOIDFS_operations; +#endif + +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/include/heap-sort.h b/src/libs/ck-libs/ampi/romio/adio/include/heap-sort.h new file mode 100644 index 0000000000..903a1e8060 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/include/heap-sort.h @@ -0,0 +1,22 @@ +#include "adio.h" + +typedef struct { + ADIO_Offset offset; + int proc; + ADIO_Offset reg_max_len; +} heap_node_t; + +typedef struct { + heap_node_t *nodes; + int size; +} heap_t; + +/*static inline int parent(heap_t *heap, int i); +static inline int left(heap_t *heap, int i); +static inline int right(heap_t *heap, int i); */ +void ADIOI_Heap_free(heap_t *heap); +int ADIOI_Heap_create(heap_t *heap, int size); +void ADIOI_Heap_insert(heap_t *heap, ADIO_Offset offset, int proc, + ADIO_Offset reg_max_len); +void ADIOI_Heap_extract_min(heap_t *heap, ADIO_Offset* key, int *proc, + ADIO_Offset *reg_max_len); diff --git a/src/libs/ck-libs/ampi/romio/adio/include/mpio_error.h b/src/libs/ck-libs/ampi/romio/adio/include/mpio_error.h index 7f915c81c3..2a5e524cfa 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/mpio_error.h +++ b/src/libs/ck-libs/ampi/romio/adio/include/mpio_error.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* $Id$ - * +/* * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ @@ -54,6 +53,7 @@ #define MPIR_ERR_NO_XFS 17 #define MPIR_ERR_NO_SFS 19 #define MPIR_ERR_NO_PVFS 21 +#define MPIR_ERR_NO_PANFS 22 #define MPIR_ERR_MULTIPLE_SPLIT_COLL 23 #define MPIR_ERR_NO_SPLIT_COLL 25 #define MPIR_ERR_ASYNC_OUTSTANDING 27 @@ -62,6 +62,8 @@ #define MPIR_ERR_FILETYPE 33 #define MPIR_ERR_NO_NTFS 35 #define MPIR_ERR_NO_TESTFS 36 +#define MPIR_ERR_NO_LUSTRE 37 +#define MPIR_ERR_NO_BGL 38 /* MPI_ERR_COMM */ #ifndef MPIR_ERR_COMM_NULL diff --git a/src/libs/ck-libs/ampi/romio/adio/include/mpipr.h b/src/libs/ck-libs/ampi/romio/adio/include/mpipr.h index c5dadfe369..952bf89362 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/mpipr.h +++ b/src/libs/ck-libs/ampi/romio/adio/include/mpipr.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* $Id$ - * +/* * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ @@ -9,11 +8,7 @@ application code without interference from MPI functions used by MPI-IO. */ -/* AMPI has no PMPI support yet */ -#ifdef AMPI -#define USE_MPI_VERSIONS -#endif - +#if 0 #ifndef USE_MPI_VERSIONS #undef MPI_Abort @@ -30,6 +25,8 @@ #define MPI_Alltoall PMPI_Alltoall #undef MPI_Alltoallv #define MPI_Alltoallv PMPI_Alltoallv +#undef MPI_Alltoallw +#define MPI_Alltoallw PMPI_Alltoallw #undef MPI_Attr_delete #define MPI_Attr_delete PMPI_Attr_delete #undef MPI_Attr_get @@ -66,6 +63,8 @@ #define MPI_Cart_sub PMPI_Cart_sub #undef MPI_Cartdim_get #define MPI_Cartdim_get PMPI_Cartdim_get +#undef MPI_Comm_call_errhandler +#define MPI_Comm_call_errhandler PMPI_Comm_call_errhandler #undef MPI_Comm_compare #define MPI_Comm_compare PMPI_Comm_compare #undef MPI_Comm_create @@ -154,24 +153,6 @@ #define MPI_Group_union PMPI_Group_union #undef MPI_Ibsend #define MPI_Ibsend PMPI_Ibsend -#undef MPI_Info_create -#define MPI_Info_create PMPI_Info_create -#undef MPI_Info_delete -#define MPI_Info_delete PMPI_Info_delete -#undef MPI_Info_dup -#define MPI_Info_dup PMPI_Info_dup -#undef MPI_Info_free -#define MPI_Info_free PMPI_Info_free -#undef MPI_Info_get -#define MPI_Info_get PMPI_Info_get -#undef MPI_Info_get_nkeys -#define MPI_Info_get_nkeys PMPI_Info_get_nkeys -#undef MPI_Info_get_nthkey -#define MPI_Info_get_nthkey PMPI_Info_get_nthkey -#undef MPI_Info_get_valuelen -#define MPI_Info_get_valuelen PMPI_Info_get_valuelen -#undef MPI_Info_set -#define MPI_Info_set PMPI_Info_set #undef MPI_Init #define MPI_Init PMPI_Init #undef MPI_Initialized @@ -280,6 +261,8 @@ #define MPI_Type_get_contents PMPI_Type_get_contents #undef MPI_Type_get_envelope #define MPI_Type_get_envelope PMPI_Type_get_envelope +#undef MPI_Type_get_true_extent +#define MPI_Type_get_true_extent PMPI_Type_get_true_extent #undef MPI_Type_hindexed #define MPI_Type_hindexed PMPI_Type_hindexed #undef MPI_Type_hvector @@ -342,8 +325,10 @@ #undef MPI_Status_f2c #define MPI_Status_f2c PMPI_Status_f2c +#undef MPI_Status_set_elements +#define MPI_Status_set_elements PMPI_Status_set_elements -#ifndef MPI_INFO_SRC /* everywhere except in info source directory */ +#ifndef HAVE_MPI_INFO_SRC /* everywhere except in info source directory */ #undef MPI_Info_create #define MPI_Info_create PMPI_Info_create #undef MPI_Info_set @@ -368,6 +353,17 @@ #define MPI_Info_f2c PMPI_Info_f2c */ #endif +#undef MPI_Grequest_start +#define MPI_Grequest_start PMPI_Grequest_start +#undef MPI_Grequest_complete +#define MPI_Grequest_complete PMPI_Grequest_complete +#undef MPI_Status_set_cancelled +#define MPI_Status_set_cancelled PMPI_Status_set_cancelled + +#undef MPIX_Grequest_class_create +#define MPIX_Grequest_class_create PMPIX_Grequest_class_create +#undef MPIX_Grequest_class_allocate +#define MPIX_Grequest_class_allocate PMPIX_Grequest_class_allocate #ifdef MPIO_FORTRAN_SRC /* only in MPI-IO Fortran source directory */ #undef MPI_File_c2f @@ -376,4 +372,14 @@ #define MPI_File_f2c PMPI_File_f2c #endif +#undef MPI_Type_get_attr +#define MPI_Type_get_attr PMPI_Type_get_attr +#undef MPI_Type_set_attr +#define MPI_Type_set_attr PMPI_Type_set_attr +#undef MPI_Comm_set_attr +#define MPI_Comm_set_attr PMPI_Comm_set_attr +#undef MPI_Type_create_keyval +#define MPI_Type_create_keyval PMPI_Type_create_keyval + +#endif #endif diff --git a/src/libs/ck-libs/ampi/romio/adio/include/mpisgi2.h b/src/libs/ck-libs/ampi/romio/adio/include/mpisgi2.h deleted file mode 100644 index 45606dc030..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/include/mpisgi2.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (C) 1997, Silicon Graphics, Inc. - * All Rights Reserved - */ - -#if (!defined(HAVE_MPI_COMBINERS) && !defined(MPI_COMBINER_NAMED)) - -#define MPI_COMBINER_NAMED (-1) -#define MPI_COMBINER_CONTIGUOUS 0 -#define MPI_COMBINER_VECTOR 1 -#define MPI_COMBINER_HVECTOR 2 -#define MPI_COMBINER_INDEXED 3 -#define MPI_COMBINER_HINDEXED 4 -#define MPI_COMBINER_STRUCT 5 - -#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/include/mpiu_greq.h b/src/libs/ck-libs/ampi/romio/adio/include/mpiu_greq.h new file mode 100644 index 0000000000..d924e277a7 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/adio/include/mpiu_greq.h @@ -0,0 +1,15 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * (C) 2003 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#ifndef _MPIU_GREQUEST_H +#define _MPIU_GREQUEST_H + +int MPIU_Greq_query_fn(void *extra_state, MPI_Status *status); +int MPIU_Greq_free_fn(void *extra_state); +int MPIU_Greq_cancel_fn(void *extra_state, int complete); + +#endif diff --git a/src/libs/ck-libs/ampi/romio/adio/include/romioconf.h.in b/src/libs/ck-libs/ampi/romio/adio/include/romioconf.h.in dissimilarity index 70% index 5a666bf411..a594f4d0a2 100644 --- a/src/libs/ck-libs/ampi/romio/adio/include/romioconf.h.in +++ b/src/libs/ck-libs/ampi/romio/adio/include/romioconf.h.in @@ -1,84 +1,383 @@ -/* adio/include/romioconf.h.in. Generated automatically from .tmp by autoheader. */ - -/* Define if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -#undef _ALL_SOURCE -#endif - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -#undef CRAY_STACKSEG_END - -/* Define as the proper declaration for yytext. */ -#undef DECLARE_YYTEXT - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define if `sys_siglist' is declared by . */ -#undef SYS_SIGLIST_DECLARED - -#undef AIO_HANDLE_IN_AIOCB -#undef AIO_PRIORITY_DEFAULT -#undef AIO_SIGNOTIFY_NONE -#undef AIO_SUN -#undef FREEBSD -#undef HAVE_LONG_LONG_64 -#undef HAVE_MOUNT_NFS -#undef HAVE_MPI_COMBINERS -#undef HAVE_MPI_DARRAY_SUBARRAY -#undef HAVE_MPI_INFO -#undef HAVE_MPI_LONG_LONG_INT -#undef HAVE_PRAGMA_CRI_DUP -#undef HAVE_PRAGMA_HP_SEC_DEF -#undef HAVE_PRAGMA_WEAK -#undef HAVE_PREAD64 -#undef HAVE_STATUS_SET_BYTES -#undef HAVE_STRERROR -#undef HAVE_SYSERRLIST -#undef HAVE_WEAK_SYMBOLS -#undef HFS -#undef HPUX -#undef INT_LT_POINTER -#undef IRIX -#undef LINUX -#undef MPICH -#undef MPIHP -#undef MPILAM -#undef MPISGI -#undef MPI_OFFSET_IS_INT -#undef NEEDS_MPI_TEST -#undef NFS -#undef NO_AIO -#undef NO_FD_IN_AIOCB -#undef NO_MPI_SGI_type_is_contig -#undef PARAGON -#undef PFS -#undef PIOFS -#undef PRINT_ERR_MSG -#undef ROMIO_PVFS -#undef ROMIO_TESTFS -#undef SFS -#undef SOLARIS -#undef SPPUX -#undef SX4 -#undef UFS -#undef XFS -#undef NEEDS_AIOCB_T - -/* Define if you have memalign. */ -#undef HAVE_MEMALIGN - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the aio library (-laio). */ -#undef HAVE_LIBAIO - -/* Define if you have the pthread library (-lpthread). */ -#undef HAVE_LIBPTHREAD - -/* Define if you have the rt library (-lrt). */ -#undef HAVE_LIBRT +/* adio/include/romioconf.h.in. Generated from configure.in by autoheader. */ + +/* Define if no signotify */ +#undef AIO_SIGNOTIFY_NONE + +/* Define for AIX */ +#undef AIX + +/* Define if Cray */ +#undef CRAY + +/* Define if aio.h exists and can be compiled */ +#undef HAVE_AIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fsync' function. */ +#undef HAVE_FSYNC + +/* Define to 1 if you have the `ftruncate' function. */ +#undef HAVE_FTRUNCATE + +/* Define if GNU __attribute__ is supported */ +#undef HAVE_GCC_ATTRIBUTE + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if int smaller than pointer */ +#undef HAVE_INT_LT_POINTER + +/* Define to 1 if you have the `Kernel_GetMemorySize' function. */ +#undef HAVE_KERNEL_GETMEMORYSIZE + +/* Define if long long is 64 bits */ +#undef HAVE_LONG_LONG_64 + +/* Define to 1 if you have the `lseek64' function. */ +#undef HAVE_LSEEK64 + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + +/* Define to 1 if you have the header file. */ +#undef HAVE_LUSTRE_LUSTRE_USER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the `memalign' function. */ +#undef HAVE_MEMALIGN + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define if MPICH2 memory tracing macros defined */ +#undef HAVE_MPIU_FUNCS + +/* Define if MPI combiners available */ +#undef HAVE_MPI_COMBINERS + +/* Define if Darray is available */ +#undef HAVE_MPI_DARRAY_SUBARRAY + +/* Define if generalized requests avaliable */ +#undef HAVE_MPI_GREQUEST + +/* Define if MPI Info is available */ +#undef HAVE_MPI_INFO + +/* Define if supports long long int */ +#undef HAVE_MPI_LONG_LONG_INT + +/* Define for CRAY weak dup */ +// #undef HAVE_PRAGMA_CRI_DUP + +/* Define for HP weak pragma */ +// #undef HAVE_PRAGMA_HP_SEC_DEF + +/* Define if pragma weak available */ +// #undef HAVE_PRAGMA_WEAK + +/* Define if pread64 available */ +#undef HAVE_PREAD64 + +/* Define if PVFS_sys_create does not have layout parameter */ +#undef HAVE_PVFS2_CREATE_WITHOUT_LAYOUT + +/* Define to 1 if you have the header file. */ +#undef HAVE_PVFS2_H + +/* Define if PVFS2_SUPER_MAGIC defined. */ +#undef HAVE_PVFS2_SUPER_MAGIC + +/* Define to 1 if you have the header file. */ +#undef HAVE_PVFS_H + +/* Define if PVFS_SUPER_MAGIC defined. */ +#undef HAVE_PVFS_SUPER_MAGIC + +/* Define to 1 if you have the `readlink' function. */ +#undef HAVE_READLINK + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNAL_H + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_SPI_KERNEL_INTERFACE_H + +/* Define to 1 if you have the `stat' function. */ +#undef HAVE_STAT + +/* Define if status set bytes available */ +#undef HAVE_STATUS_SET_BYTES + +/* Define to 1 if you have the `statvfs' function. */ +#undef HAVE_STATVFS + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if struct statfs can be compiled */ +#undef HAVE_STRUCT_STATFS + +/* Define if sys/aio.h exists and can be compiled */ +#undef HAVE_SYS_AIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ATTR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STATVFS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_VFS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if weak symbols available */ +// #undef HAVE_WEAK_SYMBOLS + +/* Define to 1 if you have the header file. */ +#undef HAVE_ZOIDFS_H + +/* Define for HPUX */ +#undef HPUX + +/* Define if int smaller than pointer */ +#undef INT_LT_POINTER + +/* Define if IRIX */ +#undef IRIX + +/* Define if compiling within MPICH */ +#undef MPICH + +/* Define if using HP MPI */ +#undef MPIHP + +/* Define if compiling within LAM/MPI */ +#undef MPILAM + +/* Define if SGI MPI */ +#undef MPISGI + +/* Define if MPI_Offset is int */ +#undef MPI_OFFSET_IS_INT + +/* Define if fsync needs a declaration */ +#undef NEEDS_FSYNC_DECL + +/* Define if ftruncate needs a declaration */ +#undef NEEDS_FTRUNCATE_DECL + +/* Define if l_start and l_len data should be cast as int */ +#undef NEEDS_INT_CAST_WITH_FLOCK + +/* Define if lseek64 needs a declaration */ +#undef NEEDS_LSEEK64_DECL + +/* Define if lstat needs a declaration */ +#undef NEEDS_LSTAT_DECL + +/* Define if mpi_test needed */ +#undef NEEDS_MPI_TEST + +/* Define if readlink needs a declaration */ +#undef NEEDS_READLINK_DECL + +/* Define if snprintf needs a declaration */ +#undef NEEDS_SNPRINTF_DECL + +/* Define if strdup needs a declaration */ +#undef NEEDS_STRDUP_DECL + +/* Define if no MPI type is contig */ +#undef NO_MPI_SGI_type_is_contig + +/* Define to the address where bug reports for this package should be sent. */ +// #undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +// #undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +// #undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +// #undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +// #undef PACKAGE_VERSION + +/* Define for printing error messages */ +#undef PRINT_ERR_MSG + +/* Define for ROMIO with BGL */ +#undef ROMIO_BGL + +/* Define for lock-free ROMIO with BGL */ +#undef ROMIO_BGLOCKLESS + +/* Define for ROMIO with gridftp */ +#undef ROMIO_GRIDFTP + +/* Define if AIO calls need file descriptor */ +#undef ROMIO_HAVE_AIO_CALLS_NEED_FILEDES + +/* Define if aio_suspend needs two arguments */ +#undef ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS + +/* Define if aiocb has aio_fildes member */ +#undef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES + +/* Define if aiocb has aio_handle member */ +#undef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_HANDLE + +/* Define if aiocb has aio_reqprio member */ +#undef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_REQPRIO + +/* Define if aiocb has aio_sigevent member */ +#undef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_SIGEVENT + +/* Define if aiocb has aio_whence member */ +#undef ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_WHENCE + +/* Define if statfs has f_fstypename */ +#undef ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME + +/* defined if struct statvfs has a f_basetype member */ +#undef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE + +/* Define if struct stat has a st_fstype member */ +#undef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE + +/* Define if AIO calls seem to work */ +#undef ROMIO_HAVE_WORKING_AIO + +/* Define for ROMIO with HFS */ +#undef ROMIO_HFS + +/* Define if compiling within MPICH2 */ +#undef ROMIO_INSIDE_MPICH2 + +/* Define for ROMIO with LUSTRE */ +#undef ROMIO_LUSTRE + +/* Define for ROMIO with NFS */ +#undef ROMIO_NFS + +/* Define for ROMIO with PANFS */ +#undef ROMIO_PANFS + +/* Define for ROMIO with PFS */ +#undef ROMIO_PFS + +/* Define for ROMIO with PVFS */ +#undef ROMIO_PVFS + +/* Define for ROMIO with PVFS2 */ +#undef ROMIO_PVFS2 + +/* Define if int64_t must be defined for PVFS */ +#undef ROMIO_PVFS_NEEDS_INT64_DEFINITION + +/* Define for ROMIO with SFS */ +#undef ROMIO_SFS + +/* Define for ROMIO with TESTFS */ +#undef ROMIO_TESTFS + +/* Define for ROMIO with UFS */ +#undef ROMIO_UFS + +/* Define for ROMIO with XFS */ +#undef ROMIO_XFS + +/* Define for ROMIO with ZoidFD */ +#undef ROMIO_ZOIDFS + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + +/* Define for SPPUX (Convex) */ +#undef SPPUX + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define for NEC SX4 */ +#undef SX4 + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#undef restrict +/* Work around a bug in Sun C++: it does not support _Restrict, even + though the corresponding Sun C compiler does, which causes + "#define restrict _Restrict" in the previous line. Perhaps some future + version of Sun C++ will work with _Restrict; if so, it'll probably + define __RESTRICT, just as Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +#endif + +/* Define to "unsigned char" if sys/types.h does not define. */ +#undef u_char + +/* Define to "unsigned int" if sys/types.h does not define. */ +#undef u_int + +/* Define to "unsigned long" if sys/types.h does not define. */ +#undef u_long + +/* Define to "unsigned short" if sys/types.h does not define. */ +#undef u_short diff --git a/src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpi.h b/src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpi.h deleted file mode 100644 index cb2cd88a0e..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpi.h +++ /dev/null @@ -1,713 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* USMID @(#)mpi/include/mpi.h 31.4 10/07/97 18:14:32 */ - -/* - * Copyright (C) 1997, Silicon Graphics, Inc. - * All Rights Reserved - * - * Copyright Notice - * + 1993 University of Chicago - * + 1993 Mississippi State University - */ - -#ifndef MPI_H_INCLUDED -#define MPI_H_INCLUDED - -#if defined(__cplusplus) -extern "C" { -#endif - -#define MPI_VERSION 1 -#define MPI_SUBVERSION 2 - -#define MPI_BOTTOM ((MPI_Aint)0) - -typedef long MPI_Aint; -typedef unsigned int MPI_Request; -typedef unsigned int MPI_Group; -typedef unsigned int MPI_Comm; -typedef unsigned int MPI_Errhandler; -typedef unsigned int MPI_Op; -typedef unsigned int MPI_Datatype; - -typedef struct { - int MPI_SOURCE; - int MPI_TAG; - int MPI_ERROR; - int size; - int reserved[2]; -} MPI_Status; - -enum { - MPI_COMM_NULL = 0, - MPI_COMM_WORLD = 1, - MPI_COMM_SELF = 2 -}; - -enum { - MPI_ERRHANDLER_NULL = 0, - MPI_ERRORS_ARE_FATAL = 1, - MPI_ERRORS_RETURN = 2 -}; - -enum { - MPI_GROUP_NULL = 0, - MPI_GROUP_EMPTY = 1 -}; - -enum { - MPI_REQUEST_NULL = 0 -}; - -enum { - MPI_OP_NULL = 0, - MPI_MAX = 1, - MPI_MIN = 2, - MPI_SUM = 3, - MPI_PROD = 4, - MPI_LAND = 5, - MPI_BAND = 6, - MPI_LOR = 7, - MPI_BOR = 8, - MPI_LXOR = 9, - MPI_BXOR = 10, - MPI_MAXLOC = 11, - MPI_MINLOC = 12 -}; - -enum { - MPI_DATATYPE_NULL = 0, - - MPI_CHAR = 1, - MPI_SHORT = 2, - MPI_INT = 3, - MPI_LONG = 4, - MPI_UNSIGNED_CHAR = 5, - MPI_UNSIGNED_SHORT = 6, - MPI_UNSIGNED = 7, - MPI_UNSIGNED_LONG = 8, - MPI_FLOAT = 9, - MPI_DOUBLE = 10, - MPI_LONG_DOUBLE = 11, - MPI_LONG_LONG = 12, - - MPI_INTEGER = 13, - MPI_REAL = 14, - MPI_DOUBLE_PRECISION = 15, - MPI_COMPLEX = 16, - MPI_DOUBLE_COMPLEX = 17, - MPI_LOGICAL = 18, - MPI_CHARACTER = 19, - MPI_INTEGER1 = 20, - MPI_INTEGER2 = 21, - MPI_INTEGER4 = 22, - MPI_INTEGER8 = 23, - MPI_REAL4 = 24, - MPI_REAL8 = 25, - MPI_REAL16 = 26, - - MPI_BYTE = 27, - MPI_PACKED = 28, - MPI_UB = 29, - MPI_LB = 30, - - MPI_FLOAT_INT = 31, - MPI_DOUBLE_INT = 32, - MPI_LONG_INT = 33, - MPI_2INT = 34, - MPI_SHORT_INT = 35, - MPI_LONG_DOUBLE_INT = 36, - - MPI_2REAL = 37, - MPI_2DOUBLE_PRECISION = 38, - MPI_2INTEGER = 39 -}; - -#define MPI_LONG_LONG_INT MPI_LONG_LONG - -enum { - MPI_SUCCESS = 0, - MPI_ERR_BUFFER = 1, - MPI_ERR_COUNT = 2, - MPI_ERR_TYPE = 3, - MPI_ERR_TAG = 4, - MPI_ERR_COMM = 5, - MPI_ERR_RANK = 6, - MPI_ERR_REQUEST = 7, - MPI_ERR_ROOT = 8, - MPI_ERR_GROUP = 9, - MPI_ERR_OP = 10, - MPI_ERR_TOPOLOGY = 11, - MPI_ERR_DIMS = 12, - MPI_ERR_ARG = 13, - MPI_ERR_UNKNOWN = 14, - MPI_ERR_TRUNCATE = 15, - MPI_ERR_OTHER = 16, - MPI_ERR_INTERN = 17, - MPI_ERR_IN_STATUS = 18, - MPI_ERR_PENDING = 19, - MPI_ERR_LASTCODE = 31 -}; - -enum { - MPI_KEYVAL_INVALID = 0, - MPI_TAG_UB = 1, - MPI_HOST = 2, - MPI_IO = 3, - MPI_WTIME_IS_GLOBAL = 4 -}; - -enum { - MPI_IDENT = 0, - MPI_CONGRUENT = 1, - MPI_SIMILAR = 2, - MPI_UNEQUAL = 3 -}; - -enum { - MPI_GRAPH = 1, - MPI_CART = 2 -}; - -enum { - MPI_UNDEFINED = -3, - MPI_ANY_SOURCE = -2, - MPI_PROC_NULL = -1 -}; - -enum { - MPI_ANY_TAG = -1 -}; - -enum { - MPI_BSEND_OVERHEAD = 32 -}; - -enum { - MPI_MAX_PROCESSOR_NAME = 256 -}; - -enum { - MPI_MAX_ERROR_STRING = 256 -}; - -typedef int MPI_Copy_function(MPI_Comm, int, void *, void *, void *, int *); -typedef int MPI_Delete_function(MPI_Comm, int, void *, void *); -typedef void MPI_Handler_function(MPI_Comm *, int *, ...); -typedef void MPI_User_function(void *, void *, int *, MPI_Datatype *); - -MPI_Copy_function MPI_NULL_COPY_FN, MPI_DUP_FN; -MPI_Delete_function MPI_NULL_DELETE_FN; - - -/*************************************/ -/* MPI-1 bindings, sorted by chapter */ -/*************************************/ - - -/* 3.2 */ - -int MPI_Send(void *, int, MPI_Datatype, int, int, MPI_Comm); -int PMPI_Send(void *, int, MPI_Datatype, int, int, MPI_Comm); - -int MPI_Recv(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Status *); -int PMPI_Recv(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Status *); - -int MPI_Get_count(MPI_Status *, MPI_Datatype, int *); -int PMPI_Get_count(MPI_Status *, MPI_Datatype, int *); - -/* 3.4 */ - -int MPI_Bsend(void *, int, MPI_Datatype, int, int, MPI_Comm); -int PMPI_Bsend(void *, int, MPI_Datatype, int, int, MPI_Comm); - -int MPI_Ssend(void *, int, MPI_Datatype, int, int, MPI_Comm); -int PMPI_Ssend(void *, int, MPI_Datatype, int, int, MPI_Comm); - -int MPI_Rsend(void *, int, MPI_Datatype, int, int, MPI_Comm); -int PMPI_Rsend(void *, int, MPI_Datatype, int, int, MPI_Comm); - -/* 3.6 */ - -int MPI_Buffer_attach(void *, int); -int PMPI_Buffer_attach(void *, int); - -int MPI_Buffer_detach(void *, int *); -int PMPI_Buffer_detach(void *, int *); - -/* 3.7 */ - -int MPI_Isend(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Isend(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Ibsend(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Ibsend(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Issend(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Issend(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Irsend(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Irsend(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Irecv(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Irecv(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Wait(MPI_Request *, MPI_Status *); -int PMPI_Wait(MPI_Request *, MPI_Status *); - -int MPI_Test(MPI_Request *, int *, MPI_Status *); -int PMPI_Test(MPI_Request *, int *, MPI_Status *); - -int MPI_Request_free(MPI_Request *); -int PMPI_Request_free(MPI_Request *); - -int MPI_Waitany(int, MPI_Request *, int *, MPI_Status *); -int PMPI_Waitany(int, MPI_Request *, int *, MPI_Status *); - -int MPI_Testany(int, MPI_Request *, int *, int *, MPI_Status *); -int PMPI_Testany(int, MPI_Request *, int *, int *, MPI_Status *); - -int MPI_Waitall(int, MPI_Request *, MPI_Status *); -int PMPI_Waitall(int, MPI_Request *, MPI_Status *); - -int MPI_Testall(int, MPI_Request *, int *, MPI_Status *); -int PMPI_Testall(int, MPI_Request *, int *, MPI_Status *); - -int MPI_Waitsome(int, MPI_Request *, int *, int *, MPI_Status *); -int PMPI_Waitsome(int, MPI_Request *, int *, int *, MPI_Status *); - -int MPI_Testsome(int, MPI_Request *, int *, int *, MPI_Status *); -int PMPI_Testsome(int, MPI_Request *, int *, int *, MPI_Status *); - -/* 3.8 */ - -int MPI_Iprobe(int, int, MPI_Comm, int *, MPI_Status *); -int PMPI_Iprobe(int, int, MPI_Comm, int *, MPI_Status *); - -int MPI_Probe(int, int, MPI_Comm, MPI_Status *); -int PMPI_Probe(int, int, MPI_Comm, MPI_Status *); - -int MPI_Cancel(MPI_Request *); -int PMPI_Cancel(MPI_Request *); - -int MPI_Test_cancelled(MPI_Status *, int *); -int PMPI_Test_cancelled(MPI_Status *, int *); - -/* 3.9 */ - -int MPI_Send_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Send_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Bsend_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Bsend_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Ssend_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Ssend_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Rsend_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Rsend_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Recv_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); -int PMPI_Recv_init(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); - -int MPI_Start(MPI_Request *); -int PMPI_Start(MPI_Request *); - -int MPI_Startall(int, MPI_Request *); -int PMPI_Startall(int, MPI_Request *); - -/* 3.10 */ - -int MPI_Sendrecv(void *, int, MPI_Datatype, int, int, void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Status *); -int PMPI_Sendrecv(void *, int, MPI_Datatype, int, int, void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Status *); - -int MPI_Sendrecv_replace(void *, int, MPI_Datatype, int, int, int, int, MPI_Comm, MPI_Status *); -int PMPI_Sendrecv_replace(void *, int, MPI_Datatype, int, int, int, int, MPI_Comm, MPI_Status *); - -/* 3.12 */ - -int MPI_Type_contiguous(int, MPI_Datatype, MPI_Datatype *); -int PMPI_Type_contiguous(int, MPI_Datatype, MPI_Datatype *); - -int MPI_Type_vector(int, int, int, MPI_Datatype, MPI_Datatype *); -int PMPI_Type_vector(int, int, int, MPI_Datatype, MPI_Datatype *); - -int MPI_Type_hvector(int, int, MPI_Aint, MPI_Datatype, MPI_Datatype *); -int PMPI_Type_hvector(int, int, MPI_Aint, MPI_Datatype, MPI_Datatype *); - -int MPI_Type_indexed(int, int *, int *, MPI_Datatype, MPI_Datatype *); -int PMPI_Type_indexed(int, int *, int *, MPI_Datatype, MPI_Datatype *); - -int MPI_Type_hindexed(int, int *, MPI_Aint *, MPI_Datatype, MPI_Datatype *); -int PMPI_Type_hindexed(int, int *, MPI_Aint *, MPI_Datatype, MPI_Datatype *); - -int MPI_Type_struct(int, int *, MPI_Aint *, MPI_Datatype *, MPI_Datatype *); -int PMPI_Type_struct(int, int *, MPI_Aint *, MPI_Datatype *, MPI_Datatype *); - -int MPI_Address(void *, MPI_Aint *); -int PMPI_Address(void *, MPI_Aint *); - -int MPI_Type_extent(MPI_Datatype, MPI_Aint *); -int PMPI_Type_extent(MPI_Datatype, MPI_Aint *); - -int MPI_Type_size(MPI_Datatype, int *); -int PMPI_Type_size(MPI_Datatype, int *); - -int MPI_Type_lb(MPI_Datatype, MPI_Aint *); -int PMPI_Type_lb(MPI_Datatype, MPI_Aint *); - -int MPI_Type_ub(MPI_Datatype, MPI_Aint *); -int PMPI_Type_ub(MPI_Datatype, MPI_Aint *); - -int MPI_Type_commit(MPI_Datatype *); -int PMPI_Type_commit(MPI_Datatype *); - -int MPI_Type_free(MPI_Datatype *); -int PMPI_Type_free(MPI_Datatype *); - -int MPI_Get_elements(MPI_Status *, MPI_Datatype, int *); -int PMPI_Get_elements(MPI_Status *, MPI_Datatype, int *); - -/* 3.13 */ - -int MPI_Pack(void *, int, MPI_Datatype, void *, int, int *, MPI_Comm); -int PMPI_Pack(void *, int, MPI_Datatype, void *, int, int *, MPI_Comm); - -int MPI_Unpack(void *, int, int *, void *, int, MPI_Datatype, MPI_Comm); -int PMPI_Unpack(void *, int, int *, void *, int, MPI_Datatype, MPI_Comm); - -int MPI_Pack_size(int, MPI_Datatype, MPI_Comm, int *); -int PMPI_Pack_size(int, MPI_Datatype, MPI_Comm, int *); - -/* 4.3 */ - -int MPI_Barrier(MPI_Comm); -int PMPI_Barrier(MPI_Comm); - -/* 4.4 */ - -int MPI_Bcast(void *, int, MPI_Datatype, int, MPI_Comm); -int PMPI_Bcast(void *, int, MPI_Datatype, int, MPI_Comm); - -/* 4.5 */ - -int MPI_Gather(void *, int, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm); -int PMPI_Gather(void *, int, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm); - -int MPI_Gatherv(void *, int, MPI_Datatype, void *, int *, int *, MPI_Datatype, int, MPI_Comm); -int PMPI_Gatherv(void *, int, MPI_Datatype, void *, int *, int *, MPI_Datatype, int, MPI_Comm); - -/* 4.6 */ - -int MPI_Scatter(void *, int, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm); -int PMPI_Scatter(void *, int, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm); - -int MPI_Scatterv(void *, int *, int *, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm); -int PMPI_Scatterv(void *, int *, int *, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm); - -/* 4.7 */ - -int MPI_Allgather(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm); -int PMPI_Allgather(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm); - -int MPI_Allgatherv(void *, int, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm); -int PMPI_Allgatherv(void *, int, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm); - -/* 4.8 */ - -int MPI_Alltoall(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm); -int PMPI_Alltoall(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm); - -int MPI_Alltoallv(void *, int *, int *, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm); -int PMPI_Alltoallv(void *, int *, int *, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm); - -/* 4.9 */ - -int MPI_Reduce(void *, void *, int, MPI_Datatype, MPI_Op, int, MPI_Comm); -int PMPI_Reduce(void *, void *, int, MPI_Datatype, MPI_Op, int, MPI_Comm); - -int MPI_Op_create(MPI_User_function *, int, MPI_Op *); -int PMPI_Op_create(MPI_User_function *, int, MPI_Op *); - -int MPI_Op_free(MPI_Op *); -int PMPI_Op_free(MPI_Op *); - -int MPI_Allreduce(void *, void *, int, MPI_Datatype, MPI_Op, MPI_Comm); -int PMPI_Allreduce(void *, void *, int, MPI_Datatype, MPI_Op, MPI_Comm); - -/* 4.10 */ - -int MPI_Reduce_scatter(void *, void *, int *, MPI_Datatype, MPI_Op, MPI_Comm); -int PMPI_Reduce_scatter(void *, void *, int *, MPI_Datatype, MPI_Op, MPI_Comm); - -/* 4.11 */ - -int MPI_Scan(void *, void *, int, MPI_Datatype, MPI_Op, MPI_Comm); -int PMPI_Scan(void *, void *, int, MPI_Datatype, MPI_Op, MPI_Comm); - -/* 5.3 */ - -int MPI_Group_size(MPI_Group, int *); -int PMPI_Group_size(MPI_Group, int *); - -int MPI_Group_rank(MPI_Group, int *); -int PMPI_Group_rank(MPI_Group, int *); - -int MPI_Group_translate_ranks(MPI_Group, int, int *, MPI_Group, int *); -int PMPI_Group_translate_ranks(MPI_Group, int, int *, MPI_Group, int *); - -int MPI_Group_compare(MPI_Group, MPI_Group, int *); -int PMPI_Group_compare(MPI_Group, MPI_Group, int *); - -int MPI_Comm_group(MPI_Comm, MPI_Group *); -int PMPI_Comm_group(MPI_Comm, MPI_Group *); - -int MPI_Group_union(MPI_Group, MPI_Group, MPI_Group *); -int PMPI_Group_union(MPI_Group, MPI_Group, MPI_Group *); - -int MPI_Group_intersection(MPI_Group, MPI_Group, MPI_Group *); -int PMPI_Group_intersection(MPI_Group, MPI_Group, MPI_Group *); - -int MPI_Group_difference(MPI_Group, MPI_Group, MPI_Group *); -int PMPI_Group_difference(MPI_Group, MPI_Group, MPI_Group *); - -int MPI_Group_incl(MPI_Group, int, int *, MPI_Group *); -int PMPI_Group_incl(MPI_Group, int, int *, MPI_Group *); - -int MPI_Group_excl(MPI_Group, int, int *, MPI_Group *); -int PMPI_Group_excl(MPI_Group, int, int *, MPI_Group *); - -int MPI_Group_range_incl(MPI_Group, int, int [][3], MPI_Group *); -int PMPI_Group_range_incl(MPI_Group, int, int [][3], MPI_Group *); - -int MPI_Group_range_excl(MPI_Group, int, int [][3], MPI_Group *); -int PMPI_Group_range_excl(MPI_Group, int, int [][3], MPI_Group *); - -int MPI_Group_free(MPI_Group *); -int PMPI_Group_free(MPI_Group *); - -/* 5.4 */ - -int MPI_Comm_size(MPI_Comm, int *); -int PMPI_Comm_size(MPI_Comm, int *); - -int MPI_Comm_rank(MPI_Comm, int *); -int PMPI_Comm_rank(MPI_Comm, int *); - -int MPI_Comm_compare(MPI_Comm, MPI_Comm, int *); -int PMPI_Comm_compare(MPI_Comm, MPI_Comm, int *); - -int MPI_Comm_dup(MPI_Comm, MPI_Comm *); -int PMPI_Comm_dup(MPI_Comm, MPI_Comm *); - -int MPI_Comm_create(MPI_Comm, MPI_Group, MPI_Comm *); -int PMPI_Comm_create(MPI_Comm, MPI_Group, MPI_Comm *); - -int MPI_Comm_split(MPI_Comm, int, int, MPI_Comm *); -int PMPI_Comm_split(MPI_Comm, int, int, MPI_Comm *); - -int MPI_Comm_free(MPI_Comm *); -int PMPI_Comm_free(MPI_Comm *); - -/* 5.6 */ - -int MPI_Comm_test_inter(MPI_Comm, int *); -int PMPI_Comm_test_inter(MPI_Comm, int *); - -int MPI_Comm_remote_size(MPI_Comm, int *); -int PMPI_Comm_remote_size(MPI_Comm, int *); - -int MPI_Comm_remote_group(MPI_Comm, MPI_Group *); -int PMPI_Comm_remote_group(MPI_Comm, MPI_Group *); - -int MPI_Intercomm_create(MPI_Comm, int, MPI_Comm, int, int, MPI_Comm *); -int PMPI_Intercomm_create(MPI_Comm, int, MPI_Comm, int, int, MPI_Comm *); - -int MPI_Intercomm_merge(MPI_Comm, int, MPI_Comm *); -int PMPI_Intercomm_merge(MPI_Comm, int, MPI_Comm *); - -/* 5.7 */ - -int MPI_Keyval_create(MPI_Copy_function *, MPI_Delete_function *, int *, void *); -int PMPI_Keyval_create(MPI_Copy_function *, MPI_Delete_function *, int *, void *); - -int MPI_Keyval_free(int *); -int PMPI_Keyval_free(int *); - -int MPI_Attr_put(MPI_Comm, int, void *); -int PMPI_Attr_put(MPI_Comm, int, void *); - -int MPI_Attr_get(MPI_Comm, int, void *, int *); -int PMPI_Attr_get(MPI_Comm, int, void *, int *); - -int MPI_Attr_delete(MPI_Comm, int); -int PMPI_Attr_delete(MPI_Comm, int); - -/* 6.5 */ - -int MPI_Cart_create(MPI_Comm, int, int *, int *, int, MPI_Comm *); -int PMPI_Cart_create(MPI_Comm, int, int *, int *, int, MPI_Comm *); - -int MPI_Dims_create(int, int, int *); -int PMPI_Dims_create(int, int, int *); - -int MPI_Graph_create(MPI_Comm, int, int *, int *, int, MPI_Comm *); -int PMPI_Graph_create(MPI_Comm, int, int *, int *, int, MPI_Comm *); - -int MPI_Topo_test(MPI_Comm, int *); -int PMPI_Topo_test(MPI_Comm, int *); - -int MPI_Graphdims_get(MPI_Comm, int *, int *); -int PMPI_Graphdims_get(MPI_Comm, int *, int *); - -int MPI_Graph_get(MPI_Comm, int, int, int *, int *); -int PMPI_Graph_get(MPI_Comm, int, int, int *, int *); - -int MPI_Cartdim_get(MPI_Comm, int *); -int PMPI_Cartdim_get(MPI_Comm, int *); - -int MPI_Cart_get(MPI_Comm, int, int *, int *, int *); -int PMPI_Cart_get(MPI_Comm, int, int *, int *, int *); - -int MPI_Cart_rank(MPI_Comm, int *, int *); -int PMPI_Cart_rank(MPI_Comm, int *, int *); - -int MPI_Cart_coords(MPI_Comm, int, int, int *); -int PMPI_Cart_coords(MPI_Comm, int, int, int *); - -int MPI_Graph_neighbors_count(MPI_Comm, int, int *); -int PMPI_Graph_neighbors_count(MPI_Comm, int, int *); - -int MPI_Graph_neighbors(MPI_Comm, int, int, int *); -int PMPI_Graph_neighbors(MPI_Comm, int, int, int *); - -int MPI_Cart_shift(MPI_Comm, int, int, int *, int *); -int PMPI_Cart_shift(MPI_Comm, int, int, int *, int *); - -int MPI_Cart_sub(MPI_Comm, int *, MPI_Comm *); -int PMPI_Cart_sub(MPI_Comm, int *, MPI_Comm *); - -int MPI_Cart_map(MPI_Comm, int, int *, int *, int *); -int PMPI_Cart_map(MPI_Comm, int, int *, int *, int *); - -int MPI_Graph_map(MPI_Comm, int, int *, int *, int *); -int PMPI_Graph_map(MPI_Comm, int, int *, int *, int *); - -/* 7.1 */ - -int MPI_Get_processor_name(char *, int *); -int PMPI_Get_processor_name(char *, int *); - -/* 7.2 */ - -int MPI_Errhandler_create(MPI_Handler_function *, MPI_Errhandler *); -int PMPI_Errhandler_create(MPI_Handler_function *, MPI_Errhandler *); - -int MPI_Errhandler_set(MPI_Comm, MPI_Errhandler); -int PMPI_Errhandler_set(MPI_Comm, MPI_Errhandler); - -int MPI_Errhandler_get(MPI_Comm, MPI_Errhandler *); -int PMPI_Errhandler_get(MPI_Comm, MPI_Errhandler *); - -int MPI_Errhandler_free(MPI_Errhandler *); -int PMPI_Errhandler_free(MPI_Errhandler *); - -int MPI_Error_string(int, char *, int *); -int PMPI_Error_string(int, char *, int *); - -/* 7.3 */ - -int MPI_Error_class(int, int *); -int PMPI_Error_class(int, int *); - -/* 7.4 */ - -double MPI_Wtime(void); -double PMPI_Wtime(void); - -double MPI_Wtick(void); -double PMPI_Wtick(void); - -/* 7.5 */ - -int MPI_Init(int *, char ***); -int PMPI_Init(int *, char ***); - -int MPI_Finalize(void); -int PMPI_Finalize(void); - -int MPI_Initialized(int *); -int PMPI_Initialized(int *); - -int MPI_Abort(MPI_Comm, int); -int PMPI_Abort(MPI_Comm, int); - -/* 8.3 */ - -int MPI_Pcontrol(int, ...); -int PMPI_Pcontrol(int, ...); - -/* MPI-1.2 */ - -int MPI_Get_version(int *, int *); -int PMPI_Get_version(int *, int *); - - -/*************************************/ -/* MPI-2 bindings, sorted by chapter */ -/*************************************/ - -/* some things commented out because they conflict with ROMIO */ - -/* typedef unsigned int MPI_Info; - -enum { - MPI_INFO_NULL = 0 -};*/ - -enum { - MPI_FUNDAMENTAL = -1 -}; - -/* added these combiners for ROMIO */ - -#define MPI_COMBINER_NAMED (-1) -#define MPI_COMBINER_CONTIGUOUS 0 -#define MPI_COMBINER_VECTOR 1 -#define MPI_COMBINER_HVECTOR 2 -#define MPI_COMBINER_INDEXED 3 -#define MPI_COMBINER_HINDEXED 4 -#define MPI_COMBINER_STRUCT 5 - - -/* 5.2 */ - -/* int MPI_Alloc_mem(MPI_Aint, MPI_Info, void *); -int PMPI_Alloc_mem(MPI_Aint, MPI_Info, void *); */ - -int MPI_Free_mem(void *); -int PMPI_Free_mem(void *); - -/* 7.5 */ - -int MPI_Type_get_envelope(MPI_Datatype, int *, int *, int *, int *); -int PMPI_Type_get_envelope(MPI_Datatype, int *, int *, int *, int *); - -int MPI_Type_get_contents(MPI_Datatype, int, int, int, int *, MPI_Aint *, MPI_Datatype *); -int PMPI_Type_get_contents(MPI_Datatype, int, int, int, int *, MPI_Aint *, MPI_Datatype *); - -/* 7.8 */ - -int MPI_Type_dup(MPI_Datatype, MPI_Datatype *); -int PMPI_Type_dup(MPI_Datatype, MPI_Datatype *); - -/* 9.6 */ - -int MPI_Finalized(int *); -int PMPI_Finalized(int *); - -#if defined(__cplusplus) -} -#endif - -#endif /* MPI_H_INCLUDED */ diff --git a/src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpif.h b/src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpif.h deleted file mode 100644 index df9bb0094e..0000000000 --- a/src/libs/ck-libs/ampi/romio/adio/sgi/mpi3.1/mpif.h +++ /dev/null @@ -1,308 +0,0 @@ -!DIR$ ID "@(#)mpi/include/mpif.h 31.2 09/12/97 11:38:27" - -! Copyright (C) 1997, Silicon Graphics, Inc. -! All Rights Reserved -! -! Copyright Notice -! + 1993 University of Chicago -! + 1993 Mississippi State University - - integer MPI_VERSION - integer MPI_SUBVERSION - - parameter (MPI_VERSION = 1) - parameter (MPI_SUBVERSION = 2) - -! MPI_Status - - integer MPI_SOURCE - integer MPI_TAG - integer MPI_ERROR - integer MPI_STATUS_SIZE - - parameter (MPI_SOURCE = 1) - parameter (MPI_TAG = 2) - parameter (MPI_ERROR = 3) - parameter (MPI_STATUS_SIZE = 6) - -! MPI_Comm - - integer MPI_COMM_NULL - integer MPI_COMM_WORLD - integer MPI_COMM_SELF - - parameter (MPI_COMM_NULL = 0) - parameter (MPI_COMM_WORLD = 1) - parameter (MPI_COMM_SELF = 2) - -! MPI_Errhandler - - integer MPI_ERRHANDLER_NULL - integer MPI_ERRORS_ARE_FATAL - integer MPI_ERRORS_RETURN - - parameter (MPI_ERRHANDLER_NULL = 0) - parameter (MPI_ERRORS_ARE_FATAL = 1) - parameter (MPI_ERRORS_RETURN = 2) - -! MPI_Group - - integer MPI_GROUP_NULL - integer MPI_GROUP_EMPTY - - parameter (MPI_GROUP_NULL = 0) - parameter (MPI_GROUP_EMPTY = 1) - -! MPI_Request - - integer MPI_REQUEST_NULL - - parameter (MPI_REQUEST_NULL = 0) - -! MPI_Op - - integer MPI_OP_NULL - integer MPI_MAX - integer MPI_MIN - integer MPI_SUM - integer MPI_PROD - integer MPI_LAND - integer MPI_BAND - integer MPI_LOR - integer MPI_BOR - integer MPI_LXOR - integer MPI_BXOR - integer MPI_MAXLOC - integer MPI_MINLOC - - parameter (MPI_OP_NULL = 0) - parameter (MPI_MAX = 1) - parameter (MPI_MIN = 2) - parameter (MPI_SUM = 3) - parameter (MPI_PROD = 4) - parameter (MPI_LAND = 5) - parameter (MPI_BAND = 6) - parameter (MPI_LOR = 7) - parameter (MPI_BOR = 8) - parameter (MPI_LXOR = 9) - parameter (MPI_BXOR = 10) - parameter (MPI_MAXLOC = 11) - parameter (MPI_MINLOC = 12) - -! MPI_Datatype - - integer MPI_DATATYPE_NULL - - integer MPI_CHAR - integer MPI_SHORT - integer MPI_INT - integer MPI_LONG - integer MPI_UNSIGNED_CHAR - integer MPI_UNSIGNED_SHORT - integer MPI_UNSIGNED - integer MPI_UNSIGNED_LONG - integer MPI_FLOAT - integer MPI_DOUBLE - integer MPI_LONG_DOUBLE - integer MPI_LONG_LONG - integer MPI_LONG_LONG_INT - - integer MPI_INTEGER - integer MPI_REAL - integer MPI_DOUBLE_PRECISION - integer MPI_COMPLEX - integer MPI_DOUBLE_COMPLEX - integer MPI_LOGICAL - integer MPI_CHARACTER - integer MPI_INTEGER1 - integer MPI_INTEGER2 - integer MPI_INTEGER4 - integer MPI_INTEGER8 - integer MPI_REAL4 - integer MPI_REAL8 - integer MPI_REAL16 - - integer MPI_BYTE - integer MPI_PACKED - integer MPI_UB - integer MPI_LB - - integer MPI_FLOAT_INT - integer MPI_DOUBLE_INT - integer MPI_LONG_INT - integer MPI_2INT - integer MPI_SHORT_INT - integer MPI_LONG_DOUBLE_INT - - integer MPI_2REAL - integer MPI_2DOUBLE_PRECISION - integer MPI_2INTEGER - - parameter (MPI_DATATYPE_NULL = 0) - - parameter (MPI_CHAR = 1) - parameter (MPI_SHORT = 2) - parameter (MPI_INT = 3) - parameter (MPI_LONG = 4) - parameter (MPI_UNSIGNED_CHAR = 5) - parameter (MPI_UNSIGNED_SHORT = 6) - parameter (MPI_UNSIGNED = 7) - parameter (MPI_UNSIGNED_LONG = 8) - parameter (MPI_FLOAT = 9) - parameter (MPI_DOUBLE = 10) - parameter (MPI_LONG_DOUBLE = 11) - parameter (MPI_LONG_LONG = 12) - parameter (MPI_LONG_LONG_INT = 12) - - parameter (MPI_INTEGER = 13) - parameter (MPI_REAL = 14) - parameter (MPI_DOUBLE_PRECISION = 15) - parameter (MPI_COMPLEX = 16) - parameter (MPI_DOUBLE_COMPLEX = 17) - parameter (MPI_LOGICAL = 18) - parameter (MPI_CHARACTER = 19) - parameter (MPI_INTEGER1 = 20) - parameter (MPI_INTEGER2 = 21) - parameter (MPI_INTEGER4 = 22) - parameter (MPI_INTEGER8 = 23) - parameter (MPI_REAL4 = 24) - parameter (MPI_REAL8 = 25) - parameter (MPI_REAL16 = 26) - - parameter (MPI_BYTE = 27) - parameter (MPI_PACKED = 28) - parameter (MPI_UB = 29) - parameter (MPI_LB = 30) - - parameter (MPI_FLOAT_INT = 31) - parameter (MPI_DOUBLE_INT = 32) - parameter (MPI_LONG_INT = 33) - parameter (MPI_2INT = 34) - parameter (MPI_SHORT_INT = 35) - parameter (MPI_LONG_DOUBLE_INT = 36) - - parameter (MPI_2REAL = 37) - parameter (MPI_2DOUBLE_PRECISION= 38) - parameter (MPI_2INTEGER = 39) - -! Error codes and classes - - integer MPI_SUCCESS - integer MPI_ERR_BUFFER - integer MPI_ERR_COUNT - integer MPI_ERR_TYPE - integer MPI_ERR_TAG - integer MPI_ERR_COMM - integer MPI_ERR_RANK - integer MPI_ERR_REQUEST - integer MPI_ERR_ROOT - integer MPI_ERR_GROUP - integer MPI_ERR_OP - integer MPI_ERR_TOPOLOGY - integer MPI_ERR_DIMS - integer MPI_ERR_ARG - integer MPI_ERR_UNKNOWN - integer MPI_ERR_TRUNCATE - integer MPI_ERR_OTHER - integer MPI_ERR_INTERN - integer MPI_ERR_IN_STATUS - integer MPI_ERR_PENDING - integer MPI_ERR_LASTCODE - - parameter (MPI_SUCCESS = 0) - parameter (MPI_ERR_BUFFER = 1) - parameter (MPI_ERR_COUNT = 2) - parameter (MPI_ERR_TYPE = 3) - parameter (MPI_ERR_TAG = 4) - parameter (MPI_ERR_COMM = 5) - parameter (MPI_ERR_RANK = 6) - parameter (MPI_ERR_REQUEST = 7) - parameter (MPI_ERR_ROOT = 8) - parameter (MPI_ERR_GROUP = 9) - parameter (MPI_ERR_OP = 10) - parameter (MPI_ERR_TOPOLOGY = 11) - parameter (MPI_ERR_DIMS = 12) - parameter (MPI_ERR_ARG = 13) - parameter (MPI_ERR_UNKNOWN = 14) - parameter (MPI_ERR_TRUNCATE = 15) - parameter (MPI_ERR_OTHER = 16) - parameter (MPI_ERR_INTERN = 17) - parameter (MPI_ERR_IN_STATUS = 18) - parameter (MPI_ERR_PENDING = 19) - parameter (MPI_ERR_LASTCODE = 31) - -! Permanent keyvals - - integer MPI_KEYVAL_INVALID - integer MPI_TAG_UB - integer MPI_HOST - integer MPI_IO - integer MPI_WTIME_IS_GLOBAL - - parameter (MPI_KEYVAL_INVALID = 0) - parameter (MPI_TAG_UB = 5) - parameter (MPI_HOST = 6) - parameter (MPI_IO = 7) - parameter (MPI_WTIME_IS_GLOBAL = 8) - -! Results of the compare operations - - integer MPI_IDENT - integer MPI_CONGRUENT - integer MPI_SIMILAR - integer MPI_UNEQUAL - - parameter (MPI_IDENT = 0) - parameter (MPI_CONGRUENT = 1) - parameter (MPI_SIMILAR = 2) - parameter (MPI_UNEQUAL = 3) - -! Topology types - - integer MPI_GRAPH - integer MPI_CART - - parameter (MPI_GRAPH = 1) - parameter (MPI_CART = 2) - -! Misc constants - - integer MPI_MAX_PROCESSOR_NAME - parameter (MPI_MAX_PROCESSOR_NAME = 256) - - integer MPI_MAX_ERROR_STRING - parameter (MPI_MAX_ERROR_STRING = 256) - - integer MPI_BSEND_OVERHEAD - parameter (MPI_BSEND_OVERHEAD = 32) - - integer MPI_UNDEFINED - parameter (MPI_UNDEFINED = -3) - - integer MPI_ANY_SOURCE - parameter (MPI_ANY_SOURCE = -2) - - integer MPI_PROC_NULL - parameter (MPI_PROC_NULL = -1) - - integer MPI_ANY_TAG - parameter (MPI_ANY_TAG = -1) - -! Misc Fortran declarations - - integer MPI_BOTTOM - pointer (MPI_BOTTOM_PTR, MPI_BOTTOM) - data MPI_BOTTOM_PTR / 0 / - - external MPI_NULL_COPY_FN, MPI_NULL_DELETE_FN, MPI_DUP_FN - - double precision MPI_WTIME, MPI_WTICK - external MPI_WTIME, MPI_WTICK - -! MPI-2 - -! integer MPI_INFO_NULL -! parameter (MPI_INFO_NULL = 0) - - integer MPI_FUNDAMENTAL - parameter (MPI_FUNDAMENTAL = -1) diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/.state-cache b/src/libs/ck-libs/ampi/romio/common/dataloop/.state-cache new file mode 100644 index 0000000000..941361c4de --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/.state-cache @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/Makefile.in b/src/libs/ck-libs/ampi/romio/common/dataloop/Makefile.in new file mode 100644 index 0000000000..0746bac2e5 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/Makefile.in @@ -0,0 +1,121 @@ +CC = @CC@ +AR = @AR@ +LIBNAME = @LIBNAME@ +RANLIB = @RANLIB@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +# QUIET_COMPILE = 1 +# ifdef V +# QUIET_COMPILE = 0 +# endif +# +# ifeq ($(QUIET_COMPILE),1) +# # say a one-line description of the action, do not echo the command +# Q=@echo +# E=@ +# else +# # do not say the short Q lines, but do echo the entire command +# Q=@echo >/dev/null +# E= +# endif +Q=@echo +E=@ + +INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../include -I${srcdir}/../../mpi-io \ + -I${srcdir}/../../adio/include -I../../adio/include \ + -I${srcdir}/../../../../../src/include \ + -I../../../../../src/include + +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) + +LIBTOOL = @LIBTOOL@ +C_COMPILE_SHL = $(CC_SHL) + +@VPATH@ + +DLOOP_OBJECTS = darray_support.o dataloop.o \ + dataloop_create.o dataloop_create_blockindexed.o \ + dataloop_create_contig.o dataloop_create_indexed.o \ + dataloop_create_pairtype.o dataloop_create_struct.o \ + dataloop_create_vector.o romio_dataloop.o segment.o \ + subarray_support.o typesize_support.o segment_ops.o \ + romio_segment_ops.o + +DLOOP_RENAMED_OBJECTS = R_darray_support.o \ + R_dataloop.o R_dataloop_create.o \ + R_dataloop_create_blockindexed.o \ + R_dataloop_create_contig.o R_dataloop_create_indexed.o \ + R_dataloop_create_pairtype.o R_dataloop_create_struct.o \ + R_dataloop_create_vector.o romio_dataloop.o R_segment.o \ + R_subarray_support.o R_typesize_support.o R_segment_ops.o \ + romio_segment_ops.o + +all: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +.c.o: +# $(Q) "$(CC) $@" + $(Q) $(CC) $(CFLAGS) -c $< + $(E)$(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + +.c.p: + @cp $(srcdir)/$*.c _$*.c + $(CC) $(CFLAGS) -c _$*.c + @rm -f _$*.c + +profile: + sleep 1 + +# we must rename the objects prior to insertion into library +# in order to avoid name clashes with copies already in the +# MPICH2 library. +$(LIBNAME): $(DLOOP_OBJECTS) + @cp darray_support.o R_darray_support.o + @cp dataloop.o R_dataloop.o + @cp dataloop_create.o R_dataloop_create.o + @cp dataloop_create_blockindexed.o R_dataloop_create_blockindexed.o + @cp dataloop_create_contig.o R_dataloop_create_contig.o + @cp dataloop_create_indexed.o R_dataloop_create_indexed.o + @cp dataloop_create_pairtype.o R_dataloop_create_pairtype.o + @cp dataloop_create_struct.o R_dataloop_create_struct.o + @cp dataloop_create_vector.o R_dataloop_create_vector.o + @cp segment.o R_segment.o + @cp subarray_support.o R_subarray_support.o + @cp typesize_support.o R_typesize_support.o + @cp segment_ops.o R_segment_ops.o + $(Q) " AR $@" + $(E)$(AR) $(LIBNAME) $(DLOOP_RENAMED_OBJECTS) + $(Q) " RANLIB $@" + $(E)$(RANLIB) $(LIBNAME) + +DLOOP_LOOBJECTS = $(DLOOP_OBJECTS:.o=.lo) +DLOOP_RENAMED_LOOBJECTS = $(DLOOP_RENAMED_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(DLOOP_LOOBJECTS) + @cp darray_support.lo R_darray_support.lo + @cp dataloop.lo R_dataloop.lo + @cp dataloop_create.lo R_dataloop_create.lo + @cp dataloop_create_blockindexed.lo R_dataloop_create_blockindexed.lo + @cp dataloop_create_contig.lo R_dataloop_create_contig.lo + @cp dataloop_create_indexed.lo R_dataloop_create_indexed.lo + @cp dataloop_create_pairtype.lo R_dataloop_create_pairtype.lo + @cp dataloop_create_struct.lo R_dataloop_create_struct.lo + @cp dataloop_create_vector.lo R_dataloop_create_vector.lo + @cp segment.lo R_segment.lo + @cp subarray_support.lo R_subarray_support.lo + @cp typesize_support.lo R_typesize_support.lo + @cp segment_ops.lo R_segment_ops.lo + $(AR) $(SHLIBNAME).la $(DLOOP_RENAMED_LOOBJECTS) + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/darray_support.c b/src/libs/ck-libs/ampi/romio/common/dataloop/darray_support.c new file mode 100644 index 0000000000..6a7d323429 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/darray_support.c @@ -0,0 +1,301 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Note: This code originally appeared in ROMIO. + */ + +#include "dataloop.h" + +static int MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, + int nprocs, int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype *type_new, + MPI_Aint *st_offset); +static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, + int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype *type_new, + MPI_Aint *st_offset); + + +int PREPEND_PREFIX(Type_convert_darray)(int size, + int rank, + int ndims, + int *array_of_gsizes, + int *array_of_distribs, + int *array_of_dargs, + int *array_of_psizes, + int order, + MPI_Datatype oldtype, + MPI_Datatype *newtype) +{ + MPI_Datatype type_old, type_new=MPI_DATATYPE_NULL, types[3]; + int procs, tmp_rank, i, tmp_size, blklens[3], *coords; + MPI_Aint *st_offsets, orig_extent, disps[3]; + + MPI_Type_extent(oldtype, &orig_extent); + +/* calculate position in Cartesian grid as MPI would (row-major + ordering) */ + coords = (int *) DLOOP_Malloc(ndims*sizeof(int)); + procs = size; + tmp_rank = rank; + for (i=0; i=0; i--) { + switch(array_of_distribs[i]) { + case MPI_DISTRIBUTE_BLOCK: + MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], + coords[i], array_of_dargs[i], order, + orig_extent, type_old, &type_new, + st_offsets+i); + break; + case MPI_DISTRIBUTE_CYCLIC: + MPIOI_Type_cyclic(array_of_gsizes, i, ndims, + array_of_psizes[i], coords[i], + array_of_dargs[i], order, + orig_extent, type_old, &type_new, + st_offsets+i); + break; + case MPI_DISTRIBUTE_NONE: + /* treat it as a block distribution on 1 process */ + MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], + coords[i], MPI_DISTRIBUTE_DFLT_DARG, order, orig_extent, + type_old, &type_new, st_offsets+i); + break; + } + if (i != ndims-1) MPI_Type_free(&type_old); + type_old = type_new; + } + + /* add displacement and UB */ + disps[1] = st_offsets[ndims-1]; + tmp_size = 1; + for (i=ndims-2; i>=0; i--) { + tmp_size *= array_of_gsizes[i+1]; + disps[1] += tmp_size*st_offsets[i]; + } + } + + disps[1] *= orig_extent; + + disps[2] = orig_extent; + for (i=0; idim; i--) stride *= array_of_gsizes[i]; + MPI_Type_hvector(mysize, 1, stride, type_old, type_new); + } + + } + + *st_offset = blksize * rank; + /* in terms of no. of elements of type oldtype in this dimension */ + if (mysize == 0) *st_offset = 0; + + return MPI_SUCCESS; +} + + +/* Returns MPI_SUCCESS on success, an MPI error code on failure. Code above + * needs to call MPIO_Err_return_xxx. + */ +static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, + int rank, int darg, int order, MPI_Aint orig_extent, + MPI_Datatype type_old, MPI_Datatype *type_new, + MPI_Aint *st_offset) +{ +/* nprocs = no. of processes in dimension dim of grid + rank = coordinate of this process in dimension dim */ + int blksize, i, blklens[3], st_index, end_index, local_size, rem, count; + MPI_Aint stride, disps[3]; + MPI_Datatype type_tmp, types[3]; + + if (darg == MPI_DISTRIBUTE_DFLT_DARG) blksize = 1; + else blksize = darg; + + /* --BEGIN ERROR HANDLING-- */ + if (blksize <= 0) { + return MPI_ERR_ARG; + } + /* --END ERROR HANDLING-- */ + + st_index = rank*blksize; + end_index = array_of_gsizes[dim] - 1; + + if (end_index < st_index) local_size = 0; + else { + local_size = ((end_index - st_index + 1)/(nprocs*blksize))*blksize; + rem = (end_index - st_index + 1) % (nprocs*blksize); + local_size += (rem < blksize) ? rem : blksize; + } + + count = local_size/blksize; + rem = local_size % blksize; + + stride = nprocs*blksize*orig_extent; + if (order == MPI_ORDER_FORTRAN) + for (i=0; idim; i--) stride *= array_of_gsizes[i]; + + MPI_Type_hvector(count, blksize, stride, type_old, type_new); + + if (rem) { + /* if the last block is of size less than blksize, include + it separately using MPI_Type_struct */ + + types[0] = *type_new; + types[1] = type_old; + disps[0] = 0; + disps[1] = count*stride; + blklens[0] = 1; + blklens[1] = rem; + + MPI_Type_struct(2, blklens, disps, types, &type_tmp); + + MPI_Type_free(type_new); + *type_new = type_tmp; + } + + /* In the first iteration, we need to set the displacement in that + dimension correctly. */ + if ( ((order == MPI_ORDER_FORTRAN) && (dim == 0)) || + ((order == MPI_ORDER_C) && (dim == ndims-1)) ) { + types[0] = MPI_LB; + disps[0] = 0; + types[1] = *type_new; + disps[1] = rank * blksize * orig_extent; + types[2] = MPI_UB; + disps[2] = orig_extent * array_of_gsizes[dim]; + blklens[0] = blklens[1] = blklens[2] = 1; + MPI_Type_struct(3, blklens, disps, types, &type_tmp); + MPI_Type_free(type_new); + *type_new = type_tmp; + + *st_offset = 0; /* set it to 0 because it is taken care of in + the struct above */ + } + else { + *st_offset = rank * blksize; + /* st_offset is in terms of no. of elements of type oldtype in + * this dimension */ + } + + if (local_size == 0) *st_offset = 0; + + return MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop.c b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop.c new file mode 100644 index 0000000000..411b47e2e6 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop.c @@ -0,0 +1,731 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include +#include +#include + +#include "./dataloop.h" + +#undef DEBUG_DLOOP_SIZE +#undef DLOOP_DEBUG_MEMORY + +/* Dataloops + * + * The functions here are used for the creation, copying, update, and display + * of DLOOP_Dataloop structures and trees of these structures. + * + * Currently we store trees of dataloops in contiguous regions of memory. They + * are stored in such a way that subtrees are also stored contiguously. This + * makes it somewhat easier to copy these subtrees around. Keep this in mind + * when looking at the functions below. + * + * The structures used in this file are defined in mpid_datatype.h. There is + * no separate mpid_dataloop.h at this time. + * + * OPTIMIZATIONS: + * + * There are spots in the code with OPT tags that indicate where we could + * optimize particular calculations or avoid certain checks. + * + * NOTES: + * + * Don't have locks in place at this time! + */ + +/* Some functions in this file are responsible for allocation of space for + * dataloops. These structures include the dataloop structure itself + * followed by a sequence of variable-sized arrays, depending on the loop + * kind. For example, a dataloop of kind DLOOP_KIND_INDEXED has a + * dataloop structure followed by an array of block sizes and then an array + * of offsets. + * + * For efficiency and ease of cleanup (preserving a single free at + * deallocation), we want to allocate this memory as a single large chunk. + * However, we must perform some alignment of the components of this chunk + * in order to obtain correct and efficient operation across all platforms. + */ + + +/*@ + Dataloop_free - deallocate the resources used to store a dataloop + + Input Parameters: +. dataloop - pointer to dataloop structure +@*/ +void PREPEND_PREFIX(Dataloop_free)(DLOOP_Dataloop **dataloop) +{ + + if (*dataloop == NULL) return; + +#ifdef DLOOP_DEBUG_MEMORY + DLOOP_dbg_printf("DLOOP_Dataloop_free: freeing loop @ %x.\n", + (int) *dataloop); +#endif + + memset(*dataloop, 0, sizeof(DLOOP_Dataloop_common)); + DLOOP_Free(*dataloop); + *dataloop = NULL; + return; +} +/*@ + Dataloop_copy - Copy an arbitrary dataloop structure, updating + pointers as necessary + + Input Parameters: ++ dest - pointer to destination region +. src - pointer to original dataloop structure +- size - size of dataloop structure + + This routine parses the dataloop structure as it goes in order to + determine what exactly it needs to update. + + Notes: + It assumes that the source dataloop was allocated in our usual way; + this means that the entire dataloop is in a contiguous region and that + the root of the tree is first in the array. + + This has some implications: ++ we can use a contiguous copy mechanism to copy the majority of the + structure +- all pointers in the region are relative to the start of the data region + the first dataloop in the array is the root of the tree +@*/ +void PREPEND_PREFIX(Dataloop_copy)(void *dest, + void *src, + int size) +{ + DLOOP_Offset ptrdiff; + +#ifdef DLOOP_DEBUG_MEMORY + DLOOP_dbg_printf("DLOOP_Dataloop_copy: copying from %x to %x (%d bytes).\n", + (int) src, (int) dest, size); +#endif + + /* copy region first */ + memcpy(dest, src, size); + + /* Calculate difference in starting locations. DLOOP_Dataloop_update() + * then traverses the new structure and updates internal pointers by + * adding this difference to them. This way we can just copy the + * structure, including pointers, in one big block. + */ + ptrdiff = (char *) dest - (char *) src; + + /* traverse structure updating pointers */ + PREPEND_PREFIX(Dataloop_update)(dest, ptrdiff); + + return; +} + + +/*@ + Dataloop_update - update pointers after a copy operation + + Input Parameters: ++ dataloop - pointer to loop to update +- ptrdiff - value indicating offset between old and new pointer values + + This function is used to recursively update all the pointers in a + dataloop tree. +@*/ +void PREPEND_PREFIX(Dataloop_update)(DLOOP_Dataloop *dataloop, + DLOOP_Offset ptrdiff) +{ + /* OPT: only declare these variables down in the Struct case */ + int i; + DLOOP_Dataloop **looparray; + + switch(dataloop->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_CONTIG: + case DLOOP_KIND_VECTOR: + /* + * All these really ugly assignments are really of the form: + * + * ((char *) dataloop->loop_params.c_t.loop) += ptrdiff; + * + * However, some compilers spit out warnings about casting on the + * LHS, so we get this much nastier form instead (using common + * struct for contig and vector): + */ + dataloop->loop_params.cm_t.dataloop = (DLOOP_Dataloop *) + ((char *) dataloop->loop_params.cm_t.dataloop + ptrdiff); + + if (!(dataloop->kind & DLOOP_FINAL_MASK)) + PREPEND_PREFIX(Dataloop_update)(dataloop->loop_params.cm_t.dataloop, ptrdiff); + break; + + case DLOOP_KIND_BLOCKINDEXED: + dataloop->loop_params.bi_t.offset_array = (DLOOP_Offset *) + ((char *) dataloop->loop_params.bi_t.offset_array + ptrdiff); + dataloop->loop_params.bi_t.dataloop = (DLOOP_Dataloop *) + ((char *) dataloop->loop_params.bi_t.dataloop + ptrdiff); + + if (!(dataloop->kind & DLOOP_FINAL_MASK)) + PREPEND_PREFIX(Dataloop_update)(dataloop->loop_params.bi_t.dataloop, ptrdiff); + break; + + case DLOOP_KIND_INDEXED: + dataloop->loop_params.i_t.blocksize_array = (DLOOP_Count *) + ((char *) dataloop->loop_params.i_t.blocksize_array + ptrdiff); + dataloop->loop_params.i_t.offset_array = (DLOOP_Offset *) + ((char *) dataloop->loop_params.i_t.offset_array + ptrdiff); + dataloop->loop_params.i_t.dataloop = (DLOOP_Dataloop *) + ((char *) dataloop->loop_params.i_t.dataloop + ptrdiff); + + if (!(dataloop->kind & DLOOP_FINAL_MASK)) + PREPEND_PREFIX(Dataloop_update)(dataloop->loop_params.i_t.dataloop, ptrdiff); + break; + + case DLOOP_KIND_STRUCT: + dataloop->loop_params.s_t.blocksize_array = (DLOOP_Count *) + ((char *) dataloop->loop_params.s_t.blocksize_array + ptrdiff); + dataloop->loop_params.s_t.offset_array = (DLOOP_Offset *) + ((char *) dataloop->loop_params.s_t.offset_array + ptrdiff); + dataloop->loop_params.s_t.dataloop_array = (DLOOP_Dataloop **) + ((char *) dataloop->loop_params.s_t.dataloop_array + ptrdiff); + + /* fix the N dataloop pointers too */ + looparray = dataloop->loop_params.s_t.dataloop_array; + for (i=0; i < dataloop->loop_params.s_t.count; i++) { + looparray[i] = (DLOOP_Dataloop *) + ((char *) looparray[i] + ptrdiff); + } + + if (dataloop->kind & DLOOP_FINAL_MASK) break; + + for (i=0; i < dataloop->loop_params.s_t.count; i++) { + PREPEND_PREFIX(Dataloop_update)(looparray[i], ptrdiff); + } + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + return; +} + +/*@ + Dataloop_alloc - allocate the resources used to store a dataloop with + no old loops associated with it. + + Input Parameters: ++ kind - kind of dataloop to allocate +. count - number of elements in dataloop (kind dependent) +. new_loop_p - address at which to store new dataloop pointer +- new_loop_sz_p - pointer to integer in which to store new loop size + + Notes: + The count parameter passed into this function will often be different + from the count passed in at the MPI layer due to optimizations. +@*/ +void PREPEND_PREFIX(Dataloop_alloc)(int kind, + DLOOP_Count count, + DLOOP_Dataloop **new_loop_p, + int *new_loop_sz_p) +{ + PREPEND_PREFIX(Dataloop_alloc_and_copy)(kind, + count, + NULL, + 0, + new_loop_p, + new_loop_sz_p); + return; +} + +/*@ + Dataloop_alloc_and_copy - allocate the resources used to store a + dataloop and copy in old dataloop as + appropriate + + Input Parameters: ++ kind - kind of dataloop to allocate +. count - number of elements in dataloop (kind dependent) +. old_loop - pointer to old dataloop (or NULL for none) +. old_loop_sz - size of old dataloop (should be zero if old_loop is NULL) +. new_loop_p - address at which to store new dataloop pointer +- new_loop_sz_p - pointer to integer in which to store new loop size + + Notes: + The count parameter passed into this function will often be different + from the count passed in at the MPI layer. +@*/ +void PREPEND_PREFIX(Dataloop_alloc_and_copy)(int kind, + DLOOP_Count count, + DLOOP_Dataloop *old_loop, + int old_loop_sz, + DLOOP_Dataloop **new_loop_p, + int *new_loop_sz_p) +{ + int new_loop_sz = 0; + int align_sz = 8; /* default aligns everything to 8-byte boundaries */ + int epsilon; + int loop_sz = sizeof(DLOOP_Dataloop); + int off_sz = 0, blk_sz = 0, ptr_sz = 0, extent_sz = 0; + + char *pos; + DLOOP_Dataloop *new_loop; + +#ifdef HAVE_MAX_STRUCT_ALIGNMENT + if (align_sz > HAVE_MAX_STRUCT_ALIGNMENT) { + align_sz = HAVE_MAX_STRUCT_ALIGNMENT; + } +#endif + + if (old_loop != NULL) { + DLOOP_Assert((old_loop_sz % align_sz) == 0); + } + + /* calculate the space that we actually need for everything */ + switch (kind) { + case DLOOP_KIND_STRUCT: + /* need space for dataloop pointers and extents */ + ptr_sz = count * sizeof(DLOOP_Dataloop *); + extent_sz = count * sizeof(DLOOP_Offset); + case DLOOP_KIND_INDEXED: + /* need space for block sizes */ + blk_sz = count * sizeof(DLOOP_Count); + case DLOOP_KIND_BLOCKINDEXED: + /* need space for block offsets */ + off_sz = count * sizeof(DLOOP_Offset); + case DLOOP_KIND_CONTIG: + case DLOOP_KIND_VECTOR: + break; + default: + DLOOP_Assert(0); + } + + /* pad everything that we're going to allocate */ + epsilon = loop_sz % align_sz; + if (epsilon) loop_sz += align_sz - epsilon; + + epsilon = off_sz % align_sz; + if (epsilon) off_sz += align_sz - epsilon; + + epsilon = blk_sz % align_sz; + if (epsilon) blk_sz += align_sz - epsilon; + + epsilon = ptr_sz % align_sz; + if (epsilon) ptr_sz += align_sz - epsilon; + + epsilon = extent_sz % align_sz; + if (epsilon) extent_sz += align_sz - epsilon; + + new_loop_sz += loop_sz + off_sz + blk_sz + ptr_sz + + extent_sz + old_loop_sz; + + /* allocate space */ + new_loop = (DLOOP_Dataloop *) DLOOP_Malloc(new_loop_sz); + if (new_loop == NULL) { + *new_loop_p = NULL; + return; + } + +#ifdef DLOOP_DEBUG_MEMORY + DLOOP_dbg_printf("DLOOP_Dataloop_alloc_and_copy: new loop @ %x (tot sz = %d, loop = %d, off = %d, blk = %d, ptr = %d, extent = %d, old = %d)\n", + (int) new_loop, + new_loop_sz, + loop_sz, + off_sz, + blk_sz, + ptr_sz, + extent_sz, + old_loop_sz); +#endif + + /* set all the pointers in the new dataloop structure */ + switch (kind) { + case DLOOP_KIND_STRUCT: + /* order is: + * - pointers + * - blocks + * - offsets + * - extents + */ + new_loop->loop_params.s_t.dataloop_array = + (DLOOP_Dataloop **) (((char *) new_loop) + loop_sz); + new_loop->loop_params.s_t.blocksize_array = + (DLOOP_Count *) (((char *) new_loop) + loop_sz + ptr_sz); + new_loop->loop_params.s_t.offset_array = + (DLOOP_Offset *) (((char *) new_loop) + loop_sz + + ptr_sz + blk_sz); + new_loop->loop_params.s_t.el_extent_array = + (DLOOP_Offset *) (((char *) new_loop) + loop_sz + + ptr_sz + blk_sz + off_sz); + break; + case DLOOP_KIND_INDEXED: + /* order is: + * - blocks + * - offsets + */ + new_loop->loop_params.i_t.blocksize_array = + (DLOOP_Count *) (((char *) new_loop) + loop_sz); + new_loop->loop_params.i_t.offset_array = + (DLOOP_Offset *) (((char *) new_loop) + loop_sz + blk_sz); + if (old_loop == NULL) { + new_loop->loop_params.i_t.dataloop = NULL; + } + else { + new_loop->loop_params.i_t.dataloop = + (DLOOP_Dataloop *) (((char *) new_loop) + + (new_loop_sz - old_loop_sz)); + } + break; + case DLOOP_KIND_BLOCKINDEXED: + new_loop->loop_params.bi_t.offset_array = + (DLOOP_Offset *) (((char *) new_loop) + loop_sz); + if (old_loop == NULL) { + new_loop->loop_params.bi_t.dataloop = NULL; + } + else { + new_loop->loop_params.bi_t.dataloop = + (DLOOP_Dataloop *) (((char *) new_loop) + + (new_loop_sz - old_loop_sz)); + } + break; + case DLOOP_KIND_CONTIG: + if (old_loop == NULL) { + new_loop->loop_params.c_t.dataloop = NULL; + } + else { + new_loop->loop_params.c_t.dataloop = + (DLOOP_Dataloop *) (((char *) new_loop) + + (new_loop_sz - old_loop_sz)); + } + break; + case DLOOP_KIND_VECTOR: + if (old_loop == NULL) { + new_loop->loop_params.v_t.dataloop = NULL; + } + else { + new_loop->loop_params.v_t.dataloop = + (DLOOP_Dataloop *) (((char *) new_loop) + + (new_loop_sz - old_loop_sz)); + } + break; + default: + DLOOP_Assert(0); + } + + pos = ((char *) new_loop) + (new_loop_sz - old_loop_sz); + if (old_loop != NULL) { + PREPEND_PREFIX(Dataloop_copy)(pos, old_loop, old_loop_sz); + } + + *new_loop_p = new_loop; + *new_loop_sz_p = new_loop_sz; + return; +} + +/*@ + Dataloop_struct_alloc - allocate the resources used to store a dataloop and + copy in old dataloop as appropriate. this version + is specifically for use when a struct dataloop is + being created; the space to hold old dataloops in + this case must be described back to the + implementation in order for efficient copying. + + Input Parameters: ++ count - number of elements in dataloop (kind dependent) +. old_loop_sz - size of old dataloop (should be zero if old_loop is NULL) +. basic_ct - number of basic types for which new dataloops are needed +. old_loop_p - address at which to store pointer to old loops +. new_loop_p - address at which to store new struct dataloop pointer +- new_loop_sz_p - address at which to store new loop size + + Notes: + The count parameter passed into this function will often be different + from the count passed in at the MPI layer due to optimizations. + + The caller is responsible for filling in the region pointed to by + old_loop_p (count elements). +@*/ +void PREPEND_PREFIX(Dataloop_struct_alloc)(DLOOP_Count count, + int old_loop_sz, + int basic_ct, + DLOOP_Dataloop **old_loop_p, + DLOOP_Dataloop **new_loop_p, + int *new_loop_sz_p) +{ + int new_loop_sz = 0; + int align_sz = 8; /* default aligns everything to 8-byte boundaries */ + int epsilon; + int loop_sz = sizeof(DLOOP_Dataloop); + int off_sz, blk_sz, ptr_sz, extent_sz, basic_sz; + + DLOOP_Dataloop *new_loop; + +#ifdef HAVE_MAX_STRUCT_ALIGNMENT + if (align_sz > HAVE_MAX_STRUCT_ALIGNMENT) { + align_sz = HAVE_MAX_STRUCT_ALIGNMENT; + } +#endif + + /* calculate the space that we actually need for everything */ + ptr_sz = count * sizeof(DLOOP_Dataloop *); + extent_sz = count * sizeof(DLOOP_Offset); + blk_sz = count * sizeof(DLOOP_Count); + off_sz = count * sizeof(DLOOP_Offset); + basic_sz = sizeof(DLOOP_Dataloop); + + /* pad everything that we're going to allocate */ + epsilon = loop_sz % align_sz; + if (epsilon) loop_sz += align_sz - epsilon; + + epsilon = off_sz % align_sz; + if (epsilon) off_sz += align_sz - epsilon; + + epsilon = blk_sz % align_sz; + if (epsilon) blk_sz += align_sz - epsilon; + + epsilon = ptr_sz % align_sz; + if (epsilon) ptr_sz += align_sz - epsilon; + + epsilon = extent_sz % align_sz; + if (epsilon) extent_sz += align_sz - epsilon; + + epsilon = basic_sz % align_sz; + if (epsilon) basic_sz += align_sz - epsilon; + + /* note: we pad *each* basic type dataloop, because the + * code used to create them assumes that we're going to + * do that. + */ + + new_loop_sz += loop_sz + off_sz + blk_sz + ptr_sz + + extent_sz + (basic_ct * basic_sz) + old_loop_sz; + + /* allocate space */ + new_loop = (DLOOP_Dataloop *) DLOOP_Malloc(new_loop_sz); + if (new_loop == NULL) { + *new_loop_p = NULL; + return; + } + +#ifdef DLOOP_DEBUG_MEMORY + DLOOP_dbg_printf("DLOOP_Dataloop_struct_alloc: new loop @ %x (tot sz = %d, loop = %d, off = %d, blk = %d, ptr = %d, extent = %d, basics = %d, old = %d)\n", + (int) new_loop, + new_loop_sz, + loop_sz, + off_sz, + blk_sz, + ptr_sz, + extent_sz, + basic_sz, + old_loop_sz); +#endif + + /* set all the pointers in the new dataloop structure */ + new_loop->loop_params.s_t.dataloop_array = (DLOOP_Dataloop **) + (((char *) new_loop) + loop_sz); + new_loop->loop_params.s_t.blocksize_array = (DLOOP_Count *) + (((char *) new_loop) + loop_sz + ptr_sz); + new_loop->loop_params.s_t.offset_array = (DLOOP_Offset *) + (((char *) new_loop) + loop_sz + ptr_sz + blk_sz); + new_loop->loop_params.s_t.el_extent_array = (DLOOP_Offset *) + (((char *) new_loop) + loop_sz + ptr_sz + blk_sz + off_sz); + + *old_loop_p = (DLOOP_Dataloop *) + (((char *) new_loop) + loop_sz + ptr_sz + blk_sz + off_sz + extent_sz); + *new_loop_p = new_loop; + *new_loop_sz_p = new_loop_sz; + + return; +} + +/*@ + Dataloop_dup - make a copy of a dataloop + + Returns 0 on success, -1 on failure. +@*/ +void PREPEND_PREFIX(Dataloop_dup)(DLOOP_Dataloop *old_loop, + int old_loop_sz, + DLOOP_Dataloop **new_loop_p) +{ + DLOOP_Dataloop *new_loop; + + DLOOP_Assert(old_loop != NULL); + DLOOP_Assert(old_loop_sz > 0); + + new_loop = (DLOOP_Dataloop *) DLOOP_Malloc(old_loop_sz); + if (new_loop == NULL) { + *new_loop_p = NULL; + return; + } + + PREPEND_PREFIX(Dataloop_copy)(new_loop, old_loop, old_loop_sz); + *new_loop_p = new_loop; + return; +} + +/*@ + Dataloop_stream_size - return the size of the data described by the dataloop + + Input Parameters: ++ dl_p - pointer to dataloop for which we will return the size +- sizefn - function for determining size of types in the corresponding stream + (passing NULL will instead result in el_size values being used) + +@*/ +DLOOP_Offset +PREPEND_PREFIX(Dataloop_stream_size)(struct DLOOP_Dataloop *dl_p, + DLOOP_Offset (*sizefn)(DLOOP_Type el_type)) +{ + DLOOP_Offset ret; + DLOOP_Offset tmp_sz, tmp_ct = 1; + + for (;;) + { + if ((dl_p->kind & DLOOP_KIND_MASK) == DLOOP_KIND_STRUCT) + { + int i; + + tmp_sz = 0; + for (i = 0; i < dl_p->loop_params.s_t.count; i++) + { + ret += dl_p->loop_params.s_t.blocksize_array[i] * + PREPEND_PREFIX(Dataloop_stream_size)(dl_p->loop_params.s_t.dataloop_array[i], sizefn); + } + return tmp_sz * tmp_ct; + } + + switch (dl_p->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_CONTIG: + tmp_ct *= dl_p->loop_params.c_t.count; +#ifdef DLOOP_DEBUG_SIZE + DLOOP_dbg_printf("stream_size: contig: ct = %d; new tot_ct = %d\n", + (int) dl_p->loop_params.c_t.count, (int) tmp_ct); +#endif + break; + case DLOOP_KIND_VECTOR: + tmp_ct *= dl_p->loop_params.v_t.count * dl_p->loop_params.v_t.blocksize; +#ifdef DLOOP_DEBUG_SIZE + DLOOP_dbg_printf("stream_size: vector: ct = %d; blk = %d; new tot_ct = %d\n", + (int) dl_p->loop_params.v_t.count, + (int) dl_p->loop_params.v_t.blocksize, + (int) tmp_ct); +#endif + break; + case DLOOP_KIND_BLOCKINDEXED: + tmp_ct *= dl_p->loop_params.bi_t.count * dl_p->loop_params.bi_t.blocksize; +#ifdef DLOOP_DEBUG_SIZE + DLOOP_dbg_printf("stream_size: blkindexed: blks = %d; new tot_ct = %d\n", + (int) dl_p->loop_params.bi_t.count * + (int) dl_p->loop_params.bi_t.blocksize, + (int) tmp_ct); +#endif + break; + case DLOOP_KIND_INDEXED: + tmp_ct *= dl_p->loop_params.i_t.total_blocks; +#ifdef DLOOP_DEBUG_SIZE + DLOOP_dbg_printf("stream_size: contig: blks = %d; new tot_ct = %d\n", + (int) dl_p->loop_params.i_t.total_blocks, + (int) tmp_ct); +#endif + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + + if (dl_p->kind & DLOOP_FINAL_MASK) break; + else { + DLOOP_Assert(dl_p->loop_params.cm_t.dataloop != NULL); + dl_p = dl_p->loop_params.cm_t.dataloop; + } + } + + /* call fn for size using bottom type, or use size if fnptr is NULL */ + tmp_sz = ((sizefn) ? sizefn(dl_p->el_type) : dl_p->el_size); + + return tmp_sz * tmp_ct; +} + +/* --BEGIN ERROR HANDLING-- */ +/*@ + Dataloop_print - dump a dataloop tree to stdout for debugging + purposes + + Input Parameters: ++ dataloop - root of tree to dump +- depth - starting depth; used to help keep up with where we are in the tree +@*/ +void PREPEND_PREFIX(Dataloop_print)(struct DLOOP_Dataloop *dataloop, + int depth) +{ + int i; + + if (dataloop == NULL) + { + DLOOP_dbg_printf("dataloop is NULL (probably basic type)\n"); + return; + } + + DLOOP_dbg_printf("loc=%p, treedepth=%d, kind=%d, el_extent=%ld\n", + dataloop, (int) depth, (int) dataloop->kind, (long) dataloop->el_extent); + switch(dataloop->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_CONTIG: + DLOOP_dbg_printf("\tCONTIG: count=%d, datatype=%p\n", + (int) dataloop->loop_params.c_t.count, + dataloop->loop_params.c_t.dataloop); + if (!(dataloop->kind & DLOOP_FINAL_MASK)) + PREPEND_PREFIX(Dataloop_print)(dataloop->loop_params.c_t.dataloop, depth+1); + break; + case DLOOP_KIND_VECTOR: + DLOOP_dbg_printf("\tVECTOR: count=%d, blksz=%d, stride=%d, datatype=%p\n", + (int) dataloop->loop_params.v_t.count, + (int) dataloop->loop_params.v_t.blocksize, + (int) dataloop->loop_params.v_t.stride, + dataloop->loop_params.v_t.dataloop); + if (!(dataloop->kind & DLOOP_FINAL_MASK)) + PREPEND_PREFIX(Dataloop_print)(dataloop->loop_params.v_t.dataloop, depth+1); + break; + case DLOOP_KIND_BLOCKINDEXED: + DLOOP_dbg_printf("\tBLOCKINDEXED: count=%d, blksz=%d, datatype=%p\n", + (int) dataloop->loop_params.bi_t.count, + (int) dataloop->loop_params.bi_t.blocksize, + dataloop->loop_params.bi_t.dataloop); + /* print out offsets later */ + if (!(dataloop->kind & DLOOP_FINAL_MASK)) + PREPEND_PREFIX(Dataloop_print)(dataloop->loop_params.bi_t.dataloop, depth+1); + break; + case DLOOP_KIND_INDEXED: + DLOOP_dbg_printf("\tINDEXED: count=%d, datatype=%p\n", + (int) dataloop->loop_params.i_t.count, + dataloop->loop_params.i_t.dataloop); + /* print out blocksizes and offsets later */ + if (!(dataloop->kind & DLOOP_FINAL_MASK)) + PREPEND_PREFIX(Dataloop_print)(dataloop->loop_params.i_t.dataloop, depth+1); + break; + case DLOOP_KIND_STRUCT: + DLOOP_dbg_printf("\tSTRUCT: count=%d\n", (int) dataloop->loop_params.s_t.count); + DLOOP_dbg_printf("\tblocksizes:\n"); + for (i=0; i < dataloop->loop_params.s_t.count; i++) + DLOOP_dbg_printf("\t\t%d\n", (int) dataloop->loop_params.s_t.blocksize_array[i]); + DLOOP_dbg_printf("\toffsets:\n"); + for (i=0; i < dataloop->loop_params.s_t.count; i++) + DLOOP_dbg_printf("\t\t%d\n", (int) dataloop->loop_params.s_t.offset_array[i]); + DLOOP_dbg_printf("\tdatatypes:\n"); + for (i=0; i < dataloop->loop_params.s_t.count; i++) + DLOOP_dbg_printf("\t\t%p\n", dataloop->loop_params.s_t.dataloop_array[i]); + if (dataloop->kind & DLOOP_FINAL_MASK) break; + + for (i=0; i < dataloop->loop_params.s_t.count; i++) { + PREPEND_PREFIX(Dataloop_print)(dataloop->loop_params.s_t.dataloop_array[i],depth+1); + } + break; + default: + DLOOP_Assert(0); + break; + } + return; +} +/* --END ERROR HANDLING-- */ diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop.h b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop.h new file mode 100644 index 0000000000..53ac8d1fe4 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop.h @@ -0,0 +1,21 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +/* This file is here only to keep includes in one place inside the + * dataloop subdirectory. This file will be different for each use + * of the dataloop code, but others should be identical. + */ +#ifndef DATALOOP_H +#define DATALOOP_H + +/* This is specific to MPICH2 */ +#include "romio_dataloop.h" + +#endif + + + diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create.c b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create.c new file mode 100644 index 0000000000..36edb4d280 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create.c @@ -0,0 +1,387 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include +#include + +#include "./dataloop.h" + +static void DLOOP_Dataloop_create_named(MPI_Datatype type, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); + +void PREPEND_PREFIX(Dataloop_create)(MPI_Datatype type, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + int i; + + int nr_ints, nr_aints, nr_types, combiner; + MPI_Datatype *types; + int *ints; + MPI_Aint *aints; + + DLOOP_Dataloop *old_dlp; + int old_dlsz, old_dldepth; + + int dummy1, dummy2, dummy3, type0_combiner, ndims; + MPI_Datatype tmptype; + + MPI_Aint stride; + MPI_Aint *disps; + + MPI_Type_get_envelope(type, &nr_ints, &nr_aints, &nr_types, &combiner); + + /* some named types do need dataloops; handle separately. */ + if (combiner == MPI_COMBINER_NAMED) { + DLOOP_Dataloop_create_named(type, dlp_p, dlsz_p, dldepth_p, flag); + return; + } + + /* Q: should we also check for "hasloop", or is the COMBINER + * check above enough to weed out everything that wouldn't + * have a loop? + */ + DLOOP_Handle_get_loopptr_macro(type, old_dlp, flag); + if (old_dlp != NULL) { + /* dataloop already created; just return it. */ + *dlp_p = old_dlp; + DLOOP_Handle_get_loopsize_macro(type, *dlsz_p, flag); + DLOOP_Handle_get_loopdepth_macro(type, *dldepth_p, flag); + return; + } + + PREPEND_PREFIX(Type_access_contents)(type, &ints, &aints, &types); + + /* first check for zero count on types where that makes sense */ + switch(combiner) { + case MPI_COMBINER_CONTIGUOUS: + case MPI_COMBINER_VECTOR: + case MPI_COMBINER_HVECTOR_INTEGER: + case MPI_COMBINER_HVECTOR: + case MPI_COMBINER_INDEXED_BLOCK: + case MPI_COMBINER_INDEXED: + case MPI_COMBINER_HINDEXED_INTEGER: + case MPI_COMBINER_HINDEXED: + case MPI_COMBINER_STRUCT_INTEGER: + case MPI_COMBINER_STRUCT: + if (ints[0] == 0) { + PREPEND_PREFIX(Dataloop_create_contiguous)(0, + MPI_INT, + dlp_p, + dlsz_p, + dldepth_p, + flag); + goto clean_exit; + } + break; + default: + break; + } + + /* recurse, processing types "below" this one before processing + * this one, if those type don't already have dataloops. + * + * note: in the struct case below we'll handle any additional + * types "below" the current one. + */ + MPI_Type_get_envelope(types[0], &dummy1, &dummy2, &dummy3, + &type0_combiner); + if (type0_combiner != MPI_COMBINER_NAMED) + { + DLOOP_Handle_get_loopptr_macro(types[0], old_dlp, flag); + if (old_dlp == NULL) + { + /* no dataloop already present; create and store one */ + PREPEND_PREFIX(Dataloop_create)(types[0], + &old_dlp, + &old_dlsz, + &old_dldepth, + flag); + + DLOOP_Handle_set_loopptr_macro(types[0], old_dlp, flag); + DLOOP_Handle_set_loopsize_macro(types[0], old_dlsz, flag); + DLOOP_Handle_set_loopdepth_macro(types[0], old_dldepth, flag); + } + } + + switch(combiner) + { + case MPI_COMBINER_DUP: + if (type0_combiner != MPI_COMBINER_NAMED) { + PREPEND_PREFIX(Dataloop_dup)(old_dlp, old_dlsz, dlp_p); + *dlsz_p = old_dlsz; + *dldepth_p = old_dldepth; + } + else { + PREPEND_PREFIX(Dataloop_create_contiguous)(1, + types[0], + dlp_p, dlsz_p, + dldepth_p, + flag); + } + break; + case MPI_COMBINER_RESIZED: + if (type0_combiner != MPI_COMBINER_NAMED) { + PREPEND_PREFIX(Dataloop_dup)(old_dlp, old_dlsz, dlp_p); + *dlsz_p = old_dlsz; + *dldepth_p = old_dldepth; + } + else { + PREPEND_PREFIX(Dataloop_create_contiguous)(1, + types[0], + dlp_p, dlsz_p, + dldepth_p, + flag); + + (*dlp_p)->el_extent = aints[1]; /* extent */ + } + break; + case MPI_COMBINER_CONTIGUOUS: + PREPEND_PREFIX(Dataloop_create_contiguous)(ints[0] /* count */, + types[0] /* oldtype */, + dlp_p, dlsz_p, + dldepth_p, + flag); + break; + case MPI_COMBINER_VECTOR: + PREPEND_PREFIX(Dataloop_create_vector)(ints[0] /* count */, + ints[1] /* blklen */, + ints[2] /* stride */, + 0 /* stride not bytes */, + types[0] /* oldtype */, + dlp_p, dlsz_p, dldepth_p, + flag); + break; + case MPI_COMBINER_HVECTOR_INTEGER: + case MPI_COMBINER_HVECTOR: + /* fortran hvector has integer stride in bytes */ + if (combiner == MPI_COMBINER_HVECTOR_INTEGER) { + stride = (MPI_Aint) ints[2]; + } + else { + stride = aints[0]; + } + + PREPEND_PREFIX(Dataloop_create_vector)(ints[0] /* count */, + ints[1] /* blklen */, + stride, + 1 /* stride in bytes */, + types[0] /* oldtype */, + dlp_p, dlsz_p, dldepth_p, + flag); + break; + case MPI_COMBINER_INDEXED_BLOCK: + PREPEND_PREFIX(Dataloop_create_blockindexed)(ints[0] /* count */, + ints[1] /* blklen */, + &ints[2] /* disps */, + 0 /* disp not bytes */, + types[0] /* oldtype */, + dlp_p, dlsz_p, + dldepth_p, + flag); + break; + case MPI_COMBINER_INDEXED: + PREPEND_PREFIX(Dataloop_create_indexed)(ints[0] /* count */, + &ints[1] /* blklens */, + &ints[ints[0]+1] /* disp */, + 0 /* disp not in bytes */, + types[0] /* oldtype */, + dlp_p, dlsz_p, dldepth_p, + flag); + break; + case MPI_COMBINER_HINDEXED_INTEGER: + case MPI_COMBINER_HINDEXED: + if (combiner == MPI_COMBINER_HINDEXED_INTEGER) { + disps = (MPI_Aint *) DLOOP_Malloc(ints[0] * sizeof(MPI_Aint)); + + for (i=0; i < ints[0]; i++) { + disps[i] = (MPI_Aint) ints[ints[0] + 1 + i]; + } + } + else { + disps = aints; + } + + PREPEND_PREFIX(Dataloop_create_indexed)(ints[0] /* count */, + &ints[1] /* blklens */, + disps, + 1 /* disp in bytes */, + types[0] /* oldtype */, + dlp_p, dlsz_p, dldepth_p, + flag); + + if (combiner == MPI_COMBINER_HINDEXED_INTEGER) { + DLOOP_Free(disps); + } + + break; + case MPI_COMBINER_STRUCT_INTEGER: + case MPI_COMBINER_STRUCT: + for (i = 1; i < ints[0]; i++) { + int type_combiner; + MPI_Type_get_envelope(types[i], &dummy1, &dummy2, &dummy3, + &type_combiner); + + if (type_combiner != MPI_COMBINER_NAMED) { + DLOOP_Handle_get_loopptr_macro(types[i], old_dlp, flag); + if (old_dlp == NULL) + { + PREPEND_PREFIX(Dataloop_create)(types[i], + &old_dlp, + &old_dlsz, + &old_dldepth, + flag); + + DLOOP_Handle_set_loopptr_macro(types[i], old_dlp, + flag); + DLOOP_Handle_set_loopsize_macro(types[i], old_dlsz, + flag); + DLOOP_Handle_set_loopdepth_macro(types[i], old_dldepth, + flag); + } + } + } + if (combiner == MPI_COMBINER_STRUCT_INTEGER) { + disps = (MPI_Aint *) DLOOP_Malloc(ints[0] * sizeof(MPI_Aint)); + + for (i=0; i < ints[0]; i++) { + disps[i] = (MPI_Aint) ints[ints[0] + 1 + i]; + } + } + else { + disps = aints; + } + + PREPEND_PREFIX(Dataloop_create_struct)(ints[0] /* count */, + &ints[1] /* blklens */, + disps, + types /* oldtype array */, + dlp_p, dlsz_p, dldepth_p, + flag); + + if (combiner == MPI_COMBINER_STRUCT_INTEGER) { + DLOOP_Free(disps); + } + break; + case MPI_COMBINER_SUBARRAY: + ndims = ints[0]; + PREPEND_PREFIX(Type_convert_subarray)(ndims, + &ints[1] /* sizes */, + &ints[1+ndims] /* subsizes */, + &ints[1+2*ndims] /* starts */, + ints[1+3*ndims] /* order */, + types[0], + &tmptype); + + PREPEND_PREFIX(Dataloop_create)(tmptype, + dlp_p, + dlsz_p, + dldepth_p, + flag); + + MPI_Type_free(&tmptype); + break; + case MPI_COMBINER_DARRAY: + ndims = ints[2]; + PREPEND_PREFIX(Type_convert_darray)(ints[0] /* size */, + ints[1] /* rank */, + ndims, + &ints[3] /* gsizes */, + &ints[3+ndims] /*distribs */, + &ints[3+2*ndims] /* dargs */, + &ints[3+3*ndims] /* psizes */, + ints[3+4*ndims] /* order */, + types[0], + &tmptype); + + PREPEND_PREFIX(Dataloop_create)(tmptype, + dlp_p, + dlsz_p, + dldepth_p, + flag); + + MPI_Type_free(&tmptype); + break; + case MPI_COMBINER_F90_REAL: + case MPI_COMBINER_F90_COMPLEX: + case MPI_COMBINER_F90_INTEGER: + /* TODO: WHAT DO I DO HERE? */ + default: + DLOOP_Assert(0); + break; + } + + clean_exit: + + PREPEND_PREFIX(Type_release_contents)(type, &ints, &aints, &types); + + /* for now we just leave the intermediate dataloops in place. + * could remove them to save space if we wanted. + */ + + return; +} + +/*@ + DLOOP_Dataloop_create_named - create a dataloop for a "named" type + if necessary. + + "named" types are ones for which MPI_Type_get_envelope() returns a + combiner of MPI_COMBINER_NAMED. some types that fit this category, + such as MPI_SHORT_INT, have multiple elements with potential gaps + and padding. these types need dataloops for correct processing. +@*/ +static void DLOOP_Dataloop_create_named(MPI_Datatype type, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + DLOOP_Dataloop *dlp; + + /* special case: pairtypes need dataloops too. + * + * note: not dealing with MPI_2INT because size == extent + * in all cases for that type. + * + * note: MPICH2 always precreates these, so we will never call + * Dataloop_create_pairtype() from here in the MPICH2 + * case. + */ + if (type == MPI_FLOAT_INT || type == MPI_DOUBLE_INT || + type == MPI_LONG_INT || type == MPI_SHORT_INT || + type == MPI_LONG_DOUBLE_INT) + { + DLOOP_Handle_get_loopptr_macro(type, dlp, flag); + if (dlp != NULL) { + /* dataloop already created; just return it. */ + *dlp_p = dlp; + DLOOP_Handle_get_loopsize_macro(type, *dlsz_p, flag); + DLOOP_Handle_get_loopdepth_macro(type, *dldepth_p, flag); + } + else { + PREPEND_PREFIX(Dataloop_create_pairtype)(type, + dlp_p, + dlsz_p, + dldepth_p, + flag); + } + return; + } + /* no other combiners need dataloops; exit. */ + else { + *dlp_p = NULL; + *dlsz_p = 0; + *dldepth_p = 0; + return; + } +} diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create.h b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create.h new file mode 100644 index 0000000000..db645d5a90 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create.h @@ -0,0 +1,83 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#ifndef DATALOOP_CREATE_H +#define DATALOOP_CREATE_H + +/* Dataloop construction functions */ +void PREPEND_PREFIX(Dataloop_create)(MPI_Datatype type, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); +int PREPEND_PREFIX(Dataloop_create_contiguous)(int count, + MPI_Datatype oldtype, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); +int PREPEND_PREFIX(Dataloop_create_vector)(int count, + int blocklength, + MPI_Aint stride, + int strideinbytes, + MPI_Datatype oldtype, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); +int PREPEND_PREFIX(Dataloop_create_blockindexed)(int count, + int blklen, + void *disp_array, + int dispinbytes, + MPI_Datatype oldtype, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); +int PREPEND_PREFIX(Dataloop_create_indexed)(int count, + int *blocklength_array, + void *displacement_array, + int dispinbytes, + MPI_Datatype oldtype, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); +int PREPEND_PREFIX(Dataloop_create_struct)(int count, + int *blklen_array, + MPI_Aint *disp_array, + MPI_Datatype *oldtype_array, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); +int PREPEND_PREFIX(Dataloop_create_pairtype)(MPI_Datatype type, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); + +/* Helper functions for dataloop construction */ +int PREPEND_PREFIX(Type_convert_subarray)(int ndims, + int *array_of_sizes, + int *array_of_subsizes, + int *array_of_starts, + int order, + MPI_Datatype oldtype, + MPI_Datatype *newtype); +int PREPEND_PREFIX(Type_convert_darray)(int size, + int rank, + int ndims, + int *array_of_gsizes, + int *array_of_distribs, + int *array_of_dargs, + int *array_of_psizes, + int order, + MPI_Datatype oldtype, + MPI_Datatype *newtype); + +#endif diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_blockindexed.c b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_blockindexed.c new file mode 100644 index 0000000000..0cbcc96f6a --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_blockindexed.c @@ -0,0 +1,325 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include + +#include "./dataloop.h" + +static DLOOP_Count DLOOP_Type_blockindexed_count_contig(DLOOP_Count count, + DLOOP_Count blklen, + void *disp_array, + int dispinbytes, + DLOOP_Offset old_extent); + +static void DLOOP_Type_blockindexed_array_copy(DLOOP_Count count, + void *disp_array, + DLOOP_Offset *out_disp_array, + int dispinbytes, + DLOOP_Offset old_extent); + +/*@ + Dataloop_create_blockindexed - create blockindexed dataloop + + Arguments: ++ int count +. void *displacement_array (array of either MPI_Aints or ints) +. int displacement_in_bytes (boolean) +. MPI_Datatype old_type +. DLOOP_Dataloop **output_dataloop_ptr +. int output_dataloop_size +. int output_dataloop_depth +- int flag + +.N Errors +.N Returns 0 on success, -1 on failure. +@*/ +int PREPEND_PREFIX(Dataloop_create_blockindexed)(int icount, + int iblklen, + void *disp_array, + int dispinbytes, + DLOOP_Type oldtype, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + int err, is_builtin, is_vectorizable = 1; + int i, new_loop_sz, old_loop_depth; + + DLOOP_Count contig_count, count, blklen; + DLOOP_Offset old_extent, eff_disp0, eff_disp1, last_stride; + DLOOP_Dataloop *new_dlp; + + count = (DLOOP_Count) icount; /* avoid subsequent casting */ + blklen = (DLOOP_Count) iblklen; + + /* if count or blklen are zero, handle with contig code, call it a int */ + if (count == 0 || blklen == 0) + { + err = PREPEND_PREFIX(Dataloop_create_contiguous)(0, + MPI_INT, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + + is_builtin = (DLOOP_Handle_hasloop_macro(oldtype)) ? 0 : 1; + + if (is_builtin) + { + DLOOP_Handle_get_size_macro(oldtype, old_extent); + old_loop_depth = 0; + } + else + { + DLOOP_Handle_get_extent_macro(oldtype, old_extent); + DLOOP_Handle_get_loopdepth_macro(oldtype, old_loop_depth, flag); + } + + contig_count = DLOOP_Type_blockindexed_count_contig(count, + blklen, + disp_array, + dispinbytes, + old_extent); + + /* optimization: + * + * if contig_count == 1 and block starts at displacement 0, + * store it as a contiguous rather than a blockindexed dataloop. + */ + if ((contig_count == 1) && + ((!dispinbytes && ((int *) disp_array)[0] == 0) || + (dispinbytes && ((MPI_Aint *) disp_array)[0] == 0))) + { + err = PREPEND_PREFIX(Dataloop_create_contiguous)(icount * iblklen, + oldtype, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + + /* optimization: + * + * if contig_count == 1 store it as a blockindexed with one + * element rather than as a lot of individual blocks. + */ + if (contig_count == 1) + { + /* adjust count and blklen and drop through */ + blklen *= count; + count = 1; + iblklen *= icount; + icount = 1; + } + + /* optimization: + * + * if displacements start at zero and result in a fixed stride, + * store it as a vector rather than a blockindexed dataloop. + */ + eff_disp0 = (dispinbytes) ? ((DLOOP_Offset) ((MPI_Aint *) disp_array)[0]) : + (((DLOOP_Offset) ((int *) disp_array)[0]) * old_extent); + + if (count > 1 && eff_disp0 == (DLOOP_Offset) 0) + { + eff_disp1 = (dispinbytes) ? + ((DLOOP_Offset) ((MPI_Aint *) disp_array)[1]) : + (((DLOOP_Offset) ((int *) disp_array)[1]) * old_extent); + last_stride = eff_disp1 - eff_disp0; + + for (i=2; i < count; i++) { + eff_disp0 = eff_disp1; + eff_disp1 = (dispinbytes) ? + ((DLOOP_Offset) ((MPI_Aint *) disp_array)[i]) : + (((DLOOP_Offset) ((int *) disp_array)[i]) * old_extent); + if (eff_disp1 - eff_disp0 != last_stride) { + is_vectorizable = 0; + break; + } + } + if (is_vectorizable) + { + err = PREPEND_PREFIX(Dataloop_create_vector)(count, + blklen, + last_stride, + 1, /* strideinbytes */ + oldtype, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + } + + /* TODO: optimization: + * + * if displacements result in a fixed stride, but first displacement + * is not zero, store it as a blockindexed (blklen == 1) of a vector. + */ + + /* TODO: optimization: + * + * if a blockindexed of a contig, absorb the contig into the blocklen + * parameter and keep the same overall depth + */ + + /* otherwise storing as a blockindexed dataloop */ + + /* Q: HOW CAN WE TELL IF IT IS WORTH IT TO STORE AS AN + * INDEXED WITH FEWER CONTIG BLOCKS (IF CONTIG_COUNT IS SMALL)? + */ + + if (is_builtin) + { + PREPEND_PREFIX(Dataloop_alloc)(DLOOP_KIND_BLOCKINDEXED, + count, + &new_dlp, + &new_loop_sz); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) return -1; + /* --END ERROR HANDLING-- */ + + new_dlp->kind = DLOOP_KIND_BLOCKINDEXED | DLOOP_FINAL_MASK; + + if (flag == DLOOP_DATALOOP_ALL_BYTES) + { + blklen *= old_extent; + new_dlp->el_size = 1; + new_dlp->el_extent = 1; + new_dlp->el_type = MPI_BYTE; + } + else + { + new_dlp->el_size = old_extent; + new_dlp->el_extent = old_extent; + new_dlp->el_type = oldtype; + } + } + else + { + DLOOP_Dataloop *old_loop_ptr = NULL; + int old_loop_sz = 0; + + DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag); + DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag); + + PREPEND_PREFIX(Dataloop_alloc_and_copy)(DLOOP_KIND_BLOCKINDEXED, + count, + old_loop_ptr, + old_loop_sz, + &new_dlp, + &new_loop_sz); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) return -1; + /* --END ERROR HANDLING-- */ + + new_dlp->kind = DLOOP_KIND_BLOCKINDEXED; + + DLOOP_Handle_get_size_macro(oldtype, new_dlp->el_size); + DLOOP_Handle_get_extent_macro(oldtype, new_dlp->el_extent); + DLOOP_Handle_get_basic_type_macro(oldtype, new_dlp->el_type); + } + + new_dlp->loop_params.bi_t.count = count; + new_dlp->loop_params.bi_t.blocksize = blklen; + + /* copy in displacement parameters + * + * regardless of dispinbytes, we store displacements in bytes in loop. + */ + DLOOP_Type_blockindexed_array_copy(count, + disp_array, + new_dlp->loop_params.bi_t.offset_array, + dispinbytes, + old_extent); + + *dlp_p = new_dlp; + *dlsz_p = new_loop_sz; + *dldepth_p = old_loop_depth + 1; + + return 0; +} + +/* DLOOP_Type_blockindexed_array_copy + * + * Unlike the indexed version, this one does not compact adjacent + * blocks, because that would really mess up the blockindexed type! + */ +static void DLOOP_Type_blockindexed_array_copy(DLOOP_Count count, + void *in_disp_array, + DLOOP_Offset *out_disp_array, + int dispinbytes, + DLOOP_Offset old_extent) +{ + int i; + if (!dispinbytes) + { + for (i=0; i < count; i++) + { + out_disp_array[i] = + ((DLOOP_Offset) ((int *) in_disp_array)[i]) * old_extent; + } + } + else + { + for (i=0; i < count; i++) + { + out_disp_array[i] = + ((DLOOP_Offset) ((MPI_Aint *) in_disp_array)[i]); + } + } + return; +} + +static DLOOP_Count DLOOP_Type_blockindexed_count_contig(DLOOP_Count count, + DLOOP_Count blklen, + void *disp_array, + int dispinbytes, + DLOOP_Offset old_extent) +{ + int i, contig_count = 1; + + if (!dispinbytes) + { + /* this is from the MPI type, is of type int */ + DLOOP_Offset cur_tdisp = (DLOOP_Offset) ((int *) disp_array)[0]; + + for (i=1; i < count; i++) + { + DLOOP_Offset next_tdisp = (DLOOP_Offset) ((int *) disp_array)[i]; + + if (cur_tdisp + blklen != next_tdisp) + { + contig_count++; + } + cur_tdisp = next_tdisp; + } + } + else + { + /* this is from the MPI type, is of type MPI_Aint */ + DLOOP_Offset cur_bdisp = (DLOOP_Offset) ((MPI_Aint *) disp_array)[0]; + + for (i=1; i < count; i++) + { + DLOOP_Offset next_bdisp = + (DLOOP_Offset) ((MPI_Aint *) disp_array)[i]; + + if (cur_bdisp + (DLOOP_Offset) blklen * old_extent != next_bdisp) + { + contig_count++; + } + cur_bdisp = next_bdisp; + } + } + return contig_count; +} diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_contig.c b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_contig.c new file mode 100644 index 0000000000..68630a3ae0 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_contig.c @@ -0,0 +1,160 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include "./dataloop.h" + +/*@ + Dataloop_contiguous - create the dataloop representation for a + contiguous datatype + + Arguments: ++ int icount, +. MPI_Datatype oldtype, +. DLOOP_Dataloop **dlp_p, +. int *dlsz_p, +. int *dldepth_p, +- int flag + +.N Errors +.N Returns 0 on success, -1 on failure. +@*/ +int PREPEND_PREFIX(Dataloop_create_contiguous)(int icount, + DLOOP_Type oldtype, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + DLOOP_Count count; + int is_builtin, apply_contig_coalescing = 0; + int new_loop_sz, new_loop_depth; + + DLOOP_Dataloop *new_dlp; + + count = (DLOOP_Count) icount; /* avoid subsequent casting */ + + is_builtin = (DLOOP_Handle_hasloop_macro(oldtype)) ? 0 : 1; + + if (is_builtin) + { + new_loop_depth = 1; + } + else + { + int old_loop_sz = 0, old_loop_depth = 0; + DLOOP_Offset old_size = 0, old_extent = 0; + DLOOP_Dataloop *old_loop_ptr; + + DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag); + DLOOP_Handle_get_loopdepth_macro(oldtype, old_loop_depth, flag); + DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag); + DLOOP_Handle_get_size_macro(oldtype, old_size); + DLOOP_Handle_get_extent_macro(oldtype, old_extent); + + /* if we have a simple combination of contigs, coalesce */ + if (((old_loop_ptr->kind & DLOOP_KIND_MASK) == DLOOP_KIND_CONTIG) + && (old_size == old_extent)) + { + /* will just copy contig and multiply count */ + apply_contig_coalescing = 1; + new_loop_depth = old_loop_depth; + } + else + { + new_loop_depth = old_loop_depth + 1; + } + } + + if (is_builtin) + { + DLOOP_Offset basic_sz = 0; + + PREPEND_PREFIX(Dataloop_alloc)(DLOOP_KIND_CONTIG, + count, + &new_dlp, + &new_loop_sz); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) return -1; + /* --END ERROR HANDLING-- */ + + DLOOP_Handle_get_size_macro(oldtype, basic_sz); + new_dlp->kind = DLOOP_KIND_CONTIG | DLOOP_FINAL_MASK; + + if (flag == DLOOP_DATALOOP_ALL_BYTES) + { + count *= basic_sz; + new_dlp->el_size = 1; + new_dlp->el_extent = 1; + new_dlp->el_type = MPI_BYTE; + } + else + { + new_dlp->el_size = basic_sz; + new_dlp->el_extent = new_dlp->el_size; + new_dlp->el_type = oldtype; + } + + new_dlp->loop_params.c_t.count = count; + } + else + { + /* user-defined base type (oldtype) */ + DLOOP_Dataloop *old_loop_ptr; + int old_loop_sz = 0; + + DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag); + DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag); + + if (apply_contig_coalescing) + { + /* make a copy of the old loop and multiply the count */ + PREPEND_PREFIX(Dataloop_dup)(old_loop_ptr, + old_loop_sz, + &new_dlp); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) return -1; + /* --END ERROR HANDLING-- */ + + new_dlp->loop_params.c_t.count *= count; + + new_loop_sz = old_loop_sz; + DLOOP_Handle_get_loopdepth_macro(oldtype, new_loop_depth, flag); + } + else + { + DLOOP_Dataloop *old_loop_ptr; + int old_loop_sz = 0; + + DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag); + DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag); + + /* allocate space for new loop including copy of old */ + PREPEND_PREFIX(Dataloop_alloc_and_copy)(DLOOP_KIND_CONTIG, + count, + old_loop_ptr, + old_loop_sz, + &new_dlp, + &new_loop_sz); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) return -1; + /* --END ERROR HANDLING-- */ + + new_dlp->kind = DLOOP_KIND_CONTIG; + DLOOP_Handle_get_size_macro(oldtype, new_dlp->el_size); + DLOOP_Handle_get_extent_macro(oldtype, new_dlp->el_extent); + DLOOP_Handle_get_basic_type_macro(oldtype, new_dlp->el_type); + + new_dlp->loop_params.c_t.count = count; + } + } + + *dlp_p = new_dlp; + *dlsz_p = new_loop_sz; + *dldepth_p = new_loop_depth; + + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_indexed.c b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_indexed.c new file mode 100644 index 0000000000..18cb0dd282 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_indexed.c @@ -0,0 +1,429 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include + +#include "./dataloop.h" + +static DLOOP_Count DLOOP_Type_indexed_count_contig(DLOOP_Count count, + int *blocklength_array, + void *displacement_array, + int dispinbytes, + DLOOP_Offset old_extent); + +static void DLOOP_Type_indexed_array_copy(DLOOP_Count count, + DLOOP_Count contig_count, + int *input_blocklength_array, + void *input_displacement_array, + DLOOP_Count *output_blocklength_array, + DLOOP_Offset *out_disp_array, + int dispinbytes, + DLOOP_Offset old_extent); + +/*@ + DLOOP_Dataloop_create_indexed + + Arguments: ++ int icount +. int *iblocklength_array +. void *displacement_array (either ints or MPI_Aints) +. int dispinbytes +. MPI_Datatype oldtype +. DLOOP_Dataloop **dlp_p +. int *dlsz_p +. int *dldepth_p +- int flag + +.N Errors +.N Returns 0 on success, -1 on error. +@*/ + +int PREPEND_PREFIX(Dataloop_create_indexed)(int icount, + int *blocklength_array, + void *displacement_array, + int dispinbytes, + MPI_Datatype oldtype, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + int err, is_builtin; + int i, new_loop_sz, old_loop_depth, blksz; + + DLOOP_Count old_type_count = 0, contig_count, count; + DLOOP_Offset old_extent; + struct DLOOP_Dataloop *new_dlp; + + count = (DLOOP_Count) icount; /* avoid subsequent casting */ + + + /* if count is zero, handle with contig code, call it an int */ + if (count == 0) + { + err = PREPEND_PREFIX(Dataloop_create_contiguous)(0, + MPI_INT, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + + is_builtin = (DLOOP_Handle_hasloop_macro(oldtype)) ? 0 : 1; + + if (is_builtin) + { + DLOOP_Handle_get_extent_macro(oldtype, old_extent); + old_loop_depth = 0; + } + else + { + DLOOP_Handle_get_extent_macro(oldtype, old_extent); + DLOOP_Handle_get_loopdepth_macro(oldtype, old_loop_depth, flag); + } + + for (i=0; i < count; i++) + { + old_type_count += (DLOOP_Count) blocklength_array[i]; + } + + contig_count = DLOOP_Type_indexed_count_contig(count, + blocklength_array, + displacement_array, + dispinbytes, + old_extent); + + /* if contig_count is zero (no data), handle with contig code */ + if (contig_count == 0) + { + err = PREPEND_PREFIX(Dataloop_create_contiguous)(0, + MPI_INT, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + + /* optimization: + * + * if contig_count == 1 and block starts at displacement 0, + * store it as a contiguous rather than an indexed dataloop. + */ + if ((contig_count == 1) && + ((!dispinbytes && ((int *) displacement_array)[0] == 0) || + (dispinbytes && ((MPI_Aint *) displacement_array)[0] == 0))) + { + err = PREPEND_PREFIX(Dataloop_create_contiguous)((int) old_type_count, + oldtype, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + + /* optimization: + * + * if contig_count == 1 (and displacement != 0), store this as + * a single element blockindexed rather than a lot of individual + * blocks. + */ + if (contig_count == 1) + { + err = PREPEND_PREFIX(Dataloop_create_blockindexed)(1, + (int) old_type_count, + displacement_array, + dispinbytes, + oldtype, + dlp_p, + dlsz_p, + dldepth_p, + flag); + + return err; + } + + /* optimization: + * + * if block length is the same for all blocks, store it as a + * blockindexed rather than an indexed dataloop. + */ + blksz = blocklength_array[0]; + for (i=1; i < count; i++) + { + if (blocklength_array[i] != blksz) + { + blksz--; + break; + } + } + if (blksz == blocklength_array[0]) + { + err = PREPEND_PREFIX(Dataloop_create_blockindexed)(icount, + blksz, + displacement_array, + dispinbytes, + oldtype, + dlp_p, + dlsz_p, + dldepth_p, + flag); + + return err; + } + + /* note: blockindexed looks for the vector optimization */ + + /* TODO: optimization: + * + * if an indexed of a contig, absorb the contig into the blocklen array + * and keep the same overall depth + */ + + /* otherwise storing as an indexed dataloop */ + + if (is_builtin) + { + PREPEND_PREFIX(Dataloop_alloc)(DLOOP_KIND_INDEXED, + count, + &new_dlp, + &new_loop_sz); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) return -1; + /* --END ERROR HANDLING-- */ + + new_dlp->kind = DLOOP_KIND_INDEXED | DLOOP_FINAL_MASK; + + if (flag == DLOOP_DATALOOP_ALL_BYTES) + { + /* blocklengths are modified below */ + new_dlp->el_size = 1; + new_dlp->el_extent = 1; + new_dlp->el_type = MPI_BYTE; + } + else + { + new_dlp->el_size = old_extent; + new_dlp->el_extent = old_extent; + new_dlp->el_type = oldtype; + } + } + else + { + DLOOP_Dataloop *old_loop_ptr = NULL; + int old_loop_sz = 0; + + DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag); + DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag); + + PREPEND_PREFIX(Dataloop_alloc_and_copy)(DLOOP_KIND_INDEXED, + contig_count, + old_loop_ptr, + old_loop_sz, + &new_dlp, + &new_loop_sz); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) return -1; + /* --END ERROR HANDLING-- */ + + new_dlp->kind = DLOOP_KIND_INDEXED; + + DLOOP_Handle_get_size_macro(oldtype, new_dlp->el_size); + DLOOP_Handle_get_extent_macro(oldtype, new_dlp->el_extent); + DLOOP_Handle_get_basic_type_macro(oldtype, new_dlp->el_type); + } + + new_dlp->loop_params.i_t.count = contig_count; + new_dlp->loop_params.i_t.total_blocks = old_type_count; + + /* copy in blocklength and displacement parameters (in that order) + * + * regardless of dispinbytes, we store displacements in bytes in loop. + */ + DLOOP_Type_indexed_array_copy(count, + contig_count, + blocklength_array, + displacement_array, + new_dlp->loop_params.i_t.blocksize_array, + new_dlp->loop_params.i_t.offset_array, + dispinbytes, + old_extent); + + if (is_builtin && (flag == DLOOP_DATALOOP_ALL_BYTES)) + { + DLOOP_Count *tmp_blklen_array = + new_dlp->loop_params.i_t.blocksize_array; + + for (i=0; i < contig_count; i++) + { + /* increase block lengths so they are in bytes */ + tmp_blklen_array[i] *= old_extent; + } + } + + *dlp_p = new_dlp; + *dlsz_p = new_loop_sz; + *dldepth_p = old_loop_depth + 1; + + return MPI_SUCCESS; +} + +/* DLOOP_Type_indexed_array_copy() + * + * Copies arrays into place, combining adjacent contiguous regions and + * dropping zero-length regions. + * + * Extent passed in is for the original type. + * + * Output displacements are always output in bytes, while block + * lengths are always output in terms of the base type. + */ +static void DLOOP_Type_indexed_array_copy(DLOOP_Count count, + DLOOP_Count contig_count, + int *in_blklen_array, + void *in_disp_array, + DLOOP_Count *out_blklen_array, + DLOOP_Offset *out_disp_array, + int dispinbytes, + DLOOP_Offset old_extent) +{ + DLOOP_Count i, cur_idx = 0; + + out_blklen_array[0] = (DLOOP_Count) in_blklen_array[0]; + + if (!dispinbytes) + { + out_disp_array[0] = (DLOOP_Offset) + ((int *) in_disp_array)[0] * old_extent; + + for (i = 1; i < count; i++) + { + if (in_blklen_array[i] == 0) + { + continue; + } + else if (out_disp_array[cur_idx] + + ((DLOOP_Offset) out_blklen_array[cur_idx]) * old_extent == + ((DLOOP_Offset) ((int *) in_disp_array)[i]) * old_extent) + { + /* adjacent to current block; add to block */ + out_blklen_array[cur_idx] += (DLOOP_Count) in_blklen_array[i]; + } + else + { + cur_idx++; + DLOOP_Assert(cur_idx < contig_count); + out_disp_array[cur_idx] = + ((DLOOP_Offset) ((int *) in_disp_array)[i]) * old_extent; + out_blklen_array[cur_idx] = in_blklen_array[i]; + } + } + } + else /* input displacements already in bytes */ + { + out_disp_array[0] = (DLOOP_Offset) ((MPI_Aint *) in_disp_array)[0]; + + for (i = 1; i < count; i++) + { + if (in_blklen_array[i] == 0) + { + continue; + } + else if (out_disp_array[cur_idx] + + ((DLOOP_Offset) out_blklen_array[cur_idx]) * old_extent == + ((DLOOP_Offset) ((MPI_Aint *) in_disp_array)[i])) + { + /* adjacent to current block; add to block */ + out_blklen_array[cur_idx] += in_blklen_array[i]; + } + else + { + cur_idx++; + DLOOP_Assert(cur_idx < contig_count); + out_disp_array[cur_idx] = + (DLOOP_Offset) ((MPI_Aint *) in_disp_array)[i]; + out_blklen_array[cur_idx] = (DLOOP_Count) in_blklen_array[i]; + } + } + } + + DLOOP_Assert(cur_idx == contig_count - 1); + return; +} + +/* DLOOP_Type_indexed_count_contig() + * + * Determines the actual number of contiguous blocks represented by the + * blocklength/displacement arrays. This might be less than count (as + * few as 1). + * + * Extent passed in is for the original type. + */ +static DLOOP_Count DLOOP_Type_indexed_count_contig(DLOOP_Count count, + int *blocklength_array, + void *displacement_array, + int dispinbytes, + DLOOP_Offset old_extent) +{ + DLOOP_Count i, contig_count = 1; + DLOOP_Count cur_blklen = (DLOOP_Count) blocklength_array[0]; + + if (!dispinbytes) + { + DLOOP_Offset cur_tdisp = + (DLOOP_Offset) ((int *) displacement_array)[0]; + + for (i = 1; i < count; i++) + { + if (blocklength_array[i] == 0) + { + continue; + } + else if (cur_tdisp + cur_blklen == + (DLOOP_Offset) ((int *) displacement_array)[i]) + { + /* adjacent to current block; add to block */ + cur_blklen += (DLOOP_Count) blocklength_array[i]; + } + else + { + cur_tdisp = (DLOOP_Offset) ((int *) displacement_array)[i]; + cur_blklen = (DLOOP_Count) blocklength_array[i]; + contig_count++; + } + } + } + else + { + DLOOP_Offset cur_bdisp = + (DLOOP_Offset) ((MPI_Aint *) displacement_array)[0]; + + for (i = 1; i < count; i++) + { + if (blocklength_array[i] == 0) + { + continue; + } + else if (cur_bdisp + cur_blklen * old_extent == + (DLOOP_Offset) ((MPI_Aint *) displacement_array)[i]) + { + /* adjacent to current block; add to block */ + cur_blklen += (DLOOP_Count) blocklength_array[i]; + } + else + { + cur_bdisp = + (DLOOP_Offset) ((MPI_Aint *) displacement_array)[i]; + cur_blklen = (DLOOP_Count) blocklength_array[i]; + contig_count++; + } + } + } + return contig_count; +} diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_pairtype.c b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_pairtype.c new file mode 100644 index 0000000000..acf3ef0a7a --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_pairtype.c @@ -0,0 +1,82 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include "dataloop.h" + +#define PAIRTYPE_CONTENTS(mt1_,ut1_,mt2_,ut2_) \ + { \ + struct { ut1_ a; ut2_ b; } foo; \ + disps[0] = 0; \ + disps[1] = (MPI_Aint) ((char *) &foo.b - (char *) &foo.a); \ + types[0] = mt1_; \ + types[1] = mt2_; \ + } + +/*@ + Dataloop_create_pairtype - create dataloop for a pairtype + + Arguments: ++ MPI_Datatype type - the pairtype +. DLOOP_Dataloop **output_dataloop_ptr +. int output_dataloop_size +. int output_dataloop_depth +- int flag + +.N Errors +.N Returns 0 on success, -1 on failure. + + Note: + This function simply creates the appropriate input parameters for + use with Dataloop_create_struct and then calls that function. + + This same function could be used to create dataloops for any type + that actually consists of two distinct elements. +@*/ +int PREPEND_PREFIX(Dataloop_create_pairtype)(MPI_Datatype type, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + int blocks[2] = { 1, 1 }; + MPI_Aint disps[2]; + MPI_Datatype types[2]; + + DLOOP_Assert(type == MPI_FLOAT_INT || type == MPI_DOUBLE_INT || + type == MPI_LONG_INT || type == MPI_SHORT_INT || + type == MPI_LONG_DOUBLE_INT || type == MPI_2INT); + + switch(type) { + case MPI_FLOAT_INT: + PAIRTYPE_CONTENTS(MPI_FLOAT, float, MPI_INT, int); + break; + case MPI_DOUBLE_INT: + PAIRTYPE_CONTENTS(MPI_DOUBLE, double, MPI_INT, int); + break; + case MPI_LONG_INT: + PAIRTYPE_CONTENTS(MPI_LONG, long, MPI_INT, int); + break; + case MPI_SHORT_INT: + PAIRTYPE_CONTENTS(MPI_SHORT, short, MPI_INT, int); + break; + case MPI_LONG_DOUBLE_INT: + PAIRTYPE_CONTENTS(MPI_LONG_DOUBLE, long double, MPI_INT, int); + break; + case MPI_2INT: + PAIRTYPE_CONTENTS(MPI_INT, int, MPI_INT, int); + break; + } + + return PREPEND_PREFIX(Dataloop_create_struct)(2, + blocks, + disps, + types, + dlp_p, + dlsz_p, + dldepth_p, + flag); +} diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_struct.c b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_struct.c new file mode 100644 index 0000000000..af3a1f1274 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_struct.c @@ -0,0 +1,672 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include "./dataloop.h" + +#ifndef PREPEND_PREFIX +#error "You must explicitly include a header that sets the PREPEND_PREFIX and includes dataloop_parts.h" +#endif + +static int DLOOP_Dataloop_create_struct_memory_error(void); +static int DLOOP_Dataloop_create_unique_type_struct(int count, + int *blklens, + MPI_Aint *disps, + DLOOP_Type *oldtypes, + int type_pos, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); +static int DLOOP_Dataloop_create_basic_all_bytes_struct( + int count, + int *blklens, + MPI_Aint *disps, + DLOOP_Type *oldtypes, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); +static int DLOOP_Dataloop_create_flattened_struct(int count, + int *blklens, + MPI_Aint *disps, + DLOOP_Type *oldtypes, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag); + +/*@ + Dataloop_create_struct - create the dataloop representation for a + struct datatype + + Input Parameters: ++ count - number of blocks in vector +. blklens - number of elements in each block +. disps - offsets of blocks from start of type in bytes +- oldtypes - types (using handle) of datatypes on which vector is based + + Output Parameters: ++ dlp_p - pointer to address in which to place pointer to new dataloop +- dlsz_p - pointer to address in which to place size of new dataloop + + Return Value: + 0 on success, -1 on failure. + + Notes: + This function relies on others, like Dataloop_create_indexed, to create + types in some cases. This call (like all the rest) takes int blklens + and MPI_Aint displacements, so it's possible to overflow when working + with a particularly large struct type in some cases. This isn't detected + or corrected in this code at this time. + +@*/ +int PREPEND_PREFIX(Dataloop_create_struct)(int count, + int *blklens, + MPI_Aint *disps, + DLOOP_Type *oldtypes, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + int err, i, nr_basics = 0, nr_derived = 0, type_pos = 0; + + DLOOP_Type first_basic = MPI_DATATYPE_NULL, + first_derived = MPI_DATATYPE_NULL; + + /* variables used in general case only */ + int loop_idx, new_loop_sz, new_loop_depth; + int old_loop_sz = 0, old_loop_depth = 0; + + DLOOP_Dataloop *new_dlp, *curpos; + + /* if count is zero, handle with contig code, call it a int */ + if (count == 0) + { + err = PREPEND_PREFIX(Dataloop_create_contiguous)(0, + MPI_INT, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + + /* browse the old types and characterize */ + for (i=0; i < count; i++) + { + /* ignore type elements with a zero blklen */ + if (blklens[i] == 0) continue; + + if (oldtypes[i] != MPI_LB && oldtypes[i] != MPI_UB) + { + int is_builtin; + + is_builtin = + (DLOOP_Handle_hasloop_macro(oldtypes[i])) ? 0 : 1; + + if (is_builtin) + { + if (nr_basics == 0) + { + first_basic = oldtypes[i]; + type_pos = i; + } + else if (oldtypes[i] != first_basic) + { + first_basic = MPI_DATATYPE_NULL; + } + nr_basics++; + } + else /* derived type */ + { + if (nr_derived == 0) + { + first_derived = oldtypes[i]; + type_pos = i; + } + else if (oldtypes[i] != first_derived) + { + first_derived = MPI_DATATYPE_NULL; + } + nr_derived++; + } + } + } + + /* note on optimizations: + * + * because LB, UB, and extent calculations are handled as part of + * the Datatype, we can safely ignore them in all our calculations + * here. + */ + + /* optimization: + * + * if there were only MPI_LBs and MPI_UBs in the struct type, + * treat it as a zero-element contiguous (just as count == 0). + */ + if (nr_basics == 0 && nr_derived == 0) + { + err = PREPEND_PREFIX(Dataloop_create_contiguous)(0, + MPI_INT, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + + /* optimization: + * + * if there is only one unique instance of a type in the struct, treat it + * as a blockindexed type. + * + * notes: + * + * if the displacement happens to be zero, the blockindexed code will + * optimize this into a contig. + */ + if (nr_basics + nr_derived == 1) + { + /* type_pos is index to only real type in array */ + err = PREPEND_PREFIX(Dataloop_create_blockindexed) + (1, /* count */ + blklens[type_pos], + &disps[type_pos], + 1, /* displacement in bytes */ + oldtypes[type_pos], + dlp_p, + dlsz_p, + dldepth_p, + flag); + + return err; + } + + /* optimization: + * + * if there only one unique type (more than one instance) in the + * struct, treat it as an indexed type. + * + * notes: + * + * this will apply to a single type with an LB/UB, as those + * are handled elsewhere. + * + */ + if (((nr_derived == 0) && (first_basic != MPI_DATATYPE_NULL)) || + ((nr_basics == 0) && (first_derived != MPI_DATATYPE_NULL))) + { + return DLOOP_Dataloop_create_unique_type_struct(count, + blklens, + disps, + oldtypes, + type_pos, + dlp_p, + dlsz_p, + dldepth_p, + flag); + } + + /* optimization: + * + * if there are no derived types and caller indicated either a + * homogeneous system or the "all bytes" conversion, convert + * everything to bytes and use an indexed type. + */ + if (nr_derived == 0 && ((flag == DLOOP_DATALOOP_HOMOGENEOUS) || + (flag == DLOOP_DATALOOP_ALL_BYTES))) + { + return DLOOP_Dataloop_create_basic_all_bytes_struct(count, + blklens, + disps, + oldtypes, + dlp_p, + dlsz_p, + dldepth_p, + flag); + } + + /* optimization: + * + * if caller asked for homogeneous or all bytes representation, + * flatten the type and store it as an indexed type so that + * there are no branches in the dataloop tree. + */ + if ((flag == DLOOP_DATALOOP_HOMOGENEOUS) || + (flag == DLOOP_DATALOOP_ALL_BYTES)) + { + return DLOOP_Dataloop_create_flattened_struct(count, + blklens, + disps, + oldtypes, + dlp_p, + dlsz_p, + dldepth_p, + flag); + } + + /* scan through types and gather derived type info */ + for (i=0; i < count; i++) + { + /* ignore type elements with a zero blklen */ + if (blklens[i] == 0) continue; + + if (DLOOP_Handle_hasloop_macro(oldtypes[i])) + { + int tmp_loop_depth, tmp_loop_sz; + + DLOOP_Handle_get_loopdepth_macro(oldtypes[i], tmp_loop_depth, flag); + DLOOP_Handle_get_loopsize_macro(oldtypes[i], tmp_loop_sz, flag); + + if (tmp_loop_depth > old_loop_depth) + { + old_loop_depth = tmp_loop_depth; + } + old_loop_sz += tmp_loop_sz; + } + } + + /* general case below: 2 or more distinct types that are either + * basics or derived, and for which we want to preserve the types + * themselves. + */ + + if (nr_basics > 0) + { + /* basics introduce an extra level of depth, so if our new depth + * must be at least 2 if there are basics. + */ + new_loop_depth = ((old_loop_depth+1) > 2) ? (old_loop_depth+1) : 2; + } + else + { + new_loop_depth = old_loop_depth + 1; + } + + PREPEND_PREFIX(Dataloop_struct_alloc)((DLOOP_Count) nr_basics + nr_derived, + old_loop_sz, + nr_basics, + &curpos, + &new_dlp, + &new_loop_sz); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) + { + return DLOOP_Dataloop_create_struct_memory_error(); + } + /* --END ERROR HANDLING-- */ + + + new_dlp->kind = DLOOP_KIND_STRUCT; + new_dlp->el_size = -1; /* not valid for struct */ + new_dlp->el_extent = -1; /* not valid for struct; see el_extent_array */ + new_dlp->el_type = MPI_DATATYPE_NULL; /* not valid for struct */ + + new_dlp->loop_params.s_t.count = (DLOOP_Count) nr_basics + nr_derived; + + /* note: curpos points to first byte in "old dataloop" region of + * newly allocated space. + */ + + for (i=0, loop_idx = 0; i < count; i++) + { + int is_builtin; + + /* ignore type elements with a zero blklen */ + if (blklens[i] == 0) continue; + + is_builtin = (DLOOP_Handle_hasloop_macro(oldtypes[i])) ? 0 : 1; + + if (is_builtin) + { + DLOOP_Dataloop *dummy_dlp; + int dummy_sz, dummy_depth; + + /* LBs and UBs already taken care of -- skip them */ + if (oldtypes[i] == MPI_LB || oldtypes[i] == MPI_UB) + { + continue; + } + + /* build a contig dataloop for this basic and point to that + * + * optimization: + * + * push the count (blklen) from the struct down into the + * contig so we can process more at the leaf. + */ + err = PREPEND_PREFIX(Dataloop_create_contiguous)(blklens[i], + oldtypes[i], + &dummy_dlp, + &dummy_sz, + &dummy_depth, + flag); + + /* --BEGIN ERROR HANDLING-- */ + if (err) { + /* TODO: FREE ALLOCATED RESOURCES */ + return -1; + } + /* --END ERROR HANDLING-- */ + + /* copy the new contig loop into place in the struct memory + * region + */ + PREPEND_PREFIX(Dataloop_copy)(curpos, dummy_dlp, dummy_sz); + new_dlp->loop_params.s_t.dataloop_array[loop_idx] = curpos; + curpos = (DLOOP_Dataloop *) ((char *) curpos + dummy_sz); + + /* we stored the block size in the contig -- use 1 here */ + new_dlp->loop_params.s_t.blocksize_array[loop_idx] = 1; + new_dlp->loop_params.s_t.el_extent_array[loop_idx] = + ((DLOOP_Offset) blklens[i]) * dummy_dlp->el_extent; + PREPEND_PREFIX(Dataloop_free)(&dummy_dlp); + } + else + { + DLOOP_Dataloop *old_loop_ptr; + int old_loop_sz; + DLOOP_Offset old_extent; + + DLOOP_Handle_get_loopptr_macro(oldtypes[i], old_loop_ptr, flag); + DLOOP_Handle_get_loopsize_macro(oldtypes[i], old_loop_sz, flag); + DLOOP_Handle_get_extent_macro(oldtypes[i], old_extent); + + PREPEND_PREFIX(Dataloop_copy)(curpos, old_loop_ptr, old_loop_sz); + new_dlp->loop_params.s_t.dataloop_array[loop_idx] = curpos; + curpos = (DLOOP_Dataloop *) ((char *) curpos + old_loop_sz); + + new_dlp->loop_params.s_t.blocksize_array[loop_idx] = + (DLOOP_Count) blklens[i]; + new_dlp->loop_params.s_t.el_extent_array[loop_idx] = + old_extent; + } + new_dlp->loop_params.s_t.offset_array[loop_idx] = + (DLOOP_Offset) disps[i]; + loop_idx++; + } + + *dlp_p = new_dlp; + *dlsz_p = new_loop_sz; + *dldepth_p = new_loop_depth; + + return 0; +} + +/* --BEGIN ERROR HANDLING-- */ +static int DLOOP_Dataloop_create_struct_memory_error(void) +{ + return -1; +} +/* --END ERROR HANDLING-- */ + +static int DLOOP_Dataloop_create_unique_type_struct(int count, + int *blklens, + MPI_Aint *disps, + DLOOP_Type *oldtypes, + int type_pos, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + /* the same type used more than once in the array; type_pos + * indexes to the first of these. + */ + int i, err, *tmp_blklens, cur_pos = 0; + DLOOP_Offset *tmp_disps; + + /* count is an upper bound on number of type instances */ + tmp_blklens = (int *) DLOOP_Malloc(count * sizeof(int)); + /* --BEGIN ERROR HANDLING-- */ + if (!tmp_blklens) { + /* TODO: ??? */ + return DLOOP_Dataloop_create_struct_memory_error(); + } + /* --END ERROR HANDLING-- */ + + tmp_disps = (DLOOP_Offset *) + DLOOP_Malloc(count * sizeof(DLOOP_Offset)); + /* --BEGIN ERROR HANDLING-- */ + if (!tmp_disps) { + DLOOP_Free(tmp_blklens); + /* TODO: ??? */ + return DLOOP_Dataloop_create_struct_memory_error(); + } + /* --END ERROR HANDLING-- */ + + for (i=type_pos; i < count; i++) + { + if (oldtypes[i] == oldtypes[type_pos] && blklens != 0) + { + tmp_blklens[cur_pos] = blklens[i]; + tmp_disps[cur_pos] = disps[i]; + cur_pos++; + } + } + + err = PREPEND_PREFIX(Dataloop_create_indexed)(cur_pos, + tmp_blklens, + tmp_disps, + 1, /* disp in bytes */ + oldtypes[type_pos], + dlp_p, + dlsz_p, + dldepth_p, + flag); + + DLOOP_Free(tmp_blklens); + DLOOP_Free(tmp_disps); + + return err; + +} + +static int DLOOP_Dataloop_create_basic_all_bytes_struct( + int count, + int *blklens, + MPI_Aint *disps, + DLOOP_Type *oldtypes, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + int i, err, cur_pos = 0; + int *tmp_blklens; + MPI_Aint *tmp_disps; + + /* count is an upper bound on number of type instances */ + tmp_blklens = (int *) DLOOP_Malloc(count * sizeof(int)); + + /* --BEGIN ERROR HANDLING-- */ + if (!tmp_blklens) + { + return DLOOP_Dataloop_create_struct_memory_error(); + } + /* --END ERROR HANDLING-- */ + + tmp_disps = (MPI_Aint *) DLOOP_Malloc(count * sizeof(MPI_Aint)); + + /* --BEGIN ERROR HANDLING-- */ + if (!tmp_disps) + { + DLOOP_Free(tmp_blklens); + return DLOOP_Dataloop_create_struct_memory_error(); + } + /* --END ERROR HANDLING-- */ + + for (i=0; i < count; i++) + { + if (oldtypes[i] != MPI_LB && oldtypes[i] != MPI_UB && blklens[i] != 0) + { + DLOOP_Offset sz; + + DLOOP_Handle_get_size_macro(oldtypes[i], sz); + tmp_blklens[cur_pos] = (int) sz * blklens[i]; + tmp_disps[cur_pos] = disps[i]; + cur_pos++; + } + } + err = PREPEND_PREFIX(Dataloop_create_indexed)(cur_pos, + tmp_blklens, + tmp_disps, + 1, /* disp in bytes */ + MPI_BYTE, + dlp_p, + dlsz_p, + dldepth_p, + flag); + + DLOOP_Free(tmp_blklens); + DLOOP_Free(tmp_disps); + + return err; +} + +static int DLOOP_Dataloop_create_flattened_struct(int count, + int *blklens, + MPI_Aint *disps, + DLOOP_Type *oldtypes, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + /* arbitrary types, convert to bytes and use indexed */ + int i, err, *tmp_blklens, nr_blks = 0; + MPI_Aint *tmp_disps; /* since we're calling another fn that takes + this type as an input parameter */ + DLOOP_Offset bytes; + DLOOP_Segment *segp; + + int first_ind, last_ind; + + segp = PREPEND_PREFIX(Segment_alloc)(); + /* --BEGIN ERROR HANDLING-- */ + if (!segp) { + return DLOOP_Dataloop_create_struct_memory_error(); + } + /* --END ERROR HANDLING-- */ + + /* use segment code once to count contiguous regions */ + for (i=0; i < count; i++) + { + int is_basic; + + /* ignore type elements with a zero blklen */ + if (blklens[i] == 0) continue; + + is_basic = (DLOOP_Handle_hasloop_macro(oldtypes[i])) ? 0 : 1; + + if (is_basic && (oldtypes[i] != MPI_LB && + oldtypes[i] != MPI_UB)) + { + nr_blks++; + } + else /* derived type; get a count of contig blocks */ + { + DLOOP_Count tmp_nr_blks; + + PREPEND_PREFIX(Segment_init)(NULL, + (DLOOP_Count) blklens[i], + oldtypes[i], + segp, + flag); + bytes = SEGMENT_IGNORE_LAST; + + PREPEND_PREFIX(Segment_count_contig_blocks)(segp, + 0, + &bytes, + &tmp_nr_blks); + + nr_blks += tmp_nr_blks; + } + } + + nr_blks += 2; /* safety measure */ + + tmp_blklens = (int *) DLOOP_Malloc(nr_blks * sizeof(int)); + /* --BEGIN ERROR HANDLING-- */ + if (!tmp_blklens) { + return DLOOP_Dataloop_create_struct_memory_error(); + } + /* --END ERROR HANDLING-- */ + + + tmp_disps = (MPI_Aint *) DLOOP_Malloc(nr_blks * sizeof(MPI_Aint)); + /* --BEGIN ERROR HANDLING-- */ + if (!tmp_disps) { + DLOOP_Free(tmp_blklens); + return DLOOP_Dataloop_create_struct_memory_error(); + } + /* --END ERROR HANDLING-- */ + + /* use segment code again to flatten the type */ + first_ind = 0; + for (i=0; i < count; i++) + { + /* we're going to use the segment code to flatten the type. + * we put in our displacement as the buffer location, and use + * the blocklength as the count value to get N contiguous copies + * of the type. + * + * Note that we're going to get back values in bytes, so that will + * be our new element type. + */ + if (oldtypes[i] != MPI_UB && oldtypes[i] != MPI_LB && blklens[i] != 0) + { + PREPEND_PREFIX(Segment_init)((char *) disps[i], + (DLOOP_Count) blklens[i], + oldtypes[i], + segp, + 0 /* homogeneous */); + + last_ind = nr_blks - first_ind; + bytes = SEGMENT_IGNORE_LAST; + PREPEND_PREFIX(Segment_mpi_flatten)(segp, + 0, + &bytes, + &tmp_blklens[first_ind], + &tmp_disps[first_ind], + &last_ind); + first_ind += last_ind; + } + } + nr_blks = first_ind; + +#if 0 + if (MPIU_DBG_SELECTED(DATATYPE,VERBOSE)) { + MPIU_DBG_OUT(DATATYPE,"--- start of flattened type ---"); + for (i=0; i < nr_blks; i++) { + MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST, + "a[%d] = (%d, %d)\n", i, + tmp_blklens[i], tmp_disps[i])); + } + MPIU_DBG_OUT(DATATYPE,"--- end of flattened type ---"); + } +#endif + + PREPEND_PREFIX(Segment_free)(segp); + + err = PREPEND_PREFIX(Dataloop_create_indexed)(nr_blks, + tmp_blklens, + tmp_disps, + 1, /* disp in bytes */ + MPI_BYTE, + dlp_p, + dlsz_p, + dldepth_p, + flag); + + DLOOP_Free(tmp_blklens); + DLOOP_Free(tmp_disps); + + return err; +} diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_vector.c b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_vector.c new file mode 100644 index 0000000000..ff4af160f6 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_create_vector.c @@ -0,0 +1,161 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include "./dataloop.h" + +/*@ + Dataloop_create_vector + + Arguments: ++ int icount +. int iblocklength +. MPI_Aint astride +. int strideinbytes +. MPI_Datatype oldtype +. DLOOP_Dataloop **dlp_p +. int *dlsz_p +. int *dldepth_p +- int flag + + Returns 0 on success, -1 on failure. + +@*/ +int PREPEND_PREFIX(Dataloop_create_vector)(int icount, + int iblocklength, + MPI_Aint astride, + int strideinbytes, + DLOOP_Type oldtype, + DLOOP_Dataloop **dlp_p, + int *dlsz_p, + int *dldepth_p, + int flag) +{ + int err, is_builtin; + int new_loop_sz, new_loop_depth; + + DLOOP_Count count, blocklength; + DLOOP_Offset stride; + DLOOP_Dataloop *new_dlp; + + count = (DLOOP_Count) icount; /* avoid subsequent casting */ + blocklength = (DLOOP_Count) iblocklength; + stride = (DLOOP_Offset) astride; + + /* if count or blocklength are zero, handle with contig code, + * call it a int + */ + if (count == 0 || blocklength == 0) + { + + err = PREPEND_PREFIX(Dataloop_create_contiguous)(0, + MPI_INT, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + + /* optimization: + * + * if count == 1, store as a contiguous rather than a vector dataloop. + */ + if (count == 1) { + err = PREPEND_PREFIX(Dataloop_create_contiguous)(iblocklength, + oldtype, + dlp_p, + dlsz_p, + dldepth_p, + flag); + return err; + } + + is_builtin = (DLOOP_Handle_hasloop_macro(oldtype)) ? 0 : 1; + + if (is_builtin) { + new_loop_sz = sizeof(DLOOP_Dataloop); + new_loop_depth = 1; + } + else { + int old_loop_sz = 0, old_loop_depth = 0; + + DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag); + DLOOP_Handle_get_loopdepth_macro(oldtype, old_loop_depth, flag); + + /* TODO: ACCOUNT FOR PADDING IN LOOP_SZ HERE */ + new_loop_sz = sizeof(DLOOP_Dataloop) + old_loop_sz; + new_loop_depth = old_loop_depth + 1; + } + + + if (is_builtin) { + DLOOP_Offset basic_sz = 0; + + PREPEND_PREFIX(Dataloop_alloc)(DLOOP_KIND_VECTOR, + count, + &new_dlp, + &new_loop_sz); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) return -1; + /* --END ERROR HANDLING-- */ + + DLOOP_Handle_get_size_macro(oldtype, basic_sz); + new_dlp->kind = DLOOP_KIND_VECTOR | DLOOP_FINAL_MASK; + + if (flag == DLOOP_DATALOOP_ALL_BYTES) + { + + blocklength *= basic_sz; + new_dlp->el_size = 1; + new_dlp->el_extent = 1; + new_dlp->el_type = MPI_BYTE; + } + else + { + new_dlp->el_size = basic_sz; + new_dlp->el_extent = new_dlp->el_size; + new_dlp->el_type = oldtype; + } + } + else /* user-defined base type (oldtype) */ { + DLOOP_Dataloop *old_loop_ptr; + int old_loop_sz = 0; + + DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag); + DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag); + + PREPEND_PREFIX(Dataloop_alloc_and_copy)(DLOOP_KIND_VECTOR, + count, + old_loop_ptr, + old_loop_sz, + &new_dlp, + &new_loop_sz); + /* --BEGIN ERROR HANDLING-- */ + if (!new_dlp) return -1; + /* --END ERROR HANDLING-- */ + + new_dlp->kind = DLOOP_KIND_VECTOR; + DLOOP_Handle_get_size_macro(oldtype, new_dlp->el_size); + DLOOP_Handle_get_extent_macro(oldtype, new_dlp->el_extent); + DLOOP_Handle_get_basic_type_macro(oldtype, new_dlp->el_type); + } + + /* vector-specific members + * + * stride stored in dataloop is always in bytes for local rep of type + */ + new_dlp->loop_params.v_t.count = count; + new_dlp->loop_params.v_t.blocksize = blocklength; + new_dlp->loop_params.v_t.stride = (strideinbytes) ? stride : + stride * new_dlp->el_extent; + + *dlp_p = new_dlp; + *dlsz_p = new_loop_sz; + *dldepth_p = new_loop_depth; + + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_parts.h b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_parts.h new file mode 100644 index 0000000000..5894dad2d0 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/dataloop_parts.h @@ -0,0 +1,463 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#ifndef DATALOOP_PARTS_H +#define DATALOOP_PARTS_H + +/* Check that all the appropriate defines are present */ +#ifndef PREPEND_PREFIX +#error "PREPEND_PREFIX must be defined before dataloop_parts.h is included." +#endif + +#ifndef DLOOP_Offset +#error "DLOOP_Offset must be defined before dataloop_parts.h is included." +#endif + +#ifndef DLOOP_Count +#error "DLOOP_Count must be defined before dataloop_parts.h is included." +#endif + +#ifndef DLOOP_Handle +#error "DLOOP_Handle must be defined before dataloop_parts.h is included." +#endif + +#ifndef DLOOP_Buffer +#error "DLOOP_Buffer must be defined before dataloop_parts.h is included." +#endif + +#ifndef DLOOP_Type +#error "DLOOP_Type must be defined before dataloop_parts.h is included." +#endif + +/* Redefine all of the internal structures in terms of the prefix */ +#define DLOOP_Dataloop PREPEND_PREFIX(Dataloop) +#define DLOOP_Dataloop_contig PREPEND_PREFIX(Dataloop_contig) +#define DLOOP_Dataloop_vector PREPEND_PREFIX(Dataloop_vector) +#define DLOOP_Dataloop_blockindexed PREPEND_PREFIX(Dataloop_blockindexed) +#define DLOOP_Dataloop_indexed PREPEND_PREFIX(Dataloop_indexed) +#define DLOOP_Dataloop_struct PREPEND_PREFIX(Dataloop_struct) +#define DLOOP_Dataloop_common PREPEND_PREFIX(Dataloop_common) +#define DLOOP_Segment PREPEND_PREFIX(Segment) +#define DLOOP_Dataloop_stackelm PREPEND_PREFIX(Dataloop_stackelm) + +/* These flags are used at creation time to specify what types of + * optimizations may be applied. They are also passed in at Segment_init + * time to specify which dataloop to use. + * + * Note: The flag to MPID_Segment_init() was originally simply "hetero" + * and was a boolean value (0 meaning homogeneous). Some MPICH2 code + * may still rely on HOMOGENEOUS being "0" and HETEROGENEOUS being "1". + */ +#define DLOOP_DATALOOP_HOMOGENEOUS 0 +#define DLOOP_DATALOOP_HETEROGENEOUS 1 +#define DLOOP_DATALOOP_ALL_BYTES 2 + +/* NOTE: ASSUMING LAST TYPE IS SIGNED */ +#define SEGMENT_IGNORE_LAST ((DLOOP_Offset) -1) +/* + * Each of the MPI datatypes can be mapped into one of 5 very simple + * loops. This loop has the following parameters: + * - count + * - blocksize[] + * - offset[] + * - stride + * - datatype[] + * + * where each [] indicates that a field may be *either* an array or a scalar. + * For each such type, we define a struct that describes these parameters + */ + +/*S + DLOOP_Dataloop_contig - Description of a contiguous dataloop + + Fields: ++ count - Number of elements +- dataloop - Dataloop of the elements + + Module: + Datatype + S*/ +typedef struct DLOOP_Dataloop_contig { + DLOOP_Count count; + struct DLOOP_Dataloop *dataloop; +} DLOOP_Dataloop_contig; + +/*S + DLOOP_Dataloop_vector - Description of a vector or strided dataloop + + Fields: ++ count - Number of elements +. blocksize - Number of dataloops in each element +. stride - Stride (in bytes) between each block +- dataloop - Dataloop of each element + + Module: + Datatype + S*/ +typedef struct DLOOP_Dataloop_vector { + DLOOP_Count count; + struct DLOOP_Dataloop *dataloop; + DLOOP_Count blocksize; + DLOOP_Offset stride; +} DLOOP_Dataloop_vector; + +/*S + DLOOP_Dataloop_blockindexed - Description of a block-indexed dataloop + + Fields: ++ count - Number of blocks +. blocksize - Number of elements in each block +. offset_array - Array of offsets (in bytes) to each block +. total_blocks - count of total blocks in the array (cached value) +- dataloop - Dataloop of each element + + Module: + Datatype + + S*/ +typedef struct DLOOP_Dataloop_blockindexed { + DLOOP_Count count; + struct DLOOP_Dataloop *dataloop; + DLOOP_Count blocksize; + DLOOP_Offset *offset_array; +} DLOOP_Dataloop_blockindexed; + +/*S + DLOOP_Dataloop_indexed - Description of an indexed dataloop + + Fields: ++ count - Number of blocks +. blocksize_array - Array giving the number of elements in each block +. offset_array - Array of offsets (in bytes) to each block +. total_blocks - count of total blocks in the array (cached value) +- dataloop - Dataloop of each element + + Module: + Datatype + + S*/ +typedef struct DLOOP_Dataloop_indexed { + DLOOP_Count count; + struct DLOOP_Dataloop *dataloop; + DLOOP_Count *blocksize_array; + DLOOP_Offset *offset_array; + DLOOP_Count total_blocks; +} DLOOP_Dataloop_indexed; + +/*S + DLOOP_Dataloop_struct - Description of a structure dataloop + + Fields: ++ count - Number of blocks +. blocksize_array - Array giving the number of elements in each block +. offset_array - Array of offsets (in bytes) to each block +- dataloop_array - Array of dataloops describing the elements of each block + + Module: + Datatype + + S*/ +typedef struct DLOOP_Dataloop_struct { + DLOOP_Count count; + struct DLOOP_Dataloop **dataloop_array; + DLOOP_Count *blocksize_array; + DLOOP_Offset *offset_array; + DLOOP_Offset *el_extent_array; /* need more than one */ +} DLOOP_Dataloop_struct; + +/* In many cases, we need the count and the next dataloop item. This + common structure gives a quick access to both. Note that all other + structures must use the same ordering of elements. + Question: should we put the pointer first in case + sizeof(pointer)>sizeof(int) ? +*/ +typedef struct DLOOP_Dataloop_common { + DLOOP_Count count; + struct DLOOP_Dataloop *dataloop; +} DLOOP_Dataloop_common; + +/*S + DLOOP_Dataloop - Description of the structure used to hold a dataloop + description + + Fields: ++ kind - Describes the type of the dataloop. This is divided into three + separate bit fields\: +.vb + Dataloop type (e.g., DLOOP_CONTIG etc.). 3 bits + IsFinal (a "leaf" dataloop; see text) 1 bit + Element Size (units for fields.) 2 bits + Element size has 4 values + 0 - Elements are in units of bytes + 1 - Elements are in units of 2 bytes + 2 - Elements are in units of 4 bytes + 3 - Elements are in units of 8 bytes +.ve + The dataloop type is one of 'DLOOP_CONTIG', 'DLOOP_VECTOR', + 'DLOOP_BLOCKINDEXED', 'DLOOP_INDEXED', or 'DLOOP_STRUCT'. +. loop_parms - A union containing the 5 dataloop structures, e.g., + 'DLOOP_Dataloop_contig', 'DLOOP_Dataloop_vector', etc. A sixth element in + this union, 'count', allows quick access to the shared 'count' field in the + five dataloop structure. +. extent - The extent of the dataloop + + Module: + Datatype + + S*/ +typedef struct DLOOP_Dataloop { + int kind; /* Contains both the loop type + (contig, vector, blockindexed, indexed, + or struct) and a bit that indicates + whether the dataloop is a leaf type. */ + union { + DLOOP_Count count; + DLOOP_Dataloop_contig c_t; + DLOOP_Dataloop_vector v_t; + DLOOP_Dataloop_blockindexed bi_t; + DLOOP_Dataloop_indexed i_t; + DLOOP_Dataloop_struct s_t; + DLOOP_Dataloop_common cm_t; + } loop_params; + DLOOP_Offset el_size; /* I don't feel like dealing with the bit manip. + * needed to get the packed size right at the moment. + */ + DLOOP_Offset el_extent; + DLOOP_Type el_type; +} DLOOP_Dataloop; + +#define DLOOP_FINAL_MASK 0x00000008 +#define DLOOP_KIND_MASK 0x00000007 +#define DLOOP_KIND_CONTIG 0x1 +#define DLOOP_KIND_VECTOR 0x2 +#define DLOOP_KIND_BLOCKINDEXED 0x3 +#define DLOOP_KIND_INDEXED 0x4 +#define DLOOP_KIND_STRUCT 0x5 + +/* The max datatype depth is the maximum depth of the stack used to + evaluate datatypes. It represents the length of the chain of + datatype dependencies. Defining this and testing when a datatype + is created removes a test in the datatype evaluation loop. */ +#define DLOOP_MAX_DATATYPE_DEPTH 8 + +/*S + DLOOP_Dataloop_stackelm - Structure for an element of the stack used + to process dataloops + + Fields: ++ curcount - Current loop count value (between 0 and + loop.loop_params.count-1) +. orig_count - original count value (cached so we don't have to look it up) +. curoffset - Offset into memory relative to the pointer to the buffer + passed in by the user. Used to maintain our position as we + move up and down the stack. NEED MORE NOTES ON THIS!!! +. orig_offset - original offset, set before the stackelm is processed, so that + we know where the offset was. this is used in processing indexed + types and possibly others. it is set for all types, but not + referenced in some cases. +. curblock - Current block value...NEED MORE NOTES ON THIS!!! +. orig_block - original block value (caches so we don't have to look it up); + INVALID FOR INDEX AND STRUCT TYPES. +- loop_p - pointer to Loop-based description of the dataloop + +S*/ +typedef struct DLOOP_Dataloop_stackelm { + int may_require_reloading; /* indicates that items below might + * need reloading (e.g. this is a struct) + */ + + DLOOP_Count curcount; + DLOOP_Offset curoffset; + DLOOP_Count curblock; + + DLOOP_Count orig_count; + DLOOP_Offset orig_offset; + DLOOP_Count orig_block; + + struct DLOOP_Dataloop *loop_p; +} DLOOP_Dataloop_stackelm; + +/*S + DLOOP_Segment - Description of the Segment datatype + + Notes: + This has no corresponding MPI datatype. + + Module: + Segment + + Questions: + Should this have an id for allocation and similarity purposes? + S*/ +typedef struct DLOOP_Segment { + void *ptr; /* pointer to datatype buffer */ + DLOOP_Handle handle; + DLOOP_Offset stream_off; /* next offset into data stream resulting from datatype + * processing. in other words, how many bytes have + * we created/used by parsing so far? that amount + 1. + */ + DLOOP_Dataloop_stackelm stackelm[DLOOP_MAX_DATATYPE_DEPTH]; + int cur_sp; /* Current stack pointer when using dataloop */ + int valid_sp; /* maximum valid stack pointer. This is used to + maintain information on the stack after it has + been placed there by following the datatype field + in a DLOOP_Dataloop_st for any type except struct */ + + struct DLOOP_Dataloop builtin_loop; /* used for both predefined types (which + * won't have a loop already) and for + * situations where a count is passed in + * and we need to create a contig loop + * to handle it + */ + /* other, device-specific information */ +} DLOOP_Segment; + +/* Dataloop functions (dataloop.c) */ +void PREPEND_PREFIX(Dataloop_copy)(void *dest, + void *src, + int size); +void PREPEND_PREFIX(Dataloop_update)(DLOOP_Dataloop *dataloop, + DLOOP_Offset ptrdiff); +DLOOP_Offset +PREPEND_PREFIX(Dataloop_stream_size)(DLOOP_Dataloop *dl_p, + DLOOP_Offset (*sizefn)(DLOOP_Type el_type)); +void PREPEND_PREFIX(Dataloop_print)(DLOOP_Dataloop *dataloop, + int depth); + +void PREPEND_PREFIX(Dataloop_alloc)(int kind, + DLOOP_Count count, + DLOOP_Dataloop **new_loop_p, + int *new_loop_sz_p); +void PREPEND_PREFIX(Dataloop_alloc_and_copy)(int kind, + DLOOP_Count count, + DLOOP_Dataloop *old_loop, + int old_loop_sz, + DLOOP_Dataloop **new_loop_p, + int *new_loop_sz_p); +void PREPEND_PREFIX(Dataloop_struct_alloc)(DLOOP_Count count, + int old_loop_sz, + int basic_ct, + DLOOP_Dataloop **old_loop_p, + DLOOP_Dataloop **new_loop_p, + int *new_loop_sz_p); +void PREPEND_PREFIX(Dataloop_dup)(DLOOP_Dataloop *old_loop, + int old_loop_sz, + DLOOP_Dataloop **new_loop_p); + +void PREPEND_PREFIX(Dataloop_free)(DLOOP_Dataloop **dataloop); + +/* Segment functions (segment.c) */ +DLOOP_Segment * PREPEND_PREFIX(Segment_alloc)(void); + +void PREPEND_PREFIX(Segment_free)(DLOOP_Segment *segp); + +int PREPEND_PREFIX(Segment_init)(const DLOOP_Buffer buf, + DLOOP_Count count, + DLOOP_Handle handle, + DLOOP_Segment *segp, + int hetero); + +void +PREPEND_PREFIX(Segment_manipulate)(DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + int (*piecefn) (DLOOP_Offset *blocks_p, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer bufp, + void *v_paramp), + int (*vectorfn) (DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count blklen, + DLOOP_Offset stride, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer bufp, + void *v_paramp), + int (*blkidxfn) (DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count blklen, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer bufp, + void *v_paramp), + int (*indexfn) (DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count *blockarray, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer bufp, + void *v_paramp), + DLOOP_Offset (*sizefn) (DLOOP_Type el_type), + void *pieceparams); + +/* Common segment operations (segment_ops.c) */ +void PREPEND_PREFIX(Segment_count_contig_blocks)(DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + DLOOP_Count *countp); +void PREPEND_PREFIX(Segment_mpi_flatten)(DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + int *blklens, + MPI_Aint *disps, + int *lengthp); + +#define DLOOP_M2M_TO_USERBUF 0 +#define DLOOP_M2M_FROM_USERBUF 1 + +struct PREPEND_PREFIX(m2m_params) { + int direction; /* M2M_TO_USERBUF or M2M_FROM_USERBUF */ + char *streambuf; + char *userbuf; +}; + +void PREPEND_PREFIX(Segment_pack)(struct DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + void *streambuf); +void PREPEND_PREFIX(Segment_unpack)(struct DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + void *streambuf); + +/* Segment piece functions that are used in specific cases elsewhere */ +int PREPEND_PREFIX(Segment_contig_m2m)(DLOOP_Offset *blocks_p, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + void *bufp, /* unused */ + void *v_paramp); +int PREPEND_PREFIX(Segment_vector_m2m)(DLOOP_Offset *blocks_p, + DLOOP_Count count, /* unused */ + DLOOP_Count blksz, + DLOOP_Offset stride, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + void *bufp, /* unused */ + void *v_paramp); +int PREPEND_PREFIX(Segment_blkidx_m2m)(DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count blocklen, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + void *bufp, /*unused */ + void *v_paramp); +int PREPEND_PREFIX(Segment_index_m2m)(DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count *blockarray, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + void *bufp, /*unused */ + void *v_paramp); +#endif + + + diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/romio_dataloop.c b/src/libs/ck-libs/ampi/romio/common/dataloop/romio_dataloop.c new file mode 100644 index 0000000000..5dbc7a42a5 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/romio_dataloop.c @@ -0,0 +1,575 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2007 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +/* This file implements functions necessary to store dataloop representations + * as an attribute on the MPI datatype. It also implements functionality to + * store a size, extent, and count of contig blocks in the same way. The + * size and extent are stored as MPI_Offset-sized values, so that overflow + * isn't a factor (as it would be on BG* for example if we used ints or + * MPI_Aints). + * + * Additionally this code puts an attribute on MPI_COMM_WORLD with a delete + * callback to clean up keyvals and any allocated memory (although currently + * memory cleanup relies on the delete functions on the types being called + * as well). + */ + +#include +#include + +#include "romio_dataloop.h" +#include "typesize_support.h" + +typedef struct MPIO_Datatype_s { + int valid, refct; + int dloop_size, dloop_depth; /* size, depth of dloop struct */ + DLOOP_Offset size, extent; /* size and extent of type */ + DLOOP_Offset true_lb, true_extent; + DLOOP_Dataloop *dloop; + DLOOP_Count contig_blks; +} MPIO_Datatype; + +/* valid flags */ +#define MPIO_DATATYPE_VALID_DLOOP_PTR 1 +#define MPIO_DATATYPE_VALID_DLOOP_SIZE 2 +#define MPIO_DATATYPE_VALID_DLOOP_DEPTH 4 +#define MPIO_DATATYPE_VALID_TYPESZEXT 8 +#define MPIO_DATATYPE_VALID_CONTIG_BLKS 16 + +#define MPIO_DATATYPE_VALID_DATALOOP (MPIO_DATATYPE_VALID_DLOOP_PTR | \ + MPIO_DATATYPE_VALID_DLOOP_SIZE | \ + MPIO_DATATYPE_VALID_DLOOP_DEPTH) + +/* MPI attr keyvals used internally */ +static int MPIO_Datatype_keyval = MPI_KEYVAL_INVALID; +static int MPIO_Datatype_finalize_keyval = MPI_KEYVAL_INVALID; + +static MPIO_Datatype *MPIO_Datatype_allocate(MPI_Datatype type); +static void MPIO_Datatype_set_szext(MPI_Datatype type, MPIO_Datatype *dtp); +static int MPIO_Datatype_initialize(void); +static int MPIO_Datatype_finalize(MPI_Comm comm, int comm_keyval, + void *attrval, void *extrastate); +static int MPIO_Datatype_copy_attr_function(MPI_Datatype type, int type_keyval, + void *extra_state, + void *attribute_val_in, + void *attribute_val_out, int *flag); +static int MPIO_Datatype_delete_attr_function(MPI_Datatype type, + int type_keyval, + void *attribute_val, + void *extra_state); + +/* MPIO_Datatype_init_dataloop + * + * Must be called before dataloop is accessed. + * + * Valid to call more than once on the same type. + */ +void MPIO_Datatype_init_dataloop(MPI_Datatype type) +{ + int mpi_errno, attrflag; + MPIO_Datatype *dtp; + + /* trivial types don't get dataloops */ + if (!(MPIO_Datatype_is_nontrivial(type))) return; + + if (MPIO_Datatype_keyval != MPI_KEYVAL_INVALID) { + MPIO_Datatype_initialize(); + } + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + if (!attrflag) { + /* need to allocate structure and create dataloop representation */ + dtp = MPIO_Datatype_allocate(type); + } + if (!(dtp->valid | MPIO_DATATYPE_VALID_DLOOP_PTR)) { + MPIO_Dataloop_create(type, + &dtp->dloop, + &dtp->dloop_size, + &dtp->dloop_depth, + 0); + } + + return; +} + +void MPIO_Datatype_get_size(MPI_Datatype type, MPI_Offset *size_p) +{ + int mpi_errno, attrflag; + MPIO_Datatype *dtp; + + if (MPIO_Datatype_keyval != MPI_KEYVAL_INVALID) { + MPIO_Datatype_initialize(); + } + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + if (!attrflag) { + dtp = MPIO_Datatype_allocate(type); + } + + if (!(dtp->valid & MPIO_DATATYPE_VALID_TYPESZEXT)) { + MPIO_Datatype_set_szext(type, dtp); + } + + *size_p = dtp->size; + return; +} + +void MPIO_Datatype_get_extent(MPI_Datatype type, MPI_Offset *extent_p) +{ + int mpi_errno, attrflag; + MPIO_Datatype *dtp; + + if (MPIO_Datatype_keyval != MPI_KEYVAL_INVALID) { + MPIO_Datatype_initialize(); + } + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + if (!attrflag) { + dtp = MPIO_Datatype_allocate(type); + } + + if (!(dtp->valid & MPIO_DATATYPE_VALID_TYPESZEXT)) { + MPIO_Datatype_set_szext(type, dtp); + } + + *extent_p = dtp->extent; + return; +} + +/* MPIO_Datatype_get_block_info + * + * Parameters: + * type - MPI datatype + * true_lb - true_lb for type (offset to start of data) + * count - count of # of contiguous regions in the type + * n_contig - flag, indicating if N of these types would also form a + * single contiguous block + */ +void MPIO_Datatype_get_block_info(MPI_Datatype type, + MPI_Offset *true_lb_p, + MPI_Offset *count_p, + int *n_contig_p) +{ + int mpi_errno, attrflag; + int nr_ints, nr_aints, nr_types, combiner; + + mpi_errno = MPI_Type_get_envelope(type, &nr_ints, &nr_aints, + &nr_types, &combiner); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + if (combiner == MPI_COMBINER_NAMED && + (type != MPI_FLOAT_INT && + type != MPI_DOUBLE_INT && + type != MPI_LONG_INT && + type != MPI_SHORT_INT && + type != MPI_LONG_DOUBLE_INT)) + { + *true_lb_p = 0; + *count_p = 1; + *n_contig_p = 1; + } + else { + MPIO_Datatype *dtp; + MPIO_Segment *segp; + MPI_Offset bytes; + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, + &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + if (!attrflag) { + /* need to allocate structure and create dataloop representation */ + dtp = MPIO_Datatype_allocate(type); + } + if (!(dtp->valid | MPIO_DATATYPE_VALID_DLOOP_PTR)) { + MPIO_Dataloop_create(type, + &dtp->dloop, + &dtp->dloop_size, + &dtp->dloop_depth, 0); + DLOOP_Assert(dtp->dloop != NULL); + } + + DLOOP_Assert((dtp->valid | MPIO_DATATYPE_VALID_DLOOP_PTR) && + (dtp->valid | MPIO_DATATYPE_VALID_DLOOP_SIZE) && + (dtp->valid | MPIO_DATATYPE_VALID_DLOOP_DEPTH)); + + segp = MPIO_Segment_alloc(); + DLOOP_Assert(segp != NULL); + + MPIO_Segment_init(NULL, 1, type, segp, 0); + bytes = SEGMENT_IGNORE_LAST; + + MPIO_Segment_count_contig_blocks(segp, 0, &bytes, &dtp->contig_blks); + MPIO_Segment_free(segp); + dtp->valid |= MPIO_DATATYPE_VALID_CONTIG_BLKS; + + if (!(dtp->valid | MPIO_DATATYPE_VALID_TYPESZEXT)) { + MPIO_Datatype_set_szext(type, dtp); + } + *true_lb_p = dtp->true_lb; + *count_p = dtp->contig_blks; + *n_contig_p = (dtp->contig_blks == 1 && + dtp->true_extent == dtp->extent) ? 1 : 0; + } + + return; +} + +void MPIO_Datatype_get_el_type(MPI_Datatype type, + MPI_Datatype *eltype_p, + int flag) +{ + int mpi_errno; + int nr_ints, nr_aints, nr_types, combiner; + + mpi_errno = MPI_Type_get_envelope(type, &nr_ints, &nr_aints, + &nr_types, &combiner); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + if (combiner == MPI_COMBINER_NAMED) { + if (type == MPI_FLOAT_INT || + type == MPI_DOUBLE_INT || + type == MPI_LONG_INT || + type == MPI_SHORT_INT || + type == MPI_LONG_DOUBLE_INT) + { + *eltype_p = MPI_DATATYPE_NULL; + } + else if (type == MPI_2INT) { + *eltype_p = MPI_INT; + } + else { + /* all the other named types are their own element type */ + *eltype_p = type; + } + } + else { + MPIO_Dataloop *dlp; + MPIO_Datatype_get_loopptr(type, &dlp, flag); + + *eltype_p = dlp->el_type; + } + return; +} + +/* dataloop-related functions used by dataloop code */ +void MPIO_Datatype_get_loopptr(MPI_Datatype type, + MPIO_Dataloop **ptr_p, + int flag) +{ + int mpi_errno, attrflag; + MPIO_Datatype *dtp; + + if (MPIO_Datatype_keyval != MPI_KEYVAL_INVALID) { + MPIO_Datatype_initialize(); + } + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + if (!(dtp->valid & MPIO_DATATYPE_VALID_DLOOP_PTR)) + *ptr_p = NULL; + else + *ptr_p = dtp->dloop; + + return; +} + +void MPIO_Datatype_get_loopsize(MPI_Datatype type, int *size_p, int flag) +{ + int mpi_errno, attrflag; + MPIO_Datatype *dtp; + + if (MPIO_Datatype_keyval != MPI_KEYVAL_INVALID) { + MPIO_Datatype_initialize(); + } + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + if (!(dtp->valid & MPIO_DATATYPE_VALID_DLOOP_SIZE)) + *size_p = -1; + else + *size_p = dtp->dloop_size; + + return; +} + +void MPIO_Datatype_get_loopdepth(MPI_Datatype type, int *depth_p, int flag) +{ + int mpi_errno, attrflag; + MPIO_Datatype *dtp; + + if (MPIO_Datatype_keyval != MPI_KEYVAL_INVALID) { + MPIO_Datatype_initialize(); + } + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + if (!(dtp->valid & MPIO_DATATYPE_VALID_DLOOP_DEPTH)) + *depth_p = -1; + else + *depth_p = dtp->dloop_depth; + + return; +} + +void MPIO_Datatype_set_loopptr(MPI_Datatype type, MPIO_Dataloop *ptr, int flag) +{ + int mpi_errno, attrflag; + MPIO_Datatype *dtp; + + if (MPIO_Datatype_keyval != MPI_KEYVAL_INVALID) { + MPIO_Datatype_initialize(); + } + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + if (!attrflag) { + dtp = MPIO_Datatype_allocate(type); + } + + printf("set loopptr = %x\n", (int) ptr); + + dtp->dloop = ptr; + dtp->valid |= MPIO_DATATYPE_VALID_DLOOP_PTR; + return; +} + +void MPIO_Datatype_set_loopsize(MPI_Datatype type, int size, int flag) +{ + int mpi_errno, attrflag; + MPIO_Datatype *dtp; + + if (MPIO_Datatype_keyval != MPI_KEYVAL_INVALID) { + MPIO_Datatype_initialize(); + } + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + if (!attrflag) { + dtp = MPIO_Datatype_allocate(type); + } + + dtp->dloop_size = size; + dtp->valid |= MPIO_DATATYPE_VALID_DLOOP_SIZE; + return; +} + +void MPIO_Datatype_set_loopdepth(MPI_Datatype type, int depth, int flag) +{ + int mpi_errno, attrflag; + MPIO_Datatype *dtp; + + if (MPIO_Datatype_keyval != MPI_KEYVAL_INVALID) { + MPIO_Datatype_initialize(); + } + + mpi_errno = MPI_Type_get_attr(type, MPIO_Datatype_keyval, &dtp, &attrflag); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + if (!attrflag) { + dtp = MPIO_Datatype_allocate(type); + } + + dtp->dloop_depth = depth; + dtp->valid |= MPIO_DATATYPE_VALID_DLOOP_DEPTH; + return; +} + +int MPIO_Datatype_is_nontrivial(MPI_Datatype type) +{ + int nr_ints, nr_aints, nr_types, combiner; + + MPI_Type_get_envelope(type, &nr_ints, &nr_aints, &nr_types, &combiner); + if (combiner != MPI_COMBINER_NAMED || + type == MPI_FLOAT_INT || + type == MPI_DOUBLE_INT || + type == MPI_LONG_INT || + type == MPI_SHORT_INT || + type == MPI_LONG_DOUBLE_INT) return 1; + else return 0; +} + +/* internal functions */ + +static int MPIO_Datatype_initialize(void) +{ + int mpi_errno; + + DLOOP_Assert(MPIO_Datatype_keyval == MPI_KEYVAL_INVALID); + + /* create keyval for dataloop storage */ + mpi_errno = MPI_Type_create_keyval(MPIO_Datatype_copy_attr_function, + MPIO_Datatype_delete_attr_function, + &MPIO_Datatype_keyval, + NULL); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + /* create keyval to hook to COMM_WORLD for finalize */ + mpi_errno = MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN, + MPIO_Datatype_finalize, + &MPIO_Datatype_finalize_keyval, + NULL); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + mpi_errno = MPI_Comm_set_attr(MPI_COMM_WORLD, + MPIO_Datatype_finalize_keyval, + NULL); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + printf("created keyval\n"); + + return 0; +} + +/* MPIO_Datatype_finalize() + */ +static int MPIO_Datatype_finalize(MPI_Comm comm, + int comm_keyval, + void *attrval, + void *extrastate) +{ + int mpi_errno; + + DLOOP_Assert(MPIO_Datatype_keyval != MPI_KEYVAL_INVALID); + + /* remove keyvals */ + mpi_errno = MPI_Type_free_keyval(&MPIO_Datatype_keyval); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + mpi_errno = MPI_Type_free_keyval(&MPIO_Datatype_finalize_keyval); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + printf("freed keyvals\n"); + + return MPI_SUCCESS; +} + +static MPIO_Datatype *MPIO_Datatype_allocate(MPI_Datatype type) +{ + int mpi_errno; + MPIO_Datatype *dtp; + + dtp = (MPIO_Datatype *) malloc(sizeof(MPIO_Datatype)); + DLOOP_Assert(dtp != NULL); + dtp->valid = 0; + dtp->refct = 1; + dtp->dloop = NULL; + dtp->dloop_size = -1; + dtp->dloop_depth = -1; + + mpi_errno = MPI_Type_set_attr(type, MPIO_Datatype_keyval, dtp); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + printf("allocated attr struct\n"); + + return dtp; +} + +/* MPIO_Datatype_set_szext() + * + * Calculates size, extent, true_lb, and true_extent of type, fills in values + * in MPIO_Datatype structure, and sets valid flag. + * + * Note: This code currently checks for compatible variable sizes at + * runtime, while this check could instead be performed at configure + * time to save a few instructions. This seems like micro-optimization, + * so I skipped it for now. -- RobR, 03/22/2007 + */ +static void MPIO_Datatype_set_szext(MPI_Datatype type, MPIO_Datatype *dtp) +{ + int mpi_errno; + + if (sizeof(int) >= sizeof(MPI_Offset) && + sizeof(MPI_Aint) >= sizeof(MPI_Offset)) + { + int size; + MPI_Aint lb, extent, true_lb, true_extent; + + mpi_errno = MPI_Type_size(type, &size); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + mpi_errno = MPI_Type_get_extent(type, &lb, &extent); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + mpi_errno = MPI_Type_get_true_extent(type, &true_lb, &true_extent); + + dtp->size = (MPI_Offset) size; + dtp->extent = (MPI_Offset) extent; + dtp->true_lb = (MPI_Offset) true_lb; + dtp->true_extent = (MPI_Offset) true_extent; + } + else { + MPIO_Type_footprint tfp; + + MPIO_Type_calc_footprint(type, &tfp); + dtp->size = tfp.size; + dtp->extent = tfp.extent; + dtp->true_lb = tfp.true_lb; + dtp->true_extent = tfp.true_ub - tfp.true_lb; + } + + dtp->valid |= MPIO_DATATYPE_VALID_TYPESZEXT; + return; +} + +static int MPIO_Datatype_copy_attr_function(MPI_Datatype type, + int type_keyval, + void *extra_state, + void *attribute_val_in, + void *attribute_val_out, + int *flag) +{ + MPIO_Datatype *dtp = (MPIO_Datatype *) attribute_val_in; + + printf("copy fn. called\n"); + + DLOOP_Assert(dtp->refct); + + dtp->refct++; + + * (MPIO_Datatype **) attribute_val_out = dtp; + *flag = 1; + + printf("inc'd refct.\n"); + + return MPI_SUCCESS; +} + +static int MPIO_Datatype_delete_attr_function(MPI_Datatype type, + int type_keyval, + void *attribute_val, + void *extra_state) +{ + MPIO_Datatype *dtp = (MPIO_Datatype *) attribute_val; + + printf("delete fn. called\n"); + + DLOOP_Assert(dtp->refct); + + printf("dec'd refct\n"); + + dtp->refct--; + if (dtp->refct == 0) { + free(dtp); + printf("freed attr structure\n"); + } + + return MPI_SUCCESS; +} + +/* + * Local variables: + * c-indent-tabs-mode: nil + * End: + */ diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/romio_dataloop.h b/src/libs/ck-libs/ampi/romio/common/dataloop/romio_dataloop.h new file mode 100644 index 0000000000..5c9bbaed7b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/romio_dataloop.h @@ -0,0 +1,148 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#ifndef ROMIO_DATALOOP_H +#define ROMIO_DATALOOP_H + +#include +#include + +/* romioconf.h must be included *before* mpi.h to avoid some redeclarations */ +#ifdef HAVE_MPITYPEDEFS_H +#include "mpitypedefs.h" +#endif +#ifdef HAVE_MPICHCONF_H +#include "mpichconf.h" +#endif +#include "romioconf.h" + +#include + +/* Note: this is where you define the prefix that will be prepended on + * all externally visible generic dataloop and segment functions. + */ +#define PREPEND_PREFIX(fn) MPIO_ ## fn + +struct MPIO_iovec { + MPI_Offset base; + MPI_Offset len; +}; + +/* These following dataloop-specific types will be used throughout the DLOOP + * instance: + */ +#define DLOOP_Offset MPI_Offset +#define DLOOP_Count MPI_Offset +#define DLOOP_Handle MPI_Datatype +#define DLOOP_Type MPI_Datatype +#define DLOOP_Buffer void * +#define DLOOP_VECTOR struct MPIO_iovec +#define DLOOP_VECTOR_LEN len +#define DLOOP_VECTOR_BUF base + +/* The following accessor functions must also be defined: + * + * DLOOP_Handle_extent() + * DLOOP_Handle_size() + * DLOOP_Handle_loopptr() + * DLOOP_Handle_loopdepth() + * DLOOP_Handle_hasloop() + * + */ + +/* USE THE NOTATION THAT BILL USED IN MPIIMPL.H AND MAKE THESE MACROS */ + +/* NOTE: put get size into mpiimpl.h; the others go here until such time + * as we see that we need them elsewhere. + */ +#define DLOOP_Handle_get_loopdepth_macro(handle_,depth_,flag_) \ + MPIO_Datatype_get_loopdepth(handle_,&(depth_),flag_) + +#define DLOOP_Handle_get_loopsize_macro(handle_,size_,flag_) \ + MPIO_Datatype_get_loopsize(handle_,&(size_),flag_) + +#define DLOOP_Handle_set_loopptr_macro(handle_,lptr_,flag_) \ + MPIO_Datatype_set_loopptr(handle_,lptr_,flag_) + +#define DLOOP_Handle_set_loopdepth_macro(handle_,depth_,flag_) \ + MPIO_Datatype_set_loopdepth(handle_,depth_,flag_) + +#define DLOOP_Handle_set_loopsize_macro(handle_,size_,flag_) \ + MPIO_Datatype_set_loopsize(handle_,size_,flag_) + +#define DLOOP_Handle_get_loopptr_macro(handle_,lptr_,flag_) \ + MPIO_Datatype_get_loopptr(handle_,&(lptr_),flag_) + +#define DLOOP_Handle_get_size_macro(handle_,size_) \ + MPIO_Datatype_get_size(handle_,&(size_)) + +#define DLOOP_Handle_get_basic_type_macro(handle_,eltype_) \ + MPIO_Datatype_get_el_type(handle_, &(eltype_), 0) + +#define DLOOP_Handle_get_extent_macro(handle_,extent_) \ + MPIO_Datatype_get_extent(handle_,&(extent_)) + +#define DLOOP_Handle_hasloop_macro(handle_) \ + (MPIO_Datatype_is_nontrivial(handle_)) + +/* allocate and free functions must also be defined. */ +#define DLOOP_Malloc malloc +#define DLOOP_Free free + +/* debugging output function */ +#define DLOOP_dbg_printf printf + +/* assert function */ +#define DLOOP_Assert assert + +/* contents access functions -- use MPICH2 versions for now. */ +#define MPIO_Type_access_contents MPID_Type_access_contents +#define MPIO_Type_release_contents MPID_Type_release_contents + +/* Include dataloop_parts.h at the end to get the rest of the prototypes + * and defines, in terms of the prefixes and types above. + */ +#include "./dataloop_parts.h" +#include "./dataloop_create.h" + +/* accessor functions */ +void MPIO_Datatype_init_dataloop(MPI_Datatype type); +void MPIO_Datatype_get_size(MPI_Datatype type, MPI_Offset *size_p); +void MPIO_Datatype_get_extent(MPI_Datatype type, MPI_Offset *extent_p); +void MPIO_Datatype_get_block_info(MPI_Datatype type, MPI_Offset *true_lb, + MPI_Offset *count, int *n_contig); +int MPIO_Datatype_is_nontrivial(MPI_Datatype type); +void MPIO_Datatype_get_el_type(MPI_Datatype type, MPI_Datatype *eltype_p, + int flag); + +/* accessor functions used only by dataloop code proper */ +void MPIO_Datatype_get_loopptr(MPI_Datatype type, MPIO_Dataloop **ptr_p, + int flag); +void MPIO_Datatype_get_loopsize(MPI_Datatype type, int *size_p, int flag); +void MPIO_Datatype_get_loopdepth(MPI_Datatype type, int *depth_p, int flag); +void MPIO_Datatype_set_loopptr(MPI_Datatype type, MPIO_Dataloop *ptr, int flag); +void MPIO_Datatype_set_loopsize(MPI_Datatype type, int size, int flag); +void MPIO_Datatype_set_loopdepth(MPI_Datatype type, int depth, int flag); + +/* accessor functions from elsewhere */ +void MPIO_Type_access_contents(MPI_Datatype type, + int **ints_p, + MPI_Aint **aints_p, + MPI_Datatype **types_p); +void MPIO_Type_release_contents(MPI_Datatype type, + int **ints_p, + MPI_Aint **aints_p, + MPI_Datatype **types_p); + +/* These values are defined by DLOOP code. + * + * Note: DLOOP_DATALOOP_ALL_BYTES not currently used in MPICH2. + */ +#define MPID_DATALOOP_HETEROGENEOUS DLOOP_DATALOOP_HETEROGENEOUS +#define MPID_DATALOOP_HOMOGENEOUS DLOOP_DATALOOP_HOMOGENEOUS + +#endif diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/romio_segment_ops.c b/src/libs/ck-libs/ampi/romio/common/dataloop/romio_segment_ops.c new file mode 100644 index 0000000000..36b0336ef8 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/romio_segment_ops.c @@ -0,0 +1,482 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2007 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include +#include + +#include "romio_dataloop.h" +#include "typesize_support.h" + +/* Nomenclature: + * ib_ - intermediate buffer + * fv_ - file view + * ub_ - user buffer + * ds_ - data sieving + */ + +/* MPIO_File_ib_params - used when finding "good" data in intermediate buffer + * + * direction - either DLOOP_M2M_TO_USERBUF or DLOOP_M2M_FROM_USERBUF + * iobuf - location of IO buffer in memory + * ib_file_off - location in file corresponding to first byte in buffer + * ib_file_size - size of valid data in IO buffer + * fv_disp - displacement of file view (not kept elsewhere) + * + * ub_segp - segment corresponding to user buffer (with valid bufp) + * + * note: fv_disp is here mainly because the "bufp" value in the segment + * isn't necessarily large enough to hold an MPI_Offset. + */ +struct MPIO_File_ib_params { + int direction; + char *ib_ptr; + MPI_Offset ib_file_off, ib_file_size; + MPI_Offset fv_disp; + + DLOOP_Segment *ub_segp; +}; + +/* MPIO_File_ds_params + * + * Used to drive process of sifting data through intermediate buffer + * + * fv_disp - file view displacement + * ib_size - size of intermediate (data sieving) buffer + * ib_file_off - starting location of next file access going to buffer + * ib_file_size - size of access going to buffer + * ib_fv_off - file view (stream) location corresponding buffer start + * ib_fv_last - stream location one past last one going to buffer + * + * ib - + * ib_segp - + */ +struct MPIO_File_ds_params { + int direction; + MPI_Offset fv_disp; + MPI_Offset ib_size; + + /* cur_file_size helps us track what I/O would be necessary to cover + * the stream region we've processed so far. + */ + MPI_Offset ib_file_off, ib_file_size; + MPI_Offset ib_fv_off, ib_fv_last; + + struct MPIO_File_ib_params ib; + DLOOP_Segment *ib_segp; +}; + +static int MPIO_Segment_contig_file_ds(MPI_Offset *blocks_p, + MPI_Datatype el_type, + MPI_Offset rel_off, + void *unused, + void *v_paramp); + +static int MPIO_Segment_contig_fv2ib(DLOOP_Offset *blocks_p, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + void *unused, + void *v_paramp); +static int MPIO_File_datasieve(struct MPIO_File_ds_params *dsp, + MPI_Offset *fv_lastp); + + +static int MPIO_Segment_contig_m2m_fake(DLOOP_Offset *blocks_p, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + void *unused, + void *v_paramp); + +int MPIO_File_ds_io(MPI_Aint *ub_ptr, + int ub_count, + MPI_Datatype ub_type, + MPI_Offset fv_off, + MPI_Offset fv_disp, + MPI_Datatype fv_type, + int direction, + MPI_Offset ib_size) +{ + /* "b" variables refer to memory buffer, "f" variables to file regions */ + int ub_ncontig, fv_ncontig; + MPI_Offset ub_blkoff, ub_blkct, ub_typesize; + MPI_Offset fv_blkoff, fv_blkct, fv_size, fv_count, fv_counttouch; + + MPI_Offset size; + char *ib_ptr; + struct MPIO_File_ds_params *dsp; + struct MPIO_File_ib_params *ibp; + DLOOP_Segment *ds_segp; + + MPIO_Datatype_get_size(fv_type, &fv_size); + + /* calculate size of access in bytes using buffer type */ + MPIO_Datatype_get_size(ub_type, &ub_typesize); + size = ub_typesize * ub_count; + + /* fv_counttouch is count of file types touched by this particular + * access. used to determine if we're really contiguous in file or not. + */ + fv_counttouch = (((fv_off % fv_size) ? 1 : 0) + + (size - fv_size + (fv_off % fv_size)) / fv_size + + (((size - fv_size + (fv_off % fv_size)) % fv_size) ? 1:0)); + + MPIO_Datatype_get_block_info(ub_type, &ub_blkoff, &ub_blkct, &ub_ncontig); + MPIO_Datatype_get_block_info(fv_type, &fv_blkoff, &fv_blkct, &fv_ncontig); + + /* set up IO buffer */ + DLOOP_Assert(ib_size > 0); + if (size < ib_size) ib_size = size; + ib_ptr = (char *) DLOOP_Malloc(ib_size); + + /* optimizations: use simplest possible types when contiguous */ + if (ub_ncontig || (ub_count == 1 && ub_blkct == 1)) { + /* contiguous in memory -- use very simple contig instead */ + MPI_Datatype eltype; + MPI_Offset eltypesz; + + MPIO_Datatype_get_el_type(ub_type, &eltype, 0); + if (eltype == MPI_DATATYPE_NULL) eltype = MPI_BYTE; + + MPIO_Datatype_get_size(eltype, &eltypesz); + DLOOP_Assert((size / eltypesz) * eltypesz == size); + + /* it's possible that the original ub_type has a true_lb > 0. + * this would be returned in ub_blkoff. we account for this by + * incrementing the ub_ptr prior to processing. + * + * we will do the same thing for the file view below. + */ + ub_ptr += ub_blkoff; + ub_type = eltype; + ub_count = size / eltypesz; + } + + if (fv_ncontig || (fv_counttouch == 1 && fv_blkct == 1)) { + /* contiguous in file -- use very simple contig instead */ + MPI_Datatype eltype; + + MPIO_Datatype_get_el_type(fv_type, &eltype, 0); + if (eltype == MPI_DATATYPE_NULL) eltype = MPI_BYTE; + + MPIO_Datatype_get_size(eltype, &fv_size); + + fv_off += fv_blkoff; + fv_type = eltype; + /* fcount assigned below for all cases */ + } + + /* fv_count is the count necessary to encompass from start of file view + * past end of access. needed for accurate dataloop processing. + */ + fv_count = ((fv_off + size) / fv_size) + + (((fv_off + size) % fv_size) ? 1 : 0); + + /* allocate and populate DS (top-level) param structures */ + dsp = (struct MPIO_File_ds_params *) + DLOOP_Malloc(sizeof(struct MPIO_File_ds_params)); + DLOOP_Assert(dsp != NULL); + + dsp->direction = direction; + dsp->fv_disp = fv_disp; + dsp->ib_size = ib_size; + dsp->ib_file_off = (MPI_Offset) -1; + dsp->ib_file_size = 0; + dsp->ib_fv_off = (MPI_Offset) -1; + dsp->ib_fv_last = fv_off; + + dsp->ib_segp = MPIO_Segment_alloc(); + MPIO_Segment_init(NULL, /* bufp not used */ + fv_count, + fv_type, + dsp->ib_segp, + 0); + + /* allocate and populate IB (mid-level) param structures */ + ibp = (struct MPIO_File_ib_params *) + DLOOP_Malloc(sizeof(struct MPIO_File_ib_params)); + DLOOP_Assert(ibp != NULL); + + ibp->ib_ptr = ib_ptr; + ibp->direction = direction; + ibp->ib_file_off = (MPI_Offset) -1; + ibp->ib_file_size = (MPI_Offset) -1; + + ibp->ub_segp = MPIO_Segment_alloc(); + MPIO_Segment_init(ub_ptr, + ub_count, + ub_type, + ibp->ub_segp, + 0); + + /* allocate segment to drive the whole process */ + ds_segp = MPIO_Segment_alloc(); + MPIO_Segment_init(NULL, /* bufp not used */ + fv_count, + fv_type, + ds_segp, + 0); + + MPIO_Segment_manipulate(ds_segp, + fv_off, + &size, + MPIO_Segment_contig_file_ds, + NULL, NULL, NULL, NULL, 0); + + /* finish any remaining I/O */ + if (dsp->ib_file_off != 0) { + MPIO_File_datasieve(dsp, &size); + } + + /* free resources */ + DLOOP_Free(ib_ptr); + MPIO_Segment_free(dsp->ib_segp); + DLOOP_Free(dsp); + MPIO_Segment_free(ibp->ub_segp); + DLOOP_Free(ibp); + MPIO_Segment_free(ds_segp); + + return 0; +} + +/* MPIO_Segment_contig_file_ds + * + * Make progress on a data sieving I/O operation for a contiguous + * region in the file view. + */ +static int MPIO_Segment_contig_file_ds(MPI_Offset *fv_blocks_p, + MPI_Datatype fv_eltype, + MPI_Offset rel_file_off, + void *unused, + void *v_paramp) +{ + MPI_Offset fv_blocks = *fv_blocks_p, fv_elsize; + struct MPIO_File_ds_params *dsp = v_paramp; + + MPIO_Datatype_get_size(fv_eltype, &fv_elsize); + + while (fv_blocks > 0) { + /* pastlastbyte is 1 more than the last byte location */ + MPI_Offset thisfirstbyte, blocksizebytes, pastlastbyte; + MPI_Offset min_access_size, full_access_size; + MPI_Offset fv_last; + + blocksizebytes = fv_blocks * fv_elsize; + thisfirstbyte = dsp->fv_disp + rel_file_off; + pastlastbyte = dsp->fv_disp + rel_file_off + blocksizebytes; + + /* start building a new access if one isn't in progress */ + if (dsp->ib_file_off == (MPI_Offset) -1) { + dsp->ib_file_off = thisfirstbyte; + dsp->ib_file_size = 0; + dsp->ib_fv_off = dsp->ib_fv_last; + } + + /* monotonically nondecreasing file views guarantee that we don't + * move backward in the file as we move forward in the stream. + */ + DLOOP_Assert(thisfirstbyte >= dsp->ib_file_off); + + /* min_access_size = size needed to get even one element + * full_access_size = size needed to get all elements + */ + min_access_size = (thisfirstbyte - dsp->ib_file_off) + fv_elsize; + full_access_size = pastlastbyte - dsp->ib_file_off; + + if (dsp->ib_size > full_access_size) { + /* the entire region fits in the iobuf with space to spare. + * update current stream offset and file size but wait to + * perform I/O. + */ + dsp->ib_file_size = pastlastbyte - dsp->ib_file_off; + dsp->ib_fv_last = dsp->ib_fv_last + blocksizebytes; + + /* update blocks to account for progress (I/O will be covered in a + * subsequent pass). + * + * note: we don't bother to update rel_file_off because we're done + * with this region. + */ + fv_blocks = 0; + + continue; + } + + if (dsp->ib_size < min_access_size) { + /* iobuf will not fit any of this region; perform I/O + * for previous regions and then deal with this one. + */ + } + else if (dsp->ib_size <= full_access_size) { + /* this I/O can complete some or all of this region */ + MPI_Offset remaining_iobuf, partial_elements; + + remaining_iobuf = dsp->ib_size - (thisfirstbyte - dsp->ib_file_off); + partial_elements = (remaining_iobuf / fv_elsize); + + /* update stored last file view offset (will verify later) */ + dsp->ib_fv_last += partial_elements * fv_elsize; + + /* update blocks and rel_off to account for upcoming progress */ + fv_blocks -= partial_elements; + rel_file_off += partial_elements * fv_elsize; + } + + fv_last = dsp->ib_fv_last; + + /* perform read */ + MPIO_File_datasieve(dsp, &fv_last); + } + + return 0; +} + +/* MPIO_File_datasieve + * + */ +static int MPIO_File_datasieve(struct MPIO_File_ds_params *dsp, + MPI_Offset *fv_lastp) +{ + DLOOP_Assert(*fv_lastp == dsp->ib_fv_last); + + /* perform read */ + printf("READ: buf = %x, off = %d, size = %d\n", + (unsigned int) dsp->ib.ib_ptr, + (int) dsp->ib_file_off, + (int) dsp->ib_file_size); + + /* copy data between ib and ub */ + MPIO_Segment_manipulate(dsp->ib_segp, + dsp->ib_fv_off, + fv_lastp, + MPIO_Segment_contig_fv2ib, + NULL, NULL, NULL, NULL, + &dsp->ib); + + DLOOP_Assert(*fv_lastp == dsp->ib_fv_last); + + if (dsp->direction == DLOOP_M2M_FROM_USERBUF) { + /* perform write */ + printf("WRITE: buf = %x, off = %d, size = %d\n", + (unsigned int) dsp->ib.ib_ptr, + (int) dsp->ib_file_off, + (int) dsp->ib_file_size); + } + + /* mark iobuf values as unused */ + dsp->ib_file_off = (MPI_Offset) -1; + dsp->ib_file_size = 0; + dsp->ib_fv_off = (MPI_Offset) -1; + /* dsp->ib_fv_last remains pointing to next byte to access */ + + return 0; +} + +/* MPIO_Segment_contig_fv2ib + * + * Map contiguous region in file view to a region in the intermediate + * buffer, then use m2m functions (pack/unpack) to transfer into + * user buffer. + * + * Parameters: + * fv_blocks_p - number of eltypes in contiguous fv region + * fv_eltype - element type for region + * rel_file_off - offset into actual file, relative to fv_disp (displacement) + * v_paramp - pointer to a MPIO_File_ib_params structure + * + * Variables: + * ib_off - offset into intermed. buffer for start of "good" data + */ +static int MPIO_Segment_contig_fv2ib(DLOOP_Offset *fv_blocks_p, + DLOOP_Type fv_eltype, + DLOOP_Offset rel_file_off, + void *unused, + void *v_paramp) +{ + MPI_Offset fv_elsize, file_off, ub_first, ub_last; + MPI_Aint ib_off; + struct MPIO_File_ib_params *ibp = v_paramp; + struct MPIO_m2m_params m2m_params; + + MPIO_Datatype_get_size(fv_eltype, &fv_elsize); + + file_off = ibp->fv_disp + rel_file_off; + ib_off = (MPI_Aint) (file_off - ibp->ib_file_off); + + /* we never attempt to process the filetype before the IO buffer or + * beyond the IO buffer. + */ + DLOOP_Assert(ib_off >= 0); + DLOOP_Assert((ib_off + (*fv_blocks_p * fv_elsize)) <= ibp->ib_file_size); + + /* fill in parameters for m2m functions */ + m2m_params.direction = ibp->direction; + m2m_params.streambuf = ibp->ib_ptr + ib_off; + m2m_params.userbuf = ibp->ub_segp->ptr; + + /* we always move through the memory type in order, so the last stored + * stream location (stream_off) is where we want to start next. + */ + ub_first = ibp->ub_segp->stream_off; + ub_last = *fv_blocks_p * fv_elsize; + + /* move to/from user buffer (using m2m fns in segment_ops.c) */ + MPIO_Segment_manipulate(ibp->ub_segp, ub_first, &ub_last, +#if 0 + MPIO_Segment_contig_m2m, + MPIO_Segment_vector_m2m, + MPIO_Segment_blkidx_m2m, + MPIO_Segment_index_m2m, +#else + MPIO_Segment_contig_m2m_fake, + NULL, NULL, NULL, +#endif + NULL, + &m2m_params); + + /* data should always be successfully processed by m2m code */ + DLOOP_Assert(ub_last == *fv_blocks_p * fv_elsize); + + return 0; +} + +static int MPIO_Segment_contig_m2m_fake(DLOOP_Offset *blocks_p, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + void *unused, + void *v_paramp) +{ + DLOOP_Offset el_size; + DLOOP_Offset size; + struct PREPEND_PREFIX(m2m_params) *paramp = v_paramp; + + DLOOP_Handle_get_size_macro(el_type, el_size); + size = *blocks_p * el_size; + + printf("\t[%s: ub_start=%x (%x+%x), ib_start=%x, sz=%d (%d*%d)]\n", + (paramp->direction == DLOOP_M2M_TO_USERBUF) ? "unpack" : "pack", + (unsigned int) (paramp->userbuf + rel_off), + (unsigned) paramp->userbuf, (unsigned) rel_off, + (unsigned) paramp->streambuf, + (int) size, + (int) *blocks_p, (int) el_size); + +#if 0 + if (paramp->direction == DLOOP_M2M_TO_USERBUF) { + memcpy((char *) (paramp->userbuf + rel_off), paramp->streambuf, size); + } + else { + memcpy(paramp->streambuf, (char *) (paramp->userbuf + rel_off), size); + } +#endif + paramp->streambuf += size; + return 0; +} + +/* + * Local variables: + * c-indent-tabs-mode: nil + * End: + */ diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/segment.c b/src/libs/ck-libs/ampi/romio/common/dataloop/segment.c new file mode 100644 index 0000000000..25c6635228 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/segment.c @@ -0,0 +1,988 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include +#include + +#include "./dataloop.h" + +#undef DLOOP_DEBUG_MANIPULATE + +#ifndef PREPEND_PREFIX +#error "You must explicitly include a header that sets the PREPEND_PREFIX and includes dataloop_parts.h" +#endif + +/* Notes on functions: + * + * There are a few different sets of functions here: + * - DLOOP_Segment_manipulate() - uses a "piece" function to perform operations + * using segments (piece functions defined elsewhere) + * - PREPEND_PREFIX functions - these define the externally visible interface + * to segment functionality + */ + +static inline DLOOP_Count DLOOP_Stackelm_blocksize(struct DLOOP_Dataloop_stackelm *elmp); +static inline DLOOP_Offset DLOOP_Stackelm_offset(struct DLOOP_Dataloop_stackelm *elmp); +static inline void DLOOP_Stackelm_load(struct DLOOP_Dataloop_stackelm *elmp, + struct DLOOP_Dataloop *dlp, + int branch_flag); +/* Segment_init + * + * buf - datatype buffer location + * count - number of instances of the datatype in the buffer + * handle - handle for datatype (could be derived or not) + * segp - pointer to previously allocated segment structure + * flag - flag indicating which optimizations are valid + * should be one of DLOOP_DATALOOP_HOMOGENEOUS, _HETEROGENEOUS, + * of _ALL_BYTES. + * + * Notes: + * - Assumes that the segment has been allocated. + * - Older MPICH2 code may pass "0" to indicate HETEROGENEOUS or "1" to + * indicate HETEROGENEOUS. + * + */ +int PREPEND_PREFIX(Segment_init)(const DLOOP_Buffer buf, + DLOOP_Count count, + DLOOP_Handle handle, + struct DLOOP_Segment *segp, + int flag) +{ + DLOOP_Offset elmsize = 0; + int i, depth = 0; + int branch_detected = 0; + + struct DLOOP_Dataloop_stackelm *elmp; + struct DLOOP_Dataloop *dlp = 0, *sblp = &segp->builtin_loop; + + DLOOP_Assert(flag == DLOOP_DATALOOP_HETEROGENEOUS || + flag == DLOOP_DATALOOP_HOMOGENEOUS || + flag == DLOOP_DATALOOP_ALL_BYTES); + +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("DLOOP_Segment_init: count = %d, buf = %x\n", + count, + buf); +#endif + + if (!DLOOP_Handle_hasloop_macro(handle)) { + /* simplest case; datatype has no loop (basic) */ + + DLOOP_Handle_get_size_macro(handle, elmsize); + + sblp->kind = DLOOP_KIND_CONTIG | DLOOP_FINAL_MASK; + sblp->loop_params.c_t.count = count; + sblp->loop_params.c_t.dataloop = 0; + sblp->el_size = elmsize; + DLOOP_Handle_get_basic_type_macro(handle, sblp->el_type); + DLOOP_Handle_get_extent_macro(handle, sblp->el_extent); + + dlp = sblp; + depth = 1; + } + else if (count == 0) { + /* only use the builtin */ + sblp->kind = DLOOP_KIND_CONTIG | DLOOP_FINAL_MASK; + sblp->loop_params.c_t.count = 0; + sblp->loop_params.c_t.dataloop = 0; + sblp->el_size = 0; + sblp->el_extent = 0; + + dlp = sblp; + depth = 1; + } + else if (count == 1) { + /* don't use the builtin */ + DLOOP_Handle_get_loopptr_macro(handle, dlp, flag); + DLOOP_Handle_get_loopdepth_macro(handle, depth, flag); + } + else { + /* default: need to use builtin to handle contig; must check + * loop depth first + */ + DLOOP_Dataloop *oldloop; /* loop from original type, before new count */ + DLOOP_Offset type_size, type_extent; + DLOOP_Type el_type; + + DLOOP_Handle_get_loopdepth_macro(handle, depth, flag); + if (depth >= DLOOP_MAX_DATATYPE_DEPTH) return -1; + + DLOOP_Handle_get_loopptr_macro(handle, oldloop, flag); + DLOOP_Assert(oldloop != NULL); + DLOOP_Handle_get_size_macro(handle, type_size); + DLOOP_Handle_get_extent_macro(handle, type_extent); + DLOOP_Handle_get_basic_type_macro(handle, el_type); + + if (depth == 1 && ((oldloop->kind & DLOOP_KIND_MASK) == DLOOP_KIND_CONTIG)) + { + if (type_size == type_extent) + { + /* use a contig */ + sblp->kind = DLOOP_KIND_CONTIG | DLOOP_FINAL_MASK; + sblp->loop_params.c_t.count = count * oldloop->loop_params.c_t.count; + sblp->loop_params.c_t.dataloop = NULL; + sblp->el_size = oldloop->el_size; + sblp->el_extent = oldloop->el_extent; + sblp->el_type = oldloop->el_type; + } + else + { + /* use a vector, with extent of original type becoming the stride */ + sblp->kind = DLOOP_KIND_VECTOR | DLOOP_FINAL_MASK; + sblp->loop_params.v_t.count = count; + sblp->loop_params.v_t.blocksize = oldloop->loop_params.c_t.count; + sblp->loop_params.v_t.stride = type_extent; + sblp->loop_params.v_t.dataloop = NULL; + sblp->el_size = oldloop->el_size; + sblp->el_extent = oldloop->el_extent; + sblp->el_type = oldloop->el_type; + } + } + else + { + /* general case */ + sblp->kind = DLOOP_KIND_CONTIG; + sblp->loop_params.c_t.count = count; + sblp->loop_params.c_t.dataloop = oldloop; + sblp->el_size = type_size; + sblp->el_extent = type_extent; + sblp->el_type = el_type; + + depth++; /* we're adding to the depth with the builtin */ + } + + dlp = sblp; + } + + /* initialize the rest of the segment values */ + segp->handle = handle; + segp->ptr = (DLOOP_Buffer) buf; + segp->stream_off = 0; + segp->cur_sp = 0; + segp->valid_sp = 0; + + /* initialize the first stackelm in its entirety */ + elmp = &(segp->stackelm[0]); + DLOOP_Stackelm_load(elmp, dlp, 0); + branch_detected = elmp->may_require_reloading; + + /* Fill in parameters not set by DLOOP_Stackelm_load */ + elmp->orig_offset = 0; + elmp->curblock = elmp->orig_block; + /* DLOOP_Stackelm_offset assumes correct orig_count, curcount, loop_p */ + elmp->curoffset = /* elmp->orig_offset + */ DLOOP_Stackelm_offset(elmp); + + i = 1; + while(!(dlp->kind & DLOOP_FINAL_MASK)) + { + /* get pointer to next dataloop */ + switch (dlp->kind & DLOOP_KIND_MASK) + { + case DLOOP_KIND_CONTIG: + case DLOOP_KIND_VECTOR: + case DLOOP_KIND_BLOCKINDEXED: + case DLOOP_KIND_INDEXED: + dlp = dlp->loop_params.cm_t.dataloop; + break; + case DLOOP_KIND_STRUCT: + dlp = dlp->loop_params.s_t.dataloop_array[0]; + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + + /* loop_p, orig_count, orig_block, and curcount are all filled by us now. + * the rest are filled in at processing time. + */ + elmp = &(segp->stackelm[i]); + + DLOOP_Stackelm_load(elmp, dlp, branch_detected); + branch_detected = elmp->may_require_reloading; + i++; + + } + + segp->valid_sp = depth-1; + + return 0; +} + +/* Segment_alloc + * + */ +struct DLOOP_Segment * PREPEND_PREFIX(Segment_alloc)(void) +{ + return (struct DLOOP_Segment *) DLOOP_Malloc(sizeof(struct DLOOP_Segment)); +} + +/* Segment_free + * + * Input Parameters: + * segp - pointer to segment + */ +void PREPEND_PREFIX(Segment_free)(struct DLOOP_Segment *segp) +{ + DLOOP_Free(segp); + return; +} + +/* DLOOP_Segment_manipulate - do something to a segment + * + * If you think of all the data to be manipulated (packed, unpacked, whatever), + * as a stream of bytes, it's easier to understand how first and last fit in. + * + * This function does all the work, calling the piecefn passed in when it + * encounters a datatype element which falls into the range of first..(last-1). + * + * piecefn can be NULL, in which case this function doesn't do anything when it + * hits a region. This is used internally for repositioning within this stream. + * + * last is a byte offset to the byte just past the last byte in the stream + * to operate on. this makes the calculations all over MUCH cleaner. + * + * stream_off, stream_el_size, first, and last are all working in terms of the + * types and sizes for the stream, which might be different from the local sizes + * (in the heterogeneous case). + * + * This is a horribly long function. Too bad; it's complicated :)! -- Rob + * + * NOTE: THIS IMPLEMENTATION CANNOT HANDLE STRUCT DATALOOPS. + */ +#define DLOOP_SEGMENT_SAVE_LOCAL_VALUES \ +{ \ + segp->cur_sp = cur_sp; \ + segp->valid_sp = valid_sp; \ + segp->stream_off = stream_off; \ + *lastp = stream_off; \ +} + +#define DLOOP_SEGMENT_LOAD_LOCAL_VALUES \ +{ \ + last = *lastp; \ + cur_sp = segp->cur_sp; \ + valid_sp = segp->valid_sp; \ + stream_off = segp->stream_off; \ + cur_elmp = &(segp->stackelm[cur_sp]); \ +} + +#define DLOOP_SEGMENT_RESET_VALUES \ +{ \ + segp->stream_off = 0; \ + segp->cur_sp = 0; \ + cur_elmp = &(segp->stackelm[0]); \ + cur_elmp->curcount = cur_elmp->orig_count; \ + cur_elmp->orig_block = DLOOP_Stackelm_blocksize(cur_elmp); \ + cur_elmp->curblock = cur_elmp->orig_block; \ + cur_elmp->curoffset = cur_elmp->orig_offset + \ + DLOOP_Stackelm_offset(cur_elmp); \ +} + +#define DLOOP_SEGMENT_POP_AND_MAYBE_EXIT \ +{ \ + cur_sp--; \ + if (cur_sp >= 0) cur_elmp = &segp->stackelm[cur_sp]; \ + else { \ + DLOOP_SEGMENT_SAVE_LOCAL_VALUES; \ + return; \ + } \ +} + +#define DLOOP_SEGMENT_PUSH \ +{ \ + cur_sp++; \ + cur_elmp = &segp->stackelm[cur_sp]; \ +} + +#define DLOOP_STACKELM_BLOCKINDEXED_OFFSET(elmp_, curcount_) \ +(elmp_)->loop_p->loop_params.bi_t.offset_array[(curcount_)] + +#define DLOOP_STACKELM_INDEXED_OFFSET(elmp_, curcount_) \ +(elmp_)->loop_p->loop_params.i_t.offset_array[(curcount_)] + +#define DLOOP_STACKELM_INDEXED_BLOCKSIZE(elmp_, curcount_) \ +(elmp_)->loop_p->loop_params.i_t.blocksize_array[(curcount_)] + +#define DLOOP_STACKELM_STRUCT_OFFSET(elmp_, curcount_) \ +(elmp_)->loop_p->loop_params.s_t.offset_array[(curcount_)] + +#define DLOOP_STACKELM_STRUCT_BLOCKSIZE(elmp_, curcount_) \ +(elmp_)->loop_p->loop_params.s_t.blocksize_array[(curcount_)] + +#define DLOOP_STACKELM_STRUCT_EL_EXTENT(elmp_, curcount_) \ +(elmp_)->loop_p->loop_params.s_t.el_extent_array[(curcount_)] + +#define DLOOP_STACKELM_STRUCT_DATALOOP(elmp_, curcount_) \ +(elmp_)->loop_p->loop_params.s_t.dataloop_array[(curcount_)] + +void PREPEND_PREFIX(Segment_manipulate)(struct DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + int (*contigfn) (DLOOP_Offset *blocks_p, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer bufp, + void *v_paramp), + int (*vectorfn) (DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count blklen, + DLOOP_Offset stride, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer bufp, + void *v_paramp), + int (*blkidxfn) (DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count blklen, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer bufp, + void *v_paramp), + int (*indexfn) (DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count *blockarray, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer bufp, + void *v_paramp), + DLOOP_Offset (*sizefn) (DLOOP_Type el_type), + void *pieceparams) +{ + /* these four are the "local values": cur_sp, valid_sp, last, stream_off */ + int cur_sp, valid_sp; + DLOOP_Offset last, stream_off; + + struct DLOOP_Dataloop_stackelm *cur_elmp; + enum { PF_NULL, PF_CONTIG, PF_VECTOR, PF_BLOCKINDEXED, PF_INDEXED } piecefn_type = PF_NULL; + + DLOOP_SEGMENT_LOAD_LOCAL_VALUES; + + if (first == *lastp) { + /* nothing to do */ + DLOOP_dbg_printf("dloop_segment_manipulate: warning: first == last (%d)\n", (int) first); + return; + } + + /* first we ensure that stream_off and first are in the same spot */ + if (first != stream_off) { +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("first=%d; stream_off=%ld; resetting.\n", + first, stream_off); +#endif + + if (first < stream_off) { + DLOOP_SEGMENT_RESET_VALUES; + stream_off = 0; + } + + if (first != stream_off) { + DLOOP_Offset tmp_last = first; + + /* use manipulate function with a NULL piecefn to advance + * stream offset + */ + PREPEND_PREFIX(Segment_manipulate)(segp, + stream_off, + &tmp_last, + NULL, /* contig fn */ + NULL, /* vector fn */ + NULL, /* blkidx fn */ + NULL, /* index fn */ + sizefn, + NULL); + + /* --BEGIN ERROR HANDLING-- */ + /* verify that we're in the right location */ + if (tmp_last != first) DLOOP_Assert(0); + /* --END ERROR HANDLING-- */ + } + + DLOOP_SEGMENT_LOAD_LOCAL_VALUES; + +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("done repositioning stream_off; first=%d, stream_off=%ld, last=%d\n", + first, stream_off, last); +#endif + } + + for (;;) { +#ifdef DLOOP_DEBUG_MANIPULATE +#if 0 + DLOOP_dbg_printf("looptop; cur_sp=%d, cur_elmp=%x\n", + cur_sp, (unsigned) cur_elmp); +#endif +#endif + + if (cur_elmp->loop_p->kind & DLOOP_FINAL_MASK) { + int piecefn_indicated_exit = -1; + DLOOP_Offset myblocks, local_el_size, stream_el_size; + DLOOP_Type el_type; + + /* structs are never finals (leaves) */ + DLOOP_Assert((cur_elmp->loop_p->kind & DLOOP_KIND_MASK) != + DLOOP_KIND_STRUCT); + + /* pop immediately on zero count */ + if (cur_elmp->curcount == 0) DLOOP_SEGMENT_POP_AND_MAYBE_EXIT; + + /* size on this system of the int, double, etc. that is + * the elementary type. + */ + local_el_size = cur_elmp->loop_p->el_size; + el_type = cur_elmp->loop_p->el_type; + stream_el_size = (sizefn) ? sizefn(el_type) : local_el_size; + + /* calculate number of elem. types to work on and function to use. + * default is to use the contig piecefn (if there is one). + */ + myblocks = cur_elmp->curblock; + piecefn_type = (contigfn ? PF_CONTIG : PF_NULL); + + /* check for opportunities to use other piecefns */ + switch (cur_elmp->loop_p->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_CONTIG: + break; + case DLOOP_KIND_BLOCKINDEXED: + /* only use blkidx piecefn if at start of blkidx type */ + if (blkidxfn && + cur_elmp->orig_block == cur_elmp->curblock && + cur_elmp->orig_count == cur_elmp->curcount) + { + /* TODO: RELAX CONSTRAINTS */ + myblocks = cur_elmp->curblock * cur_elmp->curcount; + piecefn_type = PF_BLOCKINDEXED; + } + break; + case DLOOP_KIND_INDEXED: + /* only use index piecefn if at start of the index type. + * count test checks that we're on first block. + * block test checks that we haven't made progress on first block. + */ + if (indexfn && + cur_elmp->orig_count == cur_elmp->curcount && + cur_elmp->curblock == DLOOP_STACKELM_INDEXED_BLOCKSIZE(cur_elmp, 0)) + { + /* TODO: RELAX CONSTRAINT ON COUNT? */ + myblocks = cur_elmp->loop_p->loop_params.i_t.total_blocks; + piecefn_type = PF_INDEXED; + } + break; + case DLOOP_KIND_VECTOR: + /* only use the vector piecefn if at the start of a + * contiguous block. + */ + if (vectorfn && cur_elmp->orig_block == cur_elmp->curblock) + { + myblocks = cur_elmp->curblock * cur_elmp->curcount; + piecefn_type = PF_VECTOR; + } + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("\thit leaf; cur_sp=%d, elmp=%x, piece_sz=%d\n", + cur_sp, + (unsigned) cur_elmp, myblocks * local_el_size); +#endif + + /* enforce the last parameter if necessary by reducing myblocks */ + if (last != SEGMENT_IGNORE_LAST && + (stream_off + (myblocks * stream_el_size) > last)) + { + myblocks = ((last - stream_off) / stream_el_size); +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("\tpartial block count=%d (%d bytes)\n", + myblocks, + (int) myblocks * stream_el_size); +#endif + if (myblocks == 0) { + DLOOP_SEGMENT_SAVE_LOCAL_VALUES; + return; + } + } + + /* call piecefn to perform data manipulation */ + switch (piecefn_type) { + case PF_NULL: + piecefn_indicated_exit = 0; +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("\tNULL piecefn for this piece\n"); +#endif + break; + case PF_CONTIG: + DLOOP_Assert(myblocks <= cur_elmp->curblock); + piecefn_indicated_exit = + contigfn(&myblocks, + el_type, + cur_elmp->curoffset, /* relative to segp->ptr */ + segp->ptr, /* start of buffer (from segment) */ + pieceparams); + break; + case PF_VECTOR: + piecefn_indicated_exit = + vectorfn(&myblocks, + cur_elmp->curcount, + cur_elmp->orig_block, + cur_elmp->loop_p->loop_params.v_t.stride, + el_type, + cur_elmp->curoffset, + segp->ptr, + pieceparams); + break; + case PF_BLOCKINDEXED: + piecefn_indicated_exit = + blkidxfn(&myblocks, + cur_elmp->curcount, + cur_elmp->orig_block, + cur_elmp->loop_p->loop_params.bi_t.offset_array, + el_type, + cur_elmp->orig_offset, /* blkidxfn adds offset */ + segp->ptr, + pieceparams); + break; + case PF_INDEXED: + piecefn_indicated_exit = + indexfn(&myblocks, + cur_elmp->curcount, + cur_elmp->loop_p->loop_params.i_t.blocksize_array, + cur_elmp->loop_p->loop_params.i_t.offset_array, + el_type, + cur_elmp->orig_offset, /* indexfn adds offset value */ + segp->ptr, + pieceparams); + break; + } + + /* update local values based on piecefn returns (myblocks and + * piecefn_indicated_exit) + */ + DLOOP_Assert(piecefn_indicated_exit >= 0); + DLOOP_Assert(myblocks >= 0); + stream_off += myblocks * stream_el_size; + + /* myblocks of 0 or less than cur_elmp->curblock indicates + * that we should stop processing and return. + */ + if (myblocks == 0) { + DLOOP_SEGMENT_SAVE_LOCAL_VALUES; + return; + } + else if (myblocks < cur_elmp->curblock) { + cur_elmp->curoffset += myblocks * local_el_size; + cur_elmp->curblock -= myblocks; + + DLOOP_SEGMENT_SAVE_LOCAL_VALUES; + return; + } + else /* myblocks >= cur_elmp->curblock */ { + int count_index = 0; + + /* this assumes we're either *just* processing the last parts + * of the current block, or we're processing as many blocks as + * we like starting at the beginning of one. + */ + + switch (cur_elmp->loop_p->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_INDEXED: + while (myblocks > 0 && myblocks >= cur_elmp->curblock) { + myblocks -= cur_elmp->curblock; + cur_elmp->curcount--; + DLOOP_Assert(cur_elmp->curcount >= 0); + + count_index = cur_elmp->orig_count - + cur_elmp->curcount; + cur_elmp->curblock = + DLOOP_STACKELM_INDEXED_BLOCKSIZE(cur_elmp, + count_index); + } + + if (cur_elmp->curcount == 0) { + /* don't bother to fill in values; we're popping anyway */ + DLOOP_Assert(myblocks == 0); + DLOOP_SEGMENT_POP_AND_MAYBE_EXIT; + } + else { + cur_elmp->orig_block = cur_elmp->curblock; + cur_elmp->curoffset = cur_elmp->orig_offset + + DLOOP_STACKELM_INDEXED_OFFSET(cur_elmp, + count_index); + + cur_elmp->curblock -= myblocks; + cur_elmp->curoffset += myblocks * local_el_size; + } + break; + case DLOOP_KIND_VECTOR: + /* this math relies on assertions at top of code block */ + cur_elmp->curcount -= myblocks / cur_elmp->curblock; + if (cur_elmp->curcount == 0) { + DLOOP_Assert(myblocks % cur_elmp->curblock == 0); + DLOOP_SEGMENT_POP_AND_MAYBE_EXIT; + } + else { + /* this math relies on assertions at top of code + * block + */ + cur_elmp->curblock = cur_elmp->orig_block - + (myblocks % cur_elmp->curblock); + /* new offset = original offset + + * stride * whole blocks + + * leftover bytes + */ + cur_elmp->curoffset = cur_elmp->orig_offset + + ((cur_elmp->orig_count - cur_elmp->curcount) * + cur_elmp->loop_p->loop_params.v_t.stride) + + ((cur_elmp->orig_block - cur_elmp->curblock) * + local_el_size); + } + break; + case DLOOP_KIND_CONTIG: + /* contigs that reach this point have always been + * completely processed + */ + DLOOP_Assert(myblocks == cur_elmp->curblock && + cur_elmp->curcount == 1); + DLOOP_SEGMENT_POP_AND_MAYBE_EXIT; + break; + case DLOOP_KIND_BLOCKINDEXED: + while (myblocks > 0 && myblocks >= cur_elmp->curblock) + { + myblocks -= cur_elmp->curblock; + cur_elmp->curcount--; + DLOOP_Assert(cur_elmp->curcount >= 0); + + count_index = cur_elmp->orig_count - + cur_elmp->curcount; + cur_elmp->curblock = cur_elmp->orig_block; + } + if (cur_elmp->curcount == 0) { + /* popping */ + DLOOP_Assert(myblocks == 0); + DLOOP_SEGMENT_POP_AND_MAYBE_EXIT; + } + else { + /* cur_elmp->orig_block = cur_elmp->curblock; */ + cur_elmp->curoffset = cur_elmp->orig_offset + + DLOOP_STACKELM_BLOCKINDEXED_OFFSET(cur_elmp, + count_index); + cur_elmp->curblock -= myblocks; + cur_elmp->curoffset += myblocks * local_el_size; + } + break; + } + } + + if (piecefn_indicated_exit) { + /* piece function indicated that we should quit processing */ + DLOOP_SEGMENT_SAVE_LOCAL_VALUES; + return; + } + } /* end of if leaf */ + else if (cur_elmp->curblock == 0) { +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("\thit end of block; elmp=%x [%d]\n", + (unsigned) cur_elmp, cur_sp); +#endif + cur_elmp->curcount--; + + /* new block. for indexed and struct reset orig_block. + * reset curblock for all types + */ + switch (cur_elmp->loop_p->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_CONTIG: + case DLOOP_KIND_VECTOR: + case DLOOP_KIND_BLOCKINDEXED: + break; + case DLOOP_KIND_INDEXED: + cur_elmp->orig_block = + DLOOP_STACKELM_INDEXED_BLOCKSIZE(cur_elmp, cur_elmp->curcount ? cur_elmp->orig_count - cur_elmp->curcount : 0); + break; + case DLOOP_KIND_STRUCT: + cur_elmp->orig_block = + DLOOP_STACKELM_STRUCT_BLOCKSIZE(cur_elmp, cur_elmp->curcount ? cur_elmp->orig_count - cur_elmp->curcount : 0); + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + cur_elmp->curblock = cur_elmp->orig_block; + + if (cur_elmp->curcount == 0) { +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("\talso hit end of count; elmp=%x [%d]\n", + (unsigned) cur_elmp, cur_sp); +#endif + DLOOP_SEGMENT_POP_AND_MAYBE_EXIT; + } + } + else /* push the stackelm */ { + DLOOP_Dataloop_stackelm *next_elmp; + int count_index, block_index; + + count_index = cur_elmp->orig_count - cur_elmp->curcount; + block_index = cur_elmp->orig_block - cur_elmp->curblock; + + /* reload the next stackelm if necessary */ + next_elmp = &(segp->stackelm[cur_sp + 1]); + if (cur_elmp->may_require_reloading) { + DLOOP_Dataloop *load_dlp = NULL; + switch (cur_elmp->loop_p->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_CONTIG: + case DLOOP_KIND_VECTOR: + case DLOOP_KIND_BLOCKINDEXED: + case DLOOP_KIND_INDEXED: + load_dlp = cur_elmp->loop_p->loop_params.cm_t.dataloop; + break; + case DLOOP_KIND_STRUCT: + load_dlp = DLOOP_STACKELM_STRUCT_DATALOOP(cur_elmp, + count_index); + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("\tloading dlp=%x, elmp=%x [%d]\n", + (unsigned) load_dlp, + (unsigned) next_elmp, + cur_sp+1); +#endif + + DLOOP_Stackelm_load(next_elmp, + load_dlp, + 1); + } + +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("\tpushing type, elmp=%x [%d], count=%d, block=%d\n", + (unsigned) cur_elmp, cur_sp, count_index, + block_index); +#endif + /* set orig_offset and all cur values for new stackelm. + * this is done in two steps: first set orig_offset based on + * current stackelm, then set cur values based on new stackelm. + */ + switch (cur_elmp->loop_p->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_CONTIG: + next_elmp->orig_offset = cur_elmp->curoffset + + block_index * cur_elmp->loop_p->el_extent; + break; + case DLOOP_KIND_VECTOR: + /* note: stride is in bytes */ + next_elmp->orig_offset = cur_elmp->orig_offset + + count_index * cur_elmp->loop_p->loop_params.v_t.stride + + block_index * cur_elmp->loop_p->el_extent; + break; + case DLOOP_KIND_BLOCKINDEXED: + next_elmp->orig_offset = cur_elmp->orig_offset + + block_index * cur_elmp->loop_p->el_extent + + DLOOP_STACKELM_BLOCKINDEXED_OFFSET(cur_elmp, + count_index); + break; + case DLOOP_KIND_INDEXED: + next_elmp->orig_offset = cur_elmp->orig_offset + + block_index * cur_elmp->loop_p->el_extent + + DLOOP_STACKELM_INDEXED_OFFSET(cur_elmp, count_index); + break; + case DLOOP_KIND_STRUCT: + next_elmp->orig_offset = cur_elmp->orig_offset + + block_index * DLOOP_STACKELM_STRUCT_EL_EXTENT(cur_elmp, count_index) + + DLOOP_STACKELM_STRUCT_OFFSET(cur_elmp, count_index); + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("\tstep 1: next orig_offset = %d (0x%x)\n", + next_elmp->orig_offset, + next_elmp->orig_offset); +#endif + + switch (next_elmp->loop_p->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_CONTIG: + case DLOOP_KIND_VECTOR: + next_elmp->curcount = next_elmp->orig_count; + next_elmp->curblock = next_elmp->orig_block; + next_elmp->curoffset = next_elmp->orig_offset; + break; + case DLOOP_KIND_BLOCKINDEXED: + next_elmp->curcount = next_elmp->orig_count; + next_elmp->curblock = next_elmp->orig_block; + next_elmp->curoffset = next_elmp->orig_offset + + DLOOP_STACKELM_BLOCKINDEXED_OFFSET(next_elmp, 0); + break; + case DLOOP_KIND_INDEXED: + next_elmp->curcount = next_elmp->orig_count; + next_elmp->curblock = + DLOOP_STACKELM_INDEXED_BLOCKSIZE(next_elmp, 0); + next_elmp->curoffset = next_elmp->orig_offset + + DLOOP_STACKELM_INDEXED_OFFSET(next_elmp, 0); + break; + case DLOOP_KIND_STRUCT: + next_elmp->curcount = next_elmp->orig_count; + next_elmp->curblock = + DLOOP_STACKELM_STRUCT_BLOCKSIZE(next_elmp, 0); + next_elmp->curoffset = next_elmp->orig_offset + + DLOOP_STACKELM_STRUCT_OFFSET(next_elmp, 0); + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("\tstep 2: next curoffset = %d (0x%x)\n", + next_elmp->curoffset, + next_elmp->curoffset); +#endif + + cur_elmp->curblock--; + DLOOP_SEGMENT_PUSH; + } /* end of else push the stackelm */ + } /* end of for (;;) */ + +#ifdef DLOOP_DEBUG_MANIPULATE + DLOOP_dbg_printf("hit end of datatype\n"); +#endif + + DLOOP_SEGMENT_SAVE_LOCAL_VALUES; + return; +} + +/* DLOOP_Stackelm_blocksize - returns block size for stackelm based on current + * count in stackelm. + * + * NOTE: loop_p, orig_count, and curcount members of stackelm MUST be correct + * before this is called! + * + */ +static inline DLOOP_Count DLOOP_Stackelm_blocksize(struct DLOOP_Dataloop_stackelm *elmp) +{ + struct DLOOP_Dataloop *dlp = elmp->loop_p; + + switch(dlp->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_CONTIG: + /* NOTE: we're dropping the count into the + * blksize field for contigs, as described + * in the init call. + */ + return dlp->loop_params.c_t.count; + break; + case DLOOP_KIND_VECTOR: + return dlp->loop_params.v_t.blocksize; + break; + case DLOOP_KIND_BLOCKINDEXED: + return dlp->loop_params.bi_t.blocksize; + break; + case DLOOP_KIND_INDEXED: + return dlp->loop_params.i_t.blocksize_array[elmp->orig_count - elmp->curcount]; + break; + case DLOOP_KIND_STRUCT: + return dlp->loop_params.s_t.blocksize_array[elmp->orig_count - elmp->curcount]; + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + return -1; +} + +/* DLOOP_Stackelm_offset - returns starting offset (displacement) for stackelm + * based on current count in stackelm. + * + * NOTE: loop_p, orig_count, and curcount members of stackelm MUST be correct + * before this is called! + * + * also, this really is only good at init time for vectors and contigs + * (all the time for indexed) at the moment. + * + */ +static inline DLOOP_Offset DLOOP_Stackelm_offset(struct DLOOP_Dataloop_stackelm *elmp) +{ + struct DLOOP_Dataloop *dlp = elmp->loop_p; + + switch(dlp->kind & DLOOP_KIND_MASK) { + case DLOOP_KIND_VECTOR: + case DLOOP_KIND_CONTIG: + return 0; + break; + case DLOOP_KIND_BLOCKINDEXED: + return dlp->loop_params.bi_t.offset_array[elmp->orig_count - elmp->curcount]; + break; + case DLOOP_KIND_INDEXED: + return dlp->loop_params.i_t.offset_array[elmp->orig_count - elmp->curcount]; + break; + case DLOOP_KIND_STRUCT: + return dlp->loop_params.s_t.offset_array[elmp->orig_count - elmp->curcount]; + break; + default: + /* --BEGIN ERROR HANDLING-- */ + DLOOP_Assert(0); + break; + /* --END ERROR HANDLING-- */ + } + return -1; +} + +/* DLOOP_Stackelm_load + * loop_p, orig_count, orig_block, and curcount are all filled by us now. + * the rest are filled in at processing time. + */ +static inline void DLOOP_Stackelm_load(struct DLOOP_Dataloop_stackelm *elmp, + struct DLOOP_Dataloop *dlp, + int branch_flag) +{ + elmp->loop_p = dlp; + + if ((dlp->kind & DLOOP_KIND_MASK) == DLOOP_KIND_CONTIG) { + elmp->orig_count = 1; /* put in blocksize instead */ + } + else { + elmp->orig_count = dlp->loop_params.count; + } + + if (branch_flag || (dlp->kind & DLOOP_KIND_MASK) == DLOOP_KIND_STRUCT) + { + elmp->may_require_reloading = 1; + } + else { + elmp->may_require_reloading = 0; + } + + /* required by DLOOP_Stackelm_blocksize */ + elmp->curcount = elmp->orig_count; + + elmp->orig_block = DLOOP_Stackelm_blocksize(elmp); + /* TODO: GO AHEAD AND FILL IN CURBLOCK? */ +} + +/* + * Local variables: + * c-indent-tabs-mode: nil + * End: + */ diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/segment_ops.c b/src/libs/ck-libs/ampi/romio/common/dataloop/segment_ops.c new file mode 100644 index 0000000000..04b1603db3 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/segment_ops.c @@ -0,0 +1,794 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include +#include +#include +#include + +#include "./dataloop.h" + + + +#ifdef HAVE_ANY_INT64_T_ALIGNEMENT +#define MPIR_ALIGN8_TEST(p1,p2) +#else +#define MPIR_ALIGN8_TEST(p1,p2) && ((((MPI_Aint)p1 | (MPI_Aint)p2) & 0x7) == 0) +#endif + +#ifdef HAVE_ANY_INT32_T_ALIGNEMENT +#define MPIR_ALIGN4_TEST(p1,p2) +#else +#define MPIR_ALIGN4_TEST(p1,p2) && ((((MPI_Aint)p1 | (MPI_Aint)p2) & 0x3) == 0) +#endif + +#define MPIDI_COPY_FROM_VEC(src,dest,stride,type,nelms,count) \ +{ \ + type * l_src = (type *)src, * l_dest = (type *)dest; \ + int i, j; \ + const int l_stride = stride; \ + if (nelms == 1) { \ + for (i=count;i!=0;i--) { \ + *l_dest++ = *l_src; \ + l_src = (type *) ((char *) l_src + l_stride); \ + } \ + } \ + else { \ + for (i=count; i!=0; i--) { \ + for (j=0; ju.unpack.unpack_buffer, + el_size, + (int) *blocks_p); +#endif + + if (paramp->direction == DLOOP_M2M_TO_USERBUF) { + memcpy((char *) (paramp->userbuf + rel_off), paramp->streambuf, size); + } + else { + memcpy(paramp->streambuf, (char *) (paramp->userbuf + rel_off), size); + } + paramp->streambuf += size; + return 0; +} + +/* Segment_vector_m2m + * + * Note: this combines both packing and unpacking functionality. + * + * Note: this is only called when the starting position is at the beginning + * of a whole block in a vector type. + */ +int PREPEND_PREFIX(Segment_vector_m2m)(DLOOP_Offset *blocks_p, + DLOOP_Count unused, + DLOOP_Count blksz, + DLOOP_Offset stride, + DLOOP_Type el_type, + DLOOP_Offset rel_off, /* into buffer */ + DLOOP_Buffer unused2, + void *v_paramp) +{ + DLOOP_Count i, blocks_left, whole_count; + DLOOP_Offset el_size; + struct PREPEND_PREFIX(m2m_params) *paramp = v_paramp; + char *cbufp; + + cbufp = paramp->userbuf + rel_off; + DLOOP_Handle_get_size_macro(el_type, el_size); + + whole_count = (blksz > 0) ? (*blocks_p / blksz) : 0; + blocks_left = (blksz > 0) ? (*blocks_p % blksz) : 0; + + if (paramp->direction == DLOOP_M2M_TO_USERBUF) { + if (el_size == 8 + MPIR_ALIGN8_TEST(paramp->streambuf,cbufp)) + { + MPIDI_COPY_TO_VEC(paramp->streambuf, cbufp, stride, + int64_t, blksz, whole_count); + MPIDI_COPY_TO_VEC(paramp->streambuf, cbufp, 0, + int64_t, blocks_left, 1); + } + else if (el_size == 4 + MPIR_ALIGN4_TEST(paramp->streambuf,cbufp)) + { + MPIDI_COPY_TO_VEC((paramp->streambuf), cbufp, stride, + int32_t, blksz, whole_count); + MPIDI_COPY_TO_VEC(paramp->streambuf, cbufp, 0, + int32_t, blocks_left, 1); + } + else if (el_size == 2) { + MPIDI_COPY_TO_VEC(paramp->streambuf, cbufp, stride, + int16_t, blksz, whole_count); + MPIDI_COPY_TO_VEC(paramp->streambuf, cbufp, 0, + int16_t, blocks_left, 1); + } + else { + for (i=0; i < whole_count; i++) { + memcpy(cbufp, paramp->streambuf, blksz * el_size); + paramp->streambuf += blksz * el_size; + cbufp += stride; + } + if (blocks_left) { + memcpy(cbufp, paramp->streambuf, blocks_left * el_size); + paramp->streambuf += blocks_left * el_size; + } + } + } + else /* M2M_FROM_USERBUF */ { + if (el_size == 8 + MPIR_ALIGN8_TEST(cbufp,paramp->streambuf)) + { + MPIDI_COPY_FROM_VEC(cbufp, paramp->streambuf, stride, + int64_t, blksz, whole_count); + MPIDI_COPY_FROM_VEC(cbufp, paramp->streambuf, 0, + int64_t, blocks_left, 1); + } + else if (el_size == 4 + MPIR_ALIGN4_TEST(cbufp,paramp->streambuf)) + { + MPIDI_COPY_FROM_VEC(cbufp, paramp->streambuf, stride, + int32_t, blksz, whole_count); + MPIDI_COPY_FROM_VEC(cbufp, paramp->streambuf, 0, + int32_t, blocks_left, 1); + } + else if (el_size == 2) { + MPIDI_COPY_FROM_VEC(cbufp, paramp->streambuf, stride, + int16_t, blksz, whole_count); + MPIDI_COPY_FROM_VEC(cbufp, paramp->streambuf, 0, + int16_t, blocks_left, 1); + } + else { + for (i=0; i < whole_count; i++) { + memcpy(paramp->streambuf, cbufp, blksz * el_size); + paramp->streambuf += blksz * el_size; + cbufp += stride; + } + if (blocks_left) { + memcpy(paramp->streambuf, cbufp, blocks_left * el_size); + paramp->streambuf += blocks_left * el_size; + } + } + } + + return 0; +} + +/* MPID_Segment_blkidx_m2m + */ +int PREPEND_PREFIX(Segment_blkidx_m2m)(DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count blocklen, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer unused, + void *v_paramp) +{ + DLOOP_Count curblock = 0; + DLOOP_Offset el_size; + DLOOP_Offset blocks_left = *blocks_p; + char *cbufp; + struct PREPEND_PREFIX(m2m_params) *paramp = v_paramp; + + DLOOP_Handle_get_size_macro(el_type, el_size); + + while (blocks_left) { + char *src, *dest; + + DLOOP_Assert(curblock < count); + + cbufp = paramp->userbuf + rel_off + offsetarray[curblock]; + + if (blocklen > blocks_left) blocklen = blocks_left; + + if (paramp->direction == DLOOP_M2M_TO_USERBUF) { + src = paramp->streambuf; + dest = cbufp; + } + else { + src = cbufp; + dest = paramp->streambuf; + } + + /* note: macro modifies dest buffer ptr, so we must reset */ + if (el_size == 8 + MPIR_ALIGN8_TEST(src, dest)) + { + MPIDI_COPY_FROM_VEC(src, dest, 0, int64_t, blocklen, 1); + } + else if (el_size == 4 + MPIR_ALIGN4_TEST(src,dest)) + { + MPIDI_COPY_FROM_VEC(src, dest, 0, int32_t, blocklen, 1); + } + else if (el_size == 2) { + MPIDI_COPY_FROM_VEC(src, dest, 0, int16_t, blocklen, 1); + } + else { + memcpy(dest, src, blocklen * el_size); + } + + paramp->streambuf += blocklen * el_size; + blocks_left -= blocklen; + curblock++; + } + + return 0; +} + +/* MPID_Segment_index_m2m + */ +int PREPEND_PREFIX(Segment_index_m2m)(DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count *blockarray, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer unused, + void *v_paramp) +{ + int curblock = 0; + DLOOP_Offset el_size; + DLOOP_Offset cur_block_sz, blocks_left = *blocks_p; + char *cbufp; + struct PREPEND_PREFIX(m2m_params) *paramp = v_paramp; + + DLOOP_Handle_get_size_macro(el_type, el_size); + + while (blocks_left) { + char *src, *dest; + + DLOOP_Assert(curblock < count); + cur_block_sz = blockarray[curblock]; + + cbufp = paramp->userbuf + rel_off + offsetarray[curblock]; + + if (cur_block_sz > blocks_left) cur_block_sz = blocks_left; + + if (paramp->direction == DLOOP_M2M_TO_USERBUF) { + src = paramp->streambuf; + dest = cbufp; + } + else { + src = cbufp; + dest = paramp->streambuf; + } + + /* note: macro modifies dest buffer ptr, so we must reset */ + if (el_size == 8 + MPIR_ALIGN8_TEST(src, dest)) + { + MPIDI_COPY_FROM_VEC(src, dest, 0, int64_t, cur_block_sz, 1); + } + else if (el_size == 4 + MPIR_ALIGN4_TEST(src,dest)) + { + MPIDI_COPY_FROM_VEC(src, dest, 0, int32_t, cur_block_sz, 1); + } + else if (el_size == 2) { + MPIDI_COPY_FROM_VEC(src, dest, 0, int16_t, cur_block_sz, 1); + } + else { + memcpy(dest, src, cur_block_sz * el_size); + } + + paramp->streambuf += cur_block_sz * el_size; + blocks_left -= cur_block_sz; + curblock++; + } + + return 0; +} + +void PREPEND_PREFIX(Segment_pack)(DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + void *streambuf) +{ + struct PREPEND_PREFIX(m2m_params) params; + + /* experimenting with discarding buf value in the segment, keeping in + * per-use structure instead. would require moving the parameters around a + * bit. same applies to Segment_unpack below. + */ + params.userbuf = segp->ptr; + params.streambuf = streambuf; + params.direction = DLOOP_M2M_FROM_USERBUF; + + PREPEND_PREFIX(Segment_manipulate)(segp, first, lastp, + PREPEND_PREFIX(Segment_contig_m2m), + PREPEND_PREFIX(Segment_vector_m2m), + PREPEND_PREFIX(Segment_blkidx_m2m), + PREPEND_PREFIX(Segment_index_m2m), + NULL, /* size fn */ + ¶ms); + return; +} + +void PREPEND_PREFIX(Segment_unpack)(DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + void *streambuf) +{ + struct PREPEND_PREFIX(m2m_params) params; + + params.userbuf = segp->ptr; + params.streambuf = streambuf; + params.direction = DLOOP_M2M_TO_USERBUF; + + PREPEND_PREFIX(Segment_manipulate)(segp, first, lastp, + PREPEND_PREFIX(Segment_contig_m2m), + PREPEND_PREFIX(Segment_vector_m2m), + PREPEND_PREFIX(Segment_blkidx_m2m), + PREPEND_PREFIX(Segment_index_m2m), + NULL, /* size fn */ + ¶ms); + return; +} + +struct PREPEND_PREFIX(contig_blocks_params) { + DLOOP_Count count; + DLOOP_Offset last_loc; +}; + +/* MPID_Segment_contig_count_block + * + * Note: because bufp is just an offset, we can ignore it in our + * calculations of # of contig regions. + */ +static int DLOOP_Segment_contig_count_block(DLOOP_Offset *blocks_p, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer unused, + void *v_paramp) +{ + DLOOP_Offset size, el_size; + struct PREPEND_PREFIX(contig_blocks_params) *paramp = v_paramp; + + DLOOP_Assert(*blocks_p > 0); + + DLOOP_Handle_get_size_macro(el_type, el_size); + size = *blocks_p * el_size; + +#ifdef MPID_SP_VERBOSE + MPIU_dbg_printf("contig count block: count = %d, buf+off = %d, lastloc = %d\n", + (int) paramp->count, + (int) ((char *) bufp + rel_off), + (int) paramp->last_loc); +#endif + + if (paramp->count > 0 && rel_off == paramp->last_loc) + { + /* this region is adjacent to the last */ + paramp->last_loc += size; + } + else { + /* new region */ + paramp->last_loc = rel_off + size; + paramp->count++; + } + return 0; +} + +/* DLOOP_Segment_vector_count_block + * + * Input Parameters: + * blocks_p - [inout] pointer to a count of blocks (total, for all noncontiguous pieces) + * count - # of noncontiguous regions + * blksz - size of each noncontiguous region + * stride - distance in bytes from start of one region to start of next + * el_type - elemental type (e.g. MPI_INT) + * ... + * + * Note: this is only called when the starting position is at the beginning + * of a whole block in a vector type. + */ +static int DLOOP_Segment_vector_count_block(DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count blksz, + DLOOP_Offset stride, + DLOOP_Type el_type, + DLOOP_Offset rel_off, /* into buffer */ + DLOOP_Buffer unused, + void *v_paramp) +{ + DLOOP_Count new_blk_count; + DLOOP_Offset size, el_size; + struct PREPEND_PREFIX(contig_blocks_params) *paramp = v_paramp; + + DLOOP_Assert(count > 0 && blksz > 0 && *blocks_p > 0); + + DLOOP_Handle_get_size_macro(el_type, el_size); + size = el_size * blksz; + new_blk_count = count; + + /* if size == stride, then blocks are adjacent to one another */ + if (size == stride) new_blk_count = 1; + + if (paramp->count > 0 && rel_off == paramp->last_loc) + { + /* first block sits at end of last block */ + new_blk_count--; + } + + paramp->last_loc = rel_off + (count-1) * stride + size; + paramp->count += new_blk_count; + return 0; +} + +/* DLOOP_Segment_blkidx_count_block + * + * Note: this is only called when the starting position is at the + * beginning of a whole block in a blockindexed type. + */ +static int DLOOP_Segment_blkidx_count_block(DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count blksz, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer unused, + void *v_paramp) +{ + DLOOP_Count i, new_blk_count; + DLOOP_Offset size, el_size, last_loc; + struct PREPEND_PREFIX(contig_blocks_params) *paramp = v_paramp; + + DLOOP_Assert(count > 0 && blksz > 0 && *blocks_p > 0); + + DLOOP_Handle_get_size_macro(el_type, el_size); + size = el_size * blksz; + new_blk_count = count; + + if (paramp->count > 0 && rel_off == paramp->last_loc) + { + /* first block sits at end of last block */ + new_blk_count--; + } + + last_loc = rel_off + offsetarray[0] + size; + for (i=1; i < count; i++) { + if (last_loc == rel_off + offsetarray[i]) new_blk_count--; + + last_loc = rel_off + offsetarray[i] + size; + } + + paramp->last_loc = last_loc; + paramp->count += new_blk_count; + return 0; +} + +/* DLOOP_Segment_index_count_block + * + * Note: this is only called when the starting position is at the + * beginning of a whole block in an indexed type. + */ +static int DLOOP_Segment_index_count_block(DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count *blockarray, + DLOOP_Offset *offsetarray, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer unused, + void *v_paramp) +{ + DLOOP_Count new_blk_count; + DLOOP_Offset el_size, last_loc; + struct PREPEND_PREFIX(contig_blocks_params) *paramp = v_paramp; + + DLOOP_Assert(count > 0 && *blocks_p > 0); + + DLOOP_Handle_get_size_macro(el_type, el_size); + new_blk_count = count; + + if (paramp->count > 0 && rel_off == paramp->last_loc) + { + /* first block sits at end of last block */ + new_blk_count--; + } + + /* Note: when we build an indexed type we combine adjacent regions, + * so we're not going to go through and check every piece + * separately here. if someone else were building indexed + * dataloops by hand, then the loop here might be necessary. + * DLOOP_Count i and DLOOP_Offset size would need to be + * declared above. + */ + last_loc = rel_off + offsetarray[count-1] + blockarray[count-1] * el_size; + + paramp->last_loc = last_loc; + paramp->count += new_blk_count; + return 0; +} + +/* DLOOP_Segment_count_contig_blocks() + * + * Count number of contiguous regions in segment between first and last. + */ +void PREPEND_PREFIX(Segment_count_contig_blocks)(DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + DLOOP_Count *countp) +{ + struct PREPEND_PREFIX(contig_blocks_params) params; + + params.count = 0; + params.last_loc = 0; + + PREPEND_PREFIX(Segment_manipulate)(segp, + first, + lastp, + DLOOP_Segment_contig_count_block, + DLOOP_Segment_vector_count_block, + DLOOP_Segment_blkidx_count_block, + DLOOP_Segment_index_count_block, + NULL, /* size fn */ + (void *) ¶ms); + + *countp = params.count; + return; +} + +/********** FUNCTIONS FOR FLATTENING INTO MPI OFFSETS AND BLKLENS **********/ + +/* Segment_mpi_flatten + * + * Flattens into a set of blocklengths and displacements, as in an + * MPI hindexed type. Note that we use appropriately-sized variables + * in the associated params structure for this reason. + * + * NOTE: blocks will be in units of bytes when returned. + * + * WARNING: there's potential for overflow here as we convert from + * various types into an index of bytes. + */ +struct PREPEND_PREFIX(mpi_flatten_params) { + int index, length; + MPI_Aint last_end; + int *blklens; + MPI_Aint *disps; +}; + +/* DLOOP_Segment_contig_mpi_flatten + * + */ +static int DLOOP_Segment_contig_mpi_flatten(DLOOP_Offset *blocks_p, + DLOOP_Type el_type, + DLOOP_Offset rel_off, + DLOOP_Buffer bufp, + void *v_paramp) +{ + int last_idx, size; + DLOOP_Offset el_size; + char *last_end = NULL; + struct PREPEND_PREFIX(mpi_flatten_params) *paramp = v_paramp; + + DLOOP_Handle_get_size_macro(el_type, el_size); + size = *blocks_p * (int) el_size; + + last_idx = paramp->index - 1; + if (last_idx >= 0) { + last_end = ((char *) paramp->disps[last_idx]) + + paramp->blklens[last_idx]; + } + + if ((last_idx == paramp->length-1) && + (last_end != ((char *) bufp + rel_off))) + { + /* we have used up all our entries, and this region doesn't fit on + * the end of the last one. setting blocks to 0 tells manipulation + * function that we are done (and that we didn't process any blocks). + */ + *blocks_p = 0; + return 1; + } + else if (last_idx >= 0 && (last_end == ((char *) bufp + rel_off))) + { + /* add this size to the last vector rather than using up another one */ + paramp->blklens[last_idx] += size; + } + else { + paramp->disps[last_idx+1] = (MPI_Aint) ((char *) bufp + rel_off); + paramp->blklens[last_idx+1] = size; + paramp->index++; + } + return 0; +} + +/* DLOOP_Segment_vector_mpi_flatten + * + * Input Parameters: + * blocks_p - [inout] pointer to a count of blocks (total, for all noncontiguous pieces) + * count - # of noncontiguous regions + * blksz - size of each noncontiguous region + * stride - distance in bytes from start of one region to start of next + * el_type - elemental type (e.g. MPI_INT) + * ... + * + * Note: this is only called when the starting position is at the beginning + * of a whole block in a vector type. + * + * TODO: MAKE THIS CODE SMARTER, USING THE SAME GENERAL APPROACH AS IN THE + * COUNT BLOCK CODE ABOVE. + */ +static int DLOOP_Segment_vector_mpi_flatten(DLOOP_Offset *blocks_p, + DLOOP_Count count, + DLOOP_Count blksz, + DLOOP_Offset stride, + DLOOP_Type el_type, + DLOOP_Offset rel_off, /* into buffer */ + DLOOP_Buffer bufp, /* start of buffer */ + void *v_paramp) +{ + int i, size, blocks_left; + DLOOP_Offset el_size; + struct PREPEND_PREFIX(mpi_flatten_params) *paramp = v_paramp; + + DLOOP_Handle_get_size_macro(el_type, el_size); + blocks_left = *blocks_p; + + for (i=0; i < count && blocks_left > 0; i++) { + int last_idx; + char *last_end = NULL; + + if (blocks_left > blksz) { + size = blksz * (int) el_size; + blocks_left -= blksz; + } + else { + /* last pass */ + size = blocks_left * (int) el_size; + blocks_left = 0; + } + + last_idx = paramp->index - 1; + if (last_idx >= 0) { + last_end = ((char *) paramp->disps[last_idx]) + + paramp->blklens[last_idx]; + } + + if ((last_idx == paramp->length-1) && + (last_end != ((char *) bufp + rel_off))) + { + /* we have used up all our entries, and this one doesn't fit on + * the end of the last one. + */ + *blocks_p -= (blocks_left + (size / (int) el_size)); +#ifdef MPID_SP_VERBOSE + MPIU_dbg_printf("\t[vector to vec exiting (1): next ind = %d, %d blocks processed.\n", + paramp->u.pack_vector.index, + (int) *blocks_p); +#endif + return 1; + } + else if (last_idx >= 0 && (last_end == ((char *) bufp + rel_off))) + { + /* add this size to the last vector rather than using up new one */ + paramp->blklens[last_idx] += size; + } + else { + paramp->disps[last_idx+1] = (MPI_Aint) ((char *) bufp + rel_off); + paramp->blklens[last_idx+1] = size; + paramp->index++; + } + + rel_off += stride; + } + +#ifdef MPID_SP_VERBOSE + MPIU_dbg_printf("\t[vector to vec exiting (2): next ind = %d, %d blocks processed.\n", + paramp->u.pack_vector.index, + (int) *blocks_p); +#endif + + /* if we get here then we processed ALL the blocks; don't need to update + * blocks_p + */ + + DLOOP_Assert(blocks_left == 0); + return 0; +} + +/* MPID_Segment_mpi_flatten - flatten a type into a representation + * appropriate for passing to hindexed create. + * + * Parameters: + * segp - pointer to segment structure + * first - first byte in segment to pack + * lastp - in/out parameter describing last byte to pack (and afterwards + * the last byte _actually_ packed) + * NOTE: actually returns index of byte _after_ last one packed + * blklens, disps - the usual blocklength and displacement arrays for MPI + * lengthp - in/out parameter describing length of array (and afterwards + * the amount of the array that has actual data) + */ +void PREPEND_PREFIX(Segment_mpi_flatten)(DLOOP_Segment *segp, + DLOOP_Offset first, + DLOOP_Offset *lastp, + int *blklens, + MPI_Aint *disps, + int *lengthp) +{ + struct PREPEND_PREFIX(mpi_flatten_params) params; + + DLOOP_Assert(*lengthp > 0); + + params.index = 0; + params.length = *lengthp; + params.blklens = blklens; + params.disps = disps; + + PREPEND_PREFIX(Segment_manipulate)(segp, + first, + lastp, + DLOOP_Segment_contig_mpi_flatten, + DLOOP_Segment_vector_mpi_flatten, + NULL, /* blkidx fn */ + NULL, /* index fn */ + NULL, + ¶ms); + + /* last value already handled by MPID_Segment_manipulate */ + *lengthp = params.index; + return; +} + +/* + * Local variables: + * c-indent-tabs-mode: nil + * End: + */ diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/subarray_support.c b/src/libs/ck-libs/ampi/romio/common/dataloop/subarray_support.c new file mode 100644 index 0000000000..a29d3fbd07 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/subarray_support.c @@ -0,0 +1,99 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + * + * Note: This code originally appeared in ROMIO. + */ + +#include "dataloop.h" + +int PREPEND_PREFIX(Type_convert_subarray)(int ndims, + int *array_of_sizes, + int *array_of_subsizes, + int *array_of_starts, + int order, + MPI_Datatype oldtype, + MPI_Datatype *newtype) +{ + MPI_Aint extent, disps[3], size; + int i, blklens[3]; + MPI_Datatype tmp1, tmp2, types[3]; + + MPI_Type_extent(oldtype, &extent); + + if (order == MPI_ORDER_FORTRAN) { + /* dimension 0 changes fastest */ + if (ndims == 1) { + MPI_Type_contiguous(array_of_subsizes[0], oldtype, &tmp1); + } + else { + MPI_Type_vector(array_of_subsizes[1], + array_of_subsizes[0], + array_of_sizes[0], oldtype, &tmp1); + + size = array_of_sizes[0]*extent; + for (i=2; i=0; i--) { + size *= array_of_sizes[i+1]; + MPI_Type_hvector(array_of_subsizes[i], 1, size, tmp1, &tmp2); + MPI_Type_free(&tmp1); + tmp1 = tmp2; + } + } + + /* add displacement and UB */ + disps[1] = array_of_starts[ndims-1]; + size = 1; + for (i=ndims-2; i>=0; i--) { + size *= array_of_sizes[i+1]; + disps[1] += size*array_of_starts[i]; + } + } + + disps[1] *= extent; + + disps[2] = extent; + for (i=0; i= old_lb_) { \ + lb_ = old_lb_; \ + ub_ = old_ub_ + (old_extent_) * (cnt_ - 1); \ + } \ + else /* negative extent */ { \ + lb_ = old_lb_ + (old_extent_) * (cnt_ - 1); \ + ub_ = old_ub_; \ + } \ + } + +/* DLOOP_DATATYPE_VECTOR_LB_UB() + * + * Determines the new LB and UB for a vector of blocks of old types + * given the old type's LB, UB, and extent, and a count, stride, and + * blocklen describing the vectorization. + */ +#define DLOOP_DATATYPE_VECTOR_LB_UB(cnt_, \ + stride_, \ + blklen_, \ + old_lb_, \ + old_ub_, \ + old_extent_, \ + lb_, \ + ub_) \ + { \ + if (cnt_ == 0 || blklen_ == 0) { \ + lb_ = old_lb_; \ + ub_ = old_ub_; \ + } \ + else if (stride_ >= 0 && (old_extent_) >= 0) { \ + lb_ = old_lb_; \ + ub_ = old_ub_ + (old_extent_) * ((blklen_) - 1) + \ + (stride_) * ((cnt_) - 1); \ + } \ + else if (stride_ < 0 && (old_extent_) >= 0) { \ + lb_ = old_lb_ + (stride_) * ((cnt_) - 1); \ + ub_ = old_ub_ + (old_extent_) * ((blklen_) - 1); \ + } \ + else if (stride_ >= 0 && (old_extent_) < 0) { \ + lb_ = old_lb_ + (old_extent_) * ((blklen_) - 1); \ + ub_ = old_ub_ + (stride_) * ((cnt_) - 1); \ + } \ + else { \ + lb_ = old_lb_ + (old_extent_) * ((blklen_) - 1) + \ + (stride_) * ((cnt_) - 1); \ + ub_ = old_ub_; \ + } \ + } + +/* DLOOP_DATATYPE_BLOCK_LB_UB() + * + * Determines the new LB and UB for a block of old types given the LB, + * UB, and extent of the old type as well as a new displacement and count + * of types. + * + * Note: we need the extent here in addition to the lb and ub because the + * extent might have some padding in it that we need to take into account. + */ +#define DLOOP_DATATYPE_BLOCK_LB_UB(cnt_, \ + disp_, \ + old_lb_, \ + old_ub_, \ + old_extent_, \ + lb_, \ + ub_) \ + { \ + if (cnt_ == 0) { \ + lb_ = old_lb_ + (disp_); \ + ub_ = old_ub_ + (disp_); \ + } \ + else if (old_ub_ >= old_lb_) { \ + lb_ = old_lb_ + (disp_); \ + ub_ = old_ub_ + (disp_) + (old_extent_) * ((cnt_) - 1); \ + } \ + else /* negative extent */ { \ + lb_ = old_lb_ + (disp_) + (old_extent_) * ((cnt_) - 1); \ + ub_ = old_ub_ + (disp_); \ + } \ + } + +void PREPEND_PREFIX(Type_calc_footprint)(MPI_Datatype type, + DLOOP_Type_footprint *tfp) +{ + int mpi_errno; + int nr_ints, nr_aints, nr_types, combiner; + int *ints; + MPI_Aint *aints; + MPI_Datatype *types; + + /* used to store parameters for constituent types */ + DLOOP_Offset size = 0, lb = 0, ub = 0, true_lb = 0, true_ub = 0; + DLOOP_Offset extent = 0, alignsz; + int has_sticky_lb, has_sticky_ub; + + /* used for vector/hvector/hvector_integer calculations */ + DLOOP_Offset stride; + + /* used for indexed/hindexed calculations */ + DLOOP_Offset disp; + + /* used for calculations on types with more than one block of data */ + DLOOP_Offset i, min_lb, max_ub, ntypes, tmp_lb, tmp_ub; + + /* used for processing subarray and darray types */ + int ndims; + MPI_Datatype tmptype; + + mpi_errno = MPI_Type_get_envelope(type, &nr_ints, &nr_aints, + &nr_types, &combiner); + DLOOP_Assert(mpi_errno == MPI_SUCCESS); + + if (combiner == MPI_COMBINER_NAMED) { + int mpisize; + MPI_Aint mpiextent; + + MPI_Type_size(type, &mpisize); + MPI_Type_extent(type, &mpiextent); + tfp->size = (DLOOP_Offset) mpisize; + tfp->lb = 0; + tfp->ub = (DLOOP_Offset) mpiextent; + tfp->true_lb = 0; + tfp->true_ub = (DLOOP_Offset) mpiextent; + tfp->extent = (DLOOP_Offset) mpiextent; + tfp->alignsz = DLOOP_Named_type_alignsize(type, (MPI_Aint) 0); + tfp->has_sticky_lb = (type == MPI_LB) ? 1 : 0; + tfp->has_sticky_ub = (type == MPI_UB) ? 1 : 0; + + goto clean_exit; + } + + /* get access to contents; need it immediately to check for zero count */ + PREPEND_PREFIX(Type_access_contents)(type, &ints, &aints, &types); + + /* knock out all the zero count cases */ + if ((combiner == MPI_COMBINER_CONTIGUOUS || + combiner == MPI_COMBINER_VECTOR || + combiner == MPI_COMBINER_HVECTOR_INTEGER || + combiner == MPI_COMBINER_HVECTOR || + combiner == MPI_COMBINER_INDEXED_BLOCK || + combiner == MPI_COMBINER_INDEXED || + combiner == MPI_COMBINER_HINDEXED_INTEGER || + combiner == MPI_COMBINER_STRUCT_INTEGER || + combiner == MPI_COMBINER_STRUCT) && ints[0] == 0) + { + tfp->size = tfp->lb = tfp->ub = tfp->extent = tfp->alignsz = 0; + tfp->true_lb = tfp->true_ub = 0; + tfp->has_sticky_lb = tfp->has_sticky_ub = 0; + goto clean_exit; + } + + if (combiner != MPI_COMBINER_STRUCT && + combiner != MPI_COMBINER_STRUCT_INTEGER) + { + DLOOP_Type_footprint cfp; + + PREPEND_PREFIX(Type_calc_footprint)(types[0], &cfp); + size = cfp.size; + lb = cfp.lb; + ub = cfp.ub; + true_lb = cfp.true_lb; + true_ub = cfp.true_ub; + extent = cfp.extent; + alignsz = cfp.alignsz; + has_sticky_lb = cfp.has_sticky_lb; + has_sticky_ub = cfp.has_sticky_ub; + + /* initialize some common values so we don't have to assign + * them in every case below. + */ + tfp->alignsz = alignsz; + tfp->has_sticky_lb = has_sticky_lb; + tfp->has_sticky_ub = has_sticky_ub; + + } + + switch(combiner) + { + case MPI_COMBINER_DUP: + tfp->size = size; + tfp->lb = lb; + tfp->ub = ub; + tfp->true_lb = true_lb; + tfp->true_ub = true_ub; + tfp->extent = extent; + break; + case MPI_COMBINER_RESIZED: + tfp->size = size; + tfp->lb = aints[0]; /* lb */ + tfp->ub = aints[0] + aints[1]; + tfp->true_lb = true_lb; + tfp->true_ub = true_ub; + tfp->extent = aints[1]; /* extent */ + tfp->has_sticky_lb = 1; + tfp->has_sticky_ub = 1; + break; + case MPI_COMBINER_CONTIGUOUS: + DLOOP_DATATYPE_CONTIG_LB_UB(ints[0] /* count */, + lb, ub, extent, + tfp->lb, tfp->ub); + tfp->true_lb = tfp->lb + (true_lb - lb); + tfp->true_ub = tfp->ub + (true_ub - ub); + tfp->size = ints[0] * size; + tfp->extent = tfp->ub - tfp->lb; + break; + case MPI_COMBINER_VECTOR: + case MPI_COMBINER_HVECTOR: + case MPI_COMBINER_HVECTOR_INTEGER: + if (combiner == MPI_COMBINER_VECTOR) stride = ints[2] * extent; + else if (combiner == MPI_COMBINER_HVECTOR) stride = aints[0]; + else /* HVECTOR_INTEGER */ stride = ints[2]; + + DLOOP_DATATYPE_VECTOR_LB_UB(ints[0] /* count */, + stride /* stride in bytes */, + ints[1] /* blklen */, + lb, ub, extent, + tfp->lb, tfp->ub); + tfp->true_lb = tfp->lb + (true_lb - lb); + tfp->true_ub = tfp->ub + (true_ub - ub); + tfp->size = ints[0] * ints[1] * size; + tfp->extent = tfp->ub - tfp->lb; + break; + case MPI_COMBINER_INDEXED_BLOCK: + /* prime min_lb and max_ub */ + DLOOP_DATATYPE_BLOCK_LB_UB(ints[1] /* blklen */, + ints[2] * extent /* disp */, + lb, ub, extent, + min_lb, max_ub); + + for (i=1; i < ints[0]; i++) { + DLOOP_DATATYPE_BLOCK_LB_UB(ints[1] /* blklen */, + ints[i+2] * extent /* disp */, + lb, ub, extent, + tmp_lb, tmp_ub); + if (tmp_lb < min_lb) min_lb = tmp_lb; + if (tmp_ub > max_ub) max_ub = tmp_ub; + } + tfp->size = ints[0] * ints[1] * size; + tfp->lb = min_lb; + tfp->ub = max_ub; + tfp->true_lb = min_lb + (true_lb - lb); + tfp->true_ub = max_ub + (true_ub - ub); + tfp->extent = tfp->ub - tfp->lb; + break; + case MPI_COMBINER_INDEXED: + case MPI_COMBINER_HINDEXED_INTEGER: + case MPI_COMBINER_HINDEXED: + /* find first non-zero blocklength element */ + for (i=0; i < ints[0] && ints[i+1] == 0; i++); + if (i == ints[0]) { + /* all zero blocklengths */ + tfp->size = tfp->lb = tfp->ub = tfp->extent = tfp->alignsz = 0; + tfp->has_sticky_lb = tfp->has_sticky_ub = 0; + } + else { + /* prime min_lb, max_ub, count */ + ntypes = ints[i+1]; + if (combiner == MPI_COMBINER_INDEXED) + disp = ints[ints[0]+i+1] * extent; + else if (combiner == MPI_COMBINER_HINDEXED_INTEGER) + disp = ints[ints[0]+i+1]; + else /* MPI_COMBINER_HINDEXED */ + disp = aints[i]; + + DLOOP_DATATYPE_BLOCK_LB_UB(ints[i+1] /* blklen */, + disp, + lb, ub, extent, + min_lb, max_ub); + + for (i++; i < ints[0]; i++) { + /* skip zero blocklength elements */ + if (ints[i+1] == 0) continue; + + ntypes += ints[i+1]; + if (combiner == MPI_COMBINER_INDEXED) + disp = ints[ints[0]+i+1] * extent; + else if (combiner == MPI_COMBINER_HINDEXED_INTEGER) + disp = ints[ints[0]+i+1]; + else /* MPI_COMBINER_HINDEXED */ + disp = aints[i]; + + DLOOP_DATATYPE_BLOCK_LB_UB(ints[i+1], + disp, + lb, ub, extent, + tmp_lb, tmp_ub); + if (tmp_lb < min_lb) min_lb = tmp_lb; + if (tmp_ub > max_ub) max_ub = tmp_ub; + } + tfp->size = ntypes * size; + tfp->lb = min_lb; + tfp->ub = max_ub; + tfp->true_lb = min_lb + (true_lb - lb); + tfp->true_ub = max_ub + (true_ub - ub); + tfp->extent = tfp->ub - tfp->lb; + } + break; + case MPI_COMBINER_STRUCT_INTEGER: + DLOOP_Assert(combiner != MPI_COMBINER_STRUCT_INTEGER); + break; + case MPI_COMBINER_STRUCT: + /* sufficiently complicated to pull out into separate fn */ + DLOOP_Type_calc_footprint_struct(type, + combiner, ints, aints, types, + tfp); + break; + case MPI_COMBINER_SUBARRAY: + ndims = ints[0]; + PREPEND_PREFIX(Type_convert_subarray)(ndims, + &ints[1] /* sizes */, + &ints[1+ndims] /* subsz */, + &ints[1+2*ndims] /* strts */, + ints[1+3*ndims] /* order */, + types[0], + &tmptype); + PREPEND_PREFIX(Type_calc_footprint)(tmptype, tfp); + MPI_Type_free(&tmptype); + break; + case MPI_COMBINER_DARRAY: + ndims = ints[2]; + + PREPEND_PREFIX(Type_convert_darray)(ints[0] /* size */, + ints[1] /* rank */, + ndims, + &ints[3] /* gsizes */, + &ints[3+ndims] /*distribs */, + &ints[3+2*ndims] /* dargs */, + &ints[3+3*ndims] /* psizes */, + ints[3+4*ndims] /* order */, + types[0], + &tmptype); + + PREPEND_PREFIX(Type_calc_footprint)(tmptype, tfp); + MPI_Type_free(&tmptype); + break; + case MPI_COMBINER_F90_REAL: + case MPI_COMBINER_F90_COMPLEX: + case MPI_COMBINER_F90_INTEGER: + default: + DLOOP_Assert(0); + break; + } + + clean_exit: + PREPEND_PREFIX(Type_release_contents)(type, &ints, &aints, &types); + return; +} + +/* + DLOOP_Type_calc_footprint_struct - calculate size, lb, ub, extent, + and alignsize for a struct type +*/ +static void DLOOP_Type_calc_footprint_struct(MPI_Datatype type, + int struct_combiner, + int *ints, + MPI_Aint *aints, + MPI_Datatype *types, + DLOOP_Type_footprint *tfp) +{ + int i, found_sticky_lb = 0, found_sticky_ub = 0, first_iter = 1; + DLOOP_Offset tmp_lb, tmp_ub, tmp_extent, tmp_true_lb, tmp_true_ub; + DLOOP_Offset max_alignsz = 0, tmp_size = 0, min_lb = 0, max_ub = 0; + DLOOP_Offset min_true_lb = 0, max_true_ub = 0; + + int nr_ints, nr_aints, nr_types, combiner; + + /* used to store parameters for constituent types */ + DLOOP_Type_footprint cfp; + DLOOP_Offset size, lb, ub, true_lb, true_ub, extent, alignsz; + int sticky_lb, sticky_ub; + + /* find first non-zero blocklength element */ + for (i=0; i < ints[0] && ints[i+1] == 0; i++); + + if (i == ints[0]) /* all zero-length blocks */ { + tfp->size = tfp->lb = tfp->ub = tfp->extent = tfp->alignsz = 0; + tfp->has_sticky_lb = tfp->has_sticky_ub = 0; + return; + } + + for (; i < ints[0]; i++) { + /* skip zero blocklength elements */ + if (ints[i+1] == 0) continue; + + MPI_Type_get_envelope(types[i], &nr_ints, &nr_aints, &nr_types, + &combiner); + + /* opt: could just inline assignments for combiner == NAMED case */ + + PREPEND_PREFIX(Type_calc_footprint)(types[i], &cfp); + size = cfp.size; + lb = cfp.lb; + ub = cfp.ub; + true_lb = cfp.true_lb; + true_ub = cfp.true_ub; + extent = cfp.extent; + alignsz = cfp.alignsz; + sticky_lb = cfp.has_sticky_lb; + sticky_ub = cfp.has_sticky_ub; + + DLOOP_DATATYPE_BLOCK_LB_UB(ints[i+1] /* blklen */, + aints[i] /* disp */, + lb, ub, extent, + tmp_lb, tmp_ub); + + tmp_true_lb = tmp_lb + (true_lb - lb); + tmp_true_ub = tmp_ub + (true_ub - ub); + tmp_size += size * ints[i+1]; + + if (combiner == MPI_COMBINER_NAMED) { + /* NOTE: This is a special case. If a user creates a struct + * with a named type at a non-zero displacement, the + * alignment may be different than expected due to + * special compiler rules for this case. Thus we must + * over-ride the value that we obtained from + * Type_calc_footprint() above. + */ + alignsz = DLOOP_Named_type_alignsize(types[i], aints[i]); + } + + if (max_alignsz < alignsz) max_alignsz = alignsz; + + /* We save this LB if: + * (1) this is our first iteration where we saw a nonzero blklen, + * (2) we haven't found a sticky LB and this LB is lower than + * any we have previously seen, + * (3) we haven't found a sticky LB and this one is sticky, or + * (4) this sticky LB is lower than any we have previously seen. + */ + if ((first_iter) || + (!found_sticky_lb && min_lb > tmp_lb) || + (!found_sticky_lb && sticky_lb) || + (sticky_lb && min_lb > tmp_lb)) + { + min_lb = tmp_lb; + if (sticky_lb) found_sticky_lb = 1; + } + + if ((first_iter) || + (!found_sticky_ub && max_ub < tmp_ub) || + (!found_sticky_ub && sticky_ub) || + (sticky_ub && max_ub < tmp_ub)) + { + max_ub = tmp_ub; + if (sticky_ub) found_sticky_ub = 1; + } + + if ((first_iter) || + (tmp_true_lb > min_true_lb)) + { + min_true_lb = tmp_true_lb; + } + + if ((first_iter) || + (tmp_true_ub < max_true_ub)) + { + max_true_ub = tmp_true_ub; + } + + first_iter = 0; + } + + /* calculate extent, not including potential padding */ + tmp_extent = max_ub - min_lb; + + /* account for padding if no sticky LB/UB is found */ + if ((!found_sticky_lb) && (!found_sticky_ub)) { + DLOOP_Offset epsilon; + + epsilon = (max_alignsz > 0) ? tmp_extent % max_alignsz : 0; + + if (epsilon) { + max_ub += (max_alignsz - epsilon); + tmp_extent = max_ub - min_lb; + } + } + + tfp->size = tmp_size; + tfp->lb = min_lb; + tfp->ub = max_ub; + tfp->true_lb = min_true_lb; + tfp->true_ub = max_true_ub; + tfp->extent = tmp_extent; + tfp->alignsz = max_alignsz; + tfp->has_sticky_lb = found_sticky_lb; + tfp->has_sticky_ub = found_sticky_ub; + return; +} + +/* + DLOOP_Named_type_alignsize - calculate alignment in bytes for a struct + based on constituent elements. + + Returns alignment in bytes. +*/ +static int DLOOP_Named_type_alignsize(MPI_Datatype type, MPI_Aint disp) +{ + int alignsize = 0; + + static int havent_tested_align_rules = 1; + static int max_intalign = 0, max_fpalign = 0; + static int have_double_pos_align = 0, have_llint_pos_align = 0; + static int max_doublealign = 0, max_longdoublealign = 0; + + if (havent_tested_align_rules) { + max_intalign = DLOOP_Structalign_integer_max(); + max_fpalign = DLOOP_Structalign_float_max(); + max_doublealign = DLOOP_Structalign_double_max(); + max_longdoublealign = DLOOP_Structalign_long_double_max(); + have_double_pos_align = DLOOP_Structalign_double_position(); + have_llint_pos_align = DLOOP_Structalign_llint_position(); + + havent_tested_align_rules = 0; + } + + /* skip LBs, UBs, and elements with zero block length */ + if (type == MPI_LB || type == MPI_UB) + return 0; + + MPI_Type_size(type, &alignsize); + + switch(type) + { + case MPI_FLOAT: + if (alignsize > max_fpalign) + alignsize = max_fpalign; + break; + case MPI_DOUBLE: + if (alignsize > max_doublealign) + alignsize = max_doublealign; + + if (have_double_pos_align && disp != (MPI_Aint) 0) + alignsize = 4; /* would be better to test */ + break; + case MPI_LONG_DOUBLE: + if (alignsize > max_longdoublealign) + alignsize = max_longdoublealign; + break; + default: + if (alignsize > max_intalign) + alignsize = max_intalign; + + if (have_llint_pos_align && + type == MPI_LONG_LONG_INT && + disp != (MPI_Aint) 0) + { + alignsize = 4; /* would be better to test */ + } + break; + } + + return alignsize; +} + + +/* INTERNAL STRUCT ALIGNMENT TESTS BELOW */ + +/* from MPICH2 PAC_C_MAX_INTEGER_ALIGN test: + * + * Tests for max C struct integer alignment. Note that this is for *all* + * integer types. + * + * Return value is 1, 2, 4, or 8. + */ +static int DLOOP_Structalign_integer_max() +{ + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + + int size, extent; + + struct { char a; int b; } char_int; + struct { char a; short b; } char_short; + struct { char a; long b; } char_long; + struct { char a; int b; char c; } char_int_char; + struct { char a; short b; char c; } char_short_char; +#ifdef HAVE_LONG_LONG_INT + struct { long long int a; char b; } lli_c; + struct { char a; long long int b; } c_lli; + int extent2; +#endif + + /* assume max integer alignment isn't 8 if we don't have + * an eight-byte value. + */ +#ifdef HAVE_LONG_LONG_INT + if (sizeof(int) < 8 && sizeof(long) < 8 && sizeof(long long int) < 8) + is_eight = 0; +#else + if (sizeof(int) < 8 && sizeof(long) < 8) is_eight = 0; +#endif + + size = sizeof(char) + sizeof(int); + extent = sizeof(char_int); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if ( (extent % 4) != 0) is_four = 0; + if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; + + size = sizeof(char) + sizeof(short); + extent = sizeof(char_short); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; + if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; + + size = sizeof(char) + sizeof(long); + extent = sizeof(char_long); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if ( (extent % 4) != 0) is_four = 0; + if (sizeof(long) == 8 && (extent % 8) != 0) is_eight = 0; + +#ifdef HAVE_LONG_LONG_INT + size = sizeof(char) + sizeof(long long int); + extent = sizeof(lli_c); + extent2 = sizeof(c_lli); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(long long int) >= 8 && (extent % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; +#endif + + size = sizeof(char) + sizeof(int) + sizeof(char); + extent = sizeof(char_int_char); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if ( (extent % 4) != 0) is_four = 0; + if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; + + size = sizeof(char) + sizeof(short) + sizeof(char); + extent = sizeof(char_short_char); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; + if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; + + if (is_eight) { is_four = 0; is_two = 0; } + if (is_four) is_two = 0; + + DLOOP_Assert(is_packed + is_two + is_four + is_eight == 1); + + if (is_packed) return 1; + if (is_two) return 2; + if (is_four) return 4; + return 8; +} + +/* from MPICH2 PAC_C_MAX_FP_ALIGN test: + * + * Checks for max C struct floating point alignment. Note that + * in this test we are *only* testing float types, whereas in + * the original test we were testing double and long double also. + * + * Return value is 1, 2, 4, 8, or 16. + */ +static int DLOOP_Structalign_float_max() +{ + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + int is_sixteen = 1; + struct { char a; float b; } char_float; + struct { float b; char a; } float_char; + int size, extent1, extent2; + + size = sizeof(char) + sizeof(float); + extent1 = sizeof(char_float); + extent2 = sizeof(float_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(float) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + + if (is_sixteen) { is_eight = 0; is_four = 0; is_two = 0; } + if (is_eight) { is_four = 0; is_two = 0; } + if (is_four) is_two = 0; + + DLOOP_Assert(is_packed + is_two + is_four + is_eight + is_sixteen == 1); + + if (is_packed) return 1; + if (is_two) return 2; + if (is_four) return 4; + if (is_eight) return 8; + return 16; +} + +/* from MPICH2 PAC_C_MAX_DOUBLE_FP_ALIGN test: + * + * Determines maximum struct alignment with floats and doubles. + * + * Return value is 1, 2, 4, or 8. + */ +static int DLOOP_Structalign_double_max() +{ + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; + int size, extent1, extent2; + + size = sizeof(char) + sizeof(double); + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(double) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + + if (is_eight) { is_four = 0; is_two = 0; } + if (is_four) is_two = 0; + + DLOOP_Assert(is_packed + is_two + is_four + is_eight == 1); + + if (is_packed) return 1; + if (is_two) return 2; + if (is_four) return 4; + return 8; +} + +/* from MPICH2 PAC_C_MAX_LONGDOUBLE_FP_ALIGN test: + * + * Determines maximum alignment of structs with long doubles. + * + * Return value is 1, 2, 4, 8, or 16. + */ +static int DLOOP_Structalign_long_double_max() +{ + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + int is_sixteen = 1; + struct { char a; long double b; } char_long_double; + struct { long double b; char a; } long_double_char; + struct { long double a; int b; char c; } long_double_int_char; + int size, extent1, extent2; + + size = sizeof(char) + sizeof(long double); + extent1 = sizeof(char_long_double); + extent2 = sizeof(long_double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0 + && (extent2 % 16) != 0) is_sixteen = 0; + + extent1 = sizeof(long_double_int_char); + if ( (extent1 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0) is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0) is_sixteen = 0; + + if (is_sixteen) { is_eight = 0; is_four = 0; is_two = 0; } + if (is_eight) { is_four = 0; is_two = 0; } + if (is_four) is_two = 0; + + DLOOP_Assert(is_packed + is_two + is_four + is_eight + is_sixteen == 1); + + if (is_packed) return 1; + if (is_two) return 2; + if (is_four) return 4; + if (is_eight) return 8; + return 16; +} + + +/* from MPICH2 PAC_C_DOUBLE_POS_ALIGN test: + * + * Test for odd struct alignment rule that only applies max. padding when + * double value is at front of type. + * + * Search for "Power alignment mode" for more details. + * + * Return value is 1 or 0. + */ +static int DLOOP_Structalign_double_position() +{ + int padding_varies_by_pos = 0; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; + int extent1, extent2; + + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + if (extent1 != extent2) padding_varies_by_pos = 1; + + if (padding_varies_by_pos) return 1; + else return 0; +} + +/* from MPICH2 PAC_C_LLINT_POS_ALIGN test: + * Test for odd struct alignment rule that only applies max. + * padding when long long int value is at front of type. + * + * Search for "Power alignment mode" for more details. + * + * Return value is 1 or 0. + */ +static int DLOOP_Structalign_llint_position() +{ + int padding_varies_by_pos = 0; +#ifdef HAVE_LONG_LONG_INT + struct { char a; long long int b; } char_llint; + struct { long long int b; char a; } llint_char; + int extent1, extent2; + + extent1 = sizeof(char_llint); + extent2 = sizeof(llint_char); + if (extent1 != extent2) padding_varies_by_pos = 1; +#endif + + if (padding_varies_by_pos) return 1; + else return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/common/dataloop/typesize_support.h b/src/libs/ck-libs/ampi/romio/common/dataloop/typesize_support.h new file mode 100644 index 0000000000..9b4bdee814 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/common/dataloop/typesize_support.h @@ -0,0 +1,28 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#ifndef TYPESIZE_SUPPORT_H +#define TYPESIZE_SUPPORT_H + +#include "dataloop.h" + +#define DLOOP_Type_footprint PREPEND_PREFIX(Type_footprint) + +typedef struct PREPEND_PREFIX(Type_footprint_s) { + DLOOP_Offset size, extent; + + /* these are only needed for calculating footprint of types + * built using this type. no reason to expose these. + */ + DLOOP_Offset lb, ub, alignsz; + DLOOP_Offset true_lb, true_ub; + int has_sticky_lb; + int has_sticky_ub; +} DLOOP_Type_footprint; + +void PREPEND_PREFIX(Type_calc_footprint)(MPI_Datatype type, + DLOOP_Type_footprint *tfp); + +#endif diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal.m4 new file mode 100644 index 0000000000..9f342cf332 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal.m4 @@ -0,0 +1,38 @@ +dnl This version of aclocal.m4 simply includes all of the individual +dnl components +builtin(include,aclocal_am.m4) +builtin(include,aclocal_bugfix.m4) +builtin(include,aclocal_cache.m4) +builtin(include,aclocal_cc.m4) +builtin(include,aclocal_atomic.m4) +dnl aclocal_cross.m4 uses autoconf features dated back to 2.13. +dnl too old to be useful, 07/14/2010. +dnl builtin(include,aclocal_cross.m4) +builtin(include,aclocal_cxx.m4) +builtin(include,aclocal_f77.m4) +dnl aclocal_f77old.m4 contains PAC_PROG_F77_CMDARGS which is NOT used in MPICH2 +dnl but it is still used by other packages, so leave it in confdb. +dnl builtin(include,aclocal_f77old.m4) +builtin(include,aclocal_util.m4) +builtin(include,aclocal_subcfg.m4) +builtin(include,aclocal_make.m4) +builtin(include,aclocal_mpi.m4) +builtin(include,aclocal_shl.m4) +dnl fortran90.m4 defines [Fortran 90] as an AC_LANG +dnl which works for autoconf 2.63 and older, 07/14/2010. +dnl builtin(include,fortran90.m4) +builtin(include,aclocal_runlog.m4) +builtin(include,aclocal_fc.m4) +builtin(include,aclocal_libs.m4) +builtin(include,aclocal_attr_alias.m4) +builtin(include,ax_tls.m4) +builtin(include,aclocal_romio.m4) +dnl Add the libtool files that libtoolize wants +dnl Comment these out until libtool support is enabled. +dnl May need to change this anyway, since libtoolize +dnl does not seem to understand builtin +dnl builtin(include,libtool.m4) +dnl builtin(include,ltoptions.m4) +dnl builtin(include,ltversion.m4) +dnl builtin(include,ltsugar.m4) +dnl builtin(include,lt~obsolete.m4) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_am.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_am.m4 new file mode 100644 index 0000000000..4d3b0de225 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_am.m4 @@ -0,0 +1,6 @@ +dnl AM_IGNORE is an extension that tells (a patched) automake not to +dnl include the specified AC_SUBST variable in the Makefile.in that +dnl automake generates. We don't use AC_DEFUN, since aclocal will +dnl then complain that AM_IGNORE is a duplicate (if you are using the +dnl patched automake/aclocal). +m4_ifdef([AM_IGNORE],[],[m4_define([AM_IGNORE],[])]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_atomic.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_atomic.m4 new file mode 100644 index 0000000000..4e96cfbf36 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_atomic.m4 @@ -0,0 +1,227 @@ +dnl /*D PAC_C_MEMATOMIC - Try and determine how to implement memory-atomic +dnl operations with the selected C compiler +dnl +dnl Synopsis: +dnl PAC_C_MEMATOMIC +dnl +dnl Notes: +dnl Defines names of the following form +dnl + HAVE_GCC_ASM_AND_X86_{MFENCE,LFENCE,SFENCE} - gcc __asm__ will issue +dnl mfence, lfence, or sfence +dnl . HAVE___ASM_AND_X86_{MFENCE,LFENCE,SFENCE} - __asm _emit will issue +dnl mfence, lfence, or sfence +dnl . HAVE_ASM_AND_X86_{MFENCE,LFENCE,SFENCE} - asm("...") will issue +dnl mfence, lfence, or sfence +dnl . HAVE__INTERLOCKEDEXCHANGE - _InterlockedExchange intrinsic is available +dnl (IA64) +dnl . HAVE_GCC_ASM_SPARC_MEMBAR - gcc __asm__ will issue SPARC architecture +dnl memory barrier instruction +dnl . HAVE_SOLARIS_ASM_SPARC_MEMBAR - Solaris asm() will issue SPARC +dnl architecture memory barrier instruction +dnl . HAVE_GCC_ASM_SPARC_STBAR - gcc __asm__ will issue stbar +dnl - HAVE_SOLARIS_ASM_SPARC_STBAR - Solaris __asm() will issue stbar +dnl +dnl D*/ +AC_DEFUN([PAC_C_MEMATOMIC],[ +AC_CACHE_CHECK([for x86 mfence instruction using __asm__], + pac_cv_have_gcc_asm_and_x86_mfence,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + __asm__ __volatile__ ( ".byte 0x0f, 0xae, 0xf0" ::: "memory" ); + exit(0); +} +], +pac_cv_have_gcc_asm_and_x86_mfence=yes,pac_cv_have_gcc_asm_and_x86_mfence=no)]) + +if test "$pac_cv_have_gcc_asm_and_x86_mfence" = "yes" ; then + AC_DEFINE(HAVE_GCC_ASM_AND_X86_MFENCE, 1, [Define if using gcc on a x86 system with the mfence instruction]) +fi + +AC_CACHE_CHECK([for x86 sfence instruction using __asm__], + pac_cv_have_gcc_asm_and_x86_sfence,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + __asm__ __volatile__ ( ".byte 0x0f, 0xae, 0xf8" ::: "memory" ); + exit(0); +} +], +pac_cv_have_gcc_asm_and_x86_sfence=yes,pac_cv_have_gcc_asm_and_x86_sfence=no)]) + +if test "$pac_cv_have_gcc_asm_and_x86_sfence" = "yes" ; then + AC_DEFINE(HAVE_GCC_ASM_AND_X86_SFENCE, 1, [Define if using gcc on a x86 system with the sfence instruction]) +fi + +AC_CACHE_CHECK([for x86 lfence instruction using __asm__], + pac_cv_have_gcc_asm_and_x86_lfence,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + __asm__ __volatile__ ( ".byte 0x0f, 0xae, 0xe8" ::: "memory" ); + exit(0); +} +], +pac_cv_have_gcc_asm_and_x86_lfence=yes,pac_cv_have_gcc_asm_and_x86_lfence=no)]) + +if test "$pac_cv_have_gcc_asm_and_x86_lfence" = "yes" ; then + AC_DEFINE(HAVE_GCC_ASM_AND_X86_LFENCE, 1, [Define if using gcc on a x86 system with the lfence instruction]) +fi + +dnl Some compilers, like icc, may want __asm _emit +AC_CACHE_CHECK([for x86 mfence instruction using __asm], + pac_cv_have___asm_and_x86_mfence,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + __asm _emit 0x0f __asm _emit 0xae __asm _emit 0xf0 ; + exit(0); +} +], +pac_cv_have___asm_and_x86_mfence=yes,pac_cv_have___asm_and_x86_mfence=no)]) + +if test "$pac_cv_have___asm_and_x86_mfence" = "yes" ; then + AC_DEFINE(HAVE___ASM_AND_X86_MFENCE, 1, [Define if using __asm on a x86 system with the mfence instruction]) +fi + +AC_CACHE_CHECK([for x86 sfence instruction using __asm], + pac_cv_have___asm_and_x86_sfence,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + __asm sfence ; + exit(0); +} +], +pac_cv_have___asm_and_x86_sfence=yes,pac_cv_have___asm_and_x86_sfence=no)]) + +if test "$pac_cv_have___asm_and_x86_sfence" = "yes" ; then + AC_DEFINE(HAVE___ASM_AND_X86_SFENCE, 1, [Define if using __asm on a x86 system with the sfence instruction]) +fi + +AC_CACHE_CHECK([for x86 lfence instruction using __asm], + pac_cv_have___asm_and_x86_lfence,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + __asm _emit 0x0f __asm _emit 0xae __asm _emit 0xe8 ; + exit(0); +} +], +pac_cv_have___asm_and_x86_lfence=yes,pac_cv_have___asm_and_x86_lfence=no)]) + +if test "$lac_cv_have___asm_and_x86_lfence" = "yes" ; then + AC_DEFINE(HAVE___ASM_AND_X86_LFENCE, 1, [Define if using __asm on a x86 system with the lfence instruction]) +fi + +dnl +dnl Some compilers, such as pgcc, may require additional arguments. +dnl pgcc may need -Masmkeyword flag. We may want to try this with and +dnl without adding -Masmkeyword to CFLAGS + +AC_CACHE_CHECK([for x86 mfence instruction using asm()], + pac_cv_have_asm_and_x86_mfence,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + asm("_emit 0x0f __asm _emit 0xae __asm _emit 0xf0"); + exit(0); +} +], +pac_cv_have_asm_and_x86_mfence=yes,pac_cv_have_asm_and_x86_mfence=no)]) + +if test "$pac_cv_have_asm_and_x86_mfence" = "yes" ; then + AC_DEFINE(HAVE_ASM_AND_X86_MFENCE, 1, [Define if using asm() on a x86 system with the mfence instruction]) +fi + +AC_CACHE_CHECK([for x86 sfence instruction using asm()], + pac_cv_have_asm_and_x86_sfence,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + asm("sfence"); + exit(0); +} +], +pac_cv_have_asm_and_x86_sfence=yes,pac_cv_have_asm_and_x86_sfence=no)]) + +if test "$pac_cv_have_asm_and_x86_sfence" = "yes" ; then + AC_DEFINE(HAVE_ASM_AND_X86_SFENCE, 1, [Define if using asm() on a x86 system with the sfence instruction]) +fi + +AC_CACHE_CHECK([for x86 lfence instruction using asm()], + pac_cv_have_asm_and_x86_lfence,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + asm("_emit 0x0f __asm _emit 0xae __asm _emit 0xe8"); + exit(0); +} +], +pac_cv_have_asm_and_x86_lfence=yes,pac_cv_have_asm_and_x86_lfence=no)]) + +if test "$pac_cv_have_asm_and_x86_lfence" = "yes" ; then + AC_DEFINE(HAVE_ASM_AND_X86_LFENCE, 1, [Define if using asm() on a x86 system with the lfence instruction]) +fi + +AC_CACHE_CHECK([for _InterlockedExchange intrinsic], + pac_cv_have__InterlockedExchange,[ +AC_TRY_RUN([ +int main(int argc, char **argv) +{ + unsigned long lock, *lock_ptr; + lock_ptr = &lock; + _InterlockedExchange(lock_ptr, 1); + exit(0); +} +], +pac_cv_have__InterlockedExchange=yes,pac_cv_have__InterlockedExchange=no)]) + +if test "$pac_cv_have__InterlockedExchange" = "yes" ; then + AC_DEFINE(HAVE__INTERLOCKEDEXCHANGE, 1, [Define if _InterlockedExchange intrinsic is available]) +fi + +AC_CACHE_CHECK([for SPARC membar instruction with gcc], + pac_cv_gcc_sparc_membar,[ +AC_TRY_RUN([ +int main(int argc, char **argv){ + __asm__ __volatile__ ( "membar #StoreLoad | #StoreStore" : : : "memory" ); + exit(0); +}],pac_cv_gcc_sparc_membar=yes,pac_cv_gcc_sparc_membar=no)]) +if test "$pac_cv_gcc_sparc_membar" = yes ; then + AC_DEFINE(HAVE_GCC_ASM_SPARC_MEMBAR,1,[Define if gcc asm membar supported]) +fi + +AC_CACHE_CHECK([for SPARC membar instruction with Solaris C], + pac_cv_solaris_sparc_membar,[ +AC_TRY_RUN([ +int main(int argc, char **argv){ + __asm ( "membar #StoreLoad | #StoreStore"); + exit(0); +}],pac_cv_solaris_sparc_membar=yes,pac_cv_solaris_sparc_membar=no)]) +if test "$pac_cv_solaris_sparc_membar" = yes ; then + AC_DEFINE(HAVE_SOLARIS_ASM_SPARC_MEMBAR,1,[Define if solaris asm membar supported]) +fi + +AC_CACHE_CHECK([for SPARC stbar instruction with gcc], + pac_cv_gcc_sparc_stbar,[ +AC_TRY_RUN([ +int main(int argc, char **argv){ + __asm__ __volatile__ ( "stbar" : : : "memory" ); + exit(0); +}],pac_cv_gcc_sparc_stbar=yes,pac_cv_gcc_sparc_stbar=no)]) +if test "$pac_cv_gcc_sparc_stbar" = yes ; then + AC_DEFINE(HAVE_GCC_ASM_SPARC_STBAR,1,[Define if gcc asm stbar supported]) +fi + +AC_CACHE_CHECK([for SPARC stbar instruction with Solaris C], + pac_cv_solaris_sparc_stbar,[ +AC_TRY_RUN([ +int main(int argc, char **argv){ + __asm ( "stbar" ); + exit(0); +}],pac_cv_solaris_sparc_stbar=yes,pac_cv_solaris_sparc_stbar=no)]) +if test "$pac_cv_solaris_sparc_stbar" = yes ; then + AC_DEFINE(HAVE_SOLARIS_ASM_SPARC_STBAR,1,[Define if solaris asm stbar supported]) +fi +]) \ No newline at end of file diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_attr_alias.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_attr_alias.m4 new file mode 100644 index 0000000000..32f016546d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_attr_alias.m4 @@ -0,0 +1,504 @@ +dnl +dnl Check for BSD or POSIZ style global symbol lister, nm. +dnl If found, pac_path_NM_G contains the absolute athname of nm + options +dnl pac_path_NM_G_type will be either POSIX or BSD. NM_G will be +dnl pac_path_NM_G without the absolute path. Preference is BSD style. +dnl +dnl The test checks if nm accepts the known options and also if nm produces +dnl the expected BSD or POSIX output format. +dnl +AC_DEFUN([PAC_PATH_NM_G],[ +AC_MSG_CHECKING([for BSD/POSIX style global symbol lister]) +AC_LANG_PUSH(C) +AC_PATH_PROGS_FEATURE_CHECK(NM_G, nm, [ + # Check if nm accepts -g and BSD or POSIX compatible flag. + # Use the `sed 1q' to avoid HP-UX's unknown option message: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # + # AIX's sed does not accept \+, 1) instead of doing 's|a\+||', do 's|aa*||' + # or 2) instead of 's|A \+B|AB|g', do 's|A *B|AB|g' + + # Check if nm accepts -g + case `${ac_path_NM_G} -g /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + ac_path_NM_G="${ac_path_NM_G} -g" + # Check if nm accepts -B + case `${ac_path_NM_G} -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([int iglobal;]) + ],[ + changequote(,) + case `${ac_path_NM_G} -B conftest.$OBJEXT | sed -e 's|[0-9][0-9]* *[A-Z] *iglobal|XXXX|g'` in + *XXXX*) + pac_path_NM_G="${ac_path_NM_G} -B" + pac_path_NM_G_type="BSD" + ;; + esac + changequote([,]) + ]) + ;; + *) + # Check if nm accepts -P + case `${ac_path_NM_G} -P /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([int iglobal;]) + ],[ + changequote(,) + case `${ac_path_NM_G} -P conftest.$OBJEXT | sed -e 's|iglobal *[A-Z] *[0-9][0-9]*|XXXX|g'` in + *XXXX*) + pac_path_NM_G="${ac_path_NM_G} -P" + pac_path_NM_G_type="POSIX" + ;; + esac + changequote([,]) + ]) + ;; + esac # Endof case `${ac_path_NM_G} -P + ;; + esac # Endof case `${ac_path_NM_G} -B + ;; + esac # Endof case `${ac_path_NM_G} -g + if test "X$pac_path_NM_G" != "X" ; then + AC_MSG_RESULT([$pac_path_NM_G_type style,$pac_path_NM_G]) + NM_G="`echo $pac_path_NM_G | sed -e 's|^.*nm |nm |g'`" + else + AC_MSG_RESULT(no) + fi + ac_cv_path_NM_G=${ac_path_NM_G} + ac_path_NM_G_found=: +], [AC_MSG_RESULT(no)], +[$PATH$PATH_SEPARATOR/usr/ccs/bin/elf$PATH_SEPARATOR/usr/ccs/bin$PATH_SEPARATOR/usr/ucb$PATH_SEPARATOR/bin]) +AC_LANG_POP(C) +]) dnl Endof AC_DEFUN([PAC_PATH_NM_G] +dnl +dnl PAC_C_MULTI_ATTR_ALIAS() +dnl +dnl The checks if multiple __attribute__((alias)) is available +dnl If the multiple __attribute((alias)) support is found, +dnl pac_c_multi_attr_alias=yes is set. +dnl +dnl The default is to do a runtime test. When cross_compiling=yes, +dnl pac_path_NM_G will be used to determine the test result. +dnl If CFLAGS(or CPPFLAGS) contains ATTR_ALIAS_DEBUG, the runtime will print +dnl out addresses of struct(s) for debugging purpose. +dnl +dnl +AC_DEFUN([PAC_C_MULTI_ATTR_ALIAS],[ +AC_REQUIRE([PAC_PATH_NM_G]) +AC_LANG_PUSH(C) +AC_CHECK_HEADERS([stdio.h]) +AC_MSG_CHECKING([for multiple __attribute__((alias)) support]) + +#Compile the "other" __attribute__ object file. +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif + +struct mpif_cmblk_t_ { int imember; }; +typedef struct mpif_cmblk_t_ mpif_cmblk_t; + +/* NOT initialize these structure so it appears in BSS or as COMMON symbols */ +mpif_cmblk_t mpifcmb; +mpif_cmblk_t MPIFCMB; + +/* + Do the test in this file instead in the file + where __attribute__((alias)) is used. + This is needed for pgcc since pgcc seems to + define aliased symbols if they are in the same file. +*/ +/* + We can't do the following comparision in one test: + + ilogical = (( &mpifcmb == ptr && &MPIFCMB == ptr ) ? TRUE : FALSE) ; + + because some compiler, like gcc 4.4.2's -O* optimizes the code + such that the ilogical expression is FALSE. The likely reason is that + mpifcmb and MPIFCMB are defined in the same scope in which C optimizer + may have treated them as different objects (with different addresses), + &mpifcmb != &MPIFCMB, before actually running the test and hence the + illogical expression is assumed to be always FALSE. The solution taken + here is to prevent the optimizer the opportunity to equate &mpifcmb and + &MPIFCMB (in same scope), e.g. using 2 separate tests and combine the + test results in a different scope. +*/ +int same_addrs1( void *ptr ); +int same_addrs1( void *ptr ) +{ +#if defined(ATTR_ALIAS_DEBUG) + printf( "others: addr(mpifcmb)=%p, addr(input ptr)=%p\n", &mpifcmb, ptr ); +#endif + return ( &mpifcmb == ptr ? 1 : 0 ); +} + +int same_addrs2( void *ptr ); +int same_addrs2( void *ptr ) +{ +#if defined(ATTR_ALIAS_DEBUG) + printf( "others: addr(MPIFCMB)=%p, addr(input ptr)=%p\n", &MPIFCMB, ptr ); +#endif + return ( &MPIFCMB == ptr ? 1 : 0 ); +} + + ]) +],[ + rm -f pac_conftest_other.$OBJEXT + PAC_RUNLOG([cp conftest.$OBJEXT pac_conftest_other.$OBJEXT]) + test -s pac_conftest_other.$OBJEXT && pac_c_attr_alias_other=yes +dnl cp conftest.$ac_ext pac_conftest_other.$ac_ext +dnl echo +dnl echo "pac_conftest_other.$OBJEXT" +dnl nm -P -g pac_conftest_other.$OBJEXT | grep -i "mpifcmb" +],[ + pac_c_attr_alias_other=no +]) dnl Endof AC_COMPILE_IFELSE + +pac_c_attr_alias_main=no +if test "$pac_c_attr_alias_other" = "yes" ; then + +# Push LIBS for later restoration. + PAC_PUSH_FLAG([LIBS]) + LIBS="pac_conftest_other.$OBJEXT $LIBS" + +# Link the "other" __attribute__ object file. + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif + +struct mpif_cmblk_t_ { int imember; }; +typedef struct mpif_cmblk_t_ mpif_cmblk_t; + +mpif_cmblk_t mpifcmbr = {0}; +extern mpif_cmblk_t MPIFCMB __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t mpifcmb __attribute__ ((alias("mpifcmbr"))); + +extern int same_addrs1( void *ptr ); +extern int same_addrs2( void *ptr ); + + ],[ + int iaddr = 0; +#if defined(ATTR_ALIAS_DEBUG) + printf( "main: addr(mpifcmbr) = %p\n", &mpifcmbr ); + printf( "main: addr(mpifcmb) = %p\n", &mpifcmb ); + printf( "main: addr(MPIFCMB) = %p\n", &MPIFCMB ); +#endif + iaddr = same_addrs1( &mpifcmbr ) && same_addrs2( &mpifcmbr ); + FILE *file = fopen( "pac_conftestval", "w" ); + if (!file) return 1; + fprintf( file, "%d\n", iaddr ); + ]) + ],[ + rm -f pac_conftest_main$EXEEXT + PAC_RUNLOG([cp conftest$EXEEXT pac_conftest_main$EXEEXT]) + test -x pac_conftest_main$EXEEXT && pac_c_attr_alias_main=yes +dnl cp conftest.$ac_ext pac_conftest_main.$ac_ext +dnl echo +dnl echo "pac_conftest_main$EXEEXT" +dnl nm -P -g pac_conftest_main$EXEEXT | grep -i "mpifcmb" + ],[ + pac_c_attr_alias_main=no +dnl cp conftest.$ac_ext pac_conftest_main.$ac_ext + ]) dnl Endof AC_LINK_IFELSE + +# Restore the previously pushed LIBS + PAC_POP_FLAG([LIBS]) + rm -f pac_conftest_other.$OBJEXT +fi dnl Endof if test "$pac_c_attr_alias_other" = "yes" + +if test "$pac_c_attr_alias_main" = "yes" ; then + if test "$cross_compiling" = "yes" ; then + changequote(,) + # echo "PAC CROSS-COMPILING" dnl + # POSIX NM = nm -P format dnl + if test "$pac_path_NM_G_type" = "POSIX" ; then + addrs=`${pac_path_NM_G} ./pac_conftest_main$EXEEXT | grep -i mpifcmb | sed -e 's% *[a-zA-Z][a-zA-Z]* *[a-zA-Z] *\([0-9abcdef][0-9abcdef]*\).*%\1%g'` + fi + + # BSD NM = nm -B format dnl + if test "$pac_path_NM_G_type" = "BSD" ; then + addrs=`${pac_path_NM_G} -g ./pac_conftest_main$EXEEXT | grep -i mpifcmb | sed -e "s% *\([0-9abcdef][0-9abcdef]*\) *[a-zA-Z] *[a-zA-Z][a-zA-A]*.*%\1%g"` + fi + changequote([,]) + + cmp_addr="" + diff_addrs=no + for addr in ${addrs} ; do + if test "X${cmp_addr}" != "X" ; then + if test "${cmp_addr}" != "${addr}" ; then + diff_addrs=yes + break + fi + else + cmp_addr=${addr} + fi + done + + if test "$diff_addrs" != "yes" ; then + dnl echo "Same addresses. Multiple aliases support" + AC_MSG_RESULT([${NM_G} says yes]) + pac_c_multi_attr_alias=yes + else + dnl echo "Different addresses. No multiple aliases support." + AC_MSG_RESULT([${NM_G} says no]) + pac_c_multi_attr_alias=no + fi + + else # if test "$cross_compiling" != "yes" + rm -f pac_conftestval + ac_try="./pac_conftest_main$EXEEXT" + if AC_TRY_EVAL(ac_try) ; then + pac_c_attr_alias_val=0 + if test -s pac_conftestval ; then + eval pac_c_attr_alias_val=`cat pac_conftestval` + fi + if test "$pac_c_attr_alias_val" -eq 1 ; then + AC_MSG_RESULT(yes) + pac_c_multi_attr_alias=yes + else + AC_MSG_RESULT(no) + pac_c_multi_attr_alias=no + fi + rm -f pac_conftestval + fi + fi + dnl Endof if test "$cross_compiling" = "yes" + rm -f pac_conftest_main$EXEEXT +else + AC_MSG_RESULT(no! link failure) + pac_c_multi_attr_alias=no +fi dnl Endof if test "$pac_c_attr_alias_main" = "yes" + +AC_LANG_POP(C) + +]) dnl Endof AC_DEFUN([PAC_C_MULTI_ATTR_ALIAS] +dnl +dnl PAC_C_ATTR_ALIGNED() +dnl +dnl Check if __attribute__((aligned)) support is there. +dnl If so, set pac_c_attr_aligned=yes. +dnl +dnl Do a link test instead of compile test to check if the linker +dnl would emit an error. +dnl +AC_DEFUN([PAC_C_ATTR_ALIGNED],[ +AC_LANG_PUSH(C) +AC_MSG_CHECKING([for __attribute__((aligned)) support]) +#Link the __attribute__ object file. +AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +struct mpif_cmblk_t_ { int imembers[5]; }; +typedef struct mpif_cmblk_t_ mpif_cmblk_t; +mpif_cmblk_t mpifcmbr __attribute__((aligned)) = {0}; + ],[]) +],[pac_c_attr_aligned=yes], [pac_c_attr_aligned=no]) +AC_MSG_RESULT([$pac_c_attr_aligned]) +AC_LANG_POP(C) +]) +dnl +dnl PAC_F2C_ATTR_ALIGNED_SIZE(ARRAY_SIZE, [OUTPUT_VAR], [MIN_ALIGNMENT]) +dnl +dnl ARRAY_SIZE : Size of the integer array within the fortran commmon block. +dnl OUTPUT_VAR : Optional variable to be set. +dnl if test succeeds, set OUTPUT_VAR=$pac_f2c_attr_aligned_str. +dnl if test fails, set OUTPUT_VAR="unknown". +dnl MIN_ALIGNMENT : Optional value. +dnl Minimum alignment size to be used in OUTPUT_VAR. +dnl pac_f2c_attr_aligned_str won't be modified. +dnl +dnl "pac_f2c_attr_aligned_str" will be set with +dnl 1) __attribute__((aligned(ALIGNMENT_SIZE))), +dnl 2) __attribute__((aligned)). +dnl 3) "", i.e. empty string. +dnl +dnl 2) means the test can't find a good alignment value, but both the Fortran +dnl and C compilers are OK with "aligned" which in principle means the C +dnl compiler will pick the maximum useful alignment supported by the +dnl architecture. +dnl 3) means that the test has failed to find the alignment. +dnl +AC_DEFUN([PAC_F2C_ATTR_ALIGNED_SIZE],[ +cmblksize=$1 +AC_MSG_CHECKING([the minimum alignment of Fortran common block of $cmblksize integers]) +dnl To find the minmium alignment of Fortran common block (of integer array) +dnl as seen by C object file, C object files of various (typical) alignments +dnl are linked to the Fortran code using the common block of integer array. +# +dnl Since the incorrect alignment results only a warning messages from the +dnl fortran compiler(or linker), so we use "diff" to compare the fortran +dnl compiler/linker output. We cannot use AC_LANG_WERROR, +dnl i.e. ac_fc_werror_flag=yes, because compiler like pgf77 at version 10.x) +dnl has non-zero stderr output if a fortran program is used in the linking. +dnl The stderr contains the name of fortran program even if the linking is +dnl successful. We could avoid the non-zero stderr output in pgf77 by +dnl compiling everthing into object files and linking all the object files +dnl with pgf77. Doing that would need us to use AC_TRY_EVAL instead of +dnl AC_LINK_IFELSE, so "diff" approach is used instead. +# +dnl Using diff of compiler(linker) output requires a reference output file +dnl as the base of diff. The process of creating this reference output file +dnl has to be exactly the same as the testing process, because pgf77 has +dnl the following weird behavour +dnl pgf77 -o ftest ftest.f => when $?=0 with zero stderr output +dnl pgf77 -o ftest ftest.f dummy.o => when $?=0 with non-zero stderr output. +dnl stderr has "ftest.f:". +dnl +# First create a fortran CONFTEST which will be used repeatedly. +AC_LANG_PUSH([Fortran]) dnl AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program fconftest + integer isize + parameter (isize=$cmblksize) + integer status_array(isize) + common /mpifcmb/ status_array + save /mpifcmb/ + end + ]) +]) +AC_LANG_POP([Fortran]) dnl AC_LANG_POP([Fortran 77]) +dnl +dnl +dnl +# Compile a C dummy.$OBJEXT and link with Fortran test program to create +# a reference linker output file, pac_align0.log, as the base of "diff". +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[ + cp conftest.$ac_ext pac_conftest.c + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + PAC_PUSH_FLAG([LIBS]) + LIBS="pac_conftest.$OBJEXT $LIBS" + AC_LANG_PUSH([Fortran]) dnl AC_LANG_PUSH([Fortran 77]) + PAC_PUSH_FLAG([ac_link]) + ac_link="`echo $ac_link | sed -e 's|>.*$|> $pac_logfile 2>\&1|g'`" + pac_logfile="pac_align0.log" + rm -f $pac_logfile + AC_LINK_IFELSE([],[ + pac_f2c_alignedn_diffbase=yes + ],[ + pac_f2c_alignedn_diffbase=no + ]) + # Be sure NOT to remove the conftest.f which is still needed for later use. + # rm -f conftest.$ac_ext + # Restore everything in autoconf that has been overwritten + PAC_POP_FLAG([ac_link]) + # restore previously pushed LIBS + PAC_POP_FLAG([LIBS]) + AC_LANG_POP([Fortran]) dnl AC_LANG_POP([Fortran 77]) +],[ + pac_f2c_alignedn_diffbase=no +]) +AC_LANG_POP([C]) +dnl +dnl +if test "$pac_f2c_alignedn_diffbase" = "yes" ; then + # Initialize pac_result_str to empty string since part of the test + # depends on pac_result_str is empty or non-empty string. + pac_result_str="" + # Initialize pac_f2c_attr_aligned_str to empty string and + # it will remain as empty string if the following test fails. + pac_f2c_attr_aligned_str="" + for asize in 4 8 16 32 64 128 max ; do + if test "$asize" != "max" ; then + pac_attr_aligned_str="__attribute__((aligned($asize)))" + else + pac_attr_aligned_str="__attribute__((aligned))" + fi + AC_LANG_PUSH([C]) + #Compile the __attribute__ object file. + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +changequote(,) +struct mpif_cmblk_t_ { $MPI_FINT imembers[$cmblksize]; }; +changequote([,]) +typedef struct mpif_cmblk_t_ mpif_cmblk_t; +mpif_cmblk_t mpifcmbr $pac_attr_aligned_str = {0}; + +extern mpif_cmblk_t _CMPIFCMB __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t MPIFCMB __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t MPIFCMB_ __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t _Cmpifcmb __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t mpifcmb __attribute__ ((alias("mpifcmbr"))); +extern mpif_cmblk_t mpifcmb_ __attribute__ ((alias("mpifcmbr"))); + ]) + ],[ + cp conftest.$ac_ext pac_conftest.c + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + PAC_PUSH_FLAG([LIBS]) + LIBS="pac_conftest.$OBJEXT $LIBS" + AC_LANG_PUSH([Fortran]) dnl AC_LANG_PUSH([Fortran 77]) + PAC_PUSH_FLAG([ac_link]) + ac_link="`echo $ac_link | sed -e 's|>.*$|> $pac_logfile 2>\&1|g'`" + pac_logfile="pac_align1.log" + rm -f $pac_logfile + # Use conftest.f created in CONFTEST. + AC_LINK_IFELSE([],[ + PAC_RUNLOG_IFELSE([diff -b pac_align0.log pac_align1.log],[ + pac_attr_alignedn=yes + ],[ + pac_attr_alignedn=no + cat $pac_logfile >&AS_MESSAGE_LOG_FD + echo "failed C program was:" >&AS_MESSAGE_LOG_FD + cat pac_conftest.c >&AS_MESSAGE_LOG_FD + echo "failed Fortran program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD + ]) + ],[ + pac_attr_alignedn=no + ]) + # Restore everything in autoconf that has been overwritten + PAC_POP_FLAG([ac_link]) + # restore previously pushed LIBS + PAC_POP_FLAG([LIBS]) + AC_LANG_POP([Fortran]) dnl AC_LANG_POP([Fortran 77]) + # remove previously generated object file and C file. + rm -f pac_conftest.$OBJEXT pac_conftest.c + rm -f $pac_logfile + if test "$pac_attr_alignedn" = yes ; then + ifelse([$3],[],[ + pac_result_str="$asize" + pac_f2c_attr_aligned_str="$pac_attr_aligned_str" + break + ],[ + if test "$asize" != "max" -a "$asize" -lt "$3" ; then + if test "X$pac_result_str" = "X" ; then + pac_result_str="$asize" + pac_f2c_attr_aligned_str="$pac_attr_aligned_str" + fi + continue + else + pac_f2c_attr_aligned_str="$pac_attr_aligned_str" + if test "X$pac_result_str" != "X" ; then + pac_result_str="$pac_result_str, too small! reset to $asize" + else + pac_result_str="$asize" + fi + break + fi + ]) + fi + ], [ + pac_attr_alignedn=no + ]) + AC_LANG_POP([C]) + done + ifelse([$2],[],[],[$2="$pac_f2c_attr_aligned_str"]) +else + pac_result_str="" + # Since the test fails, set pac_f2c_attr_aligned_str to empty string. + pac_f2c_attr_aligned_str="" +fi +if test "X$pac_result_str" != "X" ; then + AC_MSG_RESULT([$pac_result_str]) +else + AC_MSG_RESULT([unknown]) +fi +rm -f pac_align0.log +]) +dnl diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_bugfix.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_bugfix.m4 new file mode 100644 index 0000000000..f580d3919a --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_bugfix.m4 @@ -0,0 +1,75 @@ +dnl This internal macro fails to work properly with OTHER internal macros. +dnl Basically, if the prologue is [], then no message should be generated. +dnl This macro is in autoconf 2.52 +m4_define([AC_LANG_PROGRAM(Fortran 77)], +[m4_if([$1],[[[]]],,[m4_ifval([$1], + [m4_warn([syntax], [$0: ignoring PROLOGUE: $1])])])dnl + program main +$2 + end]) + + +dnl/*D +dnl PAC_PROG_CHECK_INSTALL_WORKS - Check whether the install program in INSTALL +dnl works. +dnl +dnl Synopsis: +dnl PAC_PROG_CHECK_INSTALL_WORKS +dnl +dnl Output Effect: +dnl Sets the variable 'INSTALL' to the value of 'ac_sh_install' if +dnl a file cannot be installed into a local directory with the 'INSTALL' +dnl program +dnl +dnl Notes: +dnl The 'AC_PROG_INSTALL' scripts tries to avoid broken versions of +dnl install by avoiding directories such as '/usr/sbin' where some +dnl systems are known to have bad versions of 'install'. Unfortunately, +dnl this is exactly the sort of test-on-name instead of test-on-capability +dnl that 'autoconf' is meant to eliminate. The test in this script +dnl is very simple but has been adequate for working around problems +dnl on Solaris, where the '/usr/sbin/install' program (known by +dnl autoconf to be bad because it is in /usr/sbin) is also reached by a +dnl soft link through /bin, which autoconf believes is good. +dnl +dnl No variables are cached to ensure that we do not make a mistake in +dnl our choice of install program. +dnl +dnl The Solaris configure requires the directory name to immediately +dnl follow the '-c' argument, rather than the more common +dnl.vb +dnl args sourcefiles destination-dir +dnl.ve +dnl D*/ +AC_DEFUN([PAC_PROG_CHECK_INSTALL_WORKS],[ +if test -z "$INSTALL" ; then + AC_MSG_RESULT([No install program available]) +else + # first make any "confdb/install-sh -c" into an absolute path + # this is a hack, but it's still much cleaner than anything else I could + # come up with (see tt#1007) [goodell@] + AS_CASE(["$INSTALL"], + [/*],[:], + [*install-sh*],[INSTALL="$master_top_srcdir/$INSTALL"]) + + # Check that this install really works + rm -f conftest + echo "Test file" > conftest + if test ! -d .conftest ; then mkdir .conftest ; fi + AC_MSG_CHECKING([whether install works]) + if $INSTALL conftest .conftest >/dev/null 2>&1 ; then + installOk=yes + else + installOk=no + fi + rm -rf .conftest conftest + AC_MSG_RESULT($installOk) + if test "$installOk" = no ; then + if test -n "$ac_install_sh" ; then + INSTALL=$ac_install_sh + else + AC_MSG_ERROR([Unable to find working install]) + fi + fi +fi +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_cache.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_cache.m4 new file mode 100644 index 0000000000..9d02c41638 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_cache.m4 @@ -0,0 +1,372 @@ +dnl +dnl/*D +dnl AC_CACHE_LOAD - Replacement for autoconf cache load +dnl +dnl Notes: +dnl Caching in autoconf is broken (at least through version 2.13). +dnl The problem is that the cache is read +dnl without any check for whether it makes any sense to read it. +dnl A common problem is a build on a shared file system; connecting to +dnl a different computer and then building within the same directory will +dnl lead to at best error messages from configure and at worse a build that +dnl is wrong but fails only at run time (e.g., wrong datatype sizes used). +dnl Later versions of autoconf do include some checks for changes in the +dnl environment that impact the choices, but still misses problems with +dnl multiple different systems. +dnl +dnl This fixes that by requiring the user to explicitly enable caching +dnl before the cache file will be loaded. +dnl +dnl To use this version of 'AC_CACHE_LOAD', you need to include +dnl 'aclocal_cache.m4' in your 'aclocal.m4' file. The sowing 'aclocal.m4' +dnl file includes this file. +dnl +dnl If no --enable-cache or --disable-cache option is selected, the +dnl command causes configure to keep track of the system being configured +dnl in a config.system file; if the current system matches the value stored +dnl in that file (or there is neither a config.cache nor config.system file), +dnl configure will enable caching. In order to ensure that the configure +dnl tests make sense, the values of CC, F77, F90, and CXX are also included +dnl in the config.system file. In addition, the value of PATH is included +dnl to ensure that changes in the PATH that might select a different version +dnl of a program with the same name (such as a native make versus gnumake) +dnl are detected. +dnl +dnl Bugs: +dnl This does not work with the Cygnus configure because the enable arguments +dnl are processed *after* AC_CACHE_LOAD (!). To address this, we avoid +dnl changing the value of enable_cache, and use real_enable_cache, duplicating +dnl the "notgiven" value. +dnl +dnl The environment variable CONFIGURE_DEBUG_CACHE, if set to yes, +dnl will cause additional data to be written out during the configure process. +dnl This can be helpful in debugging the cache file process. +dnl +dnl See Also: +dnl PAC_ARG_CACHING +dnl D*/ +define([AC_CACHE_LOAD], +[if test "$CONFIGURE_DEBUG_CACHE" = yes ; then + oldopts="$-" + clearMinusX=no + set -x + if test "$oldopts" != "$-" ; then + clearMinusX=yes + fi +fi +if test "X$cache_system" = "X" ; then + # A default file name, just in case + cache_system="config.system" + if test "$cache_file" != "/dev/null" ; then + # Get the directory for the cache file, if any + changequote(,) + dnl Be careful to ensure that there is no doubled slash + cache_system=`echo $cache_file | sed -e 's%^\(.*/\)[^/]*%\1config.system%'` + changequote([,]) + test "x$cache_system" = "x$cache_file" && cache_system="config.system" +# else +# We must *not* set enable_cache to no because we need to know if +# enable_cache was not set. +# enable_cache=no + fi +fi +dnl +dnl The "action-if-not-given" part of AC_ARG_ENABLE is not executed until +dnl after the AC_CACHE_LOAD is executed (!). Thus, the value of +dnl enable_cache if neither --enable-cache or --disable-cache is selected +dnl is null. Just in case autoconf ever fixes this, we test both cases. +dnl +dnl Include PATH in the cache.system file since changing the path can +dnl change which versions of programs are found (such as vendor make +dnl or GNU make). +dnl +# +# Get a test value and flag whether we should remove/replace the +# cache_system file (do so unless cache_system_ok is yes) +# FC and F77 should be synonyms. Save both in case +# We include the xxxFLAGS in case the user is using the flags to change +# the language (either input or output) of the compiler. E.g., +# using -xarch=v9 on Solaris to select 64 bit output or using -D_BSD_SOURCE +# with gcc to get different header files on input. +cleanargs=`echo "$CC $F77 $FC $CXX $F90 $CFLAGS $FFLAGS $CXXFLAGS $F90FLAGS $PATH" | tr '"' ' '` +if uname -srm >/dev/null 2>&1 ; then + cache_system_text="`uname -srm` $cleanargs" +else + cache_system_text="-no-uname- $cleanargs" +fi +cache_system_ok=no +# +if test -z "$real_enable_cache" ; then + real_enable_cache=$enable_cache + if test -z "$real_enable_cache" ; then real_enable_cache="notgiven" ; fi +fi +if test "X$real_enable_cache" = "Xnotgiven" ; then + # check for valid cache file + if test -z "$cache_system" ; then cache_system="config.system" ; fi + if uname -srm >/dev/null 2>&1 ; then + if test -f "$cache_system" -a -n "$cache_system_text" ; then + if test "$cache_system_text" = "`cat $cache_system`" ; then + real_enable_cache="yes" + cache_system_ok=yes + fi + elif test ! -f "$cache_system" -a -n "$cache_system_text" ; then + # remove the cache file because it may not correspond to our + # system + if test "$cache_file" != "/dev/null" ; then + rm -f $cache_file + fi + real_enable_cache="yes" + fi + fi +fi +if test "X$real_enable_cache" = "Xyes" -a "$cache_file" = "/dev/null" ; then + real_enable_cache=no +fi +if test "X$real_enable_cache" = "Xyes" ; then + if test -r "$cache_file" ; then + echo "loading cache $cache_file" + if test -w "$cache_file" ; then + # Clean the cache file (ergh) + PAC_CACHE_CLEAN + fi + . $cache_file + else + echo "Configure in `pwd` creating cache $cache_file" + > $cache_file + rm -f $cache_system + fi +else + cache_file="/dev/null" +fi +# Remember our location and the name of the cachefile +pac_cv_my_conf_dir=`pwd` +dnl do not include the cachefile name, since this may contain the process +dnl number and cause comparisons looking for changes to the cache file +dnl to detect a change that isn't real. +dnl pac_cv_my_cachefile=$cachefile +# +# Update the cache_system file if necessary +if test "$cache_system_ok" != yes ; then + if test -n "$cache_system" ; then + rm -f $cache_system + echo $cache_system_text > $cache_system + fi +fi +if test "$clearMinusX" = yes ; then + set +x +fi +]) +dnl +dnl/*D +dnl PAC_ARG_CACHING - Enable caching of results from a configure execution +dnl +dnl Synopsis: +dnl PAC_ARG_CACHING +dnl +dnl Output Effects: +dnl Adds '--enable-cache' and '--disable-cache' to the command line arguments +dnl accepted by 'configure'. +dnl +dnl See Also: +dnl AC_CACHE_LOAD +dnl D*/ +dnl Add this call to the other ARG_ENABLE calls. Note that the values +dnl set here are redundant; the LOAD_CACHE call relies on the way autoconf +dnl initially processes ARG_ENABLE commands. +AC_DEFUN([PAC_ARG_CACHING],[ +AC_ARG_ENABLE(cache, + AC_HELP_STRING([--enable-cache], [Turn on configure caching]),, + [enable_cache="notgiven"]) +]) + +dnl Clean the cache of extraneous quotes that AC_CACHE_SAVE may add +dnl +AC_DEFUN([PAC_CACHE_CLEAN],[ + rm -f confcache + sed -e "s/'\\\\''//g" -e "s/'\\\\/'/" -e "s/\\\\'/'/" \ + -e "s/'\\\\''//g" $cache_file > confcache + if cmp -s $cache_file confcache ; then + : + else + if test -w $cache_file ; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi + fi + rm -f confcache + if test "$DEBUG_AUTOCONF_CACHE" = "yes" ; then + echo "Results of cleaned cache file:" + echo "--------------------------------------------------------" + cat $cache_file + echo "--------------------------------------------------------" + fi +]) + +dnl/*D +dnl PAC_SUBDIR_CACHE - Create a cache file before ac_output for subdirectory +dnl configures. +dnl +dnl Synopsis: +dnl PAC_SUBDIR_CACHE(when) +dnl +dnl Input Parameter: +dnl . when - Indicates when the cache should be created (optional) +dnl If 'always', create a new cache file. This option +dnl should be used if any of the cache parameters (such as +dnl CFLAGS or LDFLAGS) may have changed. +dnl +dnl Output Effects: +dnl +dnl Create a cache file before ac_output so that subdir configures don't +dnl make mistakes. +dnl We can't use OUTPUT_COMMANDS to remove the cache file, because those +dnl commands are executed *before* the subdir configures. +dnl +dnl D*/ +AC_DEFUN([PAC_SUBDIR_CACHE],[]) +AC_DEFUN([PAC_SUBDIR_CACHE_OLD],[ +if test "x$1" = "xalways" -o \( "$cache_file" = "/dev/null" -a "X$real_enable_cache" = "Xnotgiven" \) ; then + # Use an absolute directory to help keep the subdir configures from getting + # lost + cache_file=`pwd`/$$conf.cache + touch $cache_file + dnl + dnl For Autoconf 2.52+, we should ensure that the environment is set + dnl for the cache. Make sure that we get the values and set the + dnl xxx_set variables properly + ac_cv_env_CC_set=set + ac_cv_env_CC_value=$CC + ac_cv_env_CFLAGS_set=${CFLAGS+set} + ac_cv_env_CFLAGS_value=$CFLAGS + ac_cv_env_CPP_set=set + ac_cv_env_CPP_value=$CPP + ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} + ac_cv_env_CPPFLAGS_value=$CPPFLAGS + ac_cv_env_LDFLAGS_set=${LDFLAGS+set} + ac_cv_env_LDFLAGS_value=$LDFLAGS + ac_cv_env_LIBS_set=${LIBS+set} + ac_cv_env_LIBS_value=$LIBS + ac_cv_env_FC_set=${FC+set} + ac_cv_env_FC_value=$FC + ac_cv_env_F77_set=${F77+set} + ac_cv_env_F77_value=$F77 + ac_cv_env_F90_set=${F90+set} + ac_cv_env_F90_value=$F90 + ac_cv_env_FFLAGS_set=${FFLAGS+set} + ac_cv_env_FFLAGS_value=$FFLAGS + ac_cv_env_CXX_set=${CXX+set} + ac_cv_env_CXX_value=$CXX + + ac_env_CC_set=set + ac_env_CC_value=$CC + ac_env_CFLAGS_set=${CFLAGS+set} + ac_env_CFLAGS_value=$CFLAGS + ac_env_CPP_set=set + ac_env_CPP_value=$CPP + ac_env_CPPFLAGS_set=${CPPFLAGS+set} + ac_env_CPPFLAGS_value=$CPPFLAGS + ac_env_LDFLAGS_set=${LDFLAGS+set} + ac_env_LDFLAGS_value=$LDFLAGS + ac_env_LIBS_set=${LIBS+set} + ac_env_LIBS_value=$LIBS + ac_env_FC_set=${FC+set} + ac_env_FC_value=$FC + ac_env_F77_set=${F77+set} + ac_env_F77_value=$F77 + ac_env_F90_set=${F90+set} + ac_env_F90_value=$F90 + ac_env_FFLAGS_set=${FFLAGS+set} + ac_env_FFLAGS_value=$FFLAGS + ac_env_CXX_set=${CXX+set} + ac_env_CXX_value=$CXX + + dnl other parameters are + dnl build_alias, host_alias, target_alias + + # It turns out that A C CACHE_SAVE can't be invoked more than once + # with data that contains blanks. What happens is that the quotes + # that it adds get quoted and then added again. To avoid this, + # we strip off the outer quotes for all cached variables + dnl We add pac_cv_my_conf_dir to give the source of this cachefile, + dnl and pac_cv_my_cachefile to indicate how it chose the cachefile. + pac_cv_my_conf_dir=`pwd` + pac_cv_my_cachefile=$cachefile + AC_CACHE_SAVE + PAC_CACHE_CLEAN + ac_configure_args="$ac_configure_args -enable-cache" +fi +dnl Unconditionally export these values. Subdir configures break otherwise +export CC +export CFLAGS +export LDFLAGS +export LIBS +export CPPFLAGS +export CPP +export FC +export F77 +export F90 +export CXX +export FFLAGS +export CCFLAGS +]) +AC_DEFUN([PAC_SUBDIR_CACHE_CLEANUP],[]) +AC_DEFUN([PAC_SUBDIR_CACHE_CLEANUP_OLD],[ +if test "$cache_file" != "/dev/null" -a "X$real_enable_cache" = "Xnotgiven" ; then + rm -f $cache_file + cache_file=/dev/null +fi +]) +dnl +dnl The following three macros support the sharing of configure results +dnl by configure scripts, including ones that are not run with +dnl AC_CONFIG_SUBDIRS (the cachefiles managed by --enable-cache can +dnl only be used with AC_CONFIG_SUBDIRS; creating a autoconf-style +dnl cachefile before the the end of the autoconf process will often +dnl cause problems. +dnl +AC_DEFUN([PAC_CREATE_BASE_CACHE],[ +AC_ARG_ENABLE(base-cache, + AC_HELP_STRING([--enable-base-cache], + [Enable the use of a simple cache for the subsidiary + configure scripts]),,enable_base_cache=default) +# The default case is controlled by the environment variable CONF_USE_CACHEFILE +if test "$enable_base_cache" = "default" ; then + if test "$CONF_USE_CACHEFILE" = yes ; then + enable_base_cache=yes + else + enable_base_cache=no + fi +fi +if test "$enable_base_cache" != no ; then + if test "$enable_base_cache" = yes ; then + basecachefile=`pwd`/cache.base + else + basecachefile=`pwd`/$enable_base_cache + fi + set | grep ac_cv > $basecachefile + # Tell other configures to load this file + echo "Creating and exporting the base cache file $basecachefile" + CONF_BASE_CACHEFILE=$basecachefile + export CONF_BASE_CACHEFILE +fi +]) +AC_DEFUN([PAC_LOAD_BASE_CACHE],[ +if test -n "$CONF_BASE_CACHEFILE" -a -s "$CONF_BASE_CACHEFILE" ; then + echo "Loading base cachefile $CONF_BASE_CACHEFILE" + . $CONF_BASE_CACHEFILE + export CONF_BASE_CACHEFILE +fi +]) +AC_DEFUN([PAC_UPDATE_BASE_CACHE],[ +if test -n "$CONF_BASE_CACHEFILE" -a -s "$CONF_BASE_CACHEFILE" ; then + set | grep ac_cv > $CONF_BASE_CACHEFILE.new + if cmp -s $CONF_BASE_CACHEFILE.new $CONF_BASE_CACHEFILE ; then + : + else + echo "Replacing $CONF_BASE_CACHEFILE" + mv $CONF_BASE_CACHEFILE.new $CONF_BASE_CACHEFILE + fi +fi +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_cc.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_cc.m4 new file mode 100644 index 0000000000..58ed3d1548 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_cc.m4 @@ -0,0 +1,1600 @@ +dnl AC_PROG_CC_GNU +ifdef([AC_PROG_CC_GNU],,[AC_DEFUN([AC_PROG_CC_GNU],)]) + +dnl PAC_PROG_CC - reprioritize the C compiler search order +AC_DEFUN([PAC_PROG_CC],[ + PAC_PUSH_FLAG([CFLAGS]) + AC_PROG_CC([gcc icc pgcc xlc xlC pathcc cc]) + PAC_POP_FLAG([CFLAGS]) +]) +dnl +dnl/*D +dnl PAC_C_CHECK_COMPILER_OPTION - Check that a compiler option is accepted +dnl without warning messages +dnl +dnl Synopsis: +dnl PAC_C_CHECK_COMPILER_OPTION(optionname,action-if-ok,action-if-fail) +dnl +dnl Output Effects: +dnl +dnl If no actions are specified, a working value is added to 'COPTIONS' +dnl +dnl Notes: +dnl This is now careful to check that the output is different, since +dnl some compilers are noisy. +dnl +dnl We are extra careful to prototype the functions in case compiler options +dnl that complain about poor code are in effect. +dnl +dnl Because this is a long script, we have ensured that you can pass a +dnl variable containing the option name as the first argument. +dnl +dnl D*/ +AC_DEFUN([PAC_C_CHECK_COMPILER_OPTION],[ +AC_MSG_CHECKING([whether C compiler accepts option $1]) +pac_opt="$1" +AC_LANG_PUSH([C]) +CFLAGS_orig="$CFLAGS" +CFLAGS_opt="$pac_opt $CFLAGS" +pac_result="unknown" + +AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +CFLAGS="$CFLAGS_orig" +rm -f pac_test1.log +PAC_LINK_IFELSE_LOG([pac_test1.log], [], [ + CFLAGS="$CFLAGS_opt" + rm -f pac_test2.log + PAC_LINK_IFELSE_LOG([pac_test2.log], [], [ + PAC_RUNLOG_IFELSE([diff -b pac_test1.log pac_test2.log], + [pac_result=yes],[pac_result=no]) + ],[ + pac_result=no + ]) +], [ + pac_result=no +]) +AC_MSG_RESULT([$pac_result]) +dnl Delete the conftest created by AC_LANG_CONFTEST. +rm -f conftest.$ac_ext + +# gcc 4.2.4 on 32-bit does not complain about the -Wno-type-limits option +# even though it doesn't support it. However, when another warning is +# triggered, it gives an error that the option is not recognized. So we +# need to test with a conftest file that will generate warnings. +# +# add an extra switch, pac_c_check_compiler_option_invalidprototest, to +# disable this test just in case some new compiler does not like it. +# +# Linking with a program with an invalid prototype to ensure a compiler warning. + +if test "$pac_result" = "yes" \ + -a "$pac_c_check_compiler_option_prototest" != "no" ; then + AC_MSG_CHECKING([whether C compiler option $1 works with an invalid prototype program]) + AC_LINK_IFELSE([ + AC_LANG_SOURCE([void main(){ return 0; }]) + ],[pac_result=yes],[pac_result=no]) + AC_MSG_RESULT([$pac_result]) +fi +# +if test "$pac_result" = "yes" ; then + AC_MSG_CHECKING([whether routines compiled with $pac_opt can be linked with ones compiled without $pac_opt]) + pac_result=unknown + CFLAGS="$CFLAGS_orig" + rm -f pac_test3.log + PAC_COMPILE_IFELSE_LOG([pac_test3.log], [ + AC_LANG_SOURCE([ + int foo(void); + int foo(void){return 0;} + ]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + + rm -f pac_test4.log + PAC_LINK_IFELSE_LOG([pac_test4.log], [AC_LANG_PROGRAM()], [ + CFLAGS="$CFLAGS_opt" + rm -f pac_test5.log + PAC_LINK_IFELSE_LOG([pac_test5.log], [AC_LANG_PROGRAM()], [ + PAC_RUNLOG_IFELSE([diff -b pac_test4.log pac_test5.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) + ],[ + pac_result=no + ]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ],[ + pac_result=no + ]) + AC_MSG_RESULT([$pac_result]) + rm -f pac_test3.log pac_test4.log pac_test5.log +fi +rm -f pac_test1.log pac_test2.log + +dnl Restore CFLAGS before 2nd/3rd argument commands are executed, +dnl as 2nd/3rd argument command could be modifying CFLAGS. +CFLAGS="$CFLAGS_orig" +if test "$pac_result" = "yes" ; then + ifelse([$2],[],[COPTIONS="$COPTIONS $1"],[$2]) +else + ifelse([$3],[],[:],[$3]) +fi +AC_LANG_POP([C]) +]) +dnl +dnl/*D +dnl PAC_C_OPTIMIZATION - Determine C options for producing optimized code +dnl +dnl Synopsis +dnl PAC_C_OPTIMIZATION([action if found]) +dnl +dnl Output Effect: +dnl Adds options to 'COPTIONS' if no other action is specified +dnl +dnl Notes: +dnl This is a temporary standin for compiler optimization. +dnl It should try to match known systems to known compilers (checking, of +dnl course), and then falling back to some common defaults. +dnl Note that many compilers will complain about -g and aggressive +dnl optimization. +dnl D*/ +AC_DEFUN([PAC_C_OPTIMIZATION],[ + for copt in "-O4 -Ofast" "-Ofast" "-fast" "-O3" "-xO3" "-O" ; do + PAC_C_CHECK_COMPILER_OPTION($copt,found_opt=yes,found_opt=no) + if test "$found_opt" = "yes" ; then + ifelse($1,,COPTIONS="$COPTIONS $copt",$1) + break + fi + done + if test "$ac_cv_prog_gcc" = "yes" ; then + for copt in "-fomit-frame-pointer" "-finline-functions" \ + "-funroll-loops" ; do + PAC_C_CHECK_COMPILER_OPTION($copt,found_opt=yes,found_opt=no) + if test "$found_opt" = "yes" ; then + ifelse($1,,COPTIONS="$COPTIONS $copt",$1) + # no break because we're trying to add them all + fi + done + # We could also look for architecture-specific gcc options + fi + +]) + +dnl/*D +dnl PAC_PROG_C_UNALIGNED_DOUBLES - Check that the C compiler allows unaligned +dnl doubles +dnl +dnl Synopsis: +dnl PAC_PROG_C_UNALIGNED_DOUBLES(action-if-true,action-if-false, +dnl action-if-unknown) +dnl +dnl Notes: +dnl 'action-if-unknown' is used in the case of cross-compilation. +dnl D*/ +AC_DEFUN([PAC_PROG_C_UNALIGNED_DOUBLES],[ +AC_CACHE_CHECK([whether C compiler allows unaligned doubles], +pac_cv_prog_c_unaligned_doubles,[ +AC_TRY_RUN([ +void fetch_double( v ) +double *v; +{ +*v = 1.0; +} +int main( argc, argv ) +int argc; +char **argv; +{ +int p[4]; +double *p_val; +fetch_double( (double *)&(p[0]) ); +p_val = (double *)&(p[0]); +if (*p_val != 1.0) return 1; +fetch_double( (double *)&(p[1]) ); +p_val = (double *)&(p[1]); +if (*p_val != 1.0) return 1; +return 0; +} +],pac_cv_prog_c_unaligned_doubles="yes",pac_cv_prog_c_unaligned_doubles="no", +pac_cv_prog_c_unaligned_doubles="unknown")]) +ifelse($1,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "yes" ; then +$1 +fi) +ifelse($2,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "no" ; then +$2 +fi) +ifelse($3,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "unknown" ; then +$3 +fi) +]) + +dnl/*D +dnl PAC_PROG_C_WEAK_SYMBOLS - Test whether C supports weak alias symbols. +dnl +dnl Synopsis +dnl PAC_PROG_C_WEAK_SYMBOLS(action-if-true,action-if-false) +dnl +dnl Output Effect: +dnl Defines one of the following if a weak symbol pragma is found: +dnl.vb +dnl HAVE_PRAGMA_WEAK - #pragma weak +dnl HAVE_PRAGMA_HP_SEC_DEF - #pragma _HP_SECONDARY_DEF +dnl HAVE_PRAGMA_CRI_DUP - #pragma _CRI duplicate x as y +dnl.ve +dnl May also define +dnl.vb +dnl HAVE_WEAK_ATTRIBUTE +dnl.ve +dnl if functions can be declared as 'int foo(...) __attribute__ ((weak));' +dnl sets the shell variable pac_cv_attr_weak to yes. +dnl Also checks for __attribute__((weak_import)) which is supported by +dnl Apple in Mac OSX (at least in Darwin). Note that this provides only +dnl weak symbols, not weak aliases +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_C_WEAK_SYMBOLS],[ +pragma_extra_message="" +AC_CACHE_CHECK([for type of weak symbol alias support], +pac_cv_prog_c_weak_symbols,[ +# Test for weak symbol support... +# We can't put # in the message because it causes autoconf to generate +# incorrect code +AC_TRY_LINK([ +extern int PFoo(int); +#pragma weak PFoo = Foo +int Foo(int a) { return a; } +],[return PFoo(1);],has_pragma_weak=yes) +# +# Some systems (Linux ia64 and ecc, for example), support weak symbols +# only within a single object file! This tests that case. +# Note that there is an extern int PFoo declaration before the +# pragma. Some compilers require this in order to make the weak symbol +# extenally visible. +if test "$has_pragma_weak" = yes ; then + PAC_COMPLINK_IFELSE([ + AC_LANG_SOURCE([ +extern int PFoo(int); +#pragma weak PFoo = Foo +int Foo(int); +int Foo(int a) { return a; } + ]) + ],[ + AC_LANG_SOURCE([ +extern int PFoo(int); +int main(int argc, char **argv) { +return PFoo(0);} + ]) + ],[ + PAC_COMPLINK_IFELSE([ + AC_LANG_SOURCE([ +extern int PFoo(int); +#pragma weak PFoo = Foo +int Foo(int); +int Foo(int a) { return a; } + ]) + ],[ + AC_LANG_SOURCE([ +extern int Foo(int); +int PFoo(int a) { return a+1;} +int main(int argc, char **argv) { +return Foo(0);} + ]) + ],[ + pac_cv_prog_c_weak_symbols="pragma weak" + ],[ + has_pragma_weak=0 + pragma_extra_message="pragma weak accepted but does not work (probably creates two non-weak entries)" + ]) + ],[ + has_pragma_weak=0 + pragma_extra_message="pragma weak accepted but does not work (probably creates two non-weak entries)" + ]) +fi +dnl +if test -z "$pac_cv_prog_c_weak_symbols" ; then + AC_TRY_LINK([ +extern int PFoo(int); +#pragma _HP_SECONDARY_DEF Foo PFoo +int Foo(int a) { return a; } +],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _HP_SECONDARY_DEF") +fi +dnl +if test -z "$pac_cv_prog_c_weak_symbols" ; then + AC_TRY_LINK([ +extern int PFoo(int); +#pragma _CRI duplicate PFoo as Foo +int Foo(int a) { return a; } +],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _CRI duplicate x as y") +fi +dnl +if test -z "$pac_cv_prog_c_weak_symbols" ; then + pac_cv_prog_c_weak_symbols="no" +fi +dnl +dnl If there is an extra explanatory message, echo it now so that it +dnl doesn't interfere with the cache result value +if test -n "$pragma_extra_message" ; then + echo $pragma_extra_message +fi +dnl +]) +if test "$pac_cv_prog_c_weak_symbols" = "no" ; then + ifelse([$2],,:,[$2]) +else + case "$pac_cv_prog_c_weak_symbols" in + "pragma weak") AC_DEFINE(HAVE_PRAGMA_WEAK,1,[Supports weak pragma]) + ;; + "pragma _HP") AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF,1,[HP style weak pragma]) + ;; + "pragma _CRI") AC_DEFINE(HAVE_PRAGMA_CRI_DUP,1,[Cray style weak pragma]) + ;; + esac + ifelse([$1],,:,[$1]) +fi +AC_CACHE_CHECK([whether __attribute__ ((weak)) allowed], +pac_cv_attr_weak,[ +AC_TRY_COMPILE([int foo(int) __attribute__ ((weak));],[int a;], +pac_cv_attr_weak=yes,pac_cv_attr_weak=no)]) +# Note that being able to compile with weak_import doesn't mean that +# it works. +AC_CACHE_CHECK([whether __attribute__ ((weak_import)) allowed], +pac_cv_attr_weak_import,[ +AC_TRY_COMPILE([int foo(int) __attribute__ ((weak_import));],[int a;], +pac_cv_attr_weak_import=yes,pac_cv_attr_weak_import=no)]) +# Check if the alias option for weak attributes is allowed +AC_CACHE_CHECK([whether __attribute__((weak,alias(...))) allowed], +pac_cv_attr_weak_alias,[ +AC_TRY_COMPILE([int foo(int) __attribute__((weak,alias("__foo")));],[int a;], +pac_cv_attr_weak_alias=yes,pac_cv_attr_weak_alias=no)]) +]) + +# +# This is a replacement that checks that FAILURES are signaled as well +# (later configure macros look for the .o file, not just success from the +# compiler, but they should not HAVE to +# +dnl --- insert 2.52 compatibility here --- +dnl 2.52 does not have AC_PROG_CC_WORKS +ifdef([AC_PROG_CC_WORKS],,[AC_DEFUN([AC_PROG_CC_WORKS],)]) +dnl +AC_DEFUN([PAC_PROG_CC_WORKS], +[AC_PROG_CC_WORKS +AC_MSG_CHECKING([whether the C compiler sets its return status correctly]) +AC_LANG_SAVE +AC_LANG_C +AC_TRY_COMPILE(,[int a = bzzzt;],notbroken=no,notbroken=yes) +AC_MSG_RESULT($notbroken) +if test "$notbroken" = "no" ; then + AC_MSG_ERROR([installation or configuration problem: C compiler does not +correctly set error code when a fatal error occurs]) +fi +]) + +dnl/*D +dnl PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS - Test whether C and the +dnl linker allow multiple weak symbols. +dnl +dnl Synopsis +dnl PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS(action-if-true,action-if-false) +dnl +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS],[ +AC_CACHE_CHECK([for multiple weak symbol support], +pac_cv_prog_c_multiple_weak_symbols,[ +# Test for multiple weak symbol support... +PAC_COMPLINK_IFELSE([ + AC_LANG_SOURCE([ +extern int PFoo(int); +extern int PFoo_(int); +extern int pfoo_(int); +#pragma weak PFoo = Foo +#pragma weak PFoo_ = Foo +#pragma weak pfoo_ = Foo +int Foo(int); +int Foo(a) { return a; } + ]) +],[ + AC_LANG_SOURCE([ +extern int PFoo(int), PFoo_(int), pfoo_(int); +int main() { +return PFoo(0) + PFoo_(1) + pfoo_(2);} + ]) +],[ + pac_cv_prog_c_multiple_weak_symbols="yes" +]) +dnl +]) +if test "$pac_cv_prog_c_multiple_weak_symbols" = "yes" ; then + ifelse([$1],,:,[$1]) +else + ifelse([$2],,:,[$2]) +fi +]) + +dnl Use the value of enable-strict to update CFLAGS +dnl pac_cc_strict_flags contains the strict flags. +dnl +dnl -std=c89 is used to select the C89 version of the ANSI/ISO C standard. +dnl As of this writing, many C compilers still accepted only this version, +dnl not the later C99 version. When all compilers accept C99, this +dnl should be changed to the appropriate standard level. Note that we've +dnl had trouble with gcc 2.95.3 accepting -std=c89 but then trying to +dnl compile program with a invalid set of options +dnl (-D __STRICT_ANSI__-trigraphs) +AC_DEFUN([PAC_CC_STRICT],[ +export enable_strict_done +if test "$enable_strict_done" != "yes" ; then + + # Some comments on strict warning options. + # These were added to reduce warnings: + # -Wno-missing-field-initializers -- We want to allow a struct to be + # initialized to zero using "struct x y = {0};" and not require + # each field to be initialized individually. + # -Wno-unused-parameter -- For portability, some parameters go unused + # when we have different implementations of functions for + # different platforms + # -Wno-unused-label -- We add fn_exit: and fn_fail: on all functions, + # but fn_fail may not be used if the function doesn't return an + # error. + # -Wno-sign-compare -- read() and write() return bytes read/written + # as a signed value, but we often compare this to size_t (or + # msg_sz_t) variables. + # -Wno-format-zero-length -- this warning is irritating and useless, since + # a zero-length format string is very well defined + # -Wno-type-limits -- There are places where we compare an unsigned to + # a constant that happens to be zero e.g., if x is unsigned and + # MIN_VAL is zero, we'd like to do "MPIU_Assert(x >= MIN_VAL);". + # Note this option is not supported by gcc 4.2. This needs to be added + # after most other warning flags, so that we catch a gcc bug on 32-bit + # that doesn't give a warning that this is unsupported, unless another + # warning is triggered, and then if gives an error. + # These were removed to reduce warnings: + # -Wcast-qual -- Sometimes we need to cast "volatile char*" to + # "char*", e.g., for memcpy. + # -Wpadded -- We catch struct padding with asserts when we need to + # -Wredundant-decls -- Having redundant declarations is benign and the + # code already has some. + # -Waggregate-return -- This seems to be a performance-related warning + # aggregate return values are legal in ANSI C, but they may be returned + # in memory rather than through a register. We do use aggregate return + # values, but they are structs of a single basic type (used to enforce + # type checking for relative vs. absolute ptrs), and with optimization + # the aggregate value is converted to a scalar. + # -Wdeclaration-after-statement -- This is a C89 + # requirement. When compiling with C99, this should be + # disabled. + # the embedded newlines in this string are safe because we evaluate each + # argument in the for-loop below and append them to the CFLAGS with a space + # as the separator instead + pac_common_strict_flags=" + -Wall + -Wextra + -Wno-missing-field-initializers + -Wstrict-prototypes + -Wmissing-prototypes + -DGCC_WALL + -Wno-unused-parameter + -Wno-unused-label + -Wshadow + -Wmissing-declarations + -Wno-long-long + -Wfloat-equal + -Wundef + -Wno-endif-labels + -Wpointer-arith + -Wbad-function-cast + -Wcast-align + -Wwrite-strings + -Wno-sign-compare + -Wold-style-definition + -Wno-multichar + -Wno-deprecated-declarations + -Wpacked + -Wnested-externs + -Winvalid-pch + -Wno-pointer-sign + -Wvariadic-macros + -Wno-format-zero-length + -Wno-type-limits + " + + enable_c89=yes + enable_c99=no + enable_posix=yes + enable_opt=yes + flags="`echo $1 | sed -e 's/:/ /g' -e 's/,/ /g'`" + for flag in ${flags}; do + case "$flag" in + c89) + enable_strict_done="yes" + enable_c89=yes + ;; + c99) + enable_strict_done="yes" + enable_c99=yes + ;; + posix) + enable_strict_done="yes" + enable_posix=yes + ;; + noposix) + enable_strict_done="yes" + enable_posix=no + ;; + opt) + enable_strict_done="yes" + enable_opt=yes + ;; + noopt) + enable_strict_done="yes" + enable_opt=no + ;; + all|yes) + enable_strict_done="yes" + enable_c89=yes + enable_posix=yes + enable_opt=yes + ;; + no) + # Accept and ignore this value + : + ;; + *) + if test -n "$flag" ; then + AC_MSG_WARN([Unrecognized value for enable-strict:$flag]) + fi + ;; + esac + done + + pac_cc_strict_flags="" + if test "${enable_strict_done}" = "yes" ; then + if test "${enable_opt}" = "yes" ; then + pac_cc_strict_flags="-O2" + fi + pac_cc_strict_flags="$pac_cc_strict_flags $pac_common_strict_flags" + if test "${enable_posix}" = "yes" ; then + PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=199506L],[pac_cc_strict_flags]) + fi + # We only allow one of strict-C99 or strict-C89 to be + # enabled. If C99 is enabled, we automatically disable C89. + if test "${enable_c99}" = "yes" ; then + PAC_APPEND_FLAG([-std=c99],[pac_cc_strict_flags]) + elif test "${enable_c89}" = "yes" ; then + PAC_APPEND_FLAG([-std=c89],[pac_cc_strict_flags]) + PAC_APPEND_FLAG([-Wdeclaration-after-statement],[pac_cc_strict_flags]) + fi + fi + + # See if the above options work with the compiler + accepted_flags="" + for flag in $pac_cc_strict_flags ; do + PAC_PUSH_FLAG([CFLAGS]) + CFLAGS="$CFLAGS $accepted_flags" + PAC_C_CHECK_COMPILER_OPTION([$flag],[accepted_flags="$accepted_flags $flag"],) + PAC_POP_FLAG([CFLAGS]) + done + pac_cc_strict_flags=$accepted_flags +fi +]) + +dnl/*D +dnl PAC_ARG_STRICT - Add --enable-strict to configure. +dnl +dnl Synopsis: +dnl PAC_ARG_STRICT +dnl +dnl Output effects: +dnl Adds '--enable-strict' to the command line. +dnl +dnl D*/ +AC_DEFUN([PAC_ARG_STRICT],[ +AC_ARG_ENABLE(strict, + AC_HELP_STRING([--enable-strict], [Turn on strict compilation testing])) +PAC_CC_STRICT($enable_strict) +CFLAGS="$CFLAGS $pac_cc_strict_flags" +export CFLAGS +]) + +dnl Return the integer structure alignment in pac_cv_c_max_integer_align +dnl Possible values include +dnl packed +dnl two +dnl four +dnl eight +dnl +dnl In addition, a "Could not determine alignment" and a "error!" +dnl return is possible. +AC_DEFUN([PAC_C_MAX_INTEGER_ALIGN],[ +AC_CACHE_CHECK([for max C struct integer alignment], +pac_cv_c_max_integer_align,[ +AC_TRY_RUN([ +#include +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + struct { char a; int b; } char_int; + struct { char a; short b; } char_short; + struct { char a; long b; } char_long; + struct { char a; int b; char c; } char_int_char; + struct { char a; short b; char c; } char_short_char; +#ifdef HAVE_LONG_LONG_INT + struct { long long int a; char b; } lli_c; + struct { char a; long long int b; } c_lli; +#endif + int size, extent, extent2; + + /* assume max integer alignment isn't 8 if we don't have + * an eight-byte value :) + */ +#ifdef HAVE_LONG_LONG_INT + if (sizeof(int) < 8 && sizeof(long) < 8 && sizeof(long long int) < 8) + is_eight = 0; +#else + if (sizeof(int) < 8 && sizeof(long) < 8) is_eight = 0; +#endif + + size = sizeof(char) + sizeof(int); + extent = sizeof(char_int); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if ( (extent % 4) != 0) is_four = 0; + if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_int",size,extent); + + size = sizeof(char) + sizeof(short); + extent = sizeof(char_short); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; + if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_short",size,extent); + + size = sizeof(char) + sizeof(long); + extent = sizeof(char_long); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if ( (extent % 4) != 0) is_four = 0; + if (sizeof(long) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_long",size,extent); + +#ifdef HAVE_LONG_LONG_INT + size = sizeof(char) + sizeof(long long int); + extent = sizeof(lli_c); + extent2 = sizeof(c_lli); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(long long int) >= 8 && (extent % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; +#endif + + size = sizeof(char) + sizeof(int) + sizeof(char); + extent = sizeof(char_int_char); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if ( (extent % 4) != 0) is_four = 0; + if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_int_char",size,extent); + + size = sizeof(char) + sizeof(short) + sizeof(char); + extent = sizeof(char_short_char); + if (size != extent) is_packed = 0; + if ( (extent % 2) != 0) is_two = 0; + if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; + if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; + DBG("char_short_char",size,extent); + + /* If aligned mod 8, it will be aligned mod 4 */ + if (is_eight) { is_four = 0; is_two = 0; } + + if (is_four) is_two = 0; + + /* Tabulate the results */ + cf = fopen( "ctest.out", "w" ); + if (is_packed + is_two + is_four + is_eight == 0) { + fprintf( cf, "Could not determine alignment\n" ); + } + else { + if (is_packed + is_two + is_four + is_eight != 1) { + fprintf( cf, "error!\n" ); + } + else { + if (is_packed) fprintf( cf, "packed\n" ); + if (is_two) fprintf( cf, "two\n" ); + if (is_four) fprintf( cf, "four\n" ); + if (is_eight) fprintf( cf, "eight\n" ); + } + } + fclose( cf ); + return 0; +}], +pac_cv_c_max_integer_align=`cat ctest.out`, +pac_cv_c_max_integer_align="unknown", +pac_cv_c_max_integer_align="$CROSS_ALIGN_STRUCT_INT") +rm -f ctest.out +]) +if test -z "$pac_cv_c_max_integer_align" ; then + pac_cv_c_max_integer_align="unknown" +fi +]) + +dnl Return the floating point structure alignment in +dnl pac_cv_c_max_fp_align. +dnl +dnl Possible values include: +dnl packed +dnl two +dnl four +dnl eight +dnl sixteen +dnl +dnl In addition, a "Could not determine alignment" and a "error!" +dnl return is possible. +AC_DEFUN([PAC_C_MAX_FP_ALIGN],[ +AC_CACHE_CHECK([for max C struct floating point alignment], +pac_cv_c_max_fp_align,[ +AC_TRY_RUN([ +#include +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + int is_sixteen = 1; + struct { char a; float b; } char_float; + struct { float b; char a; } float_char; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; +#ifdef HAVE_LONG_DOUBLE + struct { char a; long double b; } char_long_double; + struct { long double b; char a; } long_double_char; + struct { long double a; int b; char c; } long_double_int_char; +#endif + int size, extent1, extent2; + + size = sizeof(char) + sizeof(float); + extent1 = sizeof(char_float); + extent2 = sizeof(float_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(float) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + DBG("char_float",size,extent1); + + size = sizeof(char) + sizeof(double); + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(double) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + DBG("char_double",size,extent1); + +#ifdef HAVE_LONG_DOUBLE + size = sizeof(char) + sizeof(long double); + extent1 = sizeof(char_long_double); + extent2 = sizeof(long_double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0 + && (extent2 % 16) != 0) is_sixteen = 0; + DBG("char_long-double",size,extent1); + + extent1 = sizeof(long_double_int_char); + if ( (extent1 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0) is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0) is_sixteen = 0; +#else + is_sixteen = 0; +#endif + + if (is_sixteen) { is_eight = 0; is_four = 0; is_two = 0; } + + if (is_eight) { is_four = 0; is_two = 0; } + + if (is_four) is_two = 0; + + /* Tabulate the results */ + cf = fopen( "ctest.out", "w" ); + if (is_packed + is_two + is_four + is_eight + is_sixteen == 0) { + fprintf( cf, "Could not determine alignment\n" ); + } + else { + if (is_packed + is_two + is_four + is_eight + is_sixteen != 1) { + fprintf( cf, "error!\n" ); + } + else { + if (is_packed) fprintf( cf, "packed\n" ); + if (is_two) fprintf( cf, "two\n" ); + if (is_four) fprintf( cf, "four\n" ); + if (is_eight) fprintf( cf, "eight\n" ); + if (is_sixteen) fprintf( cf, "sixteen\n" ); + } + } + fclose( cf ); + return 0; +}], +pac_cv_c_max_fp_align=`cat ctest.out`, +pac_cv_c_max_fp_align="unknown", +pac_cv_c_max_fp_align="$CROSS_ALIGN_STRUCT_FP") +rm -f ctest.out +]) +if test -z "$pac_cv_c_max_fp_align" ; then + pac_cv_c_max_fp_align="unknown" +fi +]) + +dnl Return the floating point structure alignment in +dnl pac_cv_c_max_double_fp_align. +dnl +dnl Possible values include: +dnl packed +dnl two +dnl four +dnl eight +dnl +dnl In addition, a "Could not determine alignment" and a "error!" +dnl return is possible. +AC_DEFUN([PAC_C_MAX_DOUBLE_FP_ALIGN],[ +AC_CACHE_CHECK([for max C struct alignment of structs with doubles], +pac_cv_c_max_double_fp_align,[ +AC_TRY_RUN([ +#include +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + struct { char a; float b; } char_float; + struct { float b; char a; } float_char; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; + int size, extent1, extent2; + + size = sizeof(char) + sizeof(float); + extent1 = sizeof(char_float); + extent2 = sizeof(float_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(float) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + DBG("char_float",size,extent1); + + size = sizeof(char) + sizeof(double); + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(double) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + DBG("char_double",size,extent1); + + if (is_eight) { is_four = 0; is_two = 0; } + + if (is_four) is_two = 0; + + /* Tabulate the results */ + cf = fopen( "ctest.out", "w" ); + if (is_packed + is_two + is_four + is_eight == 0) { + fprintf( cf, "Could not determine alignment\n" ); + } + else { + if (is_packed + is_two + is_four + is_eight != 1) { + fprintf( cf, "error!\n" ); + } + else { + if (is_packed) fprintf( cf, "packed\n" ); + if (is_two) fprintf( cf, "two\n" ); + if (is_four) fprintf( cf, "four\n" ); + if (is_eight) fprintf( cf, "eight\n" ); + } + } + fclose( cf ); + return 0; +}], +pac_cv_c_max_double_fp_align=`cat ctest.out`, +pac_cv_c_max_double_fp_align="unknown", +pac_cv_c_max_double_fp_align="$CROSS_ALIGN_STRUCT_DOUBLE_FP") +rm -f ctest.out +]) +if test -z "$pac_cv_c_max_double_fp_align" ; then + pac_cv_c_max_double_fp_align="unknown" +fi +]) +AC_DEFUN([PAC_C_MAX_LONGDOUBLE_FP_ALIGN],[ +AC_CACHE_CHECK([for max C struct floating point alignment with long doubles], +pac_cv_c_max_longdouble_fp_align,[ +AC_TRY_RUN([ +#include +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int is_packed = 1; + int is_two = 1; + int is_four = 1; + int is_eight = 1; + int is_sixteen = 1; + struct { char a; long double b; } char_long_double; + struct { long double b; char a; } long_double_char; + struct { long double a; int b; char c; } long_double_int_char; + int size, extent1, extent2; + + size = sizeof(char) + sizeof(long double); + extent1 = sizeof(char_long_double); + extent2 = sizeof(long_double_char); + if (size != extent1) is_packed = 0; + if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) + is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0 + && (extent2 % 16) != 0) is_sixteen = 0; + DBG("char_long-double",size,extent1); + + extent1 = sizeof(long_double_int_char); + if ( (extent1 % 2) != 0) is_two = 0; + if ( (extent1 % 4) != 0) is_four = 0; + if (sizeof(long double) >= 8 && (extent1 % 8) != 0) is_eight = 0; + if (sizeof(long double) > 8 && (extent1 % 16) != 0) is_sixteen = 0; + + if (is_sixteen) { is_eight = 0; is_four = 0; is_two = 0; } + + if (is_eight) { is_four = 0; is_two = 0; } + + if (is_four) is_two = 0; + + /* Tabulate the results */ + cf = fopen( "ctest.out", "w" ); + if (is_packed + is_two + is_four + is_eight + is_sixteen == 0) { + fprintf( cf, "Could not determine alignment\n" ); + } + else { + if (is_packed + is_two + is_four + is_eight + is_sixteen != 1) { + fprintf( cf, "error!\n" ); + } + else { + if (is_packed) fprintf( cf, "packed\n" ); + if (is_two) fprintf( cf, "two\n" ); + if (is_four) fprintf( cf, "four\n" ); + if (is_eight) fprintf( cf, "eight\n" ); + if (is_sixteen) fprintf( cf, "sixteen\n" ); + } + } + fclose( cf ); + return 0; +}], +pac_cv_c_max_longdouble_fp_align=`cat ctest.out`, +pac_cv_c_max_longdouble_fp_align="unknown", +pac_cv_c_max_longdouble_fp_align="$CROSS_ALIGN_STRUCT_LONGDOUBLE_FP") +rm -f ctest.out +]) +if test -z "$pac_cv_c_max_longdouble_fp_align" ; then + pac_cv_c_max_longdouble_fp_align="unknown" +fi +]) + +dnl Other tests assume that there is potentially a maximum alignment +dnl and that if there is no maximum alignment, or a type is smaller than +dnl that value, then we align on the size of the value, with the exception +dnl of the "position-based alignment" rules we test for separately. +dnl +dnl It turns out that these assumptions have fallen short in at least one +dnl case, on MacBook Pros, where doubles are aligned on 4-byte boundaries +dnl even when long doubles are aligned on 16-byte boundaries. So this test +dnl is here specifically to handle this case. +dnl +dnl Puts result in pac_cv_c_double_alignment_exception. +dnl +dnl Possible values currently include no and four. +dnl +AC_DEFUN([PAC_C_DOUBLE_ALIGNMENT_EXCEPTION],[ +AC_CACHE_CHECK([if double alignment breaks rules, find actual alignment], +pac_cv_c_double_alignment_exception,[ +AC_TRY_RUN([ +#include +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; + int extent1, extent2, align_4 = 0; + + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + + /* we're interested in the largest value, will let separate test + * deal with position-based issues. + */ + if (extent1 < extent2) extent1 = extent2; + if ((sizeof(double) == 8) && (extent1 % 8) != 0) { + if (extent1 % 4 == 0) { +#ifdef HAVE_MAX_FP_ALIGNMENT + if (HAVE_MAX_FP_ALIGNMENT >= 8) align_4 = 1; +#else + align_4 = 1; +#endif + } + } + + cf = fopen( "ctest.out", "w" ); + + if (align_4) fprintf( cf, "four\n" ); + else fprintf( cf, "no\n" ); + + fclose( cf ); + return 0; +}], +pac_cv_c_double_alignment_exception=`cat ctest.out`, +pac_cv_c_double_alignment_exception="unknown", +pac_cv_c_double_alignment_exception="$CROSS_ALIGN_DOUBLE_EXCEPTION") +rm -f ctest.out +]) +if test -z "$pac_cv_c_double_alignment_exception" ; then + pac_cv_c_double_alignment_exception="unknown" +fi +]) + +dnl Test for odd struct alignment rule that only applies max. +dnl padding when double value is at front of type. +dnl Puts result in pac_cv_c_double_pos_align. +dnl +dnl Search for "Power alignment mode" for more details. +dnl +dnl Possible values include yes, no, and unknown. +dnl +AC_DEFUN([PAC_C_DOUBLE_POS_ALIGN],[ +AC_CACHE_CHECK([if alignment of structs with doubles is based on position], +pac_cv_c_double_pos_align,[ +AC_TRY_RUN([ +#include +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int padding_varies_by_pos = 0; + struct { char a; double b; } char_double; + struct { double b; char a; } double_char; + int extent1, extent2; + + extent1 = sizeof(char_double); + extent2 = sizeof(double_char); + if (extent1 != extent2) padding_varies_by_pos = 1; + + cf = fopen( "ctest.out", "w" ); + if (padding_varies_by_pos) fprintf( cf, "yes\n" ); + else fprintf( cf, "no\n" ); + + fclose( cf ); + return 0; +}], +pac_cv_c_double_pos_align=`cat ctest.out`, +pac_cv_c_double_pos_align="unknown", +pac_cv_c_double_pos_align="$CROSS_ALIGN_DOUBLE_POS") +rm -f ctest.out +]) +if test -z "$pac_cv_c_double_pos_align" ; then + pac_cv_c_double_pos_align="unknown" +fi +]) + +dnl Test for odd struct alignment rule that only applies max. +dnl padding when long long int value is at front of type. +dnl Puts result in pac_cv_c_llint_pos_align. +dnl +dnl Search for "Power alignment mode" for more details. +dnl +dnl Possible values include yes, no, and unknown. +dnl +AC_DEFUN([PAC_C_LLINT_POS_ALIGN],[ +AC_CACHE_CHECK([if alignment of structs with long long ints is based on position], +pac_cv_c_llint_pos_align,[ +AC_TRY_RUN([ +#include +#define DBG(a,b,c) +int main( int argc, char *argv[] ) +{ + FILE *cf; + int padding_varies_by_pos = 0; +#ifdef HAVE_LONG_LONG_INT + struct { char a; long long int b; } char_llint; + struct { long long int b; char a; } llint_char; + int extent1, extent2; + + extent1 = sizeof(char_llint); + extent2 = sizeof(llint_char); + if (extent1 != extent2) padding_varies_by_pos = 1; +#endif + + cf = fopen( "ctest.out", "w" ); + if (padding_varies_by_pos) fprintf( cf, "yes\n" ); + else fprintf( cf, "no\n" ); + + fclose( cf ); + return 0; +}], +pac_cv_c_llint_pos_align=`cat ctest.out`, +pac_cv_c_llint_pos_align="unknown", +pac_cv_c_llint_pos_align="$CROSS_ALIGN_LLINT_POS") +rm -f ctest.out +]) +if test -z "$pac_cv_c_llint_pos_align" ; then + pac_cv_c_llint_pos_align="unknown" +fi +]) + +dnl/*D +dnl PAC_FUNC_NEEDS_DECL - Set NEEDS__DECL if a declaration is needed +dnl +dnl Synopsis: +dnl PAC_FUNC_NEEDS_DECL(headerfiles,funcname) +dnl +dnl Output Effect: +dnl Sets 'NEEDS__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 There is one difficulty - if the compiler has been instructed to +dnl fail on implicitly defined functions, then this test will always +dnl fail. +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 $2(double, int, double, const char *);],[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(<>, 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 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_GNU]) +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 +dnl Check for a broken install (fails to preserve file modification times, +dnl thus breaking libraries. +dnl +dnl Create a library, install it, and then try to link against it. +AC_DEFUN([PAC_PROG_INSTALL_BREAKS_LIBS],[ +AC_CACHE_CHECK([whether install breaks libraries], +ac_cv_prog_install_breaks_libs,[ +AC_REQUIRE([AC_PROG_RANLIB]) +AC_REQUIRE([AC_PROG_INSTALL]) +AC_REQUIRE([AC_PROG_CC]) +ac_cv_prog_install_breaks_libs=yes + +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ int foo(int); int foo(int a){return a;} ]) +],[ + if ${AR-ar} ${AR_FLAGS-cr} libconftest.a conftest.$OBJEXT >/dev/null 2>&1 ; then + if ${RANLIB-:} libconftest.a >/dev/null 2>&1 ; then + # Anything less than sleep 10, and Mac OS/X (Darwin) + # will claim that install works because ranlib won't complain + sleep 10 + libinstall="$INSTALL_DATA" + eval "libinstall=\"$libinstall\"" + if ${libinstall} libconftest.a libconftest1.a >/dev/null 2>&1 ; then + saved_LIBS="$LIBS" + LIBS="libconftest1.a" + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +extern int foo(int); +int main(int argc, char **argv){ return foo(0); } + ]) + ],[ + # Success! Install works + ac_cv_prog_install_breaks_libs=no + ],[ + # Failure! Does install -p work? + rm -f libconftest1.a + if ${libinstall} -p libconftest.a libconftest1.a >/dev/null 2>&1 ; then + AC_LINK_IFELSE([],[ + # Success! Install works + ac_cv_prog_install_breaks_libs="no, with -p" + ]) + fi + ]) + LIBS="$saved_LIBS" + fi + fi + fi +]) +rm -f libconftest*.a +]) dnl Endof ac_cache_check + +if test -z "$RANLIB_AFTER_INSTALL" ; then + RANLIB_AFTER_INSTALL=no +fi +case "$ac_cv_prog_install_breaks_libs" in + yes) + RANLIB_AFTER_INSTALL=yes + ;; + "no, with -p") + INSTALL_DATA="$INSTALL_DATA -p" + ;; + *) + # Do nothing + : + ;; +esac +AC_SUBST(RANLIB_AFTER_INSTALL) +]) + +# +# determine if the compiler defines a symbol containing the function name +# Inspired by checks within the src/mpid/globus/configure.in file in MPICH2 +# +# These tests check not only that the compiler defines some symbol, such +# as __FUNCTION__, but that the symbol correctly names the function. +# +# Defines +# HAVE__FUNC__ (if __func__ defined) +# HAVE_CAP__FUNC__ (if __FUNC__ defined) +# HAVE__FUNCTION__ (if __FUNCTION__ defined) +# +AC_DEFUN([PAC_CC_FUNCTION_NAME_SYMBOL],[ +AC_CACHE_CHECK([whether the compiler defines __func__], +pac_cv_have__func__,[ +tmp_am_cross=no +AC_RUN_IFELSE([ +AC_LANG_SOURCE([ +#include +int foo(void); +int foo(void) +{ + return (strcmp(__func__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} +]) +], pac_cv_have__func__=yes, pac_cv_have__func__=no,tmp_am_cross=yes) +if test "$tmp_am_cross" = yes ; then + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +#include +int foo(void); +int foo(void) +{ + return (strcmp(__func__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} + ]) +], pac_cv_have__func__=yes, pac_cv_have__func__=no) +fi +]) + +if test "$pac_cv_have__func__" = "yes" ; then + AC_DEFINE(HAVE__FUNC__,,[define if the compiler defines __func__]) +fi + +AC_CACHE_CHECK([whether the compiler defines __FUNC__], +pac_cv_have_cap__func__,[ +tmp_am_cross=no +AC_RUN_IFELSE([ +AC_LANG_SOURCE([ +#include +int foo(void); +int foo(void) +{ + return (strcmp(__FUNC__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} +]) +], pac_cv_have_cap__func__=yes, pac_cv_have_cap__func__=no,tmp_am_cross=yes) +if test "$tmp_am_cross" = yes ; then + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +#include +int foo(void); +int foo(void) +{ + return (strcmp(__FUNC__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} + ]) +], pac_cv_have__func__=yes, pac_cv_have__func__=no) +fi +]) + +if test "$pac_cv_have_cap__func__" = "yes" ; then + AC_DEFINE(HAVE_CAP__FUNC__,,[define if the compiler defines __FUNC__]) +fi + +AC_CACHE_CHECK([whether the compiler sets __FUNCTION__], +pac_cv_have__function__,[ +tmp_am_cross=no +AC_RUN_IFELSE([ +AC_LANG_SOURCE([ +#include +int foo(void); +int foo(void) +{ + return (strcmp(__FUNCTION__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} +]) +], pac_cv_have__function__=yes, pac_cv_have__function__=no,tmp_am_cross=yes) +if test "$tmp_am_cross" = yes ; then + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +#include +int foo(void); +int foo(void) +{ + return (strcmp(__FUNCTION__, "foo") == 0); +} +int main(int argc, char ** argv) +{ + return (foo() ? 0 : 1); +} + ]) +], pac_cv_have__func__=yes, pac_cv_have__func__=no) +fi +]) + +if test "$pac_cv_have__function__" = "yes" ; then + AC_DEFINE(HAVE__FUNCTION__,,[define if the compiler defines __FUNCTION__]) +fi + +]) + + +dnl Check structure alignment +AC_DEFUN([PAC_STRUCT_ALIGNMENT],[ + # Initialize alignment checks + is_packed=1 + is_two=1 + is_four=1 + is_eight=1 + is_largest=1 + + # See if long double exists + AC_TRY_COMPILE(,[long double a;],have_long_double=yes,have_long_double=no) + + # Get sizes of regular types + AC_CHECK_SIZEOF(char) + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(short) + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(float) + AC_CHECK_SIZEOF(double) + AC_CHECK_SIZEOF(long double) + + # char_int comparison + AC_CHECK_SIZEOF(char_int, 0, [typedef struct { char a; int b; } char_int; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_int` + extent=$ac_cv_sizeof_char_int + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_int`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_int" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_short comparison + AC_CHECK_SIZEOF(char_short, 0, [typedef struct { char a; short b; } char_short; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_short` + extent=$ac_cv_sizeof_char_short + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_short`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "$ac_cv_sizeof_short" = "4" -a "`expr $extent % 4`" != "0" ; then + is_four=0 + fi + if test "$ac_cv_sizeof_short" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_long comparison + AC_CHECK_SIZEOF(char_long, 0, [typedef struct { char a; long b; } char_long; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_long` + extent=$ac_cv_sizeof_char_long + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_long`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_long" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_float comparison + AC_CHECK_SIZEOF(char_float, 0, [typedef struct { char a; float b; } char_float; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_float` + extent=$ac_cv_sizeof_char_float + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_float`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_float" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_double comparison + AC_CHECK_SIZEOF(char_double, 0, [typedef struct { char a; double b; } char_double; ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_double` + extent=$ac_cv_sizeof_char_double + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_double`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_double" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_long_double comparison + if test "$have_long_double" = "yes"; then + AC_CHECK_SIZEOF(char_long_double, 0, [ + typedef struct { + char a; + long double b; + } char_long_double; + ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_long_double` + extent=$ac_cv_sizeof_char_long_double + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_long_double`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_long_double" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + fi + + # char_int_char comparison + AC_CHECK_SIZEOF(char_int_char, 0, [ + typedef struct { + char a; + int b; + char c; + } char_int_char; + ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_int + $ac_cv_sizeof_char` + extent=$ac_cv_sizeof_char_int_char + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_int`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "`expr $extent % 4`" != "0" ; then is_four=0 ; fi + if test "$ac_cv_sizeof_int" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # char_short_char comparison + AC_CHECK_SIZEOF(char_short_char, 0, [ + typedef struct { + char a; + short b; + char c; + } char_short_char; + ]) + size=`expr $ac_cv_sizeof_char + $ac_cv_sizeof_short + $ac_cv_sizeof_char` + extent=$ac_cv_sizeof_char_short_char + if test "$size" != "$extent" ; then is_packed=0 ; fi + if test "`expr $extent % $ac_cv_sizeof_short`" != "0" ; then is_largest=0 ; fi + if test "`expr $extent % 2`" != "0" ; then is_two=0 ; fi + if test "$ac_cv_sizeof_short" = "4" -a "`expr $extent % 4`" != "0" ; then + is_four=0 + fi + if test "$ac_cv_sizeof_short" = "8" -a "`expr $extent % 8`" != "0" ; then + is_eight=0 + fi + + # If aligned mod 8, it will be aligned mod 4 + if test $is_eight = 1 ; then is_four=0 ; is_two=0 ; fi + if test $is_four = 1 ; then is_two=0 ; fi + + # Largest supersedes 8 + if test $is_largest = 1 ; then is_eight=0 ; fi + + # Find the alignment + if test "`expr $is_packed + $is_largest + $is_two + $is_four + $is_eight`" = "0" ; then + pac_cv_struct_alignment="unknown" + elif test "`expr $is_packed + $is_largest + $is_two + $is_four + $is_eight`" != "1" ; then + pac_cv_struct_alignment="unknown" + elif test $is_packed = 1 ; then + pac_cv_struct_alignment="packed" + elif test $is_largest = 1 ; then + pac_cv_struct_alignment="largest" + elif test $is_two = 1 ; then + pac_cv_struct_alignment="two" + elif test $is_four = 1 ; then + pac_cv_struct_alignment="four" + elif test $is_eight = 1 ; then + pac_cv_struct_alignment="eight" + fi +]) +dnl +dnl PAC_C_MACRO_VA_ARGS +dnl +dnl will AC_DEFINE([HAVE_MACRO_VA_ARGS]) if the compiler supports C99 variable +dnl length argument lists in macros (#define foo(...) bar(__VA_ARGS__)) +AC_DEFUN([PAC_C_MACRO_VA_ARGS],[ + AC_MSG_CHECKING([for variable argument list macro functionality]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #include + #define conftest_va_arg_macro(...) printf(__VA_ARGS__) + ], + [conftest_va_arg_macro("a test %d", 3);])], + [AC_DEFINE([HAVE_MACRO_VA_ARGS],[1],[Define if C99-style variable argument list macro functionality]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) +])dnl diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_cxx.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_cxx.m4 new file mode 100644 index 0000000000..142dac5c17 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_cxx.m4 @@ -0,0 +1,175 @@ +dnl PAC_PROG_CXX - reprioritize the C++ compiler search order +AC_DEFUN([PAC_PROG_CXX],[ + PAC_PUSH_FLAG([CXXFLAGS]) + AC_PROG_CXX([g++ icpc pgCC xlC pathCC cl]) + PAC_POP_FLAG([CXXFLAGS]) +]) + +dnl This is from crypt.to/autoconf-archive, slightly modified. +dnl It defines bool as int if it is not availalbe +dnl +AC_DEFUN([AC_CXX_BOOL], +[AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type, +ac_cv_cxx_bool, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ +int f(int x){return 1;} +int f(char x){return 1;} +int f(bool x){return 1;} +],[bool b = true; return f(b);], + ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_bool" != yes; then + AC_DEFINE(bool,int,[define if bool is a built-in type]) +fi +]) + +dnl This is from crypt.to/autoconf-archive, slightly modified (name defined) +dnl +AC_DEFUN([AC_CXX_EXCEPTIONS], +[AC_CACHE_CHECK(whether the compiler supports exceptions, +ac_cv_cxx_exceptions, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE(,[try { throw 1; } catch (int i) { return i; }], + ac_cv_cxx_exceptions=yes, ac_cv_cxx_exceptions=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_exceptions" = yes; then + AC_DEFINE(HAVE_CXX_EXCEPTIONS,,[define if the compiler supports exceptions]) +fi +]) + +dnl This is from crypt.to/autoconf-archive +dnl +AC_DEFUN([AC_CXX_NAMESPACES], +[AC_CACHE_CHECK(whether the compiler implements namespaces, +ac_cv_cxx_namespaces, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], + [using namespace Outer::Inner; return i;], + ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_namespaces" = yes; then + AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) +fi +]) + +dnl Some compilers support namespaces but don't know about std +dnl +AC_DEFUN([AC_CXX_NAMESPACE_STD], +[AC_REQUIRE([AC_CXX_NAMESPACES]) +AC_CACHE_CHECK(whether the compiler implements the namespace std, +ac_cv_cxx_namespace_std, +[ac_cv_cxx_namespace_std=no +if test "$ac_cv_cxx_namespaces" = yes ; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ +#include +using namespace std;], + [cout << "message\n";], + ac_cv_cxx_namespace_std=yes, ac_cv_cxx_namespace_std=no) + AC_LANG_RESTORE +fi +]) +if test "$ac_cv_cxx_namespace_std" = yes; then + AC_DEFINE(HAVE_NAMESPACE_STD,,[define if the compiler implements namespace std]) +fi +]) + +dnl/*D +dnl PAC_CXX_CHECK_COMPILER_OPTION - Check that a C++ compiler option is +dnl accepted without warning messages +dnl +dnl Synopsis: +dnl PAC_CXX_CHECK_COMPILER_OPTION(optionname,action-if-ok,action-if-fail) +dnl +dnl Output Effects: +dnl +dnl If no actions are specified, a working value is added to 'CXXOPTIONS' +dnl +dnl Notes: +dnl This is now careful to check that the output is different, since +dnl some compilers are noisy. +dnl +dnl We are extra careful to prototype the functions in case compiler options +dnl that complain about poor code are in effect. +dnl +dnl Because this is a long script, we have ensured that you can pass a +dnl variable containing the option name as the first argument. +dnl D*/ +AC_DEFUN([PAC_CXX_CHECK_COMPILER_OPTION],[ +AC_MSG_CHECKING([whether C++ compiler accepts option $1]) +pac_opt="$1" +AC_LANG_PUSH([C++]) +CXXFLAGS_orig="$CXXFLAGS" +CXXFLAGS_opt="$pac_opt $CXXFLAGS" +pac_result="unknown" + +AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +CXXFLAGS="$CXXFLAGS_orig" +rm -f pac_test1.log +PAC_LINK_IFELSE_LOG([pac_test1.log], [], [ + CXXFLAGS="$CXXFLAGS_opt" + rm -f pac_test2.log + PAC_LINK_IFELSE_LOG([pac_test2.log], [], [ + PAC_RUNLOG_IFELSE([diff -b pac_test1.log pac_test2.log], + [pac_result=yes],[pac_result=no]) + ],[ + pac_result=no + ]) +], [ + pac_result=no +]) +AC_MSG_RESULT([$pac_result]) +dnl Delete the conftest created by AC_LANG_CONFTEST. +rm -f conftest.$ac_ext + +if test "$pac_result" = "yes" ; then + AC_MSG_CHECKING([whether routines compiled with $pac_opt can be linked with ones compiled without $pac_opt]) + pac_result=unknown + CXXFLAGS="$CXXFLAGS_orig" + rm -f pac_test3.log + PAC_COMPILE_IFELSE_LOG([pac_test3.log], [ + AC_LANG_SOURCE([ + int foo(void); + int foo(void){return 0;} + ]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + + CXXFLAGS="$CXXFLAGS_opt" + rm -f pac_test4.log + PAC_LINK_IFELSE_LOG([pac_test4.log], [AC_LANG_PROGRAM()], [ + PAC_RUNLOG_IFELSE([diff -b pac_test2.log pac_test4.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ],[ + pac_result=no + ]) + AC_MSG_RESULT([$pac_result]) + rm -f pac_test3.log pac_test4.log +fi +rm -f pac_test1.log pac_test2.log + +dnl Restore CXXFLAGS before 2nd/3rd argument commands are executed, +dnl as 2nd/3rd argument command could be modifying CXXFLAGS. +CXXFLAGS="$CXXFLAGS_orig" +if test "$pac_result" = "yes" ; then + ifelse([$2],[],[CXXOPTIONS="$CXXOPTIONS $1"],[$2]) +else + ifelse([$3],[],[:],[$3]) +fi +AC_LANG_POP([C++]) +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_f77.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_f77.m4 new file mode 100644 index 0000000000..4a55977618 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_f77.m4 @@ -0,0 +1,1412 @@ +dnl PAC_PROG_F77 - reprioritize the F77 compiler search order +AC_DEFUN([PAC_PROG_F77],[ +PAC_PUSH_FLAG([FFLAGS]) +AC_PROG_F77([ifort pgf77 af77 xlf frt cf77 fort77 fl32 fort ifc efc ftn \ + gfortran f77 g77]) +PAC_POP_FLAG([FFLAGS]) +]) +dnl +dnl/*D +dnl PAC_PROG_F77_NAME_MANGLE - Determine how the Fortran compiler mangles +dnl names +dnl +dnl Synopsis: +dnl PAC_PROG_F77_NAME_MANGLE([action]) +dnl +dnl Output Effect: +dnl If no action is specified, one of the following names is defined: +dnl.vb +dnl If fortran names are mapped: +dnl lower -> lower F77_NAME_LOWER +dnl lower -> lower_ F77_NAME_LOWER_USCORE +dnl lower -> UPPER F77_NAME_UPPER +dnl lower_lower -> lower__ F77_NAME_LOWER_2USCORE +dnl mixed -> mixed F77_NAME_MIXED +dnl mixed -> mixed_ F77_NAME_MIXED_USCORE +dnl mixed -> UPPER@STACK_SIZE F77_NAME_UPPER_STDCALL +dnl.ve +dnl If an action is specified, it is executed instead. +dnl +dnl Notes: +dnl We assume that if lower -> lower (any underscore), upper -> upper with the +dnl same underscore behavior. Previous versions did this by +dnl compiling a Fortran program and running strings -a over it. Depending on +dnl strings is a bad idea, so instead we try compiling and linking with a +dnl C program, since that is why we are doing this anyway. A similar approach +dnl is used by FFTW, though without some of the cases we check (specifically, +dnl mixed name mangling). STD_CALL not only specifies a particular name +dnl mangling convention (adding the size of the calling stack into the function +dnl name, but also the stack management convention (callee cleans the stack, +dnl and arguments are pushed onto the stack from right to left) +dnl +dnl One additional problem is that some Fortran implementations include +dnl references to the runtime (like pgf90_compiled for the pgf90 compiler +dnl used as the "Fortran 77" compiler). This is not yet solved. +dnl +dnl D*/ +dnl +AC_DEFUN([PAC_PROG_F77_NAME_MANGLE],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_CACHE_CHECK([for Fortran 77 name mangling], +pac_cv_prog_f77_name_mangle,[ +# Initialize pac_found to indicate if name mangling scheme has been found +pac_found=no +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine MY_name( ii ) + return + end + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT f77conftest.$OBJEXT]) + saved_LIBS="$LIBS" + dnl FLIBS is set by AC_F77_LIBRARY_LDFLAGS + LIBS="f77conftest.$OBJEXT $FLIBS $LIBS" + AC_LANG_PUSH([C]) + for call in "" __stdcall ; do + for sym in my_name_ my_name__ my_name MY_NAME MY_name MY_name_ NONE ; do + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([extern void ${call} ${sym}(int);],[${sym}(0);]) + ],[ + pac_found=yes + break + ]) + done + test "$pac_found" = "yes" && break + done + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f f77conftest.$OBJEXT +]) +AC_LANG_POP([Fortran 77]) +dnl +# If we got to here and pac_cv_prog_f77_name_mangle is still NOT definable, +# it may be that the programs have to be linked with the Fortran compiler, +# not the C compiler. Try reversing the language used for the test +if test "$pac_found" != "yes" ; then + AC_LANG_PUSH([C]) + for call in "" __stdcall ; do + for sym in my_name_ my_name__ my_name MY_NAME MY_name MY_name_ NONE ; do + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([void ${call} ${sym}(int a) {}]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT cconftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="cconftest.$OBJEXT $LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([],[ call my_name(0)]) + ],[ + pac_found=yes + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + rm -f cconftest.$OBJEXT + test "$pac_found" = "yes" && break + ]) + done + test "$pac_found" = "yes" && break + done + AC_LANG_POP([C]) +fi +if test "$pac_found" = "yes" ; then + case ${sym} in + my_name_) + pac_cv_prog_f77_name_mangle="lower uscore" ;; + my_name__) + pac_cv_prog_f77_name_mangle="lower 2uscore" ;; + my_name) + pac_cv_prog_f77_name_mangle="lower" ;; + MY_NAME) + pac_cv_prog_f77_name_mangle="upper" ;; + MY_name) + pac_cv_prog_f77_name_mangle="mixed" ;; + MY_name_) + pac_cv_prog_f77_name_mangle="mixed uscore" ;; + *) + pac_cv_prog_f77_name_mangle="" + pac_found=no; + ;; + esac + if test "X$pac_cv_prog_f77_name_mangle" != "X" ; then + if test "$call" = "__stdcall" ; then + pac_cv_prog_f77_name_mangle="$pac_cv_prog_f77_name_mangle stdcall" + fi + fi +fi +]) +dnl Endof ac_cache_check +case $pac_cv_prog_f77_name_mangle in + *stdcall) + F77_STDCALL="__stdcall" ;; + *) + F77_STDCALL="" ;; +esac +# Get the standard call definition +# FIXME: This should use F77_STDCALL, not STDCALL (non-conforming name) +F77_STDCALL="$call" +AC_DEFINE_UNQUOTED(STDCALL,[$F77_STDCALL],[Define calling convention]) + +# new_name="`echo $name | tr ' ' '_' | tr [a-z] [A-Z]`" +# We could have done the character conversion with 'tr' +# which may not be portable, e.g. solaris's /usr/ucb/bin/tr. +# So use a conservative approach. + +# Replace blank with underscore +name_scheme="`echo $pac_cv_prog_f77_name_mangle | sed 's% %_%g'`" +# Turn lowercase into uppercase. +name_scheme="`echo $name_scheme | sed -e 'y%abcdefghijklmnopqrstuvwxyz%ABCDEFGHIJKLMNOPQRSTUVWXYZ%'`" +F77_NAME_MANGLE="F77_NAME_${name_scheme}" +AC_DEFINE_UNQUOTED([$F77_NAME_MANGLE]) +AC_SUBST(F77_NAME_MANGLE) +if test "X$pac_cv_prog_f77_name_mangle" = "X" ; then + AC_MSG_WARN([Unknown Fortran naming scheme]) +fi +dnl +dnl Define the macros that is needed by AC_DEFINE_UNQUOTED([$F77_NAME_MANGLE]) +AH_TEMPLATE([F77_NAME_LOWER], + [Fortran names are lowercase with no trailing underscore]) +AH_TEMPLATE([F77_NAME_LOWER_USCORE], + [Fortran names are lowercase with one trailing underscore]) +AH_TEMPLATE([F77_NAME_LOWER_2USCORE], + [Fortran names are lowercase with two trailing underscores]) +AH_TEMPLATE([F77_NAME_MIXED], + [Fortran names preserve the original case]) +AH_TEMPLATE([F77_NAME_MIXED_USCORE], + [Fortran names preserve the original case with one trailing underscore]) +AH_TEMPLATE([F77_NAME_UPPER], + [Fortran names are uppercase]) +AH_TEMPLATE([F77_NAME_LOWER_STDCALL], + [Fortran names are lowercase with no trailing underscore in stdcall]) +AH_TEMPLATE([F77_NAME_LOWER_USCORE_STDCALL], + [Fortran names are lowercase with one trailing underscore in stdcall]) +AH_TEMPLATE([F77_NAME_LOWER_2USCORE_STDCALL], + [Fortran names are lowercase with two trailing underscores in stdcall]) +AH_TEMPLATE([F77_NAME_MIXED_STDCALL], + [Fortran names preserve the original case in stdcall]) +AH_TEMPLATE([F77_NAME_MIXED_USCORE_STDCALL], + [Fortran names preserve the original case with one trailing underscore in stdcall]) +AH_TEMPLATE([F77_NAME_UPPER_STDCALL], + [Fortran names are uppercase in stdcall]) +]) +dnl +dnl/*D +dnl PAC_PROG_F77_CHECK_SIZEOF - Determine the size in bytes of a Fortran +dnl type +dnl +dnl Synopsis: +dnl PAC_PROG_F77_CHECK_SIZEOF(type,[cross-size]) +dnl +dnl Output Effect: +dnl Sets SIZEOF_F77_uctype to the size if bytes of type. +dnl If type is unknown, the size is set to 0. +dnl If cross-compiling, the value cross-size is used (it may be a variable) +dnl For example 'PAC_PROG_F77_CHECK_SIZEOF(real)' defines +dnl 'SIZEOF_F77_REAL' to 4 on most systems. The variable +dnl 'pac_cv_sizeof_f77_' (e.g., 'pac_cv_sizeof_f77_real') is also set to +dnl the size of the type. +dnl If the corresponding variable is already set, that value is used. +dnl If the name has an '*' in it (e.g., 'integer*4'), the defined name +dnl replaces that with an underscore (e.g., 'SIZEOF_F77_INTEGER_4'). +dnl +dnl Notes: +dnl If the 'cross-size' argument is not given, 'autoconf' will issue an error +dnl message. You can use '0' to specify undetermined. +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_F77_CHECK_SIZEOF],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +changequote(<<, >>)dnl +dnl The name to #define. +dnl dnl If the arg value contains a variable, we need to update that +define(<>, translit(sizeof_f77_$1, [a-z *], [A-Z__]))dnl +dnl The cache variable name. +define(<>, translit(pac_cv_f77_sizeof_$1, [ *], [__]))dnl +changequote([, ])dnl +AC_CACHE_CHECK([for size of Fortran type $1],PAC_CV_NAME,[ +AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE]) +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine isize() + $1 i(2) + call cisize( i(1), i(2) ) + end + ]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $LIBS" + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif +#ifdef F77_NAME_UPPER +#define cisize_ CISIZE +#define isize_ ISIZE +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define cisize_ cisize +#define isize_ isize +#endif +static int isize_val=0; +void cisize_(char *,char*); +void isize_(void); +void cisize_(char *i1p, char *i2p) +{ + isize_val = (int)(i2p - i1p); +} + ],[ + FILE *f = fopen("conftestval", "w"); + if (!f) return 1; + isize_(); + fprintf(f,"%d\n", isize_val); + ]) + dnl Endof ac_lang_program + ],[ + eval PAC_CV_NAME=`cat conftestval` + ],[ + eval PAC_CV_NAME=0 + ],[ + # Use -9999 as value to emit a warning message after the cache_check. + ifelse([$2],[],[eval PAC_CV_NAME=-9999],[eval PAC_CV_NAME=$2]) + ]) + dnl Endof ac_run_ifelse + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + # remove previously generated object file. + rm -f pac_f77conftest.$OBJEXT +],[ + # pac_f77compile_ok=no + ifelse([$2],,eval PAC_CV_NAME=0,eval PAC_CV_NAME=$2) +]) Endof ac_compile_ifelse +AC_LANG_POP([Fortran 77]) +]) +dnl Endof ac_cache_check +if test "$PAC_CV_NAME" = "-9999" ; then + AC_MSG_WARN([No value provided for size of $1 when cross-compiling]) +fi +AC_DEFINE_UNQUOTED(PAC_TYPE_NAME,$PAC_CV_NAME,[Define size of PAC_TYPE_NAME]) +undefine([PAC_TYPE_NAME]) +undefine([PAC_CV_NAME]) +]) +dnl +dnl This version uses a Fortran program to link programs. +dnl This is necessary because some compilers provide shared libraries +dnl that are not within the default linker paths (e.g., our installation +dnl of the Portland Group compilers) +dnl +AC_DEFUN([PAC_PROG_F77_CHECK_SIZEOF_EXT],[ +changequote(<<,>>)dnl +dnl The name to #define. +dnl If the arg value contains a variable, we need to update that +define(<>, translit(sizeof_f77_$1, [a-z *], [A-Z__]))dnl +dnl The cache variable name. +define(<>, translit(pac_cv_f77_sizeof_$1, [ *], [__]))dnl +changequote([,])dnl +AC_CACHE_CHECK([for size of Fortran type $1],PAC_CV_NAME,[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE]) +dnl if test "$cross_compiling" = yes ; then +dnl ifelse([$2],[], +dnl [AC_MSG_WARN([No value provided for size of $1 when cross-compiling])], +dnl [eval PAC_CV_NAME=$2]) +dnl fi +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif +#ifdef F77_NAME_UPPER +#define cisize_ CISIZE +#define isize_ ISIZE +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define cisize_ cisize +#define isize_ isize +#endif +int cisize_(char *,char*); +int cisize_(char *i1p, char *i2p) { + int isize_val=0; + FILE *f = fopen("conftestval", "w"); + if (!f) return 1; + isize_val = (int)(i2p - i1p); + fprintf(f,"%d\n", isize_val); + fclose(f); + return 0; +} + ]) + dnl Endof ac_lang_source +],[ + # pac_compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + # Save LIBS and prepend object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ + program main + $1 a(2) + integer irc + irc = cisize(a(1),a(2)) + end + ]) + ],[ + eval PAC_CV_NAME=`cat conftestval` + ],[ + eval PAC_CV_NAME=0 + ],[ + # Use -9999 as value to emit a warning message after the cache_check. + ifelse([$2],[],[eval PAC_CV_NAME=-9999],[eval PAC_CV_NAME=$2]) + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + # remove previously generated object file. + rm -f pac_conftest.$OBJEXT +],[ + AC_MSG_WARN([Unable to compile the C routine for finding the size of a $1]) +]) +AC_LANG_POP([C]) +]) +dnl Endof ac_cache_check +if test "$PAC_CV_NAME" = "-9999" ; then + AC_MSG_WARN([No value provided for size of $1 when cross-compiling]) +fi +AC_DEFINE_UNQUOTED(PAC_TYPE_NAME,$PAC_CV_NAME,[Define size of PAC_TYPE_NAME]) +undefine([PAC_TYPE_NAME]) +undefine([PAC_CV_NAME]) +]) +dnl +dnl/*D +dnl PAC_PROG_F77_EXCLAIM_COMMENTS +dnl +dnl Synopsis: +dnl PAC_PROG_F77_EXCLAIM_COMMENTS([action-if-true],[action-if-false]) +dnl +dnl Notes: +dnl Check whether '!' may be used to begin comments in Fortran. +dnl +dnl This macro requires a version of autoconf `after` 2.13; the 'acgeneral.m4' +dnl file contains an error in the handling of Fortran programs in +dnl 'AC_TRY_COMPILE' (fixed in our local version). +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_F77_EXCLAIM_COMMENTS],[ +AC_CACHE_CHECK([whether Fortran 77 accepts ! for comments], +pac_cv_prog_f77_exclaim_comments,[ +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([],[! This is a comment]) +],[ + pac_cv_prog_f77_exclaim_comments="yes" +],[ + pac_cv_prog_f77_exclaim_comments="no" +]) +AC_LANG_POP([Fortran 77]) +]) +if test "$pac_cv_prog_f77_exclaim_comments" = "yes" ; then + ifelse([$1],[],[:],[$1]) +else + ifelse([$2],[],[:],[$2]) +fi +])dnl +dnl +dnl/*D +dnl PAC_F77_CHECK_COMPILER_OPTION - Check that a F77 compiler option is +dnl accepted without warning messages +dnl +dnl Synopsis: +dnl PAC_F77_CHECK_COMPILER_OPTION(optionname,action-if-ok,action-if-fail) +dnl +dnl Output Effects: +dnl +dnl If no actions are specified, a working value is added to 'FOPTIONS' +dnl +dnl Notes: +dnl This is now careful to check that the output is different, since +dnl some compilers are noisy. +dnl +dnl We are extra careful to prototype the functions in case compiler options +dnl that complain about poor code are in effect. +dnl +dnl Because this is a long script, we have ensured that you can pass a +dnl variable containing the option name as the first argument. +dnl D*/ +AC_DEFUN([PAC_F77_CHECK_COMPILER_OPTION],[ +AC_MSG_CHECKING([whether Fortran 77 compiler accepts option $1]) +pac_opt="$1" +AC_LANG_PUSH([Fortran 77]) +FFLAGS_orig="$FFLAGS" +FFLAGS_opt="$pac_opt $FFLAGS" +pac_result="unknown" + +AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +FFLAGS="$FFLAGS_orig" +rm -f pac_test1.log +PAC_LINK_IFELSE_LOG([pac_test1.log], [], [ + FFLAGS="$FFLAGS_opt" + rm -f pac_test2.log + PAC_LINK_IFELSE_LOG([pac_test2.log], [], [ + PAC_RUNLOG_IFELSE([diff -b pac_test1.log pac_test2.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) +], [ + pac_result=no +]) +AC_MSG_RESULT([$pac_result]) +dnl Delete the conftest created by AC_LANG_CONFTEST. +rm -f conftest.$ac_ext +# +if test "$pac_result" = "yes" ; then + AC_MSG_CHECKING([whether routines compiled with $pac_opt can be linked with ones compiled without $pac_opt]) + pac_result=unknown + FFLAGS="$FFLAGS_orig" + rm -f pac_test3.log + PAC_COMPILE_IFELSE_LOG([pac_test3.log], [ + AC_LANG_SOURCE([ + subroutine try() + end + ]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + + FFLAGS="$FFLAGS_opt" + rm -f pac_test4.log + PAC_LINK_IFELSE_LOG([pac_test4.log], [AC_LANG_PROGRAM()], [ + PAC_RUNLOG_IFELSE([diff -b pac_test2.log pac_test4.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ],[ + pac_result=no + ]) + AC_MSG_RESULT([$pac_result]) + rm -f pac_test3.log pac_test4.log +fi +rm -f pac_test1.log pac_test2.log + +dnl Restore FFLAGS before 2nd/3rd argument commands are executed, +dnl as 2nd/3rd argument command could be modifying FFLAGS. +FFLAGS="$FFLAGS_orig" +if test "$pac_result" = "yes" ; then + ifelse([$2],[],[FOPTIONS="$FOPTIONS $1"],[$2]) +else + ifelse([$3],[],[:],[$3]) +fi +AC_LANG_POP([Fortran 77]) +]) +dnl +dnl/*D +dnl PAC_PROG_F77_LIBRARY_DIR_FLAG - Determine the flag used to indicate +dnl the directories to find libraries in +dnl +dnl Notes: +dnl Many compilers accept '-Ldir' just like most C compilers. +dnl Unfortunately, some (such as some HPUX Fortran compilers) do not, +dnl and require instead either '-Wl,-L,dir' or something else. This +dnl command attempts to determine what is accepted. The flag is +dnl placed into 'F77_LIBDIR_LEADER'. +dnl +dnl D*/ +dnl +dnl An earlier version of this only tried the arguments without using +dnl a library. This failed when the HP compiler complained about the +dnl arguments, but produced an executable anyway. +AC_DEFUN([PAC_PROG_F77_LIBRARY_DIR_FLAG],[ +AC_CACHE_CHECK([for Fortran 77 flag for library directories], +pac_cv_prog_f77_library_dir_flag,[ +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine f1conf + end + ]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + PAC_RUNLOG([test -d conftestdir || mkdir conftestdir]) + PAC_RUNLOG([${AR-ar} ${AR_FLAGS-cr} conftestdir/libf77conftest.a pac_f77conftest.$OBJEXT]) + PAC_RUNLOG([${RANLIB-ranlib} conftestdir/libf77conftest.a]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="-lf77conftest $LIBS" + saved_LDFLAGS="$LDFLAGS" + pac_cv_prog_f77_library_dir_flag="none" + for ldir in "-L" "-Wl,-L," ; do + LDFLAGS="${ldir}conftestdir $saved_LDFLAGS" + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + call f1conf + end + ]) + ],[pac_cv_prog_f77_library_dir_flag="$ldir";break]) + done + LDFLAGS="$saved_LDFLAGS" + LIBS="$saved_LIBS" + rm -rf conftestdir + rm -f pac_f77conftest.$OBJEXT +],[]) +AC_LANG_POP([Fortran 77]) +]) +dnl Endof ac_cache_check +if test "X$pac_cv_prog_f77_library_dir_flag" != "Xnone" ; then + F77_LIBDIR_LEADER="$pac_cv_prog_f77_library_dir_flag" + AC_SUBST(F77_LIBDIR_LEADER) +fi +]) +dnl +dnl/*D +dnl PAC_PROG_F77_HAS_INCDIR - Check whether Fortran accepts -Idir flag +dnl +dnl Syntax: +dnl PAC_PROG_F77_HAS_INCDIR(directory,action-if-true,action-if-false) +dnl +dnl Output Effect: +dnl Sets 'F77_INCDIR' to the flag used to choose the directory. +dnl +dnl Notes: +dnl This refers to the handling of the common Fortran include extension, +dnl not to the use of '#include' with the C preprocessor. +dnl If directory does not exist, it will be created. In that case, the +dnl directory should be a direct descendant of the current directory. +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_F77_HAS_INCDIR],[ +ifelse([$1],[],[checkdir=f77tmpdir],[checkdir=$1;checkdir_is_given=yes]) +AC_CACHE_CHECK([for include directory flag for Fortran], +pac_cv_prog_f77_has_incdir,[ +test -d $checkdir || mkdir $checkdir +dnl PAC_RUNLOG([echo ' call sub()' > $checkdir/conftestf.h]) +echo ' call sub()' > $checkdir/conftestf.h +AC_LANG_PUSH([Fortran 77]) +saved_FFLAGS="$FFLAGS" +pac_cv_prog_f77_has_incdir="none" +# SGI wants -Wf,-I +for idir in "-I" "-Wf,-I" ; do + FFLAGS="${idir} $checkdir $saved_FFLAGS" + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + program main + include 'conftestf.h' + end + ]) + ],[pac_cv_prog_f77_has_incdir="$idir"; break]) +done +FFLAGS="$saved_FFLAGS" +AC_LANG_POP([Fortran 77]) +if test "$checkdir_is_given" = "yes" ; then + rm -f $checkdir/conftestf.h +else + rm -rf $checkdir +fi +]) +dnl Endof ac_cache_check +if test "X$pac_cv_prog_f77_has_incdir" != "Xnone" ; then + F77_INCDIR="$pac_cv_prog_f77_has_incdir" + AC_SUBST(F77_INCDIR) +fi +]) +dnl +dnl/*D +dnl PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS - Check whether the Fortran compiler +dnl allows unused and undefined functions to be listed in an external +dnl statement +dnl +dnl Syntax: +dnl PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS(action-if-true,action-if-false) +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS],[ +AC_CACHE_CHECK([whether Fortran allows unused externals], +pac_cv_prog_f77_allows_unused_externals,[ +AC_LANG_PUSH([Fortran 77]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + external bar + end + ]) +],[ + pac_cv_prog_f77_allows_unused_externals="yes" +],[ + pac_cv_prog_f77_allows_unused_externals="no" +]) +AC_LANG_POP([Fortran 77]) +]) +dnl Endof ac_cache_check +if test "X$pac_cv_prog_f77_allows_unused_externals" = "Xyes" ; then + ifelse([$1],[],[:],[$1]) +else + ifelse([$2],[],[:],[$2]) +fi +]) +dnl PAC_PROG_F77_RUN_PROC_FROM_C( c main program, fortran routine, +dnl [action-if-works], [action-if-fails], +dnl [cross-action] ) +dnl Fortran routine MUST be named ftest unless you include code +dnl to select the appropriate Fortran name. +dnl +AC_DEFUN([PAC_PROG_F77_RUN_PROC_FROM_C],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([$2]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $LIBS" + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif +#ifdef F77_NAME_UPPER +#define ftest_ FTEST +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define ftest_ ftest +#endif +$1 + ]) + ],[ + ifelse([$3],[],[:],[$3]) + ],[ + ifelse([$4],[],[:],[$4]) + ],[ + ifelse([$5],[],[:],[$5]) + ]) + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f pac_f77conftest.$OBJEXT +],[ +]) +AC_LANG_POP([Fortran 77]) +]) +dnl PAC_PROG_F77_IN_C_LIBS +dnl +dnl Find the essential libraries that are needed to use the C linker to +dnl create a program that includes a trival Fortran code. +dnl +dnl For example, all pgf90 compiled objects include a reference to the +dnl symbol pgf90_compiled, found in libpgf90 . +dnl +dnl There is an additional problem. To *run* programs, we may need +dnl additional arguments; e.g., if shared libraries are used. Even +dnl with autoconf 2.52, the autoconf macro to find the library arguments +dnl doesn't handle this, either by detecting the use of -rpath or +dnl by trying to *run* a trivial program. It only checks for *linking*. +dnl +dnl +AC_DEFUN([PAC_PROG_F77_IN_C_LIBS],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([for which Fortran libraries are needed to link C with Fortran]) +F77_IN_C_LIBS="invalid" +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine ftest + end + ]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $saved_LIBS" + AC_LANG_PUSH([C]) + + # Create conftest for all link tests. + AC_LANG_CONFTEST([ + AC_LANG_PROGRAM([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif + ],[ +#ifdef F77_NAME_UPPER +#define ftest_ FTEST +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define ftest_ ftest +#endif +extern void ftest_(void); +ftest_(); + ]) + ]) + + F77_IN_C_LIBS="" + AC_LINK_IFELSE([],[:],[ + flibdirs=`echo $FLIBS | tr ' ' '\012' | grep '\-L' | tr '\012' ' '` + fliblibs=`echo $FLIBS | tr ' ' '\012' | grep -v '\-L' | tr '\012' ' '` + for flibs in $fliblibs ; do + LIBS="pac_f77conftest.$OBJEXT $flibdirs $flibs $saved_LIBS" + AC_LINK_IFELSE([],[F77_IN_C_LIBS="$flibdirs $flibs"; break]) + done + if test "X$F77_IN_C_LIBS" = "X" ; then + flibscat="" + for flibs in $fliblibs ; do + flibscat="$flibscat $flibs" + LIBS="pac_f77conftest.$OBJEXT $flibdirs $flibscat $saved_LIBS" + AC_LINK_IFELSE([],[F77_IN_C_LIBS="$flibdirs $flibscat";break]) + done + fi + ]) + + # remove conftest created by ac_lang_conftest + rm -f conftest.$ac_ext + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f pac_f77conftest.$OBJEXT +]) +AC_LANG_POP([Fortran 77]) +if test "X$F77_IN_C_LIBS" = "X" ; then + AC_MSG_RESULT(none) +else + AC_MSG_RESULT($F77_IN_C_LIBS) +fi +]) +dnl +dnl Test to see if we should use C or Fortran to link programs whose +dnl main program is in Fortran. We may find that neither work because +dnl we need special libraries in each case. +dnl +AC_DEFUN([PAC_PROG_F77_LINKER_WITH_C],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([for linker for Fortran main program]) +dnl Create a C program that uses multiplication and division +dnl in case that requires special libraries +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([],[long long a;]) +],[ + AC_DEFINE(HAVE_LONG_LONG,1,[Define if long long allowed]) +]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ +#ifdef HAVE_LONG_LONG +int f(int a, long long b) { int c; c = a * ( b / 3 ) / (b-1); return c ; } +#else +int f(int a, long b) { int c; c = a * b / (b-1); return c ; } +#endif + ]) +]) +AC_LANG_POP([C]) + +dnl Create a Fortran program for test +AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main + double precision d + print *, "hi" + end + ]) +]) +AC_LANG_POP([Fortran 77]) + +dnl Initialize flags +pac_linkwithf77=no +pac_linkwithC=no + +dnl Use F77 as a linker to compile a Fortran main and C subprogram. +if test "$pac_linkwithC" != "yes" ; then + AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $saved_LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_LINK_IFELSE([],[ + AC_MSG_RESULT([Use Fortran to link programs]) + pac_linkwithf77=yes + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ]) + AC_LANG_POP([C]) +fi + +dnl Use C as a linker and FLIBS to compile a Fortran main and C subprogram. +if test "$pac_linkwithf77" != "yes" ; then + AC_LANG_PUSH([Fortran 77]) + AC_COMPILE_IFELSE([],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $saved_LIBS" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([],[ + pac_linkwithC=yes + AC_MSG_RESULT([Use C with FLIBS to link programs]) + F77LINKER="$CC" + F77_LDFLAGS="$F77_LDFLAGS $FLIBS" + ]) + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f pac_f77conftest.$OBJEXT + ]) + AC_LANG_POP([Fortran 77]) +fi + +AC_LANG_PUSH([Fortran 77]) +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran 77]) + +AC_LANG_PUSH([C]) +rm -f conftest.$ac_ext +AC_LANG_POP([C]) + +if test "$pac_linkwithf77" != "yes" -a "$pac_linkwithC" != "yes" ; then + AC_MSG_ERROR([Could not determine a way to link a Fortran test program!]) +fi +]) +dnl +dnl Check to see if a C program can be linked when using the libraries +dnl needed by C programs +dnl +AC_DEFUN([PAC_PROG_F77_CHECK_FLIBS],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([whether $CC links with FLIBS found by autoconf]) +AC_LANG_PUSH([C]) +# Create a simple C program for the tests. +AC_LANG_CONFTEST([ + AC_LANG_PROGRAM([],[int a;]) +]) +# Try to link a C program with all of these libraries +saved_LIBS="$LIBS" +LIBS="$FLIBS $saved_LIBS" +AC_LINK_IFELSE([],[ + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) + AC_MSG_CHECKING([for which libraries can be used]) + pac_ldirs="" + pac_libs="" + pac_other="" + for name in $FLIBS ; do + case $name in + -l*) pac_libs="$pac_libs $name" ;; + -L*) pac_ldirs="$pac_ldirs $name" ;; + *) pac_other="$pac_other $name" ;; + esac + done + keep_libs="" + for name in $pac_libs ; do + LIBS="$saved_LIBS $pac_ldirs $pac_other $name" + AC_LINK_IFELSE([],[ + keep_libs="$keep_libs $name" + ]) + done + AC_MSG_RESULT($keep_libs) + FLIBS="$pac_ldirs $pac_other $keep_libs" +]) +LIBS="$saved_LIBS" +rm -f conftest.$ac_ext +AC_LANG_PUSH([C]) +]) +dnl +dnl Test for extra libraries needed when linking C routines that use +dnl stdio with Fortran. This test was created for OSX, which +dnl sometimes requires -lSystemStubs. If another library is needed, +dnl add it to F77_OTHER_LIBS +dnl +AC_DEFUN([PAC_PROG_F77_AND_C_STDIO_LIBS],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE]) +# To simply the code in the cache_check macro, chose the routine name +# first, in case we need it +confname=conf1_ +case "$pac_cv_prog_f77_name_mangle" in + "lower underscore") confname=conf1_ ;; + "upper stdcall") confname=CONF1 ;; + "upper") confname=CONF1 ;; + "lower doubleunderscore") confname=conf1_ ;; + "lower") confname=conf1 ;; + "mixed underscore") confname=conf1_ ;; + "mixed") confname=conf1 ;; +esac + +AC_CACHE_CHECK([for libraries to link Fortran main with C stdio routines], +pac_cv_prog_f77_and_c_stdio_libs,[ +pac_cv_prog_f77_and_c_stdio_libs=unknown +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif +int $confname(int a) { + printf( "The answer is %d\n", a ); fflush(stdout); return 0; +} + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main + call conf1(0) + end + ]) + ]) + for extralib in "" "-lSystemStubs" ; do + LIBS="pac_conftest.$OBJEXT $saved_LIBS $extralib" + AC_LINK_IFELSE([],[ + pac_cv_prog_f77_and_c_stdio_libs="$extralib"; break + ]) + done + if test "X$pac_cv_prog_f77_and_c_stdio_libs" = "X" ; then + pac_cv_prog_f77_and_c_stdio_libs=none + fi + rm -f conftest.$ac_ext + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT +]) +AC_LANG_POP([C]) +]) +dnl Endof ac_cache_check +if test "$pac_cv_prog_f77_and_c_stdio_libs" != "none" \ + -a "$pac_cv_prog_f77_and_c_stdio_libs" != "unknown" ; then + F77_OTHER_LIBS="$F77_OTHER_LIBS $pac_cv_prog_f77_and_c_stdio_libs" +fi +]) +dnl +dnl Check that the FLIBS determined by AC_F77_LIBRARY_LDFLAGS is valid. +dnl That macro (at least as of autoconf 2.59) attempted to parse the output +dnl of the compiler when asked to be verbose; in the case of the Fujitsu +dnl frt Fortran compiler, it included files that frt looked for and then +dnl discarded because they did not exist. +dnl +AC_DEFUN([PAC_PROG_F77_FLIBS_VALID],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([whether $F77 accepts the FLIBS found by autoconf]) +pac_cv_f77_flibs_valid=unknown +AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main + end + ]) +]) +AC_LINK_IFELSE([],[ + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) + AC_MSG_CHECKING([for valid entries in FLIBS]) + goodFLIBS="" + saveFLIBS=$FLIBS + FLIBS="" + for arg in $saveFLIBS ; do + FLIBS="$goodFLIBS $arg" + AC_LINK_IFELSE([],[goodFLIBS=$FLIBS]) + done + FLIBS=$goodFLIBS + AC_MSG_RESULT($FLIBS) +]) +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran 77]) +]) +dnl +dnl Check if the Fortran 77 and C objects are compatible in linking. +dnl e.g. On some intel x86_64 Mac, Fortran compiler's default binary format +dnl is different from C, so either -m64 or -m32 is needed in either CFLAGS +dnl or FFLAGS. +dnl +AC_DEFUN([PAC_PROG_F77_OBJ_LINKS_WITH_C],[ +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_MSG_CHECKING([whether Fortran 77 and C objects are compatible]) +AC_LANG_PUSH([C]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ +/* lower */ +void c_subpgm( int *rc ); +void c_subpgm( int *rc ) { *rc = 1; } + +/* lower underscore */ +void c_subpgm_( int *rc ); +void c_subpgm_( int *rc ) { *rc = 2; } + +/* upper */ +void C_SUBPGM( int *rc ); +void C_SUBPGM( int *rc ) { *rc = 3; } + +/* lower doubleunderscore */ +void c_subpgm__( int *rc ); +void c_subpgm__( int *rc ) { *rc = 4; } + +/* mixed */ +void C_subpgm( int *rc ); +void C_subpgm( int *rc ) { *rc = 5; } + +/* mixed underscore */ +void C_subpgm_( int *rc ); +void C_subpgm_( int *rc ) { *rc = 6; } + ]) +]) +AC_LANG_POP([C]) + +AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program test + integer rc + rc = -1 + call c_subpgm( rc ) + write(6,*) "rc=", rc + end + ]) +]) +AC_LANG_POP([Fortran 77]) + +dnl Initialize flags +pac_linkwithf77=no +pac_linkwithC=no + +dnl Use F77 as a linker to compile a Fortran main and C subprogram. +if test "$pac_linkwithC" != "yes" ; then + AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $saved_LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_LINK_IFELSE([],[ + pac_linkwithf77=yes + AC_MSG_RESULT([yes]) + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + if test "$pac_linkwithf77" = "yes" ; then + rm -f pac_conftest.$OBJEXT + fi + ]) + AC_LANG_POP([C]) +fi + +dnl Use C as a linker and FLIBS to compile a Fortran main and C subprogram. +if test "$pac_linkwithf77" != "yes" ; then + AC_LANG_PUSH([Fortran 77]) + AC_COMPILE_IFELSE([],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $FLIBS $saved_LIBS" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([],[ + pac_linkwithC=yes + AC_MSG_RESULT([yes]) + ]) + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + if test "$pac_linkwithC" = "yes" ; then + rm -f pac_f77conftest.$OBJEXT + fi + ]) + AC_LANG_POP([Fortran 77]) +fi + +AC_LANG_PUSH([Fortran 77]) +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran 77]) + +AC_LANG_PUSH([C]) +rm -f conftest.$ac_ext +AC_LANG_POP([C]) + +if test "$pac_linkwithf77" != "yes" -a "$pac_linkwithC" != "yes" ; then + AC_MSG_RESULT(no) + AC_CHECK_PROG(FILE, file, file, []) + if test "X$FILE" != "X" ; then + fobjtype="`${FILE} pac_f77conftest.$OBJEXT | sed -e \"s|pac_f77conftest\.$OBJEXT||g\"`" + cobjtype="`${FILE} pac_conftest.$OBJEXT | sed -e \"s|pac_conftest\.$OBJEXT||g\"`" + if test "$fobjtype" != "$cobjtype" ; then + AC_MSG_ERROR([**** Incompatible Fortran and C Object File Types! **** +F77 Object File Type produced by \"${F77} ${FFLAGS}\" is : ${fobjtype}. + C Object File Type produced by \"${CC} ${CFLAGS}\" is : ${cobjtype}.]) + fi + fi +fi +]) +dnl +dnl /*D +dnl PAC_F77_WORKS_WITH_CPP +dnl +dnl Checks if Fortran 77 compiler works with C preprocessor +dnl +dnl Most systems allow the Fortran compiler to process .F and .F90 files +dnl using the C preprocessor. However, some systems either do not +dnl allow this or have serious bugs (OSF Fortran compilers have a bug +dnl that generates an error message from cpp). The following test +dnl checks to see if .F works, and if not, whether "cpp -P -C" can be used +dnl D*/ +AC_DEFUN([PAC_F77_WORKS_WITH_CPP],[ +AC_REQUIRE([AC_PROG_CPP]) +AC_MSG_CHECKING([whether Fortran 77 compiler processes .F files with C preprocessor]) +AC_LANG_PUSH([Fortran 77]) +saved_f77_ext=${ac_ext} +ac_ext="F" +saved_FFLAGS="$FFLAGS" +FFLAGS="$FFLAGS $CPPFLAGS" +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main +#define ASIZE 10 + integer a(ASIZE) + end + ]) +]) +AC_COMPILE_IFELSE([],[ + pac_cv_f77_accepts_F=yes + ifelse([$1],[],[],[$1=""]) +],[ + pac_cv_f77_accepts_F=no + ifelse([$1],[],[:],[$1="false"]) +]) +# Restore Fortran 77's ac_ext but not FFLAGS +ac_ext="$saved_f77_ext" + +if test "$pac_cv_f77_accepts_F" != "yes" ; then + pac_cpp_f77="$ac_cpp -C -P conftest.F > conftest.$ac_ext" + PAC_RUNLOG_IFELSE([$pac_cpp_f77],[ + if test -s conftest.${ac_ext} ; then + AC_COMPILE_IFELSE([],[ + pac_cv_f77_accepts_F="no, use cpp" + ifelse([$1],[],[],[$1="$CPP -C -P"]) + ],[]) + rm -f conftest.${ac_ext} + fi + ],[]) +fi +FFLAGS="$saved_FFLAGS" +rm -f conftest.F +AC_LANG_POP([Fortran 77]) +AC_MSG_RESULT([$pac_cv_f77_accepts_F]) +]) +dnl +dnl /*D +dnl PAC_PROG_F77_CRAY_POINTER - Check if Fortran 77 supports Cray-style pointer. +dnl If so, set pac_cv_prog_f77_has_pointer to yes +dnl and find out if any extra compiler flag is +dnl needed and set it as CRAYPTR_FFLAGS. +dnl i.e. CRAYPTR_FFLAGS is meaningful only if +dnl pac_cv_prog_f77_has_pointer = yes. +dnl +dnl Synopsis: +dnl PAC_PROG_F77_CRAY_POINTER([action-if-true],[action-if-false]) +dnl D*/ +AC_DEFUN([PAC_PROG_F77_CRAY_POINTER],[ +AC_CACHE_CHECK([whether Fortran 77 supports Cray-style pointer], +pac_cv_prog_f77_has_pointer,[ +AC_LANG_PUSH([Fortran 77]) +AC_LANG_CONFTEST([ + AC_LANG_PROGRAM([],[ + integer M + pointer (MPTR,M) + data MPTR/0/ + ]) +]) +saved_FFLAGS="$FFLAGS" +pac_cv_prog_f77_has_pointer=no +CRAYPTR_FFLAGS="" +for ptrflag in '' '-fcray-pointer' ; do + FFLAGS="$saved_FFLAGS $ptrflag" + AC_COMPILE_IFELSE([], [ + pac_cv_prog_f77_has_pointer=yes + CRAYPTR_FFLAGS="$ptrflag" + break + ]) +done +dnl Restore FFLAGS first, since user may not want to modify FFLAGS +FFLAGS="$saved_FFLAGS" +dnl remove conftest after ac_lang_conftest +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran 77]) +]) +if test "$pac_cv_prog_f77_has_pointer" = "yes" ; then + AC_MSG_CHECKING([for Fortran 77 compiler flag for Cray-style pointer]) + if test "X$CRAYPTR_FFLAGS" != "X" ; then + AC_MSG_RESULT([$CRAYPTR_FFLAGS]) + else + AC_MSG_RESULT([none]) + fi + ifelse([$1],[],[:],[$1]) +else + ifelse([$2],[],[:],[$2]) +fi +]) +dnl +dnl +dnl PAC_F77_INIT_WORKS_WITH_C +dnl +AC_DEFUN(PAC_F77_INIT_WORKS_WITH_C,[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_MSG_CHECKING([whether Fortran init will work with C]) +pac_f_init_works_with_c=unknown +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine minit() + common /m1/ vc, vc2 + character*1 vc(1,1), vc2(1) + common /m2/ vd + integer vd + save /m1/, /m2/ + call minitc( vc, vc2, vd ) + end + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + saved_LIBS="$LIBS" + # This test checks if Fortran init can be done in pure C environment, + # i.e. no FLIBS in linking, so don't put FLIBS in LIBS below + dnl LIBS="pac_f77conftest.$OBJEXT $FLIBS $LIBS" + LIBS="pac_f77conftest.$OBJEXT $LIBS" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif +#ifdef F77_NAME_UPPER +#define minit_ MINIT +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define minit_ minit +#endif +extern void minit_(void); +int main( int argc, char **argv ) +{ + minit_(); + return 0; +} +char *v1 = 0; +char *vc2 = 0; +int v2 = 0; +void minitc_( char *dv1, int d, char *dv2, int d2, int dv3 ); +void minitc_( char *dv1, int d, char *dv2, int d2, int dv3 ) +{ +v1 = dv1; +v2 = dv3; +vc2 = dv2; +*vc2 = ' '; +} + ]) + ],[pac_f_init_works_with_c=yes],[pac_f_init_works_with_c=no]) + AC_LANG_POP([C]) + LIBS="$saved_LIBS" + rm -f pac_f77conftest.$OBJEXT +]) +AC_LANG_POP([Fortran 77]) +AC_MSG_RESULT([$pac_f_init_works_with_c]) +]) +dnl +dnl PAC_F77_LOGICALS_IN_C(MPI_FINT) +dnl +dnl where MPI_FINT is the C type for Fortran integer. +dnl +dnl Use a Fortran main program. This simplifies some steps, +dnl since getting all of the Fortran libraries (including shared +dnl libraries that are not in the default library search path) can +dnl be tricky. Specifically, The PROG_F77_RUN_PROC_FROM_C failed with +dnl some installations of the Portland group compiler. +dnl +dnl We'd also like to check other values for .TRUE. and .FALSE. to see +dnl if the compiler allows (or uses) more than one value (some DEC compilers, +dnl for example, used the high (sign) bit to indicate true and false; the +dnl rest of the bits were ignored. For now, we'll assume that there are +dnl unique true and false values. +dnl +AC_DEFUN([PAC_F77_LOGICALS_IN_C],[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE]) +pac_mpi_fint="$1" +AC_MSG_CHECKING([for values of Fortran logicals]) +AC_CACHE_VAL(pac_cv_prog_f77_true_false_value,[ +pac_cv_prog_f77_true_false_value="" +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif +#if defined(HAVE_STDLIB_H) || defined(STDC_HEADERS) +#include +#endif +#ifdef F77_NAME_UPPER +#define ftest_ FTEST +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define ftest_ ftest +#endif +void ftest_( $pac_mpi_fint *, $pac_mpi_fint *); +void ftest_( $pac_mpi_fint *itrue, $pac_mpi_fint *ifalse ) +{ + FILE *f = fopen("conftestval","w"); + if (!f) exit(1); + fprintf( f, "%d %d\n", *itrue, *ifalse ); + fclose(f); +} + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $saved_LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ + program main + logical itrue, ifalse + itrue = .TRUE. + ifalse = .FALSE. + call ftest( itrue, ifalse ) + end + ]) + ],[ + pac_cv_prog_f77_true_false_value="`cat conftestval`" + ],[ + AC_MSG_WARN([Failed to build/run program to determine Fortran logical values.]) + ],[ + # Cross-Compiling. Allow the user to set the values + if test -n "$CROSS_F77_TRUE_VALUE" -a -n "$CROSS_F77_FALSE_VALUE" ; then + pac_cv_prog_f77_true_false_value="$CROSS_F77_TRUE_VALUE $CROSS_F77_FALSE_VALUE" + else + AC_MSG_WARN([Either CROSS_F77_TRUE_VALUE="$CROSS_F77_TRUE_VALUE" or CROSS_F77_FALSE_VALUE="$CROSS_F77_FALSE_VALUE" is not set.]) + fi + ]) + AC_LANG_POP([Fortran 77]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT +]) +AC_LANG_POP([C]) +]) +dnl Endof ac_cache_val +if test "X$pac_cv_prog_f77_true_false_value" != "X" ; then + true_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/ .*//g'`" + false_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/.* *//g'`" + if test -n "$true_val" -a -n "$false_val" ; then + AC_MSG_RESULT([True is $true_val and False is $false_val]) + else + AC_MSG_RESULT([could not determine]) + fi +fi +if test -n "$true_val" -a -n "$false_val" ; then + AC_DEFINE(F77_TRUE_VALUE_SET,1,[Define if we know the value of Fortran true and false]) + AC_DEFINE_UNQUOTED(F77_TRUE_VALUE,$true_val,[The value of true in Fortran]) + AC_DEFINE_UNQUOTED(F77_FALSE_VALUE,$false_val,[The value of false in Fortran]) +fi +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_f77old.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_f77old.m4 new file mode 100644 index 0000000000..5d6e2d9e70 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_f77old.m4 @@ -0,0 +1,389 @@ +dnl/*D +dnl PAC_PROG_F77_CMDARGS - Determine how to access the command line from +dnl Fortran 77 +dnl +dnl Output Effects: +dnl The following variables are set: +dnl.vb +dnl F77_GETARG - Statement to get an argument i into string s +dnl F77_IARGC - Routine to return the number of arguments +dnl FXX_MODULE - Module command when using Fortran 90 compiler +dnl F77_GETARGDECL - Declaration of routine used for F77_GETARG +dnl F77_GETARG_FFLAGS - Flags needed when compiling/linking +dnl F77_GETARG_LDFLAGS - Flags needed when linking +dnl.ve +dnl If 'F77_GETARG' has a value, then that value and the values for these +dnl other symbols will be used instead. If no approach is found, all of these +dnl variables will have empty values. +dnl If no other approach works and a file 'f77argdef' is in the directory, +dnl that file will be sourced for the values of the above four variables. +dnl +dnl In most cases, you should add F77_GETARG_FFLAGS to the FFLAGS variable +dnl and F77_GETARG_LDFLAGS to the LDFLAGS variable, to ensure that tests are +dnl performed on the compiler version that will be used. +dnl +dnl 'AC_SUBST' is called for all six variables. +dnl +dnl One complication is that on systems with multiple Fortran compilers, +dnl some libraries used by one Fortran compiler may have been (mis)placed +dnl in a common location. We have had trouble with libg2c in particular. +dnl To work around this, we test whether iargc etc. work first. This +dnl will catch most systems and will speed up the tests. +dnl +dnl Next, the libraries are only added if they are needed to complete a +dnl link; they aren''t added just because they exist. +dnl +dnl f77argdef +dnl D*/ +dnl +dnl Random notes +dnl You can export the command line arguments from C to the g77 compiler +dnl using +dnl extern char **__libc_argv; +dnl extern int __libc_argc; +dnl f_setarg( __libc_argc, __libc_argv ); +dnl +AC_DEFUN([PAC_PROG_F77_CMDARGS],[ +found_cached="yes" +AC_MSG_CHECKING([for routines to access the command line from Fortran 77]) +AC_CACHE_VAL(pac_cv_prog_f77_cmdarg, +[ + AC_MSG_RESULT([searching...]) + found_cached="no" + # First, we perform a quick check. Does iargc and getarg work? + fxx_module="${FXX_MODULE:-}" + f77_getargdecl="${F77_GETARGDECL:-external getarg}" + f77_getarg="${F77_GETARG:-call GETARG(i,s)}" + f77_iargc="${F77_IARGC:-IARGC()}" + # + # Grumble. The Absoft Fortran compiler computes i - i as 0 and then + # 1.0 / 0 at compile time, even though the code may never be executed. + # What we need is a way to generate an error, so the second usage of i + # was replaced with f77_iargc. + cat > conftest.f </dev/null 2>&1 ; then + found_answer="yes" + FXX_MODULE="$fxx_module" + F77_GETARGDECL="$f77_getargdecl" + F77_GETARG="$f77_getarg" + F77_IARGC="$f77_iargc" + AC_MSG_RESULT(yes) + fi + fi + fi + if test $found_answer = "no" ; then + AC_MSG_RESULT(no) + # Grumph. Here are a bunch of different approaches + # We have several axes the check: + # Library to link with (none, -lU77 (HPUX), -lg2c (LINUX f77)) + # PEPCF90 (Intel ifc) + # The first line is a dummy + # (we experimented with using a , but this caused other + # problems because we need in the IFS) + trial_LIBS="0 -lU77 -lPEPCF90" + if test "$NOG2C" != "1" ; then + trial_LIBS="$trial_LIBS -lg2c" + fi + # Discard libs that are not availble: + save_IFS="$IFS" + # Make sure that IFS includes a space, or the tests that run programs + # may fail + IFS=" "" +" + save_trial_LIBS="$trial_LIBS" + trial_LIBS="" + cat > conftest.f <, the space is important + # To make the Absoft f77 and f90 work together, we need to prefer the + # upper case versions of the arguments. They also require libU77. + # -YCFRL=1 causes Absoft f90 to work with g77 and similar (f2c-based) + # Fortran compilers + # + # Problem: The Intel efc compiler hangs when presented with -N109 . + # The only real fix for this is to detect this compiler and exclude + # the test. We may want to reorganize these tests so that if we + # can compile code without special options, we never look for them. + # + using_intel_efc="no" + pac_test_msg=`$F77 -V 2>&1 | grep 'Intel(R) Fortran Itanium'` + if test "$pac_test_msg" != "" ; then + using_intel_efc="yes" + fi + if test "$using_intel_efc" = "yes" ; then + trial_FLAGS="000" + else + trial_FLAGS="000 +-N109 +-f +-YEXT_NAMES=UCS +-YEXT_NAMES=LCS +-YCFRL=1 ++U77" + fi + # Discard options that are not available: + # (IFS already saved above) + IFS=" "" +" + save_trial_FLAGS="$trial_FLAGS" + trial_FLAGS="" + for flag in $save_trial_FLAGS ; do + if test "$flag" = " " -o "$flag" = "000" ; then + opt_ok="yes" + else + PAC_F77_CHECK_COMPILER_OPTION($flag,opt_ok=yes,opt_ok=no) + fi + if test "$opt_ok" = "yes" ; then + if test "$flag" = " " -o "$flag" = "000" ; then + fflag="" + else + fflag="$flag" + fi + # discard options that don't allow mixed-case name matching + cat > conftest.f < conftest.f </dev/null 2>&1 ; then + found_answer="yes" + fi + else + found_answer="yes" + fi + fi + IFS=" "" +" + if test "$found_answer" = "yes" ; then + AC_MSG_RESULT([yes]) + pac_cv_prog_f77_cmdarg="$MSG" + pac_cv_prog_f77_cmdarg_fflags="$flags" + pac_cv_prog_f77_cmdarg_ldflags="$libs" + break + else + AC_MSG_RESULT([no]) + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.f >&AC_FD_CC + fi + done + done + IFS="$save_IFS" + rm -f conftest.* + trial=`expr $trial + 1` + done +fi +pac_cv_F77_GETARGDECL="$F77_GETARGDECL" +pac_cv_F77_IARGC="$F77_IARGC" +pac_cv_F77_GETARG="$F77_GETARG" +pac_cv_FXX_MODULE="$FXX_MODULE" +]) +if test "$found_cached" = "yes" ; then + AC_MSG_RESULT([$pac_cv_prog_f77_cmdarg]) +elif test -z "$pac_cv_F77_IARGC" ; then + AC_MSG_WARN([Could not find a way to access the command line from Fortran 77]) +fi +# Set the variable values based on pac_cv_prog_xxx +F77_GETARGDECL="$pac_cv_F77_GETARGDECL" +F77_IARGC="$pac_cv_F77_IARGC" +F77_GETARG="$pac_cv_F77_GETARG" +FXX_MODULE="$pac_cv_FXX_MODULE" +F77_GETARG_FFLAGS="$pac_cv_prog_f77_cmdarg_fflags" +F77_GETARG_LDFLAGS="$pac_cv_prog_f77_cmdarg_ldflags" +AC_SUBST(F77_GETARGDECL) +AC_SUBST(F77_IARGC) +AC_SUBST(F77_GETARG) +AC_SUBST(FXX_MODULE) +AC_SUBST(F77_GETARG_FFLAGS) +AC_SUBST(F77_GETARG_LDFLAGS) +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_fc.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_fc.m4 new file mode 100644 index 0000000000..e401dce404 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_fc.m4 @@ -0,0 +1,950 @@ +dnl /*D +dnl PAC_PROG_FC([COMPILERS]) +dnl +dnl COMPILERS is a space separated list of Fortran 77 compilers to search +dnl for. Fortran 95 isn't strictly backwards-compatible with Fortran 77, +dnl but `f95' is worth trying. +dnl +dnl Compilers are ordered by +dnl 1. F77, F90, F95 +dnl 2. Good/tested native compilers, bad/untested native compilers +dnl 3. Wrappers around f2c go last. +dnl +dnl `fort77' is a wrapper around `f2c'. +dnl It is believed that under HP-UX `fort77' is the name of the native +dnl compiler. On some Cray systems, fort77 is a native compiler. +dnl frt is the Fujitsu F77 compiler. +dnl pgf77 and pgf90 are the Portland Group F77 and F90 compilers. +dnl xlf/xlf90/xlf95/xlf2003 are IBM (AIX) F77/F90/F95/F2003 compilers. +dnl lf95 is the Lahey-Fujitsu compiler. +dnl fl32 is the Microsoft Fortran "PowerStation" compiler. +dnl af77 is the Apogee F77 compiler for Intergraph hardware running CLIX. +dnl epcf90 is the "Edinburgh Portable Compiler" F90. +dnl fort is the Compaq Fortran 90 (now 95) compiler for Tru64 and Linux/Alpha. +dnl pathf90 is the Pathscale Fortran 90 compiler +dnl ifort is another name for the Intel f90 compiler +dnl efc - An older Intel compiler (?) +dnl ifc - An older Intel compiler +dnl fc - A compiler on some unknown system. This has been removed because +dnl it may also be the name of a command for something other than +dnl the Fortran compiler (e.g., fc=file system check!) +dnl gfortran - The GNU Fortran compiler (not the same as g95) +dnl gfc - An alias for gfortran recommended in cygwin installations +dnl D*/ +AC_DEFUN([PAC_PROG_FC],[ +PAC_PUSH_FLAG([FCFLAGS]) +AC_PROG_FC([m4_default([$1], + [ifort pgf90 pathf90 pathf95 xlf90 xlf95 xlf2003 f90 epcf90 f95 fort lf95 \ + gfortran g95 ifc efc gfc])]) +PAC_POP_FLAG([FCFLAGS]) +]) +dnl +dnl PAC_FC_EXT checks for the default Fortran 90 program extension, f90 then f. +dnl This could be replaced by AC_FC_SRCEXT but since AC_FC_SRCEXT +dnl adds FCFLAGS_ext, which is used to modify FCFLAGS or Makefile.in. +dnl So will do this later. +dnl +AC_DEFUN([PAC_FC_EXT],[ +AC_MSG_CHECKING([for extension for Fortran 90 programs]) +ac_fc_srcext="f90" +AC_LANG_PUSH(Fortran) +AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM() +],[ + AC_MSG_RESULT([f90]) +],[ + ac_fc_srcext="f" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM() + ],[ + AC_MSG_RESULT([f]) + ],[ + AC_MSG_RESULT([unknown!]) + ]) +]) +AC_LANG_POP(Fortran) +]) +dnl +dnl Internal routine for testing F90 +dnl PAC_PROG_FC_WORKS() +dnl +AC_DEFUN([PAC_PROG_FC_WORKS],[ +AC_REQUIRE([PAC_FC_EXT]) +AC_LANG_PUSH(Fortran) +AC_MSG_CHECKING([whether the Fortran 90 compiler ($FC $FCFLAGS $LDFLAGS) works]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program conftest + integer, dimension(10) :: n + end + ]) +],[ + pac_cv_prog_fc_works="yes" + AC_MSG_RESULT([$pac_cv_prog_fc_works]) + AC_MSG_CHECKING([whether the Fortran 90 compiler ($FC $FCFLAGS $LDFLAGS) is a cross-compiler]) + AC_RUN_IFELSE([], + [pac_cv_prog_fc_cross="no"], + [pac_cv_prog_fc_cross="yes"], + [pac_cv_prog_fc_cross="$cross_compiling"] + ) + AC_MSG_RESULT($pac_cv_prog_fc_cross) +],[ + pac_cv_prog_fc_works="no" + AC_MSG_WARN([installation or configuration problem: Fortran 90 compiler cannot create executables.]) +]) +# The intel compiler sometimes generates these work.pc and .pcl files +rm -f work.pc work.pcl +AC_LANG_POP(Fortran) +dnl cross_compiling no longer maintained by autoconf as part of the +dnl AC_LANG changes. If we set it here, a later AC_LANG may not +dnl restore it (in the case where one compiler claims to be a cross compiler +dnl and another does not) +dnl cross_compiling=$pac_cv_prog_f90_cross +]) +dnl/*D +dnl PAC_PROG_FC_INT_KIND - Determine kind parameter for an integer with +dnl the specified number of bytes. +dnl +dnl Synopsis: +dnl PAC_PROG_FC_INT_KIND(variable-to-set,number-of-bytes,[cross-size]) +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_FC_INT_KIND],[ +# Set the default +$1=-1 +if test "$pac_cv_prog_fc_cross" = "yes" ; then + $1="$3" +else + AC_LANG_PUSH(Fortran) + AC_MSG_CHECKING([for Fortran 90 integer kind for $2-byte integers]) + # Convert bytes to digits + case $2 in + 1) sellen=2 ;; + 2) sellen=4 ;; + 4) sellen=8 ;; + 8) sellen=16 ;; + 16) sellen=30 ;; + *) sellen=8 ;; + esac + # Check for cached value + eval testval=\$"pac_cv_prog_fc_int_kind_$sellen" + if test -n "$testval" ; then + AC_MSG_RESULT([$testval (cached)]) + $1=$testval + else + KINDVAL="unavailable" + eval "pac_cv_prog_fc_int_kind_$sellen"=-1 + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ + program main + integer ii + ii = selected_int_kind($sellen) + open(8, file="conftest1.out", form="formatted") + write (8,*) ii + close(8) + stop + end + ]) + ],[pac_run_ok=yes],[pac_run_ok=no]) + if test "$pac_run_ok" = "yes" ; then + if test -s conftest1.out ; then + # Because of write, there may be a leading blank. + KINDVAL=`cat conftest1.out | sed 's/ //g'` + eval "pac_cv_prog_fc_int_kind_$sellen"=$KINDVAL + $1=$KINDVAL + fi + fi + AC_MSG_RESULT([$KINDVAL]) + fi # not cached + AC_LANG_POP(Fortran) +fi # is not cross compiling +])dnl +dnl +dnl ------------------------------------------------------------------------ +dnl Special characteristics that have no autoconf counterpart but that +dnl we need as part of the Fortran 90 support. To distinquish these, they +dnl have a [PAC] prefix. +dnl +dnl +dnl PAC_FC_MODULE_EXT(action if found,action if not found) +dnl +AC_DEFUN([PAC_FC_MODULE_EXT], +[AC_CACHE_CHECK([for Fortran 90 module extension], +pac_cv_fc_module_ext,[ +pac_cv_fc_module_case="unknown" +AC_LANG_PUSH(Fortran) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + module conftest + integer n + parameter (n=1) + end module conftest + ]) +],[ + dnl Look for module name + dnl First, try to find known names. This avoids confusion caused by + dnl additional files (like .stb created by some versions of pgf90) + dnl Early versions of the Intel compiler used "d" as the module extension; + dnl we include that just to finish the test as early as possible. + for name in conftest CONFTEST ; do + for ext in mod MOD d ; do + if test -s $name.$ext ; then + if test $name = conftest ; then + pac_cv_fc_module_case=lower + else + pac_cv_fc_module_case=upper + fi + pac_cv_fc_module_ext=$ext + pac_MOD=$ext + break + fi + done + if test -n "$pac_cv_fc_module_ext" ; then break ; fi + done + if test -z "$pac_MOD" ; then + pac_MOD=`ls conftest.* 2>&1 | grep -v conftest.${ac_fc_srcext} | grep -v conftest.o` + pac_MOD=`echo $pac_MOD | sed -e 's/conftest\.//g'` + pac_cv_fc_module_case="lower" + if test "X$pac_MOD" = "X" ; then + pac_MOD=`ls CONFTEST* 2>&1 | grep -v CONFTEST.f | grep -v CONFTEST.o` + pac_MOD=`echo $pac_MOD | sed -e 's/CONFTEST\.//g'` + if test -n "$pac_MOD" -a -s "CONFTEST.$pac_MOD" ; then + testname="CONFTEST" + pac_cv_fc_module_case="upper" + else + # Clear because we must have gotten an error message + pac_MOD="" + fi + fi + if test -z "$pac_MOD" ; then + pac_cv_fc_module_ext="unknown" + else + pac_cv_fc_module_ext=$pac_MOD + fi + fi +],[ + pac_cv_fc_module_ext="unknown" +]) +AC_LANG_POP(Fortran) +]) +dnl +dnl +dnl +AC_SUBST(FCMODEXT) +if test "$pac_cv_fc_module_ext" = "unknown" ; then + ifelse($2,,:,[$2]) +else + ifelse($1,,FCMODEXT=$pac_MOD,[$1]) +fi +]) +dnl +dnl +dnl PAC_FC_MODULE_INCFLAG +AC_DEFUN([PAC_FC_MODULE_INCFLAG],[ +AC_CACHE_CHECK([for Fortran 90 module include flag], +pac_cv_fc_module_incflag,[ +AC_REQUIRE([PAC_FC_MODULE_EXT]) +AC_LANG_PUSH(Fortran) +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + module conf + integer n + parameter (n=1) + end module conf + ]) +]) +pac_madedir="no" +if test ! -d conf ; then mkdir conftestdir ; pac_madedir="yes"; fi +if test "$pac_cv_fc_module_case" = "upper" ; then + pac_module="CONF.$pac_cv_fc_module_ext" +else + pac_module="conf.$pac_cv_fc_module_ext" +fi +AC_COMPILE_IFELSE([],[ + if test -s "$pac_module" ; then + mv $pac_module conftestdir + # Remove any temporary files, and hide the work.pc file + # (if the compiler generates them) + if test -f work.pc ; then + mv -f work.pc conftest.pc + fi + rm -f work.pcl + else + AC_MSG_WARN([Unable to build a simple Fortran 90 module]) + # echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + # cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD + _AC_MSG_LOG_CONFTEST + fi +],[]) +# Remove the conftest* after AC_LANG_CONFTEST +rm -rf conftest.dSYM +rm -f conftest.$ac_ext + +dnl Create the conftest here so the test isn't created everytime inside loop. +AC_LANG_CONFTEST([AC_LANG_PROGRAM([],[use conf])]) + +# Save the original FCFLAGS +saved_FCFLAGS="$FCFLAGS" +pac_cv_fc_module_incflag="" +for inchdr in '-I' '-M' '-p' ; do + FCFLAGS="$saved_FCFLAGS ${inchdr}conftestdir" + AC_COMPILE_IFELSE([],[pac_cv_fc_module_incflag="$inchdr" ; break]) +done +if test "X$pac_cv_fc_module_incflag" = "X" ; then + if test -s conftest.pc ; then + mv conftest.pc conftestdir/mpimod.pc + echo "mpimod.pc" > conftestdir/mpimod.pcl + echo "`pwd`/conftestdir/mpimod.pc" >> conftestdir/mpimod.pcl + inchdr='-cl,' + FCFLAGS="$save_FCFLAGS ${inchdr}conftestdir" + AC_COMPILE_IFELSE([], [pac_fcompile_ok=yes], [pac_fcompile_ok=no]) + if test "$pac_fcompile_ok" = "yes" ; then + pac_cv_fc_module_incflag="$inchdr" + # Not quite right; see the comments that follow + AC_MSG_RESULT([-cl,filename where filename contains a list of files and directories]) + FC_WORK_FILES_ARG="-cl,mpimod.pcl" + FCMODINCSPEC="-cl,/mod.pcl" + else + # The version of the Intel compiler that I have refuses to let + # you put the "work catalog" list anywhere but the current directory. + pac_cv_fc_module_incflag="Unavailable!" + fi + else + # Early versions of the Intel ifc compiler required a *file* + # containing the names of files that contained the names of the + # + # -cl,filename.pcl + # filename.pcl contains + # fullpathname.pc + # The "fullpathname.pc" is generated, I believe, when a module is + # compiled. + # Intel compilers use a wierd system: -cl,filename.pcl . If no file is + # specified, work.pcl and work.pc are created. However, if you specify + # a file, it must contain a the name of a file ending in .pc . Ugh! + pac_cv_fc_module_incflag="unknown" + fi +fi +# Restore the original FCFLAGS +FCFLAGS="$saved_FCFLAGS" +if test "$pac_madedir" = "yes" ; then rm -rf conftestdir ; fi +# Remove the conftest* after AC_LANG_CONFTEST +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +AC_LANG_POP(Fortran) +]) +AC_SUBST(FC_WORK_FILES_ARG) +AC_SUBST(FCMODINCFLAG) +FCMODINCFLAG=$pac_cv_fc_module_incflag +]) +dnl +dnl +dnl +AC_DEFUN([PAC_FC_MODULE],[ +PAC_FC_MODULE_EXT +PAC_FC_MODULE_INCFLAG +]) +dnl +dnl PAC_FC_AND_F77_COMPATIBLE([action-if-true],[action-if-false]) +dnl +dnl Determine whether object files compiled with Fortran 77 can be +dnl linked to Fortran 90 main programs. +dnl +dnl The test uses a name that includes an underscore unless the 3rd +dnl argument provides another routine name. +dnl +AC_DEFUN([PAC_FC_AND_F77_COMPATIBLE],[ +AC_REQUIRE([PAC_PROG_FC_WORKS]) +AC_CACHE_CHECK([whether Fortran 90 compiler works with Fortran 77 compiler], +pac_cv_fc_and_f77,[ +pacTestRoutine=foo_abc +ifelse([$3],,,[eval pacTestRoutine=$3]) +pac_cv_fc_and_f77="unknown" +# compile the f77 program and link with the f90 program +# The reverse may not work because the Fortran 90 environment may +# expect to be in control (and to provide library files unknown to any other +# environment, even Fortran 77!) +AC_LANG_PUSH(Fortran 77) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine ${pacTestRoutine}(b) + integer b + b = b + 1 + end + ]) +],[ + # pac_f77compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_f77conftest.$OBJEXT]) + # Save original LIBS, prepend previously generated object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_f77conftest.$OBJEXT $LIBS" + AC_LANG_PUSH(Fortran) + AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + integer a + a = 1 + call ${pacTestRoutine}(a) + end + ]) + ],[pac_cv_fc_and_f77=yes],[pac_cv_fc_and_f77=no]) + # Some versions of the Intel compiler produce these two files + rm -f work.pc work.pcl + # Restore LIBS + LIBS="$saved_LIBS" + AC_LANG_POP(Fortran) + # remove previously generated object file. + rm -f pac_f77conftest.$OBJEXT +], [ + # pac_f77compile_ok=no + pac_cv_fc_and_f77=no +]) +AC_LANG_POP(Fortran 77) +# Perform the requested action based on whether the test succeeded +if test "$pac_cv_fc_and_f77" = yes ; then + ifelse($1,,:,[$1]) +else + ifelse($2,,:,[$2]) + AC_MSG_WARN([See config.log for the failed test program and its output.]) +fi +]) +dnl +]) +dnl +dnl +dnl /*D +dnl PAC_PROG_FC_CRAY_POINTER - Check if Fortran supports Cray-style pointer. +dnl If so, set pac_cv_prog_fc_has_pointer to yes +dnl and find out if any extra compiler flag is +dnl needed and set it as CRAYPTR_FCFLAGS. +dnl i.e. CRAYPTR_FCFLAGS is meaningful only if +dnl pac_cv_prog_fc_has_pointer = yes. +dnl +dnl Synopsis: +dnl PAC_PROG_FC_CRAY_POINTER([action-if-true],[action-if-false]) +dnl D*/ +AC_DEFUN([PAC_PROG_FC_CRAY_POINTER],[ +AC_CACHE_CHECK([whether Fortran 90 supports Cray-style pointer], +pac_cv_prog_fc_has_pointer,[ +AC_LANG_PUSH([Fortran]) +AC_LANG_CONFTEST([ + AC_LANG_PROGRAM([],[ + integer M + pointer (MPTR,M) + data MPTR/0/ + ]) +]) +saved_FCFLAGS="$FCFLAGS" +pac_cv_prog_fc_has_pointer=no +CRAYPTR_FCFLAGS="" +for ptrflag in '' '-fcray-pointer' ; do + FCFLAGS="$saved_FCFLAGS $ptrflag" + AC_COMPILE_IFELSE([],[ + pac_cv_prog_fc_has_pointer=yes + CRAYPTR_FCFLAGS="$ptrflag" + break + ]) +done +dnl Restore FCFLAGS first, since user may not want to modify FCFLAGS +FCFLAGS="$saved_FCFLAGS" +dnl remove conftest after ac_lang_conftest +rm -f conftest.$ac_ext +AC_LANG_POP([Fortran]) +]) +if test "$pac_cv_prog_fc_has_pointer" = "yes" ; then + AC_MSG_CHECKING([for Fortran 90 compiler flag for Cray-style pointer]) + if test "X$CRAYPTR_FCFLAGS" != "X" ; then + AC_MSG_RESULT([$CRAYPTR_FCFLAGS]) + else + AC_MSG_RESULT([none]) + fi + ifelse([$1],[],[:],[$1]) +else + ifelse([$2],[],[:],[$2]) +fi +]) +dnl +dnl +dnl +AC_DEFUN([PAC_PROG_FC_AND_C_STDIO_LIBS],[ +AC_REQUIRE([AC_HEADER_STDC]) +# To simply the code in the cache_check macro, chose the routine name +# first, in case we need it +confname=conf1_ +case "$pac_cv_prog_f77_name_mangle" in + "lower underscore") confname=conf1_ ;; + "upper stdcall") confname=CONF1 ;; + upper) confname=CONF1 ;; + "lower doubleunderscore") confname=conf1_ ;; + lower) confname=conf1 ;; + "mixed underscore") confname=conf1_ ;; + mixed) confname=conf1 ;; +esac + +AC_CACHE_CHECK([what libraries are needed to link Fortran90 programs with C routines that use stdio],pac_cv_prog_fc_and_c_stdio_libs,[ +pac_cv_prog_fc_and_c_stdio_libs=unknown + +AC_LANG_PUSH(C) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS) +#include +#endif +int $confname( int a ) +{ printf( "The answer is %d\n", a ); fflush(stdout); return 0; } + ]) +],[ + pac_compile_ok=yes + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + # Save LIBS and prepend object file to LIBS + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + AC_LANG_PUSH(Fortran) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([],[call conf1(0)]) + ],[ + pac_cv_prog_fc_and_c_stdio_libs=none + ],[ + # Try again with -lSystemStubs + LIBS="$LIBS -lSystemStubs" + AC_LINK_IFELSE([],[ + pac_cv_prog_fc_and_c_stdio_libs="-lSystemStubs" + ],[]) + ]) + LIBS="$saved_LIBS" + AC_LANG_POP(Fortran) + rm -f pac_conftest.$OBJEXT +]) +AC_LANG_POP(C) +dnl +if test "$pac_cv_prog_fc_and_c_stdio_libs" != none -a \ + "$pac_cv_prog_fc_and_c_stdio_libs" != unknown ; then + FC_OTHER_LIBS="$FC_OTHER_LIBS $pac_cv_prog_fc_and_c_stdio_libs" +fi +]) +dnl +]) +dnl +dnl/*D +dnl PAC_FC_CHECK_COMPILER_OPTION - Check that a FC compiler option is +dnl accepted without warning messages +dnl +dnl Synopsis: +dnl PAC_FC_CHECK_COMPILER_OPTION(optionname,action-if-ok,action-if-fail) +dnl +dnl Output Effects: +dnl +dnl If no actions are specified, a working value is added to 'FCOPTIONS' +dnl +dnl Notes: +dnl This is now careful to check that the output is different, since +dnl some compilers are noisy. +dnl +dnl We are extra careful to prototype the functions in case compiler options +dnl that complain about poor code are in effect. +dnl +dnl Because this is a long script, we have ensured that you can pass a +dnl variable containing the option name as the first argument. +dnl D*/ +AC_DEFUN([PAC_FC_CHECK_COMPILER_OPTION],[ +AC_MSG_CHECKING([whether Fortran 90 compiler accepts option $1]) +pac_opt="$1" +AC_LANG_PUSH(Fortran) +FCFLAGS_orig="$FCFLAGS" +FCFLAGS_opt="$pac_opt $FCFLAGS" +pac_result="unknown" + +AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +FCFLAGS="$FCFLAGS_orig" +rm -f pac_test1.log +PAC_LINK_IFELSE_LOG([pac_test1.log], [], [ + FCFLAGS="$FCFLAGS_opt" + rm -f pac_test2.log + PAC_LINK_IFELSE_LOG([pac_test2.log], [], [ + PAC_RUNLOG_IFELSE([diff -b pac_test1.log pac_test2.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) +], [ + pac_result=no +]) +AC_MSG_RESULT([$pac_result]) +dnl Delete the conftest created by AC_LANG_CONFTEST. +rm -f conftest.$ac_ext +# +if test "$pac_result" = "yes" ; then + AC_MSG_CHECKING([whether routines compiled with $pac_opt can be linked with ones compiled without $pac_opt]) + pac_result=unknown + FCFLAGS="$FCFLAGS_orig" + rm -f pac_test3.log + PAC_COMPILE_IFELSE_LOG([pac_test3.log], [ + AC_LANG_SOURCE([ + subroutine try() + end + ]) + ],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + + FCFLAGS="$FCFLAGS_opt" + rm -f pac_test4.log + PAC_LINK_IFELSE_LOG([pac_test4.log], [AC_LANG_PROGRAM()], [ + PAC_RUNLOG_IFELSE([diff -b pac_test2.log pac_test4.log], + [pac_result=yes], [pac_result=no]) + ],[ + pac_result=no + ]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT + ],[ + pac_result=no + ]) + AC_MSG_RESULT([$pac_result]) + rm -f pac_test3.log pac_test4.log +fi +rm -f pac_test1.log pac_test2.log + +dnl Restore FCFLAGS before 2nd/3rd argument commands are executed, +dnl as 2nd/3rd argument command could be modifying FCFLAGS. +FCFLAGS="$FCFLAGS_orig" +if test "$pac_result" = "yes" ; then + ifelse([$2],[],[FCOPTIONS="$FCOPTIONS $1"],[$2]) +else + ifelse([$3],[],[:],[$3]) +fi +AC_LANG_POP(Fortran) +]) +dnl /*D +dnl PAC_FC_WORKS_WITH_CPP +dnl +dnl Checks if Fortran 90 compiler works with C preprocessor +dnl +dnl Most systems allow the Fortran compiler to process .F and .F90 files +dnl using the C preprocessor. However, some systems either do not +dnl allow this or have serious bugs (OSF Fortran compilers have a bug +dnl that generates an error message from cpp). The following test +dnl checks to see if .F works, and if not, whether "cpp -P -C" can be used +dnl D*/ +AC_DEFUN([PAC_FC_WORKS_WITH_CPP],[ +AC_REQUIRE([AC_PROG_CPP]) +AC_MSG_CHECKING([whether Fortran 90 compiler processes .F90 files with C preprocessor]) +AC_LANG_PUSH([Fortran]) +saved_fc_ext=${ac_ext} +ac_ext="F90" +saved_FCFLAGS="$FCFLAGS" +FCFLAGS="$FCFLAGS $CPPFLAGS" +AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main +#define ASIZE 10 + integer a(ASIZE) + end + ]) +]) +AC_COMPILE_IFELSE([],[ + pac_cv_fc_accepts_F90=yes + ifelse([$1],[],[],[$1=""]) +],[ + pac_cv_fc_accepts_F90=no + ifelse([$1],[],[:],[$1="false"]) +]) +# Restore Fortran's ac_ext but not FCFLAGS +ac_ext="$saved_fc_ext" + +if test "$pac_cv_fc_accepts_F90" != "yes" ; then + pac_cpp_fc="$ac_cpp -C -P conftest.F90 > conftest.$ac_ext" + PAC_RUNLOG_IFELSE([$pac_cpp_fc],[ + if test -s conftest.${ac_ext} ; then + AC_COMPILE_IFELSE([],[ + pac_cv_fc_accepts_F90="no, use cpp" + ifelse([$1],[],[],[$1="$CPP -C -P"]) + ],[]) + rm -f conftest.${ac_ext} + fi + ],[]) +fi +FCFLAGS="$saved_FCFLAGS" +rm -f conftest.F90 +AC_LANG_POP([Fortran]) +AC_MSG_RESULT([$pac_cv_fc_accepts_F90]) +]) +dnl +dnl PAC_FC_VENDOR: +dnl Try to get a version string for the F90 compiler. We may +dnl need this to find likely command-line arguments for accessing +dnl shared libraries +dnl +AC_DEFUN([PAC_FC_VENDOR],[ +AC_MSG_CHECKING([for Fortran 90 compiler vendor]) +# This is complicated by some compilers (such as the Intel 8.1 ifort) +# that return a non-zero status even when they accept the -V option +# (a zero status is returned only if there is a file). +pac_cv_fc_vendor="unknown" +for arg in --version -V -v ; do + rm -f conftest.txt + PAC_RUNLOG([$FC $arg conftest.txt 2>&1]) + # Ignore the return code, because some compilers set the + # return code to zero on invalid arguments and some to + # non-zero on success (with no files to compile) + if test -f conftest.txt ; then + if grep 'Portland Group' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=pgi + elif grep 'Sun Workshop' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=sun + elif grep 'Sun Fortran 9' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=sun + elif grep 'Absoft' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=absoft + elif grep 'G95' conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=gnu + elif grep 'GNU Fortran' conftest.txt >/dev/null 2>&1 ; then + # This is gfortran + pac_cv_fc_vendor=gnu + elif grep Intel conftest.txt >/dev/null 2>&1 ; then + pac_cv_fc_vendor=intel + fi + fi + if test "$pac_cv_fc_vendor" != "unknown" ; then break ; fi +done +if test "$pac_cv_fc_vendor" = "unknown" ; then + # Try to use the compiler name + if test "$FC" = "ifort" -o "$FC" = "ifc" ; then + pac_cv_fc_vendor=intel + elif test "$FC" = "pgf90" ; then + pac_cv_fc_vendor=pgi + elif test "$FC" = "xlf90" -o "$FC" = "xlf90_r" ; then + pac_cv_fc_vendor=ibm + elif test "$FC" = "xlf95" -o "$FC" = "xlf95_r" ; then + pac_cv_fc_vendor=ibm + fi +fi +AC_MSG_RESULT([$pac_cv_fc_vendor]) +rm -f conftest.txt +# End of checking for F90 compiler vendor +]) +dnl +dnl PAC_F77_IS_FC([ACTION_IF_TRUE],[ACTION_IF_FALSE]) +dnl Check if F77 is a Fortran 90 compiler. +dnl +AC_DEFUN([PAC_F77_IS_FC],[ +AC_MSG_CHECKING([whether $F77 is a Fortran 90 compiler]) +AC_LANG_PUSH([Fortran 77]) +saved_ac_ext=$ac_ext +ac_ext="f90" +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + integer, dimension(10) :: n + integer k + print *, range(k) + end + ]) +],[ + pac_cv_prog_f77_is_fc=yes + ifelse([$1],[],[],[$1]) +],[ + pac_cv_prog_f77_is_fc=no + ifelse([$2],[],[],[$2]) +]) +AC_MSG_RESULT([$pac_cv_prog_f77_is_fc]) +AC_LANG_POP([Fortran 77]) +]) +dnl +dnl PAC_FC_FLOAT_MODEL(float_type, [variable-set-if-successful-test]) +dnl variable-set-if-successful-test is optional variable. +dnl +dnl This is a runtime test. +dnl +AC_DEFUN([PAC_FC_FLOAT_MODEL],[ +type="$1" +AC_MSG_CHECKING([for precision and range of $type]) +AC_LANG_PUSH([Fortran]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + $type aa + print *, precision(aa), ",", range(aa) + end + ]) +],[ + rm -f pac_conftest.out + PAC_RUNLOG([./conftest$EXEEXT > pac_conftest.out]) + if test -s pac_conftest.out ; then + pac_fc_num_model="`cat pac_conftest.out | sed -e 's/ */ /g'`" + AC_MSG_RESULT([$pac_fc_num_model]) + ifelse([$2],[],[],[$2=$pac_fc_num_model]) + else + AC_MSG_WARN([No output from test program!]) + fi + rm -f pac_conftest.out +],[ + AC_MSG_WARN([Failed to build program to determine the precision and range of $type]) +]) +AC_LANG_POP([Fortran]) +]) +dnl +dnl PAC_FC_SIMPLE_NUMBER_MODEL(message,test-fc-code, +dnl [variable-set-if-successful-test]) +dnl message : message of what test-fc-code is checking +dnl test-fc-code : Fortran 90 code to check a float or integer type's data model +dnl variable-set-if-successful-test : +dnl The optional variable to be set if the test-fc-code +dnl is successful in returning the simple data model. +dnl +dnl This is a runtime test. +dnl +AC_DEFUN([PAC_FC_SIMPLE_NUMBER_MODEL],[ +pac_msg="$1" +AC_MSG_CHECKING([for $pac_msg]) +AC_LANG_PUSH([Fortran]) +AC_LINK_IFELSE([ + AC_LANG_PROGRAM([],[ + $2 + ]) +],[ + rm -f pac_conftest.out + PAC_RUNLOG([./conftest$EXEEXT > pac_conftest.out]) + if test -s pac_conftest.out ; then + pac_fc_num_model="`cat pac_conftest.out | sed -e 's/ */ /g'`" + AC_MSG_RESULT([$pac_fc_num_model]) + ifelse([$3],[],[],[$3=$pac_fc_num_model]) + else + AC_MSG_WARN([No output from test program!]) + fi + rm -f pac_conftest.out +],[ + AC_MSG_WARN([Failed to build program to determine $pac_msg]) +]) +AC_LANG_POP([Fortran]) +]) +dnl +dnl PAC_FC_AVAIL_INTEGER_MODELS([INTEGER-MODELS-FLAG]) +dnl Both INTEGER-MODELS-FLAG is an optional variable to be set if provided. +dnl If it isn't provided, PAC_FC_ALL_INTEGER_MODELS will be set. +dnl +dnl This is a runtime test. +dnl +AC_DEFUN([PAC_FC_AVAIL_INTEGER_MODELS],[ +AC_MSG_CHECKING([for available integer kinds]) +AC_LANG_PUSH([Fortran]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program main + integer r, lastkind + lastkind=selected_int_kind(1) + do r=2,30 + k = selected_int_kind(r) + if (k .ne. lastkind) then + print *, r-1,",",lastkind + lastkind = k + endif + if (k .le. 0) then + exit + endif + enddo + if (k.ne.lastkind) then + print *, 31, ",", k + endif + end + ]) +],[ + rm -f pac_conftest.out + PAC_RUNLOG([./conftest$EXEEXT > pac_conftest.out]) + if test -s pac_conftest.out ; then + pac_flag=`cat pac_conftest.out | sed -e 's/ */ /g'| tr '\012' ','` + AC_MSG_RESULT([$pac_flag]) + pac_validKinds="`sed -e 's/ */ /g' pac_conftest.out | tr '\012' ':'`" + ifelse([$1],[],[PAC_FC_ALL_INTEGER_MODELS=$pac_flag],[$1=$pac_flag]) + else + AC_MSG_WARN([No output from test program!]) + fi + rm -f pac_conftest.out +],[ + AC_MSG_WARN([Failed to build program to determine available integer models]) +]) +AC_LANG_POP([Fortran]) +]) +dnl +dnl PAC_FC_INTEGER_MODEL_MAP([INTEGER-MODEL-MAP-FLAG]) +dnl Both INTEGER-MODEL-MAP-FLAG is an optional variable to be set if provided. +dnl If it isn't provided, PAC_FC_INTEGER_MODEL_MAP will be set. +dnl +dnl This test expect pac_validKinds set by PAC_FC_ALL_INTEGER_MODELS. +dnl +dnl This is a runtime test. +dnl +dnl Compile the C subroutine as pac_conftest.o and Link it with a Fortran main. +AC_DEFUN([PAC_FC_INTEGER_MODEL_MAP],[ +AC_REQUIRE([PAC_FC_AVAIL_INTEGER_MODELS]) +AC_MSG_CHECKING([for available integer ranges]) +AC_LANG_PUSH([C]) +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#ifdef F77_NAME_UPPER +#define cisize_ CISIZE +#define isize_ ISIZE +#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) +#define cisize_ cisize +#define isize_ isize +#endif +int cisize_(char *,char*); +int cisize_(char *i1p, char *i2p) +{ + int isize_val=0; + isize_val = (int)(i2p - i1p); + return isize_val; +} + ]) +],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + pac_ccompile_ok=yes +],[ + pac_ccompile_ok=no +]) +AC_LANG_POP([C]) +dnl +if test "$pac_ccompile_ok" = "yes" ; then + saved_LIBS="$LIBS" + LIBS="pac_conftest.$OBJEXT $LIBS" + saved_IFS=$IFS + IFS=: + AC_LANG_PUSH([Fortran]) + pac_flag="" + for rangekind in $pac_validKinds ; do + kind="`echo $rangekind | sed -e 's/.*,//'`" + range="`echo $rangekind | sed -e 's/,.*//'`" + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([ + program main + integer (kind=$kind) a(2) + integer cisize + print *, $range, ",", $kind, ",", cisize( a(1), a(2) ) + end + ]) + ]) + IFS=$saved_IFS + AC_LINK_IFELSE([],[ + rm -f pac_conftest.out + PAC_RUNLOG([./conftest$EXEEXT > pac_conftest.out]) + if test -s pac_conftest.out ; then + sizes="`cat pac_conftest.out | sed -e 's/ */ /g'`" + pac_flag="$pac_flag { $sizes }," + else + AC_MSG_WARN([No output from test program!]) + fi + rm -f pac_conftest.out + ],[ + AC_MSG_WARN([Fortran program fails to build!]) + ]) + IFS=: + done + IFS=$saved_IFS + AC_MSG_RESULT([$pac_flag]) + ifelse([$1],[],[PAC_FC_INTEGER_MODEL_MAP=$pac_flag],[$1=$pac_flag]) + AC_LANG_POP([Fortran]) + LIBS="$saved_LIBS" + rm -f pac_conftest.$OBJEXT +fi +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_libs.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_libs.m4 new file mode 100644 index 0000000000..beb88a6843 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_libs.m4 @@ -0,0 +1,81 @@ + +dnl PAC_SET_HEADER_LIB_PATH(with_option) +dnl This macro looks for the --with-xxx=, --with-xxx-include and --with-xxx-lib= +dnl options and sets the library and include paths. +AC_DEFUN([PAC_SET_HEADER_LIB_PATH],[ + AC_ARG_WITH($1, + AC_HELP_STRING([--with-$1=path], + [specify path where $1 include directory and lib directory can be found]), + if test "${with_$1}" != "yes" -a "${with_$1}" != "no" ; then + # is adding lib64 by default really the right thing to do? What if + # we are on a 32-bit host that happens to have both lib dirs available? + LDFLAGS="$LDFLAGS -L${with_$1}/lib64 -L${with_$1}/lib" + CPPFLAGS="$CPPFLAGS -I${with_$1}/include" + WRAPPER_CFLAGS="$WRAPPER_CFLAGS -I${with_$1}/include" + fi, + ) + AC_ARG_WITH($1-include, + AC_HELP_STRING([--with-$1-include=path], + [specify path where $1 include directory can be found]), + if test "${with_$1_include}" != "yes" -a "${with_$1_include}" != "no" ; then + CPPFLAGS="$CPPFLAGS -I${with_$1_include}" + WRAPPER_CFLAGS="$WRAPPER_CFLAGS -I${with_$1_include}" + fi, + ) + AC_ARG_WITH($1-lib, + AC_HELP_STRING([--with-$1-lib=path], + [specify path where $1 lib directory can be found]), + if test "${with_$1_lib}" != "yes" -a "${with_$1_lib}" != "no" ; then + LDFLAGS="$LDFLAGS -L${with_$1_lib}" + fi, + ) +]) + + +dnl PAC_CHECK_HEADER_LIB(with_option, header.h, libname, function, action-if-yes, action-if-no) +dnl This macro checks for a header and lib. It is assumed that the +dnl user can specify a path to the includes and libs using --with-xxx=. +dnl The xxx is specified in the "with_option" parameter. +AC_DEFUN([PAC_CHECK_HEADER_LIB],[ + failure=no + AC_CHECK_HEADER([$2],,failure=yes) + AC_CHECK_LIB($3,$4,,failure=yes) + if test "$failure" = "no" ; then + $5 + else + $6 + fi +]) + +dnl PAC_CHECK_HEADER_LIB_FATAL(with_option, header.h, libname, function) +dnl Similar to PAC_CHECK_HEADER_LIB, but errors out on failure +AC_DEFUN([PAC_CHECK_HEADER_LIB_FATAL],[ + PAC_CHECK_HEADER_LIB($1,$2,$3,$4,success=yes,success=no) + if test "$success" = "no" ; then + AC_MSG_ERROR(['$2 or lib$3 library not found. Did you specify --with-$1= or --with-$1-include= or --with-$1-lib=?']) + fi +]) + +dnl PAC_CHECK_PREFIX(with_option,prefixvar) +AC_DEFUN([PAC_CHECK_PREFIX],[ + AC_ARG_WITH([$1-prefix], + [AS_HELP_STRING([[--with-$1-prefix[=DIR]]], [use the $1 + library installed in DIR, rather than the + one included in the distribution. Pass + "embedded" to force usage of the included + $1 source.])], + [if test "$withval" = "system" ; then + : + elif test "$withval" = "embedded" ; then + : + else + PAC_APPEND_FLAG([-I${with_$1_prefix}/include],[CPPFLAGS]) + if test -d "${with_$1_prefix}/lib64" ; then + PAC_APPEND_FLAG([-L${with_$1_prefix}/lib64],[LDFLAGS]) + fi + PAC_APPEND_FLAG([-L${with_$1_prefix}/lib],[LDFLAGS]) + fi + ], + [with_$1_prefix="embedded"]) + ] +) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_make.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_make.m4 new file mode 100644 index 0000000000..147e92e9c2 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_make.m4 @@ -0,0 +1,315 @@ +dnl +dnl We need routines to check that make works. Possible problems with +dnl make include +dnl +dnl It is really gnumake, and contrary to the documentation on gnumake, +dnl it insists on screaming everytime a directory is changed. The fix +dnl is to add the argument --no-print-directory to the make +dnl +dnl It is really BSD 4.4 make, and can't handle 'include'. For some +dnl systems, this can be fatal; there is no fix (other than removing this +dnl alleged make). +dnl +dnl It is the OSF V3 make, and can't handle a comment in a block of target +dnl code. There is no acceptable fix. +dnl +dnl +dnl +dnl +dnl Find a make program if none is defined. +AC_DEFUN([PAC_PROG_MAKE_PROGRAM],[true +if test "X$MAKE" = "X" ; then + AC_CHECK_PROGS(MAKE,make gnumake nmake pmake smake) +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_INCLUDE - Check whether make supports include +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE_INCLUDE([action if true],[action if false]) +dnl +dnl Output Effect: +dnl None +dnl +dnl Notes: +dnl This checks for makes that do not support 'include filename'. Some +dnl versions of BSD 4.4 make required '#include' instead; some versions of +dnl 'pmake' have the same syntax. +dnl +dnl See Also: +dnl PAC_PROG_MAKE +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE_INCLUDE],[ +AC_CACHE_CHECK([whether make supports include],pac_cv_prog_make_include,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +cat > conftest <<. +ALL: + @echo "success" +. +cat > conftest1 <<. +include conftest +. +pac_str=`$MAKE -f conftest1 2>&1` +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest conftest1 +if test "$pac_str" != "success" ; then + pac_cv_prog_make_include="no" +else + pac_cv_prog_make_include="yes" +fi +]) +if test "$pac_cv_prog_make_include" = "no" ; then + ifelse([$2],,:,[$2]) +else + ifelse([$1],,:,[$1]) +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_ALLOWS_COMMENTS - Check whether comments are allowed in +dnl shell commands in a makefile +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE_ALLOWS_COMMENTS([false text]) +dnl +dnl Output Effect: +dnl Issues a warning message if comments are not allowed in a makefile. +dnl Executes the argument if one is given. +dnl +dnl Notes: +dnl Some versions of OSF V3 make do not all comments in action commands. +dnl +dnl See Also: +dnl PAC_PROG_MAKE +dnl D*/ +dnl +AC_DEFUN([PAC_PROG_MAKE_ALLOWS_COMMENTS],[ +AC_CACHE_CHECK([whether make allows comments in actions], +pac_cv_prog_make_allows_comments,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +cat > conftest <<. +SHELL=/bin/sh +ALL: + @# This is a valid comment! + @echo "success" +. +pac_str=`$MAKE -f conftest 2>&1` +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +if test "$pac_str" != "success" ; then + pac_cv_prog_make_allows_comments="no" +else + pac_cv_prog_make_allows_comments="yes" +fi +]) +if test "$pac_cv_prog_make_allows_comments" = "no" ; then + AC_MSG_WARN([Your make does not allow comments in target code. +Using this make may cause problems when building programs. +You should consider using gnumake instead.]) + ifelse([$1],,[$1]) +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_VPATH - Check whether make supports source-code paths. +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE_VPATH +dnl +dnl Output Effect: +dnl Sets the variable 'VPATH' to either +dnl.vb +dnl VPATH = .:${srcdir} +dnl.ve +dnl or +dnl.vb +dnl .PATH: . ${srcdir} +dnl.ve +dnl +dnl Notes: +dnl The test checks that the path works with implicit targets (some makes +dnl support only explicit targets with 'VPATH' or 'PATH'). +dnl +dnl NEED TO DO: Check that $< works on explicit targets. +dnl +dnl See Also: +dnl PAC_PROG_MAKE +dnl +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE_VPATH],[ +AC_SUBST(VPATH) +dnl AM_IGNORE(VPATH) +AC_CACHE_CHECK([for virtual path format], +pac_cv_prog_make_vpath,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -rf conftest* +mkdir conftestdir +cat >conftestdir/a.c < conftest <&1 | grep 'conftestdir/a.c'` +if test -n "$ac_out" ; then + pac_cv_prog_make_vpath="VPATH" +else + rm -f conftest + cat > conftest <&1 | grep 'conftestdir/a.c'` + if test -n "$ac_out" ; then + pac_cv_prog_make_vpath=".PATH" + else + pac_cv_prog_make_vpath="neither VPATH nor .PATH works" + fi +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -rf conftest* +]) +if test "$pac_cv_prog_make_vpath" = "VPATH" ; then + VPATH='VPATH=.:${srcdir}' +elif test "$pac_cv_prog_make_vpath" = ".PATH" ; then + VPATH='.PATH: . ${srcdir}' +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_SET_CFLAGS - Check whether make sets CFLAGS +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE_SET_CFLAGS([action if true],[action if false]) +dnl +dnl Output Effects: +dnl Executes the first argument if 'CFLAGS' is set by 'make'; executes +dnl the second argument if 'CFLAGS' is not set by 'make'. +dnl +dnl Notes: +dnl If 'CFLAGS' is set by make, you may wish to override that choice in your +dnl makefile. +dnl +dnl See Also: +dnl PAC_PROG_MAKE +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE_SET_CFLAGS],[ +AC_CACHE_CHECK([whether make sets CFLAGS], +pac_cv_prog_make_set_cflags,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +cat > conftest <&1` +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +if test "$pac_str" = "XX" ; then + pac_cv_prog_make_set_cflags="no" +else + pac_cv_prog_make_set_cflags="yes" +fi +]) +if test "$pac_cv_prog_make_set_cflags" = "no" ; then + ifelse([$2],,:,[$2]) +else + ifelse([$1],,:,[$1]) +fi +])dnl + +dnl/*D +dnl PAC_PROG_MAKE_CLOCK_SKEW - Check whether there is a problem with +dnl clock skew in suing make. +dnl +dnl Effect: +dnl Sets the cache variable 'pac_cv_prog_make_found_clock_skew' to yes or no +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE_CLOCK_SKEW],[ +AC_CACHE_CHECK([whether clock skew breaks make], +pac_cv_prog_make_found_clock_skew,[ +AC_REQUIRE([PAC_PROG_MAKE_PROGRAM]) +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +cat > conftest < conftest.out 2>&1 +if grep -i skew conftest >/dev/null 2>&1 ; then + pac_cv_prog_make_found_clock_skew=yes +else + pac_cv_prog_make_found_clock_skew=no +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +]) +dnl We should really do something if we detect clock skew. The question is, +dnl what? +if test "$pac_cv_prog_make_found_clock_skew" = "yes" ; then + AC_MSG_WARN([Clock skew found by make. The configure and build may fail. +Consider building in a local instead of NFS filesystem.]) +fi +]) + +dnl/*D +dnl PAC_PROG_MAKE - Checks for the varieties of MAKE, including support for +dnl VPATH +dnl +dnl Synopsis: +dnl PAC_PROG_MAKE +dnl +dnl Output Effect: +dnl Sets 'MAKE' to the make program to use if 'MAKE' is not already set. +dnl Sets the variable 'SET_CFLAGS' to 'CFLAGS =' if make sets 'CFLAGS'. +dnl +dnl Notes: +dnl This macro uses 'PAC_PROG_MAKE_INCLUDE', +dnl 'PAC_PROG_MAKE_ALLOWS_COMMENTS', 'PAC_PROG_MAKE_VPATH', and +dnl 'PAC_PROG_MAKE_SET_CFLAGS'. See those commands for details about their +dnl actions. +dnl +dnl It may call 'AC_PROG_MAKE_SET', which sets 'SET_MAKE' to 'MAKE = @MAKE@' +dnl if the make program does not set the value of make, otherwise 'SET_MAKE' +dnl is set to empty; if the make program echos the directory name, then +dnl 'SET_MAKE' is set to 'MAKE = $MAKE'. +dnl D*/ +AC_DEFUN([PAC_PROG_MAKE],[ +PAC_PROG_MAKE_PROGRAM +PAC_PROG_MAKE_CLOCK_SKEW +PAC_PROG_MAKE_INCLUDE +PAC_PROG_MAKE_ALLOWS_COMMENTS +PAC_PROG_MAKE_VPATH +AC_SUBST(SET_CFLAGS) +dnl AM_IGNORE(SET_CFLAGS) +PAC_PROG_MAKE_SET_CFLAGS([SET_CFLAGS='CFLAGS=']) +if test "$pac_cv_prog_make_echos_dir" = "no" ; then + AC_PROG_MAKE_SET +else + SET_MAKE="MAKE=${MAKE-make}" +fi +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_mpi.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_mpi.m4 new file mode 100644 index 0000000000..20600dc14e --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_mpi.m4 @@ -0,0 +1,516 @@ +dnl +dnl/*D +dnl PAC_LIB_MPI - Check for MPI library +dnl +dnl Synopsis: +dnl PAC_LIB_MPI([action if found],[action if not found]) +dnl +dnl Output Effect: +dnl +dnl Notes: +dnl Currently, only checks for lib mpi and mpi.h. Later, we will add +dnl MPI_Pcontrol prototype (const int or not?). +dnl +dnl Prerequisites: +dnl autoconf version 2.13 (for AC_SEARCH_LIBS) +dnl D*/ +dnl Other tests to add: +dnl Version of MPI +dnl MPI-2 I/O? +dnl MPI-2 Spawn? +dnl MPI-2 RMA? +dnl PAC_LIB_MPI([found text],[not found text]) +AC_DEFUN([PAC_LIB_MPI],[ +dnl Set the prereq to 2.50 to avoid having +AC_PREREQ(2.50) +if test "X$pac_lib_mpi_is_building" != "Xyes" ; then + # Use CC if TESTCC is defined + if test "X$pac_save_level" != "X" ; then + pac_save_TESTCC="${TESTCC}" + pac_save_TESTCPP="${TESTCPP}" + CC="$pac_save_CC" + if test "X$pac_save_CPP" != "X" ; then + CPP="$pac_save_CPP" + fi + fi + # Look for MPILIB first if it is defined + AC_SEARCH_LIBS(MPI_Init,$MPILIB mpi mpich mpich2) + if test "$ac_cv_search_MPI_Init" = "no" ; then + ifelse($2,, + AC_MSG_ERROR([Could not find MPI library]),[$2]) + fi + AC_CHECK_HEADER(mpi.h,pac_have_mpi_h="yes",pac_have_mpi_h="no") + if test $pac_have_mpi_h = "no" ; then + ifelse($2,, + AC_MSG_ERROR([Could not find mpi.h include file]),[$2]) + fi + if test "X$pac_save_level" != "X" ; then + CC="$pac_save_TESTCC" + CPP="$pac_save_TESTCPP" + fi +fi +ifelse($1,,,[$1]) +]) + +dnl This should also set MPIRUN. +dnl +dnl/*D +dnl PAC_ARG_MPI_TYPES - Add command-line switches for different MPI +dnl environments +dnl +dnl Synopsis: +dnl PAC_ARG_MPI_TYPES([default]) +dnl +dnl Output Effects: +dnl Adds the following command line options to configure +dnl+ \-\-with\-mpich[=path] - MPICH. 'path' is the location of MPICH commands +dnl. \-\-with\-ibmmpi - IBM MPI +dnl. \-\-with\-lammpi[=path] - LAM/MPI +dnl. \-\-with\-mpichnt - MPICH NT +dnl- \-\-with\-sgimpi - SGI MPI +dnl If no type is selected, and a default ("mpich", "ibmmpi", or "sgimpi") +dnl is given, that type is used as if '--with-' was given. +dnl +dnl Sets 'CC', 'F77', 'TESTCC', 'TESTF77', and 'MPILIBNAME'. Does `not` +dnl perform an AC_SUBST for these values. +dnl Also sets 'MPIBOOT' and 'MPIUNBOOT'. These are used to specify +dnl programs that may need to be run before and after running MPI programs. +dnl For example, 'MPIBOOT' may start demons necessary to run MPI programs and +dnl 'MPIUNBOOT' will stop those demons. +dnl +dnl The two forms of the compilers are to allow for tests of the compiler +dnl when the MPI version of the compiler creates executables that cannot +dnl be run on the local system (for example, the IBM SP, where executables +dnl created with mpcc will not run locally, but executables created +dnl with xlc may be used to discover properties of the compiler, such as +dnl the size of data types). +dnl +dnl Historical note: +dnl Some common autoconf tests, such as AC_CHECK_SIZEOF, used to require +dnl running a program. But some MPI compilers (often really compilation +dnl scripts) produced programs that could only be run with special commands, +dnl such as a batch submission system. To allow these test programs to be +dnl run, a separate set of compiler variables, TESTCC, TESTF77, etc., +dnl were defined. However, in later versions of autoconf, it both became +dnl unnecessary to run programs for tests such as AC_CHECK_SIZEOF and +dnl it became necessary to define CC etc. before invoking AC_PROG_CC (and +dnl the othe language compilers), because those commands now do much, much +dnl more than just determining the compiler. +dnl +dnl To address the change, we still define the TESTCC etc. compilers where +dnl possible to allow the use of AC_TRY_RUN when required, but we define +dnl the CC etc variables and do not define ac_cv_prog_CC etc., as these +dnl cause autoconf to skip all of the other initialization code that +dnl AC_PROG_CC etc. runs. Note also that this command must occur before +dnl AC_PROG_CC (or anything that might cause AC_PROG_CC to be invoked). +dnl +dnl See also: +dnl PAC_LANG_PUSH_COMPILERS, PAC_LIB_MPI +dnl D*/ +AC_DEFUN([PAC_ARG_MPI_TYPES],[ +# known types +PAC_ARG_MPI_KNOWN_TYPES +# find compilers +PAC_MPI_FIND_COMPILER_SCRIPTS +PAC_MPI_FIND_COMPILERS +# check for MPI library +PAC_MPI_CHECK_MPI_LIB +]) +dnl +dnl To keep autoconf from prematurely invoking the compiler check scripts, +dnl we need a command that first sets the compilers and a separate one +dnl that makes any necessary checks for libraries +dnl +AC_DEFUN([PAC_ARG_MPI_KNOWN_TYPES],[ +AC_ARG_WITH(mpich, +[--with-mpich=path - Assume that we are building with MPICH], +ac_mpi_type=mpich) +# Allow MPICH2 as well as MPICH +AC_ARG_WITH(mpich2, +[--with-mpich=path - Assume that we are building with MPICH], +ac_mpi_type=mpich) +AC_ARG_WITH(lammpi, +[--with-lammpi=path - Assume that we are building with LAM/MPI], +ac_mpi_type=lammpi) +AC_ARG_WITH(ibmmpi, +[--with-ibmmpi - Use the IBM SP implementation of MPI], +ac_mpi_type=ibmmpi) +AC_ARG_WITH(sgimpi, +[--with-sgimpi - Use the SGI implementation of MPI], +ac_mpi_type=sgimpi) +AC_ARG_WITH(mpichnt, +[--with-mpichnt - Use MPICH for Windows NT ], +ac_mpi_type=mpichnt) +AC_ARG_WITH(mpi, +[--with-mpi=path - Use an MPI implementation with compile scripts mpicc + and mpif77 in path/bin],ac_mpi_type=generic) + +if test "X$ac_mpi_type" = "X" ; then + if test "X$1" != "X" ; then + ac_mpi_type=$1 + else + ac_mpi_type=unknown + fi +fi +if test "$ac_mpi_type" = "unknown" -a "$pac_lib_mpi_is_building" = "yes" ; then + ac_mpi_type="mpich" +fi +]) +dnl +dnl Because of autoconf insists on moving code to the beginning of +dnl certain definitions, it is *not possible* to define a single command +dnl that selects compilation scripts and also check for other options. +dnl Thus, this needs to be divided into +dnl MPI_FIND_COMPILER_SCRIPTS +dnl which can fail (i.e., not find a script), and +dnl MPI_FIND_COMPILERS +dnl which runs the various PROC_xx for the compilers. +AC_DEFUN([PAC_MPI_FIND_COMPILER_SCRIPTS],[ +# Set defaults +MPIRUN_NP="-np " +MPIEXEC_N="-n " +AC_SUBST(MPIRUN_NP) +AC_SUBST(MPIEXEC_N) +dnl +AC_ARG_VAR([MPIEXEC],[Name and path of mpiexec program]) +AC_ARG_VAR([MPIRUN],[Name and path of mpirun program]) +AC_ARG_VAR([MPIBOOT],[Name and path of program to run before mpirun]) +AC_ARG_VAR([MPIUNBOOT],[Name and path of program to run after all mpirun]) +AC_ARG_VAR([MPICC],[Name and absolute path of program used to compile MPI programs in C]) +AC_ARG_VAR([MPIF77],[Name and absolute path of program used to compile MPI programs in F77]) +AC_ARG_VAR([MPICXX],[Name and absolute path of program used to compile MPI programs in C++]) +AC_ARG_VAR([MPIF90],[Name and absolute path of program used to compile MPI programs in F90]) +# +# Check for things that will cause trouble. For example, +# if MPICC is defined but does not contain a / or \, then PATH_PROG will +# ignore the value +if test -n "$MPICC" ; then + case $MPICC in +changequote(<<,>>) + [\\/]* | ?:[\\/]*) +changequote([,]) + # Ok, PATH_PROG will figure it out + ;; + *) + AC_MSG_ERROR([MPICC must be set to an absolute path if it is set]) + esac +fi +if test -n "$MPICXX" ; then + case $MPICXX in +changequote(<<,>>) + [\\/]* | ?:[\\/]*) +changequote([,]) + # Ok, PATH_PROG will figure it out + ;; + *) + AC_MSG_ERROR([MPICXX must be set to an absolute path if it is set]) + esac +fi +if test -n "$MPIF77" ; then + case $MPIF77 in +changequote(<<,>>) + [\\/]* | ?:[\\/]*) +changequote([,]) + # Ok, PATH_PROG will figure it out + ;; + *) + AC_MSG_ERROR([MPIF77 must be set to an absolute path if it is set]) + esac +fi +if test -n "$MPIF90" ; then + case $MPIF90 in +changequote(<<,>>) + [\\/]* | ?:[\\/]*) +changequote([,]) + # Ok, PATH_PROG will figure it out + ;; + *) + AC_MSG_ERROR([MPIF90 must be set to an absolute path if it is set]) + esac +fi + +case $ac_mpi_type in + mpich) + dnl + dnl This isn't correct. It should try to get the underlying compiler + dnl from the mpicc and mpif77 scripts or mpireconfig + if test "X$pac_lib_mpi_is_building" != "Xyes" ; then + PAC_PUSH_FLAG([PATH]) + if test "$with_mpich" != "yes" -a "$with_mpich" != "no" ; then + # Look for commands; if not found, try adding bin to the + # path + if test ! -x $with_mpich/mpicc -a -x $with_mpich/bin/mpicc ; then + with_mpich="$with_mpich/bin" + fi + PATH=$with_mpich:${PATH} + fi + AC_PATH_PROG(MPICC,mpicc) + if test -z "$TESTCC" ; then TESTCC=${CC-cc} ; fi + CC="$MPICC" + # Note that autoconf may unconditionally change the value of + # CC (!) in some other command. Thus, we define CCMASTER + CCMASTER=$CC + # Force autoconf to respect this choice + ac_ct_CC=$CC + # to permit configure codes to recover the correct CC. This + # is an ugly not-quite-correct workaround for the fact that + # does not want you to change the C compiler once you have set it + # (But since it does so unconditionally, it silently creates + # bogus output files.) + AC_PATH_PROG(MPIF77,mpif77) + if test -z "$TESTF77" ; then TESTF77=${F77-f77} ; fi + F77="$MPIF77" + AC_PATH_PROG(MPIFC,mpif90) + if test -z "$TESTFC" ; then TESTFC=${FC-f90} ; fi + FC="$MPIFC" + AC_PATH_PROG(MPICXX,mpiCC) + if test -z "$TESTCXX" ; then TESTCXX=${CXX-CC} ; fi + CXX="$MPICXX" + # We may want to restrict this to the path containing mpirun + AC_PATH_PROG(MPIEXEC,mpiexec) + AC_PATH_PROG(MPIRUN,mpirun) + AC_PATH_PROG(MPIBOOT,mpichboot) + AC_PATH_PROG(MPIUNBOOT,mpichstop) + PAC_POP_FLAG([PATH]) + MPILIBNAME="mpich" + else + # All of the above should have been passed in the environment! + : + fi + ;; + + mpichnt) + ;; + + lammpi) + dnl + dnl This isn't correct. It should try to get the underlying compiler + dnl from the mpicc and mpif77 scripts or mpireconfig + PAC_PUSH_FLAG([PATH]) + if test "$with_mpich" != "yes" -a "$with_mpich" != "no" ; then + # Look for commands; if not found, try adding bin to the path + if test ! -x $with_lammpi/mpicc -a -x $with_lammpi/bin/mpicc ; then + with_lammpi="$with_lammpi/bin" + fi + PATH=$with_lammpi:${PATH} + fi + AC_PATH_PROG(MPICC,mpicc) + if test -z "$TESTCC" ; then TESTCC=${CC-cc} ; fi + CC="$MPICC" + AC_PATH_PROG(MPIF77,mpif77) + if test -z "$TESTCC" ; then TESTF77=${F77-f77} ; fi + F77="$MPIF77" + AC_PATH_PROG(MPIFC,mpif90) + TESTFC=${FC-f90} + if test -z "$TESTFC" ; then TESTFC=${FC-f90} ; fi + FC="$MPIFC" + AC_PATH_PROG(MPICXX,mpiCC) + if test -z "$TESTCXX" ; then TESTCXX=${CXX-CC} ; fi + CXX="$MPICXX" + PAC_POP_FLAG([PATH]) + MPILIBNAME="lammpi" + MPIBOOT="lamboot" + MPIUNBOOT="wipe" + MPIRUN="mpirun" + ;; + + ibmmpi) + AC_CHECK_PROGS(MPCC,mpcc) + AC_CHECK_PROGS(MPXLF,mpxlf mpfort) + if test -z "$MPCC" -o -z "$MPXLF" ; then + AC_MSG_ERROR([Could not find IBM MPI compilation scripts. Either mpcc or mpxlf/mpfort is missing]) + fi + if test -z "$TESTCC" ; then TESTCC=${CC-xlC} ; fi + if test -z "$TESTF77" ; then TESTF77=${F77-xlf}; fi + CC=mpcc; F77=$MPXLF + # There is no mpxlf90, but the options langlvl and free can + # select the Fortran 90 version of xlf + if test "$enable_f90" != no ; then + AC_CHECK_PROGS(MPIXLF90,mpxlf90 mpfort) + if test -z "$TESTFC" ; then TESTFC=${FC-xlf90}; fi + if test "X$MPIXLF90" != "X" ; then + FC="$MPIXLF90" + else + FC="$MPXLF -qlanglvl=90ext -qfree=f90" + fi + fi + MPILIBNAME="" + cross_compiling=yes + # Turn off the autoconf version 3 warning message + ac_tool_warned=yes + ;; + + sgimpi) + if test -z "$TESTCC" ; then TESTCC=${CC:=cc} ; fi + if test -z "$TESTF77" ; then TESTF77=${F77:=f77} ; fi + if test -z "$TESTCXX" ; then TESTCXX=${CXX:=CC} ; fi + if test -z "$TESTFC" ; then TESTFC=${FC:=f90} ; fi + # Must check for the MPI library in a separate macro - adding + # a test here will cause autoconf to prematurely define the + # C compiler + MPIRUN=mpirun + MPIBOOT="" + MPIUNBOOT="" + ;; + + generic) + # in $with_mpi/bin or $with_mpi + if test "X$MPICC" = "X" ; then + if test -x "$with_mpi/bin/mpicc" ; then + MPICC=$with_mpi/bin/mpicc + elif test -x "$with_mpi/mpicc" ; then + MPICC=$with_mpi/mpicc + fi + fi + if test "X$MPICXX" = "X" ; then + if test -x "$with_mpi/bin/mpicxx" ; then + MPICXX=$with_mpi/bin/mpicxx + elif test -x "$with_mpi/mpicxx" ; then + MPICXX=$with_mpi/mpicxx + fi + fi + if test "X$MPIF77" = "X" ; then + if test -x "$with_mpi/bin/mpif77" ; then + MPIF77=$with_mpi/bin/mpif77 + elif test -x "$with_mpi/mpif77" ; then + MPIF77=$with_mpi/mpif77 + fi + fi + if test "X$MPIF90" = "X" ; then + if test -x "$with_mpi/bin/mpif90" ; then + MPIF90=$with_mpi/bin/mpif90 + elif test -x "$with_mpi/mpif90" ; then + MPIF90=$with_mpi/mpif90 + fi + fi + if test "X$MPIEXEC" = "X" ; then + if test -x "$with_mpi/bin/mpiexec" ; then + MPIEXEC=$with_mpi/bin/mpiexec + elif test -x "$with_mpi/mpiexec" ; then + MPIEXEC=$with_mpi/mpiexec + fi + fi + CC=$MPICC + F77=$MPIF77 + if test "X$MPICXX" != "X" ; then CXX=$MPICXX ; fi + if test "X$MPIF90" != "X" ; then F90=$MPIF90 ; fi + ;; + + *) + # Use the default choices for the compilers + ;; +esac +]) + +AC_DEFUN([PAC_MPI_FIND_COMPILERS],[ +# Tell autoconf to determine properties of the compilers (these are the +# compilers for MPI programs) +PAC_PROG_CC +if test "$enable_f77" != no -a "$enable_fortran" != no ; then + AC_PROG_F77 +fi +if test "$enable_cxx" != no ; then + AC_PROG_CXX +fi +if test "$enable_f90" != no ; then + PAC_PROG_FC +fi +]) + +dnl +dnl This uses the selected CC etc to check for include paths and libraries +AC_DEFUN([PAC_MPI_CHECK_MPI_LIB],[ +case $ac_mpi_type in + mpich) + ;; + + mpichnt) + dnl + dnl This isn't adequate, but it helps with using MPICH-NT/SDK.gcc + PAC_PUSH_FLAG([CFLAGS]) + CFLAGS="$CFLAGS -I$with_mpichnt/include" + PAC_PUSH_FLAG([CPPFLAGS]) + CPPFLAGS="$CPPFLAGS -I$with_mpichnt/include" + PAC_PUSH_FLAG([LDFLAGS]) + LDFLAGS="$LDFLAGS -L$with_mpichnt/lib" + AC_CHECK_LIB(mpich,MPI_Init,found="yes",found="no") + if test "$found" = "no" ; then + AC_CHECK_LIB(mpich2,MPI_Init,found="yes",found="no") + fi + if test "$enable_cxx" != no ; then + AC_PROG_CXX + fi + if test "$enable_f90" != no ; then + PAC_PROG_FC + fi + # Set defaults for the TEST versions if not already set + if test -z "$TESTCC" ; then TESTCC=${CC:=cc} ; fi + if test -z "$TESTF77" ; then TESTF77=${F77:=f77} ; fi + if test -z "$TESTCXX" ; then TESTCXX=${CXX:=CC} ; fi + if test -z "$TESTFC" ; then TESTFC=${FC:=f90} ; fi + if test "$found" = "no" ; then + PAC_POP_FLAG([CFLAGS]) + PAC_POP_FLAG([CPPFLAGS]) + PAC_POP_FLAG([LDFLAGS]) + fi + ;; + + lammpi) + ;; + + ibmmpi) + ;; + + sgimpi) + AC_CHECK_LIB(mpi,MPI_Init) + if test "$ac_cv_lib_mpi_MPI_Init" = "yes" ; then + MPILIBNAME="mpi" + fi + ;; + + generic) + AC_SEARCH_LIBS(MPI_Init,mpi mpich2 mpich) + if test "$ac_cv_lib_mpi_MPI_Init" = "yes" ; then + MPILIBNAME="mpi" + fi + ;; + + *) + ;; +esac +]) + +dnl +dnl/*D +dnl PAC_MPI_F2C - Determine if MPI has the MPI-2 functions MPI_xxx_f2c and +dnl MPI_xxx_c2f +dnl +dnl Output Effect: +dnl Define 'HAVE_MPI_F2C' if the routines are found. +dnl +dnl Notes: +dnl Looks only for 'MPI_Request_c2f'. +dnl D*/ +AC_DEFUN([PAC_MPI_F2C],[ +AC_CACHE_CHECK([for MPI F2C and C2F routines], +pac_cv_mpi_f2c, +[ +AC_TRY_LINK([#include "mpi.h"], +[MPI_Request request;MPI_Fint a;a = MPI_Request_c2f(request);], +pac_cv_mpi_f2c="yes",pac_cv_mpi_f2c="no") +]) +if test "$pac_cv_mpi_f2c" = "yes" ; then + AC_DEFINE(HAVE_MPI_F2C,1,[Define if MPI has F2C]) +fi +]) +dnl +dnl/*D +dnl PAC_HAVE_ROMIO - make mpi.h include mpio.h if romio enabled +dnl +dnl Output Effect: +dnl expands @HAVE_ROMIO@ in mpi.h into #include "mpio.h" +dnl D*/ +AC_DEFUN([PAC_HAVE_ROMIO],[ +if test "$enable_romio" = "yes" ; then HAVE_ROMIO='#include "mpio.h"'; fi +AC_SUBST(HAVE_ROMIO) +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_romio.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_romio.m4 new file mode 100644 index 0000000000..a2ca88f423 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_romio.m4 @@ -0,0 +1,835 @@ +dnl +dnl This files contains additional macros for using autoconf to +dnl build configure scripts. +dnl +dnl Almost all of this file is taken from the aclocal.m4 of MPICH +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 +AC_DEFUN([PAC_GET_FORTNAMES],[ + rm -f confftest.f confftest.$OBJEXT + cat > confftest.f < /dev/null 2>&1 + if test ! -s confftest.$OBJEXT ; then + 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 + # MAC OS X (and probably FreeBSD need strings - (not strings -a) + # Cray doesn't accept -a ... + allstrings="-a" + if test $arch_CRAY ; then + allstrings="" + elif strings - confftest.$OBJEXT < /dev/null >/dev/null 2>&1 ; then + allstrings="-" + elif strings -a confftest.$OBJEXT < /dev/null >/dev/null 2>&1 ; then + allstrings="-a" + fi + + nameform1=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop_ | head -1` + nameform2=`strings $allstrings confftest.$OBJEXT | grep MPIR_INIT_FOP | head -1` + nameform3=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop | head -1` + nameform4=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop__ | head -1` + rm -f confftest.f confftest.$OBJEXT + if test -n "$nameform4" ; then + echo "Fortran externals are lower case and have two trailing underscores" + FORTRANNAMES="FORTRANDOUBLEUNDERSCORE" + elif test -n "$nameform1" ; then + # We don't set this in CFLAGS; it is a default case + echo "Fortran externals have a trailing underscore and are lowercase" + FORTRANNAMES="FORTRANUNDERSCORE" + elif test -n "$nameform2" ; then + echo "Fortran externals are uppercase" + FORTRANNAMES="FORTRANCAPS" + elif test -n "$nameform3" ; then + echo "Fortran externals are lower case" + FORTRANNAMES="FORTRANNOUNDERSCORE" + else + 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 + # Delete confftest files with any extension. This catches the case + # where auxillary files, such as coverage files, are removed. + rm -f confftest.* + ])dnl +dnl +define(PAC_GET_SPECIAL_SYSTEM_INFO,[ +# +if test -n "$arch_IRIX"; then + AC_MSG_CHECKING(for IRIX OS version) + dnl This block of code replaces a generic "IRIX" arch value with + dnl IRIX__ + 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/'` + changequote([,])dnl + AC_MSG_RESULT($osversion) + dnl Get SGI processor count by quick hack + AC_MSG_CHECKING(for IRIX cpucount) + 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'` + fi + changequote([,])dnl + if test "$cpucount" = "" ; then + AC_MSG_RESULT([Could not determine cpucount. Please send]) + hinv + AC_MSG_ERROR([to romio-maint@mcs.anl.gov]) + fi + AC_MSG_RESULT($cpucount) + dnl + AC_MSG_CHECKING(for IRIX cpumodel) + dnl The tail -1 is necessary for multiple processor SGI boxes + dnl We might use this to detect SGI multiprocessors and recommend + dnl -comm=shared + cputype=`hinv -t cpu | tail -1 | cut -f 3 -d' '` + if test -z "$cputype" ; then + 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 + 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 + AC_MSG_RESULT([Could not determine OS version. Please send]) + uname -a + AC_MSG_ERROR([to romio-maint@mcs.anl.gov]) + elif test $osversion = 4 ; then + true + elif test $osversion = 5 ; then + true + elif test $osversion = 6 ; then + true + else + 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 + AC_MSG_ERROR([to romio-maint@mcs.anl.gov]) + fi + AC_MSG_CHECKING(for cputype) + OLD_ARCH=IRIX + IRIXARCH="$ARCH_$osversion" + dnl Now, handle the chip set + changequote(,)dnl + cputype=`echo $cputype | sed -e 's%.*/%%' -e 's/R//' | tr -d "[A-Z]"` + changequote([,])dnl + case $cputype in + 3000) ;; + 4000) ;; + 4400) ;; + 4600) ;; + 5000) ;; + 8000) ;; + 10000);; + 12000);; + *) + AC_MSG_WARN([Unexpected IRIX/MIPS chipset $cputype. Please send the output]) + uname -a 2>&1 + hinv 2>&1 + 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 + AC_MSG_RESULT($cputype) + IRIXARCH="$IRIXARCH_$cputype" + echo "IRIX-specific architecture is $IRIXARCH" +fi +])dnl +dnl +dnl +define(PAC_TEST_MPI,[ + AC_MSG_CHECKING(if a simple MPI program compiles and links) + rm -f mpitest.c + cat > mpitest.c <&5 + $cmd >&5 2>&5 + if test ! -x conftest$EXEEXT ; then + echo "$as_me:$LINENO: failed program was:" >&5 + sed 's/^/| /' mpitest.c >&5 + rm -f conftest$EXEEXT mpitest.c + 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$EXEEXT mpitest.c + fi +AC_MSG_RESULT(yes) +])dnl +dnl +dnl +dnl +define(PAC_NEEDS_FINT,[ + AC_MSG_CHECKING(if MPI_Fint is defined in the MPI implementation) + cat > mpitest1.c < /dev/null 2>&1 + if test ! -s mpitest1.$OBJEXT ; then + NEEDS_MPI_FINT="#define NEEDS_MPI_FINT" + CFLAGS="$CFLAGS -DNEEDS_MPI_FINT" + AC_MSG_RESULT(no) + rm -f mpitest1.$OBJEXT mpitest1.c + else + NEEDS_MPI_FINT="" + AC_MSG_RESULT(yes) + rm -f mpitest1.$OBJEXT mpitest1.c + fi +])dnl +dnl +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 < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_LONG_LONG_INT,,[Define if mpi has long long it]) + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl PAC_LONG_LONG_64: check if there is a 64-bit long long +dnl +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" + 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" + LL="\%lld" + elif test "$longlongsize" = "int" ; then # a hack to set MPI_Offset as int + echo "defining MPI_Offset as int in C and integer in Fortran" + DEFINE_MPI_OFFSET="typedef int MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + AC_DEFINE(MPI_OFFSET_IS_INT,,[Define if MPI_Offset is int]) + LL="\%d" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + else + 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 +else + PAC_GET_TYPE_SIZE(long long, longlongsize) + if test -n "$longlongsize" ; then + if test "$longlongsize" = 8 ; then + PAC_TEST_LONG_LONG() + else + 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 + else +dnl check if longlong is not supported or only its size cannot be determined +dnl because the program cannot be run. + rm -f ltest.c + cat > ltest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + echo "assuming size of long long is 8bytes; use '-longlongsize' to indicate otherwise" + rm -f conftest$EXEEXT ltest.c + echo "defining MPI_Offset as long long in C and integer*8 in Fortran" + 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" + LL="\%lld" + else + echo "assuming long long is not available; use '-longlongsize' to indicate otherwise" + 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 +fi +])dnl +dnl +dnl +define(PAC_MPI_INFO,[ + AC_MSG_CHECKING(if MPI_Info functions are defined in the MPI implementation) + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_INFO,1,[Define if MPI_Info available]) + HAVE_MPI_INFO="#define HAVE_MPI_INFO" + MPI_FINFO1="!" + MPI_FINFO2="!" + MPI_FINFO3="!" + MPI_FINFO4="!" + else + AC_MSG_RESULT(no) + BUILD_MPI_INFO=1 + MPI_FINFO1=" INTEGER MPI_MAX_INFO_KEY, MPI_MAX_INFO_VAL" + MPI_FINFO2=" PARAMETER (MPI_MAX_INFO_KEY=255, MPI_MAX_INFO_VAL=1024)" + MPI_FINFO3=" INTEGER MPI_INFO_NULL" + MPI_FINFO4=" PARAMETER (MPI_INFO_NULL=0)" + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +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 < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY,,[Define if MPI Darray available]) + HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" + MPI_FARRAY1="!" + MPI_FARRAY2="!" + MPI_FARRAY3="!" + MPI_FARRAY4="!" + MPI_FARRAY5="!" + MPI_FARRAY6="!" + MPI_FARRAY7="!" + else + AC_MSG_RESULT(no) + BUILD_MPI_ARRAY=1 + MPI_FARRAY1=" INTEGER MPI_ORDER_C, MPI_ORDER_FORTRAN" + MPI_FARRAY2=" PARAMETER (MPI_ORDER_C=56, MPI_ORDER_FORTRAN=57)" + MPI_FARRAY3=" INTEGER MPI_DISTRIBUTE_BLOCK, MPI_DISTRIBUTE_CYCLIC" + MPI_FARRAY4=" INTEGER MPI_DISTRIBUTE_NONE, MPI_DISTRIBUTE_DFLT_DARG" + MPI_FARRAY5=" PARAMETER (MPI_DISTRIBUTE_BLOCK=121, MPI_DISTRIBUTE_CYCLIC=122)" + MPI_FARRAY6=" PARAMETER (MPI_DISTRIBUTE_NONE=123)" + MPI_FARRAY7=" PARAMETER (MPI_DISTRIBUTE_DFLT_DARG=-49767)" + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +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 < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + cp adio/sgi/mpi3.1/*.h include + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +dnl +define(PAC_CHECK_MPIOF_H,[ + AC_MSG_CHECKING(if mpiof.h is included in mpif.h) + rm -f mpitest.f + cat > mpitest.f < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + MPIOF_H_INCLUDED=1 + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.f +])dnl +dnl +dnl +dnl check if pread64 is defined in IRIX. needed on IRIX 6.5 +dnl +define(PAC_HAVE_PREAD64,[ + AC_MSG_CHECKING(if pread64 is defined) + rm -f conftest.c + cat > conftest.c < + main() + { + int fd=0, buf=0, i=0; + off64_t off=0; + pread64(fd, &buf, i, off); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PREAD64,,[Define if pread64 available]) + else + AC_MSG_RESULT(no) + fi +rm -f conftest$EXEEXT conftest.c +])dnl +dnl +dnl +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 < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_DEFINE(NO_MPI_SGI_type_is_contig,,[Define if no MPI type is contig]) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +dnl +define(PAC_TEST_MPI_COMBINERS,[ + AC_MSG_CHECKING(if MPI-2 combiners are defined in mpi.h) + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_COMBINERS,,[Define if MPI combiners available]) + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +dnl +dnl PAC_MPI_OFFSET_KIND() +dnl +dnl tries to determine the Fortran 90 kind parameter for 8-byte integers +dnl +define(PAC_MPI_OFFSET_KIND, +[ +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +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 "$FC" ; then + # This list should correspond to the list in aclocal_fc.m4 + AC_CHECK_PROGS(FC,ifort pgf90 pathf90 pathf95 xlf90 xlf95 f90 epcf90 \ + f95 fort lf95 gfortran g95 ifc efc) + fi + AC_MSG_CHECKING([for extension for Fortran 90 programs]) + ac_f90ext="f90" + ac_f90compile='${FC-f90} -c $FCFLAGS conftest.$ac_f90ext 1>&AC_FD_CC' + cat > conftest.$ac_f90ext < conftest.$ac_f90ext < conftest.$ac_f90ext + program main + integer i + i = selected_int_kind(16) + open(8, file="conftest.out", form="formatted") + write (8,*) i + close(8) + stop + end +EOF +if test -z "$FC" ; then + FC=f90 +fi +KINDVAL="" +if $FC -o conftest$EXEEXT conftest.$ac_f90ext >/dev/null 2>&1 ; then + ./conftest$EXEEXT >/dev/null 2>&1 + if test -s conftest.out ; then + KINDVAL=`cat conftest.out` + fi +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then + AC_MSG_RESULT($KINDVAL) + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)" +else + AC_MSG_RESULT(unavailable) +fi +])dnl +dnl +dnl +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 < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.f +])dnl +dnl +dnl +dnl PAC_GET_XFS_MEMALIGN +dnl +dnl +define(PAC_GET_XFS_MEMALIGN, +[AC_MSG_CHECKING([for memory alignment needed for direct I/O]) +rm -f memalignval +rm -f /tmp/romio_tmp.bin +AC_TEST_PROGRAM([#include +#include +#include +#include +main() { + struct dioattr st; + int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); + FILE *f=fopen("memalignval","w"); + if (fd == -1) exit(1); + if (!f) exit(1); + fcntl(fd, F_DIOINFO, &st); + fprintf( f, "%u\n", st.d_mem); + exit(0); +}],Pac_CV_NAME=`cat memalignval`,Pac_CV_NAME="") +rm -f memalignval +rm -f /tmp/romio_tmp.bin +if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then + AC_MSG_RESULT($Pac_CV_NAME) + CFLAGS="$CFLAGS -DXFS_MEMALIGN=$Pac_CV_NAME" +else + AC_MSG_RESULT(unavailable, assuming 128) + CFLAGS="$CFLAGS -DXFS_MEMALIGN=128" +fi +])dnl +dnl + +define(PAC_HAVE_MOUNT_NFS,[ + AC_MSG_CHECKING([if MOUNT_NFS is defined in the include files]) + rm -f conftest.c + cat > conftest.c < +#include + main() + { + int i=MOUNT_NFS; + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > /dev/null 2>&1 + if test -x conftest$EXEEXT ; 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$EXEEXT conftest.c +])dnl +dnl +dnl +dnl PAC_MPI_OFFSET_KIND_4BYTE() +dnl +dnl tries to determine the Fortran 90 kind parameter for 4-byte integers +dnl +define(PAC_MPI_OFFSET_KIND_4BYTE, +[AC_MSG_CHECKING([for Fortran 90 KIND parameter for 4-byte integers]) +rm -f kind.f kind.$OBJEXT kind$EXEEXT +cat < kind.f + program main + integer i + i = selected_int_kind(8) + open(8, file="k.out", form="formatted") + write (8,*) i + close(8) + stop + end +EOF +if test -z "$FC" ; then + FC=f90 +fi +KINDVAL="" +if $FC -o kind$EXEEXT kind.f >/dev/null 2>&1 ; then + ./kind >/dev/null 2>&1 + if test -s k.out ; then + KINDVAL=`cat k.out` + fi +fi +rm -f kind$EXEEXT k.out kind.f kind.$OBJEXT +if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then + AC_MSG_RESULT($KINDVAL) + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)" +else + AC_MSG_RESULT(unavailable) +fi +])dnl +dnl +dnl +define(PAC_FUNC_STRERROR,[ + AC_MSG_CHECKING([for strerror()]) + rm -f conftest.c + cat > conftest.c < + main() + { + char *s = strerror(5); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEXT conftest.c >> config.log 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_STRERROR,,[Define if strerror available]) + else + AC_MSG_RESULT(no) + AC_MSG_CHECKING([for sys_errlist]) + rm -f conftest.c +changequote(,) + cat > conftest.c < + main() + { + extern char *sys_errlist[]; + printf("%s\n", sys_errlist[34]); + } +EOF +changequote([,]) + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > config.log 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SYSERRLIST,,[Define if syserrlist available]) + else + AC_MSG_RESULT(no) + fi + fi + rm -f conftest$EXEEXT conftest.c +])dnl +dnl +define(PAC_TEST_MPIR_STATUS_SET_BYTES,[ + AC_MSG_CHECKING(if MPIR_Status_set_bytes is defined) + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status set bytes available]) + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +define(PAC_TEST_MPIU_FUNCS,[ + AC_MSG_CHECKING(support for MPICH2 memory macros) + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPIU_FUNCS,1,[Define if MPICH2 memory tracing macros defined]) + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl +dnl +define(PAC_TEST_MPI_GREQUEST,[ + AC_MSG_CHECKING(support for generalized requests) + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MPI_GREQUEST,1,[Define if generalized requests avaliable]) + DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST 1" + else + AC_MSG_RESULT(no) + fi + rm -f conftest$EXEEXT mpitest.c +])dnl diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_runlog.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_runlog.m4 new file mode 100644 index 0000000000..9b85db562b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_runlog.m4 @@ -0,0 +1,252 @@ +dnl +dnl PAC_RUN_LOG mimics _AC_RUN_LOG which is autoconf internal routine. +dnl We also make sure PAC_RUN_LOG can be used in AS_IF, so the last +dnl test command should have terminating ]), i.e. without newline before ]). +dnl +AC_DEFUN([PAC_RUNLOG],[ +{ AS_ECHO(["$as_me:$LINENO: $1"]) >&AS_MESSAGE_LOG_FD + (eval $1) 2>&AS_MESSAGE_LOG_FD + ac_status=$? + AS_ECHO(["$as_me:$LINENO: \$? = $ac_status"]) >&AS_MESSAGE_LOG_FD + test $ac_status = 0; }]) +dnl +dnl PAC_COMMAND_IFELSE is written to replace AC_TRY_EVAL with added logging +dnl to config.log, i.e. AC_TRY_EVAL does not log anything to config.log. +dnl If autoconf provides AC_COMMAND_IFELSE or AC_EVAL_IFELSE, +dnl AC_COMMAND_IFELSE dnl should be replaced by the official autoconf macros. +dnl +dnl PAC_COMMAND_IFELSE(COMMMAND,[ACTION-IF-RUN-OK],[ACTION-IF-RUN-FAIL]) +dnl +AC_DEFUN([PAC_COMMAND_IFELSE],[ +dnl Should use _AC_DO_TOKENS but use AC_RUN_LOG instead +dnl because _AC_XX is autoconf's undocumented macro. +AS_IF([PAC_RUNLOG([$1])],[ + $2 +],[ + AS_ECHO(["$as_me: program exited with status $ac_status"]) >&AS_MESSAGE_LOG_FD + m4_ifvaln([$3],[ + (exit $ac_status) + $3 + ]) +]) +]) +dnl +dnl +dnl +AC_DEFUN([PAC_EVAL_IFELSE],[ +dnl Should use _AC_DO_TOKENS but use AC_RUN_LOG instead +dnl because _AC_XX is autoconf's undocumented macro. +AS_IF([PAC_RUNLOG([$$1])],[ + $2 +],[ + AS_ECHO(["$as_me: program exited with status $ac_status"]) >&AS_MESSAGE_LOG_FD + m4_ifvaln([$3],[ + (exit $ac_status) + $3 + ]) +]) +]) +dnl +dnl +dnl +AC_DEFUN([PAC_RUNLOG_IFELSE],[ +dnl pac_TESTLOG is the internal temporary logfile for this macro. +pac_TESTLOG="pac_test.log" +rm -f $pac_TESTLOG +PAC_COMMAND_IFELSE([$1 > $pac_TESTLOG],[ + ifelse([$2],[],[],[$2]) +],[ + AS_ECHO(["*** $1 :"]) >&AS_MESSAGE_LOG_FD + cat $pac_TESTLOG >&AS_MESSAGE_LOG_FD + ifelse([$3],[],[],[$3]) +]) +rm -f $pac_TESTLOG +]) +dnl +dnl +dnl +dnl PAS_VAR_COPY - A portable layer that mimics AS_VAR_COPY when it is not +dnl defined as in older autoconf, e.g. 2.63 and older. +dnl This macro is absolutely necessary, because AS_VAR_GET in +dnl some newer autoconf, e.g. 2.64, seems to be totally broken, +dnl or behave very different from older autoconf, i.e. 2.63. +dnl +AC_DEFUN([PAS_VAR_COPY],[ +m4_ifdef([AS_VAR_COPY], [AS_VAR_COPY([$1],[$2])], [$1=AS_VAR_GET([$2])]) +]) +dnl +dnl +dnl +dnl PAC_VAR_PUSHVAL(VARNAME, [LastSavedValue])) +dnl +dnl Save the content of the shell variable, VARNAME, onto a stack. +dnl The saved value of VARNAME is restorable with respect to the nesting +dnl of the macro. +dnl +dnl The Last saved value of VARNAME on the stack is stored in shell variable +dnl pac_LastSavedValueOf_$VARNAME if the 2nd argument is NOT supplied. +dnl If the 2nd argument is present, the last saved value will be stored +dnl in the 2nd argument instead. +dnl +dnl The First saved value of VARNAME on the stack is stored in shell variable +dnl dnl pac_FirstSavedValueOf_$VARNAME. +dnl +AC_DEFUN([PAC_VAR_PUSHVAL],[ +# START of PUSHVAL +dnl define local m4-name pac_stk_level. +AS_VAR_PUSHDEF([pac_stk_level], [pac_stk_$1_level]) +AS_VAR_SET_IF([pac_stk_level],[ + dnl autoconf < 2.64 does not have AS_VAR_ARITH, so use expr instead. + AS_VAR_SET([pac_stk_level], [`expr $pac_stk_level + 1`]) +],[ + AS_VAR_SET([pac_stk_level], [0]) +]) +dnl AS_ECHO_N(["PUSHVAL: pac_stk_level = $pac_stk_level, "]) +dnl Save the content of VARNAME, i.e. $VARNAME, onto the stack. +AS_VAR_SET([pac_stk_$1_$pac_stk_level],[$$1]) +AS_VAR_IF([pac_stk_level], [0], [ + dnl Save the 1st pushed value of VARNAME as pac_FirstSavedValueOf_$VARNAME + PAS_VAR_COPY([pac_FirstSavedValueOf_$1],[pac_stk_$1_$pac_stk_level]) +]) +ifelse([$2],[],[ + dnl Save the last pushed value of VARNAME as pac_LastSavedValueOf_$VARNAME + PAS_VAR_COPY([pac_LastSavedValueOf_$1],[pac_stk_$1_$pac_stk_level]) + dnl AS_ECHO(["pac_LastSavedValueOf_$1 = $pac_LastSavedValueOf_$1"]) +],[ + dnl Save the last pushed value of VARNAME as $2 + PAS_VAR_COPY([$2],[pac_stk_$1_$pac_stk_level]) + dnl AS_ECHO(["$2 = $$2"]) +]) +AS_VAR_POPDEF([pac_stk_level]) +# END of PUSHVAL +]) +dnl +dnl +dnl +dnl PAC_VAR_POPVAL(VARNAME) +dnl +dnl Restore variable, VARNAME, from the stack. +dnl This macro is safe with respect to the nesting. +dnl Some minimal checking of nesting balance of PAC_VAR_PUSH[POP]VAL() +dnl is done here. +dnl +AC_DEFUN([PAC_VAR_POPVAL],[ +# START of POPVAL +dnl define local m4-name pac_stk_level. +AS_VAR_PUSHDEF([pac_stk_level], [pac_stk_$1_level]) +AS_VAR_SET_IF([pac_stk_level],[ + AS_VAR_IF([pac_stk_level],[-1],[ + AC_MSG_WARN(["Imbalance of PUSHVAL/POPVAL of $1"]) + ],[ + dnl AS_ECHO_N(["POPVAL: pac_stk_level = $pac_stk_level, "]) + PAS_VAR_COPY([$1],[pac_stk_$1_$pac_stk_level]) + dnl AS_ECHO(["popped_val = $$1"]) + dnl autoconf < 2.64 does not have AS_VAR_ARITH, so use expr instead. + AS_VAR_SET([pac_stk_level], [`expr $pac_stk_level - 1`]) + ]) +],[ + AC_MSG_WARN(["Uninitialized PUSHVAL/POPVAL of $1"]) +]) +AS_VAR_POPDEF([pac_stk_level]) +# END of POPVAL +]) +dnl +dnl +dnl +dnl PAC_COMPILE_IFELSE_LOG is a wrapper around AC_COMPILE_IFELSE with the +dnl output of ac_compile to a specified logfile instead of AS_MESSAGE_LOG_FD +dnl +dnl PAC_COMPILE_IFELSE_LOG(logfilename, input, +dnl [action-if-true], [action-if-false]) +dnl +dnl where input, [action-if-true] and [action-if-false] are used +dnl in AC_COMPILE_IFELSE(input, [action-if-true], [action-if-false]). +dnl This macro is nesting safe. +dnl +AC_DEFUN([PAC_COMPILE_IFELSE_LOG],[ +dnl +dnl Instead of defining our own ac_compile and do AC_TRY_EVAL +dnl on these variables. We modify ac_compile used by AC_*_IFELSE +dnl by piping the output of the command to a logfile. The reason is that +dnl 1) AC_TRY_EVAL is discouraged by Autoconf. 2) defining our ac_compile +dnl could mess up the usage and order of *CFLAGS, LDFLAGS and LIBS in +dnl these commands, i.e. deviate from how GNU standard uses these variables. +dnl +dnl Replace ">&AS_MESSAGE_LOG_FD" by "> FILE 2>&1" in ac_compile. +dnl Save a copy of ac_compile on a stack +dnl which is safe through nested invocations of this macro. +PAC_VAR_PUSHVAL([ac_compile]) +dnl Modify ac_compile based on the unmodified ac_compile. +ac_compile="`echo $pac_FirstSavedValueOf_ac_compile | sed -e 's|>.*$|> $1 2>\&1|g'`" +AC_COMPILE_IFELSE([$2],[ + ifelse([$3],[],[:],[$3]) +],[ + ifelse([$4],[],[:],[$4]) +]) +dnl Restore the original ac_compile from the stack. +PAC_VAR_POPVAL([ac_compile]) +]) +dnl +dnl +dnl +dnl PAC_LINK_IFELSE_LOG is a wrapper around AC_LINK_IFELSE with the +dnl output of ac_link to a specified logfile instead of AS_MESSAGE_LOG_FD +dnl +dnl PAC_LINK_IFELSE_LOG(logfilename, input, +dnl [action-if-true], [action-if-false]) +dnl +dnl where input, [action-if-true] and [action-if-false] are used +dnl in AC_LINK_IFELSE(input, [action-if-true], [action-if-false]). +dnl This macro is nesting safe. +dnl +AC_DEFUN([PAC_LINK_IFELSE_LOG],[ +dnl +dnl Instead of defining our own ac_link and do AC_TRY_EVAL +dnl on these variables. We modify ac_link used by AC_*_IFELSE +dnl by piping the output of the command to a logfile. The reason is that +dnl 1) AC_TRY_EVAL is discouraged by Autoconf. 2) defining our ac_link +dnl could mess up the usage and order of *CFLAGS, LDFLAGS and LIBS in +dnl these commands, i.e. deviate from how GNU standard uses these variables. +dnl +dnl Replace ">&AS_MESSAGE_LOG_FD" by "> FILE 2>&1" in ac_link. +dnl Save a copy of ac_link on a stack +dnl which is safe through nested invocations of this macro. +PAC_VAR_PUSHVAL([ac_link]) +dnl Modify ac_link based on the unmodified ac_link. +ac_link="`echo $pac_FirstSavedValueOf_ac_link | sed -e 's|>.*$|> $1 2>\&1|g'`" +dnl +AC_LINK_IFELSE([$2],[ + ifelse([$3],[],[:],[$3]) +],[ + ifelse([$4],[],[:],[$4]) +]) +dnl Restore the original ac_link from the stack. +PAC_VAR_POPVAL([ac_link]) +]) +dnl +dnl +dnl +dnl PAC_COMPLINK_IFELSE (input1, input2, [action-if-true], [action-if-false]) +dnl +dnl where input1 and input2 are either AC_LANG_SOURCE or AC_LANG_PROGRAM +dnl enclosed input programs. +dnl +dnl The macro first compiles input1 and uses the object file created +dnl as part of LIBS during linking. This macro is nesting safe. +dnl +AC_DEFUN([PAC_COMPLINK_IFELSE],[ +AC_COMPILE_IFELSE([$1],[ + PAC_RUNLOG([mv conftest.$OBJEXT pac_conftest.$OBJEXT]) + PAC_VAR_PUSHVAL([LIBS]) + LIBS="pac_conftest.$OBJEXT $pac_FirstSavedValueOf_LIBS" + AC_LINK_IFELSE([$2],[ + ifelse([$3],[],[:],[$3]) + ],[ + ifelse([$4],[],[:],[$4]) + ]) + PAC_VAR_POPVAL([LIBS]) + rm -f pac_conftest.$OBJEXT +],[ + ifelse([$4],[],[:],[$4]) +]) +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_shl.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_shl.m4 new file mode 100644 index 0000000000..c9c40d852e --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_shl.m4 @@ -0,0 +1,407 @@ +dnl +dnl Definitions for creating shared libraries +dnl +dnl The purpose of these definitions is to provide common support for +dnl shared libraries, with *or without* the use of the GNU Libtool package. +dnl For many of our important platforms, the Libtool approach is overkill, +dnl and can be particularly painful for developers. +dnl +dnl To use libtool, you need macros that are defined by libtool for libtool +dnl Don't even think about the consequences of this for updating and for +dnl using user-versions of libtool :( +dnl +dnl !!!!!!!!!!!!!!!!!!!!! +dnl libtool requires ac 2.50 !!!!!!!!!!!!!!!!! +dnl +dnl builtin(include,libtool.m4) +dnl +dnl/*D +dnl PAC_ARG_SHAREDLIBS - Add --enable-sharedlibs=kind to configure. +dnl +dnl Synopsis: +dnl PAC_ARG_SHAREDLIBS +dnl +dnl Output effects: +dnl Adds '--enable-sharedlibs=kind' to the command line. If this is enabled, +dnl then based on the value of 'kind', programs are selected for the +dnl names 'CC_SHL' and 'CC_LINK_SHL' that configure will substitute for in +dnl 'Makefile.in's. These symbols are generated by 'simplemake' when +dnl shared library support is selected. +dnl The variable 'C_LINKPATH_SHL' is set to the option to specify the +dnl path to search at runtime for libraries (-rpath in gcc/GNU ld). +dnl This can be turned off with --disable-rpath , which is appropriate +dnl for libraries and for executables that may be installed in different +dnl locations. +dnl The variable 'SHLIB_EXT' is set to the extension used by shared +dnl libraries; under most forms of Unix, this is 'so'; under Mac OS/X, this +dnl is 'dylib', and under Windows (including cygwin), this is 'dll'. +dnl +dnl Supported values of 'kind' include \: +dnl+ gcc - Use gcc to create both shared objects and libraries +dnl. osx-gcc - Use gcc on Mac OS/X to create both shared objects and +dnl libraries +dnl. solaris-cc - Use native Solaris cc to create shared objects and +dnl libraries +dnl. cygwin-gcc - Use gcc on Cygwin to create shared objects and libraries +dnl- none - The same as '--disable-sharedlibs' +dnl +dnl Others will be added as experience dictates. Likely names are +dnl + libtool - For general GNU libtool +dnl - linux-pgcc - For Portland group under Linux +dnl +dnl Notes: +dnl Shared libraries are only partially implemented. Additional symbols +dnl will probably be defined, including symbols to specify how shared library +dnl search paths are specified and how shared library names are set. +dnl D*/ +AC_DEFUN([PAC_ARG_SHAREDLIBS],[ + +AC_ARG_ENABLE(shared, + AC_HELP_STRING([--enable-shared], [Enable shared library builds]),, + enable_shared=no) + +AC_ARG_ENABLE(rpath, + AC_HELP_STRING([--enable-rpath], + [Determine whether the rpath is set when programs are + compiled and linked when shared libraries are built. + The default is yes; use --disable-rpath to turn this + feature off; in that case, shared libraries will be + found according to the rules for your system (e.g., in + LD_LIBRARY_PATH)]),,enable_rpath=yes) + +AC_ARG_ENABLE(sharedlibs, +[ --enable-sharedlibs=kind - Enable shared libraries. kind may be + gcc - Standard gcc and GNU ld options for creating shared libraries + osx-gcc - Special options for gcc needed only on OS/X + solaris-cc - Solaris native (SPARC) compilers for 32 bit systems + cygwin-gcc - Special options for gcc needed only for cygwin + none - same as --disable-sharedlibs + Only gcc, osx-gcc, and solaris-cc are currently supported +],,enable_sharedlibs=default) + +if test "$enable_sharedlibs" = "default" ; then + if test "$enable_shared" = "yes" ; then + AS_CASE([$host], + [*-*-darwin*], [enable_sharedlibs=gcc-osx], + [*-*-cygwin*|*-*-mingw*|*-*-pw32*|*-*-cegcc*], [enable_sharedlibs=cygwin-gcc], + [*-*-sunos*], [enable_sharedlibs=solaris-gcc], + [enable_sharedlibs=gcc]) + else + enable_sharedlibs=none + fi +fi + +# If --enable-sharedlibs is given, but --enable-shared is not, throw +# an error +if test "$enable_sharedlibs" != "no" -a "$enable_sharedlibs" != "none" ; then + if test "$enable_shared" = "no" ; then + AC_MSG_ERROR([--enable-sharedlibs cannot be used without --enable-shared]) + fi +fi + +CC_SHL=true +C_LINK_SHL=true +C_LINKPATH_SHL="" +SHLIB_EXT=unknown +SHLIB_FROM_LO=no +SHLIB_INSTALL='$(INSTALL_PROGRAM)' +case "$enable_sharedlibs" in + no|none) + ;; + gcc-osx|osx-gcc) + AC_MSG_RESULT([Creating shared libraries using GNU for Mac OSX]) + C_LINK_SHL='${CC} -dynamiclib -undefined suppress -single_module -flat_namespace' + CC_SHL='${CC} -fPIC' + # No way in osx to specify the location of the shared libraries at link + # time (see the code in createshlib in mpich2/src/util) + # As of 10.5, -Wl,-rpath,dirname should work . The dirname + # must be a single directory, not a colon-separated list (use multiple + # -Wl,-rpath,path for each of the paths in the list). However, os x + # apparently records the library full path, so rpath isn't as useful + # as it is on other systems + C_LINKPATH_SHL="" + SHLIB_EXT="dylib" + enable_sharedlibs="osx-gcc" + ;; + gcc) + AC_MSG_RESULT([Creating shared libraries using GNU]) + # Not quite right yet. See mpich/util/makesharedlib + # Use syntax that works in both Make and the shell + #C_LINK_SHL='${CC} -shared -Wl,-r' + C_LINK_SHL='${CC} -shared' + # For example, include the libname as ${LIBNAME_SHL} + #C_LINK_SHL='${CC} -shared -Wl,-h,' + # May need -fPIC . Test to see which one works. + for sh_arg in "-fPIC" "-fpic" "-KPIC" ; do + PAC_C_CHECK_COMPILER_OPTION($sh_arg,works=yes,works=no) + if test "$works" = "yes" ; then + CC_SHL="${CC} ${sh_arg}" + break + fi + done + if test "$works" != "yes"; then + AC_MSG_ERROR([Cannot build shared libraries with this compiler]) + fi + # This used to have -Wl,-rpath earlier, but that causes problems + # on many systems. + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-Wl,-rpath," + fi + SHLIB_EXT=so + # We need to test that this isn't osx. The following is a + # simple hack + osname=`uname -s` + case $osname in + *Darwin*|*darwin*) + AC_MSG_ERROR([You must specify --enable-sharedlibs=osx-gcc for Mac OS/X]) + ;; + *CYGWIN*|*cygwin*) + AC_MSG_ERROR([You must specify --enable-sharedlibs=cygwin-gcc for Cygwin]) + ;; + *SunOS*) + AC_MSG_ERROR([You must specify --enable-sharedlibs=solaris-gcc for Solaris with gcc]) + ;; + esac + ;; + + cygwin|cygwin-gcc|gcc-cygwin) + AC_MSG_RESULT([Creating shared libraries using GNU under CYGWIN]) + C_LINK_SHL='${CC} -shared' + CC_SHL='${CC}' + # DLL Libraries need to be in the user's path (!) + C_LINKPATH_SHL="" + SHLIB_EXT="dll" + enable_sharedlibs="cygwin-gcc" + ;; + + libtool) + # set TRY_LIBTOOL to yes to experiment with libtool. You are on your + # own - only send fixes, not bug reports. + if test "$TRY_LIBTOOL" != yes ; then + AC_MSG_ERROR([Creating shared libraries using libtool not yet supported]) + else + # Using libtool requires a heavy-weight process to test for + # various stuff that libtool needs. Without this, you'll get a + # bizarre error message about libtool being unable to find + # configure.in or configure.ac (!) + # Libtool expects to see at least enable-shared. + if test "X$enable_shared" = "X" ; then enable_shared=yes ; fi + # Initialize libtool + # This works, but libtool version 2 places the object files + # in a different place, making it harder to integrate with + # our base approach. Disabling for now + dnl LT_PREREQ([2.2.6]) + dnl LT_INIT([disable-shared]) + AC_MSG_ERROR([To use this test verison, edit aclocal_shl.m4]) + # Likely to be + # either CC or CC_SHL is libtool $cc + CC_SHL='${LIBTOOL} --mode=compile ${CC}' + # CC_LINK_SHL includes the final installation path + # For many systems, the link may need to include *all* libraries + # (since many systems don't allow any unsatisfied dependencies) + # We need to give libtool the .lo file, not the .o files + SHLIB_FROM_LO=yes + # We also need to add -no-undefined when the compiler is gcc and + # we are building under cygwin + sysname=`uname -s | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` + isCygwin=no + case "$sysname" in + *CYGWIN*) isCygwin=yes ;; + esac + if test "$isCygwin" = yes ; then + C_LINK_SHL='${LIBTOOL} --mode=link ${CC} -no-undefined -rpath ${libdir}' + else + C_LINK_SHL='${LIBTOOL} --mode=link ${CC} -rpath ${libdir}' + fi + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-rpath " + fi + # We also need a special install process with libtool. Note that this + # will also install the static libraries + SHLIB_INSTALL='$(LIBTOOL) --mode=install $(INSTALL_PROGRAM)' + # Note we may still need to add + #'$(LIBTOOL) --mode=finish $(libdir)' + fi + ;; +dnl +dnl Other, such as solaris-cc + solaris|solaris-cc) + AC_MSG_RESULT([Creating shared libraries using Solaris]) + # pic32 is appropriate for both 32 and 64 bit Solaris + C_LINK_SHL='${CC} -G -xcode=pic32' + CC_SHL='${CC} -xcode=pic32' + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-R" + fi + SHLIB_EXT=so + enable_sharedlibs="solaris-cc" + ;; + + solaris-gcc) + # This is the same as gcc, except for the C_LINKPATH_SHL + AC_MSG_RESULT([Creating shared libraries using Solaris with gcc]) + C_LINK_SHL='${CC} -shared' + CC_SHL='${CC} -fPIC' + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-R" + fi + SHLIB_EXT=so + enable_sharedlibs="solaris-gcc" + ;; + + linuxppc-xlc) + # This is only the beginning of xlc support, thanks to andy@vpac.org + CC_SHL='${CC} -qmkshrobj' + # More recent versions allow multiple args, separated by commas + if test $enable_rpath = "yes" ; then + C_LINKPATH_SHL="-Wl,-rpath," + fi + #C_LINKPATH_SHL="-Wl,-rpath -Wl," + C_LINK_SHL='${CC} -shared -qmkshrobj' + SHLIB_EXT=so + # Note that the full line should be more like + # $CLINKER -shared -qmkshrobj -Wl,-h,$libbase.$slsuffix -o ../shared/$libbase.$slsuffix *.o $OtherLibs + # for the appropriate values of $libbase and $slsuffix + # The -h name sets the name of the object; this is necessary to + # ensure that the dynamic linker can find the proper shared library. + ;; + + *) + AC_MSG_ERROR([Unknown value $enable_sharedlibs for enable-sharedlibs. Values should be gcc or osx-gcc]) + enable_sharedlibs=no + ;; +esac +# Check for the shared-library extension +PAC_CC_SHLIB_EXT +dnl +AC_SUBST(CC_SHL) +AC_SUBST(C_LINK_SHL) +AC_SUBST(C_LINKPATH_SHL) +AC_SUBST(SHLIB_EXT) +AC_SUBST(SHLIB_FROM_LO) +AC_SUBST(SHLIB_INSTALL) +]) + +dnl /*D +dnl PAC_xx_SHAREDLIBS - Get compiler and linker for shared libraries +dnl These routines may be used to determine the compiler and the +dnl linker to be used in creating shared libraries +dnl Rather than set predefined variable names, they set an argument +dnl (if provided) +dnl +dnl Synopsis +dnl PAC_CC_SHAREDLIBS(type,CCvar,CLINKvar) +dnl D*/ +AC_DEFUN([PAC_CC_SHAREDLIBS], +[ +pac_kinds=$1 +ifelse($1,,[ + pac_prog="" + AC_CHECK_PROG(pac_prog,gcc,yes,no) + # If we are gcc but OS X, set the special type + # We need a similar setting for cygwin + if test "$pac_prog" = yes ; then + osname=`uname -s` + case $osname in + *Darwin*|*darwin*) pac_kinds=gcc-osx + ;; + *) pac_kinds=gcc + ;; + esac + fi + pac_prog="" + AC_CHECK_PROG(pac_prog,libtool,yes,no) + if test "$pac_prog" = yes ; then pac_kinds="$pac_kinds libtool" ; fi +]) +for pac_arg in $pac_kinds ; do + case $pac_arg in + gcc) + # For example, include the libname as ${LIBNAME_SHL} + #C_LINK_SHL='${CC} -shared -Wl,-h,' + pac_cc_sharedlibs='gcc -shared' + # Make sure we select the correct fpic option + PAC_C_CHECK_COMPILER_OPTION(-fPIC,fPIC_OK=yes,fPIC_OK=no) + if test "$fPIC_OK" != yes ; then + PAC_C_CHECK_COMPILER_OPTION(-fpic,fpic_ok=yes,fpic_ok=no) + if test "$fpic_ok" != yes ; then + AC_MSG_ERROR([Neither -fpic nor -fPIC accepted by $CC]) + else + pac_cc_sharedlibs="$pac_cc_sharedlibs -fpic" + fi + else + pac_cc_sharedlibs="$pac_cc_sharedlibs -fPIC" + fi + pac_clink_sharedlibs='gcc -shared' + pac_type_sharedlibs=gcc + ;; + gcc-osx|osx-gcc) + pac_clink_sharedlibs='${CC} -dynamiclib -undefined suppress -single_module -flat_namespace' + pac_cc_sharedlibs='${CC} -fPIC' + pac_type_sharedlibs=gcc-osx + ;; + libtool) + AC_CHECK_PROGS(LIBTOOL,libtool,false) + if test "$LIBTOOL" = "false" ; then + AC_MSG_WARN([Could not find libtool]) + else + # Likely to be + # either CC or CC_SHL is libtool $cc + pac_cc_sharedlibs'${LIBTOOL} -mode=compile ${CC}' + pac_clink_sharedlibs='${LIBTOOL} -mode=link ${CC} -rpath ${libdir}' + pac_type_sharedlibs=libtool + fi + ;; + *) + ;; + esac + if test -n "$pac_cc_sharedlibs" ; then break ; fi +done +if test -z "$pac_cc_sharedlibs" ; then pac_cc_sharedlibs=true ; fi +if test -z "$pac_clink_sharedlibs" ; then pac_clink_sharedlibs=true ; fi +ifelse($2,,CC_SHL=$pac_cc_sharedlibs,$2=$pac_cc_sharedlibs) +ifelse($3,,C_LINK_SHL=$pac_clink_sharedlibs,$3=$pac_clink_sharedlibs) +ifelse($4,,SHAREDLIB_TYPE=$pac_type_sharedlibs,$4=$pac_type_sharedlibs) +]) + +dnl This macro ensures that all of the necessary substitutions are +dnl made by any subdirectory configure (which may simply SUBST the +dnl necessary values rather than trying to determine them from scratch) +dnl This is a more robust (and, in the case of libtool, only +dnl managable) method. +AC_DEFUN([PAC_CC_SUBDIR_SHLIBS],[ + AC_SUBST(CC_SHL) + AC_SUBST(C_LINK_SHL) + AC_SUBST(LIBTOOL) + AC_SUBST(ENABLE_SHLIB) + AC_SUBST(SHLIB_EXT) + if test "$ENABLE_SHLIB" = "libtool" ; then + if test -z "$LIBTOOL" ; then + AC_MSG_WARN([libtool selected for shared library support but LIBTOOL is not defined]) + fi + # Libtool needs master_top_builddir + if test "X$master_top_builddir" = "X" ; then + AC_MSG_ERROR([Libtool requires master_top_builddir - check configure.in sources]) + fi + AC_SUBST(master_top_builddir) + fi +]) + +dnl PAC_CC_SHLIB_EXT - get the extension for shared libraries +dnl Set the variable SHLIB_EXT if it is other than unknown. +AC_DEFUN([PAC_CC_SHLIB_EXT],[ +# Not all systems use .so as the extension for shared libraries (cygwin +# and OSX are two important examples). If we did not set the SHLIB_EXT, +# then try and determine it. We need this to properly implement +# clean steps that look for libfoo.$SHLIB_EXT . +if test "$SHLIB_EXT" = "unknown" ; then + osname=`uname -s` + case $osname in + *Darwin*|*darwin*) SHLIB_EXT=dylib + ;; + *CYGWIN*|*cygwin*) SHLIB_EXT=dll + ;; + *Linux*|*LINUX*|*SunOS*) SHLIB_EXT=so + ;; + esac +fi +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_subcfg.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_subcfg.m4 new file mode 100644 index 0000000000..31ce09fe00 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_subcfg.m4 @@ -0,0 +1,137 @@ +dnl PAC_RESET_ALL_FLAGS - Reset precious flags to those set by the user +AC_DEFUN([PAC_RESET_ALL_FLAGS],[ + if test "$FROM_MPICH2" = "yes" ; then + CFLAGS="$USER_CFLAGS" + CPPFLAGS="$USER_CPPFLAGS" + CXXFLAGS="$USER_CXXFLAGS" + FFLAGS="$USER_FFLAGS" + FCFLAGS="$USER_FCFLAGS" + LDFLAGS="$USER_LDFLAGS" + LIBS="$USER_LIBS" + fi +]) + +dnl PAC_RESET_LINK_FLAGS - Reset precious link flags to those set by the user +AC_DEFUN([PAC_RESET_LINK_FLAGS],[ + if test "$FROM_MPICH2" = "yes" ; then + LDFLAGS="$USER_LDFLAGS" + LIBS="$USER_LIBS" + fi +]) + +dnl Sandbox configure with additional arguments +dnl Usage: PAC_CONFIG_SUBDIR_ARGS(subdir,configure-args,action-if-success,action-if-failure) +dnl +dnl The subconfigure argument list is created based on "ac_precious_vars" +dnl instead of explicitly use of well-known Makefile variables, like +dnl CC/CFLAGS/CPPFLAGS..., this generalization is effective as long as +dnl calling configure.in declares the needed variables to be passed down +dnl to subconfigure as "precious" appropriately. The precious variable +dnl can be created in the following ways: +dnl 1) implicit declaration through use of autoconf macros, like +dnl AC_PROG_CC (declares CC/CFLAGS/CPPFLAGS/LIBS/LDFLAGS), or +dnl AC_PROG_F77 (declares F77/FFLAGS/FLIBS) ... +dnl which are in turns invoked by other subconfigure. +dnl When in doubt, check "ac_precious_var" in the calling configure. +dnl 2) explicit "precious" declaration through AC_ARG_VAR. +dnl Without correct "precious" declaration in the calling configure.in, +dnl there would be variables not being included in the subconfigure +dnl argument list. +dnl +dnl Note: I suspect this DEFUN body is underquoted in places, but it does not +dnl seem to cause problems in practice yet. [goodell@ 2010-05-18] +AC_DEFUN([PAC_CONFIG_SUBDIR_ARGS],[ + AC_MSG_NOTICE([===== configuring $1 =====]) + + PAC_MKDIRS($1) + pac_abs_srcdir=`(cd $srcdir && pwd)` + + if test -f $pac_abs_srcdir/$1/setup ; then + . $pac_abs_srcdir/$1/setup + fi + + pac_subconfigure_file="$pac_abs_srcdir/$1/configure" + if test -x $pac_subconfigure_file ; then + pac_subconfig_args="$2" + + # Set IFS so ac_configure_args can be tokenized + # with extra " " tokens being skipped. + PAC_PUSH_FLAG([IFS]) + IFS="'" + for pac_arg in $ac_configure_args ; do + case "$pac_arg" in + # Ignore any null and leading blank strings. + ""|" "*) + ;; + *) + pac_pval="" + # Restore IFS so ac_precious_vars which has + # " " as separator can be correctly tokenized + PAC_POP_FLAG([IFS]) + for pac_pvar in $ac_precious_vars ; do + # check if configure argument token contains the + # precious variable, i.e. "name_of_prec_var=". + pvar_in_arg=`echo $pac_arg | grep "$pac_pvar="` + if test "X$pvar_in_arg" != "X" ; then + # check if current precious variable is set in env + eval pvar_set=\${$pac_pvar+set} + if test "$pvar_set" = "set" ; then + # Append 'name_of_prec_var=value_of_prec_var' + # to the subconfigure arguments list, where + # value_of_prec_var is fetched from the env. + eval pac_pval=\${$pac_pvar} + pac_subconfig_args="$pac_subconfig_args '$pac_pvar=$pac_pval'" + break + fi + fi + done + # since the precious variable is not set in the env., + # append the corresponding configure argument token + # to the subconfigure argument list. + if test "X$pac_pval" = "X" ; then + pac_subconfig_args="$pac_subconfig_args '$pac_arg'" + fi + # reset "'" as IFS to process ac_configure_args + PAC_PUSH_FLAG([IFS]) + IFS="'" + ;; + esac + done + # Restore IFS. + PAC_POP_FLAG([IFS]) + dnl echo "pac_subconfig_args = |$pac_subconfig_args|" + + dnl Add option to disable configure options checking + if test "$enable_option_checking" = no ; then + pac_subconfig_args="$pac_subconfig_args --disable-option-checking" + fi + + AC_MSG_NOTICE([executing: $pac_subconfigure_file $pac_subconfig_args]) + if (cd $1 && eval $pac_subconfigure_file $pac_subconfig_args) ; then + ifelse([$3],[],[:],[$3]) + else + ifelse([$4],[],[:],[$4]) + fi + else + if test -e $pac_subconfigure_file ; then + AC_MSG_WARN([$pac_subconfigure_file exists but is not executable]) + else + AC_MSG_WARN([$pac_subconfigure_file does not exist]) + fi + fi + + AC_MSG_NOTICE([===== done with $1 configure =====]) + + # Check for any localdefs files. These may be created, so we + # look in the local directory first. + if test -f $1/localdefs ; then + . $1/localdefs + elif test -f $pac_abs_srcdir/$1/localdefs ; then + . $pac_abs_srcdir/$1/localdefs + fi +]) + +dnl Sandbox configure +dnl Usage: PAC_CONFIG_SUBDIR(subdir,action-if-success,action-if-failure) +AC_DEFUN([PAC_CONFIG_SUBDIR],[PAC_CONFIG_SUBDIR_ARGS([$1],[],[$2],[$3])]) + diff --git a/src/libs/ck-libs/ampi/romio/confdb/aclocal_util.m4 b/src/libs/ck-libs/ampi/romio/confdb/aclocal_util.m4 new file mode 100644 index 0000000000..6bea8acf6f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/aclocal_util.m4 @@ -0,0 +1,191 @@ +dnl Nesting safe macros for saving variables +dnl Usage: PAC_PUSH_FLAG(CFLAGS) +AC_DEFUN([PAC_PUSH_FLAG],[ + if test -z "${pac_save_$1_nesting}" ; then + pac_save_$1_nesting=0 + fi + eval pac_save_$1_${pac_save_$1_nesting}='"$$1"' + pac_save_$1_nesting=`expr ${pac_save_$1_nesting} + 1` +]) + +dnl Usage: PAC_POP_FLAG(CFLAGS) +AC_DEFUN([PAC_POP_FLAG],[ + pac_save_$1_nesting=`expr ${pac_save_$1_nesting} - 1` + eval $1="\$pac_save_$1_${pac_save_$1_nesting}" + eval pac_save_$1_${pac_save_$1_nesting}="" +]) + +dnl Usage: PAC_PUSH_ALL_FLAGS +AC_DEFUN([PAC_PUSH_ALL_FLAGS],[ + PAC_PUSH_FLAG(CFLAGS) + PAC_PUSH_FLAG(CPPFLAGS) + PAC_PUSH_FLAG(CXXFLAGS) + PAC_PUSH_FLAG(FFLAGS) + PAC_PUSH_FLAG(FCFLAGS) + PAC_PUSH_FLAG(LDFLAGS) + PAC_PUSH_FLAG(LIBS) +]) + +dnl Usage: PAC_POP_ALL_FLAGS +AC_DEFUN([PAC_POP_ALL_FLAGS],[ + PAC_POP_FLAG(CFLAGS) + PAC_POP_FLAG(CPPFLAGS) + PAC_POP_FLAG(CXXFLAGS) + PAC_POP_FLAG(FFLAGS) + PAC_POP_FLAG(FCFLAGS) + PAC_POP_FLAG(LDFLAGS) + PAC_POP_FLAG(LIBS) +]) + +dnl PAC_PREFIX_FLAG - Save flag with a prefix +dnl Usage: PAC_PREFIX_FLAG(PREFIX, FLAG) +AC_DEFUN([PAC_PREFIX_FLAG],[ + $1_$2=$$2 + export $1_$2 + AC_SUBST($1_$2) +]) + +dnl PAC_PREFIX_ALL_FLAGS - Save flags with a prefix +dnl Usage: PAC_PREFIX_ALL_FLAGS(PREFIX) +AC_DEFUN([PAC_PREFIX_ALL_FLAGS],[ + PAC_PREFIX_FLAG($1, CFLAGS) + PAC_PREFIX_FLAG($1, CPPFLAGS) + PAC_PREFIX_FLAG($1, CXXFLAGS) + PAC_PREFIX_FLAG($1, FFLAGS) + PAC_PREFIX_FLAG($1, FCFLAGS) + PAC_PREFIX_FLAG($1, LDFLAGS) + PAC_PREFIX_FLAG($1, LIBS) +]) + +dnl Usage: PAC_APPEND_FLAG([-02], [CFLAGS]) +dnl appends the given argument to the specified shell variable unless the +dnl argument is already present in the variable +AC_DEFUN([PAC_APPEND_FLAG],[ + AC_REQUIRE([AC_PROG_FGREP]) + AS_IF( + [echo "$$2" | $FGREP -e '$1' >/dev/null 2>&1], + [echo "$2(='$$2') contains '$1', not appending" >&AS_MESSAGE_LOG_FD], + [echo "$2(='$$2') does not contain '$1', appending" >&AS_MESSAGE_LOG_FD + $2="$$2 $1"] + ) +]) + +dnl Usage: PAC_PREPEND_FLAG([-lpthread], [LIBS]) +dnl Prepends the given argument to the specified shell variable unless the +dnl argument is already present in the variable. +dnl +dnl This is typically used for LIBS and similar variables because libraries +dnl should be added in reverse order. +AC_DEFUN([PAC_PREPEND_FLAG],[ + AC_REQUIRE([AC_PROG_FGREP]) + AS_IF( + [echo "$$2" | $FGREP -e '$1' >/dev/null 2>&1], + [echo "$2(='$$2') contains '$1', not prepending" >&AS_MESSAGE_LOG_FD], + [echo "$2(='$$2') does not contain '$1', prepending" >&AS_MESSAGE_LOG_FD + $2="$1 $$2"] + ) +]) + + +dnl PAC_MKDIRS(path) +dnl Create any missing directories in the path +AC_DEFUN([PAC_MKDIRS],[ +# Build any intermediate directories +for dir in $1 ; do + PAC_PUSH_FLAG([IFS]) + IFS="/" + tmp_curdir="" + for tmp_subdir in $dir ; do + tmp_curdir="${tmp_curdir}$tmp_subdir" + if test ! -d "$tmp_curdir" ; then mkdir "$tmp_curdir" ; fi + tmp_curdir="${tmp_curdir}/" + done + PAC_POP_FLAG([IFS]) +done +]) + +# Find something to use for mkdir -p. Eventually, this will have a +# script for backup. As of autoconf-2.63, AC_PROG_MKDIR_P was broken; +# it was checking to see if it recognized the "version" of mkdir and +# was deciding based on that. This should always be a feature test. +AC_DEFUN([PAC_PROG_MKDIR_P],[ +AC_CACHE_CHECK([whether mkdir -p works], +pac_cv_mkdir_p,[ +pac_cv_mkdir_p=no +rm -rf .tmp +if mkdir -p .tmp/.foo 1>/dev/null 2>&1 ; then + if test -d .tmp/.foo ; then + pac_cv_mkdir_p=yes + fi +fi +rm -rf .tmp +]) +if test "$pac_cv_mkdir_p" = "yes" ; then + MKDIR_P="mkdir -p" + export MKDIR_P +else + AC_MSG_WARN([mkdir -p does not work; the install step may fail]) +fi +AC_SUBST(MKDIR_P) +]) + +dnl Test for a clean VPATH directory. Provide this command with the names +dnl of all of the generated files that might cause problems +dnl (Makefiles won't cause problems because there's no VPATH usage for them) +dnl +dnl Synopsis +dnl PAC_VPATH_CHECK([file-names],[directory-names]) +dnl file-names should be files other than config.status and any header (e.g., +dnl fooconf.h) file that should be removed. It is optional +AC_DEFUN([PAC_VPATH_CHECK],[ +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +date >conftest$$ +# If creating a file in the current directory does not show up in the srcdir +# then we're doing a VPATH build (or something is very wrong) +if test ! -s $srcdir/conftest$$ ; then + pac_dirtyfiles="" + pac_dirtydirs="" + pac_header="" + ifdef([AC_LIST_HEADER],[pac_header=AC_LIST_HEADER]) + for file in config.status $pac_header $1 ; do + if test -f $srcdir/$file ; then + pac_dirtyfiles="$pac_dirtyfiles $file" + fi + done + ifelse($2,,,[ + for dir in $2 ; do + if test -d $srcdir/$dir ; then + pac_dirtydirs="$pac_dirtydirs $dir" + fi + done + ]) + + if test -n "$pac_dirtyfiles" -o -n "$pac_dirtydirs" ; then + # Create a nice message about what to remove + rmmsg="" + if test -n "$pac_dirtyfiles" ; then + rmmsg="files $pac_dirtyfiles" + fi + if test -n "$pac_dirtydirs" ; then + if test -n "$rmmsg" ; then + rmmsg="$rmmsg and directories $pac_dirtydirs" + else + rmmsg="directories $pac_dirtydirs" + fi + fi + if test -f $srcdir/Makefile ; then + AC_MSG_ERROR([You cannot do a VPATH build if the source directory has been + configured. Run "make distclean" in $srcdir first and make sure that the + $rmmsg have been removed.]) + else + AC_MSG_ERROR([You cannot do a VPATH build if the source directory has been + configured. Remove the $rmmsg in $srcdir.]) + fi + fi +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/ax_prefix_config_h.m4 b/src/libs/ck-libs/ampi/romio/confdb/ax_prefix_config_h.m4 new file mode 100644 index 0000000000..83f8df6f4b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/ax_prefix_config_h.m4 @@ -0,0 +1,219 @@ +# =========================================================================== +# http://autoconf-archive.cryp.to/ax_prefix_config_h.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])] +# +# DESCRIPTION +# +# This is a new variant from ac_prefix_config_ this one will use a +# lowercase-prefix if the config-define was starting with a +# lowercase-char, e.g. "#define const", "#define restrict", or "#define +# off_t", (and this one can live in another directory, e.g. +# testpkg/config.h therefore I decided to move the output-header to be the +# first arg) +# +# takes the usual config.h generated header file; looks for each of the +# generated "#define SOMEDEF" lines, and prefixes the defined name (ie. +# makes it "#define PREFIX_SOMEDEF". The result is written to the output +# config.header file. The PREFIX is converted to uppercase for the +# conversions. +# +# Defaults: +# +# OUTPUT-HEADER = $PACKAGE-config.h +# PREFIX = $PACKAGE +# ORIG-HEADER, from AM_CONFIG_HEADER(config.h) +# +# Your configure.ac script should contain both macros in this order, and +# unlike the earlier variations of this prefix-macro it is okay to place +# the AX_PREFIX_CONFIG_H call before the AC_OUTPUT invokation. +# +# Example: +# +# AC_INIT(config.h.in) # config.h.in as created by "autoheader" +# AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE +# AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in +# AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it.. +# AC_MEMORY_H # makes "#undef NEED_MEMORY_H" +# AC_C_CONST_H # makes "#undef const" +# AC_OUTPUT(Makefile) # creates the "config.h" now +# # and also mylib/_config.h +# +# if the argument to AX_PREFIX_CONFIG_H would have been omitted then the +# default outputfile would have been called simply "testpkg-config.h", but +# even under the name "mylib/_config.h" it contains prefix-defines like +# +# #ifndef TESTPKG_VERSION +# #define TESTPKG_VERSION "0.1.1" +# #endif +# #ifndef TESTPKG_NEED_MEMORY_H +# #define TESTPKG_NEED_MEMORY_H 1 +# #endif +# #ifndef _testpkg_const +# #define _testpkg_const _const +# #endif +# +# and this "mylib/_config.h" can be installed along with other +# header-files, which is most convenient when creating a shared library +# (that has some headers) where some functionality is dependent on the +# OS-features detected at compile-time. No need to invent some +# "mylib-confdefs.h.in" manually. :-) +# +# Note that some AC_DEFINEs that end up in the config.h file are actually +# self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the AC_TYPE_OFF_T +# say that they "will define inline|const|off_t if the system does not do +# it by itself". You might want to clean up about these - consider an +# extra mylib/conf.h that reads something like: +# +# #include +# #ifndef _testpkg_const +# #define _testpkg_const const +# #endif +# +# and then start using _testpkg_const in the header files. That is also a +# good thing to differentiate whether some library-user has starting to +# take up with a different compiler, so perhaps it could read something +# like this: +# +# #ifdef _MSC_VER +# #include +# #else +# #include +# #endif +# #ifndef _testpkg_const +# #define _testpkg_const const +# #endif +# +# LAST MODIFICATION +# +# 2008-04-12 +# +# COPYLEFT +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2008 Marten Svantesson +# Copyright (c) 2008 Gerald Point +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Macro Archive. When you make and +# distribute a modified version of the Autoconf Macro, you may extend this +# special exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl +AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl +AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl +AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl +AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl +AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl +AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl +AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl +AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl +m4_pushdef([_script],[conftest.prefix])dnl +m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl +_OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)` +_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"` +_PKG=`echo ifelse($2, , $PACKAGE, $2)` +_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"` +_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"` +_INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'` +if test ".$_INP" = "."; then + for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue + case "$ac_file" in + *.h) _INP=$ac_file ;; + *) + esac + test ".$_INP" != "." && break + done +fi +if test ".$_INP" = "."; then + case "$_OUT" in + */*) _INP=`basename "$_OUT"` + ;; + *-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"` + ;; + *) _INP=config.h + ;; + esac +fi +if test -z "$_PKG" ; then + AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H]) +else + if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then + _INP="$srcdir/$_INP" + fi fi + AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines) + if test -f $_INP ; then + echo "s/^@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script + echo "s/^@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script + echo "s/^@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script + echo "@%:@def[]ine $_UPP""_\\1 \\2 \\" >> _script + echo "@%:@endif/" >>_script + echo "s/^@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script + echo "@%:@define $_LOW""_\\1 \\2 \\" >> _script + echo "@%:@endif/" >> _script + # now executing _script on _DEF input to create _OUT output file + echo "@%:@ifndef $_DEF" >$tmp/pconfig.h + echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h + echo ' ' >>$tmp/pconfig.h + echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h + + sed -f _script $_INP >>$tmp/pconfig.h + echo ' ' >>$tmp/pconfig.h + echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h + echo "@%:@endif" >>$tmp/pconfig.h + if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then + AC_MSG_NOTICE([$_OUT is unchanged]) + else + ac_dir=`AS_DIRNAME(["$_OUT"])` + AS_MKDIR_P(["$ac_dir"]) + rm -f "$_OUT" + mv $tmp/pconfig.h "$_OUT" + fi + cp _script _configs.sed + else + AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT]) + fi + rm -f conftest.* +fi +m4_popdef([_symbol])dnl +m4_popdef([_script])dnl +AS_VAR_POPDEF([_INP])dnl +AS_VAR_POPDEF([_UPP])dnl +AS_VAR_POPDEF([_LOW])dnl +AS_VAR_POPDEF([_PKG])dnl +AS_VAR_POPDEF([_DEF])dnl +AS_VAR_POPDEF([_OUT])dnl +],[PACKAGE="$PACKAGE"])]) + +dnl implementation note: a bug report (31.5.2005) from Marten Svantesson points +dnl out a problem where `echo "\1"` results in a Control-A. The unix standard +dnl http://www.opengroup.org/onlinepubs/000095399/utilities/echo.html +dnl defines all backslash-sequences to be inherently non-portable asking +dnl for replacement mit printf. Some old systems had problems with that +dnl one either. However, the latest libtool (!) release does export an $ECHO +dnl (and $echo) that does the right thing - just one question is left: what +dnl was the first version to have it? Is it greater 2.58 ? diff --git a/src/libs/ck-libs/ampi/romio/confdb/ax_tls.m4 b/src/libs/ck-libs/ampi/romio/confdb/ax_tls.m4 new file mode 100644 index 0000000000..f7fc68840b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/ax_tls.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# http://www.nongnu.org/autoconf-archive/ax_tls.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_TLS +# +# DESCRIPTION +# +# Provides a test for the compiler support of thread local storage (TLS) +# extensions. Defines TLS if it is found. Currently only knows about GCC +# and MSVC. I think SunPro uses the same as GCC, and Borland apparently +# supports either. +# +# LICENSE +# +# Copyright (c) 2008 Alan Woodland +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_TLS], [ + AC_MSG_CHECKING(for thread local storage specifier) + AC_CACHE_VAL(ac_cv_tls, [ + ax_tls_keywords="__thread __declspec(thread) none" + for ax_tls_keyword in $ax_tls_keywords; do + case $ax_tls_keyword in + none) ac_cv_tls=none ; break ;; + *) + # MPICH2 modification: This was an AC_TRY_COMPILE before, but + # Darwin with non-standard compilers will accept __thread at + # compile time but fail to link due to an undefined + # "__emutls_get_address" symbol unless -lgcc_eh is added to the + # link line. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([$ax_tls_keyword int bar = 5;],[++bar;])], + [ac_cv_tls=$ax_tls_keyword ; break], + [ac_cv_tls=none]) + esac + done +]) + + if test "$ac_cv_tls" != "none"; then + # MPICH2 modification: this was "TLS" before instead of + # "MPIU_TLS_SPECIFIER", but TLS had a reasonably high chance of conflicting + # with a system library. + AC_DEFINE_UNQUOTED([MPIU_TLS_SPECIFIER], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here]) + fi + AC_MSG_RESULT($ac_cv_tls) +]) diff --git a/src/libs/ck-libs/ampi/romio/confdb/config.guess b/src/libs/ck-libs/ampi/romio/confdb/config.guess new file mode 100755 index 0000000000..dc84c68ef7 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/config.guess @@ -0,0 +1,1501 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Free Software Foundation, Inc. + +timestamp='2009-11-20' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/libs/ck-libs/ampi/romio/confdb/config.sub b/src/libs/ck-libs/ampi/romio/confdb/config.sub new file mode 100755 index 0000000000..2a55a50751 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/config.sub @@ -0,0 +1,1705 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Free Software Foundation, Inc. + +timestamp='2009-11-20' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/libs/ck-libs/ampi/romio/confdb/depcomp b/src/libs/ck-libs/ampi/romio/confdb/depcomp new file mode 100755 index 0000000000..df8eea7e4c --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/depcomp @@ -0,0 +1,630 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free +# Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u="sed s,\\\\\\\\,/,g" + depmode=msvisualcpp +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/src/libs/ck-libs/ampi/romio/confdb/install-sh b/src/libs/ck-libs/ampi/romio/confdb/install-sh new file mode 100755 index 0000000000..6781b987bd --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/install-sh @@ -0,0 +1,520 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2009-04-28.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/src/libs/ck-libs/ampi/romio/confdb/missing b/src/libs/ck-libs/ampi/romio/confdb/missing new file mode 100755 index 0000000000..28055d2ae6 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/confdb/missing @@ -0,0 +1,376 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + tar*) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar*) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/src/libs/ck-libs/ampi/romio/configure b/src/libs/ck-libs/ampi/romio/configure dissimilarity index 81% index 5f507b1793..aa0164b8b6 100755 --- a/src/libs/ck-libs/ampi/romio/configure +++ b/src/libs/ck-libs/ampi/romio/configure @@ -1,5269 +1,15669 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf. -# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -progname="`echo $0 | sed 's:^\./\./:\./:'`" -print_error() { - echo "*# $*" 2>&1 ; - } -usage_msg=" -Usage: ${progname} [-file_system=FILE_SYSTEM] [-arch=ARCH_TYPE] [-mpi=MPI_IMPL] - [-mpiincdir=MPI_INCLUDE_DIR] [-mpilib=MPI_LIBRARY] - [-mpibindir=MPI_BIN_DIR] - [-cc=C_COMPILER] [-fc=FORTRAN_COMPILER] [-nof77] - [-cflags=CFLAGS] [-fflags=FFLAGS] [-f90=F90_COMPILER] [-debug] - [-make=MAKEPGM] [-mpiolib=MPIO_LIBRARY] [-ar_nolocal] - [-noranlib] [-ar=AR_COMMAND] [-prefix=INSTALL_DIR] - [-intsize=INTSIZE] [-ptrsize=PTRSIZE] [-longsize=LONGSIZE] - [-longlongsize=LONGLONGSIZE] [-f90nag] [-disable-weak-symbols] - -where - FILE_SYSTEM = the file system(s) for which ROMIO is to be configured. - Valid values are pfs, piofs, hfs, xfs, sfs, pvfs, ufs, - and nfs (case-sensitive). They correspond to Intel's PFS, - IBM's PIOFS, HP/Convex's HFS, SGI's XFS, NEC's SFS, - Clemson University's PVFS (for Linux clusters), any Unix - file system, and NFS. - To configure for multiple file systems, use "+" as a - separator; e.g., ufs+nfs - ARCH_TYPE = the type of machine for which ROMIO is to be configured. - Not needed on most machines, because ROMIO can usually - find the arch_type on its own. Needed if you are - cross-compiling for a different architecture. - Valid values are sun4, solaris, solaris86, rs6000, - paragon, hpux, sppux, IRIX, IRIX32, IRIXN32, IRIX64, SX4, - alpha, freebsd, LINUX, and LINUX_ALPHA. (case-sensitive) - MPI_IMPL = the MPI implementation with which ROMIO will be used - Valid values are mpich, sgi, hp. (case-sensitive) - Valid implementations are MPICH 1.1.1 or higher, - SGI's MPI 3.1 or higher, HP MPI 1.3 or higher, LAM, - and Cray MPI. - MPI_INCLUDE_DIR = the full path of the directory where mpi.h is located. - Not needed if the directory is in the compiler's - default include path - MPI_LIBRARY = name of the file containing the MPI library (full path). - Not needed if the library is in the compiler's default - list of libraries - MPI_BIN_DIR = the full path of the directory that contains the MPI - versions of the compilers, such as mpicc and mpif77. - Use only if the ROMIO configure cannot find the - necessary commands - C_COMPILER = the C compiler to use. If not specified, ROMIO uses a - default compiler depending on the machine. - FORTRAN_COMPILER = the Fortran compiler to use. If not specified, ROMIO - uses a default compiler depending on the machine. - CFLAGS = flags to give to the C compiler - FFLAGS = flags to give to the Fortran compiler - F90_COMPILER = the Fortran 90 compiler to use. If not specified, - ROMIO uses f90. - MPIO_LIBRARY = name of the MPI-IO library to be built (full path). - Default is "this_directory"/lib/ARCH_TYPE/libmpio.a. - MAKEPGM = name of the make program to use - AR_COMMAND = an alternate archiver (ar) command to use. - INSTALL_DIR = directory where ROMIO is to be installed - INTSIZE = size of int in bytes. - PTRSIZE = size of pointers in bytes. - LONGSIZE = size of long in bytes. - LONGLONGSIZE = size of long long in bytes. - -The options '-mpiincdir' and '-mpilib' may be needed if the MPI include file -and MPI library are not in the compiler's default path. - -The option '-nof77' prevents the compilation of routines that require a -Fortran compiler. If you select this option, you cannot use the -Fortran interface of MPI-IO. - -The option '-f90nag' allows you to use the NAG Fortran 90 compiler -instead of Fortran 77. - -The option '-make' may be used to select an alternate make program. ROMIO -uses "make" by default. - -If '-debug' is used, ROMIO will be configured with the '-g' compiler option -for debugging. - -The option '-ar_nolocal' prevents the library archive command from -attempting to use the local directory for temporary space. This option -should be used when (a) there isn't much space (less than 10 MB) -available in the partition where ROMIO resides and (b) there is enough -space in /tmp (or wherever ar places temporary files by default). - -The option '-noranlib' causes the 'ranlib' step (needed on some systems -to build an object library) to be skipped. This is particularly useful -on systems where 'ranlib' is optional (allowed but not needed; because it -is allowed, configure chooses to use it just in case) but can fail (some -'ranlib's are implemented as scripts using 'ar'; if they don't use the -local directory, they can fail (destroying the library in the process) if -the temporary directory (usually '/tmp') does not have enough space. - -The option -disable-weak-symbols disables the use of weak symbols, even if -available, for building the profiling interface. -" -# -echo " " -echo "Configuring ROMIO Version 1.2.3" -echo " " -CONFIGURE_ARGS="$*" -if test -n "$CONFIGURE_ARGS" ; then - echo "Configuring with args $CONFIGURE_ARGS" -fi -# -# rm -f include/*.h -# -NOF77=0 -ARCH="" -arch_IRIX="" -MPI="" -MPI_INCLUDE_DIR="" -ROMIO_INCLUDE="" -MPI_LIB="" -LIBNAME="" -TEST_LIBNAME="" -FILE_SYSTEM="" -PREFIX="" -DEBUG=no -MIPS=0 -BITS=0 -FROM_MPICH=0 -CFLAGS=${CFLAGS:-""} -LL="\%lld" -AR_LOCAL=l -HAVE_MPI_INFO="" -BUILD_MPI_INFO="" -MPI_FINFO1="" -MPI_FINFO2="" -MPI_FINFO3="" -MPI_FINFO4="" -MPI_FARRAY1="" -MPI_FARRAY2="" -MPI_FARRAY3="" -MPI_FARRAY4="" -MPI_FARRAY5="" -MPI_FARRAY6="" -MPI_FARRAY7="" -DEFS="" -ROMIO_LFLAGS="" -ROMIO_LIBLIST="" -ROMIO_TCFLAGS="" -ROMIO_TCPPFLAGS="" -ROMIO_TFFLAGS="" -NOPROFILE=0 -MPIRUN="" -FORTRAN_TEST="" -MAKE=${MAKE:-"make"} -# foll. needed for f77 test programs -F77GETARG="call getarg(i,str)" -F77IARGC="iargc()" -FTESTDEFINE="" -FORTRAN_MPI_OFFSET="integer(kind=MPI_OFFSET_KIND)" -MPIOF_H_INCLUDED=0 -MPI_OFFSET_KIND1="!" -MPI_OFFSET_KIND2="!" -F90="" -TEST_CC="" -TEST_F77="" -TRY_WEAK_SYMBOLS=1 -# -known_filesystems="nfs ufs pfs piofs pvfs testfs xfs hfs sfs" -known_mpi_impls="mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi" -# -# Defaults -enable_aio=notgiven -# -for arg -do -case $arg in - -arch=* | --arch=*) - ARCH=`echo $arg|sed 's/-*arch=//'` - eval "arch_`echo $ARCH`=1" - ;; - - -with-file-system=* | --with-file-system=* ) - FILE_SYSTEM=`echo $arg|sed 's/-*with-file-system=//' | sed -e 's/\+/ /g'` - for x in $FILE_SYSTEM - do - eval "file_system_`echo $x`=1" - done - ;; - -file_system=* | --file_system=* ) - # DEPRECATED FORMAT - FILE_SYSTEM=`echo $arg|sed 's/-*file_system=//' | sed -e 's/\+/ /g'` - for x in $FILE_SYSTEM - do - eval "file_system_`echo $x`=1" - done - ;; - - --enable-aio | -enable-aio) - enable_aio=yes - ;; - --disable-aio | -disable-aio) - enable_aio=no - ;; - -with-mpi=* | --with-mpi=*) - MPI=`echo $arg|sed 's/-*with-mpi=//'` - eval "mpi_`echo $MPI`=1" - ;; - -mpi=* | --mpi=*) - # DEPRECATED FORMAT - MPI=`echo $arg|sed 's/-*mpi=//'` - eval "mpi_`echo $MPI`=1" - ;; - # OTHER ARGS ARE DEPRECATED AND SHOULD BE PROVIDED THROUGH ENV VARIABLES - -mpiincdir=* | --mpiincdir=*) - MPI_INCLUDE_DIR=`echo $arg|sed 's/-*mpiincdir=//'` - ;; - -mpibindir=* | --mpibindir=*) - MPI_BIN_DIR=`echo $arg|sed 's/-*mpibindir=//'` - ;; - -mpilib=* | --mpilib=*) - MPI_LIB=`echo $arg|sed 's/-*mpilib=//'` - ;; - -mpiolib=* | --mpiolib=*) - LIBNAME=`echo $arg|sed 's/-*mpiolib=//'` - ;; - - # THE FOLLOWING SHOULD BE PROVIDED THROUGH ENV VARIABLES - -cc=* | --cc=*) - CC=`echo $arg|sed 's/-*cc=//'` - ;; - -fc=* | --fc=*) - FC=`echo $arg|sed 's/-*fc=//'` - ;; - -f90=* | --f90=*) - F90=`echo A$arg|sed 's/A-*f90=//'` - ;; - -f90nag | --f90nag) - FC=f90 - F77GETARG="call f90_unix_MP_getarg(i,str)" - F77IARGC="f90_unix_MP_iargc()" - ;; - -cflags=* | --cflags=*) - package="`echo $arg|sed 's/-*cflags=//'`" - USER_CFLAGS="$package" - CFLAGS="$package $CFLAGS" - ;; - -fflags=* | --fflags=*) - package="`echo $arg|sed 's/-*fflags=//'`" - FFLAGS="$FFLAGS $package" - ;; - -make=* | --make=*) - package=`echo $arg|sed 's/-*make=//'` - MAKE="$package" - ;; - # END OF VALUES THAT SHOULD BE PROVIDED THROUGH ENV VARIABLES - - -nof77 | --nof77 | -disable-f77 | --disable-f77 ) - echo "Fortran interface will not be built" - NOF77=1 - ;; - - -debug | --debug | --enable-g | -enable-g) - echo "Configuring for a debugging version" - DEBUG=yes - ;; - -ar_nolocal | --ar_nolocal) - AR_LOCAL='' - ;; - -noranlib | --noranlib) - RANLIB=':' - ;; - - -prefix=* | --prefix=*) - PREFIX=`echo $arg|sed 's/-*prefix=//'` - # Use new variable name for prefix - prefix=$PREFIX - ;; - - -from_mpich | --from_mpich) - FROM_MPICH=1 - ;; - - -ar=* | --ar=*) - package=`echo $arg|sed 's/-*ar=//'` - AR="$package" - ;; - - # THESE SHOULD USE CROSS_SIZE_XXX - -intsize=* | --intsize=*) - package=`echo $arg|sed 's/-*intsize=//'` - intsize="$package" - ;; - -ptrsize=* | --ptrsize=*) - package=`echo $arg|sed 's/-*ptrsize=//'` - pointersize="$package" - ;; - -longsize=* | --longsize=*) - package=`echo $arg|sed 's/-*longsize=//'` - longsize="$package" - ;; - -longlongsize=* | --longlongsize=*) - package=`echo $arg|sed 's/-*longlongsize=//'` - longlongsize="$package" - ;; - # END OF VARIABLE SIZES - - -noprofile | --noprofile | --disable-profile | -disable-profile ) - echo "profiling interface will not be built" - NOPROFILE=1 - ;; - - -echo | --enable-echo | -enable-echo ) - set -x - ;; - -disable-weak-symbols|--disable-weak-symbols) - TRY_WEAK_SYMBOLS=0 - ;; - -enable-* | --enable-* | -disable-* | --disable-* ) - # ignore - ;; - -with-* | --with-* | -without-* | --without-* ) - # ignore - ;; - -h | -help | --h | --help | -u | --u) - (echo "${usage_msg}") >& 2 - exit 1 ;; - *) - if test -n "$arg" ; then - echo "Error: Invalid configure option $arg" - exit 1; - fi - ;; -esac -done - -# -rm -f config.log -trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15 -trap 'rm -f confdefs*' 0 - -# NLS nuisances. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi -if test "${LANG+set}" = 'set' ; then LANG=C; export LANG; fi - -rm -f conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h -compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1' - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -unique_file= - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - srcdirdefaulted=yes - # Try the directory containing this script, then `..'. - prog=$0 - confdir=`echo $prog|sed 's%/[^/][^/]*$%%'` - 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: Can not find sources in \`${confdir}' or \`..'." 1>&2 - else - echo "configure: Can not find sources in \`${srcdir}'." 1>&2 - fi - exit 1 -fi -# Preserve a srcdir of `.' to avoid automounter screwups with pwd. -# But we can't avoid them for `..', to make subdirectories work. -case $srcdir in - .|/*|~*) ;; - *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute. -esac - - -# Save the original args to write them into config.status later. -configure_args="$*" - -# - -# - -# Find the source files, if location was not specified. -if test "$srcdirdefaulted" = "yes" ; then - srcdir="" - # Try the directory containing this script, then `..'. - prog=$0 - confdir=`echo $prog|sed 's%/[^/][^/]*$%%'` - # Remove all trailing /'s - confdir=`echo $confdir|sed 's%[/*]$%%'` - 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 - -# Get top_srcdir -if test -z "$top_srcdir" ; then - top_srcdir=$srcdir -fi -# - - -if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for virtual path format""... $ac_c" -else -echo $ac_n "checking for virtual path format""... $ac_c" 1>&1 -fi -rm -rf conftest* -mkdir conftestdir -cat >conftestdir/a.c < conftest <&1 | grep 'conftestdir/a.c'` -if test -n "$ac_out" ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""VPATH" -else -echo "$ac_t""VPATH" 1>&1 -fi - VPATH='VPATH=.:$(srcdir)' -else - rm -f conftest - cat > conftest <&1 | grep 'conftestdir/a.c'` - if test -n "$ac_out" ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t"".PATH" -else -echo "$ac_t"".PATH" 1>&1 -fi - VPATH='.PATH: . $(srcdir)' - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""neither VPATH nor .PATH works" -else -echo "$ac_t""neither VPATH nor .PATH works" 1>&1 -fi - fi -fi -rm -rf conftest* - -# -# Check that an arch was set -# If it wasn't set, try to guess using "util/tarch" -# -if test -z "$ARCH" -a -x $srcdir/util/tarch ; then - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for architecture""... $ac_c" -else -echo $ac_n "checking for architecture""... $ac_c" 1>&1 -fi - ARCH=`$srcdir/util/tarch | sed s/-/_/g` - if test -z "$ARCH" ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""Unknown!" -else -echo "$ac_t""Unknown!" 1>&1 -fi - print_error "Error: Couldn't guess target architecture, you must" - print_error " set an architecture type with -arch=" - exit 1 - fi - eval "arch_$ARCH=1" - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$ARCH" -else -echo "$ac_t""$ARCH" 1>&1 -fi -fi -# -# check for valid architecture. Use __ so that _ALPHA_ does not match -# LINUX_ALPHA_ -#### WE SHOULD REMOVE THIS SOON -grep __"$ARCH"_ $srcdir/.config_params > /dev/null 2>&1 -if test $? != 0 ; then - echo "Unknown architecture $arch... proceeding anyway" -fi -# -# -# -# Find the home directory if not specified -if test "X$srcdir" != "X." -a -s $srcdir/mpi-io/Makefile.in ; then - ROMIO_HOME_TRIAL=$srcdir -else - -ROMIO_HOME_TRIAL=$PWD -if test "${ROMIO_HOME_TRIAL}" != "" -a -d "${ROMIO_HOME_TRIAL}" ; then - if test -r ${ROMIO_HOME_TRIAL}/.foo$$ ; then - /bin/rm -f ${ROMIO_HOME_TRIAL}/.foo$$ - /bin/rm -f .foo$$ - fi - if test -r ${ROMIO_HOME_TRIAL}/.foo$$ -o -r .foo$$ ; then - ROMIO_HOME_TRIAL= - else - echo "test" > ${ROMIO_HOME_TRIAL}/.foo$$ - if test ! -r .foo$$ ; then - /bin/rm -f ${ROMIO_HOME_TRIAL}/.foo$$ - ROMIO_HOME_TRIAL= - else - /bin/rm -f ${ROMIO_HOME_TRIAL}/.foo$$ - fi - fi -fi -if test "${ROMIO_HOME_TRIAL}" = "" ; then - ROMIO_HOME_TRIAL=`pwd | sed -e 's%/tmp_mnt/%/%g'` -fi -if test ! -r ${ROMIO_HOME_TRIAL}/mpi-io/Makefile.in ; then - ROMIO_HOME_TRIAL=`pwd` - if test ! -r ${ROMIO_HOME_TRIAL}/mpi-io/Makefile.in ; then - print_error "Cannot determine the root directory!" - exit 1 - fi - ROMIO_HOME_TRIAL=`pwd | sed -e 's%/tmp_mnt/%/%g'` - if test ! -d ${ROMIO_HOME_TRIAL} ; then - print_error "Warning: your default path uses the automounter; this may" - print_error "cause some problems if you use other NFS-connected systems. -" - ROMIO_HOME_TRIAL=`pwd` - fi -fi -if test -z "${ROMIO_HOME_TRIAL}" ; then - ROMIO_HOME_TRIAL=`pwd | sed -e 's%/tmp_mnt/%/%g'` - if test ! -d ${ROMIO_HOME_TRIAL} ; then - print_error "Warning: your default path uses the automounter; this may" - print_error "cause some problems if you use other NFS-connected systems. -" - ROMIO_HOME_TRIAL=`pwd` - fi -fi - -fi -echo "ROMIO home directory is $ROMIO_HOME_TRIAL" -ROMIO_HOME=$ROMIO_HOME_TRIAL -# -# Create the "autoconf" style directory names... -# -if test -z "$prefix" ; then prefix=$PREFIX ; fi -if test -z "$prefix" ; then - prefix=$ROMIO_HOME -fi - -if test -z "$exec_prefix" ; then exec_prefix='${prefix}' ; fi -# exec_prefix is the prefix for directories containing machine-specific -# files such as libraries and executables. For the USER - -includedir="${prefix}/include" - -# bindir is for executable programs for the USER -if test -z "$bindir" ; then bindir='${exec_prefix}/bin' ; fi - -# sbindir is for executable programs for the ADMINISTRATOR -if test -z "$sbindir" ; then sbindir='${exec_prefix}/sbin' ; fi - -# libdir is for libraries for the USER -if test -z "$libdir" ; then libdir='${exec_prefix}/lib' ; fi - -# mandir is the root for the man pages -if test -z "$mandir" ; then mandir='${prefix}/man' ; fi - -if test -z "$docdir" ; then docdir='${prefix}/doc' ; fi - -if test -z "$htmldir" ; then htmldir='${prefix}/www' ; fi - -# -# check for valid file system -if test -n "$FILE_SYSTEM" ; then - for x in $FILE_SYSTEM - do - found=no - for y in $known_filesystems ; do - if test $x = $y ; then - found=yes - break - fi - done - if test "$found" = "no" ; then - echo "Unknown file system $x... proceeding anyway" - fi - done -fi -# -# check for valid MPI implementation -if test -n "$MPI" ; then - found=no - for mpi in $known_mpi_impls ; do - if test "${MPI}_mpi" = "$mpi" ; then - found=yes - break - fi - done - if test $found = no ; then - echo "Unknown MPI implementation $MPI... proceeding anyway" - fi -fi -# -# check for valid MPI include directory if specified -if test $FROM_MPICH = 0 ; then - if test -n "$MPI_INCLUDE_DIR"; then - if test ! -f "$MPI_INCLUDE_DIR/mpi.h" ; then - echo "Error: Include file $MPI_INCLUDE_DIR/mpi.h not found" - exit 1 - fi - else -# assume that mpi.h is in the default path -# set MPI_INCLUDE_DIR to ".", so that it translates to -I. in the -# compile command. Some compilers complain if it's only -I - MPI_INCLUDE_DIR=. - fi -fi -# -# check for valid MPI library if specified -if test $FROM_MPICH = 0 ; then - if test -n "$MPI_LIB" ; then - if test ! -f "$MPI_LIB" ; then - echo "Error: MPI library $MPI_LIB not found" - exit 1 - fi - fi -fi -# -# -AR="${AR:-ar} cr$AR_LOCAL" -if test -z "$RANLIB" ; then - if test -z "$RANLIB"; then - # Extract the first word of `ranlib', so it can be a program name with args. - set dummy ranlib; word=$2 - echo checking for $word - IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/$word; then - RANLIB="ranlib" - break - fi - done - IFS="$saveifs" -fi -test -z "$RANLIB" && RANLIB=":" -test -n "$RANLIB" && test -n "$verbose" && echo " setting RANLIB to $RANLIB" - -fi -MAKE=${MAKE:-make} -# -# USER_CFLAGS and USER_FFLAGS are used only in test/Makefile.in -if test $DEBUG = "yes"; then - USER_CFLAGS="$CFLAGS -g" - USER_FFLAGS="$FFLAGS -g" -else - USER_CFLAGS="$CFLAGS -O" - USER_FFLAGS="$FFLAGS -O" -fi -# -if test -n "$arch_sun4" ; then - CC=${CC:-gcc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - if test "$CC" = "gcc"; then - CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" - else - CFLAGS="$CFLAGS -g" - fi - else - CFLAGS="$CFLAGS -O" - fi - if test "$enable_aio" = "no" ; then - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - - else - -{ -test -n "$verbose" && \ -echo " defining AIO_SUN" -echo "#define" AIO_SUN 1 >> confdefs.h -DEFS="$DEFS -DAIO_SUN=1" -SEDDEFS="${SEDDEFS}\${SEDdA}AIO_SUN\${SEDdB}AIO_SUN\${SEDdC}1\${SEDdD} -\${SEDuA}AIO_SUN\${SEDuB}AIO_SUN\${SEDuC}1\${SEDuD} -\${SEDeA}AIO_SUN\${SEDeB}AIO_SUN\${SEDeC}1\${SEDeD} -" -} - - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi -fi -# -if test -n "$arch_solaris" || test -n "$arch_solaris86" ; then - CC=${CC:-cc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - if test "$CC" = "gcc" ; then - CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" - else - CFLAGS="$CFLAGS -g -v" - fi - else - CFLAGS="$CFLAGS -O" - fi - if test "$enable_aio" = "no" ; then - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - - else - -{ -test -n "$verbose" && \ -echo " defining AIO_SUN" -echo "#define" AIO_SUN 1 >> confdefs.h -DEFS="$DEFS -DAIO_SUN=1" -SEDDEFS="${SEDDEFS}\${SEDdA}AIO_SUN\${SEDdB}AIO_SUN\${SEDdC}1\${SEDdD} -\${SEDuA}AIO_SUN\${SEDuB}AIO_SUN\${SEDuC}1\${SEDuD} -\${SEDeA}AIO_SUN\${SEDeB}AIO_SUN\${SEDeC}1\${SEDeD} -" -} - - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi - -{ -test -n "$verbose" && \ -echo " defining SOLARIS" -echo "#define" SOLARIS 1 >> confdefs.h -DEFS="$DEFS -DSOLARIS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}SOLARIS\${SEDdB}SOLARIS\${SEDdC}1\${SEDdD} -\${SEDuA}SOLARIS\${SEDuB}SOLARIS\${SEDuC}1\${SEDuD} -\${SEDeA}SOLARIS\${SEDeB}SOLARIS\${SEDeC}1\${SEDeD} -" -} - - if test $MPI = "mpich" ; then - TEST_CC=mpicc - TEST_F77=mpif77 - else - TEST_CC="$CC" - TEST_F77="$F77" - fi - if test "$enable_aio" != "no" ; then - MPI_LIB="$MPI_LIB -laio" - ROMIO_LIBLIST="-laio" - fi - AR="ar cr" -# solaris does not have l option to ar -# solaris f90 does not have 8-byte integer type -# (it does now!!!! 11/29/01) -fi -# -if test -n "$arch_rs6000"; then - F77=$FC - if test -z "$CC"; then - for p in mpcc -do -if test -z "$CC"; then - # Extract the first word of `$p', so it can be a program name with args. - set dummy $p; word=$2 - echo checking for $word - IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/$word; then - CC="$p" - break - fi - done - IFS="$saveifs" -fi - -test -n "$CC" && test -n "$verbose" && echo " setting CC to $CC" - -test -n "$CC" && break -done -test -n "$CC" || CC="cc" - - echo "Using $CC" - fi - if test $NOF77 = 0 && test -z "$FC"; then - for p in mpxlf -do -if test -z "$F77"; then - # Extract the first word of `$p', so it can be a program name with args. - set dummy $p; word=$2 - echo checking for $word - IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/$word; then - F77="$p" - break - fi - done - IFS="$saveifs" -fi - -test -n "$F77" && test -n "$verbose" && echo " setting F77 to $F77" - -test -n "$F77" && break -done -test -n "$F77" || F77="f77" - - echo "Using $F77" - fi - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g" - else - CFLAGS="$CFLAGS -O" - fi - # Check that aio is available (many systems appear to have aio - # either installed improperly or turned off). - # The test is the following: if not cross compiling, try to run a - # program that includes a *reference* to aio_write but does not call it - # If the libraries are not set up correctly, then this will fail. - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking whether aio routines can be used""... $ac_c" -else -echo $ac_n "checking whether aio routines can be used""... $ac_c" 1>&1 -fi - echo checking whether cross-compiling -# If we cannot run a trivial program, we must be cross compiling. -cat > conftest.c </dev/null; then - : -else - cross_compiling=1 -fi -rm -fr conftest* - -if test -n "$cross_compiling" -then - aio_runs=unknown -else -cat > conftest.c < 10) aio_write(); - return 0; -} - -EOF -eval $compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - aio_runs=yes - -else - aio_runs=no -fi -fi -rm -fr conftest*; - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$aio_runs" -else -echo "$ac_t""$aio_runs" 1>&1 -fi - if test "$enable_aio" != "no" -a "$aio_runs" = "no" ; then - enable_aio=no - fi - if test "$enable_aio" = "no" ; then - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - - else - -{ -test -n "$verbose" && \ -echo " defining NO_FD_IN_AIOCB" -echo "#define" NO_FD_IN_AIOCB 1 >> confdefs.h -DEFS="$DEFS -DNO_FD_IN_AIOCB=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_FD_IN_AIOCB\${SEDdB}NO_FD_IN_AIOCB\${SEDdC}1\${SEDdD} -\${SEDuA}NO_FD_IN_AIOCB\${SEDuB}NO_FD_IN_AIOCB\${SEDuC}1\${SEDuD} -\${SEDeA}NO_FD_IN_AIOCB\${SEDeB}NO_FD_IN_AIOCB\${SEDeC}1\${SEDeD} -" -} - - -{ -test -n "$verbose" && \ -echo " defining AIO_HANDLE_IN_AIOCB" -echo "#define" AIO_HANDLE_IN_AIOCB 1 >> confdefs.h -DEFS="$DEFS -DAIO_HANDLE_IN_AIOCB=1" -SEDDEFS="${SEDDEFS}\${SEDdA}AIO_HANDLE_IN_AIOCB\${SEDdB}AIO_HANDLE_IN_AIOCB\${SEDdC}1\${SEDdD} -\${SEDuA}AIO_HANDLE_IN_AIOCB\${SEDuB}AIO_HANDLE_IN_AIOCB\${SEDuC}1\${SEDuD} -\${SEDeA}AIO_HANDLE_IN_AIOCB\${SEDeB}AIO_HANDLE_IN_AIOCB\${SEDeC}1\${SEDeD} -" -} - - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - if test "$CC" = "mpcc" || test "$CC" = "mpCC" ; then - file_system_piofs=1 - FILE_SYSTEM="piofs" - echo "configuring for file systems piofs, ufs, and nfs" - else - echo "configuring for file systems ufs and nfs" - fi - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="$FILE_SYSTEM ufs nfs" - fi - -{ -test -n "$verbose" && \ -echo " defining AIX" -echo "#define" AIX 1 >> confdefs.h -DEFS="$DEFS -DAIX=1" -SEDDEFS="${SEDDEFS}\${SEDdA}AIX\${SEDdB}AIX\${SEDdC}1\${SEDdD} -\${SEDuA}AIX\${SEDuB}AIX\${SEDuC}1\${SEDuD} -\${SEDeA}AIX\${SEDeB}AIX\${SEDeC}1\${SEDeD} -" -} - -# assume long long exists. - longlongsize=${longlongsize:-8} - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" -fi -# -if test -n "$arch_paragon"; then - CC=${CC:-icc} - F77=${FC:-if77} - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g" - else - if test "$CC" = "icc"; then - CFLAGS="$CFLAGS -Knoieee -Mvect -O3" - else - CFLAGS="$CFLAGS -O" - fi - fi - AR="ar860 cr$AR_LOCAL" - MPI_LIB="$MPI_LIB -nx" - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_pfs=1 - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="pfs ufs nfs" - echo "configuring for file systems pfs, ufs, and nfs" - fi - -{ -test -n "$verbose" && \ -echo " defining PARAGON" -echo "#define" PARAGON 1 >> confdefs.h -DEFS="$DEFS -DPARAGON=1" -SEDDEFS="${SEDDEFS}\${SEDdA}PARAGON\${SEDdB}PARAGON\${SEDdC}1\${SEDdD} -\${SEDuA}PARAGON\${SEDuB}PARAGON\${SEDuC}1\${SEDuD} -\${SEDeA}PARAGON\${SEDeB}PARAGON\${SEDeC}1\${SEDeD} -" -} - - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - -# NO_AIO is if configuring for NFS/UFS. It doesn't affect PFS asynch. I/O. -# long long does not exist - longlongsize=${longlongsize:-0} -fi -# -if test -n "$arch_tflop" || test -n "$arch_tflops"; then - CC=${CC:-pgcc} - F77=${FC:-pgf77} - TFLOP_FLAGS="-cougar -D__PUMA" - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g $TFLOP_FLAGS" - else - if test "$CC" = "pgcc"; then - CFLAGS="$CFLAGS -Knoieee -Mvect -O3 $TFLOP_FLAGS" - else - CFLAGS="$CFLAGS -O $TFLOP_FLAGS" - fi - fi - AR="xar cr$AR_LOCAL" - RANLIB="xranlib" - MPI_LIB="$MPI_LIB" - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - FILE_SYSTEM="ufs" - echo "configuring for file system ufs" - fi -fi -# -if test -n "$arch_freebsd" || test -n "$arch_LINUX" || test -n "$arch_LINUX_ALPHA" || test -n "$arch_netbsd" || test -n "$arch_openbsd" ; then - CC=${CC:-gcc} - if test -n "$arch_freebsd" || test -n "$arch_netbsd" || test -n "$arch_openbsd"; then - F77=${FC:-f77} - -{ -test -n "$verbose" && \ -echo " defining FREEBSD" -echo "#define" FREEBSD 1 >> confdefs.h -DEFS="$DEFS -DFREEBSD=1" -SEDDEFS="${SEDDEFS}\${SEDdA}FREEBSD\${SEDdB}FREEBSD\${SEDdC}1\${SEDdD} -\${SEDuA}FREEBSD\${SEDuB}FREEBSD\${SEDuC}1\${SEDuD} -\${SEDeA}FREEBSD\${SEDeB}FREEBSD\${SEDeC}1\${SEDeD} -" -} - - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if MOUNT_NFS is defined in the include files""... $ac_c" -else -echo $ac_n "checking if MOUNT_NFS is defined in the include files""... $ac_c" 1>&1 -fi - rm -f conftest.c - cat > conftest.c < -#include - main(int argc, char** argv) - { - int i=MOUNT_NFS; - } -EOF - rm -f conftest - $CC $USER_CFLAGS -o conftest conftest.c > /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_MOUNT_NFS" -echo "#define" HAVE_MOUNT_NFS 1 >> confdefs.h -DEFS="$DEFS -DHAVE_MOUNT_NFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MOUNT_NFS\${SEDdB}HAVE_MOUNT_NFS\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_MOUNT_NFS\${SEDuB}HAVE_MOUNT_NFS\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_MOUNT_NFS\${SEDeB}HAVE_MOUNT_NFS\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi - rm -f conftest conftest.c - - longlongsize=${longlongsize:-0} -# printf doesn't work properly and no integer*8 as far as I can tell - else - F77=${FC:-g77} - -{ -test -n "$verbose" && \ -echo " defining LINUX" -echo "#define" LINUX 1 >> confdefs.h -DEFS="$DEFS -DLINUX=1" -SEDDEFS="${SEDDEFS}\${SEDdA}LINUX\${SEDdB}LINUX\${SEDdC}1\${SEDdD} -\${SEDuA}LINUX\${SEDuB}LINUX\${SEDuC}1\${SEDuD} -\${SEDeA}LINUX\${SEDeB}LINUX\${SEDeC}1\${SEDeD} -" -} - - fi - if test $DEBUG = "yes" ; then - if test "$CC" = "gcc" ; then - CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" - else - CFLAGS="$CFLAGS -g" - fi - else - CFLAGS="$CFLAGS -O" - fi - if test "$enable_aio" != "yes" ; then - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - - else - # Try to find the aio routines - use_aio=no - echo checking for aio.h -echo checking how to run the C preprocessor -if test -z "$CPP"; then - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and ``${CC-cc}'' will simply confuse - # make. It must be expanded now. - CPP="${CC-cc} -E" - cat > conftest.c < -Syntax Error -EOF -err=`eval "($CPP conftest.c >/dev/null) 2>&1"` -if test -z "$err"; then - : -else - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -test ".${verbose}" != "." && echo " setting CPP to $CPP" - -cat > conftest.c < -EOF -err=`eval "($CPP conftest.c >/dev/null) 2>&1"` -if test -z "$err"; then - rm -rf conftest* - has_aio_h=yes - -else - rm -rf conftest* - has_aio_h=no -fi -rm -f conftest* - - add_lib="" - LIBS_save="${LIBS}" -LIBS="${LIBS} -laio" -have_lib="" -echo checking for -laio -cat > conftest.c < conftest.c < conftest.c < conftest.c < -int main() { exit(0); } -int t() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_aio_write) || defined (__stub___aio_write) -choke me -#else -/* Override any gcc2 internal prototype to avoid an error. */ -extern char aio_write(); aio_write(); -#endif - } -EOF -if eval $compile; then - rm -rf conftest* - has_aio_write=yes - -else - rm -rf conftest* - has_aio_write=no -fi -rm -f conftest* - - if test "$has_aio_h" = "yes" -a "$has_aio_write" = "yes" -a \ - "$has_pthread" = "yes" ; then - use_aio=yes - fi - # Check for aiocb_t as a shorthand for struct aiocb - echo checking for for aiocb_t -cat > conftest.c < -int main() { exit(0); } -int t() { aiocb_t a; } -EOF -if eval $compile; then - rm -rf conftest* - has_aiocb_t=yes - -else - rm -rf conftest* - has_aiocb_t=no -fi -rm -f conftest* - - if test "$has_aiocb_t" = "no" ; then - -{ -test -n "$verbose" && \ -echo " defining NEEDS_AIOCB_T" -echo "#define" NEEDS_AIOCB_T 1 >> confdefs.h -DEFS="$DEFS -DNEEDS_AIOCB_T=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NEEDS_AIOCB_T\${SEDdB}NEEDS_AIOCB_T\${SEDdC}1\${SEDdD} -\${SEDuA}NEEDS_AIOCB_T\${SEDuB}NEEDS_AIOCB_T\${SEDuC}1\${SEDuD} -\${SEDeA}NEEDS_AIOCB_T\${SEDeB}NEEDS_AIOCB_T\${SEDeC}1\${SEDeD} -" -} - - fi - if test "$use_aio" = "yes" ; then - MPI_LIB="$MPI_LIB $add_lib" - ROMIO_LIBLIST="$ROMIO_LIBLIST $add_lib" - else - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - - fi - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi -fi -# -if test -n "$arch_SX4" ; then - CC=${CC:-mpicc} - F77=${FC:-mpif90} - if test $DEBUG = "yes" ; then - CFLAGS="$CFLAGS -g" - FFLAGS="$FFLAGS -g" - else - USER_FFLAGS="$FFLAGS -Chopt" - CFLAGS="$CFLAGS -O" - FFLAGS="$FFLAGS -Chopt" - fi - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - - -{ -test -n "$verbose" && \ -echo " defining SX4" -echo "#define" SX4 1 >> confdefs.h -DEFS="$DEFS -DSX4=1" -SEDDEFS="${SEDDEFS}\${SEDdA}SX4\${SEDdB}SX4\${SEDdC}1\${SEDdD} -\${SEDuA}SX4\${SEDuB}SX4\${SEDuC}1\${SEDuD} -\${SEDeA}SX4\${SEDeB}SX4\${SEDeC}1\${SEDeD} -" -} - - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_sfs=1 - file_system_nfs=1 - FILE_SYSTEM="sfs nfs" - echo "configuring for file systems sfs and nfs" - fi - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" -fi -# -if test -n "$arch_hpux" || test -n "$arch_sppux" ; then - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g +w1" - else - CFLAGS="$CFLAGS -O" - fi - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - - RANLIB=":" - if test -z "$MPI"; then - if test -f "/opt/mpi/include/mpi.h" ; then - echo "assuming that you want to use ROMIO with HP MPI" - MPI=hp - else - echo "assuming that you want to use ROMIO with MPICH" - MPI=mpich - fi - fi - if test $MPI = "mpich" ; then - mpi_mpich=1 - MPI_LIB="$MPI_LIB -lV3" - CC=${CC:-cc -Ae} - F77=${FC:-f77 +U77} - fi - if test $MPI = "hp" ; then - mpi_hp=1 - CC=${CC:-mpicc -Ae} - F77=${FC:-mpif77 +U77} - fi - if test $MPI = "lam" && test "$FC" != ""; then - FC="$FC +U77" - fi - FTESTDEFINE="external iargc, getarg" - if test -n "$arch_hpux" ; then - CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" - -{ -test -n "$verbose" && \ -echo " defining HPUX" -echo "#define" HPUX 1 >> confdefs.h -DEFS="$DEFS -DHPUX=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HPUX\${SEDdB}HPUX\${SEDdC}1\${SEDdD} -\${SEDuA}HPUX\${SEDuB}HPUX\${SEDuC}1\${SEDuD} -\${SEDeA}HPUX\${SEDeB}HPUX\${SEDeC}1\${SEDeD} -" -} - - if test $MPI = "hp" ; then - F77=${FC:-mpif90 +U77} - else - F77=${FC:-f90 +U77} - fi - else - -{ -test -n "$verbose" && \ -echo " defining SPPUX" -echo "#define" SPPUX 1 >> confdefs.h -DEFS="$DEFS -DSPPUX=1" -SEDDEFS="${SEDDEFS}\${SEDdA}SPPUX\${SEDdB}SPPUX\${SEDdC}1\${SEDdD} -\${SEDuA}SPPUX\${SEDuB}SPPUX\${SEDuC}1\${SEDuD} -\${SEDeA}SPPUX\${SEDeB}SPPUX\${SEDeC}1\${SEDeD} -" -} - - fi - if test -z "$FILE_SYSTEM" ; then - if test -n "$arch_hpux" ; then - echo checking for struct flock64 -cat > conftest.c < -int main() { exit(0); } -int t() { -struct flock64 fl; int i=F_SETLKW64; } -EOF -if eval $compile; then - rm -rf conftest* - flock64_ok="yes" - -else - rm -rf conftest* - flock64_ok="no" -fi -rm -f conftest* - - else - flock64_ok="yes" - fi - if test $flock64_ok = "yes" ; then - file_system_hfs=1 - file_system_nfs=1 - FILE_SYSTEM="hfs nfs" - echo "configuring for file systems hfs and nfs" - else - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "no flock64; configuring for file systems ufs and nfs" - fi - fi - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - if test "$CC" != "gcc" ; then - ROMIO_TCFLAGS="-Ae" - fi - if test "$F77" != "g77" ; then - ROMIO_TFFLAGS="+U77" - fi -fi -# -if test -n "$arch_alpha" || test -n "$arch_ALPHA" ; then - CC=${CC:-cc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g -std1 -warnprotos -verbose" - else - CFLAGS="$CFLAGS -O" - fi - -{ -test -n "$verbose" && \ -echo " defining AIO_PRIORITY_DEFAULT" -echo "#define" AIO_PRIORITY_DEFAULT 1 >> confdefs.h -DEFS="$DEFS -DAIO_PRIORITY_DEFAULT=1" -SEDDEFS="${SEDDEFS}\${SEDdA}AIO_PRIORITY_DEFAULT\${SEDdB}AIO_PRIORITY_DEFAULT\${SEDdC}1\${SEDdD} -\${SEDuA}AIO_PRIORITY_DEFAULT\${SEDuB}AIO_PRIORITY_DEFAULT\${SEDuC}1\${SEDuD} -\${SEDeA}AIO_PRIORITY_DEFAULT\${SEDeB}AIO_PRIORITY_DEFAULT\${SEDeC}1\${SEDeD} -" -} - - MPI_LIB="$MPI_LIB -laio" - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi - -{ -test -n "$verbose" && \ -echo " defining DEC" -echo "#define" DEC 1 >> confdefs.h -DEFS="$DEFS -DDEC=1" -SEDDEFS="${SEDDEFS}\${SEDdA}DEC\${SEDdB}DEC\${SEDdC}1\${SEDdD} -\${SEDuA}DEC\${SEDuB}DEC\${SEDuC}1\${SEDuD} -\${SEDeA}DEC\${SEDeB}DEC\${SEDeC}1\${SEDeD} -" -} - - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - ROMIO_LIBLIST="-laio" -fi -# -if test -n "$arch_CRAY" ; then - CC=${CC:-cc} - F77=${FC:-f90} - NOF77=1 - FTESTDEFINE="integer ilen" - F77GETARG="call pxfgetarg(i, str, ilen, ierr)" - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g" - else - CFLAGS="$CFLAGS -O" - fi - -{ -test -n "$verbose" && \ -echo " defining NO_AIO" -echo "#define" NO_AIO 1 >> confdefs.h -DEFS="$DEFS -DNO_AIO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_AIO\${SEDdB}NO_AIO\${SEDdC}1\${SEDdD} -\${SEDuA}NO_AIO\${SEDuB}NO_AIO\${SEDuC}1\${SEDuD} -\${SEDeA}NO_AIO\${SEDeB}NO_AIO\${SEDeC}1\${SEDeD} -" -} - - RANLIB=":" - CFLAGS="$CFLAGS -D_UNICOS" - -{ -test -n "$verbose" && \ -echo " defining CRAY" -echo "#define" CRAY 1 >> confdefs.h -DEFS="$DEFS -DCRAY=1" -SEDDEFS="${SEDDEFS}\${SEDdA}CRAY\${SEDdB}CRAY\${SEDdC}1\${SEDdD} -\${SEDuA}CRAY\${SEDuB}CRAY\${SEDuC}1\${SEDuD} -\${SEDeA}CRAY\${SEDeB}CRAY\${SEDeC}1\${SEDeD} -" -} - - if test -z "$MPI" || test -n "$mpi_sgi" ; then - MPI=cray - mpi_cray=1 - mpi_sgi="" -# above is to disable configure tests specific to SGI MPI - -{ -test -n "$verbose" && \ -echo " defining MPISGI" -echo "#define" MPISGI 1 >> confdefs.h -DEFS="$DEFS -DMPISGI=1" -SEDDEFS="${SEDDEFS}\${SEDdA}MPISGI\${SEDdB}MPISGI\${SEDdC}1\${SEDdD} -\${SEDuA}MPISGI\${SEDuB}MPISGI\${SEDuC}1\${SEDuD} -\${SEDeA}MPISGI\${SEDeB}MPISGI\${SEDeC}1\${SEDeD} -" -} - - -{ -test -n "$verbose" && \ -echo " defining HAVE_MPI_COMBINERS" -echo "#define" HAVE_MPI_COMBINERS 1 >> confdefs.h -DEFS="$DEFS -DHAVE_MPI_COMBINERS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPI_COMBINERS\${SEDdB}HAVE_MPI_COMBINERS\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_MPI_COMBINERS\${SEDuB}HAVE_MPI_COMBINERS\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_MPI_COMBINERS\${SEDeB}HAVE_MPI_COMBINERS\${SEDeC}1\${SEDeD} -" -} - - -{ -test -n "$verbose" && \ -echo " defining NO_MPI_SGI_type_is_contig" -echo "#define" NO_MPI_SGI_type_is_contig 1 >> confdefs.h -DEFS="$DEFS -DNO_MPI_SGI_type_is_contig=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_MPI_SGI_type_is_contig\${SEDdB}NO_MPI_SGI_type_is_contig\${SEDdC}1\${SEDdD} -\${SEDuA}NO_MPI_SGI_type_is_contig\${SEDuB}NO_MPI_SGI_type_is_contig\${SEDuC}1\${SEDuD} -\${SEDeA}NO_MPI_SGI_type_is_contig\${SEDeB}NO_MPI_SGI_type_is_contig\${SEDeC}1\${SEDeD} -" -} - - fi -# MPISGI needed because of error in Cray's and SGI's -# MPI_Type_get_contents (does not increment reference count). -# Others needed because MPISGI needed. - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" -fi -# -if test -n "$arch_sgi" ; then - arch_IRIX=1 - ARCH=IRIX -fi -if test -n "$arch_IRIX64" ; then - arch_IRIX=1 -fi -if test -n "$arch_IRIX32" ; then - arch_IRIX=1 -fi -if test -n "$arch_IRIXN32" ; then - arch_IRIX=1 -fi -if test -n "$arch_sgi5" ; then - arch_IRIX5=1 - ARCH=IRIX -fi -# - -# -if test -n "$arch_IRIX"; then - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for IRIX OS version""... $ac_c" -else -echo $ac_n "checking for IRIX OS version""... $ac_c" 1>&1 -fi - osversion=`uname -r | sed 's/\..*//'` - osvminor=`uname -r | sed 's/[0-9]\.\([0-9]*\)\..*/\1/'` - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$osversion" -else -echo "$ac_t""$osversion" 1>&1 -fi - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for IRIX cpucount""... $ac_c" -else -echo $ac_n "checking for IRIX cpucount""... $ac_c" 1>&1 -fi - 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'` - fi - if test "$cpucount" = "" ; then - print_error "Could not determine cpucount." - print_error "Please send " - hinv - print_error "to romio-maint@mcs.anl.gov" - exit 1 - fi - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$cpucount" -else -echo "$ac_t""$cpucount" 1>&1 -fi - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for IRIX cpumodel""... $ac_c" -else -echo $ac_n "checking for IRIX cpumodel""... $ac_c" 1>&1 -fi - 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 " - hinv -t cpu 2>&1 - hinv -t cpu | cut -f 3 -d' ' 2>&1 - print_error "to romio-maint@mcs.anl.gov" - exit 1 - fi - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$cputype" -else -echo "$ac_t""$cputype" 1>&1 -fi - if test -z "$osversion" ; then - print_error "Could not determine OS version. Please send" - print_error " " - uname -a - print_error "to romio-maint@mcs.anl.gov" - exit 1 - elif test $osversion = 4 ; then - true - elif test $osversion = 5 ; then - true - 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" - uname -a 2>&1 - hinv 2>&1 - print_error "to romio-maint@mcs.anl.gov" - exit 1 - fi - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for cputype""... $ac_c" -else -echo $ac_n "checking for cputype""... $ac_c" 1>&1 -fi - OLD_ARCH=IRIX - IRIXARCH="$ARCH_$osversion" - cputype=`echo $cputype | sed -e 's%.*/%%' -e 's/R//' | tr -d "[A-Z]"` - case $cputype in - 3000) ;; - 4000) ;; - 4400) ;; - 4600) ;; - 5000) ;; - 8000) ;; - 10000);; - 12000);; - *) - print_error "Unexpected IRIX/MIPS chipset $cputype. Please send the output" - print_error " " - 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 " " - cputype=4400 - ;; - esac - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$cputype" -else -echo "$ac_t""$cputype" 1>&1 -fi - IRIXARCH="$IRIXARCH_$cputype" - echo "IRIX-specific architecture is $IRIXARCH" -fi - -# -# special case 'sgi5' for use on MESHINE which is much like an SGI running -# irix 5 with r4400 chips, but does not have 'hinv', so above code doesn't -# work -if test -n "$arch_sgi5"; then - osversion=5 - cputype=4400 - IRIXARCH="$ARCH_$osversion" - IRIXARCH="$IRIXARCH_$cputype" -# now set arch_IRIX to 1 - arch_IRIX=1 - echo "IRIX-specific architecture is $IRIXARCH" - -{ -test -n "$verbose" && \ -echo " defining IRIX" -echo "#define" IRIX 1 >> confdefs.h -DEFS="$DEFS -DIRIX=1" -SEDDEFS="${SEDDEFS}\${SEDdA}IRIX\${SEDdB}IRIX\${SEDdC}1\${SEDdD} -\${SEDuA}IRIX\${SEDuB}IRIX\${SEDuC}1\${SEDuD} -\${SEDeA}IRIX\${SEDeB}IRIX\${SEDeC}1\${SEDeD} -" -} - -fi -# -if test -n "$arch_IRIX"; then - CC=${CC:-cc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g -fullwarn" - else - CFLAGS="$CFLAGS -O" - fi - if test $osversion = 4 ; then - RANLIB="ar ts" - if test -n "$mpi_sgi"; then - echo "Error: SGI's MPI doesn't work with IRIX 4.x" - exit 1 - fi - elif test $osversion = 5 ; then - if test -n "$mpi_sgi"; then - echo "Error: SGI's MPI doesn't work with IRIX 5.x" - exit 1 - fi - elif test $osversion = 6 ; then - if test -z "$MPI"; then - if test -f "/usr/include/mpi.h" ; then - echo "assuming that you want to use ROMIO with SGI's MPI" - MPI=sgi - mpi_sgi=1 - else - echo "assuming that you want to use ROMIO with MPICH" - MPI=mpich - mpi_mpich=1 - fi - fi - RANLIB=":" - -{ -test -n "$verbose" && \ -echo " defining AIO_SIGNOTIFY_NONE" -echo "#define" AIO_SIGNOTIFY_NONE 1 >> confdefs.h -DEFS="$DEFS -DAIO_SIGNOTIFY_NONE=1" -SEDDEFS="${SEDDEFS}\${SEDdA}AIO_SIGNOTIFY_NONE\${SEDdB}AIO_SIGNOTIFY_NONE\${SEDdC}1\${SEDdD} -\${SEDuA}AIO_SIGNOTIFY_NONE\${SEDuB}AIO_SIGNOTIFY_NONE\${SEDuC}1\${SEDuD} -\${SEDeA}AIO_SIGNOTIFY_NONE\${SEDeB}AIO_SIGNOTIFY_NONE\${SEDeC}1\${SEDeD} -" -} - - if test $cputype -ge 5000 ; then - MIPS=4 - else - MIPS=3 - fi - fi - if test -n "$mpi_sgi" && test -z "$MPI_LIB" ; then - MPI_LIB="-lmpi" - fi -# check if pread64 is defined - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if pread64 is defined""... $ac_c" -else -echo $ac_n "checking if pread64 is defined""... $ac_c" 1>&1 -fi - rm -f conftest.c - cat > conftest.c < - main(int argc, char** argv) - { - int fd=0, buf=0, i=0; - off64_t off=0; - pread64(fd, &buf, i, off); - } -EOF - rm -f conftest - $CC $USER_CFLAGS -o conftest conftest.c > /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_PREAD64" -echo "#define" HAVE_PREAD64 1 >> confdefs.h -DEFS="$DEFS -DHAVE_PREAD64=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PREAD64\${SEDdB}HAVE_PREAD64\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_PREAD64\${SEDuB}HAVE_PREAD64\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_PREAD64\${SEDeB}HAVE_PREAD64\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi -rm -f conftest conftest.c - -# - if test -z "$FILE_SYSTEM" ; then - file_system_nfs=1 - FILE_SYSTEM="nfs" - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for xfs""... $ac_c" -else -echo $ac_n "checking for xfs""... $ac_c" 1>&1 -fi - cat > conftest.c < -int main() { exit(0); } -int t() { aiocb64_t *t1; } -EOF -if eval $compile; then - rm -rf conftest* - file_system_xfs=1;FILE_SYSTEM="xfs $FILE_SYSTEM"; - -fi -rm -f conftest* - - if test "$file_system_xfs" = 1 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - file_system_ufs=1 - FILE_SYSTEM="ufs $FILE_SYSTEM" - fi - echo "configuring for file systems $FILE_SYSTEM" - fi - -{ -test -n "$verbose" && \ -echo " defining IRIX" -echo "#define" IRIX 1 >> confdefs.h -DEFS="$DEFS -DIRIX=1" -SEDDEFS="${SEDDEFS}\${SEDdA}IRIX\${SEDdB}IRIX\${SEDdC}1\${SEDdD} -\${SEDuA}IRIX\${SEDuB}IRIX\${SEDuC}1\${SEDuD} -\${SEDeA}IRIX\${SEDeB}IRIX\${SEDeC}1\${SEDeD} -" -} - - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" -fi - -for func in memalign -do -trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'` -echo checking for ${func} -cat > conftest.c < -int main() { exit(0); } -int t() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_${func}) || defined (__stub___${func}) -choke me -#else -/* Override any gcc2 internal prototype to avoid an error. */ -extern char ${func}(); ${func}(); -#endif - } -EOF -if eval $compile; then - rm -rf conftest* - { -test -n "$verbose" && \ -echo " defining ${trfunc}" -echo "#define" ${trfunc} 1 >> confdefs.h -DEFS="$DEFS -D${trfunc}=1" -SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD} -\${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD} -\${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD} -" -} - - -fi -rm -f conftest* -done - - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if MPIR_Status_set_bytes is defined""... $ac_c" -else -echo $ac_n "checking if MPIR_Status_set_bytes is defined""... $ac_c" 1>&1 -fi - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_STATUS_SET_BYTES" -echo "#define" HAVE_STATUS_SET_BYTES 1 >> confdefs.h -DEFS="$DEFS -DHAVE_STATUS_SET_BYTES=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_STATUS_SET_BYTES\${SEDdB}HAVE_STATUS_SET_BYTES\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_STATUS_SET_BYTES\${SEDuB}HAVE_STATUS_SET_BYTES\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_STATUS_SET_BYTES\${SEDeB}HAVE_STATUS_SET_BYTES\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi - rm -f conftest mpitest.c - - -if test $NOF77 = 0 ; then - echo "checking Fortran external names" - - rm -f confftest.f confftest.o - cat > 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)." - NOF77=1 - elif test -z "$FORTRANNAMES" ; then - if test $arch_CRAY ; then - # 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 - rm -f confftest.f confftest.o - if test -n "$nameform4" ; then - echo "Fortran externals are lower case and have two trailing underscores" - FORTRANNAMES="FORTRANDOUBLEUNDERSCORE" - elif test -n "$nameform1" ; then - # We don't set this in CFLAGS; it is a default case - echo "Fortran externals have a trailing underscore and are lowercase" - FORTRANNAMES="FORTRANUNDERSCORE" - elif test -n "$nameform2" ; then - echo "Fortran externals are uppercase" - FORTRANNAMES="FORTRANCAPS" - elif test -n "$nameform3" ; then - 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)." - NOF77=1 - fi - fi - if test -n "$FORTRANNAMES" ; then - WDEF="-D$FORTRANNAMES" - fi - - if test -n "$WDEF" ; then - CFLAGS="$CFLAGS $WDEF" - fi - rm -f test/mpif.h - if test "$MPI_INCLUDE_DIR" != "." && test $FROM_MPICH = 0 ; then - if test ! -d test ; then mkdir test ; fi - ln -s $MPI_INCLUDE_DIR/mpif.h test - fi -else - F77=":" -fi -# - -if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for inline""... $ac_c" -else -echo $ac_n "checking for inline""... $ac_c" 1>&1 -fi -if eval "test \"`echo '$''{'pac_cv_c_inline'+set}'`\" = set"; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""(cached)" -else -echo "$ac_t""(cached)" 1>&1 -fi -else - cat > conftest.c <&1 -fi -if test "$pac_cv_c_inline" = "no" ; then - -{ -test -n "$verbose" && \ -echo " defining inline" -echo "#define" inline 1 >> confdefs.h -DEFS="$DEFS -Dinline=1" -SEDDEFS="${SEDDEFS}\${SEDdA}inline\${SEDdB}inline\${SEDdC}1\${SEDdD} -\${SEDuA}inline\${SEDuB}inline\${SEDuC}1\${SEDuD} -\${SEDeA}inline\${SEDeB}inline\${SEDeC}1\${SEDeD} -" -} - -fi - - -# Header files -for ac_hdr in unistd.h -do -ac_safe=`echo "$ac_hdr" | tr '[a-z]./' '[A-Z]__'` -if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for $ac_hdr""... $ac_c" -else -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&1 -fi -cat > conftest.c < -int main() { exit(0); } -int t() { main(); } -EOF -if eval $compile; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" - -else - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'` - -{ -test -n "$verbose" && \ -echo " defining $ac_tr_hdr" -echo "#define" $ac_tr_hdr 1 >> confdefs.h -DEFS="$DEFS -D$ac_tr_hdr=1" -SEDDEFS="${SEDDEFS}\${SEDdA}$ac_tr_hdr\${SEDdB}$ac_tr_hdr\${SEDdC}1\${SEDdD} -\${SEDuA}$ac_tr_hdr\${SEDuB}$ac_tr_hdr\${SEDuC}1\${SEDuD} -\${SEDeA}$ac_tr_hdr\${SEDeB}$ac_tr_hdr\${SEDeC}1\${SEDeD} -" -} - -else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi -fi -done - -# - -if test -z "$intsize" ; then - Pac_name="int" - 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 - - - eval Pac_testval=\$"CROSS_SIZEOF_INT" -fi -if test -n "$Pac_testval" ; then - Pac_CV_NAME=$Pac_testval -else -if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for size of int""... $ac_c" -else -echo $ac_n "checking for size of int""... $ac_c" 1>&1 -fi -/bin/rm -f conftestval -cat > conftest.c < -main(int argc, char** argv) { - FILE *f=fopen("conftestval","w"); - if (!f) exit(1); - fprintf( f, "%d\n", sizeof(int)); - exit(0); -} -EOF -eval $compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - Pac_CV_NAME=`cat conftestval` - -else - Pac_CV_NAME="" -fi -rm -fr conftest* -/bin/rm -f conftestval -if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$Pac_CV_NAME" -else -echo "$ac_t""$Pac_CV_NAME" 1>&1 -fi - eval ${Pac_varname}_len=$Pac_CV_NAME -else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""unavailable" -else -echo "$ac_t""unavailable" 1>&1 -fi -fi -fi -intsize=$Pac_CV_NAME - -fi -if test -z "$pointersize" ; then - Pac_name="void *" - 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 - - - eval Pac_testval=\$"CROSS_SIZEOF_VOID_P" -fi -if test -n "$Pac_testval" ; then - Pac_CV_NAME=$Pac_testval -else -if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for size of void *""... $ac_c" -else -echo $ac_n "checking for size of void *""... $ac_c" 1>&1 -fi -/bin/rm -f conftestval -cat > conftest.c < -main(int argc, char** argv) { - FILE *f=fopen("conftestval","w"); - if (!f) exit(1); - fprintf( f, "%d\n", sizeof(void *)); - exit(0); -} -EOF -eval $compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - Pac_CV_NAME=`cat conftestval` - -else - Pac_CV_NAME="" -fi -rm -fr conftest* -/bin/rm -f conftestval -if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$Pac_CV_NAME" -else -echo "$ac_t""$Pac_CV_NAME" 1>&1 -fi - eval ${Pac_varname}_len=$Pac_CV_NAME -else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""unavailable" -else -echo "$ac_t""unavailable" 1>&1 -fi -fi -fi -pointersize=$Pac_CV_NAME - -fi -if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for int large enough for pointers""... $ac_c" -else -echo $ac_n "checking for int large enough for pointers""... $ac_c" 1>&1 -fi -if test -n "$pointersize" -a -n "$intsize" ; then - if test $pointersize -le $intsize ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - else - -{ -test -n "$verbose" && \ -echo " defining INT_LT_POINTER" -echo "#define" INT_LT_POINTER 1 >> confdefs.h -DEFS="$DEFS -DINT_LT_POINTER=1" -SEDDEFS="${SEDDEFS}\${SEDdA}INT_LT_POINTER\${SEDdB}INT_LT_POINTER\${SEDdC}1\${SEDdD} -\${SEDuA}INT_LT_POINTER\${SEDuB}INT_LT_POINTER\${SEDuC}1\${SEDuD} -\${SEDeA}INT_LT_POINTER\${SEDeB}INT_LT_POINTER\${SEDeC}1\${SEDeD} -" -} - - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi -else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""cannot determine; assuming it is;" -else -echo "$ac_t""cannot determine; assuming it is;" 1>&1 -fi - echo "use '-intsize' and '-ptrsize' to indicate otherwise" -fi - -# - -if test -n "$longlongsize" ; then - if test "$longlongsize" = 8 ; then - echo "defining MPI_Offset as long long in C and integer*8 in Fortran" - -{ -test -n "$verbose" && \ -echo " defining HAVE_LONG_LONG_64" -echo "#define" HAVE_LONG_LONG_64 1 >> confdefs.h -DEFS="$DEFS -DHAVE_LONG_LONG_64=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LONG_LONG_64\${SEDdB}HAVE_LONG_LONG_64\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_LONG_LONG_64\${SEDuB}HAVE_LONG_LONG_64\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_LONG_LONG_64\${SEDeB}HAVE_LONG_LONG_64\${SEDeC}1\${SEDeD} -" -} - - DEFINE_MPI_OFFSET="typedef long long MPI_Offset;" - FORTRAN_MPI_OFFSET="integer*8" - LL="\%lld" - elif test "$longlongsize" = "int" ; then # a hack to set MPI_Offset as int - echo "defining MPI_Offset as int in C and integer in Fortran" - DEFINE_MPI_OFFSET="typedef int MPI_Offset;" - FORTRAN_MPI_OFFSET="integer" - -{ -test -n "$verbose" && \ -echo " defining MPI_OFFSET_IS_INT" -echo "#define" MPI_OFFSET_IS_INT 1 >> confdefs.h -DEFS="$DEFS -DMPI_OFFSET_IS_INT=1" -SEDDEFS="${SEDDEFS}\${SEDdA}MPI_OFFSET_IS_INT\${SEDdB}MPI_OFFSET_IS_INT\${SEDdC}1\${SEDdD} -\${SEDuA}MPI_OFFSET_IS_INT\${SEDuB}MPI_OFFSET_IS_INT\${SEDuC}1\${SEDuD} -\${SEDeA}MPI_OFFSET_IS_INT\${SEDeB}MPI_OFFSET_IS_INT\${SEDeC}1\${SEDeD} -" -} - - LL="\%d" - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - else - DEFINE_MPI_OFFSET="" - LL="\%ld" - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - fi -else - Pac_name="long long" - 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 - - - eval Pac_testval=\$"CROSS_SIZEOF_LONG_LONG" -fi -if test -n "$Pac_testval" ; then - Pac_CV_NAME=$Pac_testval -else -if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for size of long long""... $ac_c" -else -echo $ac_n "checking for size of long long""... $ac_c" 1>&1 -fi -/bin/rm -f conftestval -cat > conftest.c < -main(int argc, char** argv) { - FILE *f=fopen("conftestval","w"); - if (!f) exit(1); - fprintf( f, "%d\n", sizeof(long long)); - exit(0); -} -EOF -eval $compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - Pac_CV_NAME=`cat conftestval` - -else - Pac_CV_NAME="" -fi -rm -fr conftest* -/bin/rm -f conftestval -if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$Pac_CV_NAME" -else -echo "$ac_t""$Pac_CV_NAME" 1>&1 -fi - eval ${Pac_varname}_len=$Pac_CV_NAME -else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""unavailable" -else -echo "$ac_t""unavailable" 1>&1 -fi -fi -fi -longlongsize=$Pac_CV_NAME - - if test -n "$longlongsize" ; then - if test "$longlongsize" = 8 ; then - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if the compiler prints long longs correctly with %lld""... $ac_c" -else -echo $ac_n "checking if the compiler prints long longs correctly with %lld""... $ac_c" 1>&1 -fi -rm -f conftestll -cat > conftest.c < -main(int argc, char** argv) { - long long i=8; - FILE *f=fopen("conftestll","w"); - if (!f) exit(1); - fprintf( f, "%lld\n", i); - exit(0); -} -EOF -eval $compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - Pac_CV_NAME=`cat conftestll` - -else - Pac_CV_NAME="" -fi -rm -fr conftest* -rm -f conftestll -if test "$Pac_CV_NAME" = 8 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_LONG_LONG_64" -echo "#define" HAVE_LONG_LONG_64 1 >> confdefs.h -DEFS="$DEFS -DHAVE_LONG_LONG_64=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LONG_LONG_64\${SEDdB}HAVE_LONG_LONG_64\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_LONG_LONG_64\${SEDuB}HAVE_LONG_LONG_64\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_LONG_LONG_64\${SEDeB}HAVE_LONG_LONG_64\${SEDeC}1\${SEDeD} -" -} - - 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 - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if the compiler prints long longs correctly with %ld""... $ac_c" -else -echo $ac_n "checking if the compiler prints long longs correctly with %ld""... $ac_c" 1>&1 -fi - cat > conftest.c < - main(int argc, char** argv) { - long long i=8; - FILE *f=fopen("conftestll","w"); - if (!f) exit(1); - fprintf( f, "%ld\n", i); - exit(0); - } -EOF -eval $compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - Pac_CV_NAME=`cat conftestll` - -else - Pac_CV_NAME="" -fi -rm -fr conftest* - rm -f conftestll - if test "$Pac_CV_NAME" = 8 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_LONG_LONG_64" -echo "#define" HAVE_LONG_LONG_64 1 >> confdefs.h -DEFS="$DEFS -DHAVE_LONG_LONG_64=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LONG_LONG_64\${SEDdB}HAVE_LONG_LONG_64\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_LONG_LONG_64\${SEDuB}HAVE_LONG_LONG_64\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_LONG_LONG_64\${SEDeB}HAVE_LONG_LONG_64\${SEDeC}1\${SEDeD} -" -} - - 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 - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no!!" -else -echo "$ac_t""no!!" 1>&1 -fi - echo "the compiler doesn't print long longs correctly!" - DEFINE_MPI_OFFSET="" - LL="\%ld" - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - fi -fi - - else - DEFINE_MPI_OFFSET="" - LL="\%ld" - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - fi - else - rm -f ltest.c - cat > ltest.c < /dev/null 2>&1 - if test -x conftest ; then - echo "assuming size of long long is 8bytes; use '-longlongsize' to indicate otherwise" - rm -f conftest ltest.c - echo "defining MPI_Offset as long long in C and integer*8 in Fortran" - -{ -test -n "$verbose" && \ -echo " defining HAVE_LONG_LONG_64" -echo "#define" HAVE_LONG_LONG_64 1 >> confdefs.h -DEFS="$DEFS -DHAVE_LONG_LONG_64=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LONG_LONG_64\${SEDdB}HAVE_LONG_LONG_64\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_LONG_LONG_64\${SEDuB}HAVE_LONG_LONG_64\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_LONG_LONG_64\${SEDeB}HAVE_LONG_LONG_64\${SEDeC}1\${SEDeD} -" -} - - DEFINE_MPI_OFFSET="typedef long long MPI_Offset;" - FORTRAN_MPI_OFFSET="integer*8" - LL="\%lld" - else - echo "assuming long long is not available; use '-longlongsize' to indicate otherwise" - DEFINE_MPI_OFFSET="" - LL="\%ld" - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - fi - fi -fi - -# -# -if test -n "$longlongsize"; then - if test $FROM_MPICH = 0 ; then - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if MPI_LONG_LONG_INT is defined in mpi.h""... $ac_c" -else -echo $ac_n "checking if MPI_LONG_LONG_INT is defined in mpi.h""... $ac_c" 1>&1 -fi - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_MPI_LONG_LONG_INT" -echo "#define" HAVE_MPI_LONG_LONG_INT 1 >> confdefs.h -DEFS="$DEFS -DHAVE_MPI_LONG_LONG_INT=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPI_LONG_LONG_INT\${SEDdB}HAVE_MPI_LONG_LONG_INT\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_MPI_LONG_LONG_INT\${SEDuB}HAVE_MPI_LONG_LONG_INT\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_MPI_LONG_LONG_INT\${SEDeB}HAVE_MPI_LONG_LONG_INT\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi - rm -f conftest mpitest.c - - else - -{ -test -n "$verbose" && \ -echo " defining HAVE_MPI_LONG_LONG_INT" -echo "#define" HAVE_MPI_LONG_LONG_INT 1 >> confdefs.h -DEFS="$DEFS -DHAVE_MPI_LONG_LONG_INT=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPI_LONG_LONG_INT\${SEDdB}HAVE_MPI_LONG_LONG_INT\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_MPI_LONG_LONG_INT\${SEDuB}HAVE_MPI_LONG_LONG_INT\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_MPI_LONG_LONG_INT\${SEDeB}HAVE_MPI_LONG_LONG_INT\${SEDeC}1\${SEDeD} -" -} - - fi -fi -# -if test -n "$OFFSET_KIND" -a "A$MPI_OFFSET_KIND1" = "A!" ; then - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" -else - if test "$FORTRAN_MPI_OFFSET" = "integer*8" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for Fortran 90 KIND parameter for 8-byte integers""... $ac_c" -else -echo $ac_n "checking for Fortran 90 KIND parameter for 8-byte integers""... $ac_c" 1>&1 -fi -rm -f kind.f kind.o kind -cat < kind.f - program main - integer i - i = selected_int_kind(16) - open(8, file="k.out", form="formatted") - write (8,*) i - close(8) - stop - end -EOF -if test -z "$F90" ; then - F90=f90 -fi -KINDVAL="" -if $F90 -o kind kind.f >/dev/null 2>&1 ; then - ./kind ++quiet >/dev/null 2>&1 - if test -s k.out ; then - KINDVAL=`cat k.out` - fi -fi -rm -f kind k.out kind.f kind.o k.out -if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$KINDVAL" -else -echo "$ac_t""$KINDVAL" 1>&1 -fi - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" -else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""unavailable" -else -echo "$ac_t""unavailable" 1>&1 -fi -fi - - fi - # - if test "$FORTRAN_MPI_OFFSET" = "integer" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for Fortran 90 KIND parameter for 4-byte integers""... $ac_c" -else -echo $ac_n "checking for Fortran 90 KIND parameter for 4-byte integers""... $ac_c" 1>&1 -fi -rm -f kind.f kind.o kind -cat < kind.f - program main - integer i - i = selected_int_kind(8) - open(8, file="k.out", form="formatted") - write (8,*) i - close(8) - stop - end -EOF -if test -z "$F90" ; then - F90=f90 -fi -KINDVAL="" -if $F90 -o kind kind.f >/dev/null 2>&1 ; then - ./kind ++quiet >/dev/null 2>&1 - if test -s k.out ; then - KINDVAL=`cat k.out` - fi -fi -rm -f kind k.out kind.f kind.o -if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$KINDVAL" -else -echo "$ac_t""$KINDVAL" 1>&1 -fi - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" -else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""unavailable" -else -echo "$ac_t""unavailable" 1>&1 -fi -fi - - fi -fi -# -# check if MPI_Info functions are defined in the MPI implementation -if test $FROM_MPICH = 0 ; then - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if MPI_Info functions are defined in the MPI implementation""... $ac_c" -else -echo $ac_n "checking if MPI_Info functions are defined in the MPI implementation""... $ac_c" 1>&1 -fi - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_MPI_INFO" -echo "#define" HAVE_MPI_INFO 1 >> confdefs.h -DEFS="$DEFS -DHAVE_MPI_INFO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPI_INFO\${SEDdB}HAVE_MPI_INFO\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_MPI_INFO\${SEDuB}HAVE_MPI_INFO\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_MPI_INFO\${SEDeB}HAVE_MPI_INFO\${SEDeC}1\${SEDeD} -" -} - - HAVE_MPI_INFO="#define HAVE_MPI_INFO 1" - MPI_FINFO1="!" - MPI_FINFO2="!" - MPI_FINFO3="!" - MPI_FINFO4="!" - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - BUILD_MPI_INFO=1 - MPI_FINFO1=" INTEGER MPI_MAX_INFO_KEY, MPI_MAX_INFO_VAL" - MPI_FINFO2=" PARAMETER (MPI_MAX_INFO_KEY=255, MPI_MAX_INFO_VAL=1024)" - MPI_FINFO3=" INTEGER MPI_INFO_NULL" - MPI_FINFO4=" PARAMETER (MPI_INFO_NULL=0)" - fi - rm -f conftest mpitest.c - -else - -{ -test -n "$verbose" && \ -echo " defining HAVE_MPI_INFO" -echo "#define" HAVE_MPI_INFO 1 >> confdefs.h -DEFS="$DEFS -DHAVE_MPI_INFO=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPI_INFO\${SEDdB}HAVE_MPI_INFO\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_MPI_INFO\${SEDuB}HAVE_MPI_INFO\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_MPI_INFO\${SEDeB}HAVE_MPI_INFO\${SEDeC}1\${SEDeD} -" -} - - HAVE_MPI_INFO="#define HAVE_MPI_INFO 1" - MPI_FINFO1="!" - MPI_FINFO2="!" - MPI_FINFO3="!" - MPI_FINFO4="!" -fi -# -if test -n "$mpi_sgi"; then - if test -z "$HAVE_MPI_INFO" ; then - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if MPI_INFO_NULL is defined in mpi.h""... $ac_c" -else -echo $ac_n "checking if MPI_INFO_NULL is defined in mpi.h""... $ac_c" 1>&1 -fi - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - cp adio/sgi/mpi3.1/*.h include - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi - rm -f conftest mpitest.c - # is MPI_INFO_NULL defined in mpi.h? - fi - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if MPI_SGI_type_is_contig is defined""... $ac_c" -else -echo $ac_n "checking if MPI_SGI_type_is_contig is defined""... $ac_c" 1>&1 -fi - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining NO_MPI_SGI_type_is_contig" -echo "#define" NO_MPI_SGI_type_is_contig 1 >> confdefs.h -DEFS="$DEFS -DNO_MPI_SGI_type_is_contig=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NO_MPI_SGI_type_is_contig\${SEDdB}NO_MPI_SGI_type_is_contig\${SEDdC}1\${SEDdD} -\${SEDuA}NO_MPI_SGI_type_is_contig\${SEDuB}NO_MPI_SGI_type_is_contig\${SEDuC}1\${SEDuD} -\${SEDeA}NO_MPI_SGI_type_is_contig\${SEDeB}NO_MPI_SGI_type_is_contig\${SEDeC}1\${SEDeD} -" -} - - fi - rm -f conftest mpitest.c - - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if MPI-2 combiners are defined in mpi.h""... $ac_c" -else -echo $ac_n "checking if MPI-2 combiners are defined in mpi.h""... $ac_c" 1>&1 -fi - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_MPI_COMBINERS" -echo "#define" HAVE_MPI_COMBINERS 1 >> confdefs.h -DEFS="$DEFS -DHAVE_MPI_COMBINERS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPI_COMBINERS\${SEDdB}HAVE_MPI_COMBINERS\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_MPI_COMBINERS\${SEDuB}HAVE_MPI_COMBINERS\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_MPI_COMBINERS\${SEDeB}HAVE_MPI_COMBINERS\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi - rm -f conftest mpitest.c - - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if MPI_OFFSET_KIND is defined in mpif.h""... $ac_c" -else -echo $ac_n "checking if MPI_OFFSET_KIND is defined in mpif.h""... $ac_c" 1>&1 -fi - rm -f mpitest.f - cat > mpitest.f < /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - MPI_OFFSET_KIND1="!" - MPI_OFFSET_KIND2="!" - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi - rm -f conftest mpitest.f - -fi -# -# check if darray and subarray constructors are defined in the MPI implementation -if test $FROM_MPICH = 0 ; then - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if darray and subarray constructors are defined in the MPI implementation""... $ac_c" -else -echo $ac_n "checking if darray and subarray constructors are defined in the MPI implementation""... $ac_c" 1>&1 -fi - rm -f mpitest.c - cat > mpitest.c < /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_MPI_DARRAY_SUBARRAY" -echo "#define" HAVE_MPI_DARRAY_SUBARRAY 1 >> confdefs.h -DEFS="$DEFS -DHAVE_MPI_DARRAY_SUBARRAY=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPI_DARRAY_SUBARRAY\${SEDdB}HAVE_MPI_DARRAY_SUBARRAY\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_MPI_DARRAY_SUBARRAY\${SEDuB}HAVE_MPI_DARRAY_SUBARRAY\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_MPI_DARRAY_SUBARRAY\${SEDeB}HAVE_MPI_DARRAY_SUBARRAY\${SEDeC}1\${SEDeD} -" -} - - HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" - MPI_FARRAY1="!" - MPI_FARRAY2="!" - MPI_FARRAY3="!" - MPI_FARRAY4="!" - MPI_FARRAY5="!" - MPI_FARRAY6="!" - MPI_FARRAY7="!" - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - BUILD_MPI_ARRAY=1 - MPI_FARRAY1=" INTEGER MPI_ORDER_C, MPI_ORDER_FORTRAN" - MPI_FARRAY2=" PARAMETER (MPI_ORDER_C=56, MPI_ORDER_FORTRAN=57)" - MPI_FARRAY3=" INTEGER MPI_DISTRIBUTE_BLOCK, MPI_DISTRIBUTE_CYCLIC" - MPI_FARRAY4=" INTEGER MPI_DISTRIBUTE_NONE, MPI_DISTRIBUTE_DFLT_DARG" - MPI_FARRAY5=" PARAMETER (MPI_DISTRIBUTE_BLOCK=121, MPI_DISTRIBUTE_CYCLIC=122)" - MPI_FARRAY6=" PARAMETER (MPI_DISTRIBUTE_NONE=123)" - MPI_FARRAY7=" PARAMETER (MPI_DISTRIBUTE_DFLT_DARG=-49767)" - fi - rm -f conftest mpitest.c - -else - -{ -test -n "$verbose" && \ -echo " defining HAVE_MPI_DARRAY_SUBARRAY" -echo "#define" HAVE_MPI_DARRAY_SUBARRAY 1 >> confdefs.h -DEFS="$DEFS -DHAVE_MPI_DARRAY_SUBARRAY=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPI_DARRAY_SUBARRAY\${SEDdB}HAVE_MPI_DARRAY_SUBARRAY\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_MPI_DARRAY_SUBARRAY\${SEDuB}HAVE_MPI_DARRAY_SUBARRAY\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_MPI_DARRAY_SUBARRAY\${SEDeB}HAVE_MPI_DARRAY_SUBARRAY\${SEDeC}1\${SEDeD} -" -} - - HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" - MPI_FARRAY1="!" - MPI_FARRAY2="!" - MPI_FARRAY3="!" - MPI_FARRAY4="!" - MPI_FARRAY5="!" - MPI_FARRAY6="!" - MPI_FARRAY7="!" -fi -# -# Check to see if the compiler accepts prototypes -# -# -# Test for weak symbol support... -# We can't put # in the message because it causes autoconf to generate -# incorrect code -HAVE_WEAK_SYMBOLS=0 -if test -n "$arch_hpux" || test -n "$arch_sppux" ; then -# multiple secondary definitions not allowed by HP compilers -# Fortran interface for HP already uses one secondary defn. -# therefore, do not use this method for profiling interface. -# build profiling interface explicitly. - TRY_WEAK_SYMBOLS=0 -fi -if test $TRY_WEAK_SYMBOLS = 1 ; then - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for weak symbol support""... $ac_c" -else -echo $ac_n "checking for weak symbol support""... $ac_c" 1>&1 -fi - if test -z "$ac_ext" ; then - ac_ext=c -fi -cat > conftest.$ac_ext <> config.log ; fi -fi -rm -f conftest* - - # - # Some systems (Linux ia64 and ecc, for example), support weak symbols - # only within a single object file! This tests that case. - if test "$has_pragma_weak" = 1 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""pragma weak" -else -echo "$ac_t""pragma weak" 1>&1 -fi - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking that weak symbols are visible to other files""... $ac_c" -else -echo $ac_n "checking that weak symbols are visible to other files""... $ac_c" 1>&1 -fi - rm -f conftest* - cat >>conftest1.c <>conftest2.c <&1 -fi - else - echo "$ac_link2" >>config.log - echo "Failed program was" >>config.log - cat conftest1.c >>config.log - cat conftest2.c >>config.log - if test -s conftest.out ; then cat conftest.out >> config.log ; fi - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - has_pragma_weak=0 - fi - rm -f conftest* - fi - if test "$has_pragma_weak" = 1 ; then - HAVE_WEAK_SYMBOLS=1 - -{ -test -n "$verbose" && \ -echo " defining HAVE_WEAK_SYMBOLS" -echo "#define" HAVE_WEAK_SYMBOLS 1 >> confdefs.h -DEFS="$DEFS -DHAVE_WEAK_SYMBOLS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WEAK_SYMBOLS\${SEDdB}HAVE_WEAK_SYMBOLS\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_WEAK_SYMBOLS\${SEDuB}HAVE_WEAK_SYMBOLS\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_WEAK_SYMBOLS\${SEDeB}HAVE_WEAK_SYMBOLS\${SEDeC}1\${SEDeD} -" -} - - -{ -test -n "$verbose" && \ -echo " defining HAVE_PRAGMA_WEAK" -echo "#define" HAVE_PRAGMA_WEAK 1 >> confdefs.h -DEFS="$DEFS -DHAVE_PRAGMA_WEAK=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PRAGMA_WEAK\${SEDdB}HAVE_PRAGMA_WEAK\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_PRAGMA_WEAK\${SEDuB}HAVE_PRAGMA_WEAK\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_PRAGMA_WEAK\${SEDeB}HAVE_PRAGMA_WEAK\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_ext" ; then - ac_ext=c -fi -cat > conftest.$ac_ext <> config.log ; fi -fi -rm -f conftest* - - if test "$has_pragma_hp_secondary" = 1 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""pragma _HP_SECONDARY_DEF" -else -echo "$ac_t""pragma _HP_SECONDARY_DEF" 1>&1 -fi - HAVE_WEAK_SYMBOLS=1 - -{ -test -n "$verbose" && \ -echo " defining HAVE_WEAK_SYMBOLS" -echo "#define" HAVE_WEAK_SYMBOLS 1 >> confdefs.h -DEFS="$DEFS -DHAVE_WEAK_SYMBOLS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WEAK_SYMBOLS\${SEDdB}HAVE_WEAK_SYMBOLS\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_WEAK_SYMBOLS\${SEDuB}HAVE_WEAK_SYMBOLS\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_WEAK_SYMBOLS\${SEDeB}HAVE_WEAK_SYMBOLS\${SEDeC}1\${SEDeD} -" -} - - -{ -test -n "$verbose" && \ -echo " defining HAVE_PRAGMA_HP_SEC_DEF" -echo "#define" HAVE_PRAGMA_HP_SEC_DEF 1 >> confdefs.h -DEFS="$DEFS -DHAVE_PRAGMA_HP_SEC_DEF=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PRAGMA_HP_SEC_DEF\${SEDdB}HAVE_PRAGMA_HP_SEC_DEF\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_PRAGMA_HP_SEC_DEF\${SEDuB}HAVE_PRAGMA_HP_SEC_DEF\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_PRAGMA_HP_SEC_DEF\${SEDeB}HAVE_PRAGMA_HP_SEC_DEF\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_ext" ; then - ac_ext=c -fi -cat > conftest.$ac_ext <> config.log ; fi -fi -rm -f conftest* - - if test "$has_pragma_cri_duplicate" = 1 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""pragma _CRI duplicate x as y" -else -echo "$ac_t""pragma _CRI duplicate x as y" 1>&1 -fi - HAVE_WEAK_SYMBOLS=1 - -{ -test -n "$verbose" && \ -echo " defining HAVE_WEAK_SYMBOLS" -echo "#define" HAVE_WEAK_SYMBOLS 1 >> confdefs.h -DEFS="$DEFS -DHAVE_WEAK_SYMBOLS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WEAK_SYMBOLS\${SEDdB}HAVE_WEAK_SYMBOLS\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_WEAK_SYMBOLS\${SEDuB}HAVE_WEAK_SYMBOLS\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_WEAK_SYMBOLS\${SEDeB}HAVE_WEAK_SYMBOLS\${SEDeC}1\${SEDeD} -" -} - - -{ -test -n "$verbose" && \ -echo " defining HAVE_PRAGMA_CRI_DUP" -echo "#define" HAVE_PRAGMA_CRI_DUP 1 >> confdefs.h -DEFS="$DEFS -DHAVE_PRAGMA_CRI_DUP=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PRAGMA_CRI_DUP\${SEDdB}HAVE_PRAGMA_CRI_DUP\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_PRAGMA_CRI_DUP\${SEDuB}HAVE_PRAGMA_CRI_DUP\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_PRAGMA_CRI_DUP\${SEDeB}HAVE_PRAGMA_CRI_DUP\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi - fi - fi -fi - -# -# if FILE_SYSTEM is not set above, use ufs and nfs as default -# -if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" -fi -# -if test -n "$file_system_nfs" ; then - # Check for problems with locks - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking whether file locks work with NFS""... $ac_c" -else -echo $ac_n "checking whether file locks work with NFS""... $ac_c" 1>&1 -fi - cat > conftest.c < -#include -#include - -int main(int argc, char** argv) -{ - struct flock lock; - int fd, err; - - lock.l_type = F_WRLCK; - lock.l_start = 0; - lock.l_whence = SEEK_SET; - lock.l_len = 100; - - fd = open("conftest.dat", O_RDWR | O_CREAT, 0644); - - err = fcntl(fd, F_SETLKW, &lock); - - /* printf("err = %d, errno = %d\n", err, errno); */ - close(fd); - return err; -} -EOF -eval $compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - nfs_locks_work=yes - -else - nfs_locks_work=no -fi -rm -fr conftest* - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$nfs_locks_work" -else -echo "$ac_t""$nfs_locks_work" 1>&1 -fi - if test "$nfs_locks_work" != "yes" ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""Warning: File locks do not work with NFS. See the Installation and -users manual for instructions on fixing this" -else -echo "$ac_t""Warning: File locks do not work with NFS. See the Installation and -users manual for instructions on fixing this" 1>&1 -fi - fi -fi -if test -n "$file_system_nfs"; then - -{ -test -n "$verbose" && \ -echo " defining NFS" -echo "#define" NFS 1 >> confdefs.h -DEFS="$DEFS -DNFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NFS\${SEDdB}NFS\${SEDdC}1\${SEDdD} -\${SEDuA}NFS\${SEDuB}NFS\${SEDuC}1\${SEDuD} -\${SEDeA}NFS\${SEDeB}NFS\${SEDeC}1\${SEDeD} -" -} - -fi -if test -n "$file_system_ufs"; then - -{ -test -n "$verbose" && \ -echo " defining UFS" -echo "#define" UFS 1 >> confdefs.h -DEFS="$DEFS -DUFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}UFS\${SEDdB}UFS\${SEDdC}1\${SEDdD} -\${SEDuA}UFS\${SEDuB}UFS\${SEDuC}1\${SEDuD} -\${SEDeA}UFS\${SEDeB}UFS\${SEDeC}1\${SEDeD} -" -} - -fi -if test -n "$file_system_hfs"; then - -{ -test -n "$verbose" && \ -echo " defining HFS" -echo "#define" HFS 1 >> confdefs.h -DEFS="$DEFS -DHFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HFS\${SEDdB}HFS\${SEDdC}1\${SEDdD} -\${SEDuA}HFS\${SEDuB}HFS\${SEDuC}1\${SEDuD} -\${SEDeA}HFS\${SEDeB}HFS\${SEDeC}1\${SEDeD} -" -} - -fi -if test -n "$file_system_sfs"; then - -{ -test -n "$verbose" && \ -echo " defining SFS" -echo "#define" SFS 1 >> confdefs.h -DEFS="$DEFS -DSFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}SFS\${SEDdB}SFS\${SEDdC}1\${SEDdD} -\${SEDuA}SFS\${SEDuB}SFS\${SEDuC}1\${SEDuD} -\${SEDeA}SFS\${SEDeB}SFS\${SEDeC}1\${SEDeD} -" -} - -fi -if test -n "$file_system_xfs"; then - -{ -test -n "$verbose" && \ -echo " defining XFS" -echo "#define" XFS 1 >> confdefs.h -DEFS="$DEFS -DXFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}XFS\${SEDdB}XFS\${SEDdC}1\${SEDdD} -\${SEDuA}XFS\${SEDuB}XFS\${SEDuC}1\${SEDuD} -\${SEDeA}XFS\${SEDeB}XFS\${SEDeC}1\${SEDeD} -" -} - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for memory alignment needed for direct I/O""... $ac_c" -else -echo $ac_n "checking for memory alignment needed for direct I/O""... $ac_c" 1>&1 -fi -/bin/rm -f memalignval -/bin/rm -f /tmp/romio_tmp.bin -cat > conftest.c < -#include -#include -#include -main(int argc, char** argv) { - struct dioattr st; - int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); - FILE *f=fopen("memalignval","w"); - if (fd == -1) exit(1); - if (!f) exit(1); - fcntl(fd, F_DIOINFO, &st); - fprintf( f, "%u\n", st.d_mem); - exit(0); -} -EOF -eval $compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - Pac_CV_NAME=`cat memalignval` - -else - Pac_CV_NAME="" -fi -rm -fr conftest* -/bin/rm -f memalignval -/bin/rm -f /tmp/romio_tmp.bin -if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""$Pac_CV_NAME" -else -echo "$ac_t""$Pac_CV_NAME" 1>&1 -fi - CFLAGS="$CFLAGS -DXFS_MEMALIGN=$Pac_CV_NAME" -else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""unavailable" -else -echo "$ac_t""unavailable" 1>&1 -fi - CFLAGS="$CFLAGS -DXFS_MEMALIGN=128" -fi - -fi -if test -n "$file_system_pvfs"; then - # Use ROMIO_PVFS instead of PVFS because FREEBSD defines PVFS. - -{ -test -n "$verbose" && \ -echo " defining ROMIO_PVFS" -echo "#define" ROMIO_PVFS 1 >> confdefs.h -DEFS="$DEFS -DROMIO_PVFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}ROMIO_PVFS\${SEDdB}ROMIO_PVFS\${SEDdC}1\${SEDdD} -\${SEDuA}ROMIO_PVFS\${SEDuB}ROMIO_PVFS\${SEDuC}1\${SEDuD} -\${SEDeA}ROMIO_PVFS\${SEDeB}ROMIO_PVFS\${SEDeC}1\${SEDeD} -" -} - -fi -if test -n "$file_system_pfs"; then - -{ -test -n "$verbose" && \ -echo " defining PFS" -echo "#define" PFS 1 >> confdefs.h -DEFS="$DEFS -DPFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}PFS\${SEDdB}PFS\${SEDdC}1\${SEDdD} -\${SEDuA}PFS\${SEDuB}PFS\${SEDuC}1\${SEDuD} -\${SEDeA}PFS\${SEDeB}PFS\${SEDeC}1\${SEDeD} -" -} - -fi -if test -n "$file_system_testfs"; then - -{ -test -n "$verbose" && \ -echo " defining ROMIO_TESTFS" -echo "#define" ROMIO_TESTFS 1 >> confdefs.h -DEFS="$DEFS -DROMIO_TESTFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}ROMIO_TESTFS\${SEDdB}ROMIO_TESTFS\${SEDdC}1\${SEDdD} -\${SEDuA}ROMIO_TESTFS\${SEDuB}ROMIO_TESTFS\${SEDuC}1\${SEDuD} -\${SEDeA}ROMIO_TESTFS\${SEDeB}ROMIO_TESTFS\${SEDeC}1\${SEDeD} -" -} - -fi -if test -n "$file_system_piofs"; then - -{ -test -n "$verbose" && \ -echo " defining PIOFS" -echo "#define" PIOFS 1 >> confdefs.h -DEFS="$DEFS -DPIOFS=1" -SEDDEFS="${SEDDEFS}\${SEDdA}PIOFS\${SEDdB}PIOFS\${SEDdC}1\${SEDdD} -\${SEDuA}PIOFS\${SEDuB}PIOFS\${SEDuC}1\${SEDuD} -\${SEDeA}PIOFS\${SEDeB}PIOFS\${SEDeC}1\${SEDeD} -" -} - - USER_CFLAGS="$USER_CFLAGS -bI:/usr/include/piofs/piofs.exp" - ROMIO_LFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp" - USER_FFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp" -fi -if test -n "$mpi_mpich"; then - -{ -test -n "$verbose" && \ -echo " defining NEEDS_MPI_TEST" -echo "#define" NEEDS_MPI_TEST 1 >> confdefs.h -DEFS="$DEFS -DNEEDS_MPI_TEST=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NEEDS_MPI_TEST\${SEDdB}NEEDS_MPI_TEST\${SEDdC}1\${SEDdD} -\${SEDuA}NEEDS_MPI_TEST\${SEDuB}NEEDS_MPI_TEST\${SEDuC}1\${SEDuD} -\${SEDeA}NEEDS_MPI_TEST\${SEDeB}NEEDS_MPI_TEST\${SEDeC}1\${SEDeD} -" -} - - -{ -test -n "$verbose" && \ -echo " defining MPICH" -echo "#define" MPICH 1 >> confdefs.h -DEFS="$DEFS -DMPICH=1" -SEDDEFS="${SEDDEFS}\${SEDdA}MPICH\${SEDdB}MPICH\${SEDdC}1\${SEDdD} -\${SEDuA}MPICH\${SEDuB}MPICH\${SEDuC}1\${SEDuD} -\${SEDeA}MPICH\${SEDeB}MPICH\${SEDeC}1\${SEDeD} -" -} - - if test -z "$arch_SX4" ; then - MPIOF_H_INCLUDED=1 - fi -fi -if test -n "$mpi_sgi"; then - -{ -test -n "$verbose" && \ -echo " defining MPISGI" -echo "#define" MPISGI 1 >> confdefs.h -DEFS="$DEFS -DMPISGI=1" -SEDDEFS="${SEDDEFS}\${SEDdA}MPISGI\${SEDdB}MPISGI\${SEDdC}1\${SEDdD} -\${SEDuA}MPISGI\${SEDuB}MPISGI\${SEDuC}1\${SEDuD} -\${SEDeA}MPISGI\${SEDeB}MPISGI\${SEDeC}1\${SEDeD} -" -} - -fi -if test -n "$mpi_lam"; then - -{ -test -n "$verbose" && \ -echo " defining MPILAM" -echo "#define" MPILAM 1 >> confdefs.h -DEFS="$DEFS -DMPILAM=1" -SEDDEFS="${SEDDEFS}\${SEDdA}MPILAM\${SEDdB}MPILAM\${SEDdC}1\${SEDdD} -\${SEDuA}MPILAM\${SEDuB}MPILAM\${SEDuC}1\${SEDuD} -\${SEDeA}MPILAM\${SEDeB}MPILAM\${SEDeC}1\${SEDeD} -" -} - -fi -if test -n "$mpi_hp"; then - -{ -test -n "$verbose" && \ -echo " defining MPIHP" -echo "#define" MPIHP 1 >> confdefs.h -DEFS="$DEFS -DMPIHP=1" -SEDDEFS="${SEDDEFS}\${SEDdA}MPIHP\${SEDdB}MPIHP\${SEDdC}1\${SEDdD} -\${SEDuA}MPIHP\${SEDuB}MPIHP\${SEDuC}1\${SEDuD} -\${SEDeA}MPIHP\${SEDeB}MPIHP\${SEDeC}1\${SEDeD} -" -} - - if test "$NOF77" = 0; then - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if mpiof.h is included in mpif.h""... $ac_c" -else -echo $ac_n "checking if mpiof.h is included in mpif.h""... $ac_c" 1>&1 -fi - rm -f mpitest.f - cat > mpitest.f < /dev/null 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - MPIOF_H_INCLUDED=1 - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi - rm -f conftest mpitest.f - - fi -fi -# - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for strerror()""... $ac_c" -else -echo $ac_n "checking for strerror()""... $ac_c" 1>&1 -fi - rm -f conftest.c - cat > conftest.c < - main(int argc, char** argv) - { - char *s = strerror(5); - } -EOF - rm -f conftest - $CC $USER_CFLAGS -o conftest conftest.c >> config.log 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_STRERROR" -echo "#define" HAVE_STRERROR 1 >> confdefs.h -DEFS="$DEFS -DHAVE_STRERROR=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_STRERROR\${SEDdB}HAVE_STRERROR\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_STRERROR\${SEDuB}HAVE_STRERROR\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_STRERROR\${SEDeB}HAVE_STRERROR\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking for sys_errlist""... $ac_c" -else -echo $ac_n "checking for sys_errlist""... $ac_c" 1>&1 -fi - rm -f conftest.c - - cat > conftest.c < - main(int argc, char** argv) - { - extern char *sys_errlist[]; - printf("%s\n", sys_errlist[34]); - } -EOF - - rm -f conftest - $CC $USER_CFLAGS -o conftest conftest.c > config.log 2>&1 - if test -x conftest ; then - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - -{ -test -n "$verbose" && \ -echo " defining HAVE_SYSERRLIST" -echo "#define" HAVE_SYSERRLIST 1 >> confdefs.h -DEFS="$DEFS -DHAVE_SYSERRLIST=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYSERRLIST\${SEDdB}HAVE_SYSERRLIST\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_SYSERRLIST\${SEDuB}HAVE_SYSERRLIST\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_SYSERRLIST\${SEDeB}HAVE_SYSERRLIST\${SEDeC}1\${SEDeD} -" -} - - else - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - fi - fi - rm -f conftest conftest.c - -if test -z "$srcdir" -o "$srcdir" = "." ; then srcdir="$ROMIO_HOME" ; fi - -if test -z "$LIBNAME"; then -LIBNAME="$ROMIO_HOME/lib/$ARCH/libmpio.a" -fi -# -if test ! -d $ROMIO_HOME/lib ; then - mkdir $ROMIO_HOME/lib -fi -if test ! -d $ROMIO_HOME/lib/$ARCH ; then - mkdir $ROMIO_HOME/lib/$ARCH -fi -# -if test $NOF77 = 1 ; then - F77=":" -else - FORTRAN_TEST="fperf fcoll_test fmisc" - # Disabled FORTRAN_TEST: pfcoll_test (no PMPI support in AMPI yet) -fi -# -if test $FROM_MPICH = 0 ; then - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if a simple MPI program compiles and links""... $ac_c" -else -echo $ac_n "checking if a simple MPI program compiles and links""... $ac_c" 1>&1 -fi - rm -f mpitest.c - cat > mpitest.c <&1 -fi - - - if test -z "$ac_echo_n" ; then -ac_echo_n=yes -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -ac_echo_test=`echo foo 1>&1` -if test -z "$ac_echo_test" ; then - print_error "Your sh shell does not handle the output redirection" - print_error "1>&1 correctly. Configure will work around this problem," - print_error "but you should report the problem to your vendor." -fi - -fi -if test -z "$ac_echo_test" -a 1 = 1 ; then -echo $ac_n "checking if MPI_Fint is defined in the MPI implementation""... $ac_c" -else -echo $ac_n "checking if MPI_Fint is defined in the MPI implementation""... $ac_c" 1>&1 -fi - cat > mpitest1.c < /dev/null 2>&1 - if test ! -s mpitest1.o ; then - NEEDS_MPI_FINT="#define NEEDS_MPI_FINT" - CFLAGS="$CFLAGS -DNEEDS_MPI_FINT" - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""no" -else -echo "$ac_t""no" 1>&1 -fi - rm -f mpitest1.o mpitest1.c - else - NEEDS_MPI_FINT="" - if test -z "$ac_echo_test" -a 1 = 1 ; then -echo "$ac_t""yes" -else -echo "$ac_t""yes" 1>&1 -fi - rm -f mpitest1.o mpitest1.c - fi - -else - NEEDS_MPI_FINT="" -fi -# -if test "$MPI_INCLUDE_DIR" = "." ; then - ROMIO_INCLUDE="-I../include" -else - ROMIO_INCLUDE="-I../include -I$MPI_INCLUDE_DIR" -fi -# -TEST_LIBNAME=$LIBNAME -MPIRUN=mpirun -# -# if MPICH, use mpicc in test programs -# -if test $FROM_MPICH = 1 ; then - MPICH_HOME=`dirname $ROMIO_HOME` - if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi - TEST_CC=$MPI_BIN_DIR/mpicc - MPI_LIB="" - ROMIO_INCLUDE="" - USER_CFLAGS="" - USER_FFLAGS="" - TEST_LIBNAME="" - MPIRUN=$MPI_BIN_DIR/mpirun - if test -n "$arch_SX4" || test -n "$arch_hpux" ; then - TEST_F77=$MPI_BIN_DIR/mpif90 - else - TEST_F77=$MPI_BIN_DIR/mpif77 - fi - CC=$MPI_BIN_DIR/mpicc - -{ -test -n "$verbose" && \ -echo " defining HAVE_STATUS_SET_BYTES" -echo "#define" HAVE_STATUS_SET_BYTES 1 >> confdefs.h -DEFS="$DEFS -DHAVE_STATUS_SET_BYTES=1" -SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_STATUS_SET_BYTES\${SEDdB}HAVE_STATUS_SET_BYTES\${SEDdC}1\${SEDdD} -\${SEDuA}HAVE_STATUS_SET_BYTES\${SEDuB}HAVE_STATUS_SET_BYTES\${SEDuC}1\${SEDuD} -\${SEDeA}HAVE_STATUS_SET_BYTES\${SEDeB}HAVE_STATUS_SET_BYTES\${SEDeC}1\${SEDeD} -" -} - -fi -# -if test $MPI != "mpich" ; then - -{ -test -n "$verbose" && \ -echo " defining PRINT_ERR_MSG" -echo "#define" PRINT_ERR_MSG 1 >> confdefs.h -DEFS="$DEFS -DPRINT_ERR_MSG=1" -SEDDEFS="${SEDDEFS}\${SEDdA}PRINT_ERR_MSG\${SEDdB}PRINT_ERR_MSG\${SEDdC}1\${SEDdD} -\${SEDuA}PRINT_ERR_MSG\${SEDuB}PRINT_ERR_MSG\${SEDuC}1\${SEDuD} -\${SEDeA}PRINT_ERR_MSG\${SEDeB}PRINT_ERR_MSG\${SEDeC}1\${SEDeD} -" -} - -fi -# -if test -z "$TEST_CC" ; then - TEST_CC="$CC" -fi -if test -z "$TEST_F77" ; then - TEST_F77="$F77" -fi -# -CFLAGS="$CFLAGS -DHAVE_ROMIOCONF_H" -# -echo "setting CC to $CC" -echo "setting F77 to $F77" -echo "setting TEST_CC to $TEST_CC" -echo "setting TEST_F77 to $TEST_F77" -echo "setting CFLAGS to $CFLAGS" -echo "setting USER_CFLAGS to $USER_CFLAGS" -echo "setting USER_FFLAGS to $USER_FFLAGS" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -if test ! -d adio ; then mkdir adio ; fi -if test ! -d adio/include ; then mkdir adio/include ; fi -#if test ! -d mpi2-other ; then mkdir mpi2-other ; fi -# -# Make sure we remove any configuration file incase there is out-of-date data. -# We remove the version in include in case this is a vpath build -rm -f adio/include/romioconf.h ${top_srcdir}/adio/include/romioconf.h -# -# Create makefiles for all of the adio devices. Only the ones that -# are active will be called by the top level ROMIO make -# Set default prefixes. -if test -n "$prefix"; then - test -z "$exec_prefix" && exec_prefix='${prefix}' - prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" -fi -if test -n "$exec_prefix"; then - prsub="$prsub -s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%" -fi -# Quote sed substitution magic chars in DEFS. -cat >conftest.def < config.status </dev/null | sed 1q`: -# -# $0 $configure_args - -for arg -do - case "\$arg" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args - exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;; - *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; - esac -done - -trap 'rm -fr Makefile mpi-io/Makefile mpi-io/fortran/Makefile mpi2-other/info/Makefile \ - mpi2-other/array/Makefile mpi2-other/array/fortran/Makefile adio/common/Makefile \ - test/Makefile test/misc.c test/large_file.c \ - test/runtests util/romioinstall include/mpio.h \ - include/mpiof.h \ - adio/ad_nfs/Makefile adio/ad_ufs/Makefile \ - adio/ad_xfs/Makefile adio/ad_hfs/Makefile \ - adio/ad_sfs/Makefile adio/ad_pfs/Makefile \ - adio/ad_testfs/Makefile adio/ad_pvfs/Makefile \ - adio/ad_piofs/Makefile adio/include/romioconf.h conftest*; exit 1' 1 3 15 -VPATH='$VPATH' -prefix='$prefix' -exec_prefix='$exec_prefix' -includedir='$includedir' -bindir='$bindir' -sbindir='$sbindir' -libdir='$libdir' -mandir='$mandir' -docdir='$docdir' -htmldir='$htmldir' -RANLIB='$RANLIB' -CC='$CC' -F77='$F77' -CPP='$CPP' -HAVE_WEAK_SYMBOLS='$HAVE_WEAK_SYMBOLS' -srcdir='$srcdir' -ARCH='$ARCH' -FILE_SYSTEM='$FILE_SYSTEM' -CFLAGS='$CFLAGS' -USER_CFLAGS='$USER_CFLAGS' -USER_FFLAGS='$USER_FFLAGS' -MIPS='$MIPS' -BITS='$BITS' -MPI='$MPI' -AR='$AR' -MPI_INCLUDE_DIR='$MPI_INCLUDE_DIR' -MPI_LIB='$MPI_LIB' -NOF77='$NOF77' -NOPROFILE='$NOPROFILE' -MAKE='$MAKE' -PREFIX='$PREFIX' -arch_IRIX='$arch_IRIX' -ROMIO_HOME='$ROMIO_HOME' -LIBNAME='$LIBNAME' -TEST_LIBNAME='$TEST_LIBNAME' -LL='$LL' -F77GETARG='$F77GETARG' -F77IARGC='$F77IARGC' -FTESTDEFINE='$FTESTDEFINE' -FORTRAN_MPI_OFFSET='$FORTRAN_MPI_OFFSET' -FROM_MPICH='$FROM_MPICH' -NEEDS_MPI_FINT='$NEEDS_MPI_FINT' -HAVE_MPI_INFO='$HAVE_MPI_INFO' -BUILD_MPI_INFO='$BUILD_MPI_INFO' -HAVE_MPI_DARRAY_SUBARRAY='$HAVE_MPI_DARRAY_SUBARRAY' -BUILD_MPI_ARRAY='$BUILD_MPI_ARRAY' -DEFINE_MPI_OFFSET='$DEFINE_MPI_OFFSET' -MPI_FINFO1='$MPI_FINFO1' -MPI_FINFO2='$MPI_FINFO2' -MPI_FINFO3='$MPI_FINFO3' -MPI_FINFO4='$MPI_FINFO4' -MPI_FARRAY1='$MPI_FARRAY1' -MPI_FARRAY2='$MPI_FARRAY2' -MPI_FARRAY3='$MPI_FARRAY3' -MPI_FARRAY4='$MPI_FARRAY4' -MPI_FARRAY5='$MPI_FARRAY5' -MPI_FARRAY6='$MPI_FARRAY6' -MPI_FARRAY7='$MPI_FARRAY7' -MPI_OFFSET_KIND1='$MPI_OFFSET_KIND1' -MPI_OFFSET_KIND2='$MPI_OFFSET_KIND2' -TEST_CC='$TEST_CC' -TEST_F77='$TEST_F77' -ROMIO_INCLUDE='$ROMIO_INCLUDE' -ROMIO_LFLAGS='$ROMIO_LFLAGS' -ROMIO_LIBLIST='$ROMIO_LIBLIST' -ROMIO_TCFLAGS='$ROMIO_TCFLAGS' -ROMIO_TCPPFLAGS='$ROMIO_TCPPFLAGS' -ROMIO_TFFLAGS='$ROMIO_TFFLAGS' -MPIRUN='$MPIRUN' -FORTRAN_TEST='$FORTRAN_TEST' -LIBS='$LIBS' -prefix='$prefix' -exec_prefix='$exec_prefix' -prsub='$prsub' -extrasub='$extrasub' -EOF -cat >> config.status <<\EOF - -top_srcdir=$srcdir - -CONFIG_FILES=${CONFIG_FILES-"Makefile mpi-io/Makefile mpi-io/fortran/Makefile mpi2-other/info/Makefile \ - mpi2-other/array/Makefile mpi2-other/array/fortran/Makefile adio/common/Makefile \ - test/Makefile test/misc.c test/large_file.c \ - test/runtests util/romioinstall include/mpio.h \ - include/mpiof.h \ - adio/ad_nfs/Makefile adio/ad_ufs/Makefile \ - adio/ad_xfs/Makefile adio/ad_hfs/Makefile \ - adio/ad_sfs/Makefile adio/ad_pfs/Makefile \ - adio/ad_testfs/Makefile adio/ad_pvfs/Makefile \ - adio/ad_piofs/Makefile "} -for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then - srcdir=$top_srcdir - # Remove last slash and all that follows it. Not all systems have dirname. - dir=`echo $file|sed 's%/[^/][^/]*$%%'` - if test "$dir" != "$file"; then - test "$top_srcdir" != . && srcdir=$top_srcdir/$dir - test ! -d $dir && mkdir $dir - fi - echo creating $file - rm -f $file - echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file -cat $top_srcdir/${file}.in | sed -e " -$prsub -$extrasub -s%@VPATH@%$VPATH%g -s%@prefix@%$prefix%g -s%@exec_prefix@%$exec_prefix%g -s%@includedir@%$includedir%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libdir@%$libdir%g -s%@mandir@%$mandir%g -s%@docdir@%$docdir%g -s%@htmldir@%$htmldir%g -s%@RANLIB@%$RANLIB%g -s%@CC@%$CC%g -s%@F77@%$F77%g -s%@CPP@%$CPP%g -s%@HAVE_WEAK_SYMBOLS@%$HAVE_WEAK_SYMBOLS%g -s%@srcdir@%$srcdir%g -s%@ARCH@%$ARCH%g -s%@FILE_SYSTEM@%$FILE_SYSTEM%g -s%@CFLAGS@%$CFLAGS%g -s%@USER_CFLAGS@%$USER_CFLAGS%g -s%@USER_FFLAGS@%$USER_FFLAGS%g -s%@MIPS@%$MIPS%g -s%@BITS@%$BITS%g -s%@MPI@%$MPI%g -s%@AR@%$AR%g -s%@MPI_INCLUDE_DIR@%$MPI_INCLUDE_DIR%g -s%@MPI_LIB@%$MPI_LIB%g -s%@NOF77@%$NOF77%g -s%@NOPROFILE@%$NOPROFILE%g -s%@MAKE@%$MAKE%g -s%@PREFIX@%$PREFIX%g -s%@arch_IRIX@%$arch_IRIX%g -s%@ROMIO_HOME@%$ROMIO_HOME%g -s%@LIBNAME@%$LIBNAME%g -s%@TEST_LIBNAME@%$TEST_LIBNAME%g -s%@LL@%$LL%g -s%@F77GETARG@%$F77GETARG%g -s%@F77IARGC@%$F77IARGC%g -s%@FTESTDEFINE@%$FTESTDEFINE%g -s%@FORTRAN_MPI_OFFSET@%$FORTRAN_MPI_OFFSET%g" | sed -e " -s%@FROM_MPICH@%$FROM_MPICH%g -s%@NEEDS_MPI_FINT@%$NEEDS_MPI_FINT%g -s%@HAVE_MPI_INFO@%$HAVE_MPI_INFO%g -s%@BUILD_MPI_INFO@%$BUILD_MPI_INFO%g -s%@HAVE_MPI_DARRAY_SUBARRAY@%$HAVE_MPI_DARRAY_SUBARRAY%g -s%@BUILD_MPI_ARRAY@%$BUILD_MPI_ARRAY%g -s%@DEFINE_MPI_OFFSET@%$DEFINE_MPI_OFFSET%g -s%@MPI_FINFO1@%$MPI_FINFO1%g -s%@MPI_FINFO2@%$MPI_FINFO2%g -s%@MPI_FINFO3@%$MPI_FINFO3%g -s%@MPI_FINFO4@%$MPI_FINFO4%g -s%@MPI_FARRAY1@%$MPI_FARRAY1%g -s%@MPI_FARRAY2@%$MPI_FARRAY2%g -s%@MPI_FARRAY3@%$MPI_FARRAY3%g -s%@MPI_FARRAY4@%$MPI_FARRAY4%g -s%@MPI_FARRAY5@%$MPI_FARRAY5%g -s%@MPI_FARRAY6@%$MPI_FARRAY6%g -s%@MPI_FARRAY7@%$MPI_FARRAY7%g -s%@MPI_OFFSET_KIND1@%$MPI_OFFSET_KIND1%g -s%@MPI_OFFSET_KIND2@%$MPI_OFFSET_KIND2%g -s%@TEST_CC@%$TEST_CC%g -s%@TEST_F77@%$TEST_F77%g -s%@ROMIO_INCLUDE@%$ROMIO_INCLUDE%g -s%@ROMIO_LFLAGS@%$ROMIO_LFLAGS%g -s%@ROMIO_LIBLIST@%$ROMIO_LIBLIST%g -s%@ROMIO_TCFLAGS@%$ROMIO_TCFLAGS%g -s%@ROMIO_TCPPFLAGS@%$ROMIO_TCPPFLAGS%g -s%@ROMIO_TFFLAGS@%$ROMIO_TFFLAGS%g -s%@MPIRUN@%$MPIRUN%g -s%@FORTRAN_TEST@%$FORTRAN_TEST%g -s%@LIBS@%$LIBS%g -s%@DEFS@%-DHAVE_CONFIG_H%" >> $file -fi; done - -CONFIG_HEADERS=${CONFIG_HEADERS-"adio/include/romioconf.h"} -for file in .. ${CONFIG_HEADERS}; do if test "x$file" != x..; then -echo creating $file - -# These sed commands are put into SEDDEFS when defining a macro. -# They are broken into pieces to make the sed script easier to manage. -# They are passed to sed as "A NAME B NAME C VALUE D", where NAME -# is the cpp macro being defined and VALUE is the value it is being given. -# Each defining turns into a single global substitution command. -# -# SEDd sets the value in "#define NAME VALUE" lines. -SEDdA='s@^\([ ]*\)#\([ ]*define[ ][ ]*\)' -SEDdB='\([ ][ ]*\)[^ ]*@\1#\2' -SEDdC='\3' -SEDdD='@g' -# SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -SEDuA='s@^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -SEDuB='\([ ]\)@\1#\2define\3' -SEDuC=' ' -SEDuD='\4@g' -# SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -SEDeA='s@^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -SEDeB='$@\1#\2define\3' -SEDeC=' ' -SEDeD='@g' -rm -f conftest.sed -EOF -# Turn off quoting long enough to insert the sed commands. -rm -f conftest.sh -cat > conftest.sh < conftest.s1 # Like head -20. - sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21. - # Write a limited-size here document to append to conftest.sed. - echo 'cat >> conftest.sed <> config.status - cat conftest.s1 >> config.status - echo 'CONFEOF' >> config.status - rm -f conftest.s1 conftest.sh - mv conftest.s2 conftest.sh -done -rm -f conftest.sh - -# Now back to your regularly scheduled config.status. -cat >> config.status <<\EOF -# This sed command replaces #undef's with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it in -# adio/include/romioconf.h. -cat >> conftest.sed <<\CONFEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -CONFEOF -rm -f conftest.h -# Break up the sed commands because old seds have small limits. -maxsedlines=20 -cp $top_srcdir/$file.in conftest.h1 -while : -do - lines=`grep -c . conftest.sed` - if test -z "$lines" || test "$lines" -eq 0; then break; fi - rm -f conftest.s1 conftest.s2 conftest.h2 - sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20. - sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21. - sed -f conftest.s1 < conftest.h1 > conftest.h2 - rm -f conftest.s1 conftest.h1 conftest.sed - mv conftest.h2 conftest.h1 - mv conftest.s2 conftest.sed -done -rm -f conftest.sed conftest.h -echo "/* $file. Generated automatically by configure. */" > conftest.h -cat conftest.h1 >> conftest.h -rm -f conftest.h1 -if cmp -s $file conftest.h 2>/dev/null; then - # The file exists and we would not be changing it. - echo "$file is unchanged" - rm -f conftest.h -else - rm -f $file - mv conftest.h $file -fi -fi; done - - - -exit 0 -EOF -chmod +x config.status -${CONFIG_SHELL-/bin/sh} ./config.status - -if test "$NOF77" = 0; then - CONFIG_FILES="$CONFIG_FILES mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile mpi2-other/array/fortran/Makefile test/fmisc.f test/fcoll_test.f test/pfcoll_test.f test/fperf.f" -fi -export CONFIG_FILES -./config.status -CONFIG_FILES="" -# delete the first line created by configure in some files -sed 1d util/romioinstall > util/tmp -mv util/tmp util/romioinstall -chmod 755 util/romioinstall -if test "$NOF77" = 0; then - sed 1d test/fcoll_test.f > test/tmp - mv test/tmp test/fcoll_test.f - if test "$MPIOF_H_INCLUDED" = 1; then - sed 5d test/fcoll_test.f > test/tmp - mv test/tmp test/fcoll_test.f - fi - sed 1d test/pfcoll_test.f > test/tmp - mv test/tmp test/pfcoll_test.f - if test "$MPIOF_H_INCLUDED" = 1; then - sed 5d test/pfcoll_test.f > test/tmp - mv test/tmp test/pfcoll_test.f - fi - sed 1d test/fperf.f > test/tmp - mv test/tmp test/fperf.f - if test "$MPIOF_H_INCLUDED" = 1; then - sed 5d test/fperf.f > test/tmp - mv test/tmp test/fperf.f - fi - sed 1d test/fmisc.f > test/tmp - mv test/tmp test/fmisc.f - if test "$MPIOF_H_INCLUDED" = 1; then - sed 5d test/fmisc.f > test/tmp - mv test/tmp test/fmisc.f - fi -fi -sed 1d test/misc.c > test/tmp -mv test/tmp test/misc.c -sed 1d test/large_file.c > test/tmp -mv test/tmp test/large_file.c -sed 1d include/mpio.h > include/tmp -mv include/tmp include/mpio.h -sed 1d include/mpiof.h > include/tmp -mv include/tmp include/mpiof.h -sed 1d test/runtests > test/tmp -mv test/tmp test/runtests -# -chmod 755 test/runtests -# -rm -f *.o -if test "$ROMIO_NO_BANNER" != "yes" -a "$FROM_MPICH" = 0 ; then -print_error " " -print_error Please register your copy of ROMIO with us by sending email -print_error to majordomo@mcs.anl.gov with the message -print_error subscribe romio-users -print_error This will enable us to notify you of new releases of ROMIO -print_error as well as bug fixes. -print_error " " -fi -if test $FROM_MPICH = 0 ; then - print_error Configure done. Now type make - print_error " " -fi -exit 0 +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.63. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell bug-autoconf@gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="adio/include/romioconf.h.in" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +SHLIBNAME +LIBTOOL +CC_SHL +ENABLE_SHLIB +MAKE_DEPEND_C +FORTRAN_TEST +MPIRUN +ROMIO_TFFLAGS +ROMIO_TCPPFLAGS +ROMIO_TCFLAGS +ROMIO_LFLAGS +ROMIO_INCLUDE +TEST_F77 +TEST_CC +MPI_OFFSET_KIND2 +MPI_OFFSET_KIND1 +MPI_FARRAY7 +MPI_FARRAY6 +MPI_FARRAY5 +MPI_FARRAY4 +MPI_FARRAY3 +MPI_FARRAY2 +MPI_FARRAY1 +MPI_FINFO4 +MPI_FINFO3 +MPI_FINFO2 +MPI_FINFO1 +MPI_OFFSET_TYPE +DEFINE_HAVE_MPI_GREQUEST +DEFINE_MPI_OFFSET +BUILD_MPI_ARRAY +HAVE_MPI_DARRAY_SUBARRAY +BUILD_MPI_INFO +HAVE_MPI_INFO +NEEDS_MPI_FINT +WITHIN_KNOWN_MPI_IMPL +FROM_LAM +FROM_MPICH2 +FROM_MPICH +FORTRAN_MPI_OFFSET +FTESTDEFINE +F77MPIOINC +F77IARGC +F77GETARG +LL +TEST_LIBNAME +LIBNAME +ROMIO_HOME +arch_IRIX +NOPROFILE +NOF77 +MPI_LIB +MPI_INCLUDE_DIR +AR_FLAGS +AR +BITS +MIPS +USER_FFLAGS +USER_CFLAGS +FILE_SYSTEM +ARCH +SYSDEP_INC +GLUE_DIR +FILE_SYS_DIRS +EXTRA_SRC_DIRS +DOCTEXT +MPIO_REQ_REAL_POBJECTS +MPIO_REQ_TMP_POBJECTS +MPIO_REQOBJECTS +MPIO_EXTRA_REAL_POBJECTS +MPIO_EXTRA_TMP_POBJECTS +MPIO_EXTRA_OBJECTS +master_topbuild_dir +master_top_builddir +master_top_srcdir +srcdir +PVFS2_CONFIG +HAVE_WEAK_SYMBOLS +FC +EGREP +GREP +CPP +ac_ct_F77 +FFLAGS +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +F77 +CC +RANLIB +top_build_dir +SET_MAKE +SET_CFLAGS +VPATH +MAKE +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_aio +enable_echo +enable_f77 +enable_f90 +enable_weak_symbols +enable_debug +with_file_system +with_pvfs2 +with_mpi_impl +with_mpi +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +F77 +FFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { $as_echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { $as_echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { $as_echo "$as_me: error: working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + +--enable-aio - Request use of asynchronous I/O routines (default) +--enable-echo - Turn on strong echoing. The default is enable=no. +--enable-f77 - Turn on support for Fortran 77 (default) +--enable-f90 - Turn on support for Fortran 90 (default) +--enable-weak-symbols - Turn on support for weak symbols +--enable-debug - Build a debugging version + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + +--with-file-system=name - Build with support for the named file systems + +--with-pvfs2=path - Path to installation of PVFS (version 2) + +--with-mpi-impl=name - Specify MPI implementation to build ROMIO for + +--with-mpi=path - Path to instalation of MPI (headers, libs, etc) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.63 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.63. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + ac_site_file1=$CONFIG_SITE +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test -r "$ac_site_file"; then + { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test "$CONFIGURE_DEBUG_CACHE" = yes ; then + oldopts="$-" + clearMinusX=no + set -x + if test "$oldopts" != "$-" ; then + clearMinusX=yes + fi +fi +if test "X$cache_system" = "X" ; then + # A default file name, just in case + cache_system="config.system" + if test "$cache_file" != "/dev/null" ; then + # Get the directory for the cache file, if any + + cache_system=`echo $cache_file | sed -e 's%^\(.*/\)[^/]*%\1config.system%'` + + test "x$cache_system" = "x$cache_file" && cache_system="config.system" +# else +# We must *not* set enable_cache to no because we need to know if +# enable_cache was not set. +# enable_cache=no + fi +fi +# +# Get a test value and flag whether we should remove/replace the +# cache_system file (do so unless cache_system_ok is yes) +# FC and F77 should be synonyms. Save both in case +# We include the xxxFLAGS in case the user is using the flags to change +# the language (either input or output) of the compiler. E.g., +# using -xarch=v9 on Solaris to select 64 bit output or using -D_BSD_SOURCE +# with gcc to get different header files on input. +cleanargs=`echo "$CC $F77 $FC $CXX $F90 $CFLAGS $FFLAGS $CXXFLAGS $F90FLAGS $PATH" | tr '"' ' '` +if uname -srm >/dev/null 2>&1 ; then + cache_system_text="`uname -srm` $cleanargs" +else + cache_system_text="-no-uname- $cleanargs" +fi +cache_system_ok=no +# +if test -z "$real_enable_cache" ; then + real_enable_cache=$enable_cache + if test -z "$real_enable_cache" ; then real_enable_cache="notgiven" ; fi +fi +if test "X$real_enable_cache" = "Xnotgiven" ; then + # check for valid cache file + if test -z "$cache_system" ; then cache_system="config.system" ; fi + if uname -srm >/dev/null 2>&1 ; then + if test -f "$cache_system" -a -n "$cache_system_text" ; then + if test "$cache_system_text" = "`cat $cache_system`" ; then + real_enable_cache="yes" + cache_system_ok=yes + fi + elif test ! -f "$cache_system" -a -n "$cache_system_text" ; then + # remove the cache file because it may not correspond to our + # system + if test "$cache_file" != "/dev/null" ; then + rm -f $cache_file + fi + real_enable_cache="yes" + fi + fi +fi +if test "X$real_enable_cache" = "Xyes" -a "$cache_file" = "/dev/null" ; then + real_enable_cache=no +fi +if test "X$real_enable_cache" = "Xyes" ; then + if test -r "$cache_file" ; then + echo "loading cache $cache_file" + if test -w "$cache_file" ; then + # Clean the cache file (ergh) + + rm -f confcache + sed -e "s/'\\\\''//g" -e "s/'\\\\/'/" -e "s/\\\\'/'/" \ + -e "s/'\\\\''//g" $cache_file > confcache + if cmp -s $cache_file confcache ; then + : + else + if test -w $cache_file ; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi + fi + rm -f confcache + if test "$DEBUG_AUTOCONF_CACHE" = "yes" ; then + echo "Results of cleaned cache file:" + echo "--------------------------------------------------------" + cat $cache_file + echo "--------------------------------------------------------" + fi + + fi + . $cache_file + else + echo "Configure in `pwd` creating cache $cache_file" + > $cache_file + rm -f $cache_system + fi +else + cache_file="/dev/null" +fi +# Remember our location and the name of the cachefile +pac_cv_my_conf_dir=`pwd` +# +# Update the cache_system file if necessary +if test "$cache_system_ok" != yes ; then + if test -n "$cache_system" ; then + rm -f $cache_system + echo $cache_system_text > $cache_system + fi +fi +if test "$clearMinusX" = yes ; then + set +x +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# VERSION=1.2.6 +# AC_MSG_RESULT([Configuring ROMIO Version $VERSION]) +CONFIGURE_ARGS="$*" +if test -n "$CONFIGURE_ARGS" ; then + echo "Configuring with args $CONFIGURE_ARGS" +fi + +ac_config_headers="$ac_config_headers adio/include/romioconf.h" + + +NOF77=0 +NOF90=0 +ARCH="" +arch_IRIX="" +MPI_IMPL="ampi" +MPI_INCLUDE_DIR="" +ROMIO_INCLUDE="" +TEST_LIBNAME="" +FILE_SYSTEM="" +# Do not set variables to empty that may be communicated from the +# outside environment (e.g., MPI_LIB, MPI_BIN_DIR, LIBNAME) +DEBUG=no +MIPS=0 +BITS=0 +FROM_MPICH=${FROM_MPICH:-no} +FROM_MPICH2=${FROM_MPICH2:-no} +if test "$FROM_MPICH" = yes -a "$FROM_MPICH2" = yes ; then + { $as_echo "$as_me:$LINENO: WARNING: Both FROM_MPICH and FROM_MPICH set to yes; at most one should be yes" >&5 +$as_echo "$as_me: WARNING: Both FROM_MPICH and FROM_MPICH set to yes; at most one should be yes" >&2;} + +fi +FROM_LAM=${FROM_LAM:-no} +if test "$FROM_LAM" = 1 ; then FROM_LAM=yes ; fi +CFLAGS=${CFLAGS:-""} +LL="lld" +AR_LOCAL="" +DEFINE_HAVE_MPI_GREQUEST="#undef HAVE_MPI_GREQUEST" +HAVE_MPI_INFO="" +BUILD_MPI_INFO="" +MPI_FINFO1="" +MPI_FINFO2="" +MPI_FINFO3="" +MPI_FINFO4="" +MPI_FARRAY1="" +MPI_FARRAY2="" +MPI_FARRAY3="" +MPI_FARRAY4="" +MPI_FARRAY5="" +MPI_FARRAY6="" +MPI_FARRAY7="" +DEFS="" +ROMIO_LFLAGS="" +ROMIO_TCFLAGS="" +ROMIO_TCPPFLAGS="" +ROMIO_TFFLAGS="" +NOPROFILE=1 +MPIRUN="" +FORTRAN_TEST="" +MAKE=${MAKE:-"make"} +# foll. needed for f77 test programs +F77GETARG="call getarg(i,str)" +F77IARGC="iargc()" +F77MPIOINC="" +FTESTDEFINE="" +FORTRAN_MPI_OFFSET="" +MPIOF_H_INCLUDED=0 +MPI_OFFSET_KIND1="!" +MPI_OFFSET_KIND2="!" +TEST_CC="" +TEST_F77="" +TRY_WEAK_SYMBOLS=1 +# +# Error handlers (not used with MPICH2, which provides its own routines) +MPIO_EXTRA_OBJECTS="get_errh.o set_errh.o" +MPIO_EXTRA_TMP_POBJECTS="get_errh.p set_errh.p" +MPIO_EXTRA_REAL_POBJECTS="_get_errh.o _set_errh.o" +# +# Completion routines for MPIO_Requests. MPI Implementations with +# generalized requests do not need these +# ioreq_c2f and ioreq_f2c are not MPIO_Requests; rather, they +MPIO_REQOBJECTS="iotest.o iotestall.o iotestany.o iotestsome.o iowait.o iowaitall.o iowaitany.o iowaitsome.o ioreq_c2f.o ioreq_f2c.o" +MPIO_REQ_TMP_POBJECTS="iotest.p iowait.p iowaitall.p iowaitany.p iotestall.p iotestany.p iowaitsome.p iotestsome.p" +MPIO_REQ_REAL_POBJECTS="_iotest.o _iowait.o _iowaitall.o _iowaitany.o _iotestall.o _iotestany.o _iowaitsome.o _iotestsome.o" +# +have_aio=no +# +known_filesystems="nfs ufs pfs pvfs pvfs2 testfs xfs panfs gridftp lustre bgl bglockless zoidfs" +known_mpi_impls="mpich2_mpi mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi ampi_mpi" +# +# Defaults +# Check whether --enable-aio was given. +if test "${enable_aio+set}" = set; then + enableval=$enable_aio; + if test "x$enableval" = "xno" ; then + disable_aio=yes + else + disable_aio=no + fi + +else + disable_aio=no +fi + +# Check whether --enable-echo was given. +if test "${enable_echo+set}" = set; then + enableval=$enable_echo; set -x +fi + +# Check whether --enable-f77 was given. +if test "${enable_f77+set}" = set; then + enableval=$enable_f77; +else + enable_f77=yes +fi + +# Check whether --enable-f90 was given. +if test "${enable_f90+set}" = set; then + enableval=$enable_f90; +else + enable_f90=yes +fi + +# Check whether --enable-weak-symbols was given. +if test "${enable_weak_symbols+set}" = set; then + enableval=$enable_weak_symbols; +else + enable_weak_symbols=yes +fi + +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then + enableval=$enable_debug; +fi + + +# Check whether --with-file-system was given. +if test "${with_file_system+set}" = set; then + withval=$with_file_system; +fi + + +# Check whether --with-pvfs2 was given. +if test "${with_pvfs2+set}" = set; then + withval=$with_pvfs2; +fi + + +# Check whether --with-mpi-impl was given. +if test "${with_mpi_impl+set}" = set; then + withval=$with_mpi_impl; +fi + + +# Check whether --with-mpi was given. +if test "${with_mpi+set}" = set; then + withval=$with_mpi; +fi + +if test "$enable_f77" != "yes" ; then + NOF77=1 +fi +if test "$enable_f90" != "yes" ; then + NOF90=1 +fi +if test "$enable_debug" = "yes" ; then + DEBUG=yes +fi +if test "$enable_weak_symbols" = "no" ; then + TRY_WEAK_SYMBOLS=0 +fi +MPI=$with_mpi +if test -n "$with_mpi"; then + CC=$MPI/bin/mpicc +fi + +FILE_SYSTEM=$with_file_system +# +ac_aux_dir= +for ac_dir in confdb "$srcdir"/confdb; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in confdb \"$srcdir\"/confdb" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in confdb \"$srcdir\"/confdb" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +# Check if Make is working + +true +if test "X$MAKE" = "X" ; then + for ac_prog in make gnumake nmake pmake smake +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_MAKE+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$MAKE"; then + ac_cv_prog_MAKE="$MAKE" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MAKE="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +MAKE=$ac_cv_prog_MAKE +if test -n "$MAKE"; then + { $as_echo "$as_me:$LINENO: result: $MAKE" >&5 +$as_echo "$MAKE" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$MAKE" && break +done + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether clock skew breaks make" >&5 +$as_echo_n "checking whether clock skew breaks make... " >&6; } +if test "${pac_cv_prog_make_found_clock_skew+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +cat > conftest < conftest.out 2>&1 +if grep -i skew conftest >/dev/null 2>&1 ; then + pac_cv_prog_make_found_clock_skew=yes +else + pac_cv_prog_make_found_clock_skew=no +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* + +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_prog_make_found_clock_skew" >&5 +$as_echo "$pac_cv_prog_make_found_clock_skew" >&6; } +if test "$pac_cv_prog_make_found_clock_skew" = "yes" ; then + { $as_echo "$as_me:$LINENO: WARNING: Clock skew found by make. The configure and build may fail. +Consider building in a local instead of NFS filesystem." >&5 +$as_echo "$as_me: WARNING: Clock skew found by make. The configure and build may fail. +Consider building in a local instead of NFS filesystem." >&2;} +fi + + +{ $as_echo "$as_me:$LINENO: checking whether make supports include" >&5 +$as_echo_n "checking whether make supports include... " >&6; } +if test "${pac_cv_prog_make_include+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +cat > conftest <<. +ALL: + @echo "success" +. +cat > conftest1 <<. +include conftest +. +pac_str=`$MAKE -f conftest1 2>&1` +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest conftest1 +if test "$pac_str" != "success" ; then + pac_cv_prog_make_include="no" +else + pac_cv_prog_make_include="yes" +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_prog_make_include" >&5 +$as_echo "$pac_cv_prog_make_include" >&6; } +if test "$pac_cv_prog_make_include" = "no" ; then + : +else + : +fi + + +{ $as_echo "$as_me:$LINENO: checking whether make allows comments in actions" >&5 +$as_echo_n "checking whether make allows comments in actions... " >&6; } +if test "${pac_cv_prog_make_allows_comments+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +cat > conftest <<. +SHELL=/bin/sh +ALL: + @# This is a valid comment! + @echo "success" +. +pac_str=`$MAKE -f conftest 2>&1` +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +if test "$pac_str" != "success" ; then + pac_cv_prog_make_allows_comments="no" +else + pac_cv_prog_make_allows_comments="yes" +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_prog_make_allows_comments" >&5 +$as_echo "$pac_cv_prog_make_allows_comments" >&6; } +if test "$pac_cv_prog_make_allows_comments" = "no" ; then + { $as_echo "$as_me:$LINENO: WARNING: Your make does not allow comments in target code. +Using this make may cause problems when building programs. +You should consider using gnumake instead." >&5 +$as_echo "$as_me: WARNING: Your make does not allow comments in target code. +Using this make may cause problems when building programs. +You should consider using gnumake instead." >&2;} + +fi + + + +{ $as_echo "$as_me:$LINENO: checking for virtual path format" >&5 +$as_echo_n "checking for virtual path format... " >&6; } +if test "${pac_cv_prog_make_vpath+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -rf conftest* +mkdir conftestdir +cat >conftestdir/a.c < conftest <&1 | grep 'conftestdir/a.c'` +if test -n "$ac_out" ; then + pac_cv_prog_make_vpath="VPATH" +else + rm -f conftest + cat > conftest <&1 | grep 'conftestdir/a.c'` + if test -n "$ac_out" ; then + pac_cv_prog_make_vpath=".PATH" + else + pac_cv_prog_make_vpath="neither VPATH nor .PATH works" + fi +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -rf conftest* + +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_prog_make_vpath" >&5 +$as_echo "$pac_cv_prog_make_vpath" >&6; } +if test "$pac_cv_prog_make_vpath" = "VPATH" ; then + VPATH='VPATH=.:${srcdir}' +elif test "$pac_cv_prog_make_vpath" = ".PATH" ; then + VPATH='.PATH: . ${srcdir}' +fi + + + +{ $as_echo "$as_me:$LINENO: checking whether make sets CFLAGS" >&5 +$as_echo_n "checking whether make sets CFLAGS... " >&6; } +if test "${pac_cv_prog_make_set_cflags+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +cat > conftest <&1` +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest +if test "$pac_str" = "XX" ; then + pac_cv_prog_make_set_cflags="no" +else + pac_cv_prog_make_set_cflags="yes" +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_prog_make_set_cflags" >&5 +$as_echo "$pac_cv_prog_make_set_cflags" >&6; } +if test "$pac_cv_prog_make_set_cflags" = "no" ; then + : +else + SET_CFLAGS='CFLAGS=' +fi + +if test "$pac_cv_prog_make_echos_dir" = "no" ; then + { $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +else + SET_MAKE="MAKE=${MAKE-make}" +fi + +# +# Check that an arch was set +# If it wasn't set, try to guess using "util/tarch" +# +# Sometimes tarch looses its execute bit (!) +if test -s $srcdir/util/tarch -a ! -x $srcdir/util/tarch ; then + chmod a+x $srcdir/util/tarch +fi +if test -z "$ARCH" -a -x $srcdir/util/tarch ; then + { $as_echo "$as_me:$LINENO: checking for architecture" >&5 +$as_echo_n "checking for architecture... " >&6; } + ARCH=`$srcdir/util/tarch | sed s/-/_/g` + if test -z "$ARCH" ; then + { $as_echo "$as_me:$LINENO: result: Unknown!" >&5 +$as_echo "Unknown!" >&6; } + { { $as_echo "$as_me:$LINENO: error: Error: Could not guess target architecture, you must +set an architecture type with the environment variable ARCH" >&5 +$as_echo "$as_me: error: Error: Could not guess target architecture, you must +set an architecture type with the environment variable ARCH" >&2;} + { (exit 1); exit 1; }; } + fi + eval "arch_$ARCH=1" + { $as_echo "$as_me:$LINENO: result: $ARCH" >&5 +$as_echo "$ARCH" >&6; } +fi +# +# check for valid architecture. Use __ so that _ALPHA_ does not match +# LINUX_ALPHA_ +#### WE SHOULD REMOVE THIS SOON +grep __"$ARCH"_ $srcdir/.config_params > /dev/null 2>&1 +if test $? != 0 ; then + { $as_echo "$as_me:$LINENO: WARNING: Unknown architecture $arch... proceeding anyway" >&5 +$as_echo "$as_me: WARNING: Unknown architecture $arch... proceeding anyway" >&2;} +fi +# +# +# Find the home directory if not specified +if test "X$srcdir" != "X." -a -s $srcdir/mpi-io/Makefile.in ; then + ROMIO_HOME_TRIAL=$srcdir +else + # Take advantage of autoconf2 features + if test -n "$ac_confdir" ; then + ROMIO_HOME_TRIAL=$ac_confdir + else + if test -s configure ; then + ROMIO_HOME_TRIAL=`pwd` + else + ac_confdir=`dirname "$0" 2>/dev/null` + if test -n "$ac_confdir" ; then + ROMIO_HOME_TRIAL=$ac_confdir + fi + fi + fi +fi +{ $as_echo "$as_me:$LINENO: result: ROMIO home directory is $ROMIO_HOME_TRIAL" >&5 +$as_echo "ROMIO home directory is $ROMIO_HOME_TRIAL" >&6; } +ROMIO_HOME=$ROMIO_HOME_TRIAL + +# get a fully qualified pathname for our build directory +top_build_dir=`pwd` +# used in romioinstall + + +# +# Create the "autoconf" style directory names... +# Most of these are done for us; add the documentation directories +# +# mandir is the root for the man pages +if test -z "$mandir" ; then mandir='${prefix}/man' ; fi + +if test -z "$docdir" ; then docdir='${prefix}/doc' ; fi + +if test -z "$htmldir" ; then htmldir='${prefix}/www' ; fi + +# +# check for valid file system +if test -n "$FILE_SYSTEM" ; then + # if multiple filesystems are passed in, they are '+'-delimited + # we could set the IFS to tokenize FILE_SYSTEM, but the FILE_SYSTEM env var + # is used in multiple places in the build system: get rid of the '+'s so we + # can use the 'for x in $FILE_SYSTEM ...' idiom + FILE_SYSTEM=`echo $FILE_SYSTEM|sed -e 's/\+/ /g'` + for x in $FILE_SYSTEM + do + found=no + # We could also do test -d "ad_$y" to test for known file systems + # based on having access to the adio code. Then adding a file + # system would not require changing configure to change known_filesystems + for y in $known_filesystems ; do + if test $x = $y ; then + found=yes + eval "file_system_`echo $x`=1" + break + fi + done + if test "$found" = "no" ; then + { $as_echo "$as_me:$LINENO: WARNING: Unknown file system $x... proceeding anyway" >&5 +$as_echo "$as_me: WARNING: Unknown file system $x... proceeding anyway" >&2;} + fi + done +fi +# +# If we are building within a known MPI implementation, we must avoid the +# tests about an existing implementation +if test "$FROM_MPICH" != no -o "$FROM_MPICH2" != no -o "$FROM_LAM" != no ; then + WITHIN_KNOWN_MPI_IMPL=yes +else + WITHIN_KNOWN_MPI_IMPL=no +fi +# check for valid MPI implementation +if test -n "$MPI_IMPL" ; then + found=no + for mpi in $known_mpi_impls ; do + if test "${MPI_IMPL}_mpi" = "$mpi" ; then + found=yes + break + fi + done + if test $found = no ; then + { $as_echo "$as_me:$LINENO: WARNING: Unknown MPI implementation $MPI... proceeding anyway" >&5 +$as_echo "$as_me: WARNING: Unknown MPI implementation $MPI... proceeding anyway" >&2;} + fi +fi +# + +if test -n "${with_mpi}" ; then + MPI_INCLUDE_DIR="${with_mpi}"/include + MPI_LIB_DIR="${with_mpi}"/lib +fi + +# check for valid MPI include directory if specified +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + if test -n "$MPI_INCLUDE_DIR"; then + if test ! -f "$MPI_INCLUDE_DIR/mpi.h" ; then + { { $as_echo "$as_me:$LINENO: error: Include file $MPI_INCLUDE_DIR/mpi.h not found" >&5 +$as_echo "$as_me: error: Include file $MPI_INCLUDE_DIR/mpi.h not found" >&2;} + { (exit 1); exit 1; }; } + fi + else +# assume that mpi.h is in the default path +# set MPI_INCLUDE_DIR to ".", so that it translates to -I. in the +# compile command. Some compilers complain if it's only -I + MPI_INCLUDE_DIR=. + fi +else + MPI_INCLUDE_DIR=. +fi +# +# check for valid MPI library if specified +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + if test -n "$MPI_LIB" ; then + if test ! -f "$MPI_LIB" ; then + { { $as_echo "$as_me:$LINENO: error: MPI library $MPI_LIB not found" >&5 +$as_echo "$as_me: error: MPI library $MPI_LIB not found" >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +# +# +AR="${AR:-ar} cr$AR_LOCAL" +if test -z "$RANLIB" ; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +fi +# +# USER_CFLAGS and USER_FFLAGS are used only in test/Makefile.in +if test $DEBUG = "yes"; then + USER_CFLAGS="$CFLAGS -g" + USER_FFLAGS="$FFLAGS -g" +else + USER_CFLAGS="$CFLAGS -O" + USER_FFLAGS="$FFLAGS -O" +fi +# +# Here begin the architecture-specific tests. +# -------------------------------------------------------------------------- +# We must first select the C and Fortran compilers. Because of the +# way that the PROG_CC autoconf macro works (and all of the macros that +# require it, including CHECK_HEADERS), that macro must occur exactly +# once in the configure.in file, at least as of autoconf 2.57 . +# Unfortunately, this requirement is not enforced. To handle this, +# we first case on the architecture; then use PROG_CC, then case on the +# architecture again for any arch-specific features. We also set the +# C_DEBUG_FLAG and F77_DEBUG_FLAG in case debugging is selected. +# +# For the MPICH and MPICH2 configures, the compilers will already be +# selected, so most of the compiler-selection code will be bypassed. +# -------------------------------------------------------------------------- +# For historical reasons +if test -z "$FC" ; then + FC=$F77 +fi +# +C_DEBUG_FLAG="-g" +F77_DEBUG_FLAG="-g" +# C_OPT_FLAG=${CFLAGS:-"-O"} +# MPICH1 uses OPTFLAGS and OPTFLAGSC to specify separate optimization +# flags for the C compiler (this is better that adding it to the +# undifferentiated CFLAGS, at least on input). +if test -n "$OPTFLAGS" ; then + C_OPT_FLAG="$C_OPT_FLAG $OPTFLAGS" +fi +if test -n "$OPTFLAGSC" ; then + C_OPT_FLAG="$C_OPT_FLAG $OPTFLAGSC" +fi +case $ARCH in + solaris|solaris86) + CC=${CC:-cc} + F77=${FC:-f77} + if test "$CC" != "gcc" ; then + C_DEBUG_FLAG="-g -v" + fi + ;; + + rs6000) + F77=${FC} + # Try to use mpcc if no CC specified + for ac_prog in mpcc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break +done +test -n "$CC" || CC="cc" + + if test $NOF77 = 0 && test -z "$F77"; then + for ac_prog in mpxlf +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_F77+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_F77="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + { $as_echo "$as_me:$LINENO: result: $F77" >&5 +$as_echo "$F77" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$F77" && break +done +test -n "$F77" || F77="f77" + + fi + ;; + + tflop|tflops) + CC=${CC:-pgcc} + F77=${FC:-pgf77} + CFLAGS="$CFLAGS -cougar -D__PUMA" + if test "$CC" = "pgcc" ; then + C_OPT_FLAG="-Knoieee -Mvect -O3" + fi + ;; + + freebsd|LINUX|netbsd|openbsd|LINUX_ALPHA) + CC=${CC:-gcc} + # Let the prog_f77 file g77/f77/others + F77=${FC} + ;; + + SX4) + CC=${CC:-mpicc} + F77=${FC:-mpif90} + if test $DEBUG != "yes" ; then + USER_FFLAGS="$FFLAGS -Chopt" + F77_OPT_FLAG="-Chopt" + fi + ;; + + hpux|sppux) + C_DEBUG_FLAG="-g +w1" + ;; + + alpha|ALPHA) + CC=${CC:-cc} + F77=${FC:-f77} + C_DEBUG_FLAG="-g -verbose" + ;; + + CRAY) + CC=${CC:-cc} + F77=${FC:-f90} + NOF77=1 + CFLAGS="$CFLAGS -D_UNICOS" + ;; + + sgi|IRIX64|IRIX32|IRIXN32) + arch_IRIX=1 + CC=${CC:-cc} + F77=${FC:-f77} + C_DEBUG_FLAG="-g -fullwarn" + ;; + + sgi5) + ;; + + *) + # Fall-through case. Take FC + F77=${FC:-f77} + ;; +esac + + + + if test -z "${pac_save_CFLAGS_nesting}" ; then + pac_save_CFLAGS_nesting=0 + fi + eval pac_save_CFLAGS_${pac_save_CFLAGS_nesting}='"$CFLAGS"' + pac_save_CFLAGS_nesting=`expr ${pac_save_CFLAGS_nesting} + 1` + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in gcc icc pgcc xlc xlC pathcc cc + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in gcc icc pgcc xlc xlC pathcc cc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + + +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } + +# Provide some information about the compiler. +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +if test -z "$ac_file"; then + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } + fi + fi +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +fi + +rm -f conftest$ac_cv_exeext +{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + pac_save_CFLAGS_nesting=`expr ${pac_save_CFLAGS_nesting} - 1` + eval CFLAGS="\$pac_save_CFLAGS_${pac_save_CFLAGS_nesting}" + eval pac_save_CFLAGS_${pac_save_CFLAGS_nesting}="" + + + +if test "$NOF77" != 1 ; then + # Grrr. The autoconf test for F77 will abort the configure + # if no compiler is found. We'd prefer to simply turn off + # support for Fortran, and/or give a more informative message. + + + if test -z "${pac_save_FFLAGS_nesting}" ; then + pac_save_FFLAGS_nesting=0 + fi + eval pac_save_FFLAGS_${pac_save_FFLAGS_nesting}='"$FFLAGS"' + pac_save_FFLAGS_nesting=`expr ${pac_save_FFLAGS_nesting} + 1` + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in ifort pgf77 af77 xlf frt cf77 fort77 fl32 fort ifc efc ftn \ + gfortran f77 g77 + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_F77+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_F77="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + { $as_echo "$as_me:$LINENO: result: $F77" >&5 +$as_echo "$F77" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in ifort pgf77 af77 xlf frt cf77 fort77 fl32 fort ifc efc ftn \ + gfortran f77 g77 +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_F77+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_F77="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +$as_echo "$ac_ct_F77" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_F77" && break +done + + if test "x$ac_ct_F77" = x; then + F77="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + F77=$ac_ct_F77 + fi +fi + + +# Provide some information about the compiler. +$as_echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; } +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +$as_echo "$ac_cv_f77_compiler_gnu" >&6; } +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +{ $as_echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +$as_echo_n "checking whether $F77 accepts -g... " >&6; } +if test "${ac_cv_prog_f77_g+set}" = set; then + $as_echo_n "(cached) " >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_f77_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_prog_f77_g=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +$as_echo "$ac_cv_prog_f77_g" >&6; } +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi + +if test $ac_compiler_gnu = yes; then + G77=yes +else + G77= +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + pac_save_FFLAGS_nesting=`expr ${pac_save_FFLAGS_nesting} - 1` + eval FFLAGS="\$pac_save_FFLAGS_${pac_save_FFLAGS_nesting}" + eval pac_save_FFLAGS_${pac_save_FFLAGS_nesting}="" + + +fi +if test "$CC" = "gcc" -a -z "$C_DEBUG_FLAG" ; then + C_DEBUG_FLAG="-g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" +fi +if test $DEBUG = "yes" ; then + CFLAGS="$CFLAGS $C_DEBUG_FLAG" +else + CFLAGS="$CFLAGS $C_OPT_FLAG" +fi +# --------------------------------------------------------------------------- +# Here go the rest of the tests +# --------------------------------------------------------------------------- +if test -n "$arch_solaris" || test -n "$arch_solaris86" ; then + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + if test $MPI_IMPL = "mpich" ; then + TEST_CC=mpicc + TEST_F77=mpif77 + else + TEST_CC="$CC" + TEST_F77="$F77" + fi + AR="ar cr" +# solaris does not have l option to ar +fi + + +if test -n "$arch_rs6000"; then + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + +cat >>confdefs.h <<\_ACEOF +#define AIX 1 +_ACEOF + +# assume long long exists. + ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long:-8} + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 +fi +# + +if test -n "$arch_tflop" || test -n "$arch_tflops"; then + # TFLOP_FLAGS="-cougar -D__PUMA" + AR="xar cr$AR_LOCAL" + RANLIB="xranlib" + MPI_LIB="$MPI_LIB" + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + if test -z "$FILE_SYSTEM" ; then + file_system_ufs=1 + FILE_SYSTEM="ufs" + fi +fi +# +if test -n "$arch_freebsd" || test -n "$arch_LINUX" || test -n "$arch_LINUX_ALPHA" || test -n "$arch_netbsd" || test -n "$arch_openbsd" ; then + if test -n "$arch_freebsd" || test -n "$arch_netbsd" || test -n "$arch_openbsd"; then + ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long:-0} + # printf doesn't work properly and no integer*8 as far as I can tell + fi + # Find the CPP before the header check + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi +fi +# +if test -n "$arch_SX4" ; then + have_aio=no + +cat >>confdefs.h <<\_ACEOF +#define SX4 1 +_ACEOF + + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + if test -z "$FILE_SYSTEM" ; then + file_system_sfs=1 + file_system_nfs=1 + FILE_SYSTEM="sfs nfs" + fi + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 +fi +# +if test -n "$arch_hpux" || test -n "$arch_sppux" ; then + have_aio=no + RANLIB=":" + if test -z "$MPI_IMPL"; then + if test -f "/opt/mpi/include/mpi.h" ; then + echo "assuming that you want to use ROMIO with HP MPI" + MPI_IMPL=hp + else + echo "assuming that you want to use ROMIO with MPICH" + MPI_IMPL=mpich + fi + fi + if test $MPI_IMPL = "mpich" ; then + mpi_mpich=1 + MPI_LIB="$MPI_LIB -lV3" + CC=${CC:-cc -Ae} + F77=${FC:-f77 +U77} + fi + if test $MPI_IMPL = "hp" ; then + mpi_hp=1 + CC=${CC:-mpicc -Ae} + F77=${FC:-mpif77 +U77} + fi + if test $MPI_IMPL = "lam" && test "$FC" != ""; then + F77="$F77 +U77" + fi + FTESTDEFINE="external iargc, getarg" + if test -n "$arch_hpux" ; then + CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" + +cat >>confdefs.h <<\_ACEOF +#define HPUX 1 +_ACEOF + + if test $MPI_IMPL = "hp" ; then + F77=${FC:-mpif90 +U77} + else + F77=${FC:-f90 +U77} + fi + else + +cat >>confdefs.h <<\_ACEOF +#define SPPUX 1 +_ACEOF + + fi + + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 + if test "$CC" != "gcc" ; then + ROMIO_TCFLAGS="-Ae" + fi + if test "$F77" != "g77" ; then + ROMIO_TFFLAGS="+U77" + fi +fi +# +if test -n "$arch_alpha" || test -n "$arch_ALPHA" ; then + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 + LIBS="$LIBS -laio" +fi +# +if test -n "$arch_CRAY" ; then + NOF77=1 + FTESTDEFINE="integer ilen" + F77GETARG="call pxfgetarg(i, str, ilen, ierr)" + have_aio=no + RANLIB=":" + +cat >>confdefs.h <<\_ACEOF +#define CRAY 1 +_ACEOF + + if test -z "$MPI_IMPL" || test -n "$mpi_sgi" ; then + MPI_IMPL=cray + mpi_cray=1 + mpi_sgi="" +# above is to disable configure tests specific to SGI MPI + +cat >>confdefs.h <<\_ACEOF +#define MPISGI 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI_COMBINERS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define NO_MPI_SGI_type_is_contig 1 +_ACEOF + + fi +# MPISGI needed because of error in Cray's and SGI's +# MPI_Type_get_contents (does not increment reference count). +# Others needed because MPISGI needed. + + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 +fi +# +if test -n "$arch_sgi" ; then + arch_IRIX=1 + ARCH=IRIX +fi +if test -n "$arch_IRIX64" || test -n "$arch_IRIX32" || test -n "$arch_IRIXN32" ; then + arch_IRIX=1 +fi +if test -n "$arch_sgi5" ; then + arch_IRIX5=1 + ARCH=IRIX +fi +# + +# +if test -n "$arch_IRIX"; then + { $as_echo "$as_me:$LINENO: checking for IRIX OS version" >&5 +$as_echo_n "checking for IRIX OS version... " >&6; } + osversion=`uname -r | sed 's/\..*//'` + osvminor=`uname -r | sed 's/[0-9]\.\([0-9]*\)\..*/\1/'` + { $as_echo "$as_me:$LINENO: result: $osversion" >&5 +$as_echo "$osversion" >&6; } + { $as_echo "$as_me:$LINENO: checking for IRIX cpucount" >&5 +$as_echo_n "checking for IRIX cpucount... " >&6; } + 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'` + fi + if test "$cpucount" = "" ; then + { $as_echo "$as_me:$LINENO: result: Could not determine cpucount. Please send" >&5 +$as_echo "Could not determine cpucount. Please send" >&6; } + hinv + { { $as_echo "$as_me:$LINENO: error: to romio-maint@mcs.anl.gov" >&5 +$as_echo "$as_me: error: to romio-maint@mcs.anl.gov" >&2;} + { (exit 1); exit 1; }; } + fi + { $as_echo "$as_me:$LINENO: result: $cpucount" >&5 +$as_echo "$cpucount" >&6; } + { $as_echo "$as_me:$LINENO: checking for IRIX cpumodel" >&5 +$as_echo_n "checking for IRIX cpumodel... " >&6; } + cputype=`hinv -t cpu | tail -1 | cut -f 3 -d' '` + if test -z "$cputype" ; then + { $as_echo "$as_me:$LINENO: result: Could not get cputype from hinv -t cpu command. Please send" >&5 +$as_echo "Could not get cputype from hinv -t cpu command. Please send" >&6; } + hinv -t cpu 2>&1 + hinv -t cpu | cut -f 3 -d' ' 2>&1 + { { $as_echo "$as_me:$LINENO: error: to romio-maint@mcs.anl.gov" >&5 +$as_echo "$as_me: error: to romio-maint@mcs.anl.gov" >&2;} + { (exit 1); exit 1; }; } + fi + { $as_echo "$as_me:$LINENO: result: $cputype" >&5 +$as_echo "$cputype" >&6; } + if test -z "$osversion" ; then + { $as_echo "$as_me:$LINENO: result: Could not determine OS version. Please send" >&5 +$as_echo "Could not determine OS version. Please send" >&6; } + uname -a + { { $as_echo "$as_me:$LINENO: error: to romio-maint@mcs.anl.gov" >&5 +$as_echo "$as_me: error: to romio-maint@mcs.anl.gov" >&2;} + { (exit 1); exit 1; }; } + elif test $osversion = 4 ; then + true + elif test $osversion = 5 ; then + true + elif test $osversion = 6 ; then + true + else + { $as_echo "$as_me:$LINENO: 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" >&5 +$as_echo "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" >&6; } + uname -a 2>&1 + hinv 2>&1 + { { $as_echo "$as_me:$LINENO: error: to romio-maint@mcs.anl.gov" >&5 +$as_echo "$as_me: error: to romio-maint@mcs.anl.gov" >&2;} + { (exit 1); exit 1; }; } + fi + { $as_echo "$as_me:$LINENO: checking for cputype" >&5 +$as_echo_n "checking for cputype... " >&6; } + OLD_ARCH=IRIX + IRIXARCH="$ARCH_$osversion" + cputype=`echo $cputype | sed -e 's%.*/%%' -e 's/R//' | tr -d "[A-Z]"` + case $cputype in + 3000) ;; + 4000) ;; + 4400) ;; + 4600) ;; + 5000) ;; + 8000) ;; + 10000);; + 12000);; + *) + { $as_echo "$as_me:$LINENO: WARNING: Unexpected IRIX/MIPS chipset $cputype. Please send the output" >&5 +$as_echo "$as_me: WARNING: Unexpected IRIX/MIPS chipset $cputype. Please send the output" >&2;} + uname -a 2>&1 + hinv 2>&1 + { $as_echo "$as_me:$LINENO: WARNING: to romio-maint@mcs.anl.gov +ROMIO will continue and assume that the cputype is +compatible with a MIPS 4400 processor." >&5 +$as_echo "$as_me: WARNING: to romio-maint@mcs.anl.gov +ROMIO will continue and assume that the cputype is +compatible with a MIPS 4400 processor." >&2;} + cputype=4400 + ;; + esac + { $as_echo "$as_me:$LINENO: result: $cputype" >&5 +$as_echo "$cputype" >&6; } + IRIXARCH="$IRIXARCH_$cputype" + echo "IRIX-specific architecture is $IRIXARCH" +fi + +# +# special case 'sgi5' for use on MESHINE which is much like an SGI running +# irix 5 with r4400 chips, but does not have 'hinv', so above code doesn't +# work +if test -n "$arch_sgi5"; then + osversion=5 + cputype=4400 + IRIXARCH="$ARCH_$osversion" + IRIXARCH="$IRIXARCH_$cputype" +# now set arch_IRIX to 1 + arch_IRIX=1 + echo "IRIX-specific architecture is $IRIXARCH" + +cat >>confdefs.h <<\_ACEOF +#define IRIX 1 +_ACEOF + +fi +# +if test -n "$arch_IRIX"; then + if test $osversion = 4 ; then + RANLIB="ar ts" + if test -n "$mpi_sgi"; then + { { $as_echo "$as_me:$LINENO: error: SGI\'s MPI does not work with IRIX 4.x" >&5 +$as_echo "$as_me: error: SGI\'s MPI does not work with IRIX 4.x" >&2;} + { (exit 1); exit 1; }; } + fi + elif test $osversion = 5 ; then + if test -n "$mpi_sgi"; then + { { $as_echo "$as_me:$LINENO: error: SGI\'s MPI does not work with IRIX 5.x" >&5 +$as_echo "$as_me: error: SGI\'s MPI does not work with IRIX 5.x" >&2;} + { (exit 1); exit 1; }; } + fi + elif test $osversion = 6 ; then + if test -z "$MPI_IMPL"; then + if test "$FROM_MPICH2" = "yes" ; then + # Building with MPICH2. Distinguish from MPICH-1 + MPI_IMPL=mpich2 + mpi_mpich2=1 + elif test -f "/usr/include/mpi.h" ; then + # removed use of escaped single quotes in messages + # because they confuse Emacs, making it hard to + # read the files (with emacs :) ) + { $as_echo "$as_me:$LINENO: WARNING: assuming that you want to use ROMIO with the SGI MPI" >&5 +$as_echo "$as_me: WARNING: assuming that you want to use ROMIO with the SGI MPI" >&2;} + MPI_IMPL=sgi + mpi_sgi=1 + else + { $as_echo "$as_me:$LINENO: WARNING: assuming that you want to use ROMIO with MPICH" >&5 +$as_echo "$as_me: WARNING: assuming that you want to use ROMIO with MPICH" >&2;} + MPI_IMPL=mpich + mpi_mpich=1 + fi + fi + RANLIB=":" + +cat >>confdefs.h <<\_ACEOF +#define AIO_SIGNOTIFY_NONE 1 +_ACEOF + + if test $cputype -ge 5000 ; then + MIPS=4 + else + MIPS=3 + fi + fi + if test -n "$mpi_sgi" && test -z "$MPI_LIB" ; then + MPI_LIB="-lmpi" + fi +# check if pread64 is defined + + { $as_echo "$as_me:$LINENO: checking if pread64 is defined" >&5 +$as_echo_n "checking if pread64 is defined... " >&6; } + rm -f conftest.c + cat > conftest.c < + main() + { + int fd=0, buf=0, i=0; + off64_t off=0; + pread64(fd, &buf, i, off); + } +EOF + rm -f conftest$EXEEXT + $CC $USER_CFLAGS -o conftest$EXEEXT conftest.c > /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PREAD64 /**/ +_ACEOF + + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi +rm -f conftest$EXEEXT conftest.c + +# + if test -z "$FILE_SYSTEM" ; then + file_system_nfs=1 + FILE_SYSTEM="nfs" + { $as_echo "$as_me:$LINENO: checking for xfs" >&5 +$as_echo_n "checking for xfs... " >&6; } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +int +main () +{ +aiocb64_t *t1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + file_system_xfs=1;FILE_SYSTEM="xfs $FILE_SYSTEM"; +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$file_system_xfs" = 1 ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + file_system_ufs=1 + FILE_SYSTEM="ufs $FILE_SYSTEM" + fi + fi + +cat >>confdefs.h <<\_ACEOF +#define IRIX 1 +_ACEOF + + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 +fi + + +for ac_func in memalign +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# +# Question: Should ROMIO under MPICH2 ignore the Fortran tests, since +# MPICH2 provides all of the Fortran interface routines? +# +if test $NOF77 = 0 ; then + echo "checking Fortran external names" + + rm -f confftest.f confftest.$OBJEXT + cat > confftest.f < /dev/null 2>&1 + if test ! -s confftest.$OBJEXT ; then + { $as_echo "$as_me:$LINENO: WARNING: Unable to test Fortran compiler. Compiling a test +program failed to produce an object file" >&5 +$as_echo "$as_me: WARNING: Unable to test Fortran compiler. Compiling a test +program failed to produce an object file" >&2;} + NOF77=1 + elif test -z "$FORTRANNAMES" ; then + # MAC OS X (and probably FreeBSD need strings - (not strings -a) + # Cray doesn't accept -a ... + allstrings="-a" + if test $arch_CRAY ; then + allstrings="" + elif strings - confftest.$OBJEXT < /dev/null >/dev/null 2>&1 ; then + allstrings="-" + elif strings -a confftest.$OBJEXT < /dev/null >/dev/null 2>&1 ; then + allstrings="-a" + fi + + nameform1=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop_ | head -1` + nameform2=`strings $allstrings confftest.$OBJEXT | grep MPIR_INIT_FOP | head -1` + nameform3=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop | head -1` + nameform4=`strings $allstrings confftest.$OBJEXT | grep mpir_init_fop__ | head -1` + rm -f confftest.f confftest.$OBJEXT + if test -n "$nameform4" ; then + echo "Fortran externals are lower case and have two trailing underscores" + FORTRANNAMES="FORTRANDOUBLEUNDERSCORE" + elif test -n "$nameform1" ; then + # We don't set this in CFLAGS; it is a default case + echo "Fortran externals have a trailing underscore and are lowercase" + FORTRANNAMES="FORTRANUNDERSCORE" + elif test -n "$nameform2" ; then + echo "Fortran externals are uppercase" + FORTRANNAMES="FORTRANCAPS" + elif test -n "$nameform3" ; then + echo "Fortran externals are lower case" + FORTRANNAMES="FORTRANNOUNDERSCORE" + else + { $as_echo "$as_me:$LINENO: WARNING: 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)" >&5 +$as_echo "$as_me: WARNING: 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)" >&2;} + NOF77=1 + fi + fi + if test -n "$FORTRANNAMES" ; then + WDEF="-D$FORTRANNAMES" + fi + # Delete confftest files with any extension. This catches the case + # where auxillary files, such as coverage files, are removed. + rm -f confftest.* + + if test -n "$WDEF" ; then + CFLAGS="$CFLAGS $WDEF" + fi + rm -f test/mpif.h + if test "$MPI_INCLUDE_DIR" != "." && test $WITHIN_KNOWN_MPI_IMPL = no ; then + if test ! -d test ; then mkdir test ; fi + ln -s $MPI_INCLUDE_DIR/mpif.h test + fi +else + F77=":" +fi +# +{ $as_echo "$as_me:$LINENO: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if test "${ac_cv_c_inline+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_inline=$ac_kw +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + + +# Header files +# Find the CPP before the header check +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + +for ac_header in unistd.h fcntl.h malloc.h stddef.h sys/types.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +# + +# When compiling ROMIO on Darwin with _POSIX_C_SOURCE defined (such as when +# using --enable-strict in MPICH2), sys/types.h does not define u_short and +# friends unless _DARWIN_C_SOURCE is also defined (see compat(5) on a Darwin +# box). This would normally be fine, except sys/stat.h defines struct stat to +# use u_long, so strict compiles fail. One option is to also compile with +# _DARWIN_C_SOURCE, but this disables much of the strictness that is intended +# by _POSIX_C_SOURCE. Instead we just define our own types if they are not +# provided by the system. This isn't quite as safe as typedef'ing the +# replacement types, but it will apply to later configure tests, which is +# important. +{ $as_echo "$as_me:$LINENO: checking for u_char" >&5 +$as_echo_n "checking for u_char... " >&6; } +if test "${ac_cv_type_u_char+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_u_char=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (u_char)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((u_char))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_char=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_u_char" >&5 +$as_echo "$ac_cv_type_u_char" >&6; } +if test "x$ac_cv_type_u_char" = x""yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_char unsigned char +_ACEOF + +fi + +{ $as_echo "$as_me:$LINENO: checking for u_short" >&5 +$as_echo_n "checking for u_short... " >&6; } +if test "${ac_cv_type_u_short+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_u_short=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (u_short)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((u_short))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_short=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_u_short" >&5 +$as_echo "$ac_cv_type_u_short" >&6; } +if test "x$ac_cv_type_u_short" = x""yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_short unsigned short +_ACEOF + +fi + +{ $as_echo "$as_me:$LINENO: checking for u_int" >&5 +$as_echo_n "checking for u_int... " >&6; } +if test "${ac_cv_type_u_int+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_u_int=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (u_int)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((u_int))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_int=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_u_int" >&5 +$as_echo "$ac_cv_type_u_int" >&6; } +if test "x$ac_cv_type_u_int" = x""yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int unsigned int +_ACEOF + +fi + +{ $as_echo "$as_me:$LINENO: checking for u_long" >&5 +$as_echo_n "checking for u_long... " >&6; } +if test "${ac_cv_type_u_long+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_u_long=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (u_long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((u_long))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_long=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_u_long" >&5 +$as_echo "$ac_cv_type_u_long" >&6; } +if test "x$ac_cv_type_u_long" = x""yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_long unsigned long +_ACEOF + +fi + + +# must come _after_ the above checks for u_char/u_short/u_int/u_long + +for ac_header in sys/attr.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:$LINENO: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if test "${ac_cv_sizeof_int+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_int=$ac_lo;; +'') if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute sizeof (int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } + else + ac_cv_sizeof_int=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +static long int longval () { return (long int) (sizeof (int)); } +static unsigned long int ulongval () { return (long int) (sizeof (int)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (int))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (int)))) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (int)))) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_int=`cat conftest.val` +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute sizeof (int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } + else + ac_cv_sizeof_int=0 + fi +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:$LINENO: checking size of void *" >&5 +$as_echo_n "checking size of void *... " >&6; } +if test "${ac_cv_sizeof_void_p+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_void_p=$ac_lo;; +'') if test "$ac_cv_type_void_p" = yes; then + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } + else + ac_cv_sizeof_void_p=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +static long int longval () { return (long int) (sizeof (void *)); } +static unsigned long int ulongval () { return (long int) (sizeof (void *)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (void *))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (void *)))) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (void *)))) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_void_p=`cat conftest.val` +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_void_p" = yes; then + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute sizeof (void *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } + else + ac_cv_sizeof_void_p=0 + fi +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +$as_echo "$ac_cv_sizeof_void_p" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + +{ $as_echo "$as_me:$LINENO: checking for int large enough for pointers" >&5 +$as_echo_n "checking for int large enough for pointers... " >&6; } +if test "${pac_cv_int_hold_pointer+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +if test "$ac_cv_sizeof_int" = "0" -o \ + "$ac_cv_sizeof_void_p" = "0" ; then + pac_cv_int_hold_pointer=unknown +elif test "$ac_cv_sizeof_int" -lt "$ac_cv_sizeof_void_p" ; then + pac_cv_int_hold_pointer=no +else + pac_cv_int_hold_pointer=yes +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_int_hold_pointer" >&5 +$as_echo "$pac_cv_int_hold_pointer" >&6; } +if test "$pac_cv_int_hold_pointer" != yes ; then + +cat >>confdefs.h <<\_ACEOF +#define INT_LT_POINTER 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_INT_LT_POINTER 1 +_ACEOF + +fi + +# LL is the printf-style format name for output of a MPI_Offset. +# We have to match this to the type that we use for MPI_Offset. +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:$LINENO: checking size of long long" >&5 +$as_echo_n "checking size of long long... " >&6; } +if test "${ac_cv_sizeof_long_long+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long_long=$ac_lo;; +'') if test "$ac_cv_type_long_long" = yes; then + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute sizeof (long long) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } + else + ac_cv_sizeof_long_long=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +static long int longval () { return (long int) (sizeof (long long)); } +static unsigned long int ulongval () { return (long int) (sizeof (long long)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (long long))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (long long)))) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (long long)))) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long_long=`cat conftest.val` +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_long_long" = yes; then + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute sizeof (long long) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } + else + ac_cv_sizeof_long_long=0 + fi +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 +$as_echo "$ac_cv_sizeof_long_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long +_ACEOF + + +if test "$ac_cv_sizeof_long_long" != 0 ; then + if test "$ac_cv_sizeof_long_long" = "8" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LONG_LONG_64 1 +_ACEOF + + MPI_OFFSET_TYPE="long long" + DEFINE_MPI_OFFSET="typedef long long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer*8" + LL="lld" + elif test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_int" ; then + MPI_OFFSET_TYPE="int" + DEFINE_MPI_OFFSET="typedef int MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + +cat >>confdefs.h <<\_ACEOF +#define MPI_OFFSET_IS_INT 1 +_ACEOF + + LL="d" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + else + echo "defining MPI_Offset as long in C and integer in Fortran" + MPI_OFFSET_TYPE="long" + DEFINE_MPI_OFFSET="typedef long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + LL="ld" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + fi +else + echo "defining MPI_Offset as long in C and integer in Fortran" + MPI_OFFSET_TYPE="long" + DEFINE_MPI_OFFSET="typedef long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + LL="ld" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" +fi + + +# +if test -n "$ac_cv_sizeof_long_long"; then + if test $WITHIN_KNOWN_MPI_IMPL = no ; then + + { $as_echo "$as_me:$LINENO: checking if MPI_LONG_LONG_INT is defined in mpi.h" >&5 +$as_echo_n "checking if MPI_LONG_LONG_INT is defined in mpi.h... " >&6; } + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI_LONG_LONG_INT /**/ +_ACEOF + + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + rm -f conftest$EXEEXT mpitest.c + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI_LONG_LONG_INT 1 +_ACEOF + + fi +fi +# +if test -n "$OFFSET_KIND" -a "A$MPI_OFFSET_KIND1" = "A!" ; then + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$OFFSET_KIND)" + MPI_OFFSET_KIND_VAL=$OFFSET_KIND +else + if test "$FORTRAN_MPI_OFFSET" = "integer*8" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 && test $NOF90 = 0 ; then + +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +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 "$FC" ; then + # This list should correspond to the list in aclocal_fc.m4 + for ac_prog in ifort pgf90 pathf90 pathf95 xlf90 xlf95 f90 epcf90 \ + f95 fort lf95 gfortran g95 ifc efc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_FC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$FC"; then + ac_cv_prog_FC="$FC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_FC="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +FC=$ac_cv_prog_FC +if test -n "$FC"; then + { $as_echo "$as_me:$LINENO: result: $FC" >&5 +$as_echo "$FC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$FC" && break +done + + fi + { $as_echo "$as_me:$LINENO: checking for extension for Fortran 90 programs" >&5 +$as_echo_n "checking for extension for Fortran 90 programs... " >&6; } + ac_f90ext="f90" + ac_f90compile='${FC-f90} -c $FCFLAGS conftest.$ac_f90ext 1>&5' + cat > conftest.$ac_f90ext <&5 + (eval $ac_f90compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } ; then + { $as_echo "$as_me:$LINENO: result: f90" >&5 +$as_echo "f90" >&6; } + else + # This is needed for Mac OSX 10.5 + rm -rf conftest.dSYM + rm -f conftest* + ac_f90ext="f" + cat > conftest.$ac_f90ext <&5 + (eval $ac_f90compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } ; then + { $as_echo "$as_me:$LINENO: result: f" >&5 +$as_echo "f" >&6; } + else + { $as_echo "$as_me:$LINENO: result: unknown!" >&5 +$as_echo "unknown!" >&6; } + fi + fi +fi +{ $as_echo "$as_me:$LINENO: checking for Fortran 90 KIND parameter for 8-byte integers" >&5 +$as_echo_n "checking for Fortran 90 KIND parameter for 8-byte integers... " >&6; } +cat < conftest.$ac_f90ext + program main + integer i + i = selected_int_kind(16) + open(8, file="conftest.out", form="formatted") + write (8,*) i + close(8) + stop + end +EOF +if test -z "$FC" ; then + FC=f90 +fi +KINDVAL="" +if $FC -o conftest$EXEEXT conftest.$ac_f90ext >/dev/null 2>&1 ; then + ./conftest$EXEEXT >/dev/null 2>&1 + if test -s conftest.out ; then + KINDVAL=`cat conftest.out` + fi +fi +# This is needed for Mac OSX 10.5 +rm -rf conftest.dSYM +rm -f conftest* +if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then + { $as_echo "$as_me:$LINENO: result: $KINDVAL" >&5 +$as_echo "$KINDVAL" >&6; } + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)" +else + { $as_echo "$as_me:$LINENO: result: unavailable" >&5 +$as_echo "unavailable" >&6; } +fi + + fi + # + if test "$FORTRAN_MPI_OFFSET" = "integer" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 && test $NOF90 = 0 ; then + { $as_echo "$as_me:$LINENO: checking for Fortran 90 KIND parameter for 4-byte integers" >&5 +$as_echo_n "checking for Fortran 90 KIND parameter for 4-byte integers... " >&6; } +rm -f kind.f kind.$OBJEXT kind$EXEEXT +cat < kind.f + program main + integer i + i = selected_int_kind(8) + open(8, file="k.out", form="formatted") + write (8,*) i + close(8) + stop + end +EOF +if test -z "$FC" ; then + FC=f90 +fi +KINDVAL="" +if $FC -o kind$EXEEXT kind.f >/dev/null 2>&1 ; then + ./kind >/dev/null 2>&1 + if test -s k.out ; then + KINDVAL=`cat k.out` + fi +fi +rm -f kind$EXEEXT k.out kind.f kind.$OBJEXT +if test -n "$KINDVAL" -a "$KINDVAL" != "-1" ; then + { $as_echo "$as_me:$LINENO: result: $KINDVAL" >&5 +$as_echo "$KINDVAL" >&6; } + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$KINDVAL)" +else + { $as_echo "$as_me:$LINENO: result: unavailable" >&5 +$as_echo "unavailable" >&6; } +fi + + fi +fi +# +# Test that we can use the FORTRAN_MPI_OFFSET type. If the environment +# is a strict Fortran 90/95 or later compiler, the "integer*8" format +# may not work. +if test "$NOF77" = 0 ; then + rm -f conftest* + ac_cv_f77_offset_type_works=no + { $as_echo "$as_me:$LINENO: checking that we can use $FORTRAN_MPI_OFFSET to declare MPI_DISPLACMENT_CURRENT" >&5 +$as_echo_n "checking that we can use $FORTRAN_MPI_OFFSET to declare MPI_DISPLACMENT_CURRENT... " >&6; } + cat >conftest.f <>config.log 2>&1 && test -x conftest$EXEEXT ; then + ac_cv_f77_offset_type_works=yes + fi + rm -f conftest* + { $as_echo "$as_me:$LINENO: result: $ac_cv_f77_offset_type_works" >&5 +$as_echo "$ac_cv_f77_offset_type_works" >&6; } + + if test "$ac_cv_f77_offset_type_works" != "yes" -a -n "$MPI_OFFSET_KIND_VAL"; then + { $as_echo "$as_me:$LINENO: checking whether we can use KIND with the selected F77 compiler $F77" >&5 +$as_echo_n "checking whether we can use KIND with the selected F77 compiler $F77... " >&6; } + ac_cv_f77_allows_offset_kind=no + rm -f conftest* + cat >conftest.f <>config.log 2>&1 && test -x conftest$EXEEXT ; then + ac_cv_f77_allows_offset_kind=yes + fi + rm -f conftest* + { $as_echo "$as_me:$LINENO: result: $ac_cv_f77_allows_offset_kind" >&5 +$as_echo "$ac_cv_f77_allows_offset_kind" >&6; } + if test "$ac_cv_f77_allows_offset_kind" ; then + FORTRAN_MPI_OFFSET="integer (kind=$MPI_OFFSET_KIND_VAL)" + else + { $as_echo "$as_me:$LINENO: WARNING: Could not find a way to declare an integer type corresponding to MPI_Offset in Fortran." >&5 +$as_echo "$as_me: WARNING: Could not find a way to declare an integer type corresponding to MPI_Offset in Fortran." >&2;} + fi + fi +fi + +# +# check if MPI_Info functions are defined in the MPI implementation +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + + { $as_echo "$as_me:$LINENO: checking if MPI_Info functions are defined in the MPI implementation" >&5 +$as_echo_n "checking if MPI_Info functions are defined in the MPI implementation... " >&6; } + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI_INFO 1 +_ACEOF + + HAVE_MPI_INFO="#define HAVE_MPI_INFO" + MPI_FINFO1="!" + MPI_FINFO2="!" + MPI_FINFO3="!" + MPI_FINFO4="!" + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + BUILD_MPI_INFO=1 + MPI_FINFO1=" INTEGER MPI_MAX_INFO_KEY, MPI_MAX_INFO_VAL" + MPI_FINFO2=" PARAMETER (MPI_MAX_INFO_KEY=255, MPI_MAX_INFO_VAL=1024)" + MPI_FINFO3=" INTEGER MPI_INFO_NULL" + MPI_FINFO4=" PARAMETER (MPI_INFO_NULL=0)" + fi + rm -f conftest$EXEEXT mpitest.c + +else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI_INFO 1 +_ACEOF + + HAVE_MPI_INFO="#define HAVE_MPI_INFO" + MPI_FINFO1="!" + MPI_FINFO2="!" + MPI_FINFO3="!" + MPI_FINFO4="!" +fi +# +if test -n "$mpi_sgi"; then + + { $as_echo "$as_me:$LINENO: checking if MPI_SGI_type_is_contig is defined" >&5 +$as_echo_n "checking if MPI_SGI_type_is_contig is defined... " >&6; } + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define NO_MPI_SGI_type_is_contig /**/ +_ACEOF + + fi + rm -f conftest$EXEEXT mpitest.c + + + { $as_echo "$as_me:$LINENO: checking if MPI-2 combiners are defined in mpi.h" >&5 +$as_echo_n "checking if MPI-2 combiners are defined in mpi.h... " >&6; } + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI_COMBINERS /**/ +_ACEOF + + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + rm -f conftest$EXEEXT mpitest.c + + + { $as_echo "$as_me:$LINENO: checking if MPI_OFFSET_KIND is defined in mpif.h" >&5 +$as_echo_n "checking if MPI_OFFSET_KIND is defined in mpif.h... " >&6; } + rm -f mpitest.f + cat > mpitest.f < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + rm -f conftest$EXEEXT mpitest.f + +fi +# +# check if darray and subarray constructors are defined in the MPI +# implementation +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + + { $as_echo "$as_me:$LINENO: checking if darray and subarray constructors are defined in the MPI implementation" >&5 +$as_echo_n "checking if darray and subarray constructors are defined in the MPI implementation... " >&6; } + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI_DARRAY_SUBARRAY /**/ +_ACEOF + + HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" + MPI_FARRAY1="!" + MPI_FARRAY2="!" + MPI_FARRAY3="!" + MPI_FARRAY4="!" + MPI_FARRAY5="!" + MPI_FARRAY6="!" + MPI_FARRAY7="!" + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + BUILD_MPI_ARRAY=1 + MPI_FARRAY1=" INTEGER MPI_ORDER_C, MPI_ORDER_FORTRAN" + MPI_FARRAY2=" PARAMETER (MPI_ORDER_C=56, MPI_ORDER_FORTRAN=57)" + MPI_FARRAY3=" INTEGER MPI_DISTRIBUTE_BLOCK, MPI_DISTRIBUTE_CYCLIC" + MPI_FARRAY4=" INTEGER MPI_DISTRIBUTE_NONE, MPI_DISTRIBUTE_DFLT_DARG" + MPI_FARRAY5=" PARAMETER (MPI_DISTRIBUTE_BLOCK=121, MPI_DISTRIBUTE_CYCLIC=122)" + MPI_FARRAY6=" PARAMETER (MPI_DISTRIBUTE_NONE=123)" + MPI_FARRAY7=" PARAMETER (MPI_DISTRIBUTE_DFLT_DARG=-49767)" + fi + rm -f conftest$EXEEXT mpitest.c + +fi +if test $FROM_MPICH2 = yes ; then + { $as_echo "$as_me:$LINENO: result: Overriding Array test for MPICH2" >&5 +$as_echo "Overriding Array test for MPICH2" >&6; } + unset BUILD_MPI_ARRAY + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI_DARRAY_SUBARRAY 1 +_ACEOF + + HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" + MPI_FARRAY1="!" + MPI_FARRAY2="!" + MPI_FARRAY3="!" + MPI_FARRAY4="!" + MPI_FARRAY5="!" + MPI_FARRAY6="!" + MPI_FARRAY7="!" +fi +# +# +# Test for weak symbol support... +# We can't put # in the message because it causes autoconf to generate +# incorrect code +HAVE_WEAK_SYMBOLS=0 +if test -n "$arch_hpux" || test -n "$arch_sppux" ; then +# multiple secondary definitions not allowed by HP compilers +# Fortran interface for HP already uses one secondary defn. +# therefore, do not use this method for profiling interface. +# build profiling interface explicitly. + TRY_WEAK_SYMBOLS=0 +fi +if test $TRY_WEAK_SYMBOLS = 1 ; then + { $as_echo "$as_me:$LINENO: checking for weak symbol support" >&5 +$as_echo_n "checking for weak symbol support... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +extern int PFoo(int); +#pragma weak PFoo = Foo +int Foo(int a) { return a; } + +int +main () +{ +return PFoo(1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + has_pragma_weak=1 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + # + # Some systems (Linux ia64 and ecc, for example), support weak symbols + # only within a single object file! This tests that case. + # Note that there is an extern int PFoo declaration before the + # pragma. Some compilers require this in order to make the weak symbol + # extenally visible. +if test "$has_pragma_weak" = 1 ; then + { $as_echo "$as_me:$LINENO: result: pragma weak" >&5 +$as_echo "pragma weak" >&6; } + { $as_echo "$as_me:$LINENO: checking that weak symbols are visible to other files" >&5 +$as_echo_n "checking that weak symbols are visible to other files... " >&6; } + rm -f conftest* + cat >>conftest1.c <>conftest2.c <&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:$LINENO: checking that the compiler correctly implements weak symbols" >&5 +$as_echo_n "checking that the compiler correctly implements weak symbols... " >&6; } + # The gcc 3.4.x compiler accepts the pragma weak, but does not + # correctly implement it on systems where the loader doesn't + # support weak symbols (e.g., cygwin). This is a bug in gcc, but it + # it is one that *we* have to detect. + rm -f conftest* + cat >>conftest1.c <>conftest2.c <&5 +$as_echo "yes" >&6; } + has_pragma_weak=1 + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + echo "$ac_link2" >> config.log + echo "Failed program was" >> config.log + cat conftest1.c >>config.log + cat conftest2.c >>config.log + if test -s conftest.out ; then cat conftest.out >> config.log ; fi + has_pragma_weak=0 + fi + else + echo "$ac_link2" 1>&5 + echo "Failed program was" 1>&5 + cat conftest1.c 1>&5 + cat conftest2.c 1>&5 + if test -s conftest.out ; then cat conftest.out 1>&5 ; fi + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + has_pragma_weak=0 + fi + rm -f conftest* + fi + if test "$has_pragma_weak" = 1 ; then + HAVE_WEAK_SYMBOLS=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PRAGMA_WEAK 1 +_ACEOF + + else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +extern int PFoo(int); +#pragma _HP_SECONDARY_DEF Foo PFoo +int Foo(int a) { return a; } + +int +main () +{ +return PFoo(1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + has_pragma_hp_secondary=1 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + if test "$has_pragma_hp_secondary" = 1 ; then + { $as_echo "$as_me:$LINENO: result: pragma _HP_SECONDARY_DEF" >&5 +$as_echo "pragma _HP_SECONDARY_DEF" >&6; } + HAVE_WEAK_SYMBOLS=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PRAGMA_HP_SEC_DEF 1 +_ACEOF + + else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +extern int PFoo(int); +#pragma _CRI duplicate PFoo as Foo +int Foo(int a) { return a; } + +int +main () +{ +return PFoo(1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + has_pragma_cri_duplicate=1 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + if test "$has_pragma_cri_duplicate" = 1 ; then + { $as_echo "$as_me:$LINENO: result: pragma _CRI duplicate x as y" >&5 +$as_echo "pragma _CRI duplicate x as y" >&6; } + HAVE_WEAK_SYMBOLS=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PRAGMA_CRI_DUP 1 +_ACEOF + + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + fi +fi +if test "$HAVE_WEAK_SYMBOLS" = 1 ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WEAK_SYMBOLS 1 +_ACEOF + +fi + + + + +# +# Check whether the MPI Offset type is compatible with struct flock +{ $as_echo "$as_me:$LINENO: checking whether struct flock compatible with MPI_Offset" >&5 +$as_echo_n "checking whether struct flock compatible with MPI_Offset... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct flock l; + $MPI_OFFSET_TYPE a=1; + l.l_start = a; + l.l_len = a; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_struct_flock_and_mpi_offset=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_struct_flock_and_mpi_offset=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $pac_cv_struct_flock_and_mpi_offset" >&5 +$as_echo "$pac_cv_struct_flock_and_mpi_offset" >&6; } +# FIXME: We should look for struct flock64 and the F_SETLK64/F_GETLK64 +# ADIOI_Set_lock could use these instead. +if test "$pac_cv_struct_flock_and_mpi_offset" = no ; then + { $as_echo "$as_me:$LINENO: checking whether struct flock compatible with int" >&5 +$as_echo_n "checking whether struct flock compatible with int... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct flock l; + int a=1; + l.l_start = a; + l.l_len = a; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_struct_flock_and_int=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_struct_flock_and_int=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$LINENO: result: $pac_cv_struct_flock_and_int" >&5 +$as_echo "$pac_cv_struct_flock_and_int" >&6; } + if test "$pac_cv_struct_flock_and_int" = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define NEEDS_INT_CAST_WITH_FLOCK 1 +_ACEOF + + fi + # FIXME. Solaris header files define off_t as a UNION if 64bit file + # sizes are selected. Gah! +fi + +# +# if FILE_SYSTEM is not set above, use ufs and nfs as default +# +if test -z "$FILE_SYSTEM" ; then + file_system_ufs=1 + file_system_nfs=1 + FILE_SYSTEM="ufs nfs" +fi + +# no matter what, always build testfs +file_system_testfs=1 +FILE_SYSTEM="testfs $FILE_SYSTEM" + +# An attempt to "do the right thing" with as little help from the end-user as +# possible: +# - if 'with-pvfs2' given, use that to find pvfs2-config. complain if we +# cannot find it, as this is probably what the user would expect +# - if we can find 'pvfs2-config' in our path, we can use it to set CFLAGS, +# LIBS, and LDFLAGS accordingly +# - as a fallback, use CFLAGS, LIBS, and LDFLAGS passed in by the user +# - don't do any of this if --with-file-system was given and did not include +# 'pvfs2': i.e. don't surprise the user with pvfs support. + +# Extract the first word of "pvfs2-config", so it can be a program name with args. +set dummy pvfs2-config; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PVFS2_CONFIG+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $PVFS2_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PVFS2_CONFIG="$PVFS2_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="${with_pvfs2}/bin:$PATH" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PVFS2_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PVFS2_CONFIG" && ac_cv_path_PVFS2_CONFIG="notfound" + ;; +esac +fi +PVFS2_CONFIG=$ac_cv_path_PVFS2_CONFIG +if test -n "$PVFS2_CONFIG"; then + { $as_echo "$as_me:$LINENO: result: $PVFS2_CONFIG" >&5 +$as_echo "$PVFS2_CONFIG" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test $PVFS2_CONFIG != "notfound" ; then + if test -n "${with_pvfs2}" -o -n "${file_system_pvfs2}" ; then + # the user either told us where pvfs is or asked for it in + # --with-file-system (or both) + CFLAGS="$CFLAGS $( $PVFS2_CONFIG --cflags)" + LIBS="$LIBS $( $PVFS2_CONFIG --libs)" + FILE_SYSTEM="pvfs2 $FILE_SYSTEM" + file_system_pvfs2=1 + fi +fi + +if test "$PVFS2_CONFIG" = "notfound" -a -n "$with_pvfs2" ; then + { { $as_echo "$as_me:$LINENO: error: pvfs2-config not found in $with_pvfs2" >&5 +$as_echo "$as_me: error: pvfs2-config not found in $with_pvfs2" >&2;} + { (exit 1); exit 1; }; } +fi + +# +# Print list of configured file systems +# +# TODO: REMOVE BAD ONES FROM THE LIST SOMEHOW? +# +{ $as_echo "$as_me:$LINENO: checking configured file systems" >&5 +$as_echo_n "checking configured file systems... " >&6; } +{ $as_echo "$as_me:$LINENO: result: $FILE_SYSTEM" >&5 +$as_echo "$FILE_SYSTEM" >&6; } + +if test -n "$file_system_nfs" ; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_NFS 1 +_ACEOF + + { $as_echo "$as_me:$LINENO: WARNING: File locks may not work with NFS. See the Installation and +users manual for instructions on testing and if necessary fixing this" >&5 +$as_echo "$as_me: WARNING: File locks may not work with NFS. See the Installation and +users manual for instructions on testing and if necessary fixing this" >&2;} +fi + +if test -n "$file_system_panfs"; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_PANFS 1 +_ACEOF + +fi +if test -n "$file_system_ufs"; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_UFS 1 +_ACEOF + +fi +if test -n "$file_system_bgl"; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_BGL 1 +_ACEOF + +fi +if test -n "$file_system_bglockless"; then + if test x"$file_system_bgl" = x ; then + { { $as_echo "$as_me:$LINENO: error: \"bglockless requested without bgl\"" >&5 +$as_echo "$as_me: error: \"bglockless requested without bgl\"" >&2;} + { (exit 1); exit 1; }; } + fi + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_BGLOCKLESS 1 +_ACEOF + +fi +if test -n "$file_system_hfs"; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HFS 1 +_ACEOF + +fi +if test -n "$file_system_sfs"; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_SFS 1 +_ACEOF + +fi + +if test -n "$file_system_pfs"; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_PFS 1 +_ACEOF + +fi + +if test -n "$file_system_testfs"; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_TESTFS 1 +_ACEOF + +fi +# +# Verify presence of lustre/lustre_user.h +# +if test -n "$file_system_lustre"; then + +for ac_header in lustre/lustre_user.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_LUSTRE 1 +_ACEOF + +else + { { $as_echo "$as_me:$LINENO: error: LUSTRE support requested but cannot find lustre/lustre_user.h header file" >&5 +$as_echo "$as_me: error: LUSTRE support requested but cannot find lustre/lustre_user.h header file" >&2;} + { (exit 1); exit 1; }; } + +fi + +done + +fi + +if test -n "$file_system_xfs"; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_XFS 1 +_ACEOF + + # Check for memalign value + { $as_echo "$as_me:$LINENO: checking for memory alignment needed for direct I/O" >&5 +$as_echo_n "checking for memory alignment needed for direct I/O... " >&6; } +if test "${pac_cv_memalignval+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + rm -f confmemalignval + rm -f /tmp/romio_tmp.bin + if test "$cross_compiling" = yes; then + pac_cv_memalignval="unknown" + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +#include +int main(int argc, char **argv) { + struct dioattr st; + int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); + FILE *f=fopen("confmemalignval","w"); + if (fd == -1) exit(1); + if (!f) exit(1); + fcntl(fd, F_DIOINFO, &st); + fprintf( f, "%u\n", st.d_mem); + exit(0); + } + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + pac_cv_memalignval=`cat confmemalignval` +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +pac_cv_memalignval="unknown" +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -f confmemalignval + rm -f /tmp/romio_tmp.bin + +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_memalignval" >&5 +$as_echo "$pac_cv_memalignval" >&6; } + if test -n "$pac_cv_memalignval" -a "$pac_cv_memalignval" != 0 -a \ + "$pac_cv_memalignval" != "unknown" ; then + CFLAGS="$CFLAGS -DXFS_MEMALIGN=$pac_cv_memalignval" + else + { $as_echo "$as_me:$LINENO: result: assuming 128 for memory alignment" >&5 +$as_echo "assuming 128 for memory alignment" >&6; } + CFLAGS="$CFLAGS -DXFS_MEMALIGN=128" + fi +fi + +# +# Verify presence of pvfs.h, issue with int64 +# +if test -n "$file_system_pvfs"; then + CPPFLAGS="$CPPFLAGS $CFLAGS" + +for ac_header in pvfs.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_PVFS 1 +_ACEOF + +else + { { $as_echo "$as_me:$LINENO: error: PVFS support requested but cannot find pvfs.h header file" >&5 +$as_echo "$as_me: error: PVFS support requested but cannot find pvfs.h header file" >&2;} + { (exit 1); exit 1; }; } + +fi + +done + + # Check for missing int64_t (intel version 8 compiler and -no-gcc + # selected) + { $as_echo "$as_me:$LINENO: checking that pvfs.h can be compiled" >&5 +$as_echo_n "checking that pvfs.h can be compiled... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include + +int +main () +{ + + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pvfs_header_ok=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pvfs_header_ok=no + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$LINENO: result: $pvfs_header_ok" >&5 +$as_echo "$pvfs_header_ok" >&6; } + if test "$pvfs_header_ok" = no -a "$ac_cv_sizeof_long_long" = 8 ; then + { $as_echo "$as_me:$LINENO: checking if pvfs.h can be compiled if we define int64_t" >&5 +$as_echo_n "checking if pvfs.h can be compiled if we define int64_t... " >&6; } + # Try again, but with int64_t + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + typedef long long int int64_t; +#include + +int +main () +{ + + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pvfs_header_ok="yes with int64 definition" + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$LINENO: result: $pvfs_header_ok" >&5 +$as_echo "$pvfs_header_ok" >&6; } + fi + if test "$pvfs_header_ok" = "yes with int64 definition" ; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_PVFS_NEEDS_INT64_DEFINITION 1 +_ACEOF + + fi + if test "$pvfs_header_ok" != "no" ; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_PVFS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PVFS_SUPER_MAGIC 1 +_ACEOF + + else + { $as_echo "$as_me:$LINENO: WARNING: missing or broken pvfs.h header file; disabling ROMIO PVFS support" >&5 +$as_echo "$as_me: WARNING: missing or broken pvfs.h header file; disabling ROMIO PVFS support" >&2;} + fi +fi + + + +if test -n "$file_system_zoidfs"; then + +for ac_header in zoidfs.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_ZOIDFS 1 +_ACEOF + +else + { { $as_echo "$as_me:$LINENO: error: ZoidFS support requested but cannot find zoidfs.h header file" >&5 +$as_echo "$as_me: error: ZoidFS support requested but cannot find zoidfs.h header file" >&2;} + { (exit 1); exit 1; }; } + +fi + +done + +fi + +# +# Verify presence of pvfs2.h +# +if test -n "$file_system_pvfs2"; then + CPPFLAGS="$CPPFLAGS $CFLAGS" + +for ac_header in pvfs2.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_PVFS2 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PVFS2_SUPER_MAGIC 1 +_ACEOF + +else + { { $as_echo "$as_me:$LINENO: error: PVFS2 support requested but cannot find pvfs2.h header file" >&5 +$as_echo "$as_me: error: PVFS2 support requested but cannot find pvfs2.h header file" >&2;} + { (exit 1); exit 1; }; } + +fi + +done + +fi + +# layout change after pvfs-2.6.3: +if test -n "$file_system_pvfs2"; then + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include "pvfs2.h" + int main(int argc, char **argv) { + PVFS_object_ref ref; + PVFS_sys_attr attr; + PVFS_sys_create(NULL, ref, attr, NULL, NULL, NULL, NULL); + return 0; } + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PVFS2_CREATE_WITHOUT_LAYOUT 1 +_ACEOF + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + +if test -n "$file_system_gridftp"; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_GRIDFTP 1 +_ACEOF + +fi + +if test -n "$file_system_bgl"; then + SYSDEP_INC=-I${prefix}/include +else + SYSDEP_INC= + +# Check for presence and characteristics of async. I/O calls if +# not disabled. + +# Some systems need pthreads to get AIO to work. However, we don't want +# to add pthreads just because it is there, as that can cause problems +# with some implementations of pthreads and compilers (e.g., gcc version 3 +# would fail if there was an int a[100000] on the stack if the application +# was *linked* with pthreads, but would succeed if the application was +# *not linked* with pthreads. +# +if test "x$disable_aio" = "xno" ; then + { $as_echo "$as_me:$LINENO: checking for library containing aio_write" >&5 +$as_echo_n "checking for library containing aio_write... " >&6; } +if test "${ac_cv_search_aio_write+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char aio_write (); +int +main () +{ +return aio_write (); + ; + return 0; +} +_ACEOF +for ac_lib in '' aio rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_search_aio_write=$ac_res +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_aio_write+set}" = set; then + break +fi +done +if test "${ac_cv_search_aio_write+set}" = set; then + : +else + ac_cv_search_aio_write=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_aio_write" >&5 +$as_echo "$ac_cv_search_aio_write" >&6; } +ac_res=$ac_cv_search_aio_write +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + aio_write_found=yes +else + aio_write_found=no +fi + + if test "$aio_write_found" = no ; then + # If not found, try finding pthread_create first, and if + # found, try the test again. + { $as_echo "$as_me:$LINENO: checking for library containing pthread_create" >&5 +$as_echo_n "checking for library containing pthread_create... " >&6; } +if test "${ac_cv_search_pthread_create+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +for ac_lib in '' pthread; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_search_pthread_create=$ac_res +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_pthread_create+set}" = set; then + break +fi +done +if test "${ac_cv_search_pthread_create+set}" = set; then + : +else + ac_cv_search_pthread_create=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_pthread_create" >&5 +$as_echo "$ac_cv_search_pthread_create" >&6; } +ac_res=$ac_cv_search_pthread_create +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + foundPTHREAD=yes +else + foundPTHREAD=no +fi + + if test "$foundPTHREAD" = yes ; then + { $as_echo "$as_me:$LINENO: checking for library containing aio_write" >&5 +$as_echo_n "checking for library containing aio_write... " >&6; } +if test "${ac_cv_search_aio_write+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char aio_write (); +int +main () +{ +return aio_write (); + ; + return 0; +} +_ACEOF +for ac_lib in '' aio rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_search_aio_write=$ac_res +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_aio_write+set}" = set; then + break +fi +done +if test "${ac_cv_search_aio_write+set}" = set; then + : +else + ac_cv_search_aio_write=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_aio_write" >&5 +$as_echo "$ac_cv_search_aio_write" >&6; } +ac_res=$ac_cv_search_aio_write +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + aio_write_found=yes +else + aio_write_found=no +fi + + fi + fi +fi + +if test "x$disable_aio" = "xno" -a -n "$aio_write_found" ; then + +for ac_header in signal.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # Just because aio.h is found by CPP doesn't mean that we can use it + # We try to compile it, not just read it. + { $as_echo "$as_me:$LINENO: checking if aio.h exists and can be compiled" >&5 +$as_echo_n "checking if aio.h exists and can be compiled... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + have_aio_h=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + have_aio_h=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$LINENO: result: $have_aio_h" >&5 +$as_echo "$have_aio_h" >&6; } + if test "$have_aio_h" = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AIO_H 1 +_ACEOF + + fi + + { $as_echo "$as_me:$LINENO: checking if sys/aio.h exists and can be compiled" >&5 +$as_echo_n "checking if sys/aio.h exists and can be compiled... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + have_sys_aio_h=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + have_sys_aio_h=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$LINENO: result: $have_sys_aio_h" >&5 +$as_echo "$have_sys_aio_h" >&6; } + if test "$have_sys_aio_h" = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_AIO_H 1 +_ACEOF + + fi + if test "$have_aio_h" = "no" -a "$have_sys_aio_h" = "no" ; then + disable_aio=yes + fi +fi + +if test "$have_aio_h" = "yes" -o "$have_sys_aio_h" = "yes" -o "x$disable_aio" = "xno"; then + + # Check that aio is available (many systems appear to have aio + # either installed improperly or turned off). + # The test is the following: if not cross compiling, try to run a + # program that includes a *reference* to aio_write but does not call it + # If the libraries are not set up correctly, then this will fail. + + { $as_echo "$as_me:$LINENO: checking whether aio routines can be used" >&5 +$as_echo_n "checking whether aio routines can be used... " >&6; } + # Include aio.h and the aiocb struct (since we'll need these to + # actually use the aio_write interface). Note that this will + # fail for some pre-POSIX implementations of the aio interface + # (an old IBM interface needs an fd argument as well) + if test "$cross_compiling" = yes; then + aio_runs=no + { $as_echo "$as_me:$LINENO: result: no: aio routines disabled when cross compiling" >&5 +$as_echo "no: aio routines disabled when cross compiling" >&6; } + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + int main(int argc, char **argv) + { + struct aiocb *aiocbp; + if (argc > 10) aio_write(aiocbp); + return 0; + } + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + aio_runs=yes + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +aio_runs=no + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + if test "$aio_runs" != "no" ; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_WORKING_AIO 1 +_ACEOF + + fi + + # now about that old IBM interface... + # modern AIO interfaces have the file descriptor in the aiocb structure, + # and will set ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES. Old IBM + # implementations pass the file descriptor as an argument to aio_write and + # aio_read. AIO still works on these platforms, but we have to test with + # two-argument aio_write to avoid a false negative. no need to worry about + # the two-argument vs. one-argument aio_write and aio_read: ROMIO already + # uses ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES to call aio_write and + # aio_read correctly + + { $as_echo "$as_me:$LINENO: checking for obsolete two-argument aio_write" >&5 +$as_echo_n "checking for obsolete two-argument aio_write... " >&6; } + if test "$cross_compiling" = yes; then + aio_two_arg_write=no + { $as_echo "$as_me:$LINENO: result: no: cannot test when cross-compiling" >&5 +$as_echo "no: cannot test when cross-compiling" >&6; } + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + int main(int argc, char **argv) + { + int fd; + struct aiocb *aiocbp; + if (argc > 10) aio_write(fd, aiocbp); + return 0; + } + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + aio_two_arg_write=yes + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +aio_two_arg_write=no + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + + if test "$aio_two_arg_write" != "no" -a "$aio_runs" != "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_WORKING_AIO 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_AIO_CALLS_NEED_FILEDES 1 +_ACEOF + + fi + + { $as_echo "$as_me:$LINENO: checking for obsolete two-argument aio_suspend" >&5 +$as_echo_n "checking for obsolete two-argument aio_suspend... " >&6; } + if test "$cross_compiling" = yes; then + aio_two_arg_suspend=no + { $as_echo "$as_me:$LINENO: result: no: cannot test when cross compiling" >&5 +$as_echo "no: cannot test when cross compiling" >&6; } + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + int main(int argc, char **argv) + { + struct aiocb *aiocbp; + if (argc > 10) aio_suspend(1, &aiocbp); + return 0; + } + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + aio_two_arg_suspend=yes + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +aio_two_arg_suspend=no + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + + if test "$aio_two_arg_suspend" != "no" -a "$aio_runs" != "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS 1 +_ACEOF + + fi + + { $as_echo "$as_me:$LINENO: checking for aio_fildes member of aiocb structure" >&5 +$as_echo_n "checking for aio_fildes member of aiocb structure... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + +int +main () +{ + + struct aiocb a; + a.aio_fildes = 0; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES 1 +_ACEOF + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$LINENO: checking for aio_whence member of aiocb structure" >&5 +$as_echo_n "checking for aio_whence member of aiocb structure... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif +#include +#include + +int +main () +{ + + struct aiocb a; + a.aio_whence = SEEK_SET; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_WHENCE 1 +_ACEOF + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$LINENO: checking for aio_handle member of aiocb structure" >&5 +$as_echo_n "checking for aio_handle member of aiocb structure... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + +int +main () +{ + + struct aiocb a; + aio_handle_t h; + + a.aio_handle = h; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_HANDLE 1 +_ACEOF + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$LINENO: checking for aio_reqprio member of aiocb structure" >&5 +$as_echo_n "checking for aio_reqprio member of aiocb structure... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + +int +main () +{ + + struct aiocb a; + + a.aio_reqprio = 0; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_REQPRIO 1 +_ACEOF + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$LINENO: checking for aio_sigevent member of aiocb structure" >&5 +$as_echo_n "checking for aio_sigevent member of aiocb structure... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + +int +main () +{ + + struct aiocb a; + + a.aio_sigevent.sigev_signo = 0; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_SIGEVENT 1 +_ACEOF + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +fi +# End of aio-related tests + +# +# Check for statfs (many) and specifically f_fstypename field (BSD) +# + + + + +for ac_header in sys/vfs.h sys/param.h sys/mount.h sys/statvfs.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +{ $as_echo "$as_me:$LINENO: checking whether struct statfs properly defined" >&5 +$as_echo_n "checking whether struct statfs properly defined... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SYS_VFS_H +#include +#endif +#ifdef HAVE_SYS_STATVFS_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif + +int +main () +{ + + struct statfs f; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_have_statfs=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_have_statfs=no + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $pac_cv_have_statfs" >&5 +$as_echo "$pac_cv_have_statfs" >&6; } +# At this point, we could check for whether defining +# __SWORD_TYPE as sizet_t or int/long (size of pointer) +# would help. FIXME + +if test "$pac_cv_have_statfs" = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_STATFS 1 +_ACEOF + +fi + +{ $as_echo "$as_me:$LINENO: checking for f_fstypename member of statfs structure" >&5 +$as_echo_n "checking for f_fstypename member of statfs structure... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + + struct statfs f; + memset(&f, 0, sizeof(f)); + strncmp("nfs", f.f_fstypename, 3); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_have_statfs_f_fstypename=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_have_statfs_f_fstypename=no + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $pac_cv_have_statfs_f_fstypename" >&5 +$as_echo "$pac_cv_have_statfs_f_fstypename" >&6; } +if test $pac_cv_have_statfs_f_fstypename = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME 1 +_ACEOF + +fi + +# +# Check for stat and st_fstype field (NEC SX4) +# + + + +for ac_header in sys/stat.h sys/types.h unistd.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in stat +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STAT 1 +_ACEOF + + { $as_echo "$as_me:$LINENO: checking for st_fstype member of stat structure" >&5 +$as_echo_n "checking for st_fstype member of stat structure... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +int +main () +{ + + struct stat s; + + s.st_fstype = NULL; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE 1 +_ACEOF + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +done + + +# +# Check for statvfs and f_basetype field (Solaris, Irix, AIX, etc.) +# + + + +for ac_header in sys/types.h sys/statvfs.h sys/vfs.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in statvfs +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STATVFS 1 +_ACEOF + + { $as_echo "$as_me:$LINENO: checking for f_basetype member of statvfs structure" >&5 +$as_echo_n "checking for f_basetype member of statvfs structure... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif +#ifdef HAVE_SYS_STATVFS_H +#include +#endif + +int +main () +{ + + struct statvfs foo; + + foo.f_basetype[0] = 'a'; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE 1 +_ACEOF + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +done + + +# +# Check for large file support. Make sure that we can use the off64_t +# type (in some cases, it is an array, and the ROMIO code isn't prepared for +# that). +# + +for ac_header in unistd.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +if test "$ac_cv_header_unistd_h" = "yes" ; then + { $as_echo "$as_me:$LINENO: checking for large file defines" >&5 +$as_echo_n "checking for large file defines... " >&6; } +if test "${ac_cv_has_large_file_defines+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include + +int +main () +{ + +#ifndef _LFS64_LARGEFILE +#error no largefile defines +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_has_large_file_defines=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_has_large_file_defines=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_has_large_file_defines" >&5 +$as_echo "$ac_cv_has_large_file_defines" >&6; } + if test "$ac_cv_has_large_file_defines" = "yes" ; then + # See if we can use them + { $as_echo "$as_me:$LINENO: checking whether off64_t is an scalar type" >&5 +$as_echo_n "checking whether off64_t is an scalar type... " >&6; } +if test "${ac_cv_off64_t_scalar+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _LARGEFILE64_SOURCE +#define _FILE_OFFSET_BITS 64 +#include +#include + +int +main () +{ +off64_t a = 3; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_off64_t_scalar=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_off64_t_scalar=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_off64_t_scalar" >&5 +$as_echo "$ac_cv_off64_t_scalar" >&6; } + + if test "$ac_cv_off64_t_scalar" = "yes" ; then + CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" + fi + fi +fi + + +#################################################################### +# We're about to mess with CC etc. No more feature tests past here, +# because we may set CC to something that does not yet exist! +#################################################################### + +if test -n "$mpi_mpich"; then + if test -z "$arch_SX4" ; then + MPIOF_H_INCLUDED=1 + fi + if test "$FROM_MPICH2" = no; then + +cat >>confdefs.h <<\_ACEOF +#define NEEDS_MPI_TEST 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define MPICH 1 +_ACEOF + + fi +fi + +if test -n "$mpi_sgi"; then + +cat >>confdefs.h <<\_ACEOF +#define MPISGI 1 +_ACEOF + +fi + +if test -n "$mpi_lam"; then + +cat >>confdefs.h <<\_ACEOF +#define MPILAM 1 +_ACEOF + +fi + +if test -n "$mpi_hp"; then + +cat >>confdefs.h <<\_ACEOF +#define MPIHP 1 +_ACEOF + + if test "$NOF77" = 0; then + + { $as_echo "$as_me:$LINENO: checking if mpiof.h is included in mpif.h" >&5 +$as_echo_n "checking if mpiof.h is included in mpif.h... " >&6; } + rm -f mpitest.f + cat > mpitest.f < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + MPIOF_H_INCLUDED=1 + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + rm -f conftest$EXEEXT mpitest.f + + fi +fi +# + +for ac_func in strerror +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test -z "$srcdir" -o "$srcdir" = "." ; then srcdir="$ROMIO_HOME" ; fi + +# The master_top_srcdir is the location of the source for the building +# package. This is used only as part of the MPICH2 build, including +# the documentation targets mandoc, htmldoc, and latexdoc +if test -z "$master_top_srcdir" ; then + if test "$FROM_MPICH2" = yes ; then + { $as_echo "$as_me:$LINENO: WARNING: Could not determine master_top_srcdir" >&5 +$as_echo "$as_me: WARNING: Could not determine master_top_srcdir" >&2;} + fi +fi + +# +# Get the master builddir (which may be imported from above) +if test -z "$master_top_builddir" ; then + master_top_builddir=`pwd` +fi +export master_top_builddir + +# Make sure the alternate spelling is used until we clean up all of the code +master_topbuild_dir=$master_top_builddir +export master_topbuild_dir + + +# The following definitions are needed within adio/common/status_setb.c +if test "$FROM_MPICH" = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define MPICH 1 +_ACEOF + +elif test "$FROM_MPICH2" = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define ROMIO_INSIDE_MPICH2 1 +_ACEOF + +elif test "$FROM_MPILAM" = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define MPILAM 1 +_ACEOF + +fi + +if test "$FROM_MPICH2" = no -a "$FROM_MPICH" = no ; then + if test -z "$LIBNAME"; then + LIBNAME="$top_build_dir/lib/libmpio.a" + fi + # + if test ! -d $top_build_dir/lib ; then + mkdir $top_build_dir/lib + fi +else + MPILIBNAME=${MPILIBNAME:-mpich} + if test -z "$LIBNAME" ; then + if test -d "$master_top_builddir/lib" ; then + LIBNAME=$master_top_builddir/lib/lib${MPILIBNAME}.a + else + LIBNAME="$ROMIO_HOME/lib${MPILIBNAME}.a" + fi + fi +fi +if test "$FROM_MPICH2" != no ; then + # use the error handlers from MPICH2 + MPIO_EXTRA_OBJECTS= + MPIO_EXTRA_TMP_POBJECTS= + MPIO_EXTRA_REAL_POBJECTS= + # Use generalized request to get the multiple-completion routines + MPIO_REQOBJECTS= + MPIO_REQ_TMP_POBJECTS= + MPIO_REQ_REAL_POBJECTS= +fi + + + + + + +# +# Use DOCTEXT instead of doctext +for ac_prog in doctext +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DOCTEXT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$DOCTEXT"; then + ac_cv_prog_DOCTEXT="$DOCTEXT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DOCTEXT="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +DOCTEXT=$ac_cv_prog_DOCTEXT +if test -n "$DOCTEXT"; then + { $as_echo "$as_me:$LINENO: result: $DOCTEXT" >&5 +$as_echo "$DOCTEXT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DOCTEXT" && break +done +test -n "$DOCTEXT" || DOCTEXT="true" + + +# +if test $NOF77 = 1 ; then + F77=":" +else + FORTRAN_TEST="fperf fcoll_test fmisc pfcoll_test" +fi +# +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + + { $as_echo "$as_me:$LINENO: checking if a simple MPI program compiles and links" >&5 +$as_echo_n "checking if a simple MPI program compiles and links... " >&6; } + rm -f mpitest.c + cat > mpitest.c <&5 + $cmd >&5 2>&5 + if test ! -x conftest$EXEEXT ; then + echo "$as_me:$LINENO: failed program was:" >&5 + sed 's/^/| /' mpitest.c >&5 + rm -f conftest$EXEEXT mpitest.c + { { $as_echo "$as_me:$LINENO: error: Unable to compile a simple MPI program. +Use environment variables to provide the location of MPI libraries and +include directories" >&5 +$as_echo "$as_me: error: Unable to compile a simple MPI program. +Use environment variables to provide the location of MPI libraries and +include directories" >&2;} + { (exit 1); exit 1; }; } + else + rm -f conftest$EXEEXT mpitest.c + fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + + + { $as_echo "$as_me:$LINENO: checking if MPI_Fint is defined in the MPI implementation" >&5 +$as_echo_n "checking if MPI_Fint is defined in the MPI implementation... " >&6; } + cat > mpitest1.c < /dev/null 2>&1 + if test ! -s mpitest1.$OBJEXT ; then + NEEDS_MPI_FINT="#define NEEDS_MPI_FINT" + CFLAGS="$CFLAGS -DNEEDS_MPI_FINT" + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + rm -f mpitest1.$OBJEXT mpitest1.c + else + NEEDS_MPI_FINT="" + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + rm -f mpitest1.$OBJEXT mpitest1.c + fi + +else + NEEDS_MPI_FINT="" +fi +# +if test "$MPI_INCLUDE_DIR" = "." ; then + ROMIO_INCLUDE="-I../include" +else + ROMIO_INCLUDE="-I../include -I$MPI_INCLUDE_DIR" +fi +# +TEST_LIBNAME=$LIBNAME +MPIRUN=mpirun +# +# if MPICH, use mpicc in test programs +# +if test "$FROM_MPICH" = yes ; then + MPICH_HOME=`dirname $ROMIO_HOME` + if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi + TEST_CC=$MPI_BIN_DIR/mpicc + MPI_LIB="" + ROMIO_INCLUDE="" + USER_CFLAGS="" + USER_FFLAGS="" + TEST_LIBNAME="" + MPIRUN=$MPI_BIN_DIR/mpirun + if test -n "$arch_SX4" || test -n "$arch_hpux" ; then + TEST_F77=$MPI_BIN_DIR/mpif90 + else + TEST_F77=$MPI_BIN_DIR/mpif77 + fi + CC=$MPI_BIN_DIR/mpicc + # A later test will insert the mpi2-other/info and array directories based + # on the value of BUILD_MPI_xxxx. This lets MPICH2 turn these off, + # since MPICH2 provides these routines elsewhere + EXTRA_DIRS="mpi-io/fortran" + # Some older implementations of the ADI do not include the + # MPID_Status_set_bytes routine. This uses either the + # environment variable ADI3_WITHOUT_SET_BYTES or the + # with arg --without-setbytes + if test "$ADI2_WITHOUT_SET_BYTES" != yes -a \ + "$with_setbytes" != no ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STATUS_SET_BYTES 1 +_ACEOF + + fi +elif test $FROM_LAM = yes ; then + # LAM does have the status set bytes functionality + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STATUS_SET_BYTES 1 +_ACEOF + + + # Used in the tests/ subdirectory for after ROMIO is built + TEST_CC=mpicc + TEST_F77=mpif77 + MPIRUN=mpirun + MPI_LIB= + ROMIO_INCLUDE= + USER_CFLAGS= + USER_FFLAGS= + TEST_LIBNAME= + EXTRA_DIRS="mpi-io/fortran mpi2-other/info mpi2-other/info/fortran mpi2-other/array mpi2-other/array/fortran" +elif test $FROM_MPICH2 = yes ; then + # For now, separate the mpich2 from mpich cases + MPICH_HOME=`dirname $ROMIO_HOME` + MPICH_HOME=`dirname $MPICH_HOME` + MPICH_HOME=`dirname $MPICH_HOME` + if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi + # No special compiler script. + # BUT we need the include paths + # CC="$CC -I${use_top_srcdir}/src/include -I${top_build_dir}/src/include" + # TEST_CC="$CC" + # MPI_LIB="$LIBNAME" + # To allow ROMIO to work with the LIBTOOL scripts, we want to + # work directly with the CC, not the mpicc, compiler. + # Note that in the "FROM_MPICH2" case, the CPPFLAGS and INCLUDES are already + # properly set + #CC=${top_build_dir}/bin/mpicc + # + # set the compilers to the ones in MPICH2 bin directory (master_top_builddir/bin) + TEST_CC=${master_top_builddir}/bin/mpicc + TEST_F77=${master_top_builddir}/bin/mpif77 + ROMIO_INCLUDE="" + USER_CFLAGS="" + USER_FFLAGS="" + TEST_LIBNAME="" + MPIRUN=${master_top_builddir}/bin/mpiexec + # + # Turn off the building of the Fortran interface and the Info routines + EXTRA_DIRS="" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STATUS_SET_BYTES 1 +_ACEOF + + DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST 1" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPIU_FUNCS 1 +_ACEOF + +fi +# +# +# feature tests: we can't test features if building as part of MPICH because +# we don't yet have an implementation against which we can test +# +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + + { $as_echo "$as_me:$LINENO: checking if MPIR_Status_set_bytes is defined" >&5 +$as_echo_n "checking if MPIR_Status_set_bytes is defined... " >&6; } + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STATUS_SET_BYTES /**/ +_ACEOF + + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + rm -f conftest$EXEEXT mpitest.c + + + { $as_echo "$as_me:$LINENO: checking support for generalized requests" >&5 +$as_echo_n "checking support for generalized requests... " >&6; } + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI_GREQUEST 1 +_ACEOF + + DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST 1" + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + rm -f conftest$EXEEXT mpitest.c + + + { $as_echo "$as_me:$LINENO: checking support for MPICH2 memory macros" >&5 +$as_echo_n "checking support for MPICH2 memory macros... " >&6; } + rm -f mpitest.c + cat > mpitest.c < /dev/null 2>&1 + if test -x conftest$EXEEXT ; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPIU_FUNCS 1 +_ACEOF + + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + rm -f conftest$EXEEXT mpitest.c + + +cat >>confdefs.h <<\_ACEOF +#define PRINT_ERR_MSG 1 +_ACEOF + +fi +# +if test -z "$TEST_CC" ; then + TEST_CC="$CC" +fi +if test -z "$TEST_F77" ; then + TEST_F77="$F77" +fi +# + +for ac_func in strdup +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "$ac_cv_func_strdup" = "yes" ; then + # Do we need to declare strdup? + +{ $as_echo "$as_me:$LINENO: checking whether strdup needs a declaration" >&5 +$as_echo_n "checking whether strdup needs a declaration... " >&6; } +if test "${pac_cv_func_decl_strdup+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int strdup(double, int, double, const char *); +int +main () +{ +int a=strdup(1.0,27,1.0,"foo"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_func_decl_strdup=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_func_decl_strdup=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_func_decl_strdup" >&5 +$as_echo "$pac_cv_func_decl_strdup" >&6; } +if test "$pac_cv_func_decl_strdup" = "yes" ; then + +cat >>confdefs.h <<_ACEOF +#define NEEDS_STRDUP_DECL 1 +_ACEOF + + +fi + +fi + +for ac_func in snprintf +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "$ac_cv_func_snprintf" = "yes" ; then + # Do we need to declare snprintf? + +{ $as_echo "$as_me:$LINENO: checking whether snprintf needs a declaration" >&5 +$as_echo_n "checking whether snprintf needs a declaration... " >&6; } +if test "${pac_cv_func_decl_snprintf+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int snprintf(double, int, double, const char *); +int +main () +{ +int a=snprintf(1.0,27,1.0,"foo"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_func_decl_snprintf=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_func_decl_snprintf=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_func_decl_snprintf" >&5 +$as_echo "$pac_cv_func_decl_snprintf" >&6; } +if test "$pac_cv_func_decl_snprintf" = "yes" ; then + +cat >>confdefs.h <<_ACEOF +#define NEEDS_SNPRINTF_DECL 1 +_ACEOF + + +fi + +fi + +for ac_func in lstat +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "$ac_cv_func_lstat" = "yes" ; then + # Do we need to declare lstat? + +{ $as_echo "$as_me:$LINENO: checking whether lstat needs a declaration" >&5 +$as_echo_n "checking whether lstat needs a declaration... " >&6; } +if test "${pac_cv_func_decl_lstat+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int lstat(double, int, double, const char *); +int +main () +{ +int a=lstat(1.0,27,1.0,"foo"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_func_decl_lstat=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_func_decl_lstat=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_func_decl_lstat" >&5 +$as_echo "$pac_cv_func_decl_lstat" >&6; } +if test "$pac_cv_func_decl_lstat" = "yes" ; then + +cat >>confdefs.h <<_ACEOF +#define NEEDS_LSTAT_DECL 1 +_ACEOF + + +fi + +fi + +for ac_func in readlink +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "$ac_cv_func_readlink" = "yes" ; then + # Do we need to declare readlink? + +{ $as_echo "$as_me:$LINENO: checking whether readlink needs a declaration" >&5 +$as_echo_n "checking whether readlink needs a declaration... " >&6; } +if test "${pac_cv_func_decl_readlink+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int readlink(double, int, double, const char *); +int +main () +{ +int a=readlink(1.0,27,1.0,"foo"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_func_decl_readlink=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_func_decl_readlink=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_func_decl_readlink" >&5 +$as_echo "$pac_cv_func_decl_readlink" >&6; } +if test "$pac_cv_func_decl_readlink" = "yes" ; then + +cat >>confdefs.h <<_ACEOF +#define NEEDS_READLINK_DECL 1 +_ACEOF + + +fi + +fi + +for ac_func in fsync +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "$ac_cv_func_fsync" = "yes" ; then + # Do we need to declare fsync? + +{ $as_echo "$as_me:$LINENO: checking whether fsync needs a declaration" >&5 +$as_echo_n "checking whether fsync needs a declaration... " >&6; } +if test "${pac_cv_func_decl_fsync+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int fsync(double, int, double, const char *); +int +main () +{ +int a=fsync(1.0,27,1.0,"foo"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_func_decl_fsync=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_func_decl_fsync=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_func_decl_fsync" >&5 +$as_echo "$pac_cv_func_decl_fsync" >&6; } +if test "$pac_cv_func_decl_fsync" = "yes" ; then + +cat >>confdefs.h <<_ACEOF +#define NEEDS_FSYNC_DECL 1 +_ACEOF + + +fi + +fi + +for ac_func in ftruncate +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "$ac_cv_func_ftruncate" = "yes" ; then + # Do we need to declare ftruncate? + +{ $as_echo "$as_me:$LINENO: checking whether ftruncate needs a declaration" >&5 +$as_echo_n "checking whether ftruncate needs a declaration... " >&6; } +if test "${pac_cv_func_decl_ftruncate+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int ftruncate(double, int, double, const char *); +int +main () +{ +int a=ftruncate(1.0,27,1.0,"foo"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_func_decl_ftruncate=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_func_decl_ftruncate=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_func_decl_ftruncate" >&5 +$as_echo "$pac_cv_func_decl_ftruncate" >&6; } +if test "$pac_cv_func_decl_ftruncate" = "yes" ; then + +cat >>confdefs.h <<_ACEOF +#define NEEDS_FTRUNCATE_DECL 1 +_ACEOF + + +fi + +fi + + +for ac_func in lseek64 +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "$ac_cv_func_lseek64" = "yes" ; then + +{ $as_echo "$as_me:$LINENO: checking whether lseek64 needs a declaration" >&5 +$as_echo_n "checking whether lseek64 needs a declaration... " >&6; } +if test "${pac_cv_func_decl_lseek64+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int lseek64(double, int, double, const char *); +int +main () +{ +int a=lseek64(1.0,27,1.0,"foo"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_func_decl_lseek64=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_func_decl_lseek64=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_func_decl_lseek64" >&5 +$as_echo "$pac_cv_func_decl_lseek64" >&6; } +if test "$pac_cv_func_decl_lseek64" = "yes" ; then + +cat >>confdefs.h <<_ACEOF +#define NEEDS_LSEEK64_DECL 1 +_ACEOF + + +fi + +fi +# +# Create the directory lists for the Makefile +FILE_SYS_DIRS="" +for dir in $FILE_SYSTEM ; do + FILE_SYS_DIRS="$FILE_SYS_DIRS adio/ad_$dir" +done +EXTRA_SRC_DIRS="" +GLUE_DIR="" +if test "$FROM_MPICH2" = yes -o "${MPI_IMPL}_mpi" = "mpich2_mpi"; then + GLUE_DIR="mpi-io/glue/mpich2" +elif test "$FROM_MPICH" = yes -o "${MPI_IMPL}_mpi" = "mpich_mpi"; then + GLUE_DIR="mpi-io/glue/mpich1" +else + GLUE_DIR="mpi-io/glue/default" +fi +if test "$BUILD_MPI_INFO" = 1 ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi2-other/info" + if test "$NOF77" = 0 -a "$FROM_MPICH2" != yes ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi2-other/info/fortran" + fi +fi +if test "$BUILD_MPI_ARRAY" = 1 ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi2-other/array" + if test "$NOF77" = 0 -a "$FROM_MPICH2" != yes ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi2-other/array/fortran" + fi +fi +if test "$NOF77" = 0 -a "$FROM_MPICH2" != yes ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi-io/fortran" +fi + + + + +# +CFLAGS="$CFLAGS -DHAVE_ROMIOCONF_H" +# + +if test -n "$MPIOF_H_INCLUDED"; then + F77MPIOINC="" +else + F77MPIOINC="include 'mpiof.h'" +fi + + +for ac_header in unistd.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + { $as_echo "$as_me:$LINENO: checking for large file defines" >&5 +$as_echo_n "checking for large file defines... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + +int +main () +{ + + #ifndef _LFS64_LARGEFILE + #error no largefile defines + #endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: none" >&5 +$as_echo "none" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + +done + + + +# for BlueGene, this routine helps us know how much memory is left, and if we +# need to fall back to less memory-intensive algorithms + +for ac_header in spi/kernel_interface.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in Kernel_GetMemorySize +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +echo "setting SYSDEP_INC to $SYSDEP_INC" + + +{ $as_echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5 +$as_echo_n "checking for C/C++ restrict keyword... " >&6; } +if test "${ac_cv_c_restrict+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_restrict=no + # The order here caters to the fact that C++ does not require restrict. + for ac_kw in __restrict __restrict__ _Restrict restrict; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +typedef int * int_ptr; + int foo (int_ptr $ac_kw ip) { + return ip[0]; + } +int +main () +{ +int s[1]; + int * $ac_kw t = s; + t[0] = 0; + return foo(t) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_restrict=$ac_kw +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_restrict" != no && break + done + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_restrict" >&5 +$as_echo "$ac_cv_c_restrict" >&6; } + + + case $ac_cv_c_restrict in + restrict) ;; + no) cat >>confdefs.h <<\_ACEOF +#define restrict /**/ +_ACEOF + ;; + *) cat >>confdefs.h <<_ACEOF +#define restrict $ac_cv_c_restrict +_ACEOF + ;; + esac + + + + +if test "$ac_cv_c_compiler_gnu" = "yes" ; then + { $as_echo "$as_me:$LINENO: checking whether __attribute__ allowed" >&5 +$as_echo_n "checking whether __attribute__ allowed... " >&6; } +if test "${pac_cv_gnu_attr_pure+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int foo(int) __attribute__ ((pure)); +int +main () +{ +int a; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_gnu_attr_pure=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_gnu_attr_pure=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_gnu_attr_pure" >&5 +$as_echo "$pac_cv_gnu_attr_pure" >&6; } +{ $as_echo "$as_me:$LINENO: checking whether __attribute__((format)) allowed" >&5 +$as_echo_n "checking whether __attribute__((format)) allowed... " >&6; } +if test "${pac_cv_gnu_attr_format+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int foo(char *,...) __attribute__ ((format(printf,1,2))); +int +main () +{ +int a; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + pac_cv_gnu_attr_format=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pac_cv_gnu_attr_format=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pac_cv_gnu_attr_format" >&5 +$as_echo "$pac_cv_gnu_attr_format" >&6; } + if test "$pac_cv_gnu_attr_pure" = "yes" -a "$pac_cv_gnu_attr_format" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GCC_ATTRIBUTE 1 +_ACEOF + + fi +fi + + +echo "setting CC to $CC" +echo "setting F77 to $F77" +echo "setting TEST_CC to $TEST_CC" +echo "setting TEST_F77 to $TEST_F77" +echo "setting CFLAGS to $CFLAGS" +echo "setting USER_CFLAGS to $USER_CFLAGS" +echo "setting USER_FFLAGS to $USER_FFLAGS" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +if test -z "$ENABLE_SHLIB" ; then + ENABLE_SHLIB=none +fi + + + +# Remove the .a from the library file name (so that we can use .so or +# other appropriate suffix) +SHLIBNAME=`echo $LIBNAME | sed 's/\.a$//'` + +if test ! -d adio ; then mkdir adio ; fi +if test ! -d adio/include ; then mkdir adio/include ; fi +if test ! -d mpi2-other ; then mkdir mpi2-other ; fi +if test ! -d mpi-io ; then mkdir mpi-io ; fi +if test ! -d mpi-io/glue ; then mkdir mpi-io/glue ; fi +# +# Make sure we remove any configuration file incase there is out-of-date data. +# We remove the version in include in case this is a vpath build +rm -f adio/include/romioconf.h ${use_top_srcdir}/src/mpi/romio/adio/include/romioconf.h ${use_top_srcdir}/adio/include/romioconf.h +# +# Create makefiles for all of the adio devices. Only the ones that +# are active will be called by the top level ROMIO make +ac_config_commands="$ac_config_commands default-1" + +ac_config_files="$ac_config_files Makefile localdefs mpi-io/Makefile mpi2-other/info/Makefile mpi2-other/array/Makefile adio/common/Makefile test/Makefile test/misc.c test/large_file.c test/runtests test-internal/Makefile util/romioinstall include/mpio.h include/mpiof.h adio/ad_nfs/Makefile adio/ad_ufs/Makefile adio/ad_bgl/Makefile adio/ad_bglockless/Makefile adio/ad_panfs/Makefile adio/ad_xfs/Makefile adio/ad_sfs/Makefile adio/ad_pfs/Makefile adio/ad_testfs/Makefile adio/ad_pvfs/Makefile adio/ad_pvfs2/Makefile adio/ad_gridftp/Makefile adio/ad_lustre/Makefile adio/ad_zoidfs/Makefile mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile mpi2-other/array/fortran/Makefile test/fmisc.f test/fcoll_test.f test/pfcoll_test.f test/fperf.f mpi-io/glue/mpich2/Makefile mpi-io/glue/mpich1/Makefile mpi-io/glue/default/Makefile common/dataloop/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.63. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTION]... [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.63, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2008 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { $as_echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { $as_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "adio/include/romioconf.h") CONFIG_HEADERS="$CONFIG_HEADERS adio/include/romioconf.h" ;; + "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "localdefs") CONFIG_FILES="$CONFIG_FILES localdefs" ;; + "mpi-io/Makefile") CONFIG_FILES="$CONFIG_FILES mpi-io/Makefile" ;; + "mpi2-other/info/Makefile") CONFIG_FILES="$CONFIG_FILES mpi2-other/info/Makefile" ;; + "mpi2-other/array/Makefile") CONFIG_FILES="$CONFIG_FILES mpi2-other/array/Makefile" ;; + "adio/common/Makefile") CONFIG_FILES="$CONFIG_FILES adio/common/Makefile" ;; + "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; + "test/misc.c") CONFIG_FILES="$CONFIG_FILES test/misc.c" ;; + "test/large_file.c") CONFIG_FILES="$CONFIG_FILES test/large_file.c" ;; + "test/runtests") CONFIG_FILES="$CONFIG_FILES test/runtests" ;; + "test-internal/Makefile") CONFIG_FILES="$CONFIG_FILES test-internal/Makefile" ;; + "util/romioinstall") CONFIG_FILES="$CONFIG_FILES util/romioinstall" ;; + "include/mpio.h") CONFIG_FILES="$CONFIG_FILES include/mpio.h" ;; + "include/mpiof.h") CONFIG_FILES="$CONFIG_FILES include/mpiof.h" ;; + "adio/ad_nfs/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_nfs/Makefile" ;; + "adio/ad_ufs/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_ufs/Makefile" ;; + "adio/ad_bgl/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_bgl/Makefile" ;; + "adio/ad_bglockless/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_bglockless/Makefile" ;; + "adio/ad_panfs/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_panfs/Makefile" ;; + "adio/ad_xfs/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_xfs/Makefile" ;; + "adio/ad_sfs/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_sfs/Makefile" ;; + "adio/ad_pfs/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_pfs/Makefile" ;; + "adio/ad_testfs/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_testfs/Makefile" ;; + "adio/ad_pvfs/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_pvfs/Makefile" ;; + "adio/ad_pvfs2/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_pvfs2/Makefile" ;; + "adio/ad_gridftp/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_gridftp/Makefile" ;; + "adio/ad_lustre/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_lustre/Makefile" ;; + "adio/ad_zoidfs/Makefile") CONFIG_FILES="$CONFIG_FILES adio/ad_zoidfs/Makefile" ;; + "mpi-io/fortran/Makefile") CONFIG_FILES="$CONFIG_FILES mpi-io/fortran/Makefile" ;; + "mpi2-other/info/fortran/Makefile") CONFIG_FILES="$CONFIG_FILES mpi2-other/info/fortran/Makefile" ;; + "mpi2-other/array/fortran/Makefile") CONFIG_FILES="$CONFIG_FILES mpi2-other/array/fortran/Makefile" ;; + "test/fmisc.f") CONFIG_FILES="$CONFIG_FILES test/fmisc.f" ;; + "test/fcoll_test.f") CONFIG_FILES="$CONFIG_FILES test/fcoll_test.f" ;; + "test/pfcoll_test.f") CONFIG_FILES="$CONFIG_FILES test/pfcoll_test.f" ;; + "test/fperf.f") CONFIG_FILES="$CONFIG_FILES test/fperf.f" ;; + "mpi-io/glue/mpich2/Makefile") CONFIG_FILES="$CONFIG_FILES mpi-io/glue/mpich2/Makefile" ;; + "mpi-io/glue/mpich1/Makefile") CONFIG_FILES="$CONFIG_FILES mpi-io/glue/mpich1/Makefile" ;; + "mpi-io/glue/default/Makefile") CONFIG_FILES="$CONFIG_FILES mpi-io/glue/default/Makefile" ;; + "common/dataloop/Makefile") CONFIG_FILES="$CONFIG_FILES common/dataloop/Makefile" ;; + + *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + $as_echo "$as_me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=' +' +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\).*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\).*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 +$as_echo "$as_me: error: could not setup config files machinery" >&2;} + { (exit 1); exit 1; }; } +_ACEOF + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 +$as_echo "$as_me: error: could not setup config headers machinery" >&2;} + { (exit 1); exit 1; }; } +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 +$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + ac_file_inputs="$ac_file_inputs '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 +$as_echo "$as_me: error: could not create -" >&2;} + { (exit 1); exit 1; }; } + fi + ;; + + :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "default-1":C) chmod 755 util/romioinstall test/runtests ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +# +rm -f *.o + +if test $FROM_MPICH = no -a $FROM_MPICH2 = no ; then + { $as_echo "$as_me:$LINENO: result: Configure done. Now type make." >&5 +$as_echo "Configure done. Now type make." >&6; } +fi +exit 0 diff --git a/src/libs/ck-libs/ampi/romio/configure.in b/src/libs/ck-libs/ampi/romio/configure.in dissimilarity index 64% index ad1493b890..9fc16f2434 100644 --- a/src/libs/ck-libs/ampi/romio/configure.in +++ b/src/libs/ck-libs/ampi/romio/configure.in @@ -1,1572 +1,2158 @@ -dnl This is an autoconf script. To rebuild the "configure" script -dnl from this, execute the command "autoconf" in the directory containing -dnl this script. You must have autoconf version 1.4 or later, -dnl but NOT version 2.0 or later -[#!/bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf. -# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -progname="`echo $0 | sed 's:^\./\./:\./:'`" -print_error() { - echo "*# $*" 2>&1 ; - } -usage_msg=" -Usage: ${progname} [-file_system=FILE_SYSTEM] [-arch=ARCH_TYPE] [-mpi=MPI_IMPL] - [-mpiincdir=MPI_INCLUDE_DIR] [-mpilib=MPI_LIBRARY] - [-mpibindir=MPI_BIN_DIR] - [-cc=C_COMPILER] [-fc=FORTRAN_COMPILER] [-nof77] - [-cflags=CFLAGS] [-fflags=FFLAGS] [-f90=F90_COMPILER] [-debug] - [-make=MAKEPGM] [-mpiolib=MPIO_LIBRARY] [-ar_nolocal] - [-noranlib] [-ar=AR_COMMAND] [-prefix=INSTALL_DIR] - [-intsize=INTSIZE] [-ptrsize=PTRSIZE] [-longsize=LONGSIZE] - [-longlongsize=LONGLONGSIZE] [-f90nag] [-disable-weak-symbols] - -where - FILE_SYSTEM = the file system(s) for which ROMIO is to be configured. - Valid values are pfs, piofs, hfs, xfs, sfs, pvfs, ufs, - and nfs (case-sensitive). They correspond to Intel's PFS, - IBM's PIOFS, HP/Convex's HFS, SGI's XFS, NEC's SFS, - Clemson University's PVFS (for Linux clusters), any Unix - file system, and NFS. - To configure for multiple file systems, use "+" as a - separator; e.g., ufs+nfs - ARCH_TYPE = the type of machine for which ROMIO is to be configured. - Not needed on most machines, because ROMIO can usually - find the arch_type on its own. Needed if you are - cross-compiling for a different architecture. - Valid values are sun4, solaris, solaris86, rs6000, - paragon, hpux, sppux, IRIX, IRIX32, IRIXN32, IRIX64, SX4, - alpha, freebsd, LINUX, and LINUX_ALPHA. (case-sensitive) - MPI_IMPL = the MPI implementation with which ROMIO will be used - Valid values are mpich, sgi, hp. (case-sensitive) - Valid implementations are MPICH 1.1.1 or higher, - SGI's MPI 3.1 or higher, HP MPI 1.3 or higher, LAM, - and Cray MPI. - MPI_INCLUDE_DIR = the full path of the directory where mpi.h is located. - Not needed if the directory is in the compiler's - default include path - MPI_LIBRARY = name of the file containing the MPI library (full path). - Not needed if the library is in the compiler's default - list of libraries - MPI_BIN_DIR = the full path of the directory that contains the MPI - versions of the compilers, such as mpicc and mpif77. - Use only if the ROMIO configure cannot find the - necessary commands - C_COMPILER = the C compiler to use. If not specified, ROMIO uses a - default compiler depending on the machine. - FORTRAN_COMPILER = the Fortran compiler to use. If not specified, ROMIO - uses a default compiler depending on the machine. - CFLAGS = flags to give to the C compiler - FFLAGS = flags to give to the Fortran compiler - F90_COMPILER = the Fortran 90 compiler to use. If not specified, - ROMIO uses f90. - MPIO_LIBRARY = name of the MPI-IO library to be built (full path). - Default is "this_directory"/lib/ARCH_TYPE/libmpio.a. - MAKEPGM = name of the make program to use - AR_COMMAND = an alternate archiver (ar) command to use. - INSTALL_DIR = directory where ROMIO is to be installed - INTSIZE = size of int in bytes. - PTRSIZE = size of pointers in bytes. - LONGSIZE = size of long in bytes. - LONGLONGSIZE = size of long long in bytes. - -The options '-mpiincdir' and '-mpilib' may be needed if the MPI include file -and MPI library are not in the compiler's default path. - -The option '-nof77' prevents the compilation of routines that require a -Fortran compiler. If you select this option, you cannot use the -Fortran interface of MPI-IO. - -The option '-f90nag' allows you to use the NAG Fortran 90 compiler -instead of Fortran 77. - -The option '-make' may be used to select an alternate make program. ROMIO -uses "make" by default. - -If '-debug' is used, ROMIO will be configured with the '-g' compiler option -for debugging. - -The option '-ar_nolocal' prevents the library archive command from -attempting to use the local directory for temporary space. This option -should be used when (a) there isn't much space (less than 10 MB) -available in the partition where ROMIO resides and (b) there is enough -space in /tmp (or wherever ar places temporary files by default). - -The option '-noranlib' causes the 'ranlib' step (needed on some systems -to build an object library) to be skipped. This is particularly useful -on systems where 'ranlib' is optional (allowed but not needed; because it -is allowed, configure chooses to use it just in case) but can fail (some -'ranlib's are implemented as scripts using 'ar'; if they don't use the -local directory, they can fail (destroying the library in the process) if -the temporary directory (usually '/tmp') does not have enough space. - -The option -disable-weak-symbols disables the use of weak symbols, even if -available, for building the profiling interface. -" -# -echo " " -echo "Configuring ROMIO Version 1.2.3" -echo " " -CONFIGURE_ARGS="$*" -if test -n "$CONFIGURE_ARGS" ; then - echo "Configuring with args $CONFIGURE_ARGS" -fi -# -# rm -f include/*.h -# -NOF77=0 -ARCH="" -arch_IRIX="" -MPI="" -MPI_INCLUDE_DIR="" -ROMIO_INCLUDE="" -MPI_LIB="" -LIBNAME="" -TEST_LIBNAME="" -FILE_SYSTEM="" -PREFIX="" -DEBUG=no -MIPS=0 -BITS=0 -FROM_MPICH=0 -CFLAGS=${CFLAGS:-""} -LL="\%lld" -AR_LOCAL=l -HAVE_MPI_INFO="" -BUILD_MPI_INFO="" -MPI_FINFO1="" -MPI_FINFO2="" -MPI_FINFO3="" -MPI_FINFO4="" -MPI_FARRAY1="" -MPI_FARRAY2="" -MPI_FARRAY3="" -MPI_FARRAY4="" -MPI_FARRAY5="" -MPI_FARRAY6="" -MPI_FARRAY7="" -DEFS="" -ROMIO_LFLAGS="" -ROMIO_LIBLIST="" -ROMIO_TCFLAGS="" -ROMIO_TCPPFLAGS="" -ROMIO_TFFLAGS="" -NOPROFILE=0 -MPIRUN="" -FORTRAN_TEST="" -MAKE=${MAKE:-"make"} -# foll. needed for f77 test programs -F77GETARG="call getarg(i,str)" -F77IARGC="iargc()" -FTESTDEFINE="" -FORTRAN_MPI_OFFSET="" -MPIOF_H_INCLUDED=0 -MPI_OFFSET_KIND1="!" -MPI_OFFSET_KIND2="!" -F90="" -TEST_CC="" -TEST_F77="" -TRY_WEAK_SYMBOLS=1 -# -known_filesystems="nfs ufs pfs piofs pvfs testfs xfs hfs sfs" -known_mpi_impls="mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi" -# -# Defaults -enable_aio=notgiven -# -for arg -do -case $arg in - -arch=* | --arch=*) - ARCH=`echo $arg|sed 's/-*arch=//'` - eval "arch_`echo $ARCH`=1" - ;; - - -with-file-system=* | --with-file-system=* ) - FILE_SYSTEM=`echo $arg|sed 's/-*with-file-system=//' | sed -e 's/\+/ /g'` - for x in $FILE_SYSTEM - do - eval "file_system_`echo $x`=1" - done - ;; - -file_system=* | --file_system=* ) - # DEPRECATED FORMAT - FILE_SYSTEM=`echo $arg|sed 's/-*file_system=//' | sed -e 's/\+/ /g'` - for x in $FILE_SYSTEM - do - eval "file_system_`echo $x`=1" - done - ;; - - --enable-aio | -enable-aio) - enable_aio=yes - ;; - --disable-aio | -disable-aio) - enable_aio=no - ;; - -with-mpi=* | --with-mpi=*) - MPI=`echo $arg|sed 's/-*with-mpi=//'` - eval "mpi_`echo $MPI`=1" - ;; - -mpi=* | --mpi=*) - # DEPRECATED FORMAT - MPI=`echo $arg|sed 's/-*mpi=//'` - eval "mpi_`echo $MPI`=1" - ;; - # OTHER ARGS ARE DEPRECATED AND SHOULD BE PROVIDED THROUGH ENV VARIABLES - -mpiincdir=* | --mpiincdir=*) - MPI_INCLUDE_DIR=`echo $arg|sed 's/-*mpiincdir=//'` - ;; - -mpibindir=* | --mpibindir=*) - MPI_BIN_DIR=`echo $arg|sed 's/-*mpibindir=//'` - ;; - -mpilib=* | --mpilib=*) - MPI_LIB=`echo $arg|sed 's/-*mpilib=//'` - ;; - -mpiolib=* | --mpiolib=*) - LIBNAME=`echo $arg|sed 's/-*mpiolib=//'` - ;; - - # THE FOLLOWING SHOULD BE PROVIDED THROUGH ENV VARIABLES - -cc=* | --cc=*) - CC=`echo $arg|sed 's/-*cc=//'` - ;; - -fc=* | --fc=*) - FC=`echo $arg|sed 's/-*fc=//'` - ;; - -f90=* | --f90=*) - F90=`echo A$arg|sed 's/A-*f90=//'` - ;; - -f90nag | --f90nag) - FC=f90 - F77GETARG="call f90_unix_MP_getarg(i,str)" - F77IARGC="f90_unix_MP_iargc()" - ;; - -cflags=* | --cflags=*) - package="`echo $arg|sed 's/-*cflags=//'`" - USER_CFLAGS="$package" - CFLAGS="$package $CFLAGS" - ;; - -fflags=* | --fflags=*) - package="`echo $arg|sed 's/-*fflags=//'`" - FFLAGS="$FFLAGS $package" - ;; - -make=* | --make=*) - package=`echo $arg|sed 's/-*make=//'` - MAKE="$package" - ;; - # END OF VALUES THAT SHOULD BE PROVIDED THROUGH ENV VARIABLES - - -nof77 | --nof77 | -disable-f77 | --disable-f77 ) - echo "Fortran interface will not be built" - NOF77=1 - ;; - - -debug | --debug | --enable-g | -enable-g) - echo "Configuring for a debugging version" - DEBUG=yes - ;; - -ar_nolocal | --ar_nolocal) - AR_LOCAL='' - ;; - -noranlib | --noranlib) - RANLIB=':' - ;; - - -prefix=* | --prefix=*) - PREFIX=`echo $arg|sed 's/-*prefix=//'` - # Use new variable name for prefix - prefix=$PREFIX - ;; - - -from_mpich | --from_mpich) - FROM_MPICH=1 - ;; - - -ar=* | --ar=*) - package=`echo $arg|sed 's/-*ar=//'` - AR="$package" - ;; - - # THESE SHOULD USE CROSS_SIZE_XXX - -intsize=* | --intsize=*) - package=`echo $arg|sed 's/-*intsize=//'` - intsize="$package" - ;; - -ptrsize=* | --ptrsize=*) - package=`echo $arg|sed 's/-*ptrsize=//'` - pointersize="$package" - ;; - -longsize=* | --longsize=*) - package=`echo $arg|sed 's/-*longsize=//'` - longsize="$package" - ;; - -longlongsize=* | --longlongsize=*) - package=`echo $arg|sed 's/-*longlongsize=//'` - longlongsize="$package" - ;; - # END OF VARIABLE SIZES - - -noprofile | --noprofile | --disable-profile | -disable-profile ) - echo "profiling interface will not be built" - NOPROFILE=1 - ;; - - -echo | --enable-echo | -enable-echo ) - set -x - ;; - -disable-weak-symbols|--disable-weak-symbols) - TRY_WEAK_SYMBOLS=0 - ;; - -enable-* | --enable-* | -disable-* | --disable-* ) - # ignore - ;; - -with-* | --with-* | -without-* | --without-* ) - # ignore - ;; - -h | -help | --h | --help | -u | --u) - (echo "${usage_msg}") >& 2 - exit 1 ;; - *) - if test -n "$arg" ; then - echo "Error: Invalid configure option $arg" - exit 1; - fi - ;; -esac -done -] -# -rm -f config.log -AC_PREPARE() -# -dnl -dnl Place the definitions into a configuration file, rather than sedding -dnl them into Makefiles. If you wish to force the definitions into -dnl the Makefiles, comment out this line (with dnl!). You will also need to -dnl remove the dnl from CFLAGS="$CFLAGS $DEFS" near the end of the file and -dnl comment out the line that follows it (CFLAGS="$CFLAGS -DHAVE_ROMIOCONF_H"). -dnl -AC_CONFIG_HEADER(adio/include/romioconf.h) -# -PAC_FIXUP_SRCDIR -# Get top_srcdir -if test -z "$top_srcdir" ; then - top_srcdir=$srcdir -fi -# -PAC_MAKE_VPATH -# -# Check that an arch was set -# If it wasn't set, try to guess using "util/tarch" -# -if test -z "$ARCH" -a -x $srcdir/util/tarch ; then - AC_MSG_CHECKING(for architecture) - ARCH=`$srcdir/util/tarch | sed s/-/_/g` - if test -z "$ARCH" ; then - AC_MSG_RESULT(Unknown!) - print_error "Error: Couldn't guess target architecture, you must" - print_error " set an architecture type with -arch=" - exit 1 - fi - eval "arch_$ARCH=1" - AC_MSG_RESULT($ARCH) -fi -# -# check for valid architecture. Use __ so that _ALPHA_ does not match -# LINUX_ALPHA_ -#### WE SHOULD REMOVE THIS SOON -grep __"$ARCH"_ $srcdir/.config_params > /dev/null 2>&1 -if test $? != 0 ; then - echo "Unknown architecture $arch... proceeding anyway" -fi -# -# -# -# Find the home directory if not specified -if test "X$srcdir" != "X." -a -s $srcdir/mpi-io/Makefile.in ; then - ROMIO_HOME_TRIAL=$srcdir -else - PAC_GETWD(ROMIO_HOME_TRIAL,mpi-io/Makefile.in) -fi -echo "ROMIO home directory is $ROMIO_HOME_TRIAL" -ROMIO_HOME=$ROMIO_HOME_TRIAL -# -# Create the "autoconf" style directory names... -# -if test -z "$prefix" ; then prefix=$PREFIX ; fi -if test -z "$prefix" ; then - prefix=$ROMIO_HOME -fi -AC_SUBST(prefix) -if test -z "$exec_prefix" ; then exec_prefix='${prefix}' ; fi -# exec_prefix is the prefix for directories containing machine-specific -# files such as libraries and executables. For the USER -AC_SUBST(exec_prefix) -includedir="${prefix}/include" -AC_SUBST(includedir) -# bindir is for executable programs for the USER -if test -z "$bindir" ; then bindir='${exec_prefix}/bin' ; fi -AC_SUBST(bindir) -# sbindir is for executable programs for the ADMINISTRATOR -if test -z "$sbindir" ; then sbindir='${exec_prefix}/sbin' ; fi -AC_SUBST(sbindir) -# libdir is for libraries for the USER -if test -z "$libdir" ; then libdir='${exec_prefix}/lib' ; fi -AC_SUBST(libdir) -# mandir is the root for the man pages -if test -z "$mandir" ; then mandir='${prefix}/man' ; fi -AC_SUBST(mandir) -if test -z "$docdir" ; then docdir='${prefix}/doc' ; fi -AC_SUBST(docdir) -if test -z "$htmldir" ; then htmldir='${prefix}/www' ; fi -AC_SUBST(htmldir) -# -# check for valid file system -if test -n "$FILE_SYSTEM" ; then - for x in $FILE_SYSTEM - do - found=no - for y in $known_filesystems ; do - if test $x = $y ; then - found=yes - break - fi - done - if test "$found" = "no" ; then - echo "Unknown file system $x... proceeding anyway" - fi - done -fi -# -# check for valid MPI implementation -if test -n "$MPI" ; then - found=no - for mpi in $known_mpi_impls ; do - if test "${MPI}_mpi" = "$mpi" ; then - found=yes - break - fi - done - if test $found = no ; then - echo "Unknown MPI implementation $MPI... proceeding anyway" - fi -fi -# -# check for valid MPI include directory if specified -if test $FROM_MPICH = 0 ; then - if test -n "$MPI_INCLUDE_DIR"; then - if test ! -f "$MPI_INCLUDE_DIR/mpi.h" ; then - echo "Error: Include file $MPI_INCLUDE_DIR/mpi.h not found" - exit 1 - fi - else -# assume that mpi.h is in the default path -# set MPI_INCLUDE_DIR to ".", so that it translates to -I. in the -# compile command. Some compilers complain if it's only -I - MPI_INCLUDE_DIR=. - fi -fi -# -# check for valid MPI library if specified -if test $FROM_MPICH = 0 ; then - if test -n "$MPI_LIB" ; then - if test ! -f "$MPI_LIB" ; then - echo "Error: MPI library $MPI_LIB not found" - exit 1 - fi - fi -fi -# -# -AR="${AR:-ar} cr$AR_LOCAL" -if test -z "$RANLIB" ; then - AC_PROG_RANLIB -fi -MAKE=${MAKE:-make} -# -# USER_CFLAGS and USER_FFLAGS are used only in test/Makefile.in -if test $DEBUG = "yes"; then - USER_CFLAGS="$CFLAGS -g" - USER_FFLAGS="$FFLAGS -g" -else - USER_CFLAGS="$CFLAGS -O" - USER_FFLAGS="$FFLAGS -O" -fi -# -if test -n "$arch_sun4" ; then - CC=${CC:-gcc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - if test "$CC" = "gcc"; then - dnl CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -DAIO_SUN" - CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" - else - dnl CFLAGS="$CFLAGS -g -DAIO_SUN" - CFLAGS="$CFLAGS -g" - fi - else - dnl CFLAGS="$CFLAGS -O -DAIO_SUN" - CFLAGS="$CFLAGS -O" - fi - if test "$enable_aio" = "no" ; then - AC_DEFINE(NO_AIO) - else - AC_DEFINE(AIO_SUN) - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi -fi -# -if test -n "$arch_solaris" || test -n "$arch_solaris86" ; then - CC=${CC:-cc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - if test "$CC" = "gcc" ; then - dnl CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -DAIO_SUN" - CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" - else - dnl CFLAGS="$CFLAGS -g -v -DAIO_SUN" - CFLAGS="$CFLAGS -g -v" - fi - else - dnl CFLAGS="$CFLAGS -O -DAIO_SUN" - CFLAGS="$CFLAGS -O" - fi - if test "$enable_aio" = "no" ; then - AC_DEFINE(NO_AIO) - else - AC_DEFINE(AIO_SUN) - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi - dnl CFLAGS="$CFLAGS -DSOLARIS" - AC_DEFINE(SOLARIS) - if test $MPI = "mpich" ; then - TEST_CC=mpicc - TEST_F77=mpif77 - else - TEST_CC="$CC" - TEST_F77="$F77" - fi - if test "$enable_aio" != "no" ; then - MPI_LIB="$MPI_LIB -laio" - ROMIO_LIBLIST="-laio" - fi - AR="ar cr" -# solaris does not have l option to ar -# solaris f90 does not have 8-byte integer type -# (it does now!!!! 11/29/01) -fi -# -if test -n "$arch_rs6000"; then - F77=$FC - if test -z "$CC"; then - AC_PROGRAMS_CHECK(CC, mpcc, cc) - echo "Using $CC" - fi - if test $NOF77 = 0 && test -z "$FC"; then - AC_PROGRAMS_CHECK(F77, mpxlf, f77) - echo "Using $F77" - fi - if test $DEBUG = "yes"; then - dnl CFLAGS="$CFLAGS -g -DNO_FD_IN_AIOCB -DAIO_HANDLE_IN_AIOCB" - CFLAGS="$CFLAGS -g" - else - dnl CFLAGS="$CFLAGS -O -DNO_FD_IN_AIOCB -DAIO_HANDLE_IN_AIOCB" - CFLAGS="$CFLAGS -O" - fi - # Check that aio is available (many systems appear to have aio - # either installed improperly or turned off). - # The test is the following: if not cross compiling, try to run a - # program that includes a *reference* to aio_write but does not call it - # If the libraries are not set up correctly, then this will fail. - AC_MSG_CHECKING([whether aio routines can be used]) - AC_TEST_PROGRAM([ -int main( int argc, char **argv ) -{ - if (argc > 10) aio_write(); - return 0; -} -],aio_runs=yes,aio_runs=no,aio_runs=unknown); - AC_MSG_RESULT($aio_runs) - if test "$enable_aio" != "no" -a "$aio_runs" = "no" ; then - enable_aio=no - fi - if test "$enable_aio" = "no" ; then - AC_DEFINE(NO_AIO) - else - AC_DEFINE(NO_FD_IN_AIOCB) - AC_DEFINE(AIO_HANDLE_IN_AIOCB) - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - if test "$CC" = "mpcc" || test "$CC" = "mpCC" ; then - file_system_piofs=1 - FILE_SYSTEM="piofs" - echo "configuring for file systems piofs, ufs, and nfs" - else - echo "configuring for file systems ufs and nfs" - fi - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="$FILE_SYSTEM ufs nfs" - fi - dnl CFLAGS="$CFLAGS -DAIX" - AC_DEFINE(AIX) -# assume long long exists. - longlongsize=${longlongsize:-8} - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" -fi -# -if test -n "$arch_paragon"; then - CC=${CC:-icc} - F77=${FC:-if77} - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g" - else - if test "$CC" = "icc"; then - CFLAGS="$CFLAGS -Knoieee -Mvect -O3" - else - CFLAGS="$CFLAGS -O" - fi - fi - AR="ar860 cr$AR_LOCAL" - MPI_LIB="$MPI_LIB -nx" - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_pfs=1 - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="pfs ufs nfs" - echo "configuring for file systems pfs, ufs, and nfs" - fi - dnl CFLAGS="$CFLAGS -DPARAGON -DNO_AIO" - AC_DEFINE(PARAGON) - AC_DEFINE(NO_AIO) -# NO_AIO is if configuring for NFS/UFS. It doesn't affect PFS asynch. I/O. -# long long does not exist - longlongsize=${longlongsize:-0} -fi -# -if test -n "$arch_tflop" || test -n "$arch_tflops"; then - CC=${CC:-pgcc} - F77=${FC:-pgf77} - dnl TFLOP_FLAGS="-cougar -D__PUMA -DNO_AIO" - TFLOP_FLAGS="-cougar -D__PUMA" - AC_DEFINE(NO_AIO) - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g $TFLOP_FLAGS" - else - if test "$CC" = "pgcc"; then - CFLAGS="$CFLAGS -Knoieee -Mvect -O3 $TFLOP_FLAGS" - else - CFLAGS="$CFLAGS -O $TFLOP_FLAGS" - fi - fi - AR="xar cr$AR_LOCAL" - RANLIB="xranlib" - MPI_LIB="$MPI_LIB" - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - FILE_SYSTEM="ufs" - echo "configuring for file system ufs" - fi -fi -# -if test -n "$arch_freebsd" || test -n "$arch_LINUX" || test -n "$arch_LINUX_ALPHA" || test -n "$arch_netbsd" || test -n "$arch_openbsd" ; then - CC=${CC:-gcc} - if test -n "$arch_freebsd" || test -n "$arch_netbsd" || test -n "$arch_openbsd"; then - F77=${FC:-f77} - dnl CFLAGS="$CFLAGS -DFREEBSD" - AC_DEFINE(FREEBSD) - PAC_HAVE_MOUNT_NFS - longlongsize=${longlongsize:-0} -# printf doesn't work properly and no integer*8 as far as I can tell - else - F77=${FC:-g77} - dnl CFLAGS="$CFLAGS -DLINUX" - AC_DEFINE(LINUX) - fi - if test $DEBUG = "yes" ; then - if test "$CC" = "gcc" ; then - dnl CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -DNO_AIO" - CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" - else - dnl CFLAGS="$CFLAGS -g -DNO_AIO" - CFLAGS="$CFLAGS -g" - fi - else - dnl CFLAGS="$CFLAGS -O -DNO_AIO" - CFLAGS="$CFLAGS -O" - fi - if test "$enable_aio" != "yes" ; then - AC_DEFINE(NO_AIO) - else - # Try to find the aio routines - use_aio=no - AC_HEADER_CHECK(aio.h,has_aio_h=yes,has_aio_h=no) - dnl AC_CHECK_LIB(aio,aio_write,has_aio_write=yes,has_aio_write=no) - add_lib="" - AC_HAVE_LIBRARY(aio,add_lib="-laio") - AC_HAVE_LIBRARY(rt,add_lib="$add_lib -lrt") - AC_HAVE_LIBRARY(pthread,[add_lib="$add_lib -lpthread" -has_pthread=yes],[has_pthread=no]) - AC_FUNC_CHECK(aio_write,has_aio_write=yes,has_aio_write=no) - if test "$has_aio_h" = "yes" -a "$has_aio_write" = "yes" -a \ - "$has_pthread" = "yes" ; then - use_aio=yes - fi - # Check for aiocb_t as a shorthand for struct aiocb - AC_COMPILE_CHECK([for aiocb_t], -[#include ], -[aiocb_t a;],has_aiocb_t=yes,has_aiocb_t=no) - if test "$has_aiocb_t" = "no" ; then - AC_DEFINE(NEEDS_AIOCB_T) - fi - if test "$use_aio" = "yes" ; then - MPI_LIB="$MPI_LIB $add_lib" - ROMIO_LIBLIST="$ROMIO_LIBLIST $add_lib" - else - AC_DEFINE(NO_AIO) - fi - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi -fi -# -if test -n "$arch_SX4" ; then - CC=${CC:-mpicc} - F77=${FC:-mpif90} - if test $DEBUG = "yes" ; then - dnl CFLAGS="$CFLAGS -g -DNO_AIO -DSX4" - CFLAGS="$CFLAGS -g" - FFLAGS="$FFLAGS -g" - else - USER_FFLAGS="$FFLAGS -Chopt" - dnl CFLAGS="$CFLAGS -O -DNO_AIO -DSX4" - CFLAGS="$CFLAGS -O" - FFLAGS="$FFLAGS -Chopt" - fi - AC_DEFINE(NO_AIO) - AC_DEFINE(SX4) - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_sfs=1 - file_system_nfs=1 - FILE_SYSTEM="sfs nfs" - echo "configuring for file systems sfs and nfs" - fi - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" -fi -# -if test -n "$arch_hpux" || test -n "$arch_sppux" ; then - if test $DEBUG = "yes"; then - dnl CFLAGS="$CFLAGS -g +w1 -DNO_AIO" - CFLAGS="$CFLAGS -g +w1" - else - dnl CFLAGS="$CFLAGS -O -DNO_AIO" - CFLAGS="$CFLAGS -O" - fi - AC_DEFINE(NO_AIO) - RANLIB=":" - if test -z "$MPI"; then - if test -f "/opt/mpi/include/mpi.h" ; then - echo "assuming that you want to use ROMIO with HP MPI" - MPI=hp - else - echo "assuming that you want to use ROMIO with MPICH" - MPI=mpich - fi - fi - if test $MPI = "mpich" ; then - mpi_mpich=1 - MPI_LIB="$MPI_LIB -lV3" - CC=${CC:-cc -Ae} - F77=${FC:-f77 +U77} - fi - if test $MPI = "hp" ; then - mpi_hp=1 - CC=${CC:-mpicc -Ae} - F77=${FC:-mpif77 +U77} - fi - if test $MPI = "lam" && test "$FC" != ""; then - FC="$FC +U77" - fi - FTESTDEFINE="external iargc, getarg" - if test -n "$arch_hpux" ; then - dnl CFLAGS="$CFLAGS -DHPUX -D_LARGEFILE64_SOURCE" - CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" - AC_DEFINE(HPUX) - if test $MPI = "hp" ; then - F77=${FC:-mpif90 +U77} - else - F77=${FC:-f90 +U77} - fi - else - dnl CFLAGS="$CFLAGS -DSPPUX" - AC_DEFINE(SPPUX) - fi - if test -z "$FILE_SYSTEM" ; then - if test -n "$arch_hpux" ; then - AC_COMPILE_CHECK(struct flock64,[#include ],[ -struct flock64 fl; int i=F_SETLKW64;],flock64_ok="yes",flock64_ok="no") - else - flock64_ok="yes" - fi - if test $flock64_ok = "yes" ; then - file_system_hfs=1 - file_system_nfs=1 - FILE_SYSTEM="hfs nfs" - echo "configuring for file systems hfs and nfs" - else - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "no flock64; configuring for file systems ufs and nfs" - fi - fi - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" - if test "$CC" != "gcc" ; then - ROMIO_TCFLAGS="-Ae" - fi - if test "$F77" != "g77" ; then - ROMIO_TFFLAGS="+U77" - fi -fi -# -if test -n "$arch_alpha" || test -n "$arch_ALPHA" ; then - CC=${CC:-cc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - dnl CFLAGS="$CFLAGS -g -std1 -warnprotos -verbose -DAIO_PRIORITY_DEFAULT" - CFLAGS="$CFLAGS -g -std1 -warnprotos -verbose" - else - dnl CFLAGS="$CFLAGS -O -DAIO_PRIORITY_DEFAULT" - CFLAGS="$CFLAGS -O" - fi - AC_DEFINE(AIO_PRIORITY_DEFAULT) - MPI_LIB="$MPI_LIB -laio" - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi - dnl CFLAGS="$CFLAGS -DDEC" - AC_DEFINE(DEC) - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" - ROMIO_LIBLIST="-laio" -fi -# -if test -n "$arch_CRAY" ; then - CC=${CC:-cc} - F77=${FC:-f90} - NOF77=1 - FTESTDEFINE="integer ilen" - F77GETARG="call pxfgetarg(i, str, ilen, ierr)" - if test $DEBUG = "yes"; then - dnl CFLAGS="$CFLAGS -g -DNO_AIO" - CFLAGS="$CFLAGS -g" - else - dnl CFLAGS="$CFLAGS -O -DNO_AIO" - CFLAGS="$CFLAGS -O" - fi - AC_DEFINE(NO_AIO) - RANLIB=":" - dnl CFLAGS="$CFLAGS -DCRAY -D_UNICOS" - CFLAGS="$CFLAGS -D_UNICOS" - AC_DEFINE(CRAY) - if test -z "$MPI" || test -n "$mpi_sgi" ; then - MPI=cray - mpi_cray=1 - mpi_sgi="" -# above is to disable configure tests specific to SGI MPI - dnl CFLAGS="$CFLAGS -DMPISGI -DHAVE_MPI_COMBINERS -DNO_MPI_SGI_type_is_contig" - AC_DEFINE(MPISGI) - AC_DEFINE(HAVE_MPI_COMBINERS) - AC_DEFINE(NO_MPI_SGI_type_is_contig) - fi -# MPISGI needed because of error in Cray's and SGI's -# MPI_Type_get_contents (does not increment reference count). -# Others needed because MPISGI needed. - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" - fi - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" -fi -# -if test -n "$arch_sgi" ; then - arch_IRIX=1 - ARCH=IRIX -fi -if test -n "$arch_IRIX64" ; then - arch_IRIX=1 -fi -if test -n "$arch_IRIX32" ; then - arch_IRIX=1 -fi -if test -n "$arch_IRIXN32" ; then - arch_IRIX=1 -fi -if test -n "$arch_sgi5" ; then - arch_IRIX5=1 - ARCH=IRIX -fi -# -PAC_GET_SPECIAL_SYSTEM_INFO -# -# special case 'sgi5' for use on MESHINE which is much like an SGI running -# irix 5 with r4400 chips, but does not have 'hinv', so above code doesn't -# work -if test -n "$arch_sgi5"; then - osversion=5 - cputype=4400 - IRIXARCH="$ARCH_$osversion" - IRIXARCH="$IRIXARCH_$cputype" -# now set arch_IRIX to 1 - arch_IRIX=1 - echo "IRIX-specific architecture is $IRIXARCH" - dnl CFLAGS="$CFLAGS -DIRIX" - AC_DEFINE(IRIX) -fi -# -if test -n "$arch_IRIX"; then - CC=${CC:-cc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g -fullwarn" - else - CFLAGS="$CFLAGS -O" - fi - if test $osversion = 4 ; then - RANLIB="ar ts" - if test -n "$mpi_sgi"; then - echo "Error: SGI's MPI doesn't work with IRIX 4.x" - exit 1 - fi - elif test $osversion = 5 ; then - if test -n "$mpi_sgi"; then - echo "Error: SGI's MPI doesn't work with IRIX 5.x" - exit 1 - fi - elif test $osversion = 6 ; then - if test -z "$MPI"; then - if test -f "/usr/include/mpi.h" ; then - echo "assuming that you want to use ROMIO with SGI's MPI" - MPI=sgi - mpi_sgi=1 - else - echo "assuming that you want to use ROMIO with MPICH" - MPI=mpich - mpi_mpich=1 - fi - fi - RANLIB=":" - dnl CFLAGS="$CFLAGS -DAIO_SIGNOTIFY_NONE" - AC_DEFINE(AIO_SIGNOTIFY_NONE) - if test $cputype -ge 5000 ; then - MIPS=4 - else - MIPS=3 - fi - fi - if test -n "$mpi_sgi" && test -z "$MPI_LIB" ; then - MPI_LIB="-lmpi" - fi -# check if pread64 is defined - PAC_HAVE_PREAD64 -# - if test -z "$FILE_SYSTEM" ; then - file_system_nfs=1 - FILE_SYSTEM="nfs" - AC_MSG_CHECKING(for xfs) - AC_COMPILE_CHECK(,[ -#include ], -[aiocb64_t *t1;],file_system_xfs=1;FILE_SYSTEM="xfs $FILE_SYSTEM";) - if test "$file_system_xfs" = 1 ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - file_system_ufs=1 - FILE_SYSTEM="ufs $FILE_SYSTEM" - fi - echo "configuring for file systems $FILE_SYSTEM" - fi - dnl CFLAGS="$CFLAGS -DIRIX" - AC_DEFINE(IRIX) - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" -fi -dnl -dnl - -AC_HAVE_FUNCS(memalign) -PAC_TEST_MPIR_STATUS_SET_BYTES - -if test $NOF77 = 0 ; then - echo "checking Fortran external names" - PAC_GET_FORTNAMES - if test -n "$WDEF" ; then - CFLAGS="$CFLAGS $WDEF" - fi - rm -f test/mpif.h - if test "$MPI_INCLUDE_DIR" != "." && test $FROM_MPICH = 0 ; then - if test ! -d test ; then mkdir test ; fi - ln -s $MPI_INCLUDE_DIR/mpif.h test - fi -else - F77=":" -fi -# -PAC_C_INLINE - -# Header files -PAC_CHECK_HEADERS(unistd.h) -# -PAC_INT_LT_POINTER() -# -PAC_LONG_LONG_64() -# -dnl PAC_LONG_64() -# -if test -n "$longlongsize"; then - if test $FROM_MPICH = 0 ; then - PAC_MPI_LONG_LONG_INT() - else - AC_DEFINE(HAVE_MPI_LONG_LONG_INT) - fi -fi -# -if test -n "$OFFSET_KIND" -a "A$MPI_OFFSET_KIND1" = "A!" ; then - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$OFFSET_KIND)" -else - if test "$FORTRAN_MPI_OFFSET" = "integer*8" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then - PAC_MPI_OFFSET_KIND() - fi - # - if test "$FORTRAN_MPI_OFFSET" = "integer" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then - PAC_MPI_OFFSET_KIND_4BYTE() - fi -fi -# -# check if MPI_Info functions are defined in the MPI implementation -if test $FROM_MPICH = 0 ; then - PAC_MPI_INFO() -else - AC_DEFINE(HAVE_MPI_INFO) - HAVE_MPI_INFO="#define HAVE_MPI_INFO 1" - MPI_FINFO1="!" - MPI_FINFO2="!" - MPI_FINFO3="!" - MPI_FINFO4="!" -fi -# -if test -n "$mpi_sgi"; then - if test -z "$HAVE_MPI_INFO" ; then - PAC_CHECK_MPI_SGI_INFO_NULL # is MPI_INFO_NULL defined in mpi.h? - fi - PAC_TEST_MPI_SGI_type_is_contig - PAC_TEST_MPI_COMBINERS - PAC_TEST_MPI_HAVE_OFFSET_KIND -fi -# -# check if darray and subarray constructors are defined in the MPI implementation -if test $FROM_MPICH = 0 ; then - PAC_MPI_DARRAY_SUBARRAY() -else - AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY) - HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" - MPI_FARRAY1="!" - MPI_FARRAY2="!" - MPI_FARRAY3="!" - MPI_FARRAY4="!" - MPI_FARRAY5="!" - MPI_FARRAY6="!" - MPI_FARRAY7="!" -fi -# -# Check to see if the compiler accepts prototypes -dnl PAC_CHECK_CC_PROTOTYPES(AC_DEFINE(HAVE_PROTOTYPES)) -# -# -# Test for weak symbol support... -# We can't put # in the message because it causes autoconf to generate -# incorrect code -HAVE_WEAK_SYMBOLS=0 -if test -n "$arch_hpux" || test -n "$arch_sppux" ; then -# multiple secondary definitions not allowed by HP compilers -# Fortran interface for HP already uses one secondary defn. -# therefore, do not use this method for profiling interface. -# build profiling interface explicitly. - TRY_WEAK_SYMBOLS=0 -fi -if test $TRY_WEAK_SYMBOLS = 1 ; then - AC_MSG_CHECKING(for weak symbol support) - AC_TRY_LINK([ -#pragma weak PFoo = Foo -extern int PFoo(int); -int Foo(a) { return a; } -],[return PFoo(1);],has_pragma_weak=1) - # - # Some systems (Linux ia64 and ecc, for example), support weak symbols - # only within a single object file! This tests that case. - if test "$has_pragma_weak" = 1 ; then - AC_MSG_RESULT([pragma weak]) - AC_MSG_CHECKING([that weak symbols are visible to other files]) - rm -f conftest* - cat >>conftest1.c <>conftest2.c <>config.log - echo "Failed program was" >>config.log - cat conftest1.c >>config.log - cat conftest2.c >>config.log - if test -s conftest.out ; then cat conftest.out >> config.log ; fi - AC_MSG_RESULT(no) - has_pragma_weak=0 - fi - rm -f conftest* - fi - if test "$has_pragma_weak" = 1 ; then - HAVE_WEAK_SYMBOLS=1 - AC_DEFINE(HAVE_WEAK_SYMBOLS) - AC_DEFINE(HAVE_PRAGMA_WEAK) - else - AC_TRY_LINK([ -#pragma _HP_SECONDARY_DEF Foo PFoo -int Foo(a) { return a; } -],[return PFoo(1);],has_pragma_hp_secondary=1) - if test "$has_pragma_hp_secondary" = 1 ; then - AC_MSG_RESULT([pragma _HP_SECONDARY_DEF]) - HAVE_WEAK_SYMBOLS=1 - AC_DEFINE(HAVE_WEAK_SYMBOLS) - AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF) - else - AC_TRY_LINK([ -#pragma _CRI duplicate PFoo as Foo -int Foo(a) { return a; } -],[return PFoo(1);],has_pragma_cri_duplicate=1) - if test "$has_pragma_cri_duplicate" = 1 ; then - AC_MSG_RESULT([pragma _CRI duplicate x as y]) - HAVE_WEAK_SYMBOLS=1 - AC_DEFINE(HAVE_WEAK_SYMBOLS) - AC_DEFINE(HAVE_PRAGMA_CRI_DUP) - else - AC_MSG_RESULT(no) - fi - fi - fi -fi -AC_SUBST(HAVE_WEAK_SYMBOLS) -# -# if FILE_SYSTEM is not set above, use ufs and nfs as default -# -if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - echo "configuring for file systems ufs and nfs" -fi -# -if test -n "$file_system_nfs" ; then - # Check for problems with locks - AC_MSG_CHECKING([whether file locks work with NFS]) - AC_TEST_PROGRAM([ -#include -#include -#include - -int main() -{ - struct flock lock; - int fd, err; - - lock.l_type = F_WRLCK; - lock.l_start = 0; - lock.l_whence = SEEK_SET; - lock.l_len = 100; - - fd = open("conftest.dat", O_RDWR | O_CREAT, 0644); - - err = fcntl(fd, F_SETLKW, &lock); - - /* printf("err = %d, errno = %d\n", err, errno); */ - close(fd); - return err; -}],nfs_locks_work=yes,nfs_locks_work=no) - AC_MSG_RESULT($nfs_locks_work) - if test "$nfs_locks_work" != "yes" ; then - AC_MSG_WARN([File locks do not work with NFS. See the Installation and -users manual for instructions on fixing this]) - fi -fi -if test -n "$file_system_nfs"; then - dnl CFLAGS="$CFLAGS -DNFS" - AC_DEFINE(NFS) -fi -if test -n "$file_system_ufs"; then - dnl CFLAGS="$CFLAGS -DUFS" - AC_DEFINE(UFS) -fi -if test -n "$file_system_hfs"; then - dnl CFLAGS="$CFLAGS -DHFS" - AC_DEFINE(HFS) -fi -if test -n "$file_system_sfs"; then - dnl CFLAGS="$CFLAGS -DSFS" - AC_DEFINE(SFS) -fi -if test -n "$file_system_xfs"; then - dnl CFLAGS="$CFLAGS -DXFS" - AC_DEFINE(XFS) - PAC_GET_XFS_MEMALIGN -fi -if test -n "$file_system_pvfs"; then - # Use ROMIO_PVFS instead of PVFS because FREEBSD defines PVFS. - dnl CFLAGS="$CFLAGS -DROMIO_PVFS" - AC_DEFINE(ROMIO_PVFS) -fi -if test -n "$file_system_pfs"; then - dnl CFLAGS="$CFLAGS -DPFS" - AC_DEFINE(PFS) -fi -if test -n "$file_system_testfs"; then - dnl CFLAGS="$CFLAGS -DROMIO_TESTFS" - AC_DEFINE(ROMIO_TESTFS) -fi -if test -n "$file_system_piofs"; then - dnl CFLAGS="$CFLAGS -DPIOFS" - AC_DEFINE(PIOFS) - USER_CFLAGS="$USER_CFLAGS -bI:/usr/include/piofs/piofs.exp" - ROMIO_LFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp" - USER_FFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp" -fi -if test -n "$mpi_mpich"; then - dnl CFLAGS="$CFLAGS -DNEEDS_MPI_TEST -DMPICH" - AC_DEFINE(NEEDS_MPI_TEST) - AC_DEFINE(MPICH) - if test -z "$arch_SX4" ; then - MPIOF_H_INCLUDED=1 - fi -fi -if test -n "$mpi_sgi"; then - dnl CFLAGS="$CFLAGS -DMPISGI" - AC_DEFINE(MPISGI) -fi -if test -n "$mpi_lam"; then - dnl CFLAGS="$CFLAGS -DMPILAM" - AC_DEFINE(MPILAM) -fi -if test -n "$mpi_hp"; then - dnl CFLAGS="$CFLAGS -DMPIHP" - AC_DEFINE(MPIHP) - if test "$NOF77" = 0; then - PAC_CHECK_MPIOF_H - fi -fi -# -PAC_FUNC_STRERROR -if test -z "$srcdir" -o "$srcdir" = "." ; then srcdir="$ROMIO_HOME" ; fi -AC_SUBST(srcdir) -if test -z "$LIBNAME"; then -LIBNAME="$ROMIO_HOME/lib/$ARCH/libmpio.a" -fi -# -if test ! -d $ROMIO_HOME/lib ; then - mkdir $ROMIO_HOME/lib -fi -if test ! -d $ROMIO_HOME/lib/$ARCH ; then - mkdir $ROMIO_HOME/lib/$ARCH -fi -# -if test $NOF77 = 1 ; then - F77=":" -else - FORTRAN_TEST="fperf fcoll_test fmisc" - # disabled FTEST: pfcoll_test (no PMPI support in AMPI yet) -fi -# -if test $FROM_MPICH = 0 ; then - PAC_TEST_MPI - PAC_NEEDS_FINT -else - NEEDS_MPI_FINT="" -fi -# -if test "$MPI_INCLUDE_DIR" = "." ; then - ROMIO_INCLUDE="-I../include" -else - ROMIO_INCLUDE="-I../include -I$MPI_INCLUDE_DIR" -fi -# -TEST_LIBNAME=$LIBNAME -MPIRUN=mpirun -# -# if MPICH, use mpicc in test programs -# -if test $FROM_MPICH = 1 ; then - MPICH_HOME=`dirname $ROMIO_HOME` - if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi - TEST_CC=$MPI_BIN_DIR/mpicc - MPI_LIB="" - ROMIO_INCLUDE="" - USER_CFLAGS="" - USER_FFLAGS="" - TEST_LIBNAME="" - MPIRUN=$MPI_BIN_DIR/mpirun - if test -n "$arch_SX4" || test -n "$arch_hpux" ; then - TEST_F77=$MPI_BIN_DIR/mpif90 - else - TEST_F77=$MPI_BIN_DIR/mpif77 - fi - CC=$MPI_BIN_DIR/mpicc - dnl CFLAGS="$CFLAGS -DHAVE_STATUS_SET_BYTES" - AC_DEFINE(HAVE_STATUS_SET_BYTES) -else - dnl CFLAGS="$CFLAGS -DHAVE_STATUS_SET_BYTES" - AC_DEFINE(HAVE_STATUS_SET_BYTES) -fi -# -if test $MPI != "mpich" ; then - dnl CFLAGS="$CFLAGS -DPRINT_ERR_MSG" - AC_DEFINE(PRINT_ERR_MSG) -fi -# -if test -z "$TEST_CC" ; then - TEST_CC="$CC" -fi -if test -z "$TEST_F77" ; then - TEST_F77="$F77" -fi -# -dnl CFLAGS="$CFLAGS $DEFS" -CFLAGS="$CFLAGS -DHAVE_ROMIOCONF_H" -# -echo "setting CC to $CC" -echo "setting F77 to $F77" -echo "setting TEST_CC to $TEST_CC" -echo "setting TEST_F77 to $TEST_F77" -echo "setting CFLAGS to $CFLAGS" -echo "setting USER_CFLAGS to $USER_CFLAGS" -echo "setting USER_FFLAGS to $USER_FFLAGS" -# -AC_SUBST(ARCH) -AC_SUBST(FILE_SYSTEM) -AC_SUBST(CC) -AC_SUBST(CFLAGS) -AC_SUBST(USER_CFLAGS) -AC_SUBST(USER_FFLAGS) -AC_SUBST(MIPS) -AC_SUBST(BITS) -AC_SUBST(MPI) -AC_SUBST(AR) -AC_SUBST(RANLIB) -AC_SUBST(MPI_INCLUDE_DIR) -AC_SUBST(MPI_LIB) -AC_SUBST(F77) -AC_SUBST(NOF77) -AC_SUBST(NOPROFILE) -AC_SUBST(MAKE) -AC_SUBST(PREFIX) -AC_SUBST(arch_IRIX) -AC_SUBST(ROMIO_HOME) -AC_SUBST(LIBNAME) -AC_SUBST(TEST_LIBNAME) -AC_SUBST(LL) -AC_SUBST(F77GETARG) -AC_SUBST(F77IARGC) -AC_SUBST(FTESTDEFINE) -AC_SUBST(FORTRAN_MPI_OFFSET) -AC_SUBST(FROM_MPICH) -AC_SUBST(NEEDS_MPI_FINT) -AC_SUBST(HAVE_MPI_INFO) -AC_SUBST(BUILD_MPI_INFO) -AC_SUBST(HAVE_MPI_DARRAY_SUBARRAY) -AC_SUBST(BUILD_MPI_ARRAY) -AC_SUBST(DEFINE_MPI_OFFSET) -AC_SUBST(MPI_FINFO1) -AC_SUBST(MPI_FINFO2) -AC_SUBST(MPI_FINFO3) -AC_SUBST(MPI_FINFO4) -AC_SUBST(MPI_FARRAY1) -AC_SUBST(MPI_FARRAY2) -AC_SUBST(MPI_FARRAY3) -AC_SUBST(MPI_FARRAY4) -AC_SUBST(MPI_FARRAY5) -AC_SUBST(MPI_FARRAY6) -AC_SUBST(MPI_FARRAY7) -AC_SUBST(MPI_OFFSET_KIND1) -AC_SUBST(MPI_OFFSET_KIND2) -AC_SUBST(TEST_CC) -AC_SUBST(TEST_F77) -AC_SUBST(ROMIO_INCLUDE) -AC_SUBST(ROMIO_LFLAGS) -AC_SUBST(ROMIO_LIBLIST) -AC_SUBST(ROMIO_TCFLAGS) -AC_SUBST(ROMIO_TCPPFLAGS) -AC_SUBST(ROMIO_TFFLAGS) -AC_SUBST(MPIRUN) -AC_SUBST(FORTRAN_TEST) -if test ! -d adio ; then mkdir adio ; fi -if test ! -d adio/include ; then mkdir adio/include ; fi -if test ! -d mpi2-other ; then mkdir mpi2-other ; fi -# -# Make sure we remove any configuration file incase there is out-of-date data. -# We remove the version in include in case this is a vpath build -rm -f adio/include/romioconf.h ${top_srcdir}/adio/include/romioconf.h -# -# Create makefiles for all of the adio devices. Only the ones that -# are active will be called by the top level ROMIO make -AC_OUTPUT(Makefile mpi-io/Makefile mpi-io/fortran/Makefile mpi2-other/info/Makefile \ - mpi2-other/array/Makefile mpi2-other/array/fortran/Makefile \ - adio/common/Makefile \ - test/Makefile test/misc.c test/large_file.c \ - test/runtests util/romioinstall include/mpio.h \ - include/mpiof.h \ - adio/ad_nfs/Makefile adio/ad_ufs/Makefile \ - adio/ad_xfs/Makefile adio/ad_hfs/Makefile \ - adio/ad_sfs/Makefile adio/ad_pfs/Makefile \ - adio/ad_testfs/Makefile adio/ad_pvfs/Makefile \ - adio/ad_piofs/Makefile ) -if test "$NOF77" = 0; then - CONFIG_FILES="$CONFIG_FILES mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile mpi2-other/array/fortran/Makefile test/fmisc.f test/fcoll_test.f test/pfcoll_test.f test/fperf.f" -fi -export CONFIG_FILES -./config.status -CONFIG_FILES="" -# delete the first line created by configure in some files -sed 1d util/romioinstall > util/tmp -mv util/tmp util/romioinstall -chmod 755 util/romioinstall -if test "$NOF77" = 0; then - sed 1d test/fcoll_test.f > test/tmp - mv test/tmp test/fcoll_test.f - if test "$MPIOF_H_INCLUDED" = 1; then - sed 5d test/fcoll_test.f > test/tmp - mv test/tmp test/fcoll_test.f - fi - sed 1d test/pfcoll_test.f > test/tmp - mv test/tmp test/pfcoll_test.f - if test "$MPIOF_H_INCLUDED" = 1; then - sed 5d test/pfcoll_test.f > test/tmp - mv test/tmp test/pfcoll_test.f - fi - sed 1d test/fperf.f > test/tmp - mv test/tmp test/fperf.f - if test "$MPIOF_H_INCLUDED" = 1; then - sed 5d test/fperf.f > test/tmp - mv test/tmp test/fperf.f - fi - sed 1d test/fmisc.f > test/tmp - mv test/tmp test/fmisc.f - if test "$MPIOF_H_INCLUDED" = 1; then - sed 5d test/fmisc.f > test/tmp - mv test/tmp test/fmisc.f - fi -fi -sed 1d test/misc.c > test/tmp -mv test/tmp test/misc.c -sed 1d test/large_file.c > test/tmp -mv test/tmp test/large_file.c -sed 1d include/mpio.h > include/tmp -mv include/tmp include/mpio.h -sed 1d include/mpiof.h > include/tmp -mv include/tmp include/mpiof.h -sed 1d test/runtests > test/tmp -mv test/tmp test/runtests -# -chmod 755 test/runtests -# -rm -f *.o -if test "$ROMIO_NO_BANNER" != "yes" -a "$FROM_MPICH" = 0 ; then -print_error " " -print_error Please register your copy of ROMIO with us by sending email -print_error to majordomo@mcs.anl.gov with the message -print_error subscribe romio-users -print_error This will enable us to notify you of new releases of ROMIO -print_error as well as bug fixes. -print_error " " -fi -if test $FROM_MPICH = 0 ; then - print_error Configure done. Now type make - print_error " " -fi -exit 0 +# -*- Mode: shell-script -*- +# build with +# autoconf --localdir=../confdb configure.in +# (or wherever the confdb is) +# +AC_PREREQ(2.59) + +# if this blows up, it's because you forgot to run autoheader +AC_INIT(adio/include/romioconf.h.in) +# VERSION=1.2.6 +# AC_MSG_RESULT([Configuring ROMIO Version $VERSION]) +CONFIGURE_ARGS="$*" +if test -n "$CONFIGURE_ARGS" ; then + echo "Configuring with args $CONFIGURE_ARGS" +fi + +AC_CONFIG_HEADER(adio/include/romioconf.h) + +dnl +NOF77=0 +NOF90=0 +ARCH="" +arch_IRIX="" +MPI_IMPL="" +MPI_INCLUDE_DIR="" +ROMIO_INCLUDE="" +TEST_LIBNAME="" +FILE_SYSTEM="" +# Do not set variables to empty that may be communicated from the +# outside environment (e.g., MPI_LIB, MPI_BIN_DIR, LIBNAME) +DEBUG=no +MIPS=0 +BITS=0 +FROM_MPICH=${FROM_MPICH:-no} +FROM_MPICH2=${FROM_MPICH2:-no} +if test "$FROM_MPICH" = yes -a "$FROM_MPICH2" = yes ; then + AC_MSG_WARN([Both FROM_MPICH and FROM_MPICH set to yes; at most one should be yes]) + +fi +FROM_LAM=${FROM_LAM:-no} +if test "$FROM_LAM" = 1 ; then FROM_LAM=yes ; fi +CFLAGS=${CFLAGS:-""} +LL="lld" +AR_LOCAL="" +DEFINE_HAVE_MPI_GREQUEST="#undef HAVE_MPI_GREQUEST" +HAVE_MPI_INFO="" +BUILD_MPI_INFO="" +MPI_FINFO1="" +MPI_FINFO2="" +MPI_FINFO3="" +MPI_FINFO4="" +MPI_FARRAY1="" +MPI_FARRAY2="" +MPI_FARRAY3="" +MPI_FARRAY4="" +MPI_FARRAY5="" +MPI_FARRAY6="" +MPI_FARRAY7="" +DEFS="" +ROMIO_LFLAGS="" +ROMIO_TCFLAGS="" +ROMIO_TCPPFLAGS="" +ROMIO_TFFLAGS="" +NOPROFILE=0 +MPIRUN="" +FORTRAN_TEST="" +MAKE=${MAKE:-"make"} +# foll. needed for f77 test programs +F77GETARG="call getarg(i,str)" +F77IARGC="iargc()" +F77MPIOINC="" +FTESTDEFINE="" +FORTRAN_MPI_OFFSET="" +MPIOF_H_INCLUDED=0 +MPI_OFFSET_KIND1="!" +MPI_OFFSET_KIND2="!" +TEST_CC="" +TEST_F77="" +TRY_WEAK_SYMBOLS=1 +# +# Error handlers (not used with MPICH2, which provides its own routines) +MPIO_EXTRA_OBJECTS="get_errh.o set_errh.o" +MPIO_EXTRA_TMP_POBJECTS="get_errh.p set_errh.p" +MPIO_EXTRA_REAL_POBJECTS="_get_errh.o _set_errh.o" +# +# Completion routines for MPIO_Requests. MPI Implementations with +# generalized requests do not need these +# ioreq_c2f and ioreq_f2c are not MPIO_Requests; rather, they +MPIO_REQOBJECTS="iotest.o iotestall.o iotestany.o iotestsome.o iowait.o iowaitall.o iowaitany.o iowaitsome.o ioreq_c2f.o ioreq_f2c.o" +MPIO_REQ_TMP_POBJECTS="iotest.p iowait.p iowaitall.p iowaitany.p iotestall.p iotestany.p iowaitsome.p iotestsome.p" +MPIO_REQ_REAL_POBJECTS="_iotest.o _iowait.o _iowaitall.o _iowaitany.o _iotestall.o _iotestany.o _iowaitsome.o _iotestsome.o" +# +have_aio=no +# +known_filesystems="nfs ufs pfs pvfs pvfs2 testfs xfs panfs gridftp lustre bgl bglockless zoidfs" +known_mpi_impls="mpich2_mpi mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi" +# +# Defaults +AC_ARG_ENABLE(aio,[ +--enable-aio - Request use of asynchronous I/O routines (default)], +[ + if test "x$enableval" = "xno" ; then + disable_aio=yes + else + disable_aio=no + fi +], disable_aio=no) +AC_ARG_ENABLE(echo, +[--enable-echo - Turn on strong echoing. The default is enable=no.] ,set -x) +AC_ARG_ENABLE(f77, +[--enable-f77 - Turn on support for Fortran 77 (default)],,enable_f77=yes) +AC_ARG_ENABLE(f90, +[--enable-f90 - Turn on support for Fortran 90 (default)],,enable_f90=yes) +AC_ARG_ENABLE(weak-symbols, +[--enable-weak-symbols - Turn on support for weak symbols],,enable_weak_symbols=no) +AC_ARG_ENABLE(debug, +[--enable-debug - Build a debugging version],,) +AC_ARG_WITH(file-system,[ +--with-file-system=name - Build with support for the named file systems],,) +AC_ARG_WITH(pvfs2,[ +--with-pvfs2=path - Path to installation of PVFS (version 2)],,) +AC_ARG_WITH(mpi-impl,[ +--with-mpi-impl=name - Specify MPI implementation to build ROMIO for],,) +dnl +AC_ARG_WITH(mpi, [ +--with-mpi=path - Path to instalation of MPI (headers, libs, etc)],,) +dnl +if test "$enable_f77" != "yes" ; then + NOF77=1 +fi +if test "$enable_f90" != "yes" ; then + NOF90=1 +fi +if test "$enable_debug" = "yes" ; then + DEBUG=yes +fi +if test "$enable_weak_symbols" = "no" ; then + TRY_WEAK_SYMBOLS=0 +fi +MPI=$with_mpi +if test -n "$with_mpi"; then + CC=$MPI/bin/mpicc +fi + +FILE_SYSTEM=$with_file_system +# +dnl AC_CONFIG_AUX_DIR(../../../confdb) +dnl Set the directory that contains the required install-sh, config.sub, +dnl and config.guess . Make sure that these are updated (in MPICH2, use +dnl the top-level confdb files). This separate directory is used for +dnl the moment to allow ROMIO to be separatedly distributed. +dnl scripts. +AC_CONFIG_AUX_DIR(confdb) + +# Check if Make is working +PAC_PROG_MAKE +# +# Check that an arch was set +# If it wasn't set, try to guess using "util/tarch" +# +# Sometimes tarch looses its execute bit (!) +if test -s $srcdir/util/tarch -a ! -x $srcdir/util/tarch ; then + chmod a+x $srcdir/util/tarch +fi +if test -z "$ARCH" -a -x $srcdir/util/tarch ; then + AC_MSG_CHECKING(for architecture) + ARCH=`$srcdir/util/tarch | sed s/-/_/g` + if test -z "$ARCH" ; then + AC_MSG_RESULT(Unknown!) + AC_MSG_ERROR([Error: Could not guess target architecture, you must +set an architecture type with the environment variable ARCH]) + fi + eval "arch_$ARCH=1" + AC_MSG_RESULT($ARCH) +fi +# +# check for valid architecture. Use __ so that _ALPHA_ does not match +# LINUX_ALPHA_ +#### WE SHOULD REMOVE THIS SOON +grep __"$ARCH"_ $srcdir/.config_params > /dev/null 2>&1 +if test $? != 0 ; then + AC_MSG_WARN([Unknown architecture $arch... proceeding anyway]) +fi +# +# +# Find the home directory if not specified +if test "X$srcdir" != "X." -a -s $srcdir/mpi-io/Makefile.in ; then + ROMIO_HOME_TRIAL=$srcdir +else + # Take advantage of autoconf2 features + if test -n "$ac_confdir" ; then + ROMIO_HOME_TRIAL=$ac_confdir + else + if test -s configure ; then + ROMIO_HOME_TRIAL=`pwd` + else + ac_confdir=`dirname "$0" 2>/dev/null` + if test -n "$ac_confdir" ; then + ROMIO_HOME_TRIAL=$ac_confdir + fi + fi + fi +fi +AC_MSG_RESULT([ROMIO home directory is $ROMIO_HOME_TRIAL]) +ROMIO_HOME=$ROMIO_HOME_TRIAL + +# get a fully qualified pathname for our build directory +top_build_dir=`pwd` +# used in romioinstall +AC_SUBST(top_build_dir) + +# +# Create the "autoconf" style directory names... +# Most of these are done for us; add the documentation directories +# +# mandir is the root for the man pages +if test -z "$mandir" ; then mandir='${prefix}/man' ; fi +AC_SUBST(mandir) +if test -z "$docdir" ; then docdir='${prefix}/doc' ; fi +AC_SUBST(docdir) +if test -z "$htmldir" ; then htmldir='${prefix}/www' ; fi +AC_SUBST(htmldir) +# +# check for valid file system +if test -n "$FILE_SYSTEM" ; then + # if multiple filesystems are passed in, they are '+'-delimited + # we could set the IFS to tokenize FILE_SYSTEM, but the FILE_SYSTEM env var + # is used in multiple places in the build system: get rid of the '+'s so we + # can use the 'for x in $FILE_SYSTEM ...' idiom + FILE_SYSTEM=`echo $FILE_SYSTEM|sed -e 's/\+/ /g'` + for x in $FILE_SYSTEM + do + found=no + # We could also do test -d "ad_$y" to test for known file systems + # based on having access to the adio code. Then adding a file + # system would not require changing configure to change known_filesystems + for y in $known_filesystems ; do + if test $x = $y ; then + found=yes + eval "file_system_`echo $x`=1" + break + fi + done + if test "$found" = "no" ; then + AC_MSG_WARN([Unknown file system $x... proceeding anyway]) + fi + done +fi +# +# If we are building within a known MPI implementation, we must avoid the +# tests about an existing implementation +if test "$FROM_MPICH" != no -o "$FROM_MPICH2" != no -o "$FROM_LAM" != no ; then + WITHIN_KNOWN_MPI_IMPL=yes +else + WITHIN_KNOWN_MPI_IMPL=no +fi +# check for valid MPI implementation +if test -n "$MPI_IMPL" ; then + found=no + for mpi in $known_mpi_impls ; do + if test "${MPI_IMPL}_mpi" = "$mpi" ; then + found=yes + break + fi + done + if test $found = no ; then + AC_MSG_WARN([Unknown MPI implementation $MPI... proceeding anyway]) + fi +fi +# + +if test -n "${with_mpi}" ; then + MPI_INCLUDE_DIR="${with_mpi}"/include + MPI_LIB_DIR="${with_mpi}"/lib +fi + +# check for valid MPI include directory if specified +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + if test -n "$MPI_INCLUDE_DIR"; then + if test ! -f "$MPI_INCLUDE_DIR/mpi.h" ; then + AC_MSG_ERROR([Include file $MPI_INCLUDE_DIR/mpi.h not found]) + fi + else +# assume that mpi.h is in the default path +# set MPI_INCLUDE_DIR to ".", so that it translates to -I. in the +# compile command. Some compilers complain if it's only -I + MPI_INCLUDE_DIR=. + fi +else + MPI_INCLUDE_DIR=. +fi +# +# check for valid MPI library if specified +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + if test -n "$MPI_LIB" ; then + if test ! -f "$MPI_LIB" ; then + AC_MSG_ERROR([MPI library $MPI_LIB not found]) + fi + fi +fi +# +# +AR="${AR:-ar} cr$AR_LOCAL" +if test -z "$RANLIB" ; then + AC_PROG_RANLIB +fi +# +# USER_CFLAGS and USER_FFLAGS are used only in test/Makefile.in +if test $DEBUG = "yes"; then + USER_CFLAGS="$CFLAGS -g" + USER_FFLAGS="$FFLAGS -g" +else + USER_CFLAGS="$CFLAGS -O" + USER_FFLAGS="$FFLAGS -O" +fi +# +# Here begin the architecture-specific tests. +# -------------------------------------------------------------------------- +# We must first select the C and Fortran compilers. Because of the +# way that the PROG_CC autoconf macro works (and all of the macros that +# require it, including CHECK_HEADERS), that macro must occur exactly +# once in the configure.in file, at least as of autoconf 2.57 . +# Unfortunately, this requirement is not enforced. To handle this, +# we first case on the architecture; then use PROG_CC, then case on the +# architecture again for any arch-specific features. We also set the +# C_DEBUG_FLAG and F77_DEBUG_FLAG in case debugging is selected. +# +# For the MPICH and MPICH2 configures, the compilers will already be +# selected, so most of the compiler-selection code will be bypassed. +# -------------------------------------------------------------------------- +# For historical reasons +if test -z "$FC" ; then + FC=$F77 +fi +# +C_DEBUG_FLAG="-g" +F77_DEBUG_FLAG="-g" +# C_OPT_FLAG=${CFLAGS:-"-O"} +# MPICH1 uses OPTFLAGS and OPTFLAGSC to specify separate optimization +# flags for the C compiler (this is better that adding it to the +# undifferentiated CFLAGS, at least on input). +if test -n "$OPTFLAGS" ; then + C_OPT_FLAG="$C_OPT_FLAG $OPTFLAGS" +fi +if test -n "$OPTFLAGSC" ; then + C_OPT_FLAG="$C_OPT_FLAG $OPTFLAGSC" +fi +case $ARCH in + solaris|solaris86) + CC=${CC:-cc} + F77=${FC:-f77} + if test "$CC" != "gcc" ; then + C_DEBUG_FLAG="-g -v" + fi + ;; + + rs6000) + F77=${FC} + # Try to use mpcc if no CC specified + AC_PROGRAMS_CHECK(CC, mpcc, cc) + if test $NOF77 = 0 && test -z "$F77"; then + AC_PROGRAMS_CHECK(F77, mpxlf, f77) + fi + ;; + + tflop|tflops) + CC=${CC:-pgcc} + F77=${FC:-pgf77} + CFLAGS="$CFLAGS -cougar -D__PUMA" + if test "$CC" = "pgcc" ; then + C_OPT_FLAG="-Knoieee -Mvect -O3" + fi + ;; + + freebsd|LINUX|netbsd|openbsd|LINUX_ALPHA) + CC=${CC:-gcc} + # Let the prog_f77 file g77/f77/others + F77=${FC} + ;; + + SX4) + CC=${CC:-mpicc} + F77=${FC:-mpif90} + if test $DEBUG != "yes" ; then + USER_FFLAGS="$FFLAGS -Chopt" + F77_OPT_FLAG="-Chopt" + fi + ;; + + hpux|sppux) + C_DEBUG_FLAG="-g +w1" + ;; + + alpha|ALPHA) + CC=${CC:-cc} + F77=${FC:-f77} + dnl CFLAGS="$CFLAGS -g -std1 -warnprotos -verbose" + C_DEBUG_FLAG="-g -verbose" + ;; + + CRAY) + CC=${CC:-cc} + F77=${FC:-f90} + NOF77=1 + CFLAGS="$CFLAGS -D_UNICOS" + ;; + + sgi|IRIX64|IRIX32|IRIXN32) + arch_IRIX=1 + CC=${CC:-cc} + F77=${FC:-f77} + C_DEBUG_FLAG="-g -fullwarn" + ;; + + sgi5) + ;; + + *) + # Fall-through case. Take FC + F77=${FC:-f77} + ;; +esac + +PAC_PROG_CC + +if test "$NOF77" != 1 ; then + # Grrr. The autoconf test for F77 will abort the configure + # if no compiler is found. We'd prefer to simply turn off + # support for Fortran, and/or give a more informative message. + PAC_PROG_F77 +fi +if test "$CC" = "gcc" -a -z "$C_DEBUG_FLAG" ; then + C_DEBUG_FLAG="-g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" +fi +if test $DEBUG = "yes" ; then + CFLAGS="$CFLAGS $C_DEBUG_FLAG" +else + CFLAGS="$CFLAGS $C_OPT_FLAG" +fi +# --------------------------------------------------------------------------- +# Here go the rest of the tests +# --------------------------------------------------------------------------- +if test -n "$arch_solaris" || test -n "$arch_solaris86" ; then + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + if test $MPI_IMPL = "mpich" ; then + TEST_CC=mpicc + TEST_F77=mpif77 + else + TEST_CC="$CC" + TEST_F77="$F77" + fi + AR="ar cr" +# solaris does not have l option to ar +fi + + +if test -n "$arch_rs6000"; then + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + AC_DEFINE(AIX,1,[Define for AIX]) +# assume long long exists. + ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long:-8} + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 +fi +# + +if test -n "$arch_tflop" || test -n "$arch_tflops"; then + # TFLOP_FLAGS="-cougar -D__PUMA" + AR="xar cr$AR_LOCAL" + RANLIB="xranlib" + MPI_LIB="$MPI_LIB" + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + if test -z "$FILE_SYSTEM" ; then + file_system_ufs=1 + FILE_SYSTEM="ufs" + fi +fi +# +if test -n "$arch_freebsd" || test -n "$arch_LINUX" || test -n "$arch_LINUX_ALPHA" || test -n "$arch_netbsd" || test -n "$arch_openbsd" ; then + if test -n "$arch_freebsd" || test -n "$arch_netbsd" || test -n "$arch_openbsd"; then + ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long:-0} + # printf doesn't work properly and no integer*8 as far as I can tell + fi + # Find the CPP before the header check + AC_PROG_CPP + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi +fi +# +if test -n "$arch_SX4" ; then + have_aio=no + AC_DEFINE(SX4,1,[Define for NEC SX4]) + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + if test -z "$FILE_SYSTEM" ; then + file_system_sfs=1 + file_system_nfs=1 + FILE_SYSTEM="sfs nfs" + fi + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 +fi +# +if test -n "$arch_hpux" || test -n "$arch_sppux" ; then + have_aio=no + RANLIB=":" + if test -z "$MPI_IMPL"; then + if test -f "/opt/mpi/include/mpi.h" ; then + echo "assuming that you want to use ROMIO with HP MPI" + MPI_IMPL=hp + else + echo "assuming that you want to use ROMIO with MPICH" + MPI_IMPL=mpich + fi + fi + if test $MPI_IMPL = "mpich" ; then + mpi_mpich=1 + MPI_LIB="$MPI_LIB -lV3" + CC=${CC:-cc -Ae} + F77=${FC:-f77 +U77} + fi + if test $MPI_IMPL = "hp" ; then + mpi_hp=1 + CC=${CC:-mpicc -Ae} + F77=${FC:-mpif77 +U77} + fi + if test $MPI_IMPL = "lam" && test "$FC" != ""; then + F77="$F77 +U77" + fi + FTESTDEFINE="external iargc, getarg" + if test -n "$arch_hpux" ; then + CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" + AC_DEFINE(HPUX,1,[Define for HPUX]) + if test $MPI_IMPL = "hp" ; then + F77=${FC:-mpif90 +U77} + else + F77=${FC:-f90 +U77} + fi + else + AC_DEFINE(SPPUX,1,[Define for SPPUX (Convex)]) + fi + + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 + if test "$CC" != "gcc" ; then + ROMIO_TCFLAGS="-Ae" + fi + if test "$F77" != "g77" ; then + ROMIO_TFFLAGS="+U77" + fi +fi +# +if test -n "$arch_alpha" || test -n "$arch_ALPHA" ; then + if test -z "$MPI_IMPL" ; then + MPI_IMPL=mpich + mpi_mpich=1 + fi + + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 + LIBS="$LIBS -laio" +fi +# +if test -n "$arch_CRAY" ; then + NOF77=1 + FTESTDEFINE="integer ilen" + F77GETARG="call pxfgetarg(i, str, ilen, ierr)" + have_aio=no + RANLIB=":" + AC_DEFINE(CRAY,1,[Define if Cray]) + if test -z "$MPI_IMPL" || test -n "$mpi_sgi" ; then + MPI_IMPL=cray + mpi_cray=1 + mpi_sgi="" +# above is to disable configure tests specific to SGI MPI + AC_DEFINE(MPISGI,1,[Define if SGI MPI]) + AC_DEFINE(HAVE_MPI_COMBINERS,1,[Define if MPI supports datatype combiners]) + AC_DEFINE(NO_MPI_SGI_type_is_contig,1,[Define if no types show contig]) + fi +# MPISGI needed because of error in Cray's and SGI's +# MPI_Type_get_contents (does not increment reference count). +# Others needed because MPISGI needed. + + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 +fi +# +if test -n "$arch_sgi" ; then + arch_IRIX=1 + ARCH=IRIX +fi +if test -n "$arch_IRIX64" || test -n "$arch_IRIX32" || test -n "$arch_IRIXN32" ; then + arch_IRIX=1 +fi +if test -n "$arch_sgi5" ; then + arch_IRIX5=1 + ARCH=IRIX +fi +# +PAC_GET_SPECIAL_SYSTEM_INFO +# +# special case 'sgi5' for use on MESHINE which is much like an SGI running +# irix 5 with r4400 chips, but does not have 'hinv', so above code doesn't +# work +if test -n "$arch_sgi5"; then + osversion=5 + cputype=4400 + IRIXARCH="$ARCH_$osversion" + IRIXARCH="$IRIXARCH_$cputype" +# now set arch_IRIX to 1 + arch_IRIX=1 + echo "IRIX-specific architecture is $IRIXARCH" + AC_DEFINE(IRIX,1,[Define if IRIX]) +fi +# +if test -n "$arch_IRIX"; then + if test $osversion = 4 ; then + RANLIB="ar ts" + if test -n "$mpi_sgi"; then + AC_MSG_ERROR([SGI\'s MPI does not work with IRIX 4.x]) + fi + elif test $osversion = 5 ; then + if test -n "$mpi_sgi"; then + AC_MSG_ERROR([SGI\'s MPI does not work with IRIX 5.x]) + fi + elif test $osversion = 6 ; then + if test -z "$MPI_IMPL"; then + if test "$FROM_MPICH2" = "yes" ; then + # Building with MPICH2. Distinguish from MPICH-1 + MPI_IMPL=mpich2 + mpi_mpich2=1 + elif test -f "/usr/include/mpi.h" ; then + # removed use of escaped single quotes in messages + # because they confuse Emacs, making it hard to + # read the files (with emacs :) ) + AC_MSG_WARN([assuming that you want to use ROMIO with the SGI MPI]) + MPI_IMPL=sgi + mpi_sgi=1 + else + AC_MSG_WARN([assuming that you want to use ROMIO with MPICH]) + MPI_IMPL=mpich + mpi_mpich=1 + fi + fi + RANLIB=":" + AC_DEFINE(AIO_SIGNOTIFY_NONE,1,[Define if no signotify]) + if test $cputype -ge 5000 ; then + MIPS=4 + else + MIPS=3 + fi + fi + if test -n "$mpi_sgi" && test -z "$MPI_LIB" ; then + MPI_LIB="-lmpi" + fi +# check if pread64 is defined + PAC_HAVE_PREAD64 +# + if test -z "$FILE_SYSTEM" ; then + file_system_nfs=1 + FILE_SYSTEM="nfs" + AC_MSG_CHECKING(for xfs) + AC_TRY_COMPILE([ +#include ], +[aiocb64_t *t1;],file_system_xfs=1;FILE_SYSTEM="xfs $FILE_SYSTEM";) + if test "$file_system_xfs" = 1 ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + file_system_ufs=1 + FILE_SYSTEM="ufs $FILE_SYSTEM" + fi + fi + AC_DEFINE(IRIX,1,[Define if IRIX]) + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" + MPI_OFFSET_KIND_VAL=8 +fi + +AC_HAVE_FUNCS(memalign) + +# +# Question: Should ROMIO under MPICH2 ignore the Fortran tests, since +# MPICH2 provides all of the Fortran interface routines? +# +if test $NOF77 = 0 ; then + echo "checking Fortran external names" + PAC_GET_FORTNAMES + if test -n "$WDEF" ; then + CFLAGS="$CFLAGS $WDEF" + fi + dnl PAC_PROG_F77_NAME_MANGLE + dnl (need to set the new name format) + rm -f test/mpif.h + if test "$MPI_INCLUDE_DIR" != "." && test $WITHIN_KNOWN_MPI_IMPL = no ; then + if test ! -d test ; then mkdir test ; fi + ln -s $MPI_INCLUDE_DIR/mpif.h test + fi +else + F77=":" +fi +# +AC_C_INLINE + +# Header files +# Find the CPP before the header check +AC_PROG_CPP +AC_CHECK_HEADERS([unistd.h fcntl.h malloc.h stddef.h sys/types.h]) +# + +# When compiling ROMIO on Darwin with _POSIX_C_SOURCE defined (such as when +# using --enable-strict in MPICH2), sys/types.h does not define u_short and +# friends unless _DARWIN_C_SOURCE is also defined (see compat(5) on a Darwin +# box). This would normally be fine, except sys/stat.h defines struct stat to +# use u_long, so strict compiles fail. One option is to also compile with +# _DARWIN_C_SOURCE, but this disables much of the strictness that is intended +# by _POSIX_C_SOURCE. Instead we just define our own types if they are not +# provided by the system. This isn't quite as safe as typedef'ing the +# replacement types, but it will apply to later configure tests, which is +# important. +AC_CHECK_TYPE([u_char],[],[AC_DEFINE_UNQUOTED([u_char],[unsigned char],[Define to "unsigned char" if sys/types.h does not define.])]) +AC_CHECK_TYPE([u_short],[],[AC_DEFINE_UNQUOTED([u_short],[unsigned short],[Define to "unsigned short" if sys/types.h does not define.])]) +AC_CHECK_TYPE([u_int],[],[AC_DEFINE_UNQUOTED([u_int],[unsigned int],[Define to "unsigned int" if sys/types.h does not define.])]) +AC_CHECK_TYPE([u_long],[],[AC_DEFINE_UNQUOTED([u_long],[unsigned long],[Define to "unsigned long" if sys/types.h does not define.])]) + +# must come _after_ the above checks for u_char/u_short/u_int/u_long +AC_CHECK_HEADERS([sys/attr.h]) + +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(void *) +AC_CACHE_CHECK([for int large enough for pointers], +pac_cv_int_hold_pointer,[ +if test "$ac_cv_sizeof_int" = "0" -o \ + "$ac_cv_sizeof_void_p" = "0" ; then + pac_cv_int_hold_pointer=unknown +elif test "$ac_cv_sizeof_int" -lt "$ac_cv_sizeof_void_p" ; then + pac_cv_int_hold_pointer=no +else + pac_cv_int_hold_pointer=yes +fi +]) +if test "$pac_cv_int_hold_pointer" != yes ; then + AC_DEFINE(INT_LT_POINTER,1,[Define if int smaller than pointer]) + dnl Switch to a conforming name (start with HAVE or USE) + AC_DEFINE(HAVE_INT_LT_POINTER,1,[Define if int smaller than pointer]) +fi + +# LL is the printf-style format name for output of a MPI_Offset. +# We have to match this to the type that we use for MPI_Offset. +AC_CHECK_SIZEOF(long long) +if test "$ac_cv_sizeof_long_long" != 0 ; then + if test "$ac_cv_sizeof_long_long" = "8" ; then + AC_DEFINE(HAVE_LONG_LONG_64,1,[Define if long long is 64 bits]) + MPI_OFFSET_TYPE="long long" + DEFINE_MPI_OFFSET="typedef long long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer*8" + LL="lld" + elif test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_int" ; then + MPI_OFFSET_TYPE="int" + DEFINE_MPI_OFFSET="typedef int MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + AC_DEFINE(MPI_OFFSET_IS_INT,1,[Define if MPI_Offset is int]) + LL="d" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + else + echo "defining MPI_Offset as long in C and integer in Fortran" + MPI_OFFSET_TYPE="long" + DEFINE_MPI_OFFSET="typedef long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + LL="ld" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" + fi +else + echo "defining MPI_Offset as long in C and integer in Fortran" + MPI_OFFSET_TYPE="long" + DEFINE_MPI_OFFSET="typedef long MPI_Offset;" + FORTRAN_MPI_OFFSET="integer" + LL="ld" + MPI_OFFSET_KIND1="!" + MPI_OFFSET_KIND2="!" +fi + + +# +if test -n "$ac_cv_sizeof_long_long"; then + if test $WITHIN_KNOWN_MPI_IMPL = no ; then + PAC_MPI_LONG_LONG_INT + else + AC_DEFINE(HAVE_MPI_LONG_LONG_INT,1,[Define if supports long long int]) + fi +fi +# +if test -n "$OFFSET_KIND" -a "A$MPI_OFFSET_KIND1" = "A!" ; then + MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" + MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$OFFSET_KIND)" + MPI_OFFSET_KIND_VAL=$OFFSET_KIND +else + if test "$FORTRAN_MPI_OFFSET" = "integer*8" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 && test $NOF90 = 0 ; then + PAC_MPI_OFFSET_KIND + fi + # + if test "$FORTRAN_MPI_OFFSET" = "integer" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 && test $NOF90 = 0 ; then + PAC_MPI_OFFSET_KIND_4BYTE + fi +fi +# +# Test that we can use the FORTRAN_MPI_OFFSET type. If the environment +# is a strict Fortran 90/95 or later compiler, the "integer*8" format +# may not work. +if test "$NOF77" = 0 ; then + rm -f conftest* + ac_cv_f77_offset_type_works=no + AC_MSG_CHECKING([that we can use $FORTRAN_MPI_OFFSET to declare MPI_DISPLACMENT_CURRENT]) + cat >conftest.f <>config.log 2>&1 && test -x conftest$EXEEXT ; then + ac_cv_f77_offset_type_works=yes + fi + rm -f conftest* + AC_MSG_RESULT($ac_cv_f77_offset_type_works) + + if test "$ac_cv_f77_offset_type_works" != "yes" -a -n "$MPI_OFFSET_KIND_VAL"; then + AC_MSG_CHECKING([whether we can use KIND with the selected F77 compiler $F77]) + ac_cv_f77_allows_offset_kind=no + rm -f conftest* + cat >conftest.f <>config.log 2>&1 && test -x conftest$EXEEXT ; then + ac_cv_f77_allows_offset_kind=yes + fi + rm -f conftest* + AC_MSG_RESULT($ac_cv_f77_allows_offset_kind) + if test "$ac_cv_f77_allows_offset_kind" ; then + FORTRAN_MPI_OFFSET="integer (kind=$MPI_OFFSET_KIND_VAL)" + else + AC_MSG_WARN([Could not find a way to declare an integer type corresponding to MPI_Offset in Fortran.]) + fi + fi +fi + +# +# check if MPI_Info functions are defined in the MPI implementation +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + PAC_MPI_INFO +else + AC_DEFINE(HAVE_MPI_INFO,1,[Define if MPI Info is available]) + HAVE_MPI_INFO="#define HAVE_MPI_INFO" + MPI_FINFO1="!" + MPI_FINFO2="!" + MPI_FINFO3="!" + MPI_FINFO4="!" +fi +# +if test -n "$mpi_sgi"; then +dnl if test -z "$HAVE_MPI_INFO" ; then +dnl PAC_CHECK_MPI_SGI_INFO_NULL # is MPI_INFO_NULL defined in mpi.h? +dnl fi + PAC_TEST_MPI_SGI_type_is_contig + PAC_TEST_MPI_COMBINERS + PAC_TEST_MPI_HAVE_OFFSET_KIND +fi +# +# check if darray and subarray constructors are defined in the MPI +# implementation +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + PAC_MPI_DARRAY_SUBARRAY +fi +if test $FROM_MPICH2 = yes ; then + dnl Made this a message instead of a warning because the warning is + dnl likely to confuse users. + AC_MSG_RESULT([Overriding Array test for MPICH2]) + unset BUILD_MPI_ARRAY + AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY,1,[Define if Darray is available]) + HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" + MPI_FARRAY1="!" + MPI_FARRAY2="!" + MPI_FARRAY3="!" + MPI_FARRAY4="!" + MPI_FARRAY5="!" + MPI_FARRAY6="!" + MPI_FARRAY7="!" +fi +# +# +# Test for weak symbol support... +# We can't put # in the message because it causes autoconf to generate +# incorrect code +HAVE_WEAK_SYMBOLS=0 +if test -n "$arch_hpux" || test -n "$arch_sppux" ; then +# multiple secondary definitions not allowed by HP compilers +# Fortran interface for HP already uses one secondary defn. +# therefore, do not use this method for profiling interface. +# build profiling interface explicitly. + TRY_WEAK_SYMBOLS=0 +fi +if test $TRY_WEAK_SYMBOLS = 1 ; then + AC_MSG_CHECKING([for weak symbol support]) + AC_TRY_LINK([ +extern int PFoo(int); +#pragma weak PFoo = Foo +int Foo(int a) { return a; } +],[return PFoo(1);],has_pragma_weak=1) + # + # Some systems (Linux ia64 and ecc, for example), support weak symbols + # only within a single object file! This tests that case. + # Note that there is an extern int PFoo declaration before the + # pragma. Some compilers require this in order to make the weak symbol + # extenally visible. +if test "$has_pragma_weak" = 1 ; then + AC_MSG_RESULT([pragma weak]) + AC_MSG_CHECKING([that weak symbols are visible to other files]) + rm -f conftest* + cat >>conftest1.c <>conftest2.c <>conftest1.c <>conftest2.c <> config.log + echo "Failed program was" >> config.log + cat conftest1.c >>config.log + cat conftest2.c >>config.log + if test -s conftest.out ; then cat conftest.out >> config.log ; fi + has_pragma_weak=0 + fi + else + echo "$ac_link2" 1>&AC_FD_CC + echo "Failed program was" 1>&AC_FD_CC + cat conftest1.c 1>&AC_FD_CC + cat conftest2.c 1>&AC_FD_CC + if test -s conftest.out ; then cat conftest.out 1>&AC_FD_CC ; fi + AC_MSG_RESULT(no) + has_pragma_weak=0 + fi + rm -f conftest* + fi + if test "$has_pragma_weak" = 1 ; then + HAVE_WEAK_SYMBOLS=1 + AC_DEFINE(HAVE_PRAGMA_WEAK,1,[Define if pragma weak available]) + else + AC_TRY_LINK([ +extern int PFoo(int); +#pragma _HP_SECONDARY_DEF Foo PFoo +int Foo(int a) { return a; } +],[return PFoo(1);],has_pragma_hp_secondary=1) + if test "$has_pragma_hp_secondary" = 1 ; then + AC_MSG_RESULT([pragma _HP_SECONDARY_DEF]) + HAVE_WEAK_SYMBOLS=1 + AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF,1,[Define for HP weak pragma]) + else + AC_TRY_LINK([ +extern int PFoo(int); +#pragma _CRI duplicate PFoo as Foo +int Foo(int a) { return a; } +],[return PFoo(1);],has_pragma_cri_duplicate=1) + if test "$has_pragma_cri_duplicate" = 1 ; then + AC_MSG_RESULT([pragma _CRI duplicate x as y]) + HAVE_WEAK_SYMBOLS=1 + AC_DEFINE(HAVE_PRAGMA_CRI_DUP,1,[Define for CRAY weak dup]) + else + AC_MSG_RESULT(no) + fi + fi + fi +fi +if test "$HAVE_WEAK_SYMBOLS" = 1 ; then + AC_DEFINE(HAVE_WEAK_SYMBOLS,1,[Define if weak symbols available]) +fi +AC_SUBST(HAVE_WEAK_SYMBOLS) + + + +# +# Check whether the MPI Offset type is compatible with struct flock +AC_MSG_CHECKING([whether struct flock compatible with MPI_Offset]) +AC_TRY_COMPILE([#include ], +[struct flock l; + $MPI_OFFSET_TYPE a=1; + l.l_start = a; + l.l_len = a; +],pac_cv_struct_flock_and_mpi_offset=yes,pac_cv_struct_flock_and_mpi_offset=no) +AC_MSG_RESULT($pac_cv_struct_flock_and_mpi_offset) +# FIXME: We should look for struct flock64 and the F_SETLK64/F_GETLK64 +# ADIOI_Set_lock could use these instead. +if test "$pac_cv_struct_flock_and_mpi_offset" = no ; then + AC_MSG_CHECKING([whether struct flock compatible with int]) + AC_TRY_COMPILE([#include ], +[struct flock l; + int a=1; + l.l_start = a; + l.l_len = a; +],pac_cv_struct_flock_and_int=yes,pac_cv_struct_flock_and_int=no) + AC_MSG_RESULT($pac_cv_struct_flock_and_int) + if test "$pac_cv_struct_flock_and_int" = yes ; then + AC_DEFINE(NEEDS_INT_CAST_WITH_FLOCK,1,[Define if l_start and l_len data should be cast as int]) + fi + # FIXME. Solaris header files define off_t as a UNION if 64bit file + # sizes are selected. Gah! +fi + +# +# if FILE_SYSTEM is not set above, use ufs and nfs as default +# +if test -z "$FILE_SYSTEM" ; then + file_system_ufs=1 + file_system_nfs=1 + FILE_SYSTEM="ufs nfs" +fi + +# no matter what, always build testfs +file_system_testfs=1 +FILE_SYSTEM="testfs $FILE_SYSTEM" + +# An attempt to "do the right thing" with as little help from the end-user as +# possible: +# - if 'with-pvfs2' given, use that to find pvfs2-config. complain if we +# cannot find it, as this is probably what the user would expect +# - if we can find 'pvfs2-config' in our path, we can use it to set CFLAGS, +# LIBS, and LDFLAGS accordingly +# - as a fallback, use CFLAGS, LIBS, and LDFLAGS passed in by the user +# - don't do any of this if --with-file-system was given and did not include +# 'pvfs2': i.e. don't surprise the user with pvfs support. + +AC_PATH_PROG(PVFS2_CONFIG, pvfs2-config, notfound, [${with_pvfs2}/bin:$PATH]) +if test $PVFS2_CONFIG != "notfound" ; then + if test -n "${with_pvfs2}" -o -n "${file_system_pvfs2}" ; then + # the user either told us where pvfs is or asked for it in + # --with-file-system (or both) + CFLAGS="$CFLAGS $( $PVFS2_CONFIG --cflags)" + LIBS="$LIBS $( $PVFS2_CONFIG --libs)" + FILE_SYSTEM="pvfs2 $FILE_SYSTEM" + file_system_pvfs2=1 + fi +fi + +if test "$PVFS2_CONFIG" = "notfound" -a -n "$with_pvfs2" ; then + AC_MSG_ERROR([pvfs2-config not found in $with_pvfs2]) +fi + +# +# Print list of configured file systems +# +# TODO: REMOVE BAD ONES FROM THE LIST SOMEHOW? +# +AC_MSG_CHECKING([configured file systems]) +AC_MSG_RESULT([$FILE_SYSTEM]) + +if test -n "$file_system_nfs" ; then + AC_DEFINE(ROMIO_NFS,1,[Define for ROMIO with NFS]) + AC_MSG_WARN([File locks may not work with NFS. See the Installation and +users manual for instructions on testing and if necessary fixing this]) +fi + +if test -n "$file_system_panfs"; then + AC_DEFINE(ROMIO_PANFS,1,[Define for ROMIO with PANFS]) +fi +if test -n "$file_system_ufs"; then + AC_DEFINE(ROMIO_UFS,1,[Define for ROMIO with UFS]) +fi +if test -n "$file_system_bgl"; then + AC_DEFINE(ROMIO_BGL,1,[Define for ROMIO with BGL]) +fi +if test -n "$file_system_bglockless"; then + if test x"$file_system_bgl" = x ; then + AC_MSG_ERROR("bglockless requested without bgl") + fi + AC_DEFINE(ROMIO_BGLOCKLESS,1,[Define for lock-free ROMIO with BGL]) +fi +if test -n "$file_system_hfs"; then + AC_DEFINE(ROMIO_HFS,1,[Define for ROMIO with HFS]) +fi +if test -n "$file_system_sfs"; then + AC_DEFINE(ROMIO_SFS,1,[Define for ROMIO with SFS]) +fi + +if test -n "$file_system_pfs"; then + AC_DEFINE(ROMIO_PFS,1,[Define for ROMIO with PFS]) +fi + +if test -n "$file_system_testfs"; then + AC_DEFINE(ROMIO_TESTFS,1,[Define for ROMIO with TESTFS]) +fi +# +# Verify presence of lustre/lustre_user.h +# +if test -n "$file_system_lustre"; then + AC_CHECK_HEADERS(lustre/lustre_user.h, + AC_DEFINE(ROMIO_LUSTRE,1,[Define for ROMIO with LUSTRE]), + AC_MSG_ERROR([LUSTRE support requested but cannot find lustre/lustre_user.h header file]) + ) +fi + +if test -n "$file_system_xfs"; then + AC_DEFINE(ROMIO_XFS,1,[Define for ROMIO with XFS]) + # Check for memalign value + AC_CACHE_CHECK([for memory alignment needed for direct I/O], + pac_cv_memalignval, + [ + rm -f confmemalignval + rm -f /tmp/romio_tmp.bin + AC_TRY_RUN([ +#include +#include +#include +#include +int main(int argc, char **argv) { + struct dioattr st; + int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644); + FILE *f=fopen("confmemalignval","w"); + if (fd == -1) exit(1); + if (!f) exit(1); + fcntl(fd, F_DIOINFO, &st); + fprintf( f, "%u\n", st.d_mem); + exit(0); + } + ], + pac_cv_memalignval=`cat confmemalignval`, + pac_cv_memalignval="unknown",pac_cv_memalignval="unknown" + ) + rm -f confmemalignval + rm -f /tmp/romio_tmp.bin + ]) + if test -n "$pac_cv_memalignval" -a "$pac_cv_memalignval" != 0 -a \ + "$pac_cv_memalignval" != "unknown" ; then + CFLAGS="$CFLAGS -DXFS_MEMALIGN=$pac_cv_memalignval" + else + AC_MSG_RESULT(assuming 128 for memory alignment) + CFLAGS="$CFLAGS -DXFS_MEMALIGN=128" + fi +fi + +# +# Verify presence of pvfs.h, issue with int64 +# +if test -n "$file_system_pvfs"; then + CPPFLAGS="$CPPFLAGS $CFLAGS" + AC_CHECK_HEADERS(pvfs.h, + AC_DEFINE(ROMIO_PVFS,1,[Define for ROMIO with PVFS]), + AC_MSG_ERROR([PVFS support requested but cannot find pvfs.h header file]) + ) + # Check for missing int64_t (intel version 8 compiler and -no-gcc + # selected) + AC_MSG_CHECKING([that pvfs.h can be compiled]) + AC_TRY_COMPILE([ +#include + ],[ + ],pvfs_header_ok=yes,pvfs_header_ok=no + ) + AC_MSG_RESULT($pvfs_header_ok) + if test "$pvfs_header_ok" = no -a "$ac_cv_sizeof_long_long" = 8 ; then + AC_MSG_CHECKING([if pvfs.h can be compiled if we define int64_t]) + # Try again, but with int64_t + AC_TRY_COMPILE([ + typedef long long int int64_t; +#include + ],[ + ], + pvfs_header_ok="yes with int64 definition" + ) + AC_MSG_RESULT($pvfs_header_ok) + fi + if test "$pvfs_header_ok" = "yes with int64 definition" ; then + AC_DEFINE(ROMIO_PVFS_NEEDS_INT64_DEFINITION,1,[Define if int64_t must be defined for PVFS]) + fi + if test "$pvfs_header_ok" != "no" ; then + AC_DEFINE(ROMIO_PVFS,1,[Define for ROMIO with PVFS]) + AC_DEFINE(HAVE_PVFS_SUPER_MAGIC, 1, [Define if PVFS_SUPER_MAGIC defined.]) + else + AC_MSG_WARN(missing or broken pvfs.h header file; disabling ROMIO PVFS support) + fi +fi + + + +if test -n "$file_system_zoidfs"; then + AC_CHECK_HEADERS(zoidfs.h, + AC_DEFINE(ROMIO_ZOIDFS,1,[Define for ROMIO with ZoidFD]), + AC_MSG_ERROR([ZoidFS support requested but cannot find zoidfs.h header file]) + ) +fi + +# +# Verify presence of pvfs2.h +# +if test -n "$file_system_pvfs2"; then + CPPFLAGS="$CPPFLAGS $CFLAGS" + AC_CHECK_HEADERS(pvfs2.h, + AC_DEFINE(ROMIO_PVFS2,1,[Define for ROMIO with PVFS2]) + AC_DEFINE(HAVE_PVFS2_SUPER_MAGIC, 1, [Define if PVFS2_SUPER_MAGIC defined.]), + AC_MSG_ERROR([PVFS2 support requested but cannot find pvfs2.h header file]) + ) +fi + +# layout change after pvfs-2.6.3: +if test -n "$file_system_pvfs2"; then + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ +#include +#include "pvfs2.h" + int main(int argc, char **argv) { + PVFS_object_ref ref; + PVFS_sys_attr attr; + PVFS_sys_create(NULL, ref, attr, NULL, NULL, NULL, NULL); + return 0; } + ])], + , AC_DEFINE(HAVE_PVFS2_CREATE_WITHOUT_LAYOUT, 1, + [Define if PVFS_sys_create does not have layout parameter]) + ) +fi + + +if test -n "$file_system_gridftp"; then + AC_DEFINE(ROMIO_GRIDFTP, 1, [Define for ROMIO with gridftp]) +fi + +if test -n "$file_system_bgl"; then + SYSDEP_INC=-I${prefix}/include +else + SYSDEP_INC= + +# Check for presence and characteristics of async. I/O calls if +# not disabled. + +# Some systems need pthreads to get AIO to work. However, we don't want +# to add pthreads just because it is there, as that can cause problems +# with some implementations of pthreads and compilers (e.g., gcc version 3 +# would fail if there was an int a[100000] on the stack if the application +# was *linked* with pthreads, but would succeed if the application was +# *not linked* with pthreads. +# +if test "x$disable_aio" = "xno" ; then + AC_SEARCH_LIBS(aio_write,aio rt,aio_write_found=yes,aio_write_found=no) + if test "$aio_write_found" = no ; then + # If not found, try finding pthread_create first, and if + # found, try the test again. + AC_SEARCH_LIBS(pthread_create,pthread,foundPTHREAD=yes,foundPTHREAD=no) + if test "$foundPTHREAD" = yes ; then + AC_SEARCH_LIBS(aio_write,aio rt,aio_write_found=yes,aio_write_found=no) + fi + fi +fi + +if test "x$disable_aio" = "xno" -a -n "$aio_write_found" ; then + AC_CHECK_HEADERS(signal.h) + # Just because aio.h is found by CPP doesn't mean that we can use it + # We try to compile it, not just read it. + AC_MSG_CHECKING([if aio.h exists and can be compiled]) + AC_TRY_COMPILE([ +#include +#include ], +[],have_aio_h=yes,have_aio_h=no) + AC_MSG_RESULT($have_aio_h) + if test "$have_aio_h" = yes ; then + AC_DEFINE(HAVE_AIO_H,1,[Define if aio.h exists and can be compiled]) + fi + + AC_MSG_CHECKING([if sys/aio.h exists and can be compiled]) + AC_TRY_COMPILE([ +#include +#include ], +[],have_sys_aio_h=yes,have_sys_aio_h=no) + AC_MSG_RESULT($have_sys_aio_h) + if test "$have_sys_aio_h" = yes ; then + AC_DEFINE(HAVE_SYS_AIO_H,1,[Define if sys/aio.h exists and can be compiled]) + fi + if test "$have_aio_h" = "no" -a "$have_sys_aio_h" = "no" ; then + disable_aio=yes + fi +fi + +if test "$have_aio_h" = "yes" -o "$have_sys_aio_h" = "yes" -o "x$disable_aio" = "xno"; then + + # Check that aio is available (many systems appear to have aio + # either installed improperly or turned off). + # The test is the following: if not cross compiling, try to run a + # program that includes a *reference* to aio_write but does not call it + # If the libraries are not set up correctly, then this will fail. + + AC_MSG_CHECKING([whether aio routines can be used]) + # Include aio.h and the aiocb struct (since we'll need these to + # actually use the aio_write interface). Note that this will + # fail for some pre-POSIX implementations of the aio interface + # (an old IBM interface needs an fd argument as well) + AC_TRY_RUN([ +#include +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + int main(int argc, char **argv) + { + struct aiocb *aiocbp; + if (argc > 10) aio_write(aiocbp); + return 0; + } + ], + aio_runs=yes + AC_MSG_RESULT(yes), + aio_runs=no + AC_MSG_RESULT(no), + aio_runs=no + AC_MSG_RESULT(no: aio routines disabled when cross compiling) + ) + if test "$aio_runs" != "no" ; then + AC_DEFINE(ROMIO_HAVE_WORKING_AIO, 1, Define if AIO calls seem to work) + fi + + # now about that old IBM interface... + # modern AIO interfaces have the file descriptor in the aiocb structure, + # and will set ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES. Old IBM + # implementations pass the file descriptor as an argument to aio_write and + # aio_read. AIO still works on these platforms, but we have to test with + # two-argument aio_write to avoid a false negative. no need to worry about + # the two-argument vs. one-argument aio_write and aio_read: ROMIO already + # uses ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES to call aio_write and + # aio_read correctly + + AC_MSG_CHECKING([for obsolete two-argument aio_write]) + AC_TRY_RUN([ +#include +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + int main(int argc, char **argv) + { + int fd; + struct aiocb *aiocbp; + if (argc > 10) aio_write(fd, aiocbp); + return 0; + } + ], + aio_two_arg_write=yes + AC_MSG_RESULT(yes), + aio_two_arg_write=no + AC_MSG_RESULT(no), + aio_two_arg_write=no + AC_MSG_RESULT(no: cannot test when cross-compiling) + ) + + if test "$aio_two_arg_write" != "no" -a "$aio_runs" != "yes" ; then + AC_DEFINE(ROMIO_HAVE_WORKING_AIO, 1, Define if AIO calls seem to work) + AC_DEFINE(ROMIO_HAVE_AIO_CALLS_NEED_FILEDES, 1, Define if AIO calls need file descriptor) + fi + + AC_MSG_CHECKING([for obsolete two-argument aio_suspend]) + AC_TRY_RUN([ +#include +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + int main(int argc, char **argv) + { + struct aiocb *aiocbp; + if (argc > 10) aio_suspend(1, &aiocbp); + return 0; + } + ], + aio_two_arg_suspend=yes + AC_MSG_RESULT(yes), + aio_two_arg_suspend=no + AC_MSG_RESULT(no), + aio_two_arg_suspend=no + AC_MSG_RESULT(no: cannot test when cross compiling) + ) + + if test "$aio_two_arg_suspend" != "no" -a "$aio_runs" != "yes" ; then + AC_DEFINE(ROMIO_HAVE_AIO_SUSPEND_TWO_ARGS, 1, Define if aio_suspend needs two arguments) + fi + + AC_MSG_CHECKING([for aio_fildes member of aiocb structure]) + AC_TRY_COMPILE([ +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + ],[ + struct aiocb a; + a.aio_fildes = 0; + ], + AC_MSG_RESULT(yes) + AC_DEFINE(ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_FILDES, 1, [Define if aiocb has aio_fildes member]), + AC_MSG_RESULT(no) + ) + AC_MSG_CHECKING(for aio_whence member of aiocb structure) + AC_TRY_COMPILE([ +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif +#include +#include + ],[ + struct aiocb a; + a.aio_whence = SEEK_SET; + ], + AC_MSG_RESULT(yes) + AC_DEFINE(ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_WHENCE, 1, [Define if aiocb has aio_whence member]), + AC_MSG_RESULT(no) + ) + AC_MSG_CHECKING(for aio_handle member of aiocb structure) + AC_TRY_COMPILE([ +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + ],[ + struct aiocb a; + aio_handle_t h; + + a.aio_handle = h; + ], + AC_MSG_RESULT(yes) + AC_DEFINE(ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_HANDLE, 1, [Define if aiocb has aio_handle member]), + AC_MSG_RESULT(no) + ) + AC_MSG_CHECKING(for aio_reqprio member of aiocb structure) + AC_TRY_COMPILE([ +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + ],[ + struct aiocb a; + + a.aio_reqprio = 0; + ], + AC_MSG_RESULT(yes) + AC_DEFINE(ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_REQPRIO, 1, [Define if aiocb has aio_reqprio member]), + AC_MSG_RESULT(no) + ) + AC_MSG_CHECKING(for aio_sigevent member of aiocb structure) + AC_TRY_COMPILE([ +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_AIO_H +#include +#endif +#ifdef HAVE_SYS_AIO_H +#include +#endif + ],[ + struct aiocb a; + + a.aio_sigevent.sigev_signo = 0; + ], + AC_MSG_RESULT(yes) + AC_DEFINE(ROMIO_HAVE_STRUCT_AIOCB_WITH_AIO_SIGEVENT, 1, [Define if aiocb has aio_sigevent member]), + AC_MSG_RESULT(no) + ) + +fi +fi +# End of aio-related tests + +# +# Check for statfs (many) and specifically f_fstypename field (BSD) +# +AC_CHECK_HEADERS(sys/vfs.h sys/param.h sys/mount.h sys/statvfs.h) +AC_MSG_CHECKING([whether struct statfs properly defined]) +AC_TRY_COMPILE([ +#ifdef HAVE_SYS_VFS_H +#include +#endif +#ifdef HAVE_SYS_STATVFS_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif + ],[ + struct statfs f; + ], + pac_cv_have_statfs=yes,pac_cv_have_statfs=no +) +AC_MSG_RESULT($pac_cv_have_statfs) +# At this point, we could check for whether defining +# __SWORD_TYPE as sizet_t or int/long (size of pointer) +# would help. FIXME + +if test "$pac_cv_have_statfs" = yes ; then + AC_DEFINE(HAVE_STRUCT_STATFS,1,[Define if struct statfs can be compiled]) +fi + +AC_MSG_CHECKING([for f_fstypename member of statfs structure]) +AC_TRY_COMPILE([ +#include +#include +#include + ],[ + struct statfs f; + memset(&f, 0, sizeof(f)); + strncmp("nfs", f.f_fstypename, 3); + ], + pac_cv_have_statfs_f_fstypename=yes, + pac_cv_have_statfs_f_fstypename=no +) +AC_MSG_RESULT($pac_cv_have_statfs_f_fstypename) +if test $pac_cv_have_statfs_f_fstypename = yes ; then + AC_DEFINE(ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME, 1,[Define if statfs has f_fstypename]) +fi + +# +# Check for stat and st_fstype field (NEC SX4) +# +AC_CHECK_HEADERS(sys/stat.h sys/types.h unistd.h) +AC_CHECK_FUNCS(stat, + AC_DEFINE(HAVE_STAT, 1, Define if stat function is present) + AC_MSG_CHECKING([for st_fstype member of stat structure]) + AC_TRY_COMPILE([ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + ],[ + struct stat s; + + s.st_fstype = NULL; + ], + AC_MSG_RESULT(yes) + AC_DEFINE(ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE, 1, Define if struct stat has a st_fstype member), + AC_MSG_RESULT(no) + ) +) + +# +# Check for statvfs and f_basetype field (Solaris, Irix, AIX, etc.) +# +AC_CHECK_HEADERS(sys/types.h sys/statvfs.h sys/vfs.h) +AC_CHECK_FUNCS(statvfs, + AC_DEFINE(HAVE_STATVFS, 1, Define if statvfs function is present) + AC_MSG_CHECKING([for f_basetype member of statvfs structure]) + AC_TRY_COMPILE([ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif +#ifdef HAVE_SYS_STATVFS_H +#include +#endif + ], [[ + struct statvfs foo; + + foo.f_basetype[0] = 'a'; + ]], + AC_MSG_RESULT(yes) + AC_DEFINE(ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE, 1, defined if struct statvfs has a f_basetype member), + AC_MSG_RESULT(no) + ) +) + +# +# Check for large file support. Make sure that we can use the off64_t +# type (in some cases, it is an array, and the ROMIO code isn't prepared for +# that). +# +AC_CHECK_HEADERS(unistd.h) +if test "$ac_cv_header_unistd_h" = "yes" ; then + AC_CACHE_CHECK([for large file defines],ac_cv_has_large_file_defines,[ + AC_TRY_COMPILE([ +#include + ], [ +#ifndef _LFS64_LARGEFILE +#error no largefile defines +#endif + ],ac_cv_has_large_file_defines=yes,ac_cv_has_large_file_defines=no)]) + if test "$ac_cv_has_large_file_defines" = "yes" ; then + # See if we can use them + AC_CACHE_CHECK([whether off64_t is an scalar type],ac_cv_off64_t_scalar,[ + AC_TRY_COMPILE([ +#define _LARGEFILE64_SOURCE +#define _FILE_OFFSET_BITS 64 +#include +#include +],[off64_t a = 3;],ac_cv_off64_t_scalar=yes,ac_cv_off64_t_scalar=no)]) + + if test "$ac_cv_off64_t_scalar" = "yes" ; then + CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" + fi + fi +fi + + +#################################################################### +# We're about to mess with CC etc. No more feature tests past here, +# because we may set CC to something that does not yet exist! +#################################################################### + +if test -n "$mpi_mpich"; then + if test -z "$arch_SX4" ; then + MPIOF_H_INCLUDED=1 + fi + if test "$FROM_MPICH2" = no; then + AC_DEFINE(NEEDS_MPI_TEST,1,[Define if mpi_test needed]) + AC_DEFINE(MPICH,1,[Define if using MPICH]) + fi +fi + +if test -n "$mpi_sgi"; then + AC_DEFINE(MPISGI,1,[Define if SGI MPI]) +fi + +if test -n "$mpi_lam"; then + AC_DEFINE(MPILAM,1,[Define if using LAM/MPI]) +fi + +if test -n "$mpi_hp"; then + AC_DEFINE(MPIHP,1,[Define if using HP MPI]) + if test "$NOF77" = 0; then + PAC_CHECK_MPIOF_H + fi +fi +# +AC_CHECK_FUNCS(strerror) +if test -z "$srcdir" -o "$srcdir" = "." ; then srcdir="$ROMIO_HOME" ; fi +AC_SUBST(srcdir) +# The master_top_srcdir is the location of the source for the building +# package. This is used only as part of the MPICH2 build, including +# the documentation targets mandoc, htmldoc, and latexdoc +if test -z "$master_top_srcdir" ; then + if test "$FROM_MPICH2" = yes ; then + AC_MSG_WARN([Could not determine master_top_srcdir]) + fi +fi +AC_SUBST(master_top_srcdir) +# +# Get the master builddir (which may be imported from above) +if test -z "$master_top_builddir" ; then + master_top_builddir=`pwd` +fi +export master_top_builddir +AC_SUBST(master_top_builddir) +# Make sure the alternate spelling is used until we clean up all of the code +master_topbuild_dir=$master_top_builddir +export master_topbuild_dir +AC_SUBST(master_topbuild_dir) + +# The following definitions are needed within adio/common/status_setb.c +if test "$FROM_MPICH" = yes ; then + AC_DEFINE(MPICH,1,[Define if compiling within MPICH]) +elif test "$FROM_MPICH2" = yes ; then + AC_DEFINE(ROMIO_INSIDE_MPICH2,1,[Define if compiling within MPICH2]) +elif test "$FROM_MPILAM" = yes ; then + AC_DEFINE(MPILAM,1,[Define if compiling within LAM/MPI]) +fi + +if test "$FROM_MPICH2" = no -a "$FROM_MPICH" = no ; then + if test -z "$LIBNAME"; then + LIBNAME="$top_build_dir/lib/libmpio.a" + fi + # + if test ! -d $top_build_dir/lib ; then + mkdir $top_build_dir/lib + fi +else + MPILIBNAME=${MPILIBNAME:-mpich} + if test -z "$LIBNAME" ; then + if test -d "$master_top_builddir/lib" ; then + LIBNAME=$master_top_builddir/lib/lib${MPILIBNAME}.a + else + LIBNAME="$ROMIO_HOME/lib${MPILIBNAME}.a" + fi + fi +fi +if test "$FROM_MPICH2" != no ; then + # use the error handlers from MPICH2 + MPIO_EXTRA_OBJECTS= + MPIO_EXTRA_TMP_POBJECTS= + MPIO_EXTRA_REAL_POBJECTS= + # Use generalized request to get the multiple-completion routines + MPIO_REQOBJECTS= + MPIO_REQ_TMP_POBJECTS= + MPIO_REQ_REAL_POBJECTS= +fi +AC_SUBST(MPIO_EXTRA_OBJECTS) +AC_SUBST(MPIO_EXTRA_TMP_POBJECTS) +AC_SUBST(MPIO_EXTRA_REAL_POBJECTS) +AC_SUBST(MPIO_REQOBJECTS) +AC_SUBST(MPIO_REQ_TMP_POBJECTS) +AC_SUBST(MPIO_REQ_REAL_POBJECTS) +# +# Use DOCTEXT instead of doctext +AC_CHECK_PROGS(DOCTEXT,doctext,true) +AC_SUBST(DOCTEXT) +# +if test $NOF77 = 1 ; then + F77=":" +else + FORTRAN_TEST="fperf fcoll_test fmisc pfcoll_test" +fi +# +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + PAC_TEST_MPI + PAC_NEEDS_FINT +else + NEEDS_MPI_FINT="" +fi +# +if test "$MPI_INCLUDE_DIR" = "." ; then + ROMIO_INCLUDE="-I../include" +else + ROMIO_INCLUDE="-I../include -I$MPI_INCLUDE_DIR" +fi +# +TEST_LIBNAME=$LIBNAME +MPIRUN=mpirun +# +# if MPICH, use mpicc in test programs +# +if test "$FROM_MPICH" = yes ; then + MPICH_HOME=`dirname $ROMIO_HOME` + if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi + TEST_CC=$MPI_BIN_DIR/mpicc + MPI_LIB="" + ROMIO_INCLUDE="" + USER_CFLAGS="" + USER_FFLAGS="" + TEST_LIBNAME="" + MPIRUN=$MPI_BIN_DIR/mpirun + if test -n "$arch_SX4" || test -n "$arch_hpux" ; then + TEST_F77=$MPI_BIN_DIR/mpif90 + else + TEST_F77=$MPI_BIN_DIR/mpif77 + fi + CC=$MPI_BIN_DIR/mpicc + # A later test will insert the mpi2-other/info and array directories based + # on the value of BUILD_MPI_xxxx. This lets MPICH2 turn these off, + # since MPICH2 provides these routines elsewhere + EXTRA_DIRS="mpi-io/fortran" + # Some older implementations of the ADI do not include the + # MPID_Status_set_bytes routine. This uses either the + # environment variable ADI3_WITHOUT_SET_BYTES or the + # with arg --without-setbytes + if test "$ADI2_WITHOUT_SET_BYTES" != yes -a \ + "$with_setbytes" != no ; then + AC_DEFINE(HAVE_STATUS_SET_BYTES,1,[Define if have MPIR_Status_set_bytes]) + fi +elif test $FROM_LAM = yes ; then + # LAM does have the status set bytes functionality + AC_DEFINE(HAVE_STATUS_SET_BYTES,1,[Define if have MPIR_Status_set_bytes]) + + # Used in the tests/ subdirectory for after ROMIO is built + TEST_CC=mpicc + TEST_F77=mpif77 + MPIRUN=mpirun + MPI_LIB= + ROMIO_INCLUDE= + USER_CFLAGS= + USER_FFLAGS= + TEST_LIBNAME= + EXTRA_DIRS="mpi-io/fortran mpi2-other/info mpi2-other/info/fortran mpi2-other/array mpi2-other/array/fortran" +elif test $FROM_MPICH2 = yes ; then + # For now, separate the mpich2 from mpich cases + MPICH_HOME=`dirname $ROMIO_HOME` + MPICH_HOME=`dirname $MPICH_HOME` + MPICH_HOME=`dirname $MPICH_HOME` + if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi + # No special compiler script. + # BUT we need the include paths + # CC="$CC -I${use_top_srcdir}/src/include -I${top_build_dir}/src/include" + # TEST_CC="$CC" + # MPI_LIB="$LIBNAME" + # To allow ROMIO to work with the LIBTOOL scripts, we want to + # work directly with the CC, not the mpicc, compiler. + # Note that in the "FROM_MPICH2" case, the CPPFLAGS and INCLUDES are already + # properly set + #CC=${top_build_dir}/bin/mpicc + # + # set the compilers to the ones in MPICH2 bin directory (master_top_builddir/bin) + TEST_CC=${master_top_builddir}/bin/mpicc + TEST_F77=${master_top_builddir}/bin/mpif77 + ROMIO_INCLUDE="" + USER_CFLAGS="" + USER_FFLAGS="" + TEST_LIBNAME="" + MPIRUN=${master_top_builddir}/bin/mpiexec + # + # Turn off the building of the Fortran interface and the Info routines + EXTRA_DIRS="" + AC_DEFINE(HAVE_STATUS_SET_BYTES,1,[Define if status_set_bytes available]) + DEFINE_HAVE_MPI_GREQUEST="#define HAVE_MPI_GREQUEST 1" + AC_DEFINE(HAVE_MPIU_FUNCS,1,[Define if MPICH2 memory tracing macros defined]) +fi +# +# +# feature tests: we can't test features if building as part of MPICH because +# we don't yet have an implementation against which we can test +# +if test $WITHIN_KNOWN_MPI_IMPL = no ; then + PAC_TEST_MPIR_STATUS_SET_BYTES + PAC_TEST_MPI_GREQUEST + PAC_TEST_MPIU_FUNCS + AC_DEFINE(PRINT_ERR_MSG,1,[Define for printing error messages]) +fi +# +if test -z "$TEST_CC" ; then + TEST_CC="$CC" +fi +if test -z "$TEST_F77" ; then + TEST_F77="$F77" +fi +# +AC_CHECK_FUNCS(strdup) +if test "$ac_cv_func_strdup" = "yes" ; then + # Do we need to declare strdup? + PAC_FUNC_NEEDS_DECL([#include ],strdup) +fi +AC_CHECK_FUNCS(snprintf) +if test "$ac_cv_func_snprintf" = "yes" ; then + # Do we need to declare snprintf? + PAC_FUNC_NEEDS_DECL([#include ],snprintf) +fi +AC_CHECK_FUNCS(lstat) +if test "$ac_cv_func_lstat" = "yes" ; then + # Do we need to declare lstat? + PAC_FUNC_NEEDS_DECL([#include ],lstat) +fi +AC_CHECK_FUNCS(readlink) +if test "$ac_cv_func_readlink" = "yes" ; then + # Do we need to declare readlink? + PAC_FUNC_NEEDS_DECL([#include ],readlink) +fi +AC_CHECK_FUNCS(fsync) +if test "$ac_cv_func_fsync" = "yes" ; then + # Do we need to declare fsync? + PAC_FUNC_NEEDS_DECL([#include ],fsync) +fi +AC_CHECK_FUNCS(ftruncate) +if test "$ac_cv_func_ftruncate" = "yes" ; then + # Do we need to declare ftruncate? + PAC_FUNC_NEEDS_DECL([#include ],ftruncate) +fi + +AC_CHECK_FUNCS(lseek64) +if test "$ac_cv_func_lseek64" = "yes" ; then + PAC_FUNC_NEEDS_DECL([#include ],lseek64) +fi +# +# Create the directory lists for the Makefile +FILE_SYS_DIRS="" +for dir in $FILE_SYSTEM ; do + FILE_SYS_DIRS="$FILE_SYS_DIRS adio/ad_$dir" +done +EXTRA_SRC_DIRS="" +GLUE_DIR="" +if test "$FROM_MPICH2" = yes -o "${MPI_IMPL}_mpi" = "mpich2_mpi"; then + GLUE_DIR="mpi-io/glue/mpich2" +elif test "$FROM_MPICH" = yes -o "${MPI_IMPL}_mpi" = "mpich_mpi"; then + GLUE_DIR="mpi-io/glue/mpich1" +else + GLUE_DIR="mpi-io/glue/default" +fi +if test "$BUILD_MPI_INFO" = 1 ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi2-other/info" + if test "$NOF77" = 0 -a "$FROM_MPICH2" != yes ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi2-other/info/fortran" + fi +fi +if test "$BUILD_MPI_ARRAY" = 1 ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi2-other/array" + if test "$NOF77" = 0 -a "$FROM_MPICH2" != yes ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi2-other/array/fortran" + fi +fi +if test "$NOF77" = 0 -a "$FROM_MPICH2" != yes ; then + EXTRA_SRC_DIRS="$EXTRA_SRC_DIRS mpi-io/fortran" +fi +AC_SUBST(EXTRA_SRC_DIRS) +AC_SUBST(FILE_SYS_DIRS) +AC_SUBST(GLUE_DIR) + +# +CFLAGS="$CFLAGS -DHAVE_ROMIOCONF_H" +# + +if test -n "$MPIOF_H_INCLUDED"; then + F77MPIOINC="" +else + F77MPIOINC="include 'mpiof.h'" +fi + +AC_CHECK_HEADERS(unistd.h, + AC_MSG_CHECKING([for large file defines]) + AC_TRY_COMPILE([ + #include + ], [ + #ifndef _LFS64_LARGEFILE + #error no largefile defines + #endif + ], + CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" + AC_MSG_RESULT(yes), + AC_MSG_RESULT(none) ) + ) + + +# for BlueGene, this routine helps us know how much memory is left, and if we +# need to fall back to less memory-intensive algorithms +AC_CHECK_HEADERS(spi/kernel_interface.h) +AC_CHECK_FUNCS(Kernel_GetMemorySize) + + +echo "setting SYSDEP_INC to $SYSDEP_INC" +AC_SUBST(SYSDEP_INC) + +AC_C_RESTRICT +PAC_C_GNU_ATTRIBUTE + +echo "setting CC to $CC" +echo "setting F77 to $F77" +echo "setting TEST_CC to $TEST_CC" +echo "setting TEST_F77 to $TEST_F77" +echo "setting CFLAGS to $CFLAGS" +echo "setting USER_CFLAGS to $USER_CFLAGS" +echo "setting USER_FFLAGS to $USER_FFLAGS" + +AC_SUBST(ARCH) +AC_SUBST(FILE_SYSTEM) +AC_SUBST(CC) +AC_SUBST(CPPFLAGS) +AC_SUBST(CFLAGS) +AC_SUBST(USER_CFLAGS) +AC_SUBST(USER_FFLAGS) +AC_SUBST(MIPS) +AC_SUBST(BITS) +AC_SUBST(AR) +AC_SUBST(AR_FLAGS) +AC_SUBST(RANLIB) +AC_SUBST(MPI_INCLUDE_DIR) +AC_SUBST(MPI_LIB) +AC_SUBST(F77) +AC_SUBST(NOF77) +AC_SUBST(NOPROFILE) +AC_SUBST(MAKE) +AC_SUBST(arch_IRIX) +AC_SUBST(ROMIO_HOME) +AC_SUBST(LIBNAME) +AC_SUBST(TEST_LIBNAME) +AC_SUBST(LL) +AC_SUBST(F77GETARG) +AC_SUBST(F77IARGC) +AC_SUBST(F77MPIOINC) +AC_SUBST(FTESTDEFINE) +AC_SUBST(FORTRAN_MPI_OFFSET) +AC_SUBST(FROM_MPICH) +AC_SUBST(FROM_MPICH2) +AC_SUBST(FROM_LAM) +AC_SUBST(WITHIN_KNOWN_MPI_IMPL) +AC_SUBST(NEEDS_MPI_FINT) +AC_SUBST(HAVE_MPI_INFO) +AC_SUBST(BUILD_MPI_INFO) +AC_SUBST(HAVE_MPI_DARRAY_SUBARRAY) +AC_SUBST(BUILD_MPI_ARRAY) +AC_SUBST(DEFINE_MPI_OFFSET) +AC_SUBST(DEFINE_HAVE_MPI_GREQUEST) +AC_SUBST(MPI_OFFSET_TYPE) +AC_SUBST(MPI_FINFO1) +AC_SUBST(MPI_FINFO2) +AC_SUBST(MPI_FINFO3) +AC_SUBST(MPI_FINFO4) +AC_SUBST(MPI_FARRAY1) +AC_SUBST(MPI_FARRAY2) +AC_SUBST(MPI_FARRAY3) +AC_SUBST(MPI_FARRAY4) +AC_SUBST(MPI_FARRAY5) +AC_SUBST(MPI_FARRAY6) +AC_SUBST(MPI_FARRAY7) +AC_SUBST(MPI_OFFSET_KIND1) +AC_SUBST(MPI_OFFSET_KIND2) +AC_SUBST(MPIO_REQOBJECTS) +AC_SUBST(TEST_CC) +AC_SUBST(TEST_F77) +AC_SUBST(ROMIO_INCLUDE) +AC_SUBST(ROMIO_LFLAGS) +AC_SUBST(ROMIO_TCFLAGS) +AC_SUBST(ROMIO_TCPPFLAGS) +AC_SUBST(ROMIO_TFFLAGS) +AC_SUBST(MPIRUN) +AC_SUBST(FORTRAN_TEST) +dnl +dnl Dependency handling +AC_SUBST(MAKE_DEPEND_C) +dnl +dnl Support shared libraries +if test -z "$ENABLE_SHLIB" ; then + ENABLE_SHLIB=none +fi +AC_SUBST(ENABLE_SHLIB) +AC_SUBST(CC_SHL) +AC_SUBST(LIBTOOL) +# Remove the .a from the library file name (so that we can use .so or +# other appropriate suffix) +SHLIBNAME=`echo $LIBNAME | sed 's/\.a$//'` +AC_SUBST(SHLIBNAME) +dnl +if test ! -d adio ; then mkdir adio ; fi +if test ! -d adio/include ; then mkdir adio/include ; fi +if test ! -d mpi2-other ; then mkdir mpi2-other ; fi +if test ! -d mpi-io ; then mkdir mpi-io ; fi +if test ! -d mpi-io/glue ; then mkdir mpi-io/glue ; fi +# +# Make sure we remove any configuration file incase there is out-of-date data. +# We remove the version in include in case this is a vpath build +rm -f adio/include/romioconf.h ${use_top_srcdir}/src/mpi/romio/adio/include/romioconf.h ${use_top_srcdir}/adio/include/romioconf.h +# +# Create makefiles for all of the adio devices. Only the ones that +# are active will be called by the top level ROMIO make +AC_OUTPUT_COMMANDS([chmod 755 util/romioinstall test/runtests]) +AC_OUTPUT(Makefile localdefs mpi-io/Makefile mpi2-other/info/Makefile \ + mpi2-other/array/Makefile adio/common/Makefile \ + test/Makefile test/misc.c test/large_file.c \ + test/runtests test-internal/Makefile util/romioinstall \ + include/mpio.h \ + include/mpiof.h \ + adio/ad_nfs/Makefile adio/ad_ufs/Makefile \ + adio/ad_bgl/Makefile \ + adio/ad_bglockless/Makefile \ + adio/ad_panfs/Makefile \ + adio/ad_xfs/Makefile \ + adio/ad_sfs/Makefile adio/ad_pfs/Makefile \ + adio/ad_testfs/Makefile adio/ad_pvfs/Makefile \ + adio/ad_pvfs2/Makefile \ + adio/ad_gridftp/Makefile \ + adio/ad_lustre/Makefile \ + adio/ad_zoidfs/Makefile \ + mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile \ + mpi2-other/array/fortran/Makefile test/fmisc.f \ + test/fcoll_test.f test/pfcoll_test.f test/fperf.f \ + mpi-io/glue/mpich2/Makefile \ + mpi-io/glue/mpich1/Makefile \ + mpi-io/glue/default/Makefile common/dataloop/Makefile ) +# +rm -f *.o + +if test $FROM_MPICH = no -a $FROM_MPICH2 = no ; then + AC_MSG_RESULT([Configure done. Now type make.]) +fi +dnl PAC_SUBDIR_CACHE_CLEANUP +exit 0 diff --git a/src/libs/ck-libs/ampi/romio/configure2.in b/src/libs/ck-libs/ampi/romio/configure2.in deleted file mode 100644 index 3bacfd7554..0000000000 --- a/src/libs/ck-libs/ampi/romio/configure2.in +++ /dev/null @@ -1,1341 +0,0 @@ -# build with -# autoconf -output=configure2 --localdir=../confdb configure2.in -# (or wherever the confdb is) -# The following usage message is out-of-date -# It is retained only to remind us which options were defined. -usage_msg=" -Usage: ${progname} [-file_system=FILE_SYSTEM] [-arch=ARCH_TYPE] [-mpi=MPI_IMPL] - [-mpiincdir=MPI_INCLUDE_DIR] [-mpilib=MPI_LIBRARY] - [-mpibindir=MPI_BIN_DIR] - [-cc=C_COMPILER] [-fc=FORTRAN_COMPILER] [-nof77] - [-cflags=CFLAGS] [-fflags=FFLAGS] [-f90=F90_COMPILER] [-debug] - [-make=MAKEPGM] [-mpiolib=MPIO_LIBRARY] [-ar_nolocal] - [-noranlib] [-ar=AR_COMMAND] [-prefix=INSTALL_DIR] - [-intsize=INTSIZE] [-ptrsize=PTRSIZE] [-longsize=LONGSIZE] - [-longlongsize=LONGLONGSIZE] [-f90nag] [-disable-weak-symbols] - -where - FILE_SYSTEM = the file system(s) for which ROMIO is to be configured. - Valid values are pfs, piofs, hfs, xfs, sfs, pvfs, ufs, - and nfs (case-sensitive). They correspond to Intel's PFS, - IBM's PIOFS, HP/Convex's HFS, SGI's XFS, NEC's SFS, - Clemson University's PVFS (for Linux clusters), any Unix - file system, and NFS. - To configure for multiple file systems, use "+" as a - separator; e.g., ufs+nfs - ARCH_TYPE = the type of machine for which ROMIO is to be configured. - Not needed on most machines, because ROMIO can usually - find the arch_type on its own. Needed if you are - cross-compiling for a different architecture. - Valid values are sun4, solaris, solaris86, rs6000, - paragon, hpux, sppux, IRIX, IRIX32, IRIXN32, IRIX64, SX4, - alpha, freebsd, LINUX, and LINUX_ALPHA. (case-sensitive) - MPI_IMPL = the MPI implementation with which ROMIO will be used - Valid values are mpich, sgi, hp. (case-sensitive) - Valid implementations are MPICH 1.1.1 or higher, - SGI's MPI 3.1 or higher, HP MPI 1.3 or higher, LAM, - and Cray MPI. - MPI_INCLUDE_DIR = the full path of the directory where mpi.h is located. - Not needed if the directory is in the compiler's - default include path - MPI_LIBRARY = name of the file containing the MPI library (full path). - Not needed if the library is in the compiler's default - list of libraries - MPI_BIN_DIR = the full path of the directory that contains the MPI - versions of the compilers, such as mpicc and mpif77. - Use only if the ROMIO configure cannot find the - necessary commands - C_COMPILER = the C compiler to use. If not specified, ROMIO uses a - default compiler depending on the machine. - FORTRAN_COMPILER = the Fortran compiler to use. If not specified, ROMIO - uses a default compiler depending on the machine. - CFLAGS = flags to give to the C compiler - FFLAGS = flags to give to the Fortran compiler - F90_COMPILER = the Fortran 90 compiler to use. If not specified, - ROMIO uses f90. - MPIO_LIBRARY = name of the MPI-IO library to be built (full path). - Default is "this_directory"/lib/ARCH_TYPE/libmpio.a. - MAKEPGM = name of the make program to use - AR_COMMAND = an alternate archiver (ar) command to use. - INSTALL_DIR = directory where ROMIO is to be installed - INTSIZE = size of int in bytes. - PTRSIZE = size of pointers in bytes. - LONGSIZE = size of long in bytes. - LONGLONGSIZE = size of long long in bytes. - -The options '-mpiincdir' and '-mpilib' may be needed if the MPI include file -and MPI library are not in the compiler's default path. - -The option '-nof77' prevents the compilation of routines that require a -Fortran compiler. If you select this option, you cannot use the -Fortran interface of MPI-IO. - -The option '-f90nag' allows you to use the NAG Fortran 90 compiler -instead of Fortran 77. - -The option '-make' may be used to select an alternate make program. ROMIO -uses "make" by default. - -If '-debug' is used, ROMIO will be configured with the '-g' compiler option -for debugging. - -The option '-ar_nolocal' prevents the library archive command from -attempting to use the local directory for temporary space. This option -should be used when (a) there isn't much space (less than 10 MB) -available in the partition where ROMIO resides and (b) there is enough -space in /tmp (or wherever ar places temporary files by default). - -The option '-noranlib' causes the 'ranlib' step (needed on some systems -to build an object library) to be skipped. This is particularly useful -on systems where 'ranlib' is optional (allowed but not needed; because it -is allowed, configure chooses to use it just in case) but can fail (some -'ranlib's are implemented as scripts using 'ar'; if they don't use the -local directory, they can fail (destroying the library in the process) if -the temporary directory (usually '/tmp') does not have enough space. - -The option -disable-weak-symbols disables the use of weak symbols, even if -available, for building the profiling interface. -" -# -AC_INIT(adio/include/romioconf.h.in) -echo " " -echo "Configuring ROMIO Version 1.2.3" -echo " " -CONFIGURE_ARGS="$*" -if test -n "$CONFIGURE_ARGS" ; then - echo "Configuring with args $CONFIGURE_ARGS" -fi -AC_CONFIG_HEADER(adio/include/romioconf.h) -dnl -NOF77=0 -ARCH="" -arch_IRIX="" -MPI="" -MPI_INCLUDE_DIR="" -ROMIO_INCLUDE="" -MPI_LIB="" -LIBNAME="" -TEST_LIBNAME="" -FILE_SYSTEM="" -DEBUG=no -MIPS=0 -BITS=0 -FROM_MPICH=${FROM_MPICH:-0} -FROM_MPICH2=${FROM_MPICH2:-0} -CFLAGS=${CFLAGS:-""} -LL="\%lld" -AR_LOCAL=l -HAVE_MPI_INFO="" -BUILD_MPI_INFO="" -MPI_FINFO1="" -MPI_FINFO2="" -MPI_FINFO3="" -MPI_FINFO4="" -MPI_FARRAY1="" -MPI_FARRAY2="" -MPI_FARRAY3="" -MPI_FARRAY4="" -MPI_FARRAY5="" -MPI_FARRAY6="" -MPI_FARRAY7="" -DEFS="" -ROMIO_LFLAGS="" -ROMIO_LIBLIST="" -ROMIO_TCFLAGS="" -ROMIO_TCPPFLAGS="" -ROMIO_TFFLAGS="" -NOPROFILE=0 -MPIRUN="" -FORTRAN_TEST="" -MAKE=${MAKE:-"make"} -# foll. needed for f77 test programs -F77GETARG="call getarg(i,str)" -F77IARGC="iargc()" -FTESTDEFINE="" -FORTRAN_MPI_OFFSET="" -MPIOF_H_INCLUDED=0 -MPI_OFFSET_KIND1="!" -MPI_OFFSET_KIND2="!" -F90="" -TEST_CC="" -TEST_F77="" -TRY_WEAK_SYMBOLS=1 -# -known_filesystems="nfs ufs pfs piofs pvfs testfs xfs hfs sfs" -known_mpi_impls="mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi" -# -# Defaults -AC_ARG_ENABLE(aio,[ ---enable-aio - Request use of asynchronous I/O routines],,enable_aio=notgiven) -AC_ARG_ENABLE(echo, -[--enable-echo - Turn on strong echoing. The default is enable=no.] ,set -x) -AC_ARG_ENABLE(f77, -[--enable-f77 - Turn on support for Fortran 77 (default)],,enable_f77=yes) -AC_ARG_WITH(file-system,[ ---with-file-system=name - Build with support for the named file systems],,) -AC_ARG_WITH(mpi,[ ---with-mpi=name - Specify MPI implementation to build ROMIO for],,) -dnl -if test "$enable_f77" != "yes" ; then - NOF77=1 -fi -MPI=$with_mpi -FILE_SYSTEM=$with_file_system -# -for arg -do -case $arg in - -arch=* | --arch=*) - ARCH=`echo $arg|sed 's/-*arch=//'` - eval "arch_`echo $ARCH`=1" - ;; - - -debug | --debug | --enable-g | -enable-g) - echo "Configuring for a debugging version" - DEBUG=yes - ;; - -from_mpich | --from_mpich) - FROM_MPICH=1 - ;; - - -noprofile | --noprofile | --disable-profile | -disable-profile ) - echo "profiling interface will not be built" - NOPROFILE=1 - ;; - - -disable-weak-symbols|--disable-weak-symbols) - TRY_WEAK_SYMBOLS=0 - ;; -esac -done -# -AC_CONFIG_AUX_DIR(../../../confdb) -dnl PAC_ARG_CACHING - -rm -f config.log -# -# Check that an arch was set -# If it wasn't set, try to guess using "util/tarch" -# -if test -z "$ARCH" -a -x $srcdir/util/tarch ; then - AC_MSG_CHECKING(for architecture) - ARCH=`$srcdir/util/tarch | sed s/-/_/g` - if test -z "$ARCH" ; then - AC_MSG_RESULT(Unknown!) - AC_MSG_ERROR([Error: Couldn't guess target architecture, you must -set an architecture type with -arch=]) - fi - eval "arch_$ARCH=1" - AC_MSG_RESULT($ARCH) -fi -# -# check for valid architecture. Use __ so that _ALPHA_ does not match -# LINUX_ALPHA_ -#### WE SHOULD REMOVE THIS SOON -grep __"$ARCH"_ $srcdir/.config_params > /dev/null 2>&1 -if test $? != 0 ; then - AC_MSG_WARN([Unknown architecture $arch... proceeding anyway]) -fi -# -# -# -# Find the home directory if not specified -if test "X$srcdir" != "X." -a -s $srcdir/mpi-io/Makefile.in ; then - ROMIO_HOME_TRIAL=$srcdir -else - PAC_GETWD(ROMIO_HOME_TRIAL,mpi-io/Makefile.in) -fi -echo "ROMIO home directory is $ROMIO_HOME_TRIAL" -ROMIO_HOME=$ROMIO_HOME_TRIAL -# -# Create the "autoconf" style directory names... -# -# mandir is the root for the man pages -if test -z "$mandir" ; then mandir='${prefix}/man' ; fi -AC_SUBST(mandir) -if test -z "$docdir" ; then docdir='${prefix}/doc' ; fi -AC_SUBST(docdir) -if test -z "$htmldir" ; then htmldir='${prefix}/www' ; fi -AC_SUBST(htmldir) -# -# check for valid file system -if test -n "$FILE_SYSTEM" ; then - # if multiple filesystems are passed in, they are '+'-delimited - # we could set the IFS to tokenize FILE_SYSTEM, but the FILE_SYSTEM env var - # is used in multiple places in the build system: get rid of the '+'s so we - # can use the 'for x in $FILE_SYSTEM ...' idiom - FILE_SYSTEM=`echo $FILE_SYSTEM|sed -e 's/\+/ /g'` - for x in $FILE_SYSTEM - do - found=no - for y in $known_filesystems ; do - if test $x = $y ; then - found=yes - eval "file_system_`echo $x`=1" - break - fi - done - if test "$found" = "no" ; then - AC_MSG_WARN([Unknown file system $x... proceeding anyway]) - fi - done -fi -# -# check for valid MPI implementation -if test -n "$MPI" ; then - found=no - for mpi in $known_mpi_impls ; do - if test "${MPI}_mpi" = "$mpi" ; then - found=yes - break - fi - done - if test $found = no ; then - AC_MSG_WARN([Unknown MPI implementation $MPI... proceeding anyway]) - fi -fi -# -# check for valid MPI include directory if specified -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then - if test -n "$MPI_INCLUDE_DIR"; then - if test ! -f "$MPI_INCLUDE_DIR/mpi.h" ; then - AC_MSG_ERROR([Include file $MPI_INCLUDE_DIR/mpi.h not found]) - fi - else -# assume that mpi.h is in the default path -# set MPI_INCLUDE_DIR to ".", so that it translates to -I. in the -# compile command. Some compilers complain if it's only -I - MPI_INCLUDE_DIR=. - fi -else - MPI_INCLUDE_DIR=. -fi -# -# check for valid MPI library if specified -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then - if test -n "$MPI_LIB" ; then - if test ! -f "$MPI_LIB" ; then - AC_MSG_ERROR([MPI library $MPI_LIB not found]) - fi - fi -fi -# -# -AR="${AR:-ar} cr$AR_LOCAL" -if test -z "$RANLIB" ; then - AC_PROG_RANLIB -fi -MAKE=${MAKE:-make} -# -# USER_CFLAGS and USER_FFLAGS are used only in test/Makefile.in -if test $DEBUG = "yes"; then - USER_CFLAGS="$CFLAGS -g" - USER_FFLAGS="$FFLAGS -g" -else - USER_CFLAGS="$CFLAGS -O" - USER_FFLAGS="$FFLAGS -O" -fi -# -if test -n "$arch_sun4" ; then - CC=${CC:-gcc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - if test "$CC" = "gcc"; then - CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" - else - CFLAGS="$CFLAGS -g" - fi - else - CFLAGS="$CFLAGS -O" - fi - if test "$enable_aio" = "no" ; then - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) - else - AC_DEFINE(AIO_SUN,,[Define for SUN0S 4]) - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - AC_MSG_RESULT([configuring for file systems ufs and nfs]) - fi -fi -# -if test -n "$arch_solaris" || test -n "$arch_solaris86" ; then - CC=${CC:-cc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - if test "$CC" = "gcc" ; then - CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" - else - CFLAGS="$CFLAGS -g -v" - fi - else - CFLAGS="$CFLAGS -O" - fi - if test "$enable_aio" = "no" ; then - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) - else - AC_DEFINE(AIO_SUN,,[Define for SUN0S 4]) - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - AC_MSG_RESULT([configuring for file systems ufs and nfs]) - fi - AC_DEFINE(SOLARIS,,[Define for Solaris]) - if test $MPI = "mpich" ; then - TEST_CC=mpicc - TEST_F77=mpif77 - else - TEST_CC="$CC" - TEST_F77="$F77" - fi - if test "$enable_aio" != "no" ; then - MPI_LIB="$MPI_LIB -laio" - ROMIO_LIBLIST="-laio" - fi - AR="ar cr" -# solaris does not have l option to ar -# solaris f90 does not have 8-byte integer type -# (it does now!!!! 11/29/01) -fi -# -if test -n "$arch_rs6000"; then - F77=$FC - if test -z "$CC"; then - AC_PROGRAMS_CHECK(CC, mpcc, cc) - echo "Using $CC" - fi - if test $NOF77 = 0 && test -z "$FC"; then - AC_PROGRAMS_CHECK(F77, mpxlf, f77) - echo "Using $F77" - fi - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g" - else - CFLAGS="$CFLAGS -O" - fi - # Check that aio is available (many systems appear to have aio - # either installed improperly or turned off). - # The test is the following: if not cross compiling, try to run a - # program that includes a *reference* to aio_write but does not call it - # If the libraries are not set up correctly, then this will fail. - AC_MSG_CHECKING([whether aio routines can be used]) - AC_TRY_RUN([ -int main( int argc, char **argv ) -{ - if (argc > 10) aio_write(); - return 0; -} -],aio_runs=yes,aio_runs=no,aio_runs=unknown) - AC_MSG_RESULT($aio_runs) - if test "$enable_aio" != "no" -a "$aio_runs" = "no" ; then - enable_aio=no - fi - if test "$enable_aio" = "no" ; then - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) - else - AC_DEFINE(NO_FD_IN_AIOCB,,[Define for no fd in the aiocb]) - AC_DEFINE(AIO_HANDLE_IN_AIOCB,,[Define for aio handle in aiocb]) - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - if test "$CC" = "mpcc" || test "$CC" = "mpCC" ; then - file_system_piofs=1 - FILE_SYSTEM="piofs" - AC_MSG_RESULT([configuring for file systems piofs, ufs, and nfs]) - else - AC_MSG_RESULT([configuring for file systems ufs and nfs]) - fi - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="$FILE_SYSTEM ufs nfs" - fi - AC_DEFINE(AIX,,[Define for AIX]) -# assume long long exists. - longlongsize=${longlongsize:-8} - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" -fi -# -if test -n "$arch_paragon"; then - CC=${CC:-icc} - F77=${FC:-if77} - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g" - else - if test "$CC" = "icc"; then - CFLAGS="$CFLAGS -Knoieee -Mvect -O3" - else - CFLAGS="$CFLAGS -O" - fi - fi - AR="ar860 cr$AR_LOCAL" - MPI_LIB="$MPI_LIB -nx" - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_pfs=1 - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="pfs ufs nfs" - AC_MSG_RESULT([configuring for file systems pfs, ufs, and nfs]) - fi - AC_DEFINE(PARAGON,,[Define for Intel Paragon]) - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) -# NO_AIO is if configuring for NFS/UFS. It doesn't affect PFS asynch. I/O. -# long long does not exist - longlongsize=${longlongsize:-0} -fi -# -if test -n "$arch_tflop" || test -n "$arch_tflops"; then - CC=${CC:-pgcc} - F77=${FC:-pgf77} - TFLOP_FLAGS="-cougar -D__PUMA" - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g $TFLOP_FLAGS" - else - if test "$CC" = "pgcc"; then - CFLAGS="$CFLAGS -Knoieee -Mvect -O3 $TFLOP_FLAGS" - else - CFLAGS="$CFLAGS -O $TFLOP_FLAGS" - fi - fi - AR="xar cr$AR_LOCAL" - RANLIB="xranlib" - MPI_LIB="$MPI_LIB" - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - FILE_SYSTEM="ufs" - AC_MSG_RESULT([configuring for file system ufs]) - fi -fi -# -if test -n "$arch_freebsd" || test -n "$arch_LINUX" || test -n "$arch_LINUX_ALPHA" || test -n "$arch_netbsd" || test -n "$arch_openbsd" ; then - CC=${CC:-gcc} - if test -n "$arch_freebsd" || test -n "$arch_netbsd" || test -n "$arch_openbsd"; then - F77=${FC:-f77} - AC_DEFINE(FREEBSD,,[Define for FreeBSD]) - PAC_HAVE_MOUNT_NFS - longlongsize=${longlongsize:-0} -# printf doesn't work properly and no integer*8 as far as I can tell - else - F77=${FC:-g77} - AC_DEFINE(LINUX,,[Define for Linux]) - fi - if test $DEBUG = "yes" ; then - if test "$CC" = "gcc" ; then - CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes" - else - CFLAGS="$CFLAGS -g" - fi - else - CFLAGS="$CFLAGS -O" - fi - if test "$enable_aio" != "yes" ; then - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) - else - # Try to find the aio routines - use_aio=no - AC_HEADER_CHECK(aio.h,has_aio_h=yes,has_aio_h=no) - add_lib="" - AC_SEARCH_LIBS(aio_write,aio,add_lib="-laio") - # What function do we want -lrt for? - AC_HAVE_LIBRARY(rt,add_lib="$add_lib -lrt") - AC_SEARCH_LIBS(pthread_create,pthread,[add_lib="$add_lib -lpthread" -has_pthread=yes],[has_pthread=no]) - AC_FUNC_CHECK(aio_write,has_aio_write=yes,has_aio_write=no) - if test "$has_aio_h" = "yes" -a "$has_aio_write" = "yes" -a \ - "$has_pthread" = "yes" ; then - use_aio=yes - fi - # Check for aiocb_t as a shorthand for struct aiocb - AC_MSG_CHECKING([for aiocb_t]) - AC_TRY_COMPILE([#include ], -[aiocb_t a;],has_aiocb_t=yes,has_aiocb_t=no) - AC_MSG_RESULT($has_aiocb_t) - if test "$has_aiocb_t" = "no" ; then - AC_DEFINE(NEEDS_AIOCB_T,,[Define for aiocb_t definition needed]) - fi - if test "$use_aio" = "yes" ; then - MPI_LIB="$MPI_LIB $add_lib" - ROMIO_LIBLIST="$ROMIO_LIBLIST $add_lib" - else - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) - fi - fi - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - AC_MSG_RESULT([configuring for file systems ufs and nfs]) - fi -fi -# -if test -n "$arch_SX4" ; then - CC=${CC:-mpicc} - F77=${FC:-mpif90} - if test $DEBUG = "yes" ; then - CFLAGS="$CFLAGS -g" - FFLAGS="$FFLAGS -g" - else - USER_FFLAGS="$FFLAGS -Chopt" - CFLAGS="$CFLAGS -O" - FFLAGS="$FFLAGS -Chopt" - fi - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) - AC_DEFINE(SX4,,[Define for NEC SX4]) - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_sfs=1 - file_system_nfs=1 - FILE_SYSTEM="sfs nfs" - AC_MSG_RESULT([configuring for file systems sfs and nfs]) - fi - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" -fi -# -if test -n "$arch_hpux" || test -n "$arch_sppux" ; then - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g +w1" - else - CFLAGS="$CFLAGS -O" - fi - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) - RANLIB=":" - if test -z "$MPI"; then - if test -f "/opt/mpi/include/mpi.h" ; then - echo "assuming that you want to use ROMIO with HP MPI" - MPI=hp - else - echo "assuming that you want to use ROMIO with MPICH" - MPI=mpich - fi - fi - if test $MPI = "mpich" ; then - mpi_mpich=1 - MPI_LIB="$MPI_LIB -lV3" - CC=${CC:-cc -Ae} - F77=${FC:-f77 +U77} - fi - if test $MPI = "hp" ; then - mpi_hp=1 - CC=${CC:-mpicc -Ae} - F77=${FC:-mpif77 +U77} - fi - if test $MPI = "lam" && test "$FC" != ""; then - FC="$FC +U77" - fi - FTESTDEFINE="external iargc, getarg" - if test -n "$arch_hpux" ; then - CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" - AC_DEFINE(HPUX,,[Define for HPUX]) - if test $MPI = "hp" ; then - F77=${FC:-mpif90 +U77} - else - F77=${FC:-f90 +U77} - fi - else - AC_DEFINE(SPPUX,,[Define for SPPUX (Convex)]) - fi - if test -z "$FILE_SYSTEM" ; then - if test -n "$arch_hpux" ; then - AC_MSG_CHECKING([for struct flock64]) - AC_TRY_COMPILE([#include ],[ -struct flock64 fl; int i=F_SETLKW64;],flock64_ok="yes",flock64_ok="no") - AC_MSG_RESULT($flock64_ok) - else - flock64_ok="yes" - fi - if test $flock64_ok = "yes" ; then - file_system_hfs=1 - file_system_nfs=1 - FILE_SYSTEM="hfs nfs" - AC_MSG_RESULT([configuring for file systems hfs and nfs]) - else - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - AC_MSG_RESULT([no flock64; configuring for file systems ufs and nfs]) - fi - fi - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" - if test "$CC" != "gcc" ; then - ROMIO_TCFLAGS="-Ae" - fi - if test "$F77" != "g77" ; then - ROMIO_TFFLAGS="+U77" - fi -fi -# -if test -n "$arch_alpha" || test -n "$arch_ALPHA" ; then - CC=${CC:-cc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g -std1 -warnprotos -verbose" - else - CFLAGS="$CFLAGS -O" - fi - AC_DEFINE(AIO_PRIORITY_DEFAULT,,[Define for AIO priority is default]) - MPI_LIB="$MPI_LIB -laio" - if test -z "$MPI" ; then - MPI=mpich - mpi_mpich=1 - fi - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - AC_MSG_RESULT([configuring for file systems ufs and nfs]) - fi - AC_DEFINE(DEC,,[Define for DEC/Compaq/HP Alpha]) - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" - ROMIO_LIBLIST="-laio" -fi -# -if test -n "$arch_CRAY" ; then - CC=${CC:-cc} - F77=${FC:-f90} - NOF77=1 - FTESTDEFINE="integer ilen" - F77GETARG="call pxfgetarg(i, str, ilen, ierr)" - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g" - else - CFLAGS="$CFLAGS -O" - fi - AC_DEFINE(NO_AIO,,[Define if AIO should not be used]) - RANLIB=":" - CFLAGS="$CFLAGS -D_UNICOS" - AC_DEFINE(CRAY,,[Define if Cray]) - if test -z "$MPI" || test -n "$mpi_sgi" ; then - MPI=cray - mpi_cray=1 - mpi_sgi="" -# above is to disable configure tests specific to SGI MPI - AC_DEFINE(MPISGI,,[Define if SGI MPI]) - AC_DEFINE(HAVE_MPI_COMBINERS,,[Define if MPI supports datatype combiners]) - AC_DEFINE(NO_MPI_SGI_type_is_contig,,[Define if no types show contig]) - fi -# MPISGI needed because of error in Cray's and SGI's -# MPI_Type_get_contents (does not increment reference count). -# Others needed because MPISGI needed. - if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - AC_MSG_RESULT([configuring for file systems ufs and nfs]) - fi - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" -fi -# -if test -n "$arch_sgi" ; then - arch_IRIX=1 - ARCH=IRIX -fi -if test -n "$arch_IRIX64" ; then - arch_IRIX=1 -fi -if test -n "$arch_IRIX32" ; then - arch_IRIX=1 -fi -if test -n "$arch_IRIXN32" ; then - arch_IRIX=1 -fi -if test -n "$arch_sgi5" ; then - arch_IRIX5=1 - ARCH=IRIX -fi -# -PAC_GET_SPECIAL_SYSTEM_INFO -# -# special case 'sgi5' for use on MESHINE which is much like an SGI running -# irix 5 with r4400 chips, but does not have 'hinv', so above code doesn't -# work -if test -n "$arch_sgi5"; then - osversion=5 - cputype=4400 - IRIXARCH="$ARCH_$osversion" - IRIXARCH="$IRIXARCH_$cputype" -# now set arch_IRIX to 1 - arch_IRIX=1 - echo "IRIX-specific architecture is $IRIXARCH" - AC_DEFINE(IRIX,,[Define if IRIX]) -fi -# -if test -n "$arch_IRIX"; then - CC=${CC:-cc} - F77=${FC:-f77} - if test $DEBUG = "yes"; then - CFLAGS="$CFLAGS -g -fullwarn" - else - CFLAGS="$CFLAGS -O" - fi - if test $osversion = 4 ; then - RANLIB="ar ts" - if test -n "$mpi_sgi"; then - AC_MSG_ERROR(["SGI's MPI doesn't work with IRIX 4.x"]) - fi - elif test $osversion = 5 ; then - if test -n "$mpi_sgi"; then - AC_MSG_ERROR("SGI's MPI doesn't work with IRIX 5.x"]) - fi - elif test $osversion = 6 ; then - if test -z "$MPI"; then - if test -f "/usr/include/mpi.h" ; then - echo "assuming that you want to use ROMIO with SGI's MPI" - MPI=sgi - mpi_sgi=1 - else - echo "assuming that you want to use ROMIO with MPICH" - MPI=mpich - mpi_mpich=1 - fi - fi - RANLIB=":" - AC_DEFINE(AIO_SIGNOTIFY_NONE,,[Define if no signotify]) - if test $cputype -ge 5000 ; then - MIPS=4 - else - MIPS=3 - fi - fi - if test -n "$mpi_sgi" && test -z "$MPI_LIB" ; then - MPI_LIB="-lmpi" - fi -# check if pread64 is defined - PAC_HAVE_PREAD64 -# - if test -z "$FILE_SYSTEM" ; then - file_system_nfs=1 - FILE_SYSTEM="nfs" - AC_MSG_CHECKING(for xfs) - AC_TRY_COMPILE([ -#include ], -[aiocb64_t *t1;],file_system_xfs=1;FILE_SYSTEM="xfs $FILE_SYSTEM";) - if test "$file_system_xfs" = 1 ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - file_system_ufs=1 - FILE_SYSTEM="ufs $FILE_SYSTEM" - fi - AC_MSG_RESULT([configuring for file systems $FILE_SYSTEM]) - fi - AC_DEFINE(IRIX,,[Define if IRIX]) - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=8)" -fi - -AC_HAVE_FUNCS(memalign) -PAC_TEST_MPIR_STATUS_SET_BYTES - -if test $NOF77 = 0 ; then - echo "checking Fortran external names" - PAC_GET_FORTNAMES - if test -n "$WDEF" ; then - CFLAGS="$CFLAGS $WDEF" - fi - rm -f test/mpif.h - if test "$MPI_INCLUDE_DIR" != "." && test $FROM_MPICH = 0 && \ - test $FROM_MPICH2 = 0 ; then - if test ! -d test ; then mkdir test ; fi - ln -s $MPI_INCLUDE_DIR/mpif.h test - fi -else - F77=":" -fi -# -PAC_C_INLINE - -# Header files -PAC_CHECK_HEADERS(unistd.h) -# -PAC_INT_LT_POINTER() -# -PAC_LONG_LONG_64() -# -dnl PAC_LONG_64() -# -if test -n "$longlongsize"; then - if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then - PAC_MPI_LONG_LONG_INT() - else - AC_DEFINE(HAVE_MPI_LONG_LONG_INT,,[Define if supports long long int]) - fi -fi -# -if test -n "$OFFSET_KIND" -a "A$MPI_OFFSET_KIND1" = "A!" ; then - MPI_OFFSET_KIND1=" INTEGER MPI_OFFSET_KIND" - MPI_OFFSET_KIND2=" PARAMETER (MPI_OFFSET_KIND=$OFFSET_KIND)" -else - if test "$FORTRAN_MPI_OFFSET" = "integer*8" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then - PAC_MPI_OFFSET_KIND() - fi - # - if test "$FORTRAN_MPI_OFFSET" = "integer" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then - PAC_MPI_OFFSET_KIND_4BYTE() - fi -fi -# -# check if MPI_Info functions are defined in the MPI implementation -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then - PAC_MPI_INFO() -else - AC_DEFINE(HAVE_MPI_INFO,,[Define if MPI Info is available]) - HAVE_MPI_INFO="#define HAVE_MPI_INFO 1" - MPI_FINFO1="!" - MPI_FINFO2="!" - MPI_FINFO3="!" - MPI_FINFO4="!" -fi -# -if test -n "$mpi_sgi"; then - if test -z "$HAVE_MPI_INFO" ; then - PAC_CHECK_MPI_SGI_INFO_NULL # is MPI_INFO_NULL defined in mpi.h? - fi - PAC_TEST_MPI_SGI_type_is_contig - PAC_TEST_MPI_COMBINERS - PAC_TEST_MPI_HAVE_OFFSET_KIND -fi -# -# check if darray and subarray constructors are defined in the MPI implementation -if test $FROM_MPICH = 0 ; then - PAC_MPI_DARRAY_SUBARRAY() -else - AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY,,[Define if Darray is available]) - HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY" - MPI_FARRAY1="!" - MPI_FARRAY2="!" - MPI_FARRAY3="!" - MPI_FARRAY4="!" - MPI_FARRAY5="!" - MPI_FARRAY6="!" - MPI_FARRAY7="!" -fi -# -# Check to see if the compiler accepts prototypes -dnl PAC_CHECK_CC_PROTOTYPES(AC_DEFINE(HAVE_PROTOTYPES)) -# -# -# Test for weak symbol support... -# We can't put # in the message because it causes autoconf to generate -# incorrect code -HAVE_WEAK_SYMBOLS=0 -if test -n "$arch_hpux" || test -n "$arch_sppux" ; then -# multiple secondary definitions not allowed by HP compilers -# Fortran interface for HP already uses one secondary defn. -# therefore, do not use this method for profiling interface. -# build profiling interface explicitly. - TRY_WEAK_SYMBOLS=0 -fi -if test $TRY_WEAK_SYMBOLS = 1 ; then - AC_MSG_CHECKING(for weak symbol support) - AC_TRY_LINK([ -#pragma weak PFoo = Foo -int Foo(a) { return a; } -],[return PFoo(1);],has_pragma_weak=1) - # - # Some systems (Linux ia64 and ecc, for example), support weak symbols - # only within a single object file! This tests that case. - if test "$has_pragma_weak" = 1 ; then - AC_MSG_RESULT([pragma weak]) - AC_MSG_CHECKING([that weak symbols are visible to other files]) - rm -f conftest* - cat >>conftest1.c <>conftest2.c <>config.log - echo "Failed program was" >>config.log - cat conftest1.c >>config.log - cat conftest2.c >>config.log - if test -s conftest.out ; then cat conftest.out >> config.log ; fi - AC_MSG_RESULT(no) - has_pragma_weak=0 - fi - rm -f conftest* - fi - if test "$has_pragma_weak" = 1 ; then - HAVE_WEAK_SYMBOLS=1 - AC_DEFINE(HAVE_WEAK_SYMBOLS,,[Define if weak symbols available]) - AC_DEFINE(HAVE_PRAGMA_WEAK,,[Define if pragma weak available]) - else - AC_TRY_LINK([ -#pragma _HP_SECONDARY_DEF Foo PFoo -int Foo(a) { return a; } -],[return PFoo(1);],has_pragma_hp_secondary=1) - if test "$has_pragma_hp_secondary" = 1 ; then - AC_MSG_RESULT([pragma _HP_SECONDARY_DEF]) - HAVE_WEAK_SYMBOLS=1 - AC_DEFINE(HAVE_WEAK_SYMBOLS,,[Define if weak symbols available]) - AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF,,[Define for HP weak pragma]) - else - AC_TRY_LINK([ -#pragma _CRI duplicate PFoo as Foo -int Foo(a) { return a; } -],[return PFoo(1);],has_pragma_cri_duplicate=1) - if test "$has_pragma_cri_duplicate" = 1 ; then - AC_MSG_RESULT([pragma _CRI duplicate x as y]) - HAVE_WEAK_SYMBOLS=1 - AC_DEFINE(HAVE_WEAK_SYMBOLS,,[Define if weak symbols available]) - AC_DEFINE(HAVE_PRAGMA_CRI_DUP,,[Define for CRAY weak dup]) - else - AC_MSG_RESULT(no) - fi - fi - fi -fi -AC_SUBST(HAVE_WEAK_SYMBOLS) -# -# if FILE_SYSTEM is not set above, use ufs and nfs as default -# -if test -z "$FILE_SYSTEM" ; then - file_system_ufs=1 - file_system_nfs=1 - FILE_SYSTEM="ufs nfs" - AC_MSG_RESULT([configuring for file systems ufs and nfs]) -fi -# -if test -n "$file_system_nfs" ; then - # Check for problems with locks - AC_MSG_CHECKING([whether file locks work with NFS]) - AC_TRY_RUN([ -#include -#include -#include - -int main() -{ - struct flock lock; - int fd, err; - - lock.l_type = F_WRLCK; - lock.l_start = 0; - lock.l_whence = SEEK_SET; - lock.l_len = 100; - - fd = open("conftest.dat", O_RDWR | O_CREAT, 0644); - - err = fcntl(fd, F_SETLKW, &lock); - - /* printf("err = %d, errno = %d\n", err, errno); */ - close(fd); - return err; -}],nfs_locks_work=yes,nfs_locks_work=no,nfs_locks_work=unknown) - AC_MSG_RESULT($nfs_locks_work) - if test "$nfs_locks_work" != "yes" ; then - AC_MSG_WARN([File locks do not work with NFS. See the Installation and -users manual for instructions on fixing this]) - fi -fi -if test -n "$file_system_nfs"; then - AC_DEFINE(NFS,,[Define for NFS]) -fi -if test -n "$file_system_ufs"; then - AC_DEFINE(UFS,,[Define for UFS]) -fi -if test -n "$file_system_hfs"; then - AC_DEFINE(HFS,,[Define for HFS]) -fi -if test -n "$file_system_sfs"; then - AC_DEFINE(SFS,,[Define for SFS]) -fi -if test -n "$file_system_xfs"; then - AC_DEFINE(XFS,,[Define for XFS]) - PAC_GET_XFS_MEMALIGN -fi -if test -n "$file_system_pvfs"; then - # Use ROMIO_PVFS instead of PVFS because FREEBSD defines PVFS. - AC_DEFINE(ROMIO_PVFS,,[Define for Romio with PVFS]) -fi -if test -n "$file_system_pfs"; then - AC_DEFINE(PFS,,[Define for PFS]) -fi -if test -n "$file_system_testfs"; then - AC_DEFINE(ROMIO_TESTFS,,[Define for TESTFS]) -fi -if test -n "$file_system_piofs"; then - AC_DEFINE(PIOFS,,[Define for PIOFS]) - USER_CFLAGS="$USER_CFLAGS -bI:/usr/include/piofs/piofs.exp" - ROMIO_LFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp" - USER_FFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp" -fi -if test -n "$mpi_mpich"; then - if test "$FROM_MPICH2" = 0; then - AC_DEFINE(NEEDS_MPI_TEST,,[Define if mpi_test needed]) - AC_DEFINE(MPICH,,[Define if using MPICH]) - if test -z "$arch_SX4" ; then - MPIOF_H_INCLUDED=1 - fi - fi -fi -if test -n "$mpi_sgi"; then - AC_DEFINE(MPISGI,,[Define if SGI MPI]) -fi -if test -n "$mpi_lam"; then - AC_DEFINE(MPILAM,,[Define if using LAM/MPI]) -fi -if test -n "$mpi_hp"; then - AC_DEFINE(MPIHP,,[Define if using HP MPI]) - if test "$NOF77" = 0; then - PAC_CHECK_MPIOF_H - fi -fi -# -PAC_FUNC_STRERROR -if test -z "$srcdir" -o "$srcdir" = "." ; then srcdir="$ROMIO_HOME" ; fi -AC_SUBST(srcdir) -if test "$FROM_MPICH2" = 0 ; then - if test -z "$LIBNAME"; then - LIBNAME="$ROMIO_HOME/lib/$ARCH/libmpio.a" - fi - # - if test ! -d $ROMIO_HOME/lib ; then - mkdir $ROMIO_HOME/lib - fi - if test ! -d $ROMIO_HOME/lib/$ARCH ; then - mkdir $ROMIO_HOME/lib/$ARCH - fi -else - if test -n "$top_build_dir" -a -d "$top_build_dir/lib" ; then - LIBNAME=$top_build_dir/lib/lib${MPILIBNAME}.a - else - LIBNAME="$ROMIO_HOME/lib${MPILIBNAME}.a" - fi -fi -# -if test $NOF77 = 1 ; then - F77=":" -else - FORTRAN_TEST="fperf fcoll_test fmisc pfcoll_test" -fi -# -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then - PAC_TEST_MPI - PAC_NEEDS_FINT -else - NEEDS_MPI_FINT="" -fi -# -if test "$MPI_INCLUDE_DIR" = "." ; then - ROMIO_INCLUDE="-I../include" -else - ROMIO_INCLUDE="-I../include -I$MPI_INCLUDE_DIR" -fi -# -TEST_LIBNAME=$LIBNAME -MPIRUN=mpirun -# -# if MPICH, use mpicc in test programs -# -if test $FROM_MPICH = 1 ; then - MPICH_HOME=`dirname $ROMIO_HOME` - if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi - TEST_CC=$MPI_BIN_DIR/mpicc - MPI_LIB="" - ROMIO_INCLUDE="" - USER_CFLAGS="" - USER_FFLAGS="" - TEST_LIBNAME="" - MPIRUN=$MPI_BIN_DIR/mpirun - if test -n "$arch_SX4" || test -n "$arch_hpux" ; then - TEST_F77=$MPI_BIN_DIR/mpif90 - else - TEST_F77=$MPI_BIN_DIR/mpif77 - fi - CC=$MPI_BIN_DIR/mpicc - AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status_set_bytes available]) -fi -# For now, separate the mpich2 from mpich cases -if test $FROM_MPICH2 = 1 ; then - MPICH_HOME=`dirname $ROMIO_HOME` - MPICH_HOME=`dirname $MPICH_HOME` - MPICH_HOME=`dirname $MPICH_HOME` - if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi - # No special compiler script. - # BUT we need the include paths - CC="$CC -I${use_top_srcdir}/src/include -I${top_build_dir}/src/include" - TEST_CC="$CC" - MPI_LIB="$LIBNAME" - ROMIO_INCLUDE="" - USER_CFLAGS="" - USER_FFLAGS="" - TEST_LIBNAME="" - MPIRUN=$MPI_BIN_DIR/mpiexec - AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status_set_bytes available]) -fi -# -if test $MPI != "mpich" -o "$FROM_MPICH2" = 1 ; then - AC_DEFINE(PRINT_ERR_MSG,,[Define for printing error messages]) -fi -# -if test -z "$TEST_CC" ; then - TEST_CC="$CC" -fi -if test -z "$TEST_F77" ; then - TEST_F77="$F77" -fi -# -CFLAGS="$CFLAGS -DHAVE_ROMIOCONF_H" -# -echo "setting CC to $CC" -echo "setting F77 to $F77" -echo "setting TEST_CC to $TEST_CC" -echo "setting TEST_F77 to $TEST_F77" -echo "setting CFLAGS to $CFLAGS" -echo "setting USER_CFLAGS to $USER_CFLAGS" -echo "setting USER_FFLAGS to $USER_FFLAGS" -# -VPATH='VPATH = .:${srcdir}' -AC_SUBST(VPATH) -AC_SUBST(ARCH) -AC_SUBST(FILE_SYSTEM) -AC_SUBST(CC) -AC_SUBST(CFLAGS) -AC_SUBST(USER_CFLAGS) -AC_SUBST(USER_FFLAGS) -AC_SUBST(MIPS) -AC_SUBST(BITS) -AC_SUBST(MPI) -AC_SUBST(AR) -AC_SUBST(RANLIB) -AC_SUBST(MPI_INCLUDE_DIR) -AC_SUBST(MPI_LIB) -AC_SUBST(F77) -AC_SUBST(NOF77) -AC_SUBST(NOPROFILE) -AC_SUBST(MAKE) -AC_SUBST(arch_IRIX) -AC_SUBST(ROMIO_HOME) -AC_SUBST(LIBNAME) -AC_SUBST(TEST_LIBNAME) -AC_SUBST(LL) -AC_SUBST(F77GETARG) -AC_SUBST(F77IARGC) -AC_SUBST(FTESTDEFINE) -AC_SUBST(FORTRAN_MPI_OFFSET) -AC_SUBST(FROM_MPICH) -AC_SUBST(FROM_MPICH2) -AC_SUBST(NEEDS_MPI_FINT) -AC_SUBST(HAVE_MPI_INFO) -AC_SUBST(BUILD_MPI_INFO) -AC_SUBST(HAVE_MPI_DARRAY_SUBARRAY) -AC_SUBST(BUILD_MPI_ARRAY) -AC_SUBST(DEFINE_MPI_OFFSET) -AC_SUBST(MPI_FINFO1) -AC_SUBST(MPI_FINFO2) -AC_SUBST(MPI_FINFO3) -AC_SUBST(MPI_FINFO4) -AC_SUBST(MPI_FARRAY1) -AC_SUBST(MPI_FARRAY2) -AC_SUBST(MPI_FARRAY3) -AC_SUBST(MPI_FARRAY4) -AC_SUBST(MPI_FARRAY5) -AC_SUBST(MPI_FARRAY6) -AC_SUBST(MPI_FARRAY7) -AC_SUBST(MPI_OFFSET_KIND1) -AC_SUBST(MPI_OFFSET_KIND2) -AC_SUBST(TEST_CC) -AC_SUBST(TEST_F77) -AC_SUBST(ROMIO_INCLUDE) -AC_SUBST(ROMIO_LFLAGS) -AC_SUBST(ROMIO_LIBLIST) -AC_SUBST(ROMIO_TCFLAGS) -AC_SUBST(ROMIO_TCPPFLAGS) -AC_SUBST(ROMIO_TFFLAGS) -AC_SUBST(MPIRUN) -AC_SUBST(FORTRAN_TEST) -if test ! -d adio ; then mkdir adio ; fi -if test ! -d adio/include ; then mkdir adio/include ; fi -if test ! -d mpi2-other ; then mkdir mpi2-other ; fi -# -# Make sure we remove any configuration file incase there is out-of-date data. -# We remove the version in include in case this is a vpath build -rm -f adio/include/romioconf.h ${use_top_srcdir}/src/mpi/romio/adio/include/romioconf.h ${use_top_srcdir}/adio/include/romioconf.h -# -# Create makefiles for all of the adio devices. Only the ones that -# are active will be called by the top level ROMIO make -AC_OUTPUT_COMMANDS([chmod 755 util/romioinstall test/runtests]) -AC_OUTPUT(Makefile mpi-io/Makefile mpi2-other/info/Makefile \ - mpi2-other/array/Makefile adio/common/Makefile \ - test/Makefile test/misc.c test/large_file.c \ - test/runtests util/romioinstall include/mpio.h \ - include/mpiof.h \ - adio/ad_nfs/Makefile adio/ad_ufs/Makefile \ - adio/ad_xfs/Makefile adio/ad_hfs/Makefile \ - adio/ad_sfs/Makefile adio/ad_pfs/Makefile \ - adio/ad_testfs/Makefile adio/ad_pvfs/Makefile \ - adio/ad_piofs/Makefile \ - mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile \ - mpi2-other/array/fortran/Makefile test/fmisc.f \ - test/fcoll_test.f test/pfcoll_test.f test/fperf.f ) -# -rm -f *.o -if test "$ROMIO_NO_BANNER" != "yes" -a "$FROM_MPICH" = 0 -a \ - $FROM_MPICH2 = 0 ; then -cat < test/tmp - mv test/tmp test/fcoll_test.f - sed 5d test/pfcoll_test.f > test/tmp - mv test/tmp test/fcoll_test.f - sed 5d test/fperf.f > test/tmp - mv test/tmp test/fperf.f - sed 5d test/fmisc.f > test/tmp - mv test/tmp test/fmisc.f -fi -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then - AC_MSG_RESULT([Configure done. Now type make]) -fi -dnl PAC_SUBDIR_CACHE_CLEANUP -exit 0 diff --git a/src/libs/ck-libs/ampi/romio/doc/Makefile b/src/libs/ck-libs/ampi/romio/doc/Makefile new file mode 100644 index 0000000000..26b7bcfffa --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/doc/Makefile @@ -0,0 +1,11 @@ +all: + latex users-guide.tex + bibtex users-guide + latex users-guide.tex + latex users-guide.tex + dvipdfm users-guide + +clean: + -rm -f users-guide.toc users-guide.log users-guide.dvi \ + users-guide.aux users-guide.bbl users-guide.ps \ + users-guide.blg diff --git a/src/libs/ck-libs/ampi/romio/doc/README b/src/libs/ck-libs/ampi/romio/doc/README new file mode 100644 index 0000000000..b61e73ee20 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/doc/README @@ -0,0 +1,35 @@ +The ROMIO Users Guide is in the file users-guide.ps.gz. + +The book ``Using MPI-2: Advanced Features of the Message-Passing +Interface,'' by William Gropp, Ewing Lusk, and Rajeev Thakur, +MIT Press, 1999, provides a tutorial introduction to all aspects of +MPI-2, including I/O. It has lots of example programs. + +The following papers related to ROMIO are available online: + +* Rajeev Thakur, William Gropp, and Ewing Lusk, ``Optimizing +Noncontiguous Accesses in MPI-IO,'' Parallel Computing, (28)1:83--105, +January 2002. +http://www.mcs.anl.gov/~thakur/papers/mpi-io-noncontig.ps + +* R. Thakur, W. Gropp, and E. Lusk, ``On Implementing MPI-IO Portably +and with High Performance,'' in Proc. of the Sixth Workshop on I/O in +Parallel and Distributed Systems, May 1999. +http://www.mcs.anl.gov/~thakur/papers/mpio-impl.ps + +* R. Thakur, W. Gropp, and E. Lusk, ``Data Sieving and Collective I/O +in ROMIO,'' in Proc. of the 7th Symposium on the Frontiers of +Massively Parallel Computation, February 1999, pp. 182--189. +http://www.mcs.anl.gov/~thakur/papers/romio-coll.ps + +* R. Thakur, W. Gropp, and E. Lusk, ``A Case for Using MPI's Derived +Datatypes to Improve I/O Performance,'' in Proc. of SC98: High +Performance Networking and Computing, November 1998. +http://www.mcs.anl.gov/~thakur/dtype + +* R. Thakur, W. Gropp, and E. Lusk, ``An Abstract-Device Interface for +Implementing Portable Parallel-I/O Interfaces,'' in Proc. of the 6th +Symposium on the Frontiers of Massively Parallel Computation, +October 1996, pp. 180-187. +http://www.mcs.anl.gov/~thakur/papers/adio.ps + diff --git a/src/libs/ck-libs/ampi/romio/doc/makepubpage.sh b/src/libs/ck-libs/ampi/romio/doc/makepubpage.sh new file mode 100755 index 0000000000..390519e580 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/doc/makepubpage.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# if you have bibtext2html installed (http://www.lri.fr/~filliatr/bibtex2html/ +# but I know there are other packages by that name), then you can re-generate +# the "ROMIO publication page" +# (http://www.mcs.anl.gov/research/projects/romio/pubs.html) + +# If you update the command below, please be sure to retain the link to the +# older papers + +WEB_HOST=login3.mcs.anl.gov +WEB_DIR=/mcs/web/research/projects/romio + +bibtex2html -t "Papers using ROMIO" \ + --header "Please help us keep this list up to date. Contact mpich-discuss@mcs.anl.gov for any corrections or additions.

Last updated at $(date).

Recent publications

" \ + --footer "

Other publications

+

+ + + + + + diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/Makefile.in b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/Makefile.in new file mode 100644 index 0000000000..51cde8a0d9 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/Makefile.in @@ -0,0 +1,52 @@ +CC = @CC@ +AR = @AR@ +LIBNAME = @LIBNAME@ +RANLIB = @RANLIB@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../../include -I${srcdir}/../../../mpi-io -I${srcdir}/../../../adio/include -I../../../adio/include -I${srcdir}/../../../../../../src/include -I../../../../../../src/include +CFLAGS = -DHAVE_MPI_INFO_SRC @CPPFLAGS@ @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE_SHL = $(CC_SHL) + +@VPATH@ + +MPIO_OBJECTS = mpio_file.o mpio_err.o + +all: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +.c.o: + $(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + +.c.p: + @cp $(srcdir)/$*.c _$*.c + $(CC) $(CFLAGS) -c _$*.c + @rm -f _$*.c + +profile: + sleep 1 + +$(LIBNAME): $(MPIO_OBJECTS) + $(AR) $(LIBNAME) $(MPIO_OBJECTS) + $(RANLIB) $(LIBNAME) + +MPIO_LOOBJECTS = $(MPIO_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(MPIO_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(MPIO_LOOBJECTS) + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/mpio_err.c b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/mpio_err.c new file mode 100644 index 0000000000..9400a11399 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/mpio_err.c @@ -0,0 +1,65 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include +#include + +#include "mpioimpl.h" +#include "adio_extern.h" + +/* MPICH1 error handling implementation */ + +int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], + int line, int error_class, const char generic_msg[], + const char specific_msg[], ... ) +{ + va_list Argp; + int error_code; + + va_start(Argp, specific_msg); + + error_code = MPIR_Err_setmsg(error_class, 0, fcname, generic_msg, + specific_msg, Argp); + + vfprintf(stderr, specific_msg, Argp); + + va_end(Argp); + + return error_code; +} + +int MPIO_Err_return_file(MPI_File mpi_fh, int error_code) +{ + char buf[MPI_MAX_ERROR_STRING]; + int myrank, result_len; + MPI_Errhandler err_handler; + + if (mpi_fh == MPI_FILE_NULL) err_handler = ADIOI_DFLT_ERR_HANDLER; + else { + ADIO_File fh; + fh = MPIO_File_resolve(mpi_fh); + err_handler = fh->err_handler; + } + + MPI_Comm_rank(MPI_COMM_WORLD, &myrank); + if (err_handler == MPI_ERRORS_ARE_FATAL) { + MPI_Error_string(error_code, buf, &result_len); + FPRINTF(stderr, "[%d] %s\n", myrank, buf); + MPI_Abort(MPI_COMM_WORLD, 1); + } + else if (err_handler != MPI_ERRORS_RETURN) { + FPRINTF(stderr, "Only MPI_ERRORS_RETURN and MPI_ERRORS_ARE_FATAL are currently supported as error handlers for files\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + return error_code; +} + +int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code) +{ + return MPIO_Err_return_file(MPI_FILE_NULL, error_code); +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/mpio_file.c b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/mpio_file.c new file mode 100644 index 0000000000..aaee32b98d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich1/mpio_file.c @@ -0,0 +1,94 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" +#include "adio_extern.h" + +/* Hooks for allocation of MPI_File handles. + * + * Three functions are used in ROMIO for allocation/deallocation + * of MPI_File structures: + * - MPIO_File_create(size) + * - MPIO_File_resolve(mpi_fh) + * - MPIO_File_free(mpi_fh) + * + */ + +MPI_File MPIO_File_create(int size) +{ + MPI_File mpi_fh; + + mpi_fh = (MPI_File) ADIOI_Malloc(size); + return mpi_fh; +} + +ADIO_File MPIO_File_resolve(MPI_File mpi_fh) +{ + return mpi_fh; +} + +void MPIO_File_free(MPI_File *mpi_fh) +{ + ADIOI_Free(*mpi_fh); + *mpi_fh = MPI_FILE_NULL; +} + +MPI_File MPIO_File_f2c(MPI_Fint fh) +{ +#ifndef INT_LT_POINTER + return (MPI_File) ((void *) fh); + /* the extra cast is to get rid of a compiler warning on Exemplar. + The warning is because MPI_File points to a structure containing + longlongs, which may be 8-byte aligned. But MPI_Fint itself + may not be 8-byte aligned.*/ +#else + if (!fh) return MPI_FILE_NULL; + + /* --BEGIN ERROR HANDLING-- */ + if ((fh < 0) || (fh > ADIOI_Ftable_ptr)) { + /* there is no way to return an error code from MPI_File_f2c */ + return MPI_FILE_NULL; + } + /* --END ERROR HANDLING-- */ + return ADIOI_Ftable[fh]; +#endif +} + +MPI_Fint MPIO_File_c2f(MPI_File fh) +{ +#ifndef INT_LT_POINTER + return (MPI_Fint) fh; +#else + int i; + + if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) + return (MPI_Fint) 0; + + if (fh->fortran_handle != -1) + return fh->fortran_handle; + + if (!ADIOI_Ftable) { + ADIOI_Ftable_max = 1024; + ADIOI_Ftable = (MPI_File *) + ADIOI_Malloc(ADIOI_Ftable_max*sizeof(MPI_File)); + ADIOI_Ftable_ptr = 0; /* 0 can't be used though, because + MPI_FILE_NULL=0 */ + for (i=0; ifortran_handle = ADIOI_Ftable_ptr; + return (MPI_Fint) ADIOI_Ftable_ptr; +#endif +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/.state-cache b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/.state-cache new file mode 100644 index 0000000000..b7c0e1d898 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/.state-cache @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/Makefile.in b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/Makefile.in new file mode 100644 index 0000000000..78600dab69 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/Makefile.in @@ -0,0 +1,79 @@ +CC = @CC@ +AR = @AR@ +LIBNAME = @LIBNAME@ +RANLIB = @RANLIB@ +srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ + +#DEFS = @DEFS@ -I. -I${srcdir} +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I@MPI_INCLUDE_DIR@ -I../../../include -I${srcdir}/../../../mpi-io -I${srcdir}/../../../adio/include -I../../../adio/include -I${srcdir}/../../../../../../src/include -I../../../../../../src/include +#CFLAGS = -DHAVE_MPI_INFO_SRC @CPPFLAGS@ @CFLAGS@ $(MPIOPROFILE) $(INCLUDES) +CFLAGS = -DHAVE_MPI_INFO_SRC @CFLAGS@ $(MPIOPROFILE) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +C_COMPILE_SHL = $(CC_SHL) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) +#C_COMPILE_SHL = $(CC_SHL) + +@VPATH@ + +MPIO_OBJECTS = mpio_file.o mpio_err.o + +all: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi + +.SUFFIXES: $(SUFFIXES) .p .lo + +# $(CC) $(CFLAGS) -c $< +.c.o: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE) -c $< ; \ + fi + @$(C_COMPILE) -c $< +# $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o +# @mv -f _s$*.o $*.lo +.c.lo: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE_SHL) -c $< -o _s$*.o ; \ + echo mv -f _s$*.o $*.lo ; \ + fi + @$(C_COMPILE_SHL) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + +# $(CC) $(CFLAGS) -c $< -o _$*.o +.c.p: + @if [ "x$(VERBOSE)" != "x1" ] ; then \ + echo " CC $<" ; \ + else \ + echo $(C_COMPILE) -c $< -o _$*.o ; \ + fi + @$(C_COMPILE) -c $< -o _$*.o + +profile: + sleep 1 + +coverage: + -@for file in ${MPIO_OBJECTS:.o=.c} ; do \ + gcov -b -f $$file ; done + +$(LIBNAME): $(MPIO_OBJECTS) + $(AR) $(LIBNAME) $(MPIO_OBJECTS) + $(RANLIB) $(LIBNAME) + +MPIO_LOOBJECTS = $(MPIO_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(MPIO_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(MPIO_LOOBJECTS) + +clean: + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/mpio_err.c b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/mpio_err.c new file mode 100644 index 0000000000..e59b688c74 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/mpio_err.c @@ -0,0 +1,113 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include +#include + +#include "mpioimpl.h" +#include "adio_extern.h" + +/* MPICH2 error handling implementation */ +/* FIXME: These external prototypes should be included from + mpich2/src/include/mpiext.h */ +int MPIR_Err_create_code_valist(int, int, const char [], int, int, + const char [], const char [], va_list ); +int MPIR_Err_is_fatal(int); + +void MPIR_Get_file_error_routine( MPI_Errhandler, + void (**)(MPI_File *, int *, ...), + int * ); +int MPIR_File_call_cxx_errhandler( MPI_File *, int *, + void (*)(MPI_File *, int *, ... ) ); + +int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[], + int line, int error_class, const char generic_msg[], + const char specific_msg[], ... ) +{ + va_list Argp; + int error_code; + + va_start(Argp, specific_msg); + + error_code = MPIR_Err_create_code_valist(lastcode, fatal, fcname, line, + error_class, generic_msg, + specific_msg, Argp); + + va_end(Argp); + + return error_code; +} + +int MPIO_Err_return_file(MPI_File mpi_fh, int error_code) +{ + MPI_Errhandler e; + void (*c_errhandler)(MPI_File *, int *, ... ); + int kind; /* Error handler kind (see below) */ + char error_msg[4096]; + int len; + + /* If the file pointer is not valid, we use the handler on + MPI_FILE_NULL (MPI-2, section 9.7). For now, this code assumes that + MPI_FILE_NULL has the default handler (return). FIXME. See + below - the set error handler uses ADIOI_DFLT_ERR_HANDLER; + */ + + /* First, get the handler and the corresponding function */ + if (mpi_fh == MPI_FILE_NULL) { + e = ADIOI_DFLT_ERR_HANDLER; + } + else { + ADIO_File fh; + + fh = MPIO_File_resolve(mpi_fh); + e = fh->err_handler; + } + + /* Actually, e is just the value provide by the MPICH2 routines + file_set_errhandler. This is actually a *pointer* to the + errhandler structure. We don't know that, so we ask + the MPICH2 code to translate this object into an error handler. + kind = 0: errors are fatal + kind = 1: errors return + kind = 2: errors call function + */ + if (e == MPI_ERRORS_RETURN || e == MPIR_ERRORS_THROW_EXCEPTIONS || !e) { + /* FIXME: This is a hack in case no error handler was set */ + kind = 1; + c_errhandler = 0; + } + else { + MPIR_Get_file_error_routine( e, &c_errhandler, &kind ); + } + + /* --BEGIN ERROR HANDLING-- */ + if (MPIR_Err_is_fatal(error_code) || kind == 0) + { + ADIOI_Snprintf(error_msg, 4096, "I/O error: "); + len = (int)strlen(error_msg); + MPIR_Err_get_string(error_code, &error_msg[len], 4096-len, NULL); + MPID_Abort(NULL, MPI_SUCCESS, error_code, error_msg); + } + /* --END ERROR HANDLING-- */ + else if (kind == 2) { + (*c_errhandler)( &mpi_fh, &error_code, 0 ); + } + else if (kind == 3) { + MPIR_File_call_cxx_errhandler( &mpi_fh, &error_code, c_errhandler ); + } + + /* kind == 1 just returns */ + return error_code; +} + +int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code) +{ + /* note: MPI calls inside the MPICH2 implementation are prefixed + * with an "N", indicating a nested call. + */ + MPI_Comm_call_errhandler(mpi_comm, error_code); + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/mpio_file.c b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/mpio_file.c new file mode 100644 index 0000000000..a52f97f92f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/glue/mpich2/mpio_file.c @@ -0,0 +1,92 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2004 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#include "adio_extern.h" + +/* Hooks for allocation of MPI_File handles. + * + * Three functions are used in ROMIO for allocation/deallocation + * of MPI_File structures: + * - MPIO_File_create(size) + * - MPIO_File_resolve(mpi_fh) + * - MPIO_File_free(mpi_fh) + * + */ + +MPI_File MPIO_File_create(int size) +{ + MPI_File mpi_fh; + + mpi_fh = (MPI_File) ADIOI_Malloc(size); + return mpi_fh; +} + +ADIO_File MPIO_File_resolve(MPI_File mpi_fh) +{ + return mpi_fh; +} + +void MPIO_File_free(MPI_File *mpi_fh) +{ + ADIOI_Free(*mpi_fh); + *mpi_fh = MPI_FILE_NULL; +} + +MPI_File MPIO_File_f2c(MPI_Fint fh) +{ +#ifndef INT_LT_POINTER + return (MPI_File) ((void *) fh); + /* the extra cast is to get rid of a compiler warning on Exemplar. + The warning is because MPI_File points to a structure containing + longlongs, which may be 8-byte aligned. But MPI_Fint itself + may not be 8-byte aligned.*/ +#else + if (!fh) return MPI_FILE_NULL; + if ((fh < 0) || (fh > ADIOI_Ftable_ptr)) { + /* there is no way to return an error from MPI_File_f2c */ + return MPI_FILE_NULL; + } + return ADIOI_Ftable[fh]; +#endif +} + +MPI_Fint MPIO_File_c2f(MPI_File fh) +{ +#ifndef INT_LT_POINTER + return (MPI_Fint) fh; +#else + int i; + + if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) + return (MPI_Fint) 0; + + if (fh->fortran_handle != -1) + return fh->fortran_handle; + + if (!ADIOI_Ftable) { + ADIOI_Ftable_max = 1024; + ADIOI_Ftable = (MPI_File *) + ADIOI_Malloc(ADIOI_Ftable_max*sizeof(MPI_File)); + ADIOI_Ftable_ptr = 0; /* 0 can't be used though, because + MPI_FILE_NULL=0 */ + for (i=0; ifortran_handle = ADIOI_Ftable_ptr; + return (MPI_Fint) ADIOI_Ftable_ptr; +#endif +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/ioreq_c2f.c b/src/libs/ck-libs/ampi/romio/mpi-io/ioreq_c2f.c index 4db9db1d7e..72708b8b79 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/ioreq_c2f.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/ioreq_c2f.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -35,32 +34,49 @@ Input Parameters: Return Value: Fortran I/O-request handle (integer) @*/ +#ifdef HAVE_MPI_GREQUEST +MPI_Fint MPIO_Request_c2f(MPIO_Request request) +{ + return ((MPI_Fint)request); +} +#else + MPI_Fint MPIO_Request_c2f(MPIO_Request request) { #ifndef INT_LT_POINTER - return (MPI_Fint)(intptr_t)request; + return (MPI_Fint) request; #else int i; + MPIU_THREADPRIV_DECL; + /* We can make this test outside of the ALLFUNC mutex because it does + not access any shared data */ if ((request <= (MPIO_Request) 0) || (request->cookie != ADIOI_REQ_COOKIE)) - return (MPI_Fint) 0; - if (!CtvAccess(ADIOI_Reqtable)) { - CtvAccess(ADIOI_Reqtable_max) = 1024; - CtvAccess(ADIOI_Reqtable) = (MPIO_Request *) - ADIOI_Malloc(CtvAccess(ADIOI_Reqtable_max)*sizeof(MPIO_Request)); - CtvAccess(ADIOI_Reqtable_ptr) = 0; /* 0 can't be used though, because + { + return (MPI_Fint) 0; + } + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + if (!ADIOI_Reqtable) { + ADIOI_Reqtable_max = 1024; + ADIOI_Reqtable = (MPIO_Request *) + ADIOI_Malloc(ADIOI_Reqtable_max*sizeof(MPIO_Request)); + ADIOI_Reqtable_ptr = 0; /* 0 can't be used though, because MPIO_REQUEST_NULL=0 */ - for (i=0; i CtvAccess(ADIOI_Reqtable_ptr))) { - FPRINTF(stderr, "MPIO_Request_f2c: Invalid request\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + if (!request) { + return MPIO_REQUEST_NULL; } - return CtvAccess(ADIOI_Reqtable)[request]; + /* --BEGIN ERROR HANDLING-- */ + if ((request < 0) || (request > ADIOI_Reqtable_ptr)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_REQUEST, + "**request", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + return MPIO_REQUEST_NULL; + } + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + return ADIOI_Reqtable[request]; #endif } +#endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/iotest.c b/src/libs/ck-libs/ampi/romio/mpi-io/iotest.c index e7f32df086..df1671bb09 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/iotest.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/iotest.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -38,12 +37,17 @@ Output Parameters: .N fortran @*/ +#ifdef HAVE_MPI_GREQUEST +int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status) +{ + return (MPI_Test(request, flag, status)); +} +#else int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status) { int error_code; -#ifndef PRINT_ERR_MSG static char myname[] = "MPIO_TEST"; -#endif + MPIU_THREADPRIV_DECL; #ifdef MPI_hpux int fl_xmpi; @@ -52,19 +56,24 @@ int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status) } #endif /* MPI_hpux */ - if (*request == MPIO_REQUEST_NULL) return MPI_SUCCESS; + MPIU_THREAD_CS_ENTER(ALLFUNC,); + if (*request == MPIO_REQUEST_NULL) { + error_code = MPI_SUCCESS; + goto fn_exit; + } + + /* --BEGIN ERROR HANDLING-- */ if ((*request < (MPIO_Request) 0) || - ((*request)->cookie != ADIOI_REQ_COOKIE)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPIO_Test: Invalid request object\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_REQUEST, MPIR_ERR_REQUEST_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif + ((*request)->cookie != ADIOI_REQ_COOKIE)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_REQUEST, + "**request", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ switch ((*request)->optype) { case ADIOI_READ: @@ -78,5 +87,9 @@ int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status) #ifdef MPI_hpux HPMP_IO_WEND(fl_xmpi); #endif /* MPI_hpux */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } +#endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/iotestall.c b/src/libs/ck-libs/ampi/romio/mpi-io/iotestall.c new file mode 100644 index 0000000000..23b812f96f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/iotestall.c @@ -0,0 +1,77 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2003 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPIO_Testall = PMPIO_Testall +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPIO_Testall MPIO_Testall +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPIO_Testall as PMPIO_Testall +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Testall(int count, MPIO_Request requests[], int *flag, + MPI_Status statuses[]) +{ + int done, i, err; + MPIU_THREADPRIV_DECL; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + if (count == 1) { + err = MPIO_Test( requests, flag, statuses ); + goto fn_exit; + } + + /* This is actually very difficult to do. We can't use MPIO_Test, + since we must change the requests only if *ALL* requests are complete + */ + /* FIXME: THIS IS NOT CORRECT (see above). But most applications won't + care */ + done = 1; + for (i=0; iPMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Testany(int count, MPIO_Request requests[], int *index, + int *flag, MPI_Status *status) +{ + int i, err; + MPIU_THREADPRIV_DECL; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + if (count == 1) { + err = MPIO_Test( requests, flag, status ); + if (!err) *index = 0; + goto fn_exit; + } + + /* Check for no active requests */ + for (i=0; iMPI_SOURCE = MPI_ANY_SOURCE; + status->MPI_TAG = MPI_ANY_TAG; + status->count = 0; + status->cancelled = 0; + } +#endif + err = MPI_SUCCESS; + goto fn_exit; + } + + err = MPI_SUCCESS; + for (i=0; iPMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Testsome(int count, MPIO_Request requests[], int *outcount, + int indices[], MPI_Status *statuses) +{ + int i, err; + int flag; + MPIU_THREADPRIV_DECL; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + if (count == 1) { + err = MPIO_Test( requests, &flag, statuses ); + if (!err) { + if (flag) { + indices[0] = 0; + *outcount = 1; + } + else { + *outcount = 0; + } + } + goto fn_exit; + } + + /* Check for no active requests */ + for (i=0; icookie != ADIOI_REQ_COOKIE)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPIO_Wait: Invalid request object\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_REQUEST, MPIR_ERR_REQUEST_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif + if (*request == MPIO_REQUEST_NULL) { + error_code = MPI_SUCCESS; + goto fn_exit; + } + + + /* --BEGIN ERROR HANDLING-- */ + if ((*request < (MPIO_Request) 0) || + ((*request)->cookie != ADIOI_REQ_COOKIE)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_REQUEST, + "**request", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ switch ((*request)->optype) { case ADIOI_READ: @@ -77,5 +88,9 @@ int MPIO_Wait(MPIO_Request *request, MPI_Status *status) #ifdef MPI_hpux HPMP_IO_WEND(fl_xmpi); #endif /* MPI_hpux */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } +#endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/iowaitall.c b/src/libs/ck-libs/ampi/romio/mpi-io/iowaitall.c new file mode 100644 index 0000000000..b8e7dbd22f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/iowaitall.c @@ -0,0 +1,74 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 2003 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPIO_Waitall = PMPIO_Waitall +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPIO_Waitall MPIO_Waitall +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPIO_Waitall as PMPIO_Waitall +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Waitall( int count, MPIO_Request requests[], MPI_Status statuses[] ) +{ + int notdone, i, flag, err; + MPIU_THREADPRIV_DECL; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + if (count == 1) { + err = MPIO_Wait(requests, statuses); + goto fn_exit; + } + + + do { + notdone = 0; + for (i=0; iPMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Waitany(int count, MPIO_Request requests[], int *index, + MPI_Status *status) +{ + int i, flag, err; + MPIU_THREADPRIV_DECL; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + if (count == 1) { + err = MPIO_Wait( requests, status ); + if (!err) *index = 0; + goto fn_exit; + } + + /* Check for no active requests */ + for (i=0; iMPI_SOURCE = MPI_ANY_SOURCE; + status->MPI_TAG = MPI_ANY_TAG; + status->count = 0; + status->cancelled = 0; + } +#endif + err = MPI_SUCCESS; + goto fn_exit; + } + + err = MPI_SUCCESS; + do { + flag = 0; + for (i=0; iPMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* + This is a temporary function until we switch to using MPI-2's generalized + requests. +*/ + +int MPIO_Waitsome(int count, MPIO_Request requests[], int *outcount, + int indices[], MPI_Status *statuses) +{ + int i, flag, err; + MPIU_THREADPRIV_DECL; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + if (count == 1) { + err = MPIO_Wait( requests, statuses ); + if (!err) { + *outcount = 1; + indices[0] = 0; + } + goto fn_exit; + } + + /* Check for no active requests */ + for (i=0; iPMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_iread - Nonblocking read using individual file pointer - -Input Parameters: -. fh - file handle (handle) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) -. request - request object (handle) - -.N fortran -@*/ -int MPI_File_iread(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPIO_Request *request) -{ - int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_IREAD"; -#endif - int datatype_size; - ADIO_Offset off; - ADIO_Status status; -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEIREAD, TRDTSYSTEM, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_iread: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_WRONLY) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread: Can't read from a file opened with MPI_MODE_WRONLY\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_MODE_WRONLY, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); - - /* contiguous or strided? */ - - if (buftype_is_contig && filetype_is_contig) { - /* convert count and offset to bytes */ - bufsize = datatype_size * count; - if (!(fh->atomicity)) - ADIO_IreadContig(fh, buf, count, datatype, ADIO_INDIVIDUAL, 0, - request, &error_code); - else { - /* to maintain strict atomicity semantics with other concurrent - operations, lock (exclusive) and call blocking routine */ - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_READ; - (*request)->fd = fh; - (*request)->datatype = datatype; - (*request)->queued = 0; - (*request)->handle = 0; - - off = fh->fp_ind; - if ((fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); - - ADIO_ReadContig(fh, buf, count, datatype, ADIO_INDIVIDUAL, 0, - &status, &error_code); - - if ((fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - - fh->async_count++; - /* status info. must be linked to the request structure, so that it - can be accessed later from a wait */ - } - } - else ADIO_IreadStrided(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, request, &error_code); - -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_iread = PMPI_File_iread +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_iread MPI_File_iread +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_iread as PMPI_File_iread +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif +/*@ + MPI_File_iread - Nonblocking read using individual file pointer + +Input Parameters: +. fh - file handle (handle) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) +. request - request object (handle) + +.N fortran +@*/ +#ifdef HAVE_MPI_GREQUEST +#include "mpiu_greq.h" +#endif + +int MPI_File_iread(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype, MPI_Request *request) +{ + int error_code=MPI_SUCCESS; + static char myname[] = "MPI_FILE_IREAD"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEIREAD, TRDTSYSTEM, mpi_fh, datatype, + count); +#endif /* MPI_hpux */ + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + error_code = MPIOI_File_iread(mpi_fh, (MPI_Offset) 0, ADIO_INDIVIDUAL, + buf, count, datatype, myname, request); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(mpi_fh, error_code); + /* --END ERROR HANDLING-- */ + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, mpi_fh, datatype, count); +#endif /* MPI_hpux */ + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} + +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_iread(MPI_File mpi_fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Request *request) +{ + int error_code, bufsize, buftype_is_contig, filetype_is_contig; + int datatype_size; + ADIO_Status status; + ADIO_File fh; + ADIO_Offset off; + MPI_Offset nbytes=0; + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Type_size(datatype, &datatype_size); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_READABLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); + + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + + if (buftype_is_contig && filetype_is_contig) { + /* convert count and offset to bytes */ + bufsize = datatype_size * count; + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fh->disp + fh->etype_size * offset; + } + else { + off = fh->fp_ind; + } + + if (!(fh->atomicity)) + ADIO_IreadContig(fh, buf, count, datatype, file_ptr_type, + off, request, &error_code); + else { + /* to maintain strict atomicity semantics with other concurrent + operations, lock (exclusive) and call blocking routine */ + if (ADIO_Feature(fh, ADIO_LOCKS)) + { + ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); + } + + ADIO_ReadContig(fh, buf, count, datatype, file_ptr_type, + off, &status, &error_code); + + if (ADIO_Feature(fh, ADIO_LOCKS)) + { + ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); + } + if (error_code == MPI_SUCCESS) { + nbytes = count*datatype_size; + } + MPIO_Completed_request_create(&fh, nbytes, &error_code, request); + } + } + else ADIO_IreadStrided(fh, buf, count, datatype, file_ptr_type, + offset, request, &error_code); + +fn_exit: + + return error_code; +} +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/iread_at.c b/src/libs/ck-libs/ampi/romio/mpi-io/iread_at.c dissimilarity index 77% index fada8463a5..8e04c2f48d 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/iread_at.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/iread_at.c @@ -1,182 +1,74 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_iread_at = PMPI_File_iread_at -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_iread_at MPI_File_iread_at -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_iread_at as PMPI_File_iread_at -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_iread_at - Nonblocking read using explict offset - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (nonnegative integer) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) -. request - request object (handle) - -.N fortran -@*/ -int MPI_File_iread_at(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, - MPIO_Request *request) -{ - int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_IREAD_AT"; -#endif - int datatype_size; - ADIO_Status status; - ADIO_Offset off; -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEIREADAT, TRDTSYSTEM, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_iread_at: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_at: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_at: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_at: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_at: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_WRONLY) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_at: Can't read from a file opened with MPI_MODE_WRONLY\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_MODE_WRONLY, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_at: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); - - /* contiguous or strided? */ - - if (buftype_is_contig && filetype_is_contig) { - /* convert count and offset to bytes */ - bufsize = datatype_size * count; - off = fh->disp + fh->etype_size * offset; - if (!(fh->atomicity)) - ADIO_IreadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, request, &error_code); - else { - /* to maintain strict atomicity semantics with other concurrent - operations, lock (exclusive) and call blocking routine */ - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_READ; - (*request)->fd = fh; - (*request)->datatype = datatype; - (*request)->queued = 0; - (*request)->handle = 0; - - if ((fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); - - ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, &status, &error_code); - - if ((fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - - fh->async_count++; - /* status info. must be linked to the request structure, so that it - can be accessed later from a wait */ - } - } - else ADIO_IreadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, request, &error_code); - -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_iread_at = PMPI_File_iread_at +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_iread_at MPI_File_iread_at +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_iread_at as PMPI_File_iread_at +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_iread_at - Nonblocking read using explict offset + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (nonnegative integer) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) +. request - request object (handle) + +.N fortran +@*/ +#ifdef HAVE_MPI_GREQUEST +#include "mpiu_greq.h" +#endif + + +int MPI_File_iread_at(MPI_File mpi_fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPIO_Request *request) +{ + int error_code; + static char myname[] = "MPI_FILE_IREAD_AT"; + +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEIREADAT, TRDTSYSTEM, mpi_fh, datatype, + count); +#endif /* MPI_hpux */ + + + error_code = MPIOI_File_iread(mpi_fh, offset, ADIO_EXPLICIT_OFFSET, buf, + count, datatype, myname, request); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(mpi_fh, error_code); + /* --END ERROR HANDLING-- */ + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, mpi_fh, datatype, count); +#endif /* MPI_hpux */ + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/iread_sh.c b/src/libs/ck-libs/ampi/romio/mpi-io/iread_sh.c index 2dcba7b004..4d3d399f02 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/iread_sh.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/iread_sh.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -38,117 +37,101 @@ Output Parameters: .N fortran @*/ -int MPI_File_iread_shared(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPIO_Request *request) +#ifdef HAVE_MPI_GREQUEST +#include "mpiu_greq.h" + + +int MPI_File_iread_shared(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype, MPI_Request *request) { int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG + ADIO_File fh; static char myname[] = "MPI_FILE_IREAD_SHARED"; -#endif int datatype_size, incr; - ADIO_Status status; + MPI_Status status; ADIO_Offset off, shared_fp; + MPI_Offset nbytes=0; -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_iread_shared: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_shared: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + fh = MPIO_File_resolve(mpi_fh); - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_shared: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + /* --END ERROR HANDLING-- */ MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_shared: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iread_shared: Shared file pointer not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + incr = (count*datatype_size)/fh->etype_size; ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code); - if (error_code != MPI_SUCCESS) { - FPRINTF(stderr, "MPI_File_iread_shared: Error! Could not access shared file pointer.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + { + /* note: ADIO_Get_shared_fp should have set up error code already? */ + MPIO_Err_return_file(fh, error_code); } + /* --END ERROR HANDLING-- */ - /* contiguous or strided? */ - if (buftype_is_contig && filetype_is_contig) { + if (buftype_is_contig && filetype_is_contig) + { /* convert count and shared_fp to bytes */ bufsize = datatype_size * count; off = fh->disp + fh->etype_size * shared_fp; if (!(fh->atomicity)) + { ADIO_IreadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, request, &error_code); - else { + off, request, &error_code); + } + else + { /* to maintain strict atomicity semantics with other concurrent operations, lock (exclusive) and call blocking routine */ - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_READ; - (*request)->fd = fh; - (*request)->datatype = datatype; - (*request)->queued = 0; - (*request)->handle = 0; - if (fh->file_system != ADIO_NFS) + { ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); + } - ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, off, - &status, &error_code); + ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + off, &status, &error_code); if (fh->file_system != ADIO_NFS) + { ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - - fh->async_count++; - /* status info. must be linked to the request structure, so that it - can be accessed later from a wait */ + } + if (error_code == MPI_SUCCESS){ + nbytes = count * datatype_size; + } + MPIO_Completed_request_create(&fh, nbytes, &error_code, request); } } - else ADIO_IreadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, request, &error_code); + else + { + ADIO_IreadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + shared_fp, request, &error_code); + } + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } +#endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/iwrite.c b/src/libs/ck-libs/ampi/romio/mpi-io/iwrite.c dissimilarity index 62% index 6f197e37ed..a03a44c72a 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/iwrite.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/iwrite.c @@ -1,160 +1,165 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_iwrite = PMPI_File_iwrite -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_iwrite MPI_File_iwrite -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_iwrite as PMPI_File_iwrite -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - - -/*@ - MPI_File_iwrite - Nonblocking write using individual file pointer - -Input Parameters: -. fh - file handle (handle) -. buf - initial address of buffer (choice) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. request - request object (handle) - -.N fortran -@*/ -int MPI_File_iwrite(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPIO_Request *request) -{ - int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_IWRITE"; -#endif - int datatype_size; - ADIO_Status status; - ADIO_Offset off; -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITE, TRDTSYSTEM, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_iwrite: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); - - /* contiguous or strided? */ - - if (buftype_is_contig && filetype_is_contig) { - /* convert sizes to bytes */ - bufsize = datatype_size * count; - if (!(fh->atomicity)) - ADIO_IwriteContig(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, request, &error_code); - else { - /* to maintain strict atomicity semantics with other concurrent - operations, lock (exclusive) and call blocking routine */ - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fh; - (*request)->datatype = datatype; - (*request)->queued = 0; - (*request)->handle = 0; - - off = fh->fp_ind; - if ((fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); - - ADIO_WriteContig(fh, buf, count, datatype, ADIO_INDIVIDUAL, 0, - &status, &error_code); - - if ((fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - - fh->async_count++; - /* status info. must be linked to the request structure, so that it - can be accessed later from a wait */ - } - } - else - ADIO_IwriteStrided(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, request, &error_code); - -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_iwrite = PMPI_File_iwrite +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_iwrite MPI_File_iwrite +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_iwrite as PMPI_File_iwrite +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_iwrite - Nonblocking write using individual file pointer + +Input Parameters: +. fh - file handle (handle) +. buf - initial address of buffer (choice) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. request - request object (handle) + +.N fortran +@*/ +#ifdef HAVE_MPI_GREQUEST +#include "mpiu_greq.h" +#endif + +int MPI_File_iwrite(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype, MPI_Request *request) +{ + int error_code=MPI_SUCCESS; + static char myname[] = "MPI_FILE_IWRITE"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITE, TRDTSYSTEM, mpi_fh, datatype, + count); +#endif /* MPI_hpux */ + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + error_code = MPIOI_File_iwrite(mpi_fh, (MPI_Offset) 0, ADIO_INDIVIDUAL, + buf, count, datatype, myname, request); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(mpi_fh, error_code); + /* --END ERROR HANDLING-- */ + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, mpi_fh, datatype, count); +#endif /* MPI_hpux */ + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} + +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_iwrite(MPI_File mpi_fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Request *request) +{ + int error_code, bufsize, buftype_is_contig, filetype_is_contig; + int datatype_size; + ADIO_Status status; + ADIO_Offset off; + ADIO_File fh; + MPI_Offset nbytes=0; + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Type_size(datatype, &datatype_size); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_WRITABLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); + + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + + if (buftype_is_contig && filetype_is_contig) { + /* convert sizes to bytes */ + bufsize = datatype_size * count; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fh->disp + fh->etype_size * offset; + } + else { + off = fh->fp_ind; + } + + if (!(fh->atomicity)) { + ADIO_IwriteContig(fh, buf, count, datatype, file_ptr_type, + off, request, &error_code); + } + else { + /* to maintain strict atomicity semantics with other concurrent + operations, lock (exclusive) and call blocking routine */ + if (ADIO_Feature(fh, ADIO_LOCKS) ) + { + ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); + } + + ADIO_WriteContig(fh, buf, count, datatype, file_ptr_type, off, + &status, &error_code); + + if (ADIO_Feature(fh, ADIO_LOCKS) ) + { + ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); + } + if (error_code == MPI_SUCCESS) { + nbytes = count * datatype_size; + } + + MPIO_Completed_request_create(&fh, nbytes, &error_code, request); + } + } + else { + ADIO_IwriteStrided(fh, buf, count, datatype, file_ptr_type, + offset, request, &error_code); + } +fn_exit: + return error_code; +} +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/iwrite_at.c b/src/libs/ck-libs/ampi/romio/mpi-io/iwrite_at.c dissimilarity index 74% index e42a783bd7..321a55398a 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/iwrite_at.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/iwrite_at.c @@ -1,175 +1,76 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_iwrite_at = PMPI_File_iwrite_at -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_iwrite_at MPI_File_iwrite_at -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_iwrite_at as PMPI_File_iwrite_at -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - - -/*@ - MPI_File_iwrite_at - Nonblocking write using explict offset - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (nonnegative integer) -. buf - initial address of buffer (choice) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. request - request object (handle) - -.N fortran -@*/ -int MPI_File_iwrite_at(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, - MPIO_Request *request) -{ - int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_IWRITE_AT"; -#endif - int datatype_size; - ADIO_Status status; - ADIO_Offset off; -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITEAT, TRDTSYSTEM, - fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_iwrite_at: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite_at: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite_at: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite_at: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite_at: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite_at: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); - - /* contiguous or strided? */ - - if (buftype_is_contig && filetype_is_contig) { - /* convert sizes to bytes */ - bufsize = datatype_size * count; - off = fh->disp + fh->etype_size * offset; - if (!(fh->atomicity)) - ADIO_IwriteContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, request, &error_code); - else { - /* to maintain strict atomicity semantics with other concurrent - operations, lock (exclusive) and call blocking routine */ - - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fh; - (*request)->datatype = datatype; - (*request)->queued = 0; - (*request)->handle = 0; - - if ((fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); - - ADIO_WriteContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, off, - &status, &error_code); - - if ((fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - - fh->async_count++; - /* status info. must be linked to the request structure, so that it - can be accessed later from a wait */ - - } - } - else - ADIO_IwriteStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, request, &error_code); - -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count) -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_iwrite_at = PMPI_File_iwrite_at +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_iwrite_at MPI_File_iwrite_at +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_iwrite_at as PMPI_File_iwrite_at +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_iwrite_at - Nonblocking write using explict offset + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (nonnegative integer) +. buf - initial address of buffer (choice) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. request - request object (handle) + +.N fortran +@*/ +#ifdef HAVE_MPI_GREQUEST +#include "mpiu_greq.h" +#endif + +int MPI_File_iwrite_at(MPI_File mpi_fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPIO_Request *request) +{ + int error_code; + ADIO_File fh; + static char myname[] = "MPI_FILE_IWRITE_AT"; + +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITEAT, TRDTSYSTEM, + mpi_fh, datatype, count); +#endif /* MPI_hpux */ + + + fh = MPIO_File_resolve(mpi_fh); + + error_code = MPIOI_File_iwrite(fh, offset, ADIO_EXPLICIT_OFFSET, buf, + count, datatype, myname, request); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, mpi_fh, datatype, count) +#endif /* MPI_hpux */ + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/iwrite_sh.c b/src/libs/ck-libs/ampi/romio/mpi-io/iwrite_sh.c index 2a9d4ec4b1..9812facc40 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/iwrite_sh.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/iwrite_sh.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -38,80 +37,48 @@ Output Parameters: .N fortran @*/ -int MPI_File_iwrite_shared(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPIO_Request *request) +#ifdef HAVE_MPI_GREQUEST +#include "mpiu_greq.h" +#endif + +int MPI_File_iwrite_shared(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype, MPIO_Request *request) { int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_IWRITE_SHARED"; -#endif + ADIO_File fh; int datatype_size, incr; ADIO_Status status; ADIO_Offset off, shared_fp; + static char myname[] = "MPI_FILE_IWRITE_SHARED"; -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_iwrite_shared: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite_shared: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + fh = MPIO_File_resolve(mpi_fh); - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite_shared: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + /* --END ERROR HANDLING-- */ MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite_shared: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_iwrite_shared: Shared file pointer not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + incr = (count*datatype_size)/fh->etype_size; ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code); if (error_code != MPI_SUCCESS) { - FPRINTF(stderr, "MPI_File_iwrite_shared: Error! Could not access shared file pointer.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + /* note: ADIO_Get_shared_fp should have set up error code already? */ + MPIO_Err_return_file(fh, error_code); } /* contiguous or strided? */ @@ -126,30 +93,24 @@ int MPI_File_iwrite_shared(MPI_File fh, void *buf, int count, /* to maintain strict atomicity semantics with other concurrent operations, lock (exclusive) and call blocking routine */ - *request = ADIOI_Malloc_request(); - (*request)->optype = ADIOI_WRITE; - (*request)->fd = fh; - (*request)->datatype = datatype; - (*request)->queued = 0; - (*request)->handle = 0; - if (fh->file_system != ADIO_NFS) ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); - ADIO_WriteContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, off, - &status, &error_code); + ADIO_WriteContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + off, &status, &error_code); if (fh->file_system != ADIO_NFS) ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - fh->async_count++; - /* status info. must be linked to the request structure, so that it - can be accessed later from a wait */ + MPIO_Completed_request_create(&fh, bufsize, &error_code, request); } } else ADIO_IwriteStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, request, &error_code); + shared_fp, request, &error_code); + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/mpich2_fileutil.c b/src/libs/ck-libs/ampi/romio/mpi-io/mpich2_fileutil.c new file mode 100644 index 0000000000..747ad7f2fd --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/mpich2_fileutil.c @@ -0,0 +1,60 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpioimpl.h" +#include "adio_extern.h" + +#ifdef MPICH2 + +/* Forward ref for the routine to extract and set the error handler + in a ROMIO File structure. FIXME: These should be imported from a common + header file that is also used in errhan/file_set_errhandler.c + */ +int MPIR_ROMIO_Get_file_errhand( MPI_File, MPI_Errhandler * ); +int MPIR_ROMIO_Set_file_errhand( MPI_File, MPI_Errhandler ); +void MPIR_Get_file_error_routine( MPI_Errhandler, + void (**)(MPI_File *, int *, ...), + int * ); + +/* These next two routines are used to allow MPICH2 to access/set the + error handers in the MPI_File structure until MPICH2 knows about the + file structure, and to handle the errhandler structure, which + includes a reference count. Not currently used. */ +int MPIR_ROMIO_Set_file_errhand( MPI_File file_ptr, MPI_Errhandler e ) +{ + if (file_ptr == MPI_FILE_NULL) ADIOI_DFLT_ERR_HANDLER = e; + /* --BEGIN ERROR HANDLING-- */ + else if (file_ptr->cookie != ADIOI_FILE_COOKIE) { + return MPI_ERR_FILE; + } + /* --END ERROR HANDLING-- */ + else + file_ptr->err_handler = e; + return 0; +} +int MPIR_ROMIO_Get_file_errhand( MPI_File file_ptr, MPI_Errhandler *e ) +{ + if (file_ptr == MPI_FILE_NULL) { + if (ADIOI_DFLT_ERR_HANDLER == MPI_ERRORS_RETURN) + *e = 0; + else { + *e = ADIOI_DFLT_ERR_HANDLER; + } + } + /* --BEGIN ERROR HANDLING-- */ + else if (file_ptr->cookie != ADIOI_FILE_COOKIE) { + return MPI_ERR_FILE; + } + /* --END ERROR HANDLING-- */ + else { + if (file_ptr->err_handler == MPI_ERRORS_RETURN) + *e = 0; + else + *e = file_ptr->err_handler; + } + return 0; +} + +#endif /* MPICH2 */ diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/mpioimpl.h b/src/libs/ck-libs/ampi/romio/mpi-io/mpioimpl.h index 0224dfc3b8..ffcf4fafb9 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/mpioimpl.h +++ b/src/libs/ck-libs/ampi/romio/mpi-io/mpioimpl.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -17,6 +16,26 @@ #include "mpio.h" #include "converse.h" //For Ctv* +/* FIXME: We should be more restricted in what we include from MPICH2 + into ROMIO */ +#ifdef ROMIO_INSIDE_MPICH2 +#include "mpiimpl.h" +#include "mpiimplthread.h" + +#else /* not ROMIO_INSIDE_MPICH2 */ +/* Any MPI implementation that wishes to follow the thread-safety and + error reporting features provided by MPICH2 must implement these + four functions. Defining these as empty should not change the behavior + of correct programs */ +#define MPIU_THREAD_CS_ENTER(x,y) +#define MPIU_THREAD_CS_EXIT(x,y) +#ifdef HAVE_WINDOWS_H +#define MPIU_UNREFERENCED_ARG(a) a +#else +#define MPIU_UNREFERENCED_ARG(a) +#endif +#endif /* ROMIO_INSIDE_MPICH2 */ + /* info is a linked list of these structures */ struct MPIR_Info { int cookie; @@ -28,6 +47,10 @@ struct MPIR_Info { MPI_Delete_function ADIOI_End_call; +/* common initialization routine */ +void MPIR_MPIOInit(int * error_code); + + #include "mpioprof.h" #ifdef MPI_hpux diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/mpioprof.h b/src/libs/ck-libs/ampi/romio/mpi-io/mpioprof.h index 6a52a2e55e..7e1044c61a 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/mpioprof.h +++ b/src/libs/ck-libs/ampi/romio/mpi-io/mpioprof.h @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -11,6 +10,7 @@ building the profiling interface */ +#if 0 #ifdef MPIO_BUILD_PROFILING #undef MPI_File_open @@ -115,6 +115,8 @@ #undef MPI_File_get_type_extent #define MPI_File_get_type_extent PMPI_File_get_type_extent +#undef MPI_Register_datarep +#define MPI_Register_datarep PMPI_Register_datarep #undef MPI_File_set_atomicity #define MPI_File_set_atomicity PMPI_File_set_atomicity #undef MPI_File_get_atomicity @@ -140,15 +142,29 @@ #endif #undef MPIO_Test +#undef PMPIO_Test #define MPIO_Test PMPIO_Test #undef MPIO_Wait +#undef PMPIO_Wait #define MPIO_Wait PMPIO_Wait +#undef MPIO_Testall +#define MPIO_Testall PMPIO_Testall +#undef MPIO_Waitall +#define MPIO_Waitall PMPIO_Waitall +#undef MPIO_Testany +#define MPIO_Testany PMPIO_Testany +#undef MPIO_Waitany +#define MPIO_Waitany PMPIO_Waitany +#undef MPIO_Testsome +#define MPIO_Testsome PMPIO_Testsome +#undef MPIO_Waitsome +#define MPIO_Waitsome PMPIO_Waitsome #undef MPIO_Request_f2c #define MPIO_Request_f2c PMPIO_Request_f2c #undef MPIO_Request_c2f #define MPIO_Request_c2f PMPIO_Request_c2f -#ifdef MPI_INFO_SRC /* only in info source directory */ +#if defined(HAVE_MPI_INFO_SRC) /* only in info source directory */ #undef MPI_Info_create #define MPI_Info_create PMPI_Info_create @@ -175,4 +191,18 @@ #endif +#undef MPI_Grequest_start +#define MPI_Grequest_start PMPI_Grequest_start +#undef MPI_Grequest_complete +#define MPI_Grequest_complete PMPI_Grequest_complete +#undef MPI_Status_set_cancelled +#define MPI_Status_set_cancelled PMPI_Status_set_cancelled + +#undef MPIX_Grequest_start +#define MPIX_Grequest_start PMPIX_Grequest_start +#undef MPIX_Grequest_class_create +#define MPIX_Grequest_class_create PMPIX_Grequest_class_create + +#endif + #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/mpir-mpioinit.c b/src/libs/ck-libs/ampi/romio/mpi-io/mpir-mpioinit.c new file mode 100644 index 0000000000..d4d2cf877e --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/mpir-mpioinit.c @@ -0,0 +1,56 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2009 UChicago/Argonne LLC + * See COPYRIGHT in top-level directory. + */ +#include +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +extern int ADIO_Init_keyval; + +/* common code to stuff an attribute on a communicator for the purpose of + * cleaning up in MPI_Finalize() */ + +void MPIR_MPIOInit(int * error_code) { + + int flag; + char myname[] = "MPIR_MPIOInit"; + + /* first check if ADIO has been initialized. If not, initialize it */ + if (ADIO_Init_keyval == MPI_KEYVAL_INVALID) { + MPI_Initialized(&flag); + + /* --BEGIN ERROR HANDLING-- */ + if (!flag) { + *error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, __LINE__, + MPI_ERR_OTHER, "**initialized", 0); + *error_code = MPIO_Err_return_file(MPI_FILE_NULL, *error_code); + return; + } + /* --END ERROR HANDLING-- */ + + MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_End_call, &ADIO_Init_keyval, + (void *) 0); + + /* put a dummy attribute on MPI_COMM_SELF, because we want the delete + function to be called when MPI_COMM_SELF is freed. Clarified + in MPI-2 section 4.8, the standard mandates that attributes on + MPI_COMM_SELF get cleaned up early in MPI_Finalize */ + + MPI_Attr_put(MPI_COMM_SELF, ADIO_Init_keyval, (void *) 0); + + /* initialize ADIO */ + ADIO_Init( (int *)0, (char ***)0, error_code); + } + *error_code = MPI_SUCCESS; +} +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/mpiu_greq.c b/src/libs/ck-libs/ampi/romio/mpi-io/mpiu_greq.c new file mode 100644 index 0000000000..e460fee8d1 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/mpiu_greq.c @@ -0,0 +1,49 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2003 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include +#include "mpioimpl.h" +#include "mpiu_greq.h" + +#ifdef HAVE_WEAK_SYMBOLS +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +int MPIU_Greq_query_fn(void *extra_state, MPI_Status *status) +{ + int foo; + + /* can't touch user's MPI_ERROR, so hold it for a moment */ + foo = status->MPI_ERROR; + + /* get the status from the blocking operation */ + memcpy(status, extra_state, sizeof(MPI_Status)); + + /* restore MPI_ERROR to whatever it had when we got it */ + status->MPI_ERROR = foo; + + /* and let Test|Wait know we weren't canceled */ + MPI_Status_set_cancelled(status, 0); + + return MPI_SUCCESS; +} + +int MPIU_Greq_free_fn(void *extra_state) +{ + /* frees the memory allocated in MPIO_Completed_request_create */ + ADIOI_Free(extra_state); + + return MPI_SUCCESS; +} +int MPIU_Greq_cancel_fn(void *extra_state, int complete) +{ + MPIU_UNREFERENCED_ARG(extra_state); + MPIU_UNREFERENCED_ARG(complete); + + /* can't cancel */ + return MPI_SUCCESS; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/open.c b/src/libs/ck-libs/ampi/romio/mpi-io/open.c dissimilarity index 71% index 4674a5b5ff..0f9615cbfb 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/open.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/open.c @@ -1,274 +1,205 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_open = PMPI_File_open -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_open MPI_File_open -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_open as PMPI_File_open -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -CtvExtern(int, ADIO_Init_keyval); -// AMPI: was ADIO_Init_keyval initialized already? -CtvExtern(int, ADIO_Init_keyval_done); - -/*@ - MPI_File_open - Opens a file - -Input Parameters: -. comm - communicator (handle) -. filename - name of file to open (string) -. amode - file access mode (integer) -. info - info object (handle) - -Output Parameters: -. fh - file handle (handle) - -.N fortran -@*/ -int MPI_File_open(MPI_Comm comm, char *filename, int amode, - MPI_Info info, MPI_File *fh) -{ - int error_code, file_system, flag, /* tmp_amode, */rank, orig_amode; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_OPEN"; -#endif - char *tmp; - MPI_Comm dupcomm, dupcommself; - ADIOI_Fns *fsops; - -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_OPEN_START(fl_xmpi, comm); -#endif /* MPI_hpux */ - - if (comm == MPI_COMM_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_open: Invalid communicator\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_COMM, MPIR_ERR_COMM_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif - } - - MPI_Comm_test_inter(comm, &flag); - if (flag) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_open: Intercommunicator cannot be passed to MPI_File_open\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_COMM, MPIR_ERR_COMM_INTER, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif - } - - if ( ((amode&MPI_MODE_RDONLY)?1:0) + ((amode&MPI_MODE_RDWR)?1:0) + - ((amode&MPI_MODE_WRONLY)?1:0) != 1 ) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_open: Exactly one of MPI_MODE_RDONLY, MPI_MODE_WRONLY, or MPI_MODE_RDWR must be specified\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_AMODE, 3, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif - } - - if ((amode & MPI_MODE_RDONLY) && - ((amode & MPI_MODE_CREATE) || (amode & MPI_MODE_EXCL))) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_open: It is erroneous to specify MPI_MODE_CREATE or MPI_MODE_EXCL with MPI_MODE_RDONLY\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_AMODE, 5, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif - } - - if ((amode & MPI_MODE_RDWR) && (amode & MPI_MODE_SEQUENTIAL)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_open: It is erroneous to specify MPI_MODE_SEQUENTIAL with MPI_MODE_RDWR\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_AMODE, 7, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif - } - -/* check if amode is the same on all processes */ - MPI_Comm_dup(comm, &dupcomm); - -/* - Removed this check because broadcast is too expensive. - tmp_amode = amode; - MPI_Bcast(&tmp_amode, 1, MPI_INT, 0, dupcomm); - if (amode != tmp_amode) { - FPRINTF(stderr, "MPI_File_open: amode must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -*/ - CtvInitialize(int, ADIO_Init_keyval); - CtvInitialize(int, ADIO_Init_keyval_done); - -/* check if ADIO has been initialized. If not, initialize it */ - if (CtvAccess(ADIO_Init_keyval) == MPI_KEYVAL_INVALID || CtvAccess(ADIO_Init_keyval_done) != 1) { - CtvAccess(ADIO_Init_keyval_done) = 1; - - -/* check if MPI itself has been initialized. If not, flag an error. - Can't initialize it here, because don't know argc, argv */ - MPI_Initialized(&flag); - if (!flag) { - FPRINTF(stderr, "Error: MPI_Init() must be called before using MPI-IO\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_End_call, &CtvAccess(ADIO_Init_keyval), - (void *) 0); - - -/* put a dummy attribute on MPI_COMM_WORLD, because we want the delete - function to be called when MPI_COMM_WORLD is freed. Hopefully the - MPI library frees MPI_COMM_WORLD when MPI_Finalize is called, - though the standard does not mandate this. */ - - MPI_Attr_put(MPI_COMM_WORLD, CtvAccess(ADIO_Init_keyval), (void *) 0); - -/* initialize ADIO */ - - ADIO_Init( (int *)0, (char ***)0, &error_code); - } - - - file_system = -1; - - /* resolve file system type from file name; this is a collective call */ - ADIO_ResolveFileType(dupcomm, filename, &file_system, &fsops, &error_code); - if (error_code != MPI_SUCCESS) { - /* ADIO_ResolveFileType() will print as informative a message as it - * possibly can or call MPIR_Err_setmsg. We just need to propagate - * the error up. In the PRINT_ERR_MSG case MPI_Abort has already - * been called as well, so we probably didn't even make it this far. - */ -#ifdef PRINT_ERR_MSG - MPI_Abort(MPI_COMM_WORLD, 1); /* this is mostly here for clarity */ -#else - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif - } - - /* Test for invalid flags in amode. - * - * eventually we should allow the ADIO implementations to test for - * invalid flags through some functional interface rather than having - * these tests here. -- Rob, 06/06/2001 - */ - if (((file_system == ADIO_PIOFS) || (file_system == ADIO_PVFS)) && - (amode & MPI_MODE_SEQUENTIAL)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_open: MPI_MODE_SEQUENTIAL not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_MODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif - } - - /* strip off prefix if there is one */ - tmp = strchr(filename, ':'); - /* Only skip prefixes greater than length one to allow for windows drive specification (c:\...)*/ - /*if (tmp) filename = tmp + 1;*/ - if (tmp > filename + 1) - filename = tmp + 1; - - orig_amode = amode; - MPI_Comm_rank(dupcomm, &rank); - - if ((amode & MPI_MODE_CREATE) && (amode & MPI_MODE_EXCL)) { - /* the open should fail if the file exists. Only process 0 should - check this. Otherwise, if all processes try to check and the file - does not exist, one process will create the file and others who - reach later will return error. */ - - if (!rank) { - MPI_Comm_dup(MPI_COMM_SELF, &dupcommself); - /* NOTE: dupcommself is freed either in ADIO_Open if the open fails, - * or in ADIO_Close. - */ - *fh = ADIO_Open(MPI_COMM_SELF, dupcommself, filename, file_system, amode, - 0, MPI_BYTE, MPI_BYTE, M_ASYNC, info, - ADIO_PERM_NULL, &error_code); - /* broadcast the error code to other processes */ - MPI_Bcast(&error_code, 1, MPI_INT, 0, dupcomm); - /* if no error, close the file. It will be reopened normally - below. */ - if (error_code == MPI_SUCCESS) ADIO_Close(*fh, &error_code); - } - else MPI_Bcast(&error_code, 1, MPI_INT, 0, dupcomm); - - if (error_code != MPI_SUCCESS) { - MPI_Comm_free(&dupcomm); - *fh = MPI_FILE_NULL; -#ifdef MPI_hpux - HPMP_IO_OPEN_END(fl_xmpi, *fh, comm); -#endif /* MPI_hpux */ - return error_code; - } - else amode = amode ^ MPI_MODE_EXCL; /* turn off MPI_MODE_EXCL */ - } - -/* use default values for disp, etype, filetype */ -/* set iomode=M_ASYNC. It is used to implement the Intel PFS interface - on top of ADIO. Not relevant for MPI-IO implementation */ - - *fh = ADIO_Open(comm, dupcomm, filename, file_system, amode, 0, MPI_BYTE, - MPI_BYTE, M_ASYNC, info, ADIO_PERM_NULL, &error_code); - - /* if MPI_MODE_EXCL was removed, add it back */ - if ((error_code == MPI_SUCCESS) && (amode != orig_amode)) - (*fh)->access_mode = orig_amode; - - /* determine name of file that will hold the shared file pointer */ - /* can't support shared file pointers on a file system that doesn't - support file locking, e.g., PIOFS, PVFS */ - if ((error_code == MPI_SUCCESS) && ((*fh)->file_system != ADIO_PIOFS) - && ((*fh)->file_system != ADIO_PVFS)) { - ADIOI_Shfp_fname(*fh, rank); - - /* if MPI_MODE_APPEND, set the shared file pointer to end of file. - indiv. file pointer already set to end of file in ADIO_Open. - Here file view is just bytes. */ - if ((*fh)->access_mode & MPI_MODE_APPEND) { - if (!rank) ADIO_Set_shared_fp(*fh, (*fh)->fp_ind, &error_code); - MPI_Barrier(dupcomm); - } - } - -#ifdef MPI_hpux - HPMP_IO_OPEN_END(fl_xmpi, *fh, comm); -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_open = PMPI_File_open +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_open MPI_File_open +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_open as PMPI_File_open +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* for user-definde reduce operator */ +#include "adio_extern.h" + + +CtvExtern(int, ADIO_Init_keyval); + +/*@ + MPI_File_open - Opens a file + +Input Parameters: +. comm - communicator (handle) +. filename - name of file to open (string) +. amode - file access mode (integer) +. info - info object (handle) + +Output Parameters: +. fh - file handle (handle) + +.N fortran +@*/ +int MPI_File_open(MPI_Comm comm, char *filename, int amode, + MPI_Info info, MPI_File *fh) +{ + int error_code, file_system, flag, tmp_amode=0, rank; + char *tmp; + MPI_Comm dupcomm; + ADIOI_Fns *fsops; + static char myname[] = "MPI_FILE_OPEN"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_OPEN_START(fl_xmpi, comm); +#endif /* MPI_hpux */ + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + /* --BEGIN ERROR HANDLING-- */ + if (comm == MPI_COMM_NULL) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_COMM, + "**comm", 0); + goto fn_fail; + } + /* --END ERROR HANDLING-- */ + + MPI_Comm_test_inter(comm, &flag); + /* --BEGIN ERROR HANDLING-- */ + if (flag) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_COMM, + "**commnotintra", 0); + goto fn_fail; + } + + if ( ((amode&MPI_MODE_RDONLY)?1:0) + ((amode&MPI_MODE_RDWR)?1:0) + + ((amode&MPI_MODE_WRONLY)?1:0) != 1 ) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_AMODE, + "**fileamodeone", 0); + goto fn_fail; + } + + if ((amode & MPI_MODE_RDONLY) && + ((amode & MPI_MODE_CREATE) || (amode & MPI_MODE_EXCL))) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_AMODE, + "**fileamoderead", 0); + goto fn_fail; + } + + if ((amode & MPI_MODE_RDWR) && (amode & MPI_MODE_SEQUENTIAL)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_AMODE, + "**fileamodeseq", 0); + goto fn_fail; + } + + MPI_Comm_dup(comm, &dupcomm); + +/* check if ADIO has been initialized. If not, initialize it */ + MPIR_MPIOInit(&error_code); + if (error_code != MPI_SUCCESS) goto fn_fail; + +/* check if amode is the same on all processes */ + MPI_Allreduce(&amode, &tmp_amode, 1, MPI_INT, CtvAccess(ADIO_same_amode), dupcomm); + + if (tmp_amode == ADIO_AMODE_NOMATCH) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_AMODE, + "**fileamodediff", 0); + goto fn_fail; + } + /* --END ERROR HANDLING-- */ + + file_system = -1; + + /* resolve file system type from file name; this is a collective call */ + ADIO_ResolveFileType(dupcomm, filename, &file_system, &fsops, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + { + /* ADIO_ResolveFileType() will print as informative a message as it + * possibly can or call MPIO_Err_setmsg. We just need to propagate + * the error up. + */ + goto fn_fail; + } + + /* --END ERROR HANDLING-- */ + + /* strip off prefix if there is one, but only skip prefixes + * if they are greater than length one to allow for windows + * drive specifications (e.g. c:\...) */ + + tmp = strchr(filename, ':'); + if (tmp > filename + 1) { + filename = tmp + 1; + } + +/* use default values for disp, etype, filetype */ + + *fh = ADIO_Open(comm, dupcomm, filename, file_system, fsops, amode, 0, + MPI_BYTE, MPI_BYTE, info, ADIO_PERM_NULL, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) { + MPI_Comm_free(&dupcomm); + goto fn_fail; + } + /* --END ERROR HANDLING-- */ + + /* if MPI_MODE_SEQUENTIAL requested, file systems cannot do explicit offset + * or independent file pointer accesses, leaving not much else aside from + * shared file pointer accesses. */ + if ( !ADIO_Feature((*fh), ADIO_SHARED_FP) && (amode & MPI_MODE_SEQUENTIAL)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNSUPPORTED_OPERATION, + "**iosequnsupported", 0); + ADIO_Close(*fh, &error_code); + goto fn_fail; + } + + /* determine name of file that will hold the shared file pointer */ + /* can't support shared file pointers on a file system that doesn't + support file locking. */ + if ((error_code == MPI_SUCCESS) && + ADIO_Feature((*fh), ADIO_SHARED_FP)) { + MPI_Comm_rank(dupcomm, &rank); + ADIOI_Shfp_fname(*fh, rank); + + /* if MPI_MODE_APPEND, set the shared file pointer to end of file. + indiv. file pointer already set to end of file in ADIO_Open. + Here file view is just bytes. */ + if ((*fh)->access_mode & MPI_MODE_APPEND) { + if (rank == (*fh)->hints->ranklist[0]) /* only one person need set the sharedfp */ + ADIO_Set_shared_fp(*fh, (*fh)->fp_ind, &error_code); + MPI_Barrier(dupcomm); + } + } + +#ifdef MPI_hpux + HPMP_IO_OPEN_END(fl_xmpi, *fh, comm); +#endif /* MPI_hpux */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + return error_code; +fn_fail: + /* --BEGIN ERROR HANDLING-- */ + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; + /* --END ERROR HANDLING-- */ +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/prealloc.c b/src/libs/ck-libs/ampi/romio/mpi-io/prealloc.c index eceef828e4..620a6c78e4 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/prealloc.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/prealloc.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -33,13 +32,12 @@ Input Parameters: .N fortran @*/ -int MPI_File_preallocate(MPI_File fh, MPI_Offset size) +int MPI_File_preallocate(MPI_File mpi_fh, MPI_Offset size) { ADIO_Fcntl_t *fcntl_struct; - int error_code, mynod; -#ifndef PRINT_ERR_MSG + int error_code=0, mynod=0; + ADIO_File fh; static char myname[] = "MPI_FILE_PREALLOCATE"; -#endif MPI_Offset tmp_sz; #ifdef MPI_hpux int fl_xmpi; @@ -48,41 +46,36 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size) fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_preallocate: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); if (size < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_preallocate: Invalid size argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_SIZE_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadsize", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } tmp_sz = size; MPI_Bcast(&tmp_sz, 1, ADIO_OFFSET, 0, fh->comm); if (tmp_sz != size) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_preallocate: size argument must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_SIZE_ARG_NOT_SAME, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**notsame", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ + + if (size == 0) goto fn_exit; - if (size == 0) return MPI_SUCCESS; + ADIOI_TEST_DEFERRED(fh, myname, &error_code); MPI_Comm_rank(fh->comm, &mynod); if (!mynod) { @@ -90,12 +83,22 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size) fcntl_struct->diskspace = size; ADIO_Fcntl(fh, ADIO_FCNTL_SET_DISKSPACE, fcntl_struct, &error_code); ADIOI_Free(fcntl_struct); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ } MPI_Barrier(fh->comm); #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ + + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + /* TODO: bcast result? */ if (!mynod) return error_code; else return MPI_SUCCESS; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/rd_atallb.c b/src/libs/ck-libs/ampi/romio/mpi-io/rd_atallb.c dissimilarity index 72% index cdc006f3c7..901c50cab3 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/rd_atallb.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/rd_atallb.c @@ -1,131 +1,51 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_read_at_all_begin = PMPI_File_read_at_all_begin -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_read_at_all_begin MPI_File_read_at_all_begin -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_read_at_all_begin as PMPI_File_read_at_all_begin -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_read_at_all_begin - Begin a split collective read using explict offset - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (nonnegative integer) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) - -.N fortran -@*/ -int MPI_File_read_at_all_begin(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype) -{ - int error_code, datatype_size; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_READ_AT_ALL_BEGIN"; -#endif - MPI_Status status; - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_at_all_begin: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all_begin: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all_begin: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all_begin: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all_begin: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->split_coll_count) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all_begin: Only one active split collective I/O operation allowed per file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - fh->split_coll_count = 1; - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all_begin: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, &status, &error_code); - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_read_at_all_begin = PMPI_File_read_at_all_begin +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_read_at_all_begin MPI_File_read_at_all_begin +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_read_at_all_begin as PMPI_File_read_at_all_begin +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_read_at_all_begin - Begin a split collective read using explict offset + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (nonnegative integer) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) + +.N fortran +@*/ +int MPI_File_read_at_all_begin(MPI_File mpi_fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype) +{ + int error_code; + static char myname[] = "MPI_FILE_READ_AT_ALL_BEGIN"; + + error_code = MPIOI_File_read_all_begin(mpi_fh, offset, + ADIO_EXPLICIT_OFFSET, + buf, count, datatype, myname); + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/rd_atalle.c b/src/libs/ck-libs/ampi/romio/mpi-io/rd_atalle.c index de7e4a07eb..cdb1df61d2 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/rd_atalle.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/rd_atalle.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -25,7 +24,8 @@ #endif /*@ - MPI_File_read_at_all_end - Complete a split collective read using explict offset + MPI_File_read_at_all_end - Complete a split collective read using + explict offset Input Parameters: . fh - file handle (handle) @@ -36,34 +36,13 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_at_all_end(MPI_File fh, void *buf, MPI_Status *status) +int MPI_File_read_at_all_end(MPI_File mpi_fh, void *buf, MPI_Status *status) { -#ifndef PRINT_ERR_MSG int error_code; static char myname[] = "MPI_FILE_READ_AT_ALL_END"; -#endif - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_at_all_end: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - if (!(fh->split_coll_count)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all_end: Does not match a previous MPI_File_read_at_all_begin\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - fh->split_coll_count = 0; + error_code = MPIOI_File_read_all_end(mpi_fh, buf, myname, status); - return MPI_SUCCESS; + return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read.c b/src/libs/ck-libs/ampi/romio/mpi-io/read.c dissimilarity index 68% index e09789f5ec..08de2b4334 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read.c @@ -1,161 +1,165 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_read = PMPI_File_read -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_read MPI_File_read -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_read as PMPI_File_read -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* status object not filled currently */ - - -/*@ - MPI_File_read - Read using individual file pointer - -Input Parameters: -. fh - file handle (handle) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) -. status - status object (Status) - -.N fortran -@*/ -int MPI_File_read(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) -{ - int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_READ"; -#endif - int datatype_size; - ADIO_Offset off; -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEREAD, TRDTBLOCK, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - if (count*datatype_size == 0) { -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return MPI_SUCCESS; - } - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_WRONLY) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read: Can't read from a file opened with MPI_MODE_WRONLY\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_MODE_WRONLY, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); - - /* contiguous or strided? */ - - if (buftype_is_contig && filetype_is_contig) { - bufsize = datatype_size * count; - /* if atomic mode requested, lock (exclusive) the region, because there - could be a concurrent noncontiguous request. Locking doesn't - work on PIOFS and PVFS, and on NFS it is done in the ADIO_ReadContig.*/ - off = fh->fp_ind; - if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); - - ADIO_ReadContig(fh, buf, count, datatype, ADIO_INDIVIDUAL, 0, - status, &error_code); - - if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - } - else ADIO_ReadStrided(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, &error_code); - /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ - -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_read = PMPI_File_read +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_read MPI_File_read +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_read as PMPI_File_read +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* status object not filled currently */ + +/*@ + MPI_File_read - Read using individual file pointer + +Input Parameters: +. fh - file handle (handle) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) +. status - status object (Status) + +.N fortran +@*/ +int MPI_File_read(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status) +{ + int error_code; + static char myname[] = "MPI_FILE_READ"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEREAD, TRDTBLOCK, mpi_fh, datatype, count); +#endif /* MPI_hpux */ + + error_code = MPIOI_File_read(mpi_fh, (MPI_Offset) 0, ADIO_INDIVIDUAL, buf, + count, datatype, myname, status); + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, mpi_fh, datatype, count); +#endif /* MPI_hpux */ + + return error_code; +} + +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_read(MPI_File mpi_fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Status *status) +{ + int error_code, bufsize, buftype_is_contig, filetype_is_contig; + int datatype_size; + ADIO_File fh; + ADIO_Offset off; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Type_size(datatype, &datatype_size); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + if (count*datatype_size == 0) + { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + error_code = MPI_SUCCESS; + goto fn_exit; + } + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_READABLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); + + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + + if (buftype_is_contig && filetype_is_contig) + { + /* convert count and offset to bytes */ + bufsize = datatype_size * count; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fh->disp + fh->etype_size * offset; + } + else /* ADIO_INDIVIDUAL */ { + off = fh->fp_ind; + } + + /* if atomic mode requested, lock (exclusive) the region, because + there could be a concurrent noncontiguous request. + */ + if ((fh->atomicity) && ADIO_Feature(fh, ADIO_LOCKS)) { + ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); + } + + ADIO_ReadContig(fh, buf, count, datatype, file_ptr_type, + off, status, &error_code); + + if ((fh->atomicity) && ADIO_Feature(fh, ADIO_LOCKS)) { + ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); + } + } + else + { + ADIO_ReadStrided(fh, buf, count, datatype, file_ptr_type, + offset, status, &error_code); + /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ + } + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read_all.c b/src/libs/ck-libs/ampi/romio/mpi-io/read_all.c dissimilarity index 61% index a6afeb3ced..e180b7d108 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read_all.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read_all.c @@ -1,127 +1,119 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_read_all = PMPI_File_read_all -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_read_all MPI_File_read_all -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_read_all as PMPI_File_read_all -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* status object not filled currently */ - -/*@ - MPI_File_read_all - Collective read using individual file pointer - -Input Parameters: -. fh - file handle (handle) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) -. status - status object (Status) - -.N fortran -@*/ -int MPI_File_read_all(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) -{ - int error_code, datatype_size; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_READ_ALL"; -#endif -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEREADALL, TRDTBLOCK, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_all: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_WRONLY) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all: Can't read from a file opened with MPI_MODE_WRONLY\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_MODE_WRONLY, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, &error_code); -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_read_all = PMPI_File_read_all +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_read_all MPI_File_read_all +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_read_all as PMPI_File_read_all +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* status object not filled currently */ + +/*@ + MPI_File_read_all - Collective read using individual file pointer + +Input Parameters: +. fh - file handle (handle) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) +. status - status object (Status) + +.N fortran +@*/ +int MPI_File_read_all(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status) +{ + int error_code; + static char myname[] = "MPI_FILE_READ_ALL"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEREADALL, TRDTBLOCK, fh, datatype, count); +#endif /* MPI_hpux */ + + error_code = MPIOI_File_read_all(mpi_fh, (MPI_Offset) 0, + ADIO_INDIVIDUAL, buf, + count, datatype, myname, status); + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, fh, datatype, count); +#endif /* MPI_hpux */ + + return error_code; +} + +/* Note: MPIOI_File_read_all also used by MPI_File_read_at_all */ +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_read_all(MPI_File mpi_fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Status *status) +{ + int error_code, datatype_size; + ADIO_File fh; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Type_size(datatype, &datatype_size); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_READABLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIO_ReadStridedColl(fh, buf, count, datatype, file_ptr_type, + offset, status, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read_allb.c b/src/libs/ck-libs/ampi/romio/mpi-io/read_allb.c dissimilarity index 64% index c6c218f831..a31f9f6d15 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read_allb.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read_allb.c @@ -1,119 +1,116 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_read_all_begin = PMPI_File_read_all_begin -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_read_all_begin MPI_File_read_all_begin -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_read_all_begin as PMPI_File_read_all_begin -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_read_all_begin - Begin a split collective read using individual file pointer - -Input Parameters: -. fh - file handle (handle) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) - -.N fortran -@*/ -int MPI_File_read_all_begin(MPI_File fh, void *buf, int count, - MPI_Datatype datatype) -{ - int error_code, datatype_size; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_READ_ALL_BEGIN"; -#endif - MPI_Status status; - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_all_begin: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all_begin: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all_begin: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all_begin: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->split_coll_count) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all_begin: Only one active split collective I/O operation allowed per file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - fh->split_coll_count = 1; - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all_begin: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, &status, &error_code); - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_read_all_begin = PMPI_File_read_all_begin +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_read_all_begin MPI_File_read_all_begin +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_read_all_begin as PMPI_File_read_all_begin +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_read_all_begin - Begin a split collective read using individual file pointer + +Input Parameters: +. fh - file handle (handle) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) + +.N fortran +@*/ +int MPI_File_read_all_begin(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype) +{ + int error_code; + static char myname[] = "MPI_FILE_READ_ALL_BEGIN"; + + error_code = MPIOI_File_read_all_begin(mpi_fh, (MPI_Offset) 0, + ADIO_INDIVIDUAL, buf, count, + datatype, myname); + + return error_code; +} + +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_read_all_begin(MPI_File mpi_fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname) +{ + int error_code, datatype_size; + ADIO_File fh; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Type_size(datatype, &datatype_size); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_READABLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + + if (fh->split_coll_count) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iosplitcoll", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + fh->split_coll_count = 1; + + ADIO_ReadStridedColl(fh, buf, count, datatype, file_ptr_type, + offset, &fh->split_status, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read_alle.c b/src/libs/ck-libs/ampi/romio/mpi-io/read_alle.c index d78c4fa50a..6d29924a35 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read_alle.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read_alle.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -25,7 +24,8 @@ #endif /*@ - MPI_File_read_all_end - Complete a split collective read using individual file pointer + MPI_File_read_all_end - Complete a split collective read using + individual file pointer Input Parameters: . fh - file handle (handle) @@ -36,34 +36,53 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status *status) +int MPI_File_read_all_end(MPI_File mpi_fh, void *buf, MPI_Status *status) { -#ifndef PRINT_ERR_MSG int error_code; static char myname[] = "MPI_FILE_IREAD"; -#endif -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_all_end: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + error_code = MPIOI_File_read_all_end(mpi_fh, buf, myname, status); + + return error_code; +} + +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_read_all_end(MPI_File mpi_fh, + void *buf, + char *myname, + MPI_Status *status) +{ + int error_code; + ADIO_File fh; + + MPIU_UNREFERENCED_ARG(buf); + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); if (!(fh->split_coll_count)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_all_end: Does not match a previous MPI_File_read_all_begin\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iosplitcollnone", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ +#ifdef HAVE_STATUS_SET_BYTES + if (status != MPI_STATUS_IGNORE) + *status = fh->split_status; +#endif fh->split_coll_count = 0; +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + return MPI_SUCCESS; } +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read_at.c b/src/libs/ck-libs/ampi/romio/mpi-io/read_at.c dissimilarity index 78% index e04269dad4..d30e97ea52 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read_at.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read_at.c @@ -1,178 +1,63 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_read_at = PMPI_File_read_at -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_read_at MPI_File_read_at -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_read_at as PMPI_File_read_at -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* status object not filled currently */ - - -/*@ - MPI_File_read_at - Read using explict offset - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (nonnegative integer) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) -. status - status object (Status) - -.N fortran -@*/ -int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, MPI_Status *status) -{ - int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_READ_AT"; -#endif - int datatype_size; - ADIO_Offset off; -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEREADAT, TRDTBLOCK, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_at: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - if (count*datatype_size == 0) { -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return MPI_SUCCESS; - } - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_WRONLY) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at: Can't read from a file opened with MPI_MODE_WRONLY\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_MODE_WRONLY, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); - - /* contiguous or strided? */ - - if (buftype_is_contig && filetype_is_contig) { - /* convert count and offset to bytes */ - bufsize = datatype_size * count; - off = fh->disp + fh->etype_size * offset; - - /* if atomic mode requested, lock (exclusive) the region, because there - could be a concurrent noncontiguous request. Locking doesn't - work on PIOFS and PVFS, and on NFS it is done in the ADIO_ReadContig.*/ - - if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); - - ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, status, &error_code); - - if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - } - else ADIO_ReadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, status, &error_code); - /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ - - -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} - +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_read_at = PMPI_File_read_at +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_read_at MPI_File_read_at +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_read_at as PMPI_File_read_at +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* status object not filled currently */ + +/*@ + MPI_File_read_at - Read using explict offset + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (nonnegative integer) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) +. status - status object (Status) + +.N fortran +@*/ +int MPI_File_read_at(MPI_File mpi_fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPI_Status *status) +{ + int error_code; + static char myname[] = "MPI_FILE_READ_AT"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEREADAT, TRDTBLOCK, mpi_fh, datatype, + count); +#endif /* MPI_hpux */ + + /* ADIOI_File_read() defined in mpi-io/read.c */ + error_code = MPIOI_File_read(mpi_fh, offset, ADIO_EXPLICIT_OFFSET, buf, + count, datatype, myname, status); + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, mpi_fh, datatype, count); +#endif /* MPI_hpux */ + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read_atall.c b/src/libs/ck-libs/ampi/romio/mpi-io/read_atall.c dissimilarity index 68% index 7e2b12e84a..9ff3bcf9c5 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read_atall.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read_atall.c @@ -1,140 +1,64 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_read_at_all = PMPI_File_read_at_all -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_read_at_all MPI_File_read_at_all -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_read_at_all as PMPI_File_read_at_all -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* status object not filled currently */ - -/*@ - MPI_File_read_at_all - Collective read using explict offset - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (nonnegative integer) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) -. status - status object (Status) - -.N fortran -@*/ -int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, - MPI_Status *status) -{ - int error_code, datatype_size; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_IREAD_AT"; -#endif -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEREADATALL, TRDTBLOCK, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_at_all: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_at_all: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_WRONLY) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_atall: Can't read from a file opened with MPI_MODE_WRONLY\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_MODE_WRONLY, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_atall: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, status, &error_code); -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_read_at_all = PMPI_File_read_at_all +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_read_at_all MPI_File_read_at_all +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_read_at_all as PMPI_File_read_at_all +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* status object not filled currently */ + +/*@ + MPI_File_read_at_all - Collective read using explict offset + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (nonnegative integer) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) +. status - status object (Status) + +.N fortran +@*/ +int MPI_File_read_at_all(MPI_File mpi_fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPI_Status *status) +{ + int error_code; + static char myname[] = "MPI_FILE_IREAD_AT"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEREADATALL, TRDTBLOCK, mpi_fh, datatype, + count); +#endif /* MPI_hpux */ + + error_code = MPIOI_File_read_all(mpi_fh, offset, ADIO_EXPLICIT_OFFSET, buf, + count, datatype, myname, status); + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, mpi_fh, datatype, count); +#endif /* MPI_hpux */ + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read_ord.c b/src/libs/ck-libs/ampi/romio/mpi-io/read_ord.c dissimilarity index 60% index 9c4827ccd0..41993cb55f 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read_ord.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read_ord.c @@ -1,125 +1,106 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_read_ordered = PMPI_File_read_ordered -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_read_ordered MPI_File_read_ordered -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_read_ordered as PMPI_File_read_ordered -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* status object not filled currently */ - -/*@ - MPI_File_read_ordered - Collective read using shared file pointer - -Input Parameters: -. fh - file handle (handle) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) -. status - status object (Status) - -.N fortran -@*/ -int MPI_File_read_ordered(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) -{ - int error_code, datatype_size, nprocs, myrank, i, incr; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_READ_ORDERED"; -#endif - ADIO_Offset shared_fp; - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_ordered: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered: Shared file pointer not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Comm_size(fh->comm, &nprocs); - MPI_Comm_rank(fh->comm, &myrank); - - incr = (count*datatype_size)/fh->etype_size; - for (i=0; icomm); - } - - ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, status, &error_code); - - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_read_ordered = PMPI_File_read_ordered +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_read_ordered MPI_File_read_ordered +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_read_ordered as PMPI_File_read_ordered +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* status object not filled currently */ + +/*@ + MPI_File_read_ordered - Collective read using shared file pointer + +Input Parameters: +. fh - file handle (handle) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) +. status - status object (Status) + +.N fortran +@*/ +int MPI_File_read_ordered(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status) +{ + int error_code, datatype_size, nprocs, myrank, incr; + int source, dest; + static char myname[] = "MPI_FILE_READ_ORDERED"; + ADIO_Offset shared_fp=0; + ADIO_File fh; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + /* --END ERROR HANDLING-- */ + + MPI_Type_size(datatype, &datatype_size); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIOI_TEST_DEFERRED(fh, "MPI_File_read_ordered", &error_code); + + MPI_Comm_size(fh->comm, &nprocs); + MPI_Comm_rank(fh->comm, &myrank); + + incr = (count*datatype_size)/fh->etype_size; + + /* Use a message as a 'token' to order the operations */ + source = myrank - 1; + dest = myrank + 1; + if (source < 0) source = MPI_PROC_NULL; + if (dest >= nprocs) dest = MPI_PROC_NULL; + MPI_Recv(NULL, 0, MPI_BYTE, source, 0, fh->comm, MPI_STATUS_IGNORE); + + ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Send(NULL, 0, MPI_BYTE, dest, 0, fh->comm); + + ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + shared_fp, status, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + /* FIXME: Check for error code from ReadStridedColl? */ + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read_ordb.c b/src/libs/ck-libs/ampi/romio/mpi-io/read_ordb.c dissimilarity index 65% index dd66416ed7..2686ca3727 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read_ordb.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read_ordb.c @@ -1,136 +1,113 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_read_ordered_begin = PMPI_File_read_ordered_begin -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_read_ordered_begin MPI_File_read_ordered_begin -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_read_ordered_begin as PMPI_File_read_ordered_begin -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_read_ordered_begin - Begin a split collective read using shared file pointer - -Input Parameters: -. fh - file handle (handle) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) - -.N fortran -@*/ -int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count, - MPI_Datatype datatype) -{ - int error_code, datatype_size, nprocs, myrank, i, incr; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_READ_ORDERED_BEGIN"; -#endif - ADIO_Offset shared_fp; - MPI_Status status; - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_ordered_begin: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered_begin: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered_begin: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->split_coll_count) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered_begin: Only one active split collective I/O operation allowed per file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - fh->split_coll_count = 1; - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered_begin: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered_begin: Shared file pointer not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Comm_size(fh->comm, &nprocs); - MPI_Comm_rank(fh->comm, &myrank); - - incr = (count*datatype_size)/fh->etype_size; - for (i=0; icomm); - } - - ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, &status, &error_code); - - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_read_ordered_begin = PMPI_File_read_ordered_begin +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_read_ordered_begin MPI_File_read_ordered_begin +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_read_ordered_begin as PMPI_File_read_ordered_begin +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_read_ordered_begin - Begin a split collective read using shared file pointer + +Input Parameters: +. fh - file handle (handle) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) + +.N fortran +@*/ +int MPI_File_read_ordered_begin(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype) +{ + int error_code, datatype_size, nprocs, myrank, incr; + int source, dest; + ADIO_Offset shared_fp; + ADIO_File fh; + static char myname[] = "MPI_FILE_READ_ORDERED_BEGIN"; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + + if (fh->split_coll_count) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iosplitcoll", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + fh->split_coll_count = 1; + + + MPI_Type_size(datatype, &datatype_size); + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + + MPI_Comm_size(fh->comm, &nprocs); + MPI_Comm_rank(fh->comm, &myrank); + + incr = (count*datatype_size)/fh->etype_size; + /* Use a message as a 'token' to order the operations */ + source = myrank - 1; + dest = myrank + 1; + if (source < 0) source = MPI_PROC_NULL; + if (dest >= nprocs) dest = MPI_PROC_NULL; + MPI_Recv(NULL, 0, MPI_BYTE, source, 0, fh->comm, MPI_STATUS_IGNORE); + + ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + { + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Send(NULL, 0, MPI_BYTE, dest, 0, fh->comm); + + ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + shared_fp, &fh->split_status, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read_orde.c b/src/libs/ck-libs/ampi/romio/mpi-io/read_orde.c index ddafb0831b..d07a2ddf43 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read_orde.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read_orde.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -36,34 +35,39 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status) +int MPI_File_read_ordered_end(MPI_File mpi_fh, void *buf, MPI_Status *status) { -#ifndef PRINT_ERR_MSG - int error_code; + int error_code=MPI_SUCCESS; + ADIO_File fh; static char myname[] = "MPI_FILE_READ_ORDERED_END"; -#endif -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_ordered_end: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_UNREFERENCED_ARG(buf); - if (!(fh->split_coll_count)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_ordered_end: Does not match a previous MPI_File_read_ordered_begin\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + + if (!(fh->split_coll_count)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iosplitcollnone", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ +#ifdef HAVE_STATUS_SET_BYTES + if (status != MPI_STATUS_IGNORE) + *status = fh->split_status; +#endif fh->split_coll_count = 0; - return MPI_SUCCESS; +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/read_sh.c b/src/libs/ck-libs/ampi/romio/mpi-io/read_sh.c index 77256f463e..f1459767f3 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/read_sh.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/read_sh.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -40,84 +39,65 @@ Output Parameters: .N fortran @*/ -int MPI_File_read_shared(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) +int MPI_File_read_shared(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status) { int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG static char myname[] = "MPI_FILE_READ_SHARED"; -#endif int datatype_size, incr; ADIO_Offset off, shared_fp; + ADIO_File fh; -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_read_shared: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_shared: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + fh = MPIO_File_resolve(mpi_fh); - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_shared: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + /* --END ERROR HANDLING-- */ MPI_Type_size(datatype, &datatype_size); - if (count*datatype_size == 0) return MPI_SUCCESS; - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_shared: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_read_shared: Shared file pointer not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + if (count*datatype_size == 0) + { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); #endif + error_code = MPI_SUCCESS; + goto fn_exit; } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_READABLE(fh, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); + /* --END ERROR HANDLING-- */ + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + incr = (count*datatype_size)/fh->etype_size; + ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code); - if (error_code != MPI_SUCCESS) { - FPRINTF(stderr, "MPI_File_read_shared: Error! Could not access shared file pointer.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + { + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ /* contiguous or strided? */ - if (buftype_is_contig && filetype_is_contig) { + if (buftype_is_contig && filetype_is_contig) + { /* convert count and shared_fp to bytes */ bufsize = datatype_size * count; off = fh->disp + fh->etype_size * shared_fp; @@ -135,9 +115,20 @@ int MPI_File_read_shared(MPI_File fh, void *buf, int count, if ((fh->atomicity) && (fh->file_system != ADIO_NFS)) ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); } - else ADIO_ReadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, status, &error_code); - /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ + else + { + ADIO_ReadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + shared_fp, status, &error_code); + /* For strided and atomic mode, locking is done in ADIO_ReadStrided */ + } + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/register_datarep.c b/src/libs/ck-libs/ampi/romio/mpi-io/register_datarep.c new file mode 100644 index 0000000000..729834d335 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi-io/register_datarep.c @@ -0,0 +1,135 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" +#include "adio_extern.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_Register_datarep = PMPI_Register_datarep +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_Register_datarep MPI_Register_datarep +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_Register_datarep as PMPI_Register_datarep +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_Register_datarep - Register functions for user-defined data + representations + + Input Parameters: ++ name - data representation name (string) +. read_conv_fn - function invoked to convert from file representation to + native representation (function) +. write_conv_fn - function invoked to convert from native representation to + file representation (function) +. extent_fn - function invoked to get the exted of a datatype as represented + in the file (function) +- extra_state - pointer to extra state that is passed to each of the + three functions + + Notes: + This function allows the user to provide routines to convert data from + an external representation, used within a file, and the native representation, + used within the CPU. There is one predefined data representation, + 'external32'. Please consult the MPI-2 standard for details on this + function. + +.N fortran + + @*/ +int MPI_Register_datarep(char *name, + MPI_Datarep_conversion_function *read_conv_fn, + MPI_Datarep_conversion_function *write_conv_fn, + MPI_Datarep_extent_function *extent_fn, + void *state) +{ + int error_code; + ADIOI_Datarep *datarep; + static char myname[] = "MPI_REGISTER_DATAREP"; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + /* --BEGIN ERROR HANDLING-- */ + /* check datarep name (use strlen instead of strnlen because + strnlen is not portable) */ + if (name == NULL || + strlen(name) < 1 || + strlen(name) > MPI_MAX_DATAREP_STRING) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "**datarepname", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPIR_MPIOInit(&error_code); + if (error_code != MPI_SUCCESS) goto fn_exit; + + /* --BEGIN ERROR HANDLING-- */ + /* check datarep isn't already registered */ + for (datarep = CtvAccess(ADIOI_Datarep_head); datarep; datarep = datarep->next) { + if (!strncmp(name, datarep->name, MPI_MAX_DATAREP_STRING)) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_DUP_DATAREP, + "**datarepused", + "**datarepused %s", + name); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; + } + } + + /* check extent function pointer */ + if (extent_fn == NULL) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "**datarepextent", 0); + error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + datarep = ADIOI_Malloc(sizeof(ADIOI_Datarep)); +/* need to ifdef MPICH2 because if it is MPICH2 in memory tracing mode, it will complain + about the use of strdup instead of MPIU_Strdup. (mpiimpl.h is being included in mpioimpl.h + ifdef MPICH2 */ +#ifdef MPICH2 + datarep->name = MPIU_Strdup(name); +#else + datarep->name = ADIOI_Strdup(name); +#endif + datarep->state = state; + datarep->read_conv_fn = read_conv_fn; + datarep->write_conv_fn = write_conv_fn; + datarep->extent_fn = extent_fn; + datarep->next = CtvAccess(ADIOI_Datarep_head); + + CtvAccess(ADIOI_Datarep_head) = datarep; + + error_code = MPI_SUCCESS; + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/seek.c b/src/libs/ck-libs/ampi/romio/mpi-io/seek.c index 4f15e91065..e038d4fa7d 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/seek.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/seek.c @@ -1,12 +1,12 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "mpioimpl.h" +#include "adioi.h" #ifdef HAVE_WEAK_SYMBOLS @@ -34,97 +34,104 @@ Input Parameters: .N fortran @*/ -int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence) +int MPI_File_seek(MPI_File mpi_fh, MPI_Offset offset, int whence) { int error_code; -#ifndef PRINT_ERR_MSG + ADIO_File fh; static char myname[] = "MPI_FILE_SEEK"; -#endif MPI_Offset curr_offset, eof_offset; + #ifdef MPI_hpux int fl_xmpi; HPMP_IO_START(fl_xmpi, BLKMPIFILESEEK, TRDTBLOCK, fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_seek: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + /* --END ERROR HANDLING-- */ switch(whence) { case MPI_SEEK_SET: + /* --BEGIN ERROR HANDLING-- */ if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ break; case MPI_SEEK_CUR: /* find offset corr. to current location of file pointer */ - ADIOI_Get_position(fh, (ADIO_Offset*)&curr_offset); + ADIOI_Get_position(fh, &curr_offset); offset += curr_offset; + + /* --BEGIN ERROR HANDLING-- */ if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek: offset points to a negative location in the file\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG_NEG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_ARG, + "**ionegoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ + break; case MPI_SEEK_END: + /* we can in many cases do seeks w/o a file actually opened, but not in + * the MPI_SEEK_END case */ + ADIOI_TEST_DEFERRED(fh, "MPI_File_seek", &error_code); + /* find offset corr. to end of file */ - ADIOI_Get_eof_offset(fh, (ADIO_Offset*)&eof_offset); + ADIOI_Get_eof_offset(fh, &eof_offset); offset += eof_offset; + + /* --BEGIN ERROR HANDLING-- */ if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek: offset points to a negative location in the file\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG_NEG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, myname, + __LINE__, MPI_ERR_ARG, + "**ionegoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ + break; default: -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek: Invalid whence argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_WHENCE_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + /* --BEGIN ERROR HANDLING-- */ + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadwhence", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + /* --END ERROR HANDLING-- */ } ADIO_SeekIndividual(fh, offset, ADIO_SEEK_SET, &error_code); + /* TODO: what do we do with this error? */ + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ + + error_code = MPI_SUCCESS; + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/seek_sh.c b/src/libs/ck-libs/ampi/romio/mpi-io/seek_sh.c dissimilarity index 69% index db9ba2d274..feb11ae756 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/seek_sh.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/seek_sh.c @@ -1,169 +1,182 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_seek_shared = PMPI_File_seek_shared -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_seek_shared MPI_File_seek_shared -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_seek_shared as PMPI_File_seek_shared -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_seek_shared - Updates the shared file pointer - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (integer) -. whence - update mode (state) - -.N fortran -@*/ -int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence) -{ - int error_code=MPI_SUCCESS, tmp_whence, myrank; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_SEEK_SHARED"; -#endif - MPI_Offset curr_offset, eof_offset, tmp_offset; - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_seek_shared: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek_shared: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek_shared: Shared file pointer not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - tmp_offset = offset; - MPI_Bcast(&tmp_offset, 1, ADIO_OFFSET, 0, fh->comm); - if (tmp_offset != offset) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek_shared: offset must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG_NOT_SAME, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - tmp_whence = whence; - MPI_Bcast(&tmp_whence, 1, MPI_INT, 0, fh->comm); - if (tmp_whence != whence) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek_shared: whence argument must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_WHENCE_ARG_NOT_SAME, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Comm_rank(fh->comm, &myrank); - - if (!myrank) { - switch(whence) { - case MPI_SEEK_SET: - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek_shared: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - break; - case MPI_SEEK_CUR: - /* get current location of shared file pointer */ - ADIO_Get_shared_fp(fh, 0, (ADIO_Offset*)&curr_offset, &error_code); - if (error_code != MPI_SUCCESS) { - FPRINTF(stderr, "MPI_File_seek_shared: Error! Could not access shared file pointer.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - offset += curr_offset; - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek_shared: offset points to a negative location in the file\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG_NEG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - break; - case MPI_SEEK_END: - /* find offset corr. to end of file */ - ADIOI_Get_eof_offset(fh, (ADIO_Offset*)&eof_offset); - offset += eof_offset; - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek_shared: offset points to a negative location in the file\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG_NEG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - break; - default: -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_seek_shared: Invalid whence argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_WHENCE_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIO_Set_shared_fp(fh, offset, &error_code); - } - - MPI_Barrier(fh->comm); - - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_seek_shared = PMPI_File_seek_shared +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_seek_shared MPI_File_seek_shared +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_seek_shared as PMPI_File_seek_shared +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_seek_shared - Updates the shared file pointer + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (integer) +. whence - update mode (state) + +.N fortran +@*/ +int MPI_File_seek_shared(MPI_File mpi_fh, MPI_Offset offset, int whence) +{ + int error_code=MPI_SUCCESS, tmp_whence, myrank; + static char myname[] = "MPI_FILE_SEEK_SHARED"; + MPI_Offset curr_offset, eof_offset, tmp_offset; + ADIO_File fh; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); + /* --END ERROR HANDLING-- */ + + tmp_offset = offset; + MPI_Bcast(&tmp_offset, 1, ADIO_OFFSET, 0, fh->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_offset != offset) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**notsame", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + tmp_whence = whence; + MPI_Bcast(&tmp_whence, 1, MPI_INT, 0, fh->comm); + /* --BEGIN ERROR HANDLING-- */ + if (tmp_whence != whence) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadwhence", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + ADIOI_TEST_DEFERRED(fh, "MPI_File_seek_shared", &error_code); + + MPI_Comm_rank(fh->comm, &myrank); + + if (!myrank) + { + switch(whence) + { + case MPI_SEEK_SET: + /* --BEGIN ERROR HANDLING-- */ + if (offset < 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + break; + case MPI_SEEK_CUR: + /* get current location of shared file pointer */ + ADIO_Get_shared_fp(fh, 0, &curr_offset, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_FATAL, + myname, __LINE__, + MPI_ERR_INTERN, + "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + offset += curr_offset; + /* --BEGIN ERROR HANDLING-- */ + if (offset < 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "**ionegoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + break; + case MPI_SEEK_END: + /* find offset corr. to end of file */ + ADIOI_Get_eof_offset(fh, &eof_offset); + offset += eof_offset; + /* --BEGIN ERROR HANDLING-- */ + if (offset < 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_ARG, + "**ionegoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + break; + default: + /* --BEGIN ERROR HANDLING-- */ + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadwhence", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + /* --END ERROR HANDLING-- */ + } + + ADIO_Set_shared_fp(fh, offset, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_FATAL, + myname, __LINE__, + MPI_ERR_INTERN, + "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + } + + /* FIXME: explain why the barrier is necessary */ + MPI_Barrier(fh->comm); + + error_code = MPI_SUCCESS; + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/set_atom.c b/src/libs/ck-libs/ampi/romio/mpi-io/set_atom.c index f90e4b73b2..4a1c4655f6 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/set_atom.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/set_atom.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -33,45 +32,58 @@ Input Parameters: .N fortran @*/ -int MPI_File_set_atomicity(MPI_File fh, int flag) +int MPI_File_set_atomicity(MPI_File mpi_fh, int flag) { int error_code, tmp_flag; -#ifndef PRINT_ERR_MSG static char myname[] = "MPI_FILE_SET_ATOMICITY"; -#endif ADIO_Fcntl_t *fcntl_struct; + ADIO_File fh; -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_set_atomicity: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIOI_TEST_DEFERRED(fh, myname, &error_code); if (flag) flag = 1; /* take care of non-one values! */ /* check if flag is the same on all processes */ tmp_flag = flag; MPI_Bcast(&tmp_flag, 1, MPI_INT, 0, fh->comm); + + /* --BEGIN ERROR HANDLING-- */ if (tmp_flag != flag) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_atomicity: flag must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_FLAG_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**notsame", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + if (fh->atomicity == flag){ + error_code = MPI_SUCCESS; + goto fn_exit; } - if (fh->atomicity == flag) return MPI_SUCCESS; fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t)); fcntl_struct->atomicity = flag; ADIO_Fcntl(fh, ADIO_FCNTL_SET_ATOMICITY, fcntl_struct, &error_code); + /* TODO: what do we do with this error code? */ + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + ADIOI_Free(fcntl_struct); +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/set_errh.c b/src/libs/ck-libs/ampi/romio/mpi-io/set_errh.c index d275770ea4..b23e43a114 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/set_errh.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/set_errh.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -34,30 +33,42 @@ Input Parameters: .N fortran @*/ -int MPI_File_set_errhandler(MPI_File fh, MPI_Errhandler errhandler) +int MPI_File_set_errhandler(MPI_File mpi_fh, MPI_Errhandler errhandler) { int error_code = MPI_SUCCESS; -#ifndef PRINT_ERR_MSG static char myname[] = "MPI_FILE_SET_ERRHANDLER"; -#endif + ADIO_File fh; + MPIU_THREADPRIV_DECL; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); - if ((errhandler != MPI_ERRORS_RETURN) || (errhandler != MPI_ERRORS_ARE_FATAL)) { - FPRINTF(stderr, "Only MPI_ERRORS_RETURN and MPI_ERRORS_ARE_FATAL are currently supported for MPI_File_set_errhandler\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + if (mpi_fh == MPI_FILE_NULL) { + CtvAccess(ADIOI_DFLT_ERR_HANDLER) = errhandler; } + else { + fh = MPIO_File_resolve(mpi_fh); - if (fh == MPI_FILE_NULL) CtvAccess(ADIOI_DFLT_ERR_HANDLER) = errhandler; - else if (fh->cookie != ADIOI_FILE_COOKIE) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_close: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_FILE, MPIR_ERR_FILE_CORRUPT, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(MPI_FILE_NULL, error_code, myname); -#endif + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + /* --END ERROR HANDLING-- */ + + if ((errhandler != MPI_ERRORS_RETURN) && + (errhandler != MPI_ERRORS_ARE_FATAL)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNSUPPORTED_OPERATION, + "**fileopunsupported", + 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + + fh->err_handler = errhandler; } - else fh->err_handler = errhandler; +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/set_info.c b/src/libs/ck-libs/ampi/romio/mpi-io/set_info.c index d96414c54b..e99fdc8fe7 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/set_info.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/set_info.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -33,24 +32,31 @@ Input Parameters: .N fortran @*/ -int MPI_File_set_info(MPI_File fh, MPI_Info info) +int MPI_File_set_info(MPI_File mpi_fh, MPI_Info info) { int error_code; -#ifndef PRINT_ERR_MSG static char myname[] = "MPI_FILE_SET_INFO"; -#endif + ADIO_File fh; -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_set_info: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + /* --END ERROR HANDLING-- */ /* set new info */ ADIO_SetInfo(fh, info, &error_code); + /* TODO: what to do with error code? */ + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/set_size.c b/src/libs/ck-libs/ampi/romio/mpi-io/set_size.c index 5a4f9c3a95..8823b12079 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/set_size.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/set_size.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -33,13 +32,13 @@ Input Parameters: .N fortran @*/ -int MPI_File_set_size(MPI_File fh, MPI_Offset size) +int MPI_File_set_size(MPI_File mpi_fh, MPI_Offset size) { int error_code; -#ifndef PRINT_ERR_MSG + ADIO_File fh; static char myname[] = "MPI_FILE_SET_SIZE"; -#endif MPI_Offset tmp_sz; + #ifdef MPI_hpux int fl_xmpi; @@ -47,45 +46,52 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size) MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_set_size: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); if (size < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_size: Invalid size argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_SIZE_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadsize", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ tmp_sz = size; MPI_Bcast(&tmp_sz, 1, ADIO_OFFSET, 0, fh->comm); + /* --BEGIN ERROR HANDLING-- */ if (tmp_sz != size) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_size: size argument must be the same on all processes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_SIZE_ARG_NOT_SAME, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**notsame", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ + + ADIOI_TEST_DEFERRED(fh, "MPI_File_set_size", &error_code); ADIO_Resize(fh, size, &error_code); + /* TODO: what to do with error code? */ + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + #ifdef MPI_hpux HPMP_IO_END(fl_xmpi, fh, MPI_DATATYPE_NULL, -1); #endif /* MPI_hpux */ +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/set_view.c b/src/libs/ck-libs/ampi/romio/mpi-io/set_view.c dissimilarity index 72% index 33f82f544c..ea0cbf112f 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/set_view.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/set_view.c @@ -1,176 +1,175 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_set_view = PMPI_File_set_view -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_set_view MPI_File_set_view -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_set_view as PMPI_File_set_view -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_set_view - Sets the file view - -Input Parameters: -. fh - file handle (handle) -. disp - displacement (nonnegative integer) -. etype - elementary datatype (handle) -. filetype - filetype (handle) -. datarep - data representation (string) -. info - info object (handle) - -.N fortran -@*/ -int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, - MPI_Datatype filetype, char *datarep, MPI_Info info) -{ - ADIO_Fcntl_t *fcntl_struct; - int filetype_size, etype_size, error_code; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_SET_VIEW"; -#endif - ADIO_Offset shared_fp, byte_off; - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_set_view: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if ((disp < 0) && (disp != MPI_DISPLACEMENT_CURRENT)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_view: Invalid disp argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_DISP_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - /* rudimentary checks for incorrect etype/filetype.*/ - if (etype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_view: Invalid etype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_ETYPE_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (filetype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_view: Invalid filetype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_FILETYPE_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if ((fh->access_mode & MPI_MODE_SEQUENTIAL) && (disp != MPI_DISPLACEMENT_CURRENT)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_view: disp must be set to MPI_DISPLACEMENT_CURRENT since file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, 1, - myname, (char *) 0, "%s", "displacement must be set to MPI_DISPLACEMENT_CURRENT since file was opened with MPI_MODE_SEQUENTIAL"); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if ((disp == MPI_DISPLACEMENT_CURRENT) && !(fh->access_mode & MPI_MODE_SEQUENTIAL)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_view: disp can be set to MPI_DISPLACEMENT_CURRENT only if file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, 1, - myname, (char *) 0, "%s", "displacement can be set to MPI_DISPLACEMENT_CURRENT only if file was opened with MPI_MODE_SEQUENTIAL"); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(filetype, &filetype_size); - MPI_Type_size(etype, &etype_size); - if (filetype_size % etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_view: Filetype must be constructed out of one or more etypes\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_FILETYPE, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (strcmp(datarep, "native") && strcmp(datarep, "NATIVE")) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_set_view: Only \"native\" data representation currently supported\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_DATAREP, - MPIR_ERR_NOT_NATIVE_DATAREP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t)); - fcntl_struct->disp = disp; - fcntl_struct->etype = etype; - fcntl_struct->filetype = filetype; - fcntl_struct->info = info; - fcntl_struct->iomode = fh->iomode; - - if (disp == MPI_DISPLACEMENT_CURRENT) { - MPI_Barrier(fh->comm); - ADIO_Get_shared_fp(fh, 0, &shared_fp, &error_code); - /* MPI_Barrier(fh->comm); - deleting this because there is a barrier below */ - ADIOI_Get_byte_offset(fh, shared_fp, &byte_off); - fcntl_struct->disp = byte_off; - } - - ADIO_Fcntl(fh, ADIO_FCNTL_SET_VIEW, fcntl_struct, &error_code); - - /* reset shared file pointer to zero */ - - if ((fh->file_system != ADIO_PIOFS) && (fh->file_system != ADIO_PVFS) && - (fh->shared_fp_fd != ADIO_FILE_NULL)) - ADIO_Set_shared_fp(fh, 0, &error_code); - /* only one process needs to set it to zero, but I don't want to - create the shared-file-pointer file if shared file pointers have - not been used so far. Therefore, every process that has already - opened the shared-file-pointer file sets the shared file pointer - to zero. If the file was not opened, the value is automatically - zero. Note that shared file pointer is stored as no. of etypes - relative to the current view, whereas indiv. file pointer is - stored in bytes. */ - - if ((fh->file_system != ADIO_PIOFS) && (fh->file_system != ADIO_PVFS)) - MPI_Barrier(fh->comm); /* for above to work correctly */ - - ADIOI_Free(fcntl_struct); - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_set_view = PMPI_File_set_view +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_set_view MPI_File_set_view +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_set_view as PMPI_File_set_view +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_set_view - Sets the file view + +Input Parameters: +. fh - file handle (handle) +. disp - displacement (nonnegative integer) +. etype - elementary datatype (handle) +. filetype - filetype (handle) +. datarep - data representation (string) +. info - info object (handle) + +.N fortran +@*/ +int MPI_File_set_view(MPI_File mpi_fh, MPI_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, char *datarep, MPI_Info info) +{ + int filetype_size, etype_size, error_code; + static char myname[] = "MPI_FILE_SET_VIEW"; + ADIO_Offset shared_fp, byte_off; + ADIO_File fh; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + + if ((disp < 0) && (disp != MPI_DISPLACEMENT_CURRENT)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobaddisp", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + + /* rudimentary checks for incorrect etype/filetype.*/ + if (etype == MPI_DATATYPE_NULL) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**ioetype", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + + if (filetype == MPI_DATATYPE_NULL) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iofiletype", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + + if ((fh->access_mode & MPI_MODE_SEQUENTIAL) && + (disp != MPI_DISPLACEMENT_CURRENT)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iodispifseq", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + + if ((disp == MPI_DISPLACEMENT_CURRENT) && + !(fh->access_mode & MPI_MODE_SEQUENTIAL)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iodispifseq", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Type_size(filetype, &filetype_size); + MPI_Type_size(etype, &etype_size); + + /* --BEGIN ERROR HANDLING-- */ + if (filetype_size % etype_size != 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iofiletype", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + + if (strcmp(datarep, "native") && strcmp(datarep, "NATIVE")) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, + MPI_ERR_UNSUPPORTED_DATAREP, + "**unsupporteddatarep",0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + if (disp == MPI_DISPLACEMENT_CURRENT) { + MPI_Barrier(fh->comm); + ADIO_Get_shared_fp(fh, 0, &shared_fp, &error_code); + /* TODO: check error code */ + + MPI_Barrier(fh->comm); + ADIOI_Get_byte_offset(fh, shared_fp, &byte_off); + /* TODO: check error code */ + + disp = byte_off; + } + + ADIO_Set_view(fh, disp, etype, filetype, info, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + /* reset shared file pointer to zero */ + if (ADIO_Feature(fh, ADIO_SHARED_FP) && + (fh->shared_fp_fd != ADIO_FILE_NULL)) + { + /* only one process needs to set it to zero, but I don't want to + create the shared-file-pointer file if shared file pointers have + not been used so far. Therefore, every process that has already + opened the shared-file-pointer file sets the shared file pointer + to zero. If the file was not opened, the value is automatically + zero. Note that shared file pointer is stored as no. of etypes + relative to the current view, whereas indiv. file pointer is + stored in bytes. */ + + ADIO_Set_shared_fp(fh, 0, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + } + + if (ADIO_Feature(fh, ADIO_SHARED_FP)) + { + MPI_Barrier(fh->comm); /* for above to work correctly */ + } + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/wr_atallb.c b/src/libs/ck-libs/ampi/romio/mpi-io/wr_atallb.c dissimilarity index 73% index 61d72a3bce..2b3c226f7b 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/wr_atallb.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/wr_atallb.c @@ -1,129 +1,50 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_write_at_all_begin = PMPI_File_write_at_all_begin -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_write_at_all_begin MPI_File_write_at_all_begin -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_write_at_all_begin as PMPI_File_write_at_all_begin -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_write_at_all_begin - Begin a split collective write using explict offset - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (nonnegative integer) -. buf - initial address of buffer (choice) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -.N fortran -@*/ -int MPI_File_write_at_all_begin(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype) -{ - int error_code, datatype_size; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_WRITE_AT_ALL_BEGIN"; -#endif - MPI_Status status; - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_at_all_begin: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all_begin: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all_begin: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all_begin: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all_begin: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->split_coll_count) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all_begin: Only one active split collective I/O operation allowed per file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - fh->split_coll_count = 1; - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all_begin: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, &status, &error_code); - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_write_at_all_begin = PMPI_File_write_at_all_begin +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_write_at_all_begin MPI_File_write_at_all_begin +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_write_at_all_begin as PMPI_File_write_at_all_begin +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_write_at_all_begin - Begin a split collective write using + explict offset + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (nonnegative integer) +. buf - initial address of buffer (choice) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +.N fortran +@*/ +int MPI_File_write_at_all_begin(MPI_File mpi_fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype) +{ + int error_code; + static char myname[] = "MPI_FILE_WRITE_AT_ALL_BEGIN"; + + error_code = MPIOI_File_write_all_begin(mpi_fh, offset, + ADIO_EXPLICIT_OFFSET, + buf, count, datatype, myname); + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/wr_atalle.c b/src/libs/ck-libs/ampi/romio/mpi-io/wr_atalle.c index 7d2a2f58ed..c19eb9cac8 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/wr_atalle.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/wr_atalle.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -36,34 +35,12 @@ Output Parameters: .N fortran @*/ -int MPI_File_write_at_all_end(MPI_File fh, void *buf, MPI_Status *status) +int MPI_File_write_at_all_end(MPI_File mpi_fh, void *buf, MPI_Status *status) { -#ifndef PRINT_ERR_MSG int error_code; static char myname[] = "MPI_FILE_WRITE_AT_ALL_END"; -#endif - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_at_all_end: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (!(fh->split_coll_count)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all_end: Does not match a previous MPI_File_write_at_all_begin\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - fh->split_coll_count = 0; + error_code = MPIOI_File_write_all_end(mpi_fh, buf, myname, status); - return MPI_SUCCESS; + return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write.c b/src/libs/ck-libs/ampi/romio/mpi-io/write.c dissimilarity index 60% index d84146bf6e..5b8772921f 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write.c @@ -1,150 +1,170 @@ -/* -*- mode: c; c-basic-offset:4 ; -*- */ -/* - * $id: write.c,v 1.8 2002/10/24 15:54:44 gropp Exp $ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_write = PMPI_File_write -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_write MPI_File_write -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_write as PMPI_File_write -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* status object not filled currently */ - -/*@ - MPI_File_write - Write using individual file pointer - -Input Parameters: -. fh - file handle (handle) -. buf - initial address of buffer (choice) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. status - status object (Status) - -.N fortran -@*/ -int MPI_File_write(MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) -{ - int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_WRITE"; -#endif - int datatype_size; - ADIO_Offset off; -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEWRITE, TRDTBLOCK, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - if (count*datatype_size == 0) { -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return MPI_SUCCESS; - } - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); - - /* contiguous or strided? */ - - if (buftype_is_contig && filetype_is_contig) { - bufsize = datatype_size * count; - /* if atomic mode requested, lock (exclusive) the region, because there - could be a concurrent noncontiguous request. Locking doesn't - work on PIOFS and PVFS, and on NFS it is done in the ADIO_WriteContig.*/ - off = fh->fp_ind; - if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_PVFS) && (fh->file_system != ADIO_NFS)) - ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); - - ADIO_WriteContig(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, &error_code); - - if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_PVFS) && (fh->file_system != ADIO_NFS)) - ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - } - else - ADIO_WriteStrided(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, &error_code); - /* For strided and atomic mode, locking is done in ADIO_WriteStrided */ - -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_write = PMPI_File_write +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_write MPI_File_write +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_write as PMPI_File_write +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* status object not filled currently */ + +/*@ + MPI_File_write - Write using individual file pointer + +Input Parameters: +. fh - file handle (handle) +. buf - initial address of buffer (choice) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. status - status object (Status) + +.N fortran +@*/ +int MPI_File_write(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status) +{ + int error_code; + static char myname[] = "MPI_FILE_WRITE"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEWRITE, TRDTBLOCK, fh, datatype, count); +#endif /* MPI_hpux */ + + error_code = MPIOI_File_write(mpi_fh, (MPI_Offset) 0, ADIO_INDIVIDUAL, buf, + count, datatype, myname, status); + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, fh, datatype, count); +#endif /* MPI_hpux */ + + return error_code; +} + +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_write(MPI_File mpi_fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Status *status) +{ + int error_code, bufsize, buftype_is_contig, filetype_is_contig; + int datatype_size; + ADIO_Offset off; + ADIO_File fh; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Type_size(datatype, &datatype_size); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + if (count*datatype_size == 0) + { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); +#endif + error_code = MPI_SUCCESS; + goto fn_exit; + } + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_WRITABLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); + ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); + + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + + if (buftype_is_contig && filetype_is_contig) + { + /* convert bufcount and offset to bytes */ + bufsize = datatype_size * count; + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) { + off = fh->disp + fh->etype_size * offset; + } + else /* ADIO_INDIVIDUAL */ { + off = fh->fp_ind; + } + + /* if atomic mode requested, lock (exclusive) the region, because + there could be a concurrent noncontiguous request. Locking doesn't + work on PIOFS and PVFS, and on NFS it is done in the + ADIO_WriteContig. + */ + + if ((fh->atomicity) && ADIO_Feature(fh, ADIO_LOCKS)) + { + ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); + } + + ADIO_WriteContig(fh, buf, count, datatype, file_ptr_type, + off, status, &error_code); + + if ((fh->atomicity) && ADIO_Feature(fh, ADIO_LOCKS)) + { + ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); + } + } + else + { + /* For strided and atomic mode, locking is done in ADIO_WriteStrided */ + ADIO_WriteStrided(fh, buf, count, datatype, file_ptr_type, + offset, status, &error_code); + } + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write_all.c b/src/libs/ck-libs/ampi/romio/mpi-io/write_all.c index 3ff87801ce..45934460da 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write_all.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write_all.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -40,77 +39,81 @@ Output Parameters: .N fortran @*/ -int MPI_File_write_all(MPI_File fh, void *buf, int count, +int MPI_File_write_all(MPI_File mpi_fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { - int error_code, datatype_size; -#ifndef PRINT_ERR_MSG + int error_code; static char myname[] = "MPI_FILE_WRITE_ALL"; -#endif #ifdef MPI_hpux int fl_xmpi; HPMP_IO_START(fl_xmpi, BLKMPIFILEWRITEALL, TRDTBLOCK, fh, datatype, count); #endif /* MPI_hpux */ -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_all: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + error_code = MPIOI_File_write_all(mpi_fh, (MPI_Offset) 0, + ADIO_INDIVIDUAL, buf, + count, datatype, myname, status); - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, fh, datatype, count); +#endif /* MPI_hpux */ - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + return error_code; +} + +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_write_all(MPI_File mpi_fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname, + MPI_Status *status) +{ + int error_code, datatype_size; + ADIO_File fh; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_WRITABLE(fh, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIO_WriteStridedColl(fh, buf, count, datatype, file_ptr_type, + offset, status, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); - ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, status, &error_code); -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ return error_code; } +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write_allb.c b/src/libs/ck-libs/ampi/romio/mpi-io/write_allb.c dissimilarity index 68% index 10d062d815..eda23d6789 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write_allb.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write_allb.c @@ -1,117 +1,115 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_write_all_begin = PMPI_File_write_all_begin -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_write_all_begin MPI_File_write_all_begin -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_write_all_begin as PMPI_File_write_all_begin -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_write_all_begin - Begin a split collective write using individual file pointer - -Input Parameters: -. fh - file handle (handle) -. buf - initial address of buffer (choice) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -.N fortran -@*/ -int MPI_File_write_all_begin(MPI_File fh, void *buf, int count, - MPI_Datatype datatype) -{ - int error_code, datatype_size; - MPI_Status status; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_WRITE_ALL_BEGIN"; -#endif - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_all_begin: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all_begin: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all_begin: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all_begin: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->split_coll_count) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all_begin: Only one active split collective I/O operation allowed per file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - fh->split_coll_count = 1; - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all_begin: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_INDIVIDUAL, - 0, &status, &error_code); - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_write_all_begin = PMPI_File_write_all_begin +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_write_all_begin MPI_File_write_all_begin +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_write_all_begin as PMPI_File_write_all_begin +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_write_all_begin - Begin a split collective write using + individual file pointer + +Input Parameters: +. fh - file handle (handle) +. buf - initial address of buffer (choice) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +.N fortran +@*/ +int MPI_File_write_all_begin(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype) +{ + int error_code; + static char myname[] = "MPI_FILE_WRITE_ALL_BEGIN"; + + error_code = MPIOI_File_write_all_begin(mpi_fh, (MPI_Offset) 0, + ADIO_INDIVIDUAL, buf, count, + datatype, myname); + + return error_code; +} + +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_write_all_begin(MPI_File mpi_fh, + MPI_Offset offset, + int file_ptr_type, + void *buf, + int count, + MPI_Datatype datatype, + char *myname) +{ + int error_code, datatype_size; + ADIO_File fh; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code); + + if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "**iobadoffset", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + + if (fh->split_coll_count) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iosplitcoll", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + fh->split_coll_count = 1; + + MPI_Type_size(datatype, &datatype_size); + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + fh->split_datatype = datatype; + ADIO_WriteStridedColl(fh, buf, count, datatype, file_ptr_type, + offset, &fh->split_status, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; +} +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write_alle.c b/src/libs/ck-libs/ampi/romio/mpi-io/write_alle.c index 98b29e3465..4187552953 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write_alle.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write_alle.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -36,34 +35,59 @@ Output Parameters: .N fortran @*/ -int MPI_File_write_all_end(MPI_File fh, void *buf, MPI_Status *status) +int MPI_File_write_all_end(MPI_File mpi_fh, void *buf, MPI_Status *status) { -#ifndef PRINT_ERR_MSG int error_code; - static char myname[] = "MPI_FILE_IREAD"; -#endif + static char myname[] = "MPI_FILE_WRITE_ALL_END"; -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_all_end: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + error_code = MPIOI_File_write_all_end(mpi_fh, buf, myname, status); - if (!(fh->split_coll_count)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_all_end: Does not match a previous MPI_File_write_all_begin\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + return error_code; +} + +/* prevent multiple definitions of this routine */ +// #ifdef MPIO_BUILD_PROFILING +int MPIOI_File_write_all_end(MPI_File mpi_fh, + void *buf, + char *myname, + MPI_Status *status) +{ + int error_code; + ADIO_File fh; + + MPIU_UNREFERENCED_ARG(buf); + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + + if (!(fh->split_coll_count)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iosplitcollnone", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ +#ifdef HAVE_STATUS_SET_BYTES + /* FIXME - we should really ensure that the split_datatype remains + valid by incrementing the ref count in the write_allb.c routine + and decrement it here after setting the bytes */ + if (status != MPI_STATUS_IGNORE) + *status = fh->split_status; +#endif fh->split_coll_count = 0; - return MPI_SUCCESS; + error_code = MPI_SUCCESS; + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + return error_code; } +// #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write_at.c b/src/libs/ck-libs/ampi/romio/mpi-io/write_at.c dissimilarity index 72% index b937a21967..8a34bb66cb 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write_at.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write_at.c @@ -1,167 +1,63 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_write_at = PMPI_File_write_at -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_write_at MPI_File_write_at -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_write_at as PMPI_File_write_at -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* status object not filled currently */ - - -/*@ - MPI_File_write_at - Write using explict offset - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (nonnegative integer) -. buf - initial address of buffer (choice) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. status - status object (Status) - -.N fortran -@*/ -int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, - MPI_Status *status) -{ - int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_WRITE_AT"; -#endif - int datatype_size; - ADIO_Offset off; -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEWRITEAT, TRDTBLOCK, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_at: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - if (count*datatype_size == 0) { -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return MPI_SUCCESS; - } - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); - ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); - - /* contiguous or strided? */ - - if (buftype_is_contig && filetype_is_contig) { - /* convert bufocunt and offset to bytes */ - bufsize = datatype_size * count; - off = fh->disp + fh->etype_size * offset; - - /* if atomic mode requested, lock (exclusive) the region, because there - could be a concurrent noncontiguous request. Locking doesn't - work on PIOFS and PVFS, and on NFS it is done in the ADIO_WriteContig.*/ - - if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize); - - ADIO_WriteContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - off, status, &error_code); - - if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && - (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)) - ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); - } - else - ADIO_WriteStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, status, &error_code); - /* For strided and atomic mode, locking is done in ADIO_WriteStrided */ - -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_write_at = PMPI_File_write_at +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_write_at MPI_File_write_at +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_write_at as PMPI_File_write_at +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* status object not filled currently */ + +/*@ + MPI_File_write_at - Write using explict offset + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (nonnegative integer) +. buf - initial address of buffer (choice) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. status - status object (Status) + +.N fortran +@*/ +int MPI_File_write_at(MPI_File mpi_fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPI_Status *status) +{ + int error_code; + static char myname[] = "MPI_FILE_WRITE_AT"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEWRITEAT, TRDTBLOCK, fh, datatype, count); +#endif /* MPI_hpux */ + + /* MPIOI_File_write() defined in mpi-io/write.c */ + error_code = MPIOI_File_write(mpi_fh, offset, ADIO_EXPLICIT_OFFSET, buf, + count, datatype, myname, status); + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, fh, datatype, count); +#endif /* MPI_hpux */ + + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write_atall.c b/src/libs/ck-libs/ampi/romio/mpi-io/write_atall.c dissimilarity index 61% index 2b7683b545..0987df45b2 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write_atall.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write_atall.c @@ -1,130 +1,63 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_write_at_all = PMPI_File_write_at_all -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_write_at_all MPI_File_write_at_all -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_write_at_all as PMPI_File_write_at_all -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/* status object not filled currently */ - -/*@ - MPI_File_write_at_all - Collective write using explict offset - -Input Parameters: -. fh - file handle (handle) -. offset - file offset (nonnegative integer) -. buf - initial address of buffer (choice) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. status - status object (Status) - -.N fortran -@*/ -int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, - MPI_Status *status) -{ - int error_code, datatype_size; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_WRITE_AT_ALL"; -#endif -#ifdef MPI_hpux - int fl_xmpi; - - HPMP_IO_START(fl_xmpi, BLKMPIFILEWRITEATALL, TRDTBLOCK, fh, datatype, count); -#endif /* MPI_hpux */ - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_at_all: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (offset < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all: Invalid offset argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->access_mode & MPI_MODE_SEQUENTIAL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_at_all: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - offset, status, &error_code); -#ifdef MPI_hpux - HPMP_IO_END(fl_xmpi, fh, datatype, count); -#endif /* MPI_hpux */ - return error_code; -} - +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_write_at_all = PMPI_File_write_at_all +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_write_at_all MPI_File_write_at_all +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_write_at_all as PMPI_File_write_at_all +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/* status object not filled currently */ + +/*@ + MPI_File_write_at_all - Collective write using explict offset + +Input Parameters: +. fh - file handle (handle) +. offset - file offset (nonnegative integer) +. buf - initial address of buffer (choice) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. status - status object (Status) + +.N fortran +@*/ +int MPI_File_write_at_all(MPI_File mpi_fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPI_Status *status) +{ + int error_code; + static char myname[] = "MPI_FILE_WRITE_AT_ALL"; +#ifdef MPI_hpux + int fl_xmpi; + + HPMP_IO_START(fl_xmpi, BLKMPIFILEWRITEATALL, TRDTBLOCK, fh, datatype, count); +#endif /* MPI_hpux */ + + error_code = MPIOI_File_write_all(mpi_fh, offset, ADIO_EXPLICIT_OFFSET, + buf, count, datatype, myname, status); + +#ifdef MPI_hpux + HPMP_IO_END(fl_xmpi, fh, datatype, count); +#endif /* MPI_hpux */ + return error_code; +} + diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write_ord.c b/src/libs/ck-libs/ampi/romio/mpi-io/write_ord.c index ed2ed0cc80..2ad4fd40bf 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write_ord.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write_ord.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -40,88 +39,72 @@ Output Parameters: .N fortran @*/ -int MPI_File_write_ordered(MPI_File fh, void *buf, int count, +int MPI_File_write_ordered(MPI_File mpi_fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { - int error_code, datatype_size, nprocs, myrank, i, incr; -#ifndef PRINT_ERR_MSG + int error_code, datatype_size, nprocs, myrank, incr; + int source, dest; static char myname[] = "MPI_FILE_WRITE_ORDERED"; -#endif ADIO_Offset shared_fp; + ADIO_File fh; -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_ordered: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + fh = MPIO_File_resolve(mpi_fh); - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + /* --END ERROR HANDLING-- */ MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered: Shared file pointer not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIOI_TEST_DEFERRED(fh, myname, &error_code); MPI_Comm_size(fh->comm, &nprocs); MPI_Comm_rank(fh->comm, &myrank); incr = (count*datatype_size)/fh->etype_size; - for (i=0; icomm); + /* Use a message as a 'token' to order the operations */ + source = myrank - 1; + dest = myrank + 1; + if (source < 0) source = MPI_PROC_NULL; + if (dest >= nprocs) dest = MPI_PROC_NULL; + MPI_Recv(NULL, 0, MPI_BYTE, source, 0, fh->comm, MPI_STATUS_IGNORE); + + ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, + myname, __LINE__, MPI_ERR_INTERN, + "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ + + MPI_Send(NULL, 0, MPI_BYTE, dest, 0, fh->comm); ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, shared_fp, status, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + /* FIXME: Check for error code from WriteStridedColl? */ return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write_ordb.c b/src/libs/ck-libs/ampi/romio/mpi-io/write_ordb.c dissimilarity index 65% index e6ae1dcf60..4693eb5733 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write_ordb.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write_ordb.c @@ -1,137 +1,116 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_File_write_ordered_begin = PMPI_File_write_ordered_begin -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_File_write_ordered_begin MPI_File_write_ordered_begin -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_File_write_ordered_begin as PMPI_File_write_ordered_begin -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#endif - -/*@ - MPI_File_write_ordered_begin - Begin a split collective write using shared file pointer - -Input Parameters: -. fh - file handle (handle) -. count - number of elements in buffer (nonnegative integer) -. datatype - datatype of each buffer element (handle) - -Output Parameters: -. buf - initial address of buffer (choice) - -.N fortran -@*/ -int MPI_File_write_ordered_begin(MPI_File fh, void *buf, int count, - MPI_Datatype datatype) -{ - int error_code, datatype_size, nprocs, myrank, i, incr; -#ifndef PRINT_ERR_MSG - static char myname[] = "MPI_FILE_WRITE_ORDERED_BEGIN"; -#endif - ADIO_Offset shared_fp; - MPI_Status status; - -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_ordered_begin: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif - - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered_begin: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered_begin: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if (fh->split_coll_count) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered_begin: Only one active split collective I/O operation allowed per file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - fh->split_coll_count = 1; - - MPI_Type_size(datatype, &datatype_size); - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered_begin: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered_begin: Shared file pointer not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - - MPI_Comm_size(fh->comm, &nprocs); - MPI_Comm_rank(fh->comm, &myrank); - - incr = (count*datatype_size)/fh->etype_size; - for (i=0; icomm); - } - - ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, &status, &error_code); - - return error_code; -} +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_File_write_ordered_begin = PMPI_File_write_ordered_begin +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_File_write_ordered_begin MPI_File_write_ordered_begin +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_File_write_ordered_begin as PMPI_File_write_ordered_begin +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ + MPI_File_write_ordered_begin - Begin a split collective write using shared file pointer + +Input Parameters: +. fh - file handle (handle) +. count - number of elements in buffer (nonnegative integer) +. datatype - datatype of each buffer element (handle) + +Output Parameters: +. buf - initial address of buffer (choice) + +.N fortran +@*/ +int MPI_File_write_ordered_begin(MPI_File mpi_fh, void *buf, int count, + MPI_Datatype datatype) +{ + int error_code, datatype_size, nprocs, myrank, incr; + int source, dest; + static char myname[] = "MPI_FILE_WRITE_ORDERED_BEGIN"; + ADIO_Offset shared_fp; + ADIO_File fh; + + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + + if (fh->split_coll_count) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iosplitcoll", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + fh->split_coll_count = 1; + + MPI_Type_size(datatype, &datatype_size); + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + + MPI_Comm_size(fh->comm, &nprocs); + MPI_Comm_rank(fh->comm, &myrank); + + incr = (count*datatype_size)/fh->etype_size; + /* Use a message as a 'token' to order the operations */ + source = myrank - 1; + dest = myrank + 1; + if (source < 0) source = MPI_PROC_NULL; + if (dest >= nprocs) dest = MPI_PROC_NULL; + MPI_Recv(NULL, 0, MPI_BYTE, source, 0, fh->comm, MPI_STATUS_IGNORE); + + ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, + myname, __LINE__, MPI_ERR_INTERN, + "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; + } + /* --END ERROR HANDLING-- */ + + MPI_Send(NULL, 0, MPI_BYTE, dest, 0, fh->comm); + + ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, + shared_fp, &fh->split_status, &error_code); + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); + + /* FIXME: Check for error code from WriteStridedColl? */ + return error_code; +} diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write_orde.c b/src/libs/ck-libs/ampi/romio/mpi-io/write_orde.c index 836d3a6260..2044a8c868 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write_orde.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write_orde.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -36,34 +35,39 @@ Output Parameters: .N fortran @*/ -int MPI_File_write_ordered_end(MPI_File fh, void *buf, MPI_Status *status) +int MPI_File_write_ordered_end(MPI_File mpi_fh, void *buf, MPI_Status *status) { -#ifndef PRINT_ERR_MSG int error_code; static char myname[] = "MPI_FILE_WRITE_ORDERED_END"; -#endif + ADIO_File fh; -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_ordered_end: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_UNREFERENCED_ARG(buf); - if (!(fh->split_coll_count)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_ordered_end: Does not match a previous MPI_File_write_ordered_begin\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); + + fh = MPIO_File_resolve(mpi_fh); + + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + + if (!(fh->split_coll_count)) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_IO, + "**iosplitcollnone", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ +#ifdef HAVE_STATUS_SET_BYTES + if (status != MPI_STATUS_IGNORE) + *status = fh->split_status; +#endif fh->split_coll_count = 0; + +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return MPI_SUCCESS; } diff --git a/src/libs/ck-libs/ampi/romio/mpi-io/write_sh.c b/src/libs/ck-libs/ampi/romio/mpi-io/write_sh.c index 956c68de0f..a1950505fa 100644 --- a/src/libs/ck-libs/ampi/romio/mpi-io/write_sh.c +++ b/src/libs/ck-libs/ampi/romio/mpi-io/write_sh.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -40,84 +39,65 @@ Output Parameters: .N fortran @*/ -int MPI_File_write_shared(MPI_File fh, void *buf, int count, +int MPI_File_write_shared(MPI_File mpi_fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int error_code, bufsize, buftype_is_contig, filetype_is_contig; -#ifndef PRINT_ERR_MSG static char myname[] = "MPI_FILE_READ_SHARED"; -#endif int datatype_size, incr; ADIO_Offset off, shared_fp; + ADIO_File fh; -#ifdef PRINT_ERR_MSG - if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) { - FPRINTF(stderr, "MPI_File_write_shared: Invalid file handle\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } -#else - ADIOI_TEST_FILE_HANDLE(fh, myname); -#endif + MPIU_THREAD_CS_ENTER(ALLFUNC,); - if (count < 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_shared: Invalid count argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + fh = MPIO_File_resolve(mpi_fh); - if (datatype == MPI_DATATYPE_NULL) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_shared: Invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_FILE_HANDLE(fh, myname, error_code); + MPIO_CHECK_COUNT(fh, count, myname, error_code); + MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code); + /* --END ERROR HANDLING-- */ MPI_Type_size(datatype, &datatype_size); - if (count*datatype_size == 0) return MPI_SUCCESS; - - if ((count*datatype_size) % fh->etype_size != 0) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_shared: Only an integral number of etypes can be accessed\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL, - myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); -#endif - } - if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) { -#ifdef PRINT_ERR_MSG - FPRINTF(stderr, "MPI_File_write_shared: Shared file pointer not supported on PIOFS and PVFS\n"); - MPI_Abort(MPI_COMM_WORLD, 1); -#else - error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, - MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0); - return ADIOI_Error(fh, error_code, myname); + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code); + /* --END ERROR HANDLING-- */ + + if (count*datatype_size == 0) { +#ifdef HAVE_STATUS_SET_BYTES + MPIR_Status_set_bytes(status, datatype, 0); #endif + error_code = MPI_SUCCESS; + goto fn_exit; } + /* --BEGIN ERROR HANDLING-- */ + MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code); + MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code); + /* --END ERROR HANDLING-- */ + ADIOI_Datatype_iscontig(datatype, &buftype_is_contig); ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig); + ADIOI_TEST_DEFERRED(fh, myname, &error_code); + incr = (count*datatype_size)/fh->etype_size; + ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code); - if (error_code != MPI_SUCCESS) { - FPRINTF(stderr, "MPI_File_write_shared: Error! Could not access shared file pointer.\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, + myname, __LINE__, MPI_ERR_INTERN, + "**iosharedfailed", 0); + error_code = MPIO_Err_return_file(fh, error_code); + goto fn_exit; } + /* --END ERROR HANDLING-- */ - /* contiguous or strided? */ - if (buftype_is_contig && filetype_is_contig) { + if (buftype_is_contig && filetype_is_contig) + { /* convert bufocunt and shared_fp to bytes */ bufsize = datatype_size * count; off = fh->disp + fh->etype_size * shared_fp; @@ -136,9 +116,18 @@ int MPI_File_write_shared(MPI_File fh, void *buf, int count, ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize); } else + { ADIO_WriteStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, - shared_fp, status, &error_code); - /* For strided and atomic mode, locking is done in ADIO_WriteStrided */ + shared_fp, status, &error_code); + /* For strided and atomic mode, locking is done in ADIO_WriteStrided */ + } + + /* --BEGIN ERROR HANDLING-- */ + if (error_code != MPI_SUCCESS) + error_code = MPIO_Err_return_file(fh, error_code); + /* --END ERROR HANDLING-- */ +fn_exit: + MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; } diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/array/.state-cache b/src/libs/ck-libs/ampi/romio/mpi2-other/array/.state-cache new file mode 100644 index 0000000000..ac9967969d --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/array/.state-cache @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/array/Makefile.in b/src/libs/ck-libs/ampi/romio/mpi2-other/array/Makefile.in index ed3372b37e..41a366e398 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/array/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/array/Makefile.in @@ -3,9 +3,15 @@ AR = @AR@ LIBNAME = @LIBNAME@ RANLIB = @RANLIB@ srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../include -I${srcdir}/../../mpi-io -I${srcdir}/../../adio/include -I../../adio/include -CFLAGS = @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) $(OPTS) +CFLAGS = @CPPFLAGS@ @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE_SHL = $(CC_SHL) @VPATH@ @@ -16,23 +22,59 @@ MPIO_TMP_POBJECTS = subarray.p darray.p MPIO_REAL_POBJECTS = _subarray.o _darray.o all: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi -.SUFFIXES: $(SUFFIXES) .p +.SUFFIXES: $(SUFFIXES) .p .sp .lo .c.o: $(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo .c.p: @cp $(srcdir)/$*.c _$*.c $(CC) $(CFLAGS) -c _$*.c @rm -f _$*.c -profile: $(MPIO_TMP_POBJECTS) +.c.sp: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _$*.lo + +profile: $(MPIO_REAL_POBJECTS) $(AR) $(LIBNAME) $(MPIO_REAL_POBJECTS) + $(RANLIB) $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) P$(SHLIBNAME).la ;\ + fi @rm -f _*.o $(LIBNAME): $(MPIO_OBJECTS) $(AR) $(LIBNAME) $(MPIO_OBJECTS) + $(RANLIB) $(LIBNAME) + +MPIO_LOOBJECTS = $(MPIO_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(MPIO_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(MPIO_LOOBJECTS) + +# -------------------------------------------------------------------------- +# We use P$(SHLBNAME) simply to distinguish the regular lib build from the +# profiling library build +MPIO_LOPOBJECTS = $(MPIO_REAL_POBJECTS:.o=.lo) +MPIO_TMP_LOPOBJECTS = ${MPIO_TMP_POBJECTS:.p=.sp} +P$(SHLIBNAME).la: $(MPIO_TMP_LOPOBJECTS) + $(AR) $(SHLIBNAME).la $(MPIO_LOPOBJECTS) +# -------------------------------------------------------------------------- clean: - @rm -f *.o + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg + +# Rules for the profiling objects +_subarray.o: subarray.c + $(CC) $(CFLAGS) -c $(srcdir)/subarray.c -o _subarray.o +_darray.o: darray.c + $(CC) $(CFLAGS) -c $(srcdir)/darray.c -o _darray.o + diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/array/darray.c b/src/libs/ck-libs/ampi/romio/mpi2-other/array/darray.c dissimilarity index 78% index 7d9263f835..2891d459d5 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/array/darray.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/array/darray.c @@ -1,390 +1,209 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * $Id$ - * - * Copyright (C) 1997 University of Chicago. - * See COPYRIGHT notice in top-level directory. - */ - -#include "mpioimpl.h" - -#ifdef HAVE_WEAK_SYMBOLS - -#if defined(HAVE_PRAGMA_WEAK) -#pragma weak MPI_Type_create_darray = PMPI_Type_create_darray -#elif defined(HAVE_PRAGMA_HP_SEC_DEF) -#pragma _HP_SECONDARY_DEF PMPI_Type_create_darray MPI_Type_create_darray -#elif defined(HAVE_PRAGMA_CRI_DUP) -#pragma _CRI duplicate MPI_Type_create_darray as PMPI_Type_create_darray -/* end of weak pragmas */ -#endif - -/* Include mapping from MPI->PMPI */ -#define MPIO_BUILD_PROFILING -#include "mpioprof.h" -#undef MPIO_BUILD_PROFILING -#endif - -void MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, int nprocs, - int rank, int darg, int order, MPI_Aint orig_extent, - MPI_Datatype type_old, MPI_Datatype *type_new, - MPI_Aint *st_offset); -void MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, - int rank, int darg, int order, MPI_Aint orig_extent, - MPI_Datatype type_old, MPI_Datatype *type_new, - MPI_Aint *st_offset); - - -/*@ -MPI_Type_create_darray - Creates a datatype corresponding to a distributed, multidimensional array - -Input Parameters: -. size - size of process group (positive integer) -. rank - rank in process group (nonnegative integer) -. ndims - number of array dimensions as well as process grid dimensions (positive integer) -. array_of_gsizes - number of elements of type oldtype in each dimension of global array (array of positive integers) -. array_of_distribs - distribution of array in each dimension (array of state) -. array_of_dargs - distribution argument in each dimension (array of positive integers) -. array_of_psizes - size of process grid in each dimension (array of positive integers) -. order - array storage order flag (state) -. oldtype - old datatype (handle) - -Output Parameters: -. newtype - new datatype (handle) - -.N fortran -@*/ -int MPI_Type_create_darray(int size, int rank, int ndims, - int *array_of_gsizes, int *array_of_distribs, - int *array_of_dargs, int *array_of_psizes, - int order, MPI_Datatype oldtype, - MPI_Datatype *newtype) -{ - MPI_Datatype type_old, type_new, types[3]; - int procs, tmp_rank, i, tmp_size, blklens[3], *coords; - MPI_Aint *st_offsets, orig_extent, disps[3], size_with_aint; - MPI_Offset size_with_offset; - - if (size <= 0) { - FPRINTF(stderr, "MPI_Type_create_darray: Invalid size argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - if (rank < 0) { - FPRINTF(stderr, "MPI_Type_create_darray: Invalid rank argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - if (ndims <= 0) { - FPRINTF(stderr, "MPI_Type_create_darray: Invalid ndims argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - if (array_of_gsizes <= (int *) 0) { - FPRINTF(stderr, "MPI_Type_create_darray: array_of_gsizes is an invalid address\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - if (array_of_distribs <= (int *) 0) { - FPRINTF(stderr, "MPI_Type_create_darray: array_of_distribs is an invalid address\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - if (array_of_dargs <= (int *) 0) { - FPRINTF(stderr, "MPI_Type_create_darray: array_of_dargs is an invalid address\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - if (array_of_psizes <= (int *) 0) { - FPRINTF(stderr, "MPI_Type_create_darray: array_of_psizes is an invalid address\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - for (i=0; i=0; i--) { - switch(array_of_distribs[i]) { - case MPI_DISTRIBUTE_BLOCK: - MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], - coords[i], array_of_dargs[i], order, orig_extent, - type_old, &type_new, st_offsets+i); - break; - case MPI_DISTRIBUTE_CYCLIC: - MPIOI_Type_cyclic(array_of_gsizes, i, ndims, - array_of_psizes[i], coords[i], array_of_dargs[i], order, - orig_extent, type_old, &type_new, st_offsets+i); - break; - case MPI_DISTRIBUTE_NONE: - if (array_of_psizes[i] != 1) { - FPRINTF(stderr, "MPI_Type_create_darray: For MPI_DISTRIBUTE_NONE, the number of processes in that dimension of the grid must be 1\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - /* treat it as a block distribution on 1 process */ - MPIOI_Type_block(array_of_gsizes, i, ndims, array_of_psizes[i], - coords[i], MPI_DISTRIBUTE_DFLT_DARG, order, orig_extent, - type_old, &type_new, st_offsets+i); - break; - default: - FPRINTF(stderr, "MPI_Type_create_darray: Invalid value in array_of_distribs\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - if (i != ndims-1) MPI_Type_free(&type_old); - type_old = type_new; - } - - /* add displacement and UB */ - disps[1] = st_offsets[ndims-1]; - tmp_size = 1; - for (i=ndims-2; i>=0; i--) { - tmp_size *= array_of_gsizes[i+1]; - disps[1] += tmp_size*st_offsets[i]; - } - } - else { - FPRINTF(stderr, "MPI_Type_create_darray: Invalid order argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - disps[1] *= orig_extent; - - disps[2] = orig_extent; - for (i=0; idim; i--) stride *= array_of_gsizes[i]; - MPI_Type_hvector(mysize, 1, stride, type_old, type_new); - } - - } - - *st_offset = blksize * rank; - /* in terms of no. of elements of type oldtype in this dimension */ - if (mysize == 0) *st_offset = 0; -} - - -void MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nprocs, - int rank, int darg, int order, MPI_Aint orig_extent, - MPI_Datatype type_old, MPI_Datatype *type_new, - MPI_Aint *st_offset) -{ -/* nprocs = no. of processes in dimension dim of grid - rank = coordinate of this process in dimension dim */ - - int blksize, i, blklens[2], st_index, end_index, local_size, rem, count; - MPI_Aint stride, disps[2]; - MPI_Datatype type_tmp, types[2]; - - if (darg == MPI_DISTRIBUTE_DFLT_DARG) blksize = 1; - else blksize = darg; - - if (blksize <= 0) { - FPRINTF(stderr, "MPI_Type_create_darray: m <= 0 is not valid for a cyclic(m) distribution\n"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - st_index = rank*blksize; - end_index = array_of_gsizes[dim] - 1; - - if (end_index < st_index) local_size = 0; - else { - local_size = ((end_index - st_index + 1)/(nprocs*blksize))*blksize; - rem = (end_index - st_index + 1) % (nprocs*blksize); - local_size += ADIOI_MIN(rem, blksize); - } - - count = local_size/blksize; - rem = local_size % blksize; - - stride = nprocs*blksize*orig_extent; - if (order == MPI_ORDER_FORTRAN) - for (i=0; idim; i--) stride *= array_of_gsizes[i]; - - MPI_Type_hvector(count, blksize, stride, type_old, type_new); - - if (rem) { - /* if the last block is of size less than blksize, include - it separately using MPI_Type_struct */ - - types[0] = *type_new; - types[1] = type_old; - disps[0] = 0; - disps[1] = count*stride; - blklens[0] = 1; - blklens[1] = rem; - - MPI_Type_struct(2, blklens, disps, types, &type_tmp); - - MPI_Type_free(type_new); - *type_new = type_tmp; - } - - /* need to set the UB for block-cyclic to work */ - types[0] = *type_new; - types[1] = MPI_UB; - disps[0] = 0; - disps[1] = orig_extent; - if (order == MPI_ORDER_FORTRAN) - for (i=0; i<=dim; i++) disps[1] *= array_of_gsizes[i]; - else for (i=ndims-1; i>=dim; i--) disps[1] *= array_of_gsizes[i]; - blklens[0] = blklens[1] = 1; - MPI_Type_struct(2, blklens, disps, types, &type_tmp); - MPI_Type_free(type_new); - *type_new = type_tmp; - - *st_offset = rank * blksize; - /* in terms of no. of elements of type oldtype in this dimension */ - if (local_size == 0) *st_offset = 0; -} -#endif +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "mpioimpl.h" + +#ifdef HAVE_WEAK_SYMBOLS + +#if defined(HAVE_PRAGMA_WEAK) +#pragma weak MPI_Type_create_darray = PMPI_Type_create_darray +#elif defined(HAVE_PRAGMA_HP_SEC_DEF) +#pragma _HP_SECONDARY_DEF PMPI_Type_create_darray MPI_Type_create_darray +#elif defined(HAVE_PRAGMA_CRI_DUP) +#pragma _CRI duplicate MPI_Type_create_darray as PMPI_Type_create_darray +/* end of weak pragmas */ +#endif + +/* Include mapping from MPI->PMPI */ +#define MPIO_BUILD_PROFILING +#include "mpioprof.h" +#endif + +/*@ +MPI_Type_create_darray - Creates a datatype corresponding to a distributed, multidimensional array + +Input Parameters: +. size - size of process group (positive integer) +. rank - rank in process group (nonnegative integer) +. ndims - number of array dimensions as well as process grid dimensions (positive integer) +. array_of_gsizes - number of elements of type oldtype in each dimension of global array (array of positive integers) +. array_of_distribs - distribution of array in each dimension (array of state) +. array_of_dargs - distribution argument in each dimension (array of positive integers) +. array_of_psizes - size of process grid in each dimension (array of positive integers) +. order - array storage order flag (state) +. oldtype - old datatype (handle) + +Output Parameters: +. newtype - new datatype (handle) + +.N fortran +@*/ +int MPI_Type_create_darray(int size, int rank, int ndims, + int *array_of_gsizes, int *array_of_distribs, + int *array_of_dargs, int *array_of_psizes, + int order, MPI_Datatype oldtype, + MPI_Datatype *newtype) +{ + int err, error_code; + int i; + MPI_Aint orig_extent, size_with_aint; + MPI_Offset size_with_offset; + static char myname[] = "MPI_TYPE_CREATE_DARRAY"; + + /* --BEGIN ERROR HANDLING-- */ + if (size <= 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid size argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (rank < 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid rank argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (ndims <= 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid ndoms argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_gsizes <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_gsizes argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_distribs <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_distribs argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_dargs <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_dargs argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + if (array_of_psizes <= (int *) 0) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_psizes argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); + } + + for (i=0; i + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/Makefile.in b/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/Makefile.in index 563fd52b66..63c8fe5e02 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/Makefile.in @@ -5,7 +5,7 @@ LIBNAME = @LIBNAME@ srcdir = @srcdir@ INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../../include -I${srcdir}/../../../mpi-io -I${srcdir}/../../../adio/include -I../../../adio/include -CFLAGS = @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) $(OPTS) +CFLAGS = @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) @VPATH@ @@ -27,12 +27,22 @@ all: $(LIBNAME) $(CC) $(CFLAGS) -c _$*.c @rm -f _$*.c -profile: $(MPIO_TMP_PFOBJECTS) +profile: $(MPIO_REAL_PFOBJECTS) $(AR) $(LIBNAME) $(MPIO_REAL_PFOBJECTS) + $(RANLIB) $(LIBNAME) @rm -f _*.o $(LIBNAME): $(MPIO_FOBJECTS) $(AR) $(LIBNAME) $(MPIO_FOBJECTS) + $(RANLIB) $(LIBNAME) clean: - @rm -f *.o + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg + +# Rules for the profiling objects +_subarrayf.o: subarrayf.c + $(CC) $(CFLAGS) -c $(srcdir)/subarrayf.c -o _subarrayf.o +_darrayf.o: darrayf.c + $(CC) $(CFLAGS) -c $(srcdir)/darrayf.c -o _darrayf.o diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/darrayf.c b/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/darrayf.c index cd6a6fd571..2a660a428e 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/darrayf.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/darrayf.c @@ -1,41 +1,28 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ -#include "mpio.h" #include "adio.h" - +#include "mpio.h" #if defined(MPIO_BUILD_PROFILING) || defined(HAVE_WEAK_SYMBOLS) -#ifdef FORTRANCAPS -#define mpi_type_create_darray_ PMPI_TYPE_CREATE_DARRAY -#elif defined(FORTRANDOUBLEUNDERSCORE) -#define mpi_type_create_darray_ pmpi_type_create_darray__ -#elif !defined(FORTRANUNDERSCORE) -#if defined(HPUX) || defined(SPPUX) -#pragma _HP_SECONDARY_DEF pmpi_type_create_darray pmpi_type_create_darray_ -#endif -#define mpi_type_create_darray_ pmpi_type_create_darray -#else -#if defined(HPUX) || defined(SPPUX) -#pragma _HP_SECONDARY_DEF pmpi_type_create_darray_ pmpi_type_create_darray -#endif -#define mpi_type_create_darray_ pmpi_type_create_darray_ -#endif #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) +extern FORTRAN_API void FORT_CALL MPI_TYPE_CREATE_DARRAY(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_TYPE_CREATE_DARRAY = PMPI_TYPE_CREATE_DARRAY #elif defined(FORTRANDOUBLEUNDERSCORE) +extern FORTRAN_API void FORT_CALL mpi_type_create_darray__(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_type_create_darray__ = pmpi_type_create_darray__ #elif !defined(FORTRANUNDERSCORE) +extern FORTRAN_API void FORT_CALL mpi_type_create_darray(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_type_create_darray = pmpi_type_create_darray #else +extern FORTRAN_API void FORT_CALL mpi_type_create_darray_(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_type_create_darray_ = pmpi_type_create_darray_ #endif @@ -67,6 +54,22 @@ #include "mpioprof.h" #endif +#ifdef FORTRANCAPS +#define mpi_type_create_darray_ PMPI_TYPE_CREATE_DARRAY +#elif defined(FORTRANDOUBLEUNDERSCORE) +#define mpi_type_create_darray_ pmpi_type_create_darray__ +#elif !defined(FORTRANUNDERSCORE) +#if defined(HPUX) || defined(SPPUX) +#pragma _HP_SECONDARY_DEF pmpi_type_create_darray pmpi_type_create_darray_ +#endif +#define mpi_type_create_darray_ pmpi_type_create_darray +#else +#if defined(HPUX) || defined(SPPUX) +#pragma _HP_SECONDARY_DEF pmpi_type_create_darray_ pmpi_type_create_darray +#endif +#define mpi_type_create_darray_ pmpi_type_create_darray_ +#endif + #else #ifdef FORTRANCAPS @@ -86,6 +89,13 @@ #endif #ifdef MPIHP +/* Prototype to keep compiler happy */ +void mpi_type_create_darray_(int *size,int *rank,int *ndims, + int *array_of_gsizes,int *array_of_distribs, + int *array_of_dargs,int *array_of_psizes, + int *order, MPI_Fint *oldtype, + MPI_Fint *newtype, int *ierr ); + void mpi_type_create_darray_(int *size,int *rank,int *ndims, int *array_of_gsizes,int *array_of_distribs, int *array_of_dargs,int *array_of_psizes, @@ -102,12 +112,18 @@ void mpi_type_create_darray_(int *size,int *rank,int *ndims, } #else +/* Prototype to keep compiler happy */ +FORTRAN_API void FORT_CALL mpi_type_create_darray_(MPI_Fint *size,MPI_Fint *rank,MPI_Fint *ndims, + MPI_Fint *array_of_gsizes,MPI_Fint *array_of_distribs, + MPI_Fint *array_of_dargs,MPI_Fint *array_of_psizes, + MPI_Fint *order,MPI_Fint *oldtype, + MPI_Fint *newtype, MPI_Fint *ierr); -void mpi_type_create_darray_(int *size,int *rank,int *ndims, - int *array_of_gsizes,int *array_of_distribs, - int *array_of_dargs,int *array_of_psizes, - int *order,MPI_Datatype *oldtype, - MPI_Datatype *newtype, int *ierr ) +FORTRAN_API void FORT_CALL mpi_type_create_darray_(MPI_Fint *size,MPI_Fint *rank,MPI_Fint *ndims, + MPI_Fint *array_of_gsizes,MPI_Fint *array_of_distribs, + MPI_Fint *array_of_dargs,MPI_Fint *array_of_psizes, + MPI_Fint *order,MPI_Fint *oldtype, + MPI_Fint *newtype, MPI_Fint *ierr ) { *ierr = MPI_Type_create_darray(*size,*rank,*ndims,array_of_gsizes,array_of_distribs,array_of_dargs,array_of_psizes,*order,*oldtype,newtype); } diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/subarrayf.c b/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/subarrayf.c index da61ef855d..511de1d300 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/subarrayf.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/array/fortran/subarrayf.c @@ -1,41 +1,29 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ -#include "mpio.h" #include "adio.h" +#include "mpio.h" #if defined(MPIO_BUILD_PROFILING) || defined(HAVE_WEAK_SYMBOLS) -#ifdef FORTRANCAPS -#define mpi_type_create_subarray_ PMPI_TYPE_CREATE_SUBARRAY -#elif defined(FORTRANDOUBLEUNDERSCORE) -#define mpi_type_create_subarray_ pmpi_type_create_subarray__ -#elif !defined(FORTRANUNDERSCORE) -#if defined(HPUX) || defined(SPPUX) -#pragma _HP_SECONDARY_DEF pmpi_type_create_subarray pmpi_type_create_subarray_ -#endif -#define mpi_type_create_subarray_ pmpi_type_create_subarray -#else -#if defined(HPUX) || defined(SPPUX) -#pragma _HP_SECONDARY_DEF pmpi_type_create_subarray_ pmpi_type_create_subarray -#endif -#define mpi_type_create_subarray_ pmpi_type_create_subarray_ -#endif #if defined(HAVE_WEAK_SYMBOLS) #if defined(HAVE_PRAGMA_WEAK) #if defined(FORTRANCAPS) +extern FORTRAN_API void FORT_CALL MPI_TYPE_CREATE_SUBARRAY(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak MPI_TYPE_CREATE_SUBARRAY = PMPI_TYPE_CREATE_SUBARRAY #elif defined(FORTRANDOUBLEUNDERSCORE) +extern FORTRAN_API void FORT_CALL mpi_type_create_subarray__(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_type_create_subarray__ = pmpi_type_create_subarray__ #elif !defined(FORTRANUNDERSCORE) +extern FORTRAN_API void FORT_CALL mpi_type_create_subarray(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_type_create_subarray = pmpi_type_create_subarray #else +extern FORTRAN_API void FORT_CALL mpi_type_create_subarray_(MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *); #pragma weak mpi_type_create_subarray_ = pmpi_type_create_subarray_ #endif @@ -67,6 +55,22 @@ #include "mpioprof.h" #endif +#ifdef FORTRANCAPS +#define mpi_type_create_subarray_ PMPI_TYPE_CREATE_SUBARRAY +#elif defined(FORTRANDOUBLEUNDERSCORE) +#define mpi_type_create_subarray_ pmpi_type_create_subarray__ +#elif !defined(FORTRANUNDERSCORE) +#if defined(HPUX) || defined(SPPUX) +#pragma _HP_SECONDARY_DEF pmpi_type_create_subarray pmpi_type_create_subarray_ +#endif +#define mpi_type_create_subarray_ pmpi_type_create_subarray +#else +#if defined(HPUX) || defined(SPPUX) +#pragma _HP_SECONDARY_DEF pmpi_type_create_subarray_ pmpi_type_create_subarray +#endif +#define mpi_type_create_subarray_ pmpi_type_create_subarray_ +#endif + #else #ifdef FORTRANCAPS @@ -86,6 +90,12 @@ #endif #ifdef MPIHP +/* Prototype to keep compiler happy */ +void mpi_type_create_subarray_(int *ndims,int *array_of_sizes, + int *array_of_subsizes,int *array_of_starts, + int *order,MPI_Fint *oldtype, + MPI_Fint *newtype, int *ierr ); + void mpi_type_create_subarray_(int *ndims,int *array_of_sizes, int *array_of_subsizes,int *array_of_starts, int *order,MPI_Fint *oldtype, @@ -101,10 +111,17 @@ void mpi_type_create_subarray_(int *ndims,int *array_of_sizes, #else -void mpi_type_create_subarray_(int *ndims,int *array_of_sizes, - int *array_of_subsizes,int *array_of_starts, - int *order,MPI_Datatype *oldtype, - MPI_Datatype *newtype, int *ierr ){ +/* Prototype to keep compiler happy */ +FORTRAN_API void FORT_CALL mpi_type_create_subarray_(MPI_Fint *ndims,MPI_Fint *array_of_sizes, + MPI_Fint *array_of_subsizes,MPI_Fint *array_of_starts, + MPI_Fint *order,MPI_Fint *oldtype, + MPI_Fint *newtype, MPI_Fint *ierr ); + +FORTRAN_API void FORT_CALL mpi_type_create_subarray_(MPI_Fint *ndims,MPI_Fint *array_of_sizes, + MPI_Fint *array_of_subsizes,MPI_Fint *array_of_starts, + MPI_Fint *order,MPI_Fint *oldtype, + MPI_Fint *newtype, MPI_Fint *ierr ) +{ *ierr = MPI_Type_create_subarray(*ndims,array_of_sizes,array_of_subsizes,array_of_starts,*order,*oldtype,newtype); } #endif diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/array/subarray.c b/src/libs/ck-libs/ampi/romio/mpi2-other/array/subarray.c index 803277d15c..6a08b3d846 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/array/subarray.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/array/subarray.c @@ -1,7 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ - * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ @@ -24,6 +22,8 @@ #include "mpioprof.h" #endif +static char myname[] = "MPI_Type_create_subarray"; + /*@ MPI_Type_create_subarray - Creates a datatype describing a subarray of a multidimensional array @@ -45,56 +45,89 @@ int MPI_Type_create_subarray(int ndims, int *array_of_sizes, int order, MPI_Datatype oldtype, MPI_Datatype *newtype) { - MPI_Aint extent, disps[3], size, size_with_aint; - int i, blklens[3]; - MPI_Datatype tmp1, tmp2, types[3]; + MPI_Aint extent, size_with_aint; + int i, err, error_code; MPI_Offset size_with_offset; + /* --BEGIN ERROR HANDLING-- */ if (ndims <= 0) { - FPRINTF(stderr, "MPI_Type_create_subarray: Invalid ndims argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid ndims argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); } if (array_of_sizes <= (int *) 0) { - FPRINTF(stderr, "MPI_Type_create_subarray: array_of_sizes is an invalid address\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_sizes argument", + 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); } if (array_of_subsizes <= (int *) 0) { - FPRINTF(stderr, "MPI_Type_create_subarray: array_of_subsizes is an invalid address\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_subsizes argument", + 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); } if (array_of_starts <= (int *) 0) { - FPRINTF(stderr, "MPI_Type_create_subarray: array_of_starts is an invalid address\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid array_of_starts argument", + 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); } for (i=0; i array_of_sizes[i]) { - FPRINTF(stderr, "MPI_Type_create_subarray: Error! array_of_subsizes[%d] > array_of_sizes[%d]\n", i, i); - MPI_Abort(MPI_COMM_WORLD, 1); + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid subsize argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); } if (array_of_starts[i] > (array_of_sizes[i] - array_of_subsizes[i])) { - FPRINTF(stderr, "MPI_Type_create_subarray: Error! array_of_starts[%d] > (array_of_sizes[%d] - array_of_subsizes[%d])\n", i, i, i); - MPI_Abort(MPI_COMM_WORLD, 1); + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid start argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); } } /* order argument checked below */ if (oldtype == MPI_DATATYPE_NULL) { - FPRINTF(stderr, "MPI_Type_create_subarray: oldtype is an invalid datatype\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid type argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); } MPI_Type_extent(oldtype, &extent); @@ -107,84 +140,37 @@ int MPI_Type_create_subarray(int ndims, int *array_of_sizes, size_with_offset = extent; for (i=0; i=0; i--) { - size *= array_of_sizes[i+1]; - MPI_Type_hvector(array_of_subsizes[i], 1, size, tmp1, &tmp2); - MPI_Type_free(&tmp1); - tmp1 = tmp2; - } - } - - /* add displacement and UB */ - - disps[1] = array_of_starts[ndims-1]; - size = 1; - for (i=ndims-2; i>=0; i--) { - size *= array_of_sizes[i+1]; - disps[1] += size*array_of_starts[i]; - } + if (order != MPI_ORDER_FORTRAN && order != MPI_ORDER_C) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, MPI_ERR_ARG, + "Invalid order argument", 0); + return MPIO_Err_return_comm(MPI_COMM_SELF, error_code); } - else { - FPRINTF(stderr, "MPI_Type_create_subarray: Invalid order argument\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + /* --END ERROR HANDLING-- */ + + err = ADIO_Type_create_subarray(ndims, + array_of_sizes, + array_of_subsizes, + array_of_starts, + order, + oldtype, + newtype); + /* --BEGIN ERROR HANDLING-- */ + if (err != MPI_SUCCESS) { + error_code = MPIO_Err_create_code(MPI_SUCCESS, + MPIR_ERR_RECOVERABLE, + myname, __LINE__, err, + "Internal error", 0); } - - disps[1] *= extent; - - disps[2] = extent; - for (i=0; i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/Makefile.in b/src/libs/ck-libs/ampi/romio/mpi2-other/info/Makefile.in index 10fdac1735..b77f08e2b3 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/Makefile.in @@ -3,9 +3,15 @@ AR = @AR@ LIBNAME = @LIBNAME@ RANLIB = @RANLIB@ srcdir = @srcdir@ +CC_SHL = @CC_SHL@ +SHLIBNAME = @SHLIBNAME@ INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../include -I${srcdir}/../../mpi-io -I${srcdir}/../../adio/include -I../../adio/include -CFLAGS = -DMPI_INFO_SRC @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) $(OPTS) +CFLAGS = -DHAVE_MPI_INFO_SRC @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) + +top_builddir = @master_topbuild_dir@ +LIBTOOL = @LIBTOOL@ +C_COMPILE_SHL = $(CC_SHL) @VPATH@ @@ -22,23 +28,78 @@ MPIO_REAL_POBJECTS = _info_create.o _info_dup.o _info_get.o _info_getnth.o \ _info_c2f.o _info_f2c.o all: $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) $(SHLIBNAME).la ;\ + fi -.SUFFIXES: $(SUFFIXES) .p +.SUFFIXES: $(SUFFIXES) .p .sp .lo .c.o: $(CC) $(CFLAGS) -c $< +.c.lo: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o + @mv -f _s$*.o $*.lo + .c.p: @cp $(srcdir)/$*.c _$*.c $(CC) $(CFLAGS) -c _$*.c @rm -f _$*.c -profile: $(MPIO_TMP_POBJECTS) +.c.sp: + $(C_COMPILE_SHL) $(CFLAGS) -c $< -o _$*.lo + +profile: $(MPIO_REAL_POBJECTS) $(AR) $(LIBNAME) $(MPIO_REAL_POBJECTS) + $(RANLIB) $(LIBNAME) + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \ + $(MAKE) P$(SHLIBNAME).la ;\ + fi @rm -f _*.o $(LIBNAME): $(MPIO_OBJECTS) $(AR) $(LIBNAME) $(MPIO_OBJECTS) + $(RANLIB) $(LIBNAME) + +MPIO_LOOBJECTS = $(MPIO_OBJECTS:.o=.lo) +$(SHLIBNAME).la: $(MPIO_LOOBJECTS) + $(AR) $(SHLIBNAME).la $(MPIO_LOOBJECTS) + +# -------------------------------------------------------------------------- +# We use P$(SHLBNAME) simply to distinguish the regular lib build from the +# profiling library build +MPIO_LOPOBJECTS = $(MPIO_REAL_POBJECTS:.o=.lo) +MPIO_TMP_LOPOBJECTS = ${MPIO_TMP_POBJECTS:.p=.sp} +P$(SHLIBNAME).la: $(MPIO_TMP_LOPOBJECTS) + $(AR) $(SHLIBNAME).la $(MPIO_LOPOBJECTS) +# -------------------------------------------------------------------------- clean: - @rm -f *.o + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg + + +# Rules for the profiling objects +info_create.o: infocreate.c + $(CC) $(CFLAGS) -c $(srcdir)/infocreate.c -o _info_create.o +info_dup.o: infodup.c + $(CC) $(CFLAGS) -c $(srcdir)/infodup.c -o _info_dup.o +info_get.o: infoget.c + $(CC) $(CFLAGS) -c $(srcdir)/infoget.c -o _info_get.o +info_getnth.o: infogetnth.c + $(CC) $(CFLAGS) -c $(srcdir)/infogetnth.c -o _info_getnth.o +info_set.o: infoset.c + $(CC) $(CFLAGS) -c $(srcdir)/infoset.c -o _info_set.o +info_delete.o: infodelete.c + $(CC) $(CFLAGS) -c $(srcdir)/infodelete.c -o _info_delete.o +info_free.o: infofree.c + $(CC) $(CFLAGS) -c $(srcdir)/infofree.c -o _info_free.o +info_getnks.o: infogetnks.c + $(CC) $(CFLAGS) -c $(srcdir)/infogetnks.c -o _info_getnks.o +info_getvln.o: infogetvln.c + $(CC) $(CFLAGS) -c $(srcdir)/infogetvln.c -o _info_getvln.o +info_c2f.o: infoc2f.c + $(CC) $(CFLAGS) -c $(srcdir)/infoc2f.c -o _info_c2f.o +info_f2c.o: infof2c.c + $(CC) $(CFLAGS) -c $(srcdir)/infof2c.c -o _info_f2c.o diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/.state-cache b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/.state-cache new file mode 100644 index 0000000000..8f76bf2ed4 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/.state-cache @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/Makefile.in b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/Makefile.in index 519184ab37..c84769c546 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/Makefile.in @@ -5,7 +5,7 @@ RANLIB = @RANLIB@ srcdir = @srcdir@ INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../../include -I${srcdir}/../../../adio/include -I${srcdir}/../../../mpi-io -I../../../adio/include -CFLAGS = @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) $(OPTS) +CFLAGS = @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR) @VPATH@ @@ -30,12 +30,36 @@ all: $(LIBNAME) $(CC) $(CFLAGS) -c _$*.c @rm -f _$*.c -profile: $(MPIO_TMP_POBJECTS) +profile: $(MPIO_REAL_POBJECTS) $(AR) $(LIBNAME) $(MPIO_REAL_POBJECTS) + $(RANLIB) $(LIBNAME) @rm -f _*.o $(LIBNAME): $(MPIO_OBJECTS) $(AR) $(LIBNAME) $(MPIO_OBJECTS) + $(RANLIB) $(LIBNAME) clean: - @rm -f *.o + @rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg + @rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda + @rm -f ${srcdir}/*.bb ${srcdir}/*.bbg + +# Rules for the profiling objects +_info_createf.o: info_createf.c + $(CC) $(CFLAGS) -c $(srcdir)/info_createf.c -o _info_createf.o +_info_dupf.o: info_dupf.c + $(CC) $(CFLAGS) -c $(srcdir)/info_dupf.c -o _info_dupf.o +_info_getf.o: info_getf.c + $(CC) $(CFLAGS) -c $(srcdir)/info_getf.c -o _info_getf.o +_info_getnthf.o: info_getnthf.c + $(CC) $(CFLAGS) -c $(srcdir)/info_getnthf.c -o _info_getnthf.o +_info_setf.o: info_setf.c + $(CC) $(CFLAGS) -c $(srcdir)/info_setf.c -o _info_setf.o +_info_deletef.o: info_deletef.c + $(CC) $(CFLAGS) -c $(srcdir)/info_deletef.c -o _info_deletef.o +_info_freef.o: info_freef.c + $(CC) $(CFLAGS) -c $(srcdir)/info_freef.c -o _info_freef.o +_info_getnksf.o: info_getnksf.c + $(CC) $(CFLAGS) -c $(srcdir)/info_getnksf.c -o _info_getnksf.o +_info_getvlnf.o: info_getvlnf.c + $(CC) $(CFLAGS) -c $(srcdir)/info_getvlnf.c -o _info_getvlnf.o diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_createf.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_createf.c index c57d44d44e..cd2d45b3e1 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_createf.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_createf.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_deletef.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_deletef.c index 623212ca31..039b85b549 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_deletef.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_deletef.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -111,7 +110,7 @@ void mpi_info_delete_(MPI_Fint *info, char *key, int *ierr, int keylen) key += lead_blanks; newkey = (char *) ADIOI_Malloc((new_keylen+1)*sizeof(char)); - strncpy(newkey, key, new_keylen); + ADIOI_Strncpy(newkey, key, new_keylen); newkey[new_keylen] = '\0'; info_c = MPI_Info_f2c(*info); diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_dupf.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_dupf.c index ed95bccb01..6d4fd40331 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_dupf.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_dupf.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_freef.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_freef.c index a569fe9bb2..d8f0f88d3a 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_freef.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_freef.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_getf.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_getf.c index 20f1b393bf..0fc8e13614 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_getf.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/fortran/info_getf.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -112,7 +111,7 @@ void mpi_info_get_(MPI_Fint *info, char *key, int *valuelen, char *value, key += lead_blanks; newkey = (char *) ADIOI_Malloc((new_keylen+1)*sizeof(char)); - strncpy(newkey, key, new_keylen); + ADIOI_Strncpy(newkey, key, new_keylen); newkey[new_keylen] = '\0'; if (value <= (char *) 0) { @@ -135,7 +134,7 @@ void mpi_info_get_(MPI_Fint *info, char *key, int *valuelen, char *value, if (*flag) { tmpvaluelen = strlen(tmpvalue); - strncpy(value, tmpvalue, tmpvaluelen); + ADIOI_Strncpy(value, tmpvalue, tmpvaluelen); /* blank pad the remaining space */ for (i=tmpvaluelen; icookie = MPIR_INFO_COOKIE; @@ -72,5 +46,6 @@ int MPI_Info_create(MPI_Info *info) /* this is the first structure in this linked list. it is always kept empty. new (key,value) pairs are added after it. */ +fn_exit: return MPI_SUCCESS; } diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_delete.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_delete.c index 702bfd8a96..ab72499d4f 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_delete.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_delete.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -64,8 +63,8 @@ int MPI_Info_delete(MPI_Info info, char *key) while (curr) { if (!strcmp(curr->key, key)) { - free(curr->key); /* not ADIOI_Free, because it was strdup'ed */ - free(curr->value); + ADIOI_Free(curr->key); + ADIOI_Free(curr->value); prev->next = curr->next; ADIOI_Free(curr); done = 1; diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_dup.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_dup.c index 134f125677..aea92855ec 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_dup.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_dup.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -56,8 +55,8 @@ int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) curr_new->next = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info)); curr_new = curr_new->next; curr_new->cookie = 0; /* cookie not set on purpose */ - curr_new->key = strdup(curr_old->key); - curr_new->value = strdup(curr_old->value); + curr_new->key = ADIOI_Strdup(curr_old->key); + curr_new->value = ADIOI_Strdup(curr_old->value); curr_new->next = 0; curr_old = curr_old->next; diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_f2c.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_f2c.c index e42328a127..2cef4f5faf 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_f2c.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_f2c.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_free.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_free.c index b105aef81f..b14699809c 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_free.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_free.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -47,8 +46,8 @@ int MPI_Info_free(MPI_Info *info) while (curr) { next = curr->next; - free(curr->key); - free(curr->value); + ADIOI_Free(curr->key); + ADIOI_Free(curr->value); ADIOI_Free(curr); curr = next; } diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_get.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_get.c index 4616c1d63c..443b4fc51d 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_get.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_get.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -77,7 +76,7 @@ int MPI_Info_get(MPI_Info info, char *key, int valuelen, char *value, int *flag) while (curr) { if (!strcmp(curr->key, key)) { - strncpy(value, curr->value, valuelen); + ADIOI_Strncpy(value, curr->value, valuelen); value[valuelen] = '\0'; *flag = 1; break; diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getnks.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getnks.c index e9a7a615e2..6806276fb0 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getnks.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getnks.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getnth.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getnth.c index afaf9f583b..2e2978f96c 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getnth.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getnth.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -69,7 +68,7 @@ int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) curr = curr->next; i++; } - strcpy(key, curr->key); + ADIOI_Strncpy(key, curr->key, MPI_MAX_INFO_KEY); return MPI_SUCCESS; } diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getvln.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getvln.c index ab872370a2..903b280f17 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getvln.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_getvln.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. diff --git a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_set.c b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_set.c index 26bc03ac07..49574eeb01 100644 --- a/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_set.c +++ b/src/libs/ck-libs/ampi/romio/mpi2-other/info/info_set.c @@ -1,6 +1,5 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * $Id$ * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. @@ -78,8 +77,8 @@ int MPI_Info_set(MPI_Info info, char *key, char *value) while (curr) { if (!strcmp(curr->key, key)) { - free(curr->value); /* not ADIOI_Free, because it was strdup'ed */ - curr->value = strdup(value); + ADIOI_Free(curr->value); + curr->value = ADIOI_Strdup(value); break; } prev = curr; @@ -90,8 +89,8 @@ int MPI_Info_set(MPI_Info info, char *key, char *value) prev->next = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info)); curr = prev->next; curr->cookie = 0; /* cookie not set on purpose */ - curr->key = strdup(key); - curr->value = strdup(value); + curr->key = ADIOI_Strdup(key); + curr->value = ADIOI_Strdup(value); curr->next = 0; } diff --git a/src/libs/ck-libs/ampi/romio/test-internal/.state-cache b/src/libs/ck-libs/ampi/romio/test-internal/.state-cache new file mode 100644 index 0000000000..f215bd3e0e --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test-internal/.state-cache @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/test-internal/Makefile.in b/src/libs/ck-libs/ampi/romio/test-internal/Makefile.in new file mode 100644 index 0000000000..508e83355f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test-internal/Makefile.in @@ -0,0 +1,47 @@ +CC = @TEST_CC@ +F77 = @TEST_F77@ +INCLUDE_DIR = @ROMIO_INCLUDE@ +# because := is not universally avalible, we have to play games to use the +# user-specificed LDFLAGS and OUR_LIBS env. variables (if set) +OUR_LIBS = @TEST_LIBNAME@ @MPI_LIB@ @ROMIO_LIBLIST@ ${LDFLAGS} ${LIBS} +USER_CFLAGS = @CPPFLAGS@ @USER_CFLAGS@ $(INCLUDE_DIR) +USER_FFLAGS = @CPPFLAGS@ @USER_FFLAGS@ $(INCLUDE_DIR) +CTESTS = file_realms_test io_bounds_test heap_test +FTESTS = +srcdir=@srcdir@ + +@VPATH@ + + +all: c-test + +c-test: $(CTESTS) + +default: all + +.c.o: + $(CC) $(USER_CFLAGS) -c $< + +.f.o: + $(F77) $(USER_FFLAGS) -c $< + +.o: + $(CC) $(USER_CFLAGS) -o $@ $< $(OUR_LIBS) + +clean: + rm -f .P* PI* *.o + rm -f $(CTESTS) $(FTESTS) + @-rm -f work.pc work.pcl + +file_realms_test: file_realms_test.o + +io_bounds_test: io_bounds_test.o + +heap_test: heap_test.o +# +# The Fortran tests must be built with the Fortran linker +#testing: +# -./runtests $(TESTARGS) + +cleanall: + -@rm -f .P* PI* diff --git a/src/libs/ck-libs/ampi/romio/test-internal/file_realms_test.c b/src/libs/ck-libs/ampi/romio/test-internal/file_realms_test.c new file mode 100644 index 0000000000..029fa1b61b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test-internal/file_realms_test.c @@ -0,0 +1,76 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "../adio/include/adio.h" +#include "../adio/include/adio_extern.h" +#include "mpi.h" + +int main (int argc, char **argv) +{ + int i; + ADIO_File fd; + ADIO_Offset min_st_offset, max_end_offset; + int rank; + int nprocs_for_coll; + int lb; + int size, extent; + + MPI_Init (&argc, &argv); + MPI_Comm_rank (MPI_COMM_WORLD, &rank); + + if (argc != 4) { + if (!rank) + printf ("Usage: file_realms_test \n" + " simulates file_realm calculation\n"); + MPI_Finalize(); + return 1; + } + + nprocs_for_coll = atoi (argv[1]); + + min_st_offset = atoi (argv[2]); + max_end_offset = atoi (argv[3]); + + if (max_end_offset < min_st_offset){ + if (!rank) + printf ("end offset %lld is less then start offset %lld\n", + max_end_offset, min_st_offset); + MPI_Finalize(); + return 1; + } + + printf ("min_st_offset = %lld\nmax_end_offset = %lld\n", + min_st_offset, max_end_offset); + + fd = (ADIO_File) ADIOI_Malloc (sizeof (struct ADIOI_FileD)); + fd->hints = (ADIOI_Hints *) + ADIOI_Malloc (sizeof(struct ADIOI_Hints_struct)); + fd->hints->cb_nodes = nprocs_for_coll; + ADIOI_Calc_file_realms (fd, min_st_offset, max_end_offset); + + for (i=0; i < nprocs_for_coll; i++) { + printf ("file_realm_st_offs[%d] = %lld\n", i, fd->file_realm_st_offs[i]); + } + for (i=0; i < nprocs_for_coll; i++) { + MPI_Type_size (fd->file_realm_types[i], &size); + printf ("file_realm [%d] size = %d\n", i, size); + } + for (i=0; i < nprocs_for_coll; i++) { + MPI_Type_get_extent (fd->file_realm_types[i], &lb, &extent); + printf ("file_realm [%d] extent = %d\n", i, extent); + } + + for (i=0; i < nprocs_for_coll; i++) + MPI_Type_free (&fd->file_realm_types[i]); + ADIOI_Free (fd->file_realm_st_offs); + ADIOI_Free (fd->file_realm_types); + ADIOI_Free (fd->hints); + ADIOI_Free (fd); + + MPI_Finalize(); + + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/test-internal/heap_test.c b/src/libs/ck-libs/ampi/romio/test-internal/heap_test.c new file mode 100644 index 0000000000..c47b5385f0 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test-internal/heap_test.c @@ -0,0 +1,453 @@ +#include "../adio/include/heap-sort.h" +#include +#include +#include +#include + +#define PREDEF_TESTS 2 +/* test types */ +#define ALL 0 +#define RANDOM -1 +#define CUSTOM -2 + +/* ACTIONS */ +#define BUILD 0 +#define INSERT 1 +#define EXTRACT 2 +#define EXTRACT_INSERT 3 + +typedef struct { + char name[64]; + int heap_size; + int print; + int verify; + int action_arr_sz; + int *action_arr; + int *action_count_arr; + ADIO_Offset *offsets; + ADIO_Offset *correct_order; +} test_params_t; + +void print_usage(); +void print_keys(ADIO_Offset* offsets, int size); +void print_params(test_params_t *params); +int run_test(test_params_t *test); +void fill_random_test(test_params_t *params); +void init_predefined_test(test_params_t *params, int index); +void dumb_sort(test_params_t *params); + +int main(int argc, char **argv) { + int i, print = 1, verify = 1; + int adding_elements; + int curr_add_idx; + int test_type = RANDOM; + test_params_t predefined_tests[PREDEF_TESTS]; + test_params_t test; + + /* parse args */ + adding_elements = 0; + curr_add_idx = 0; + if (argc == 1) { + print_usage(); + return 1; + } + i = 1; + while (i < argc) { + if (!strcmp("-A", argv[i])) { + adding_elements = 0; + test_type = ALL; + i++; + } + else if (!strcmp("-T", argv[i])) { + adding_elements = 0; + test_type = atoi(argv[i+1]); + i += 2; + } + else if (!strcmp("-r", argv[i])) { + adding_elements = 0; + test.heap_size = atoi(argv[i+1]); + if (test.heap_size <= 0) { + printf("heap size should be a positive integer\n"); + return 1; + } + test.offsets = (ADIO_Offset *) malloc(test.heap_size*sizeof(ADIO_Offset)); + test_type = RANDOM; + i += 2; + } + else if (!strcmp("-e", argv[i])) { + test.heap_size = argc - 2; + if (test.heap_size <= 0) { + printf("need at least one key\n"); + return 1; + } + test.offsets = (ADIO_Offset *) malloc(test.heap_size*sizeof(ADIO_Offset)); + adding_elements = 1; + test_type = CUSTOM; + i++; + } + else if (!strcmp("-v", argv[i])) { + verify = 1; + i++; + } + else if (!strcmp("-p", argv[i])) { + print = 1; + i++; + } + else if (!strcmp("-V", argv[i])) { + verify = 0; + i++; + } + else if (!strcmp("-P", argv[i])) { + print = 0; + i++; + } + else if (adding_elements) { + test.offsets[curr_add_idx] = atoi(argv[i]); + curr_add_idx++; + i++; + } + else { + printf("Illegal argument: %s", argv[i]); + print_usage(); + return 1; + } + } + + if (test_type == RANDOM) { + fill_random_test(&test); + strcpy(test.name, "RANDOMIZED TEST"); + } + else if (test_type == CUSTOM) + strcpy(test.name, "CUSTOM TEST"); + if ((test_type == CUSTOM) || (test_type == RANDOM)) { + test.print = print; + test.verify = verify; + test.action_arr_sz = 2; + test.action_arr = (int *) malloc(test.action_arr_sz*sizeof(int)); + test.action_count_arr = (int *) malloc(test.action_arr_sz*sizeof(int)); + /* build the entire heap */ + /* test.action_arr[0] = BUILD; + test.action_count_arr[0] = 1; */ + /* insert keys one at a time */ + test.action_arr[0] = INSERT; + test.action_count_arr[0] = test.heap_size; + /* extract all the keys */ + test.action_arr[1] = EXTRACT; + test.action_count_arr[1] = test.heap_size; + + if (verify) { + test.correct_order = (ADIO_Offset *)malloc(test.heap_size*sizeof(ADIO_Offset)); + dumb_sort(&test); + } + if (print) + print_params(&test); + run_test(&test); + } + else { + if (test_type == ALL) { + for (i=0; i\n" + " -r Create a random test and verify of size \n" + " -e test with the space delimited list of keys\n" + " -p print parameters and keys (default)\n" + " -P do not print parameters and keys\n" + " -v verify keys (default)\n" + " -V do not verify keys\n" + ); +} + +void print_keys(ADIO_Offset *offsets, int size) { + int i; + for (i=0; i < size; i++) + printf("%lld ", offsets[i]); +} + +void print_params(test_params_t *params) { + int i; + static char action_map[3][8] = {"BUILD", "INSERT", "EXTRACT"}; + + printf("----------------Test Parameters---------------\n"); + printf("Actions:\n"); + for (i=0; iaction_arr_sz; i++) { + printf("%sx%d\n", action_map[params->action_arr[i]], + params->action_count_arr[i]); + } + + printf("Initial order :\n"); + print_keys(params->offsets, params->heap_size); + printf("\n"); + + if (params->verify) { + printf("Expected order:\n"); + print_keys(params->correct_order, params->heap_size); + printf("\n"); + } + printf("----------------------------------------------\n"); +} + +void fill_random_test(test_params_t *params) { + int i; + int max_key; + time_t seed; + int order = 0; + + time(&seed); + srand(seed); + + order = 0; + max_key = 1; + while (order < 25) { + max_key *= 10; + if (!((int) (params->heap_size / max_key))) + break; + order++; + } + for (i=0; i < params->heap_size; i++) + params->offsets[i] = (rand() % max_key); +} + +void dumb_sort(test_params_t *params) { + ADIO_Offset *offsets, tmp_offset; + int i, j; + + offsets = params->correct_order; + memcpy(offsets, params->offsets, params->heap_size*sizeof(ADIO_Offset)); + for (i=0; i < params->heap_size; i++) { + for (j=i; j < params->heap_size; j++) { + if (offsets[j] < offsets[i]) { + tmp_offset = offsets[i]; + offsets[i] = offsets[j]; + offsets[j] = tmp_offset; + } + } + } +} + +int run_test(test_params_t *test) { + heap_t myheap; + ADIO_Offset *extracted; + int stored_proc; + ADIO_Offset stored_reg_max_len; + int i, j, k, err_flag = 0; + int curr_insert_idx = 0; + int curr_extract_idx = 0; + + create_heap(&myheap, test->heap_size); + myheap.size = 0; + + extracted = (ADIO_Offset *) malloc(test->heap_size * sizeof(ADIO_Offset)); + for (i=0; i < test->action_arr_sz; i++) { + for (j=0; jaction_count_arr[i]; j++) { + switch (test->action_arr[i]) + { + case BUILD: + myheap.size = test->heap_size; + for (k=0; k < test->heap_size; k++) { + myheap.nodes[k].offset = test->offsets[k]; + myheap.nodes[k].proc = k; + } + build_heap(&myheap); + break; + case INSERT: + ADIOI_Heap_insert(&myheap, test->offsets[curr_insert_idx], + curr_insert_idx, curr_insert_idx); + curr_insert_idx++; + break; + case EXTRACT: + heap_extract_min(&myheap, &extracted[curr_extract_idx], + &stored_proc, &stored_reg_max_len); + if (test->verify && (extracted[curr_extract_idx] != + test->correct_order[curr_extract_idx])) + err_flag++; + curr_extract_idx++; + break; + case EXTRACT_INSERT: + heap_extract_min(&myheap, &extracted[curr_extract_idx], + &stored_proc, &stored_reg_max_len); + if (test->verify &&(extracted[curr_extract_idx] != + test->correct_order[curr_extract_idx])) + err_flag++; + curr_extract_idx++; + + ADIOI_Heap_insert(&myheap, test->offsets[curr_insert_idx], + curr_insert_idx, curr_insert_idx); + curr_insert_idx++; + break; + default: + break; + } + } + } + + if (test->verify) { + if (err_flag) { + printf("***%s FAILED***\n", test->name); + if (test->print) { + printf("Min extraction:\n"); + print_keys(extracted, test->heap_size); + printf("\n"); + } + } + else + printf("***%s PASSED***\n", test->name); + } + + free_heap(&myheap); + free(extracted); + /* clean up test params */ + free(test->offsets); + if (test->verify) + free(test->correct_order); + free(test->action_arr); + free(test->action_count_arr); + + return err_flag; +} + +void init_predefined_test(test_params_t *params, int index) { + + switch (index) + { + case 0: + strcpy(params->name, "TEST 1"); + params->heap_size = 15; + params->action_arr_sz = 3; + + /* allocate space */ + params->action_arr = + (int *) malloc (params->action_arr_sz*sizeof(int)); + params->action_count_arr = + (int *) malloc (params->action_arr_sz*sizeof(int)); + params->offsets = (ADIO_Offset *) malloc(params->heap_size*sizeof(ADIO_Offset)); + if (params->verify) + params->correct_order = + (ADIO_Offset *) malloc(params->heap_size*sizeof(ADIO_Offset)); + + /* Set procs */ + params->offsets[0] = 65; + params->offsets[1] = 53; + params->offsets[2] = 51; + params->offsets[3] = 74; + params->offsets[4] = 1; + params->offsets[5] = 3; + params->offsets[6] = 86; + params->offsets[7] = 82; + params->offsets[8] = 42; + params->offsets[9] = 62; + params->offsets[10] = 33; + params->offsets[11] = 12; + params->offsets[12] = 79; + params->offsets[13] = 13; + params->offsets[14] = 28; + + if (params->verify) { + params->correct_order[0] = 1; + params->correct_order[1] = 3; + params->correct_order[2] = 12; + params->correct_order[3] = 33; + params->correct_order[4] = 13; + params->correct_order[5] = 28; + params->correct_order[6] = 42; + params->correct_order[7] = 51; + params->correct_order[8] = 53; + params->correct_order[9] = 62; + params->correct_order[10] = 65; + params->correct_order[11] = 74; + params->correct_order[12] = 79; + params->correct_order[13] = 82; + params->correct_order[14] = 86; + } + + params->action_arr[0] = INSERT; + params->action_arr[1] = EXTRACT_INSERT; + params->action_arr[11] = EXTRACT; + + params->action_count_arr[0] = 10; + params->action_count_arr[1] = 5; + params->action_count_arr[11] = 10; + break; + case 1: + strcpy(params->name, "TEST 1"); + params->heap_size = 15; + params->action_arr_sz = 3; + + /* allocate space */ + params->action_arr = + (int *) malloc (params->action_arr_sz*sizeof(int)); + params->action_count_arr = + (int *) malloc (params->action_arr_sz*sizeof(int)); + params->offsets = (ADIO_Offset *) malloc(params->heap_size*sizeof(ADIO_Offset)); + if (params->verify) + params->correct_order = + (ADIO_Offset *) malloc(params->heap_size*sizeof(ADIO_Offset)); + + /* Set values */ + params->offsets[0] = 65; + params->offsets[1] = 53; + params->offsets[2] = 51; + params->offsets[3] = 74; + params->offsets[4] = 1; + params->offsets[5] = 3; + params->offsets[6] = 86; + params->offsets[7] = 82; + params->offsets[8] = 42; + params->offsets[9] = 62; + params->offsets[10] = 33; + params->offsets[11] = 12; + params->offsets[12] = 79; + params->offsets[13] = 13; + params->offsets[14] = 28; + + if (params->verify) { + params->correct_order[0] = 1; + params->correct_order[1] = 3; + params->correct_order[2] = 12; + params->correct_order[3] = 33; + params->correct_order[4] = 13; + params->correct_order[5] = 28; + params->correct_order[6] = 42; + params->correct_order[7] = 51; + params->correct_order[8] = 53; + params->correct_order[9] = 62; + params->correct_order[10] = 65; + params->correct_order[11] = 74; + params->correct_order[12] = 79; + params->correct_order[13] = 82; + params->correct_order[14] = 86; + } + + params->action_arr[0] = INSERT; + params->action_arr[1] = EXTRACT_INSERT; + params->action_arr[11] = EXTRACT; + + params->action_count_arr[0] = 10; + params->action_count_arr[1] = 5; + params->action_count_arr[11] = 10; + break; + default: + break; + } +} diff --git a/src/libs/ck-libs/ampi/romio/test-internal/io_bounds_test.c b/src/libs/ck-libs/ampi/romio/test-internal/io_bounds_test.c new file mode 100644 index 0000000000..b2a48c1be0 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test-internal/io_bounds_test.c @@ -0,0 +1,302 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (C) 2008 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + +#include "../adio/include/adio.h" +#include "../adio/include/adioi.h" +#include "../adio/include/adio_extern.h" +#include "mpi.h" + +#define PREDEF_TESTS 5 +#define MAX_OFF_LENS 4 + +typedef struct { + ADIO_Offset offset; + int count; + int type_blocklens[MAX_OFF_LENS]; + int type_indices[MAX_OFF_LENS]; + MPI_Datatype type_oldtypes[MAX_OFF_LENS]; + int type_count; + + ADIO_Offset correct_st_offset; + ADIO_Offset correct_end_offset; +} test_param_t; + +int run_test (test_param_t *test); +int setup_predefined (test_param_t *tests_arr, int count); +int print_usage (void); +int print_test_params (test_param_t *test); + +int main (int argc, char **argv) { + int rank; + int run_test_number = 0; + int failed; + int while_condition; + int i; + + test_param_t predefined_tests[PREDEF_TESTS]; + + MPI_Init (&argc, &argv); + MPI_Comm_rank (MPI_COMM_WORLD, &rank); + + if (argc != 1) { + if (!rank) { + printf ("Use only one process\n"); + print_usage (); + } + MPI_Finalize(); + return 1; + } + i = 1; + while (i < argc) { + if (!strcmp (argv[i], "-A")) { + run_test_number = 0; + i++; + } + else if (!strcmp (argv[i], "-T")) { + run_test_number = atoi (argv[i+1]); + if ((run_test_number > PREDEF_TESTS) || (run_test_number < 1)) { + if (!rank) + printf ("Invalid test number, only %d tests\n", + PREDEF_TESTS); + MPI_Finalize (); + return 1; + } + i += 2; + } + else { + if (!rank) { + printf ("Invalid Argument: %s\n", argv[i]); + print_usage (); + } + i++; + } + } + + setup_predefined (predefined_tests, PREDEF_TESTS); + + if (!run_test_number) { + i = 0; + while_condition = PREDEF_TESTS; + } + else { + i = run_test_number - 1; + while_condition = run_test_number; + } + while (i < while_condition) { + printf ("***** Test %d *****\n", i+1); + failed = run_test (&predefined_tests[i]); + printf ("******************\n"); + i++; + } + + MPI_Finalize (); + + return 0; +} + +int run_test (test_param_t *test) { + ADIO_Offset st_offset, end_offset; + MPI_File fh; + int is_contig; + int ind_err = 0, exp_err = 0; + + MPI_Datatype filetype; + + MPI_Type_struct (test->type_count, test->type_blocklens, + test->type_indices, test->type_oldtypes, &filetype); + MPI_Type_commit (&filetype); + + MPI_File_open (MPI_COMM_WORLD, "test_file.txt" , MPI_MODE_RDWR, + MPI_INFO_NULL, &fh); + + MPI_File_set_view (fh, 0, MPI_BYTE, filetype, "native", MPI_INFO_NULL); + + MPI_File_seek (fh, test->offset, MPI_SEEK_SET); + ADIOI_Calc_bounds ((ADIO_File) fh, test->count, MPI_BYTE, ADIO_INDIVIDUAL, + test->offset, &st_offset, &end_offset); + + ind_err = 0; + if (st_offset != test->correct_st_offset) { + printf ("Individual st_offset = %lld end_offset = %lld\n", + st_offset, end_offset); + ind_err = 1; + } + if (end_offset != test->correct_end_offset) { + printf ("Individual st_offset = %lld end_offset = %lld\n", + st_offset, end_offset); + ind_err = 1; + } + MPI_File_close (&fh); + if (ind_err) + printf ("Individual Calc FAILED\n"); + + MPI_File_open (MPI_COMM_WORLD, "test_file.txt" , MPI_MODE_RDWR, + MPI_INFO_NULL, &fh); + + if (!is_contig) + MPI_File_set_view (fh, 0, MPI_BYTE, filetype, "native", MPI_INFO_NULL); + + MPI_File_seek (fh, 0, MPI_SEEK_SET); + ADIOI_Calc_bounds ((ADIO_File) fh, test->count, MPI_BYTE, + ADIO_EXPLICIT_OFFSET, test->offset, &st_offset, + &end_offset); + + exp_err = 0; + if (st_offset != test->correct_st_offset) { + printf ("Explicit st_offset = %lld end_offset = %lld\n", + st_offset, end_offset); + exp_err = 1; + } + if (end_offset != test->correct_end_offset) { + printf ("Explicit st_offset = %lld end_offset = %lld\n", + st_offset, end_offset); + exp_err = 1; + } + if (exp_err) + printf ("Explicit Calc FAILED\n"); + + MPI_File_close (&fh); + + if (!is_contig) + MPI_Type_free (&filetype); + + return (exp_err || ind_err); +} + +int print_usage () +{ + printf ( + "Usage:\n" + " io_bounds_test -A -T \n"); +} + +int print_test_params (test_param_t *test) +{ + int i; + printf ( + "I/O offset: %lld\n" + "bytes: %d\n" + "Filetype [n](disp, lens, type):\n", + test->offset, test->count); + + for (i=0; itype_count; i++) { + printf ( + " [%d](%lld, %d, ", + i, + test->type_blocklens[i], + test->type_indices[i]); + if (test->type_oldtypes[i] == MPI_BYTE) { + printf ( "%s)\n", "MPI_BYTE"); + } + else if (test->type_oldtypes[i] == MPI_UB) { + printf ( "%s)\n", "MPI_UB"); + } + else if (test->type_oldtypes[i] == MPI_LB) { + printf ( "%s)\n", "MPI_LB"); + } + } + printf ( + "Expected Start offset: %lld\n" + "Expected End offset: %lld\n", + test->correct_st_offset, + test->correct_end_offset); +} + +int setup_predefined (test_param_t *tests_arr, int count) +{ + int i; + for (i=0; i < PREDEF_TESTS; i++) { + switch (i) + { + case 0: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + case 1: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + case 2: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + case 3: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + case 4: + tests_arr[i].offset = 0; + tests_arr[i].count = 0; + tests_arr[i].type_count = 0; + tests_arr[i].type_indices[0] = 0; + tests_arr[i].type_blocklens[0] = 0; + tests_arr[i].type_oldtypes[0] = MPI_BYTE; + tests_arr[i].type_indices[1] = 0; + tests_arr[i].type_blocklens[1] = 0; + tests_arr[i].type_oldtypes[1] = MPI_BYTE; + tests_arr[i].type_indices[2] = 0; + tests_arr[i].type_blocklens[2] = 0; + tests_arr[i].type_oldtypes[2] = MPI_BYTE; + tests_arr[i].type_indices[3] = 0; + tests_arr[i].type_blocklens[3] = 0; + tests_arr[i].type_oldtypes[3] = MPI_BYTE; + break; + } + } + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/test/.codingcheck b/src/libs/ck-libs/ampi/romio/test/.codingcheck new file mode 100644 index 0000000000..0d0a655fa8 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test/.codingcheck @@ -0,0 +1,13 @@ +# +# We allow these routines for the romio test programs +%romioTestRoutines = ( + 'printf' => sys, 'fprintf' => sys , 'sprintf' => sys, 'vprintf' => sys, + 'strcpy' => sys, 'strncpy' => sys, 'strcat' => sys, + 'malloc' => sys, 'free' => sys, 'calloc' => sys, 'strdup' => sys, + 'assert' => sys, 'snprintf' => sys, + ); +if (defined(&PushAllowFuncNames)) { + &PushAllowFuncNames( "romioTestRoutines", "tree", "add" ); +} + +1; diff --git a/src/libs/ck-libs/ampi/romio/test/.state-cache b/src/libs/ck-libs/ampi/romio/test/.state-cache new file mode 100644 index 0000000000..8bf25ccc8c --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test/.state-cache @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/test/Makefile.in b/src/libs/ck-libs/ampi/romio/test/Makefile.in dissimilarity index 65% index e74b798846..7f85a3bb86 100644 --- a/src/libs/ck-libs/ampi/romio/test/Makefile.in +++ b/src/libs/ck-libs/ampi/romio/test/Makefile.in @@ -1,81 +1,60 @@ -CC = @TEST_CC@ -F77 = @TEST_F77@ -ffree-form -INCLUDE_DIR = @ROMIO_INCLUDE@ -# because := is not universally avalible, we have to play games to use the -# user-specificed LDFLAGS and OUR_LIBS env. variables (if set) -OUR_LIBS = @TEST_LIBNAME@ @MPI_LIB@ ${LDFLAGS} ${LIBS} -USER_CFLAGS = @USER_CFLAGS@ $(INCLUDE_DIR) -USER_FFLAGS = @USER_FFLAGS@ $(INCLUDE_DIR) -CTESTS = simple perf async coll_test coll_perf misc file_info excl large_array \ - atomicity noncontig i_noncontig noncontig_coll split_coll shared_fp \ - large_file error status noncontig_coll2 psimple -FTESTS = fcoll_test fperf fmisc pfcoll_test -srcdir=@srcdir@ - -@VPATH@ - - -all: c-test @FORTRAN_TEST@ - -c-test: $(CTESTS) - -default: all - -.c.o: - $(CC) $(USER_CFLAGS) -c $< - -.f.o: - $(F77) $(USER_FFLAGS) -c $< - -.o: - $(CC) $(USER_CFLAGS) -o $@ $< $(OUR_LIBS) - -clean: - rm -f .P* PI* *.o - rm -f $(CTESTS) $(FTESTS) - @-rm -f work.pc work.pcl - -simple: simple.o -psimple: psimple.o -perf: perf.o -excl: excl.o -status: status.o -async: async.o -atomicity: atomicity.o -coll_test: coll_test.o -coll_perf: coll_perf.o -misc: misc.o -noncontig: noncontig.o -i_noncontig: i_noncontig.o -noncontig_coll: noncontig_coll.o -noncontig_coll2: noncontig_coll2.o -file_info: file_info.o -error: error.o -shared_fp: shared_fp.o -split_coll: split_coll.o -#fperf: fperf.o -#fcoll_test: fcoll_test.o -#pfcoll_test: pfcoll_test.o -#fmisc: fmisc.o -large_file: large_file.o -large_array: large_array.o - -# -# The Fortran tests must be built with the Fortran linker -fperf: fperf.f - $(F77) $(USER_FFLAGS) -o $@ $< $(OUR_LIBS) - -fcoll_test: fcoll_test.f - $(F77) $(USER_FFLAGS) -o $@ $< $(OUR_LIBS) - -fmisc: fmisc.f - $(F77) $(USER_FFLAGS) -o $@ $< $(OUR_LIBS) - -pfcoll_test: pfcoll_test.f - $(F77) $(USER_FFLAGS) -o $@ $< $(OUR_LIBS) - -testing: - -./runtests $(TESTARGS) - -cleanall: - -@rm -f .P* PI* misc.c large_file.c fcoll_test.f fmisc.f fperf.f \mpif.h simple async coll_test coll_perf misc perf fcoll_test fperf fmisc file_info excl large_array large_file noncontig i_noncontig noncontig_coll atomicity *.out runtests pfcoll_test.f noncontig_coll2 +CC = @TEST_CC@ +F77 = @TEST_F77@ +INCLUDE_DIR = @ROMIO_INCLUDE@ +# because := is not universally avalible, we have to play games to use the +# user-specified LDFLAGS and OUR_LIBS env. variables (if set) +OUR_LIBS = @TEST_LIBNAME@ @MPI_LIB@ ${LDFLAGS} ${LIBS} +USER_CFLAGS = @CPPFLAGS@ @USER_CFLAGS@ $(INCLUDE_DIR) +USER_FFLAGS = @CPPFLAGS@ @USER_FFLAGS@ $(INCLUDE_DIR) +CTESTS = simple perf async coll_test coll_perf misc file_info excl large_array \ + atomicity noncontig i_noncontig noncontig_coll split_coll shared_fp \ + large_file error status noncontig_coll2 aggregation1 aggregation2 \ + async-multiple ordered_fp hindexed +# psimple +FTESTS = fcoll_test fperf fmisc +# pfcoll_test +srcdir=@srcdir@ + +@VPATH@ + + +all: c-test fcoll_test fperf fmisc + +c-test: $(CTESTS) + +default: all + +.c.o: + $(CC) $(USER_CFLAGS) -c $< + +.f.o: + $(F77) $(USER_FFLAGS) -c $< + +.o: + $(CC) $(USER_CFLAGS) -o $@ $< $(OUR_LIBS) + +clean: + rm -f .P* PI* *.o + rm -f $(CTESTS) $(FTESTS) + @-rm -f work.pc work.pcl + +# +# The Fortran tests must be built with the Fortran linker +fperf: fperf.o + $(F77) $(USER_FFLAGS) -o fperf fperf.o $(OUR_LIBS) + +fcoll_test: fcoll_test.o + $(F77) $(USER_FFLAGS) -o fcoll_test fcoll_test.o $(OUR_LIBS) + +fmisc: fmisc.o + $(F77) $(USER_FFLAGS) -o fmisc fmisc.o $(OUR_LIBS) + +pfcoll_test: pfcoll_test.o + $(F77) $(USER_FFLAGS) -o pfcoll_test pfcoll_test.o $(OUR_LIBS) + +#testing: +# -./runtests $(TESTARGS) + +cleanall: + -@rm -f .P* PI* misc.c large_file.c fcoll_test.f fmisc.f fperf.f \ + mpif.h $(CTESTS) $(FTESTS) *.out runtests pfcoll_test.f diff --git a/src/libs/ck-libs/ampi/romio/test/Mfile.in b/src/libs/ck-libs/ampi/romio/test/Mfile.in new file mode 100644 index 0000000000..c2e1c29825 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test/Mfile.in @@ -0,0 +1,84 @@ +ALL: default + +# This is a special Makefile.in source for use by the test suite (see the +# configure in examples/test) +##### User configurable options ##### + +MPIR_HOME = @MPIR_HOME@ +CC = @MPICC@ +CLINKER = @MPICC@ +CCC = @MPICPLUSPLUS@ +CCLINKER = $(CCC) +F77 = @MPIF77@ +F90BASE = @MPIF90BASE@ +F90 = @MPIF90@ +FLINKER = @MPIF77@ +OPTFLAGS = @OPTFLAGS@ +MPIFDEP = @MPIFDEP@ +### End User configurable options ### + +SHELL = /bin/sh +prefix = @prefix@ +top_srcdir = @top_srcdir@ +srcdir = @srcdir@ +@VPATH@ + +PROFLIB = +CFLAGS = @CFLAGS@ @DEFS@ $(OPTFLAGS) +CCFLAGS = $(CFLAGS) +FFLAGS = $(OPTFLAGS) @FFLAGS@ +# Use LIBS to add any special libraries for C programs +LIBS = @LIB_PATH@ @LIB_LIST@ +# Use FLIBS to add any special libraries for Fortran programs +FLIBS = @FLIB_PATH@ @LIB_LIST@ @F77EXTRALIBS@ +EXECS = $(CTESTS) $(FTESTS) +OTHEREXECS = +CTESTS = simple perf async coll_test coll_perf misc file_info excl \ + large_array \ + atomicity noncontig i_noncontig noncontig_coll split_coll shared_fp \ + large_file psimple error status noncontig_coll2 +FTESTS = fcoll_test fperf fmisc pfcoll_test + +default: $(EXECS) + +# +# Note that runtests builds the executables as required +testing: + -./runtests $(TESTARGS) + +all: testing + +fortran_tests: $(FTESTS) +# +# The Fortran tests must be built with the Fortran linker +fperf: fperf.f + $(F77) $(USER_FFLAGS) -o $@ $< $(FLIBS) + +# Some of the Fortran tests must be derived, so their code will be in the +# LOCAL directory +fcoll_test: fcoll_test.f + $(F77) $(USER_FFLAGS) -o fcoll_test fcoll_test.f $(FLIBS) + +fmisc: fmisc.f + $(F77) $(USER_FFLAGS) -o fmisc fmisc.f $(FLIBS) + +pfcoll_test: pfcoll_test.f + $(F77) $(USER_FFLAGS) -o pfcoll_test pfcoll_test.f $(FLIBS) + +# +# Make sure that we remove executables for specific architectures +clean: + @-rm -f *.o *~ PI* $(EXECS) *.out core pt2pt.diff $(OTHEREXECS) \ + *.trace rdb.* startup.* mpif.h ${srcdir}/*.o *.stdo + @-rm -f work.pc work.pcl + @-for file in $(EXECS) Makefile ; do \ + rm -f $$file.sun4 $$file.alpha $$file.IRIX $$file.freebsd ;\ + done +.c: + $(CC) $(CFLAGS) -o $* $< $(LIBS) +.c.o: + $(CC) $(CFLAGS) -c $< +.o: + ${CLINKER} $(OPTFLAGS) -o $* $*.o $(LIBS) +.f.o: + $(F77) $(FFLAGS) -c $< diff --git a/src/libs/ck-libs/ampi/romio/test/README b/src/libs/ck-libs/ampi/romio/test/README index 41ba6064a2..dbab8e393d 100644 --- a/src/libs/ck-libs/ampi/romio/test/README +++ b/src/libs/ck-libs/ampi/romio/test/README @@ -1,9 +1,9 @@ -This directory contains a few example programs. +This directory contains a few example programs. Each program takes the filename as a command-line argument -"-fname filename". +"-fname filename". -If you are using "mpirun" to run an MPI program, you can run the +If you are using "mpirun" to run an MPI program, you can run the program "simple" with two processes as follows: mpirun -np 2 simple -fname test @@ -22,9 +22,9 @@ perf.c: A simple read and write performance test. Each process writes reads it back. For a different access size, change the value of SIZE in the code. The bandwidth is reported for two cases: (1) without including MPI_File_sync and (2) including - MPI_File_sync. - -async.c: This program is the same as simple.c, except that it uses + MPI_File_sync. + +async.c: This program is the same as simple.c, except that it uses asynchronous I/O. coll_test.c: This program tests the use of collective I/O. It writes @@ -42,31 +42,31 @@ coll_perf.c: Measures the I/O bandwidth for writing/reading a 3D misc.c: Tests various miscellaneous MPI-IO functions -atomicity.c: Tests whether atomicity semantics are satisfied for - overlapping accesses in atomic mode. The probability of detecting +atomicity.c: Tests whether atomicity semantics are satisfied for + overlapping accesses in atomic mode. The probability of detecting errors is higher if you run it on 8 or more processes. large_file.c: Tests access to large files. Writes a 4-Gbyte file and reads it back. Run it only on one process and on a file system - on which ROMIO supports large files, i.e., PIOFS, XFS, SFS, and HFS. + on which ROMIO supports large files. large_array.c: Tests writing and reading a 4-Gbyte distributed array using the distributed array datatype constructor. Works only on file systems that support 64-bit file sizes and MPI implementations - that support 64-bit MPI_Aint. + that support 64-bit MPI_Aint. -file_info.c: Tests the setting and retrieval of hints via +file_info.c: Tests the setting and retrieval of hints via MPI_File_set_info and MPI_File_get_info excl.c: Tests MPI_File_open with MPI_MODE_EXCL -noncontig.c: Tests noncontiguous accesses in memory and file using +noncontig.c: Tests noncontiguous accesses in memory and file using independent I/O. Run it on two processes only. noncontig_coll.c: Same as noncontig.c, but uses collective I/O -noncontig_coll2.c: Same as noncontig_coll.c, but exercises the - cb_config_list hint and aggregation handling more. +noncontig_coll2.c: Same as noncontig_coll.c, but exercises the + cb_config_list hint and aggregation handling more. i_noncontig.c: Same as noncontig.c, but uses nonblocking I/O @@ -78,7 +78,7 @@ fperf.f: Fortran version of perf.c fcoll_test.f: Fortran version of coll_test.c -pfcoll_test.f: Same as fcoll_test.f but uses the PMPI versions of +pfcoll_test.f: Same as fcoll_test.f but uses the PMPI versions of all MPI routines fmisc.f: Fortran version of misc.c diff --git a/src/libs/ck-libs/ampi/romio/test/aggregation1.c b/src/libs/ck-libs/ampi/romio/test/aggregation1.c new file mode 100644 index 0000000000..3b3e8bef23 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test/aggregation1.c @@ -0,0 +1,260 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2007 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +/* Test case from John Bent (ROMIO req #835) + * Aggregation code was not handling certain access patterns when collective + * buffering forced */ +#include +#include +#include +#include +#include + +#define NUM_OBJS 4 +#define OBJ_SIZE 1048576 + +extern char *optarg; +extern int optind, opterr, optopt; + + +char *prog = NULL; +int debug = 0; + +static void +Usage( int line ) { + int rank; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + if ( rank == 0 ) { + fprintf( stderr, + "Usage (line %d): %s [-d] [-h] -f filename\n" + "\t-d for debugging\n" + "\t-h to turn on the hints to force collective aggregation\n", + line, prog ); + } + exit( 0 ); +} + +static void +fatal_error( int mpi_ret, MPI_Status *mpi_stat, char *msg ) { + fprintf( stderr, "Fatal error %s: %d\n", msg, mpi_ret ); + MPI_Abort( MPI_COMM_WORLD, -1 ); +} + +static void +print_hints( int rank, MPI_File *mfh ) { + MPI_Info info; + int nkeys; + int i, dummy_int; + char key[1024]; + char value[1024]; + + MPI_Barrier( MPI_COMM_WORLD ); + if ( rank == 0 ) { + MPI_File_get_info( *mfh, &info ); + MPI_Info_get_nkeys( info, &nkeys ); + + printf( "HINTS:\n" ); + for( i = 0; i < nkeys; i++ ) { + MPI_Info_get_nthkey( info, i, key ); + printf( "%35s -> ", key ); + MPI_Info_get( info, key, 1024, value, &dummy_int ); + printf( "%s\n", value ); + } + MPI_Info_free(&info); + } + MPI_Barrier( MPI_COMM_WORLD ); +} + +static void +fill_buffer( char *buffer, int bufsize, int rank, MPI_Offset offset ) { + memset( (void*)buffer, 0, bufsize ); + snprintf( buffer, bufsize, "Hello from %d at %lld\n", rank, offset ); +} + +static MPI_Offset +get_offset( int rank, int num_objs, int obj_size, int which_obj ) { + MPI_Offset offset; + offset = (MPI_Offset)rank * num_objs * obj_size + which_obj * obj_size; + return offset; +} + +static void +write_file( char *target, int rank, MPI_Info *info ) { + MPI_File wfh; + MPI_Status mpi_stat; + int mpi_ret; + int i; + char buffer[OBJ_SIZE]; + + if ( debug ) printf( "%d writing file %s\n", rank, target ); + + if( (mpi_ret = MPI_File_open(MPI_COMM_WORLD, target, + MPI_MODE_WRONLY | MPI_MODE_CREATE, *info, &wfh ) ) + != MPI_SUCCESS ) + { + fatal_error( mpi_ret, NULL, "open for write" ); + } + + for( i = 0; i < NUM_OBJS; i++ ) { + MPI_Offset offset = get_offset( rank, NUM_OBJS, OBJ_SIZE, i ); + fill_buffer( buffer, OBJ_SIZE, rank, offset ); + if ( debug ) printf( "%s", buffer ); + if ( (mpi_ret = MPI_File_write_at_all( wfh, offset, buffer, OBJ_SIZE, + MPI_CHAR, &mpi_stat ) ) != MPI_SUCCESS ) + { + fatal_error( mpi_ret, &mpi_stat, "write" ); + } + } + + if ( debug ) print_hints( rank, &wfh ); + + if( (mpi_ret = MPI_File_close( &wfh ) ) != MPI_SUCCESS ) { + fatal_error( mpi_ret, NULL, "close for write" ); + } + if ( debug ) printf( "%d wrote file %s\n", rank, target ); +} + +static int +reduce_corruptions( int corrupt_blocks ) { + int mpi_ret; + int sum; + if ( ( mpi_ret = MPI_Reduce( &corrupt_blocks, &sum, 1, + MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD ) ) != MPI_SUCCESS ) + { + fatal_error( mpi_ret, NULL, "MPI_Reduce" ); + } + return sum; +} + +static void +read_file( char *target, int rank, MPI_Info *info, int *corrupt_blocks ) { + MPI_File rfh; + MPI_Status mpi_stat; + int mpi_ret; + int i; + char buffer[OBJ_SIZE]; + char *verify_buf = NULL; + verify_buf = (char *)malloc(OBJ_SIZE); + + if ( debug ) printf( "%d reading file %s\n", rank, target ); + + if( (mpi_ret = MPI_File_open(MPI_COMM_WORLD, target, + MPI_MODE_RDONLY, *info, &rfh ) ) != MPI_SUCCESS ) + { + fatal_error( mpi_ret, NULL, "open for read" ); + } + + for( i = 0; i < NUM_OBJS; i++ ) { + MPI_Offset offset = get_offset( rank, NUM_OBJS, OBJ_SIZE, i ); + fill_buffer( verify_buf, OBJ_SIZE, rank, offset ); + if ( debug ) printf( "Expecting %s", buffer ); + if ( (mpi_ret = MPI_File_read_at_all( rfh, offset, buffer, OBJ_SIZE, + MPI_CHAR, &mpi_stat ) ) != MPI_SUCCESS ) + { + fatal_error( mpi_ret, &mpi_stat, "read" ); + } + if ( memcmp( verify_buf, buffer, OBJ_SIZE ) != 0 ) { + (*corrupt_blocks)++; + printf( "Corruption at %lld\n", offset ); + if ( debug ) { + printf( "\tExpecting %s\n" + "\tRecieved %s\n", + verify_buf, buffer ); + } + } + } + + if( (mpi_ret = MPI_File_close( &rfh ) ) != MPI_SUCCESS ) { + fatal_error( mpi_ret, NULL, "close for read" ); + } + free(verify_buf); + +} + +static void +set_hints( MPI_Info *info ) { + MPI_Info_set( *info, "romio_cb_write", "enable" ); + MPI_Info_set( *info, "romio_no_indep_rw", "1" ); + MPI_Info_set( *info, "cb_nodes", "1" ); + MPI_Info_set( *info, "cb_buffer_size", "4194304" ); +} + +/* +void +set_hints( MPI_Info *info, char *hints ) { + char *delimiter = " "; + char *hints_cp = strdup( hints ); + char *key = strtok( hints_cp, delimiter ); + char *val; + while( key ) { + val = strtok( NULL, delimiter ); + if ( debug ) printf( "HINT: %s = %s\n", key, val ); + if ( ! val ) { + Usage( __LINE__ ); + } + MPI_Info_set( *info, key, val ); + key = strtok( NULL, delimiter ); + } + free( hints_cp ); +} +*/ + +int +main( int argc, char *argv[] ) { + int nproc = 1, rank = 0; + char *target = NULL; + int c; + MPI_Info info; + int mpi_ret; + int corrupt_blocks = 0; + + MPI_Init( &argc, &argv ); + MPI_Comm_size(MPI_COMM_WORLD, &nproc); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + if( (mpi_ret = MPI_Info_create(&info)) != MPI_SUCCESS) { + if(rank == 0) fatal_error( mpi_ret, NULL, "MPI_info_create.\n"); + } + + prog = strdup( argv[0] ); + + while( ( c = getopt( argc, argv, "df:h" ) ) != EOF ) { + switch( c ) { + case 'd': + debug = 1; + break; + case 'f': + target = strdup( optarg ); + break; + case 'h': + set_hints( &info ); + break; + default: + Usage( __LINE__ ); + } + } + if ( ! target ) { + Usage( __LINE__ ); + } + + write_file( target, rank, &info ); + read_file( target, rank, &info, &corrupt_blocks ); + + corrupt_blocks = reduce_corruptions( corrupt_blocks ); + if ( rank == 0 ) { + if (corrupt_blocks == 0) { + fprintf(stdout, " No Errors\n"); + } else { + fprintf(stdout, "%d/%d blocks corrupt\n", + corrupt_blocks, nproc * NUM_OBJS ); + } + } + MPI_Info_free(&info); + + MPI_Finalize(); + free(prog); + exit( 0 ); +} diff --git a/src/libs/ck-libs/ampi/romio/test/aggregation2.c b/src/libs/ck-libs/ampi/romio/test/aggregation2.c new file mode 100644 index 0000000000..3c57c1d206 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test/aggregation2.c @@ -0,0 +1,89 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2007 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +/* Look for regressions in aggregator code. A more simple access pattern than + * aggregation1 */ + +#include + +#include +#include +#include + +#include +#include + +#include + +#define BUFSIZE 512 + +static void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +int main(int argc, char ** argv) +{ + MPI_Info info = MPI_INFO_NULL; + MPI_File fh; + MPI_Offset off=0; + MPI_Status status; + int errcode; + int i, rank, errs=0, toterrs, buffer[BUFSIZE], buf2[BUFSIZE]; + + MPI_Init(&argc, &argv); + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + MPI_Info_create(&info); + MPI_Info_set(info, "romio_cb_write", "enable"); + MPI_Info_set(info, "cb_nodes", "1"); + + for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } + MPI_Info_free(&info); + MPI_Finalize(); + + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/test/async-multiple.c b/src/libs/ck-libs/ampi/romio/test/async-multiple.c new file mode 100644 index 0000000000..6d4ee63f7b --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test/async-multiple.c @@ -0,0 +1,139 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- + * vim: ts=8 sts=4 sw=4 noexpandtab + * + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include +#include +#include + +#define SIZE (65536) +#define NR_NBOPS (32) + +/* Uses asynchronous I/O. Each process writes to separate files and + reads them back. The file name is taken as a command-line argument, + and the process rank is appended to it.*/ + +void handle_error(int errcode, char *str); + +void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} +int main(int argc, char **argv) +{ + int *buf, i, rank, nints, len; + char *filename, *tmp; + int errs=0, toterrs; + MPI_File fh; + MPI_Status status[NR_NBOPS]; + MPI_Request request[NR_NBOPS]; + int errcode = 0; + + MPI_Init(&argc,&argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: async -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len+10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len+10); + MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + + buf = (int *) malloc(SIZE); + nints = SIZE/sizeof(int); + for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } + + free(buf); + free(filename); + free(tmp); + + MPI_Finalize(); + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/test/async.c b/src/libs/ck-libs/ampi/romio/test/async.c index 386db3a189..fc26ea7b0e 100644 --- a/src/libs/ck-libs/ampi/romio/test/async.c +++ b/src/libs/ck-libs/ampi/romio/test/async.c @@ -1,6 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include @@ -9,20 +12,32 @@ /* Uses asynchronous I/O. Each process writes to separate files and reads them back. The file name is taken as a command-line argument, - and the process rank is appended to it.*/ + and the process rank is appended to it.*/ +void handle_error(int errcode, char *str); + +void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} int main(int argc, char **argv) { int *buf, i, rank, nints, len; char *filename, *tmp; + int errs=0, toterrs; MPI_File fh; MPI_Status status; MPIO_Request request; + int errcode = 0; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!rank) { i = 1; @@ -57,34 +72,67 @@ int main(int argc, char **argv) strcpy(tmp, filename); sprintf(filename, "%s.%d", tmp, rank); - MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); + errcode = MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL); - MPI_File_iwrite(fh, buf, nints, MPI_INT, &request); + errcode = MPI_File_iwrite(fh, buf, nints, MPI_INT, &request); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_iwrite"); + } +#ifdef MPIO_USES_MPI_REQUEST + MPI_Wait( &request, &status ); +#else MPIO_Wait(&request, &status); +#endif MPI_File_close(&fh); /* reopen the file and read the data back */ for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } free(buf); free(filename); free(tmp); MPI_Finalize(); - return 0; + return 0; } diff --git a/src/libs/ck-libs/ampi/romio/test/atomicity.c b/src/libs/ck-libs/ampi/romio/test/atomicity.c index 2ed479a5a7..31e8d4228c 100644 --- a/src/libs/ck-libs/ampi/romio/test/atomicity.c +++ b/src/libs/ck-libs/ampi/romio/test/atomicity.c @@ -1,22 +1,26 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include /* tests whether atomicity semantics are satisfied for overlapping accesses - in atomic mode. The probability of detecting errors is higher if you run + in atomic mode. The probability of detecting errors is higher if you run it on 8 or more processes. */ /* The file name is taken as a command-line argument. */ #define BUFSIZE 10000 /* no. of integers */ - +#define VERBOSE 0 int main(int argc, char **argv) { int *writebuf, *readbuf, i, mynod, nprocs, len, err; char *filename; + int errs=0, toterrs; MPI_Datatype newtype; MPI_File fh; MPI_Status status; @@ -26,7 +30,7 @@ int main(int argc, char **argv) MPI_Comm_rank(MPI_COMM_WORLD, &mynod); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -59,19 +63,21 @@ int main(int argc, char **argv) /* initialize file to all zeros */ if (!mynod) { MPI_File_delete(filename, MPI_INFO_NULL); - MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | + MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } MPI_Type_free(&newtype); MPI_Info_free(&info); free(writebuf); diff --git a/src/libs/ck-libs/ampi/romio/test/big_extents.c b/src/libs/ck-libs/ampi/romio/test/big_extents.c new file mode 100644 index 0000000000..92f0df09f4 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test/big_extents.c @@ -0,0 +1,211 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2007 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +/* a test to exercise very large extents: on most platforms with 32 bit + * integers, we'd expect these tests to give unexpected values. On platforms + * with 64 bit integers, these tests will be fine. On BlueGene we're not sure + * yet :> + */ + + +#include +#include +#include +#include + +#define CHECK(fn) {int errcode; errcode = (fn); if (errcode != MPI_SUCCESS) handle_error(errcode, NULL); } + + +static void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +static void typestats(MPI_Datatype type) +{ + MPI_Aint lb, extent; + int size; + + MPI_Type_get_extent(type, &lb, &extent); + MPI_Type_size(type, &size); + + printf("dtype %d: lb = %ld extent = %ld size = %d...", + type, (long)lb, (long)extent, size); + +} + +static int verify_type(char *filename, MPI_Datatype type, + int64_t expected_extent, int do_coll) +{ + int rank, canary, tsize; + int compare=-1; + int errs=0, toterrs=0; + MPI_Status status; + MPI_File fh; + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + CHECK( MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE|MPI_MODE_RDWR, MPI_INFO_NULL, &fh)); + CHECK( MPI_File_set_view(fh, rank*sizeof(int), + MPI_BYTE, type, "native", MPI_INFO_NULL)); + + MPI_Type_size(type, &tsize); + + canary=rank+1000000; + + /* skip over first instance of type */ + if (do_coll) { + CHECK( MPI_File_write_at_all(fh, tsize, &canary, 1, MPI_INT, &status)); + } else { + CHECK( MPI_File_write_at(fh, tsize, &canary, 1, MPI_INT, &status)); + } + + CHECK( MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", + MPI_INFO_NULL)); + + if (do_coll) { + CHECK( MPI_File_read_at_all(fh, expected_extent/sizeof(int)+rank, + &compare, 1, MPI_INT, &status)); + } else { + CHECK( MPI_File_read_at(fh, expected_extent/sizeof(int)+rank, + &compare, 1, MPI_INT, &status)); + } + + if (compare != canary) + errs=1; + MPI_Allreduce(&errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + + MPI_File_close(&fh); + + if (toterrs) { + printf("%d: got %d expected %d\n", rank, compare, canary); + /* keep file if there's an error */ + } else { + if (rank == 0) MPI_File_delete(filename, MPI_INFO_NULL); + } + + return (toterrs); + +} + +static int testtype(char *filename, MPI_Datatype type, int64_t expected_extent) +{ + int rank, ret, errs=0; + int collective=1, nocollective=0; + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + if (!rank) typestats(type); + + ret = verify_type(filename, type, expected_extent, nocollective); + if (ret) { + errs++; + fprintf(stderr, "type %d failed indep\n", type); + } else + if (!rank) printf("indep: OK "); + + ret = verify_type(filename, type, expected_extent, collective); + if (ret) { + errs++; + fprintf(stderr, "type %d failed collective\n", type); + } else + if (!rank) printf("coll: OK\n"); + + return errs; +} + +int main(int argc, char **argv) +{ + int count=2; + int blocks[2]; + int disps[2]; + + int ndims=2; + int sizes[2]; + int subs[2]; + int starts[2]; + + MPI_Datatype baseindex, indexed1G, indexed3G, indexed6G; + MPI_Datatype subarray1G, subarray3G, subarray6G; + int ret, rank; + + MPI_Init(&argc, &argv); + + if (argc != 2) { + fprintf(stderr, "usage: %s \n", argv[0]); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + /* base type: 1MB indexed type of ints*/ + count = 2; + blocks[0] = 1; + disps[0] = 0; + blocks[1] = 1; + disps[1] = 1024*256-1; + + MPI_Type_indexed(count, blocks, disps, MPI_INT, &baseindex); + /* simple case: 1GB extent */ + MPI_Type_contiguous(1024, baseindex, &indexed1G); + MPI_Type_commit(&indexed1G); + + /* a little trickier: 3Gb extent */ + MPI_Type_contiguous(3072, baseindex, &indexed3G); + MPI_Type_commit(&indexed3G); + + /* and finally 6GB extent */ + MPI_Type_contiguous(6144, baseindex, &indexed6G); + MPI_Type_commit(&indexed6G); + + /* TODO: + * - add a darray test + * - add a test with crazy extents */ + sizes[0] = 1024*16; + sizes[1] = 1024*16; + subs[0] = subs[1] = 256; + starts[0] = starts[1] = 0; + + MPI_Type_create_subarray(ndims, sizes, subs, starts, + MPI_ORDER_C, MPI_INT, &subarray1G); + MPI_Type_commit(&subarray1G); + + sizes[1] = 1024*16*3; + MPI_Type_create_subarray(ndims, sizes, subs, starts, + MPI_ORDER_C, MPI_INT, &subarray3G); + MPI_Type_commit(&subarray3G); + + sizes[1] = 1024*16*6; + MPI_Type_create_subarray(ndims, sizes, subs, starts, + MPI_ORDER_C, MPI_INT, &subarray6G); + MPI_Type_commit(&subarray6G); + + /* assume command line arguments make it out to all processes */ + ret = testtype(argv[1], indexed1G, (int64_t)1024*1024*1024); + + ret = testtype(argv[1], indexed3G, (int64_t)1024*1024*1024*3); + + ret = testtype(argv[1], indexed6G, (int64_t)1024*1024*1024*6); + + ret = testtype(argv[1], subarray1G, (int64_t)1024*1024*1024); + + ret = testtype(argv[1], subarray3G, (int64_t)1024*1024*1024*3); + + ret = testtype(argv[1], subarray6G, (int64_t)1024*1024*1024*6); + + if(!ret && !rank) fprintf(stderr, " No Errors\n"); + + MPI_Finalize(); + return (-ret); + +} +/* + * vim: ts=8 sts=4 sw=4 noexpandtab + */ diff --git a/src/libs/ck-libs/ampi/romio/test/coll_perf.c b/src/libs/ck-libs/ampi/romio/test/coll_perf.c index 4ebe213a16..2d978d4aae 100644 --- a/src/libs/ck-libs/ampi/romio/test/coll_perf.c +++ b/src/libs/ck-libs/ampi/romio/test/coll_perf.c @@ -1,6 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include @@ -11,7 +14,7 @@ block-distributed array to a file corresponding to the global array in row-major (C) order. Note that the file access pattern is noncontiguous. - + Array size 128^3. For other array sizes, change array_of_gsizes below.*/ @@ -31,7 +34,7 @@ int main(int argc, char **argv) MPI_Comm_rank(MPI_COMM_WORLD, &mynod); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -87,7 +90,7 @@ int main(int argc, char **argv) /* to eliminate paging effects, do the operations once but don't time them */ - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, + MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); MPI_File_write_all(fh, buf, bufcount, MPI_INT, &status); @@ -98,7 +101,7 @@ int main(int argc, char **argv) MPI_Barrier(MPI_COMM_WORLD); /* now time write_all */ - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, + MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); @@ -120,8 +123,8 @@ int main(int argc, char **argv) MPI_Barrier(MPI_COMM_WORLD); /* now time read_all */ - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); + MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, + MPI_INFO_NULL, &fh); MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); MPI_Barrier(MPI_COMM_WORLD); diff --git a/src/libs/ck-libs/ampi/romio/test/coll_test.c b/src/libs/ck-libs/ampi/romio/test/coll_test.c index 40e9b60bd8..d9a96d7b97 100644 --- a/src/libs/ck-libs/ampi/romio/test/coll_test.c +++ b/src/libs/ck-libs/ampi/romio/test/coll_test.c @@ -1,6 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include @@ -14,6 +17,17 @@ /* The file name is taken as a command-line argument. */ /* Note that the file access pattern is noncontiguous. */ + +void handle_error(int errcode, char *str); + +void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} int main(int argc, char **argv) { @@ -23,15 +37,18 @@ int main(int argc, char **argv) int array_of_dargs[3], array_of_psizes[3]; int *readbuf, *writebuf, bufcount, mynod, *tmpbuf, array_size; char *filename; + int errs=0, toterrs; MPI_File fh; MPI_Status status; MPI_Request request; + MPI_Info info = MPI_INFO_NULL; + int errcode; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &mynod); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -76,7 +93,7 @@ int main(int argc, char **argv) for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } MPI_Type_free(&newtype); free(readbuf); diff --git a/src/libs/ck-libs/ampi/romio/test/creat_excl.c b/src/libs/ck-libs/ampi/romio/test/creat_excl.c new file mode 100644 index 0000000000..21b7c5ef02 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test/creat_excl.c @@ -0,0 +1,134 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include +#include +#include +/* + * the new defered open code made some changes to the way we manage CREAT|EXCL, + * so test out that code path */ + +struct options { + char *fname; + int verbose; + int do_aggregation; +}; +typedef struct options options; + + +void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +void parse_args(int argc, char ** argv, int rank, options *opts) +{ + int i, len=0; + if (rank == 0) { + i = 1; + while (i < argc) { + if (strcmp("-fname", argv[i]) == 0) { + len = strlen(argv[i+1]); + opts->fname = (char *) malloc(len + 1); + strcpy(opts->fname, argv[i+1]); + i+=2;/* option and argument */ + continue; + } + if (strcmp("-aggregate", argv[i]) == 0) { + opts->do_aggregation = 1; + i++; + continue; + } + if (strcmp("-verbose", argv[i]) == 0) { + opts->verbose = 1; + i++; + continue; + } + } + if (opts->fname == NULL) { /* didn't get a filename */ + fprintf(stderr, "Usage: %s -fname filename [-aggregate] [-verbose]\n", argv[0]); + MPI_Abort(MPI_COMM_WORLD, 1); + } + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(opts->fname, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); + MPI_Bcast(&(opts->do_aggregation), 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&(opts->verbose), 1, MPI_INT, 0, MPI_COMM_WORLD); + } else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + opts->fname = (char *) malloc(len + 1); + MPI_Bcast(opts->fname, len+1, MPI_CHAR, 0, MPI_COMM_WORLD); + MPI_Bcast(&(opts->do_aggregation), 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&(opts->verbose), 1, MPI_INT, 0, MPI_COMM_WORLD); + } + +} + +int main(int argc, char ** argv) { + int nprocs, mynod, errcode; + options my_options = {NULL, 0, 0}; + MPI_File fh; + MPI_Status status; + MPI_Info info; + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + + parse_args(argc, argv, mynod, &my_options); + + if (my_options.do_aggregation) { + MPI_Info_create(&info); + MPI_Info_set(info, "romio_no_indep_rw", "true"); + MPI_Info_set(info, "cb_config_list", "leela.mcs.anl.gov:1"); + } else { + info = MPI_INFO_NULL; + } + + /* create the file w/o EXCL: this must not fail */ + errcode = MPI_File_open(MPI_COMM_WORLD, my_options.fname, + MPI_MODE_CREATE|MPI_MODE_RDWR, info, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_close"); + } + + /* now try to open w/ CREAT|EXCL: this must fail */ + errcode = MPI_File_open(MPI_COMM_WORLD, my_options.fname, + MPI_MODE_CREATE|MPI_MODE_EXCL|MPI_MODE_RDWR, info, &fh); + if (errcode == MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open: expected an error: got"); + } + + /* ignore the error: File_delete is not aggregator-aware */ + MPI_File_delete(my_options.fname, info); + + /* this must succeed: the file no longer exists */ + errcode = MPI_File_open(MPI_COMM_WORLD, my_options.fname, + MPI_MODE_CREATE|MPI_MODE_EXCL|MPI_MODE_RDWR, info, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } + + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_close"); + } + + if (mynod == 0) { + printf(" No Errors\n"); + } + + MPI_Finalize(); + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/test/error.c b/src/libs/ck-libs/ampi/romio/test/error.c index 6cf8fea9cc..80214799d1 100644 --- a/src/libs/ck-libs/ampi/romio/test/error.c +++ b/src/libs/ck-libs/ampi/romio/test/error.c @@ -1,15 +1,20 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include +#define VERBOSE 0 /* tests if error message is printed correctly */ int main(int argc, char **argv) { int i, rank, len, err; + int errs = 0; char *filename, *tmp; MPI_File fh; char string[MPI_MAX_ERROR_STRING]; @@ -17,12 +22,14 @@ int main(int argc, char **argv) MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); +#if VERBOSE if (!rank) { fprintf(stderr, "Tests if errors are reported correctly...\n"); fprintf(stderr, "Should say \"Invalid displacement argument\"\n\n"); } +#endif -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!rank) { i = 1; @@ -46,7 +53,7 @@ int main(int argc, char **argv) filename = (char *) malloc(len+10); MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); } - + /* each process opens a separate file called filename.'myrank' */ tmp = (char *) malloc(len+10); strcpy(tmp, filename); @@ -54,19 +61,46 @@ int main(int argc, char **argv) err = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE+MPI_MODE_RDWR, MPI_INFO_NULL, &fh); - err = MPI_File_set_view(fh, -1, MPI_BYTE, MPI_BYTE, "native", + err = MPI_File_set_view(fh, -1, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL); /* disp is deliberately passed as -1 */ + /* This test is designed for ROMIO specifically and tests for a + specific error message */ if (err != MPI_SUCCESS) { MPI_Error_string(err, string, &len); - if (!rank) fprintf(stderr, "%s\n", string); + if (!rank) { +#if VERBOSE + fprintf(stderr, "%s\n", string); +#else + /* check for the word "displacement" in the message. + This allows other formatting of the message */ + if (strstr( string, "displacement" ) == 0) { + fprintf( stderr, "Unexpected error message %s\n", string ); + errs++; + } +#endif + } + } + else { + errs++; + fprintf( stderr, "File set view did not return an error\n" ); } MPI_File_close(&fh); free(filename); free(tmp); + + if (!rank) { + if (errs == 0) { + printf( " No Errors\n" ); + } + else { + printf( " Found %d errors\n", errs ); + } + } + MPI_Finalize(); - return 0; + return 0; } diff --git a/src/libs/ck-libs/ampi/romio/test/excl.c b/src/libs/ck-libs/ampi/romio/test/excl.c index bb169c19c9..89cd064633 100644 --- a/src/libs/ck-libs/ampi/romio/test/excl.c +++ b/src/libs/ck-libs/ampi/romio/test/excl.c @@ -1,6 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include @@ -11,12 +14,13 @@ int main(int argc, char **argv) { MPI_File fh; int rank, len, err, i; + int errs=0, toterrs; char *filename; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!rank) { i = 1; @@ -40,29 +44,41 @@ int main(int argc, char **argv) filename = (char *) malloc(len+10); MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); } - + if (!rank) MPI_File_delete(filename, MPI_INFO_NULL); MPI_Barrier(MPI_COMM_WORLD); /* this open should succeed */ - err = MPI_File_open(MPI_COMM_WORLD, filename, + err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_EXCL | MPI_MODE_RDWR, MPI_INFO_NULL , &fh); - if (err != MPI_SUCCESS) + if (err != MPI_SUCCESS) { + errs++; fprintf(stderr, "Process %d: open failed when it should have succeeded\n", rank); + } else MPI_File_close(&fh); MPI_Barrier(MPI_COMM_WORLD); /* this open should fail */ - err = MPI_File_open(MPI_COMM_WORLD, filename, + err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_EXCL | MPI_MODE_RDWR, MPI_INFO_NULL , &fh); - if (err == MPI_SUCCESS) + if (err == MPI_SUCCESS) { + errs++; fprintf(stderr, "Process %d: open succeeded when it should have failed\n", rank); + } - if (!rank) fprintf(stderr, "Done\n"); + MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); + if (rank == 0) { + if( toterrs > 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } free(filename); MPI_Finalize(); - return 0; + return 0; } diff --git a/src/libs/ck-libs/ampi/romio/test/fcoll_test.f.in b/src/libs/ck-libs/ampi/romio/test/fcoll_test.f.in index 4ab8980826..9c2b172218 100644 --- a/src/libs/ck-libs/ampi/romio/test/fcoll_test.f.in +++ b/src/libs/ck-libs/ampi/romio/test/fcoll_test.f.in @@ -1,12 +1,17 @@ - subroutine mpi_main +! -*- Mode: Fortran; -*- +! +! (C) 2001 by Argonne National Laboratory. +! See COPYRIGHT in top-level directory. +! + program main implicit none include 'mpif.h' - include 'mpiof.h' + @F77MPIOINC@ ! Fortran equivalent of coll_test.c - integer FILESIZE + integer FILESIZE parameter (FILESIZE=32*32*32*4) ! A 32^3 array. For other array sizes, change FILESIZE above and @@ -17,7 +22,7 @@ ! back, and checks that the data read is correct. ! Note that the file access pattern is noncontiguous. - + integer newtype, i, ndims, array_of_gsizes(3) integer order, intsize, nprocs, j, array_of_distribs(3) integer array_of_dargs(3), array_of_psizes(3) @@ -25,43 +30,45 @@ integer mynod, tmpbuf(FILESIZE), array_size, argc, iargc integer fh, status(MPI_STATUS_SIZE), request, ierr character*1024 str ! used to store the filename + integer errs, toterrs @FORTRAN_MPI_OFFSET@ disp @FTESTDEFINE@ + errs = 0 call MPI_INIT(ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, nprocs, ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, mynod, ierr) -! process 0 takes the file name as a command-line argument and +! process 0 takes the file name as a command-line argument and ! broadcasts it to other processes if (mynod .eq. 0) then - call AMPI_Command_argument_count(argc) + argc = @F77IARGC@ i = 0 - call AMPI_Get_command_argument(i, str, 1024, ierr) + @F77GETARG@ do while ((i .lt. argc) .and. (str .ne. '-fname')) i = i + 1 - call AMPI_Get_command_argument(i, str, 1024, ierr) + @F77GETARG@ end do if (i .ge. argc) then - print * + print * print *, '*# Usage: fcoll_test -fname filename' print * call MPI_ABORT(MPI_COMM_WORLD, 1, ierr) end if i = i + 1 - call AMPI_Get_command_argument(i, str, 1024, ierr) + @F77GETARG@ call MPI_BCAST(str, 1024, MPI_CHARACTER, 0, & & MPI_COMM_WORLD, ierr) - else + else call MPI_BCAST(str, 1024, MPI_CHARACTER, 0, & & MPI_COMM_WORLD, ierr) end if ! create the distributed array filetype - + ndims = 3 order = MPI_ORDER_FORTRAN @@ -89,12 +96,12 @@ call MPI_TYPE_COMMIT(newtype, ierr) -! initialize writebuf +! initialize writebuf call MPI_TYPE_SIZE(newtype, bufcount, ierr) call MPI_TYPE_SIZE(MPI_INTEGER, intsize, ierr) bufcount = bufcount/intsize - do i=1, bufcount + do i=1, bufcount writebuf(i) = 1 end do @@ -108,7 +115,7 @@ & MPI_COMM_WORLD, ierr) call MPI_WAIT(request, status, ierr) - j = 0 + j = 1 array_size = array_of_gsizes(1) * array_of_gsizes(2) * & & array_of_gsizes(3) do i=1, array_size @@ -125,7 +132,7 @@ call MPI_FILE_OPEN(MPI_COMM_WORLD, str, & & MPI_MODE_CREATE+MPI_MODE_RDWR, MPI_INFO_NULL, fh, ierr) - disp = 0 + disp = 0 call MPI_FILE_SET_VIEW(fh, disp, MPI_INTEGER, newtype, "native", & & MPI_INFO_NULL, ierr) call MPI_FILE_WRITE_ALL(fh, writebuf, bufcount, MPI_INTEGER, & @@ -136,7 +143,7 @@ call MPI_FILE_OPEN(MPI_COMM_WORLD, str, & & MPI_MODE_CREATE+MPI_MODE_RDWR, MPI_INFO_NULL, fh, ierr) - + call MPI_FILE_SET_VIEW(fh, disp, MPI_INTEGER, newtype, "native", & & MPI_INFO_NULL, ierr) call MPI_FILE_READ_ALL(fh, readbuf, bufcount, MPI_INTEGER, & @@ -146,17 +153,24 @@ ! check the data read do i=1, bufcount if (readbuf(i) .ne. writebuf(i)) then + errs = errs + 1 print *, 'Node ', mynod, ' readbuf ', readbuf(i), & & ' writebuf ', writebuf(i), ' i', i end if end do call MPI_TYPE_FREE(newtype, ierr) + call MPI_Allreduce( errs, toterrs, 1, MPI_INTEGER, MPI_SUM, & + $ MPI_COMM_WORLD, ierr ) if (mynod .eq. 0) then - print *, ' Done' - end if + if( toterrs .gt. 0 ) then + print *, 'Found ', toterrs, ' errors' + else + print *, ' No Errors' + endif + endif call MPI_FINALIZE(ierr) stop - end subroutine + end diff --git a/src/libs/ck-libs/ampi/romio/test/file_info.c b/src/libs/ck-libs/ampi/romio/test/file_info.c index ea04ab915c..8b9862beca 100644 --- a/src/libs/ck-libs/ampi/romio/test/file_info.c +++ b/src/libs/ck-libs/ampi/romio/test/file_info.c @@ -1,10 +1,33 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +/* Change for BG/L made by Hao Yu, yuh@us.ibm.com + */ + #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include +/* this test wants to compare the hints it gets from a file with a set of + * default hints. These hints are specific to the MPI-IO implementation, so + * pick one of the following profiles to use */ + +# define DFLT_CB_BUFFER_SIZE 16777216 +# define DFLT_IND_RD_BUFFER_SIZE 4194304 +# define DFLT_IND_WR_BUFFER_SIZE 524288 +# define DFLT_ROMIO_CB_READ "automatic" +# define DFLT_ROMIO_CB_WRITE "automatic" +/* #undef INFO_DEBUG */ + +/* Test will print out information about unexpected hint keys or values that + * differ from the default. Since this is often interesting but rarely an + * error, default will be to increment errror cound for true error conditions + * but not print out these "interesting" non-error cases. */ + int main(int argc, char **argv) { @@ -19,7 +42,7 @@ int main(int argc, char **argv) MPI_Comm_rank(MPI_COMM_WORLD, &mynod); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -48,7 +71,7 @@ int main(int argc, char **argv) } /* open the file with MPI_INFO_NULL */ - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, + MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); /* check the default values set by ROMIO */ @@ -58,9 +81,9 @@ int main(int argc, char **argv) for (i=0; i 0) { sprintf(value, "%d", default_striping_factor-1); @@ -195,22 +218,24 @@ int main(int argc, char **argv) /* the striping unit in bytes */ MPI_Info_set(info, "striping_unit", "131072"); +#ifndef SKIP_CB_CONFIG_LIST_TEST /* set the cb_config_list so we'll get deterministic cb_nodes output */ MPI_Info_set(info, "cb_config_list", "*:*"); +#endif /* the I/O device number from which to start striping the file. - accepted only if 0 <= value < default_striping_factor; + accepted only if 0 <= value < default_striping_factor; ignored otherwise */ sprintf(value, "%d", default_striping_factor-2); MPI_Info_set(info, "start_iodevice", value); -/* The following hint about PFS server buffering is accepted only on - Intel PFS. It can be specified anytime. */ +/* The following hint about PFS server buffering is accepted only on + Intel PFS. It can be specified anytime. */ MPI_Info_set(info, "pfs_svr_buf", "true"); /* open the file and set new info */ - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, + MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); /* check the values set */ @@ -220,8 +245,8 @@ int main(int argc, char **argv) for (i=0; i +#include +#include +#include + +#define YLEN 5 +#define XLEN 10 +#define SUB_XLEN 3 + +/* rjl: I was just too lazy to compute this at run-time */ +char compare_buf[XLEN*4][YLEN*4] = { + {'0','1','2',0,0,'3','4','5',0,0,'D','E','F',0,0,'G','H','I'}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {'6','7','8',0,0,'9',':',';',0,0,'J','K','L',0,0,'M','N','O'}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {'X','Y','Z',0,0,'[','\\',']',0,0,'l','m','n',0,0,'o','p','q'}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {'^','_','`',0,0,'a','b','c',0,0,'r','s','t',0,0,'u','v','w'}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {'0','1','2',0,0,'3','4','5',0,0,'D','E','F',0,0,'G','H','I'}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {'6','7','8',0,0,'9',':',';',0,0,'J','K','L',0,0,'M','N','O'}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {'X','Y','Z',0,0,'[','\\',']',0,0,'l','m','n',0,0,'o','p','q'}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {'^','_','`',0,0,'a','b','c',0,0,'r','s','t',0,0,'u','v','w'}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} +}; + + +/* set this if you want a dump of the global array +#define VERBOSE 1 +*/ + +/*----< main() >------------------------------------------------------------*/ +int main(int argc, char **argv) { + int i, j, err, rank, np, num_io; + char *buf, *filename; + int rank_dim[2], array_of_sizes[2]; + int array_of_subsizes[2]; + int count, *blocklengths, global_array_size, ftype_size; + MPI_Aint *displacements; + MPI_File fh; + MPI_Datatype ftype; + MPI_Status status; + MPI_Offset offset=0; + int nr_errors=0; +#ifdef VERBOSE + int k; +#endif + + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &np); + + if (np != 4) { + if (!rank) printf("Please run with 4 processes. Exiting ...\n\n"); + MPI_Finalize(); + return 1; + } + + filename = argv[1]; + + num_io = 2; + + /*-----------------------------------------------------------------------*/ + /* process rank in each dimension */ + rank_dim[0] = rank / 2; + rank_dim[1] = rank % 2; + + /* global 2D array size */ + array_of_sizes[0] = YLEN * 2; + array_of_sizes[1] = XLEN * 2; + + global_array_size = array_of_sizes[0] * array_of_sizes[1]; + + array_of_subsizes[0] = YLEN / 2; + array_of_subsizes[1] = XLEN * SUB_XLEN / 5; + + offset = rank_dim[0] * YLEN * array_of_sizes[1] + + rank_dim[1] * XLEN; + + /* define data type for file view */ + count = array_of_subsizes[0] * 2; /* 2 is the no. blocks along X */ + blocklengths = (int*) malloc(count*sizeof(int)); + displacements = (MPI_Aint*)malloc(count*sizeof(MPI_Aint)); + for (i=0; i0 && j%XLEN==0) printf(" "); + if (*ptr != 0) + printf(" %c",*ptr); + else + printf(" "); + ptr++; + } + printf("\n"); + } + printf("\n"); + } +#endif + ptr = rd_buf; + for(i=0; i<2*YLEN*num_io; i++) { + for(j=0; j<2*XLEN; j++) { + if( *ptr != compare_buf[i][j]) { + fprintf(stderr, "expected %d got %d at [%d][%d]\n", + *ptr, compare_buf[i][j], i, j); + nr_errors++; + } + ptr++; + } + } + free(rd_buf); + + if (nr_errors == 0) + fprintf(stdout, " No Errors\n"); + else + fprintf(stderr, "Found %d errors\n", nr_errors); + } + + free(blocklengths); + free(displacements); + free(buf); + MPI_Type_free(&ftype); + MPI_Finalize(); + return 0; +} + +/* command-line outputs are: (the global array is written twice) + +% mpiexec -n 4 wkl_subarray +------------------------------------------------------- + [ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ] + +[ 0] 0 1 2 3 4 5 D E F G H I +[ 1] +[ 2] 6 7 8 9 : ; J K L M N O +[ 3] +[ 4] +[ 5] X Y Z [ \ ] l m n o p q +[ 6] +[ 7] ^ _ ` a b c r s t u v w +[ 8] +[ 9] + +[10] 0 1 2 3 4 5 D E F G H I +[11] +[12] 6 7 8 9 : ; J K L M N O +[13] +[14] +[15] X Y Z [ \ ] l m n o p q +[16] +[17] ^ _ ` a b c r s t u v w +[18] +[19] + +*/ + diff --git a/src/libs/ck-libs/ampi/romio/test/i_noncontig.c b/src/libs/ck-libs/ampi/romio/test/i_noncontig.c index 9d9532dfa4..6f4bfbd8f3 100644 --- a/src/libs/ck-libs/ampi/romio/test/i_noncontig.c +++ b/src/libs/ck-libs/ampi/romio/test/i_noncontig.c @@ -1,6 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include @@ -9,9 +12,12 @@ #define SIZE 5000 +#define VERBOSE 0 + int main(int argc, char **argv) { int *buf, i, mynod, nprocs, len, b[3]; + int errs=0, toterrs; MPI_Aint d[3]; MPI_File fh; MPI_Status status; @@ -28,7 +34,7 @@ int main(int argc, char **argv) MPI_Abort(MPI_COMM_WORLD, 1); } -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -70,39 +76,61 @@ int main(int argc, char **argv) MPI_Type_free(&typevec); if (!mynod) { +#if VERBOSE fprintf(stderr, "\ntesting noncontiguous in memory, noncontiguous in file using nonblocking I/O\n"); +#endif MPI_File_delete(filename, MPI_INFO_NULL); } MPI_Barrier(MPI_COMM_WORLD); - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | + MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL); for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } MPI_Type_free(&newtype); free(buf); free(filename); diff --git a/src/libs/ck-libs/ampi/romio/test/large_array.c b/src/libs/ck-libs/ampi/romio/test/large_array.c index afce4ff006..35001116ef 100644 --- a/src/libs/ck-libs/ampi/romio/test/large_array.c +++ b/src/libs/ck-libs/ampi/romio/test/large_array.c @@ -1,19 +1,22 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include -/* Writes a 4-Gbyte distributed array, reads it back, and then deletes the +/* Writes a 4-Gbyte distributed array, reads it back, and then deletes the file. Uses collective I/O. */ /* The file name is taken as a command-line argument. */ /* Run it only on a machine with sufficient memory and a file system on which ROMIO supports large files, i.e., PIOFS, XFS, SFS, and HFS */ -/* This program will work only if the MPI implementation defines MPI_Aint +/* This program will work only if the MPI implementation defines MPI_Aint as a 64-bit integer. */ - + int main(int argc, char **argv) { MPI_Datatype newtype; @@ -31,7 +34,7 @@ int main(int argc, char **argv) MPI_Comm_rank(MPI_COMM_WORLD, &mynod); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -74,7 +77,7 @@ int main(int argc, char **argv) for (i=0; i #include #include -/* writes a file of size 4 Gbytes and reads it back. +/* writes a file of size 4 Gbytes and reads it back. should be run on one process only*/ /* The file name is taken as a command-line argument. */ -/* Can be used only on file systems on which ROMIO supports large files, +/* Can be used only on file systems on which ROMIO supports large files, i.e., PIOFS, XFS, SFS, and HFS. */ - + #define SIZE 1048576*4 /* no. of long longs in each write/read */ #define NTIMES 128 /* no. of writes/reads */ @@ -59,7 +63,7 @@ int main(int argc, char **argv) for (i=0; i #include #include /* tests various miscellaneous functions. */ +#define VERBOSE 0 + +void handle_error(int errcode, char *str); + +void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); +} int main(int argc, char **argv) { int buf[1024], amode, flag, mynod, len, i; + int errs = 0, toterrs; MPI_File fh; MPI_Status status; MPI_Datatype newtype; @@ -16,11 +32,12 @@ int main(int argc, char **argv) MPI_Group group; MPI_Datatype etype, filetype; char datarep[25], *filename; + int errcode=0; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &mynod); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -46,80 +63,203 @@ int main(int argc, char **argv) } - MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); + errcode = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_open"); + } - MPI_File_write(fh, buf, 1024, MPI_INT, &status); + errcode = MPI_File_write(fh, buf, 1024, MPI_INT, &status); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_write"); + } - MPI_File_sync(fh); + errcode = MPI_File_sync(fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_sync"); + } - MPI_File_get_amode(fh, &amode); + errcode = MPI_File_get_amode(fh, &amode); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_amode"); + } +#if VERBOSE if (!mynod) fprintf(stderr, "testing MPI_File_get_amode\n"); - if (amode != (MPI_MODE_CREATE | MPI_MODE_RDWR)) - fprintf(stderr, "amode is %d, should be %d\n\n", amode, MPI_MODE_CREATE | - MPI_MODE_RDWR); +#endif + if (amode != (MPI_MODE_CREATE | MPI_MODE_RDWR)) { + errs++; + fprintf(stderr, "amode is %d, should be %d\n\n", + amode, MPI_MODE_CREATE | MPI_MODE_RDWR); + } - MPI_File_get_atomicity(fh, &flag); - if (flag) fprintf(stderr, "atomicity is %d, should be 0\n", flag); + errcode = MPI_File_get_atomicity(fh, &flag); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_atomicity"); + } + if (flag) { + errs++; + fprintf(stderr, "atomicity is %d, should be 0\n", flag); + } +#if VERBOSE if (!mynod) fprintf(stderr, "setting atomic mode\n"); - MPI_File_set_atomicity(fh, 1); - MPI_File_get_atomicity(fh, &flag); - if (!flag) fprintf(stderr, "atomicity is %d, should be 1\n", flag); - MPI_File_set_atomicity(fh, 0); +#endif + errcode = MPI_File_set_atomicity(fh, 1); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_atomicity"); + } + errcode = MPI_File_get_atomicity(fh, &flag); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_atomicity"); + } + if (!flag) { + errs++; + fprintf(stderr, "atomicity is %d, should be 1\n", flag); + } + errcode = MPI_File_set_atomicity(fh, 0); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_atomicity"); + } +#if VERBOSE if (!mynod) fprintf(stderr, "reverting back to nonatomic mode\n"); +#endif MPI_Type_vector(10, 10, 20, MPI_INT, &newtype); MPI_Type_commit(&newtype); - MPI_File_set_view(fh, 1000, MPI_INT, newtype, "native", MPI_INFO_NULL); + errcode = MPI_File_set_view(fh, 1000, MPI_INT, newtype, "native", MPI_INFO_NULL); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_view"); + } +#if VERBOSE if (!mynod) fprintf(stderr, "testing MPI_File_get_view\n"); - MPI_File_get_view(fh, &disp, &etype, &filetype, datarep); - if ((disp != 1000) || strcmp(datarep, "native")) - fprintf(stderr, "disp = @LL@, datarep = %s, should be 1000, native\n\n", disp, datarep); - +#endif + errcode = MPI_File_get_view(fh, &disp, &etype, &filetype, datarep); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_view"); + } + if ((disp != 1000) || strcmp(datarep, "native")) { + errs++; + fprintf(stderr, "disp = %@LL@, datarep = %s, should be 1000, native\n\n", disp, datarep); + } +#if VERBOSE if (!mynod) fprintf(stderr, "testing MPI_File_get_byte_offset\n"); - MPI_File_get_byte_offset(fh, 10, &disp); - if (disp != (1000+20*sizeof(int))) fprintf(stderr, "byte offset = @LL@, should be %d\n\n", disp, (int) (1000+20*sizeof(int))); +#endif + errcode = MPI_File_get_byte_offset(fh, 10, &disp); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_byte_offset"); + } + if (disp != (1000+20*sizeof(int))) { + errs++; + fprintf(stderr, "byte offset = %@LL@, should be %d\n\n", + disp, (int) (1000+20*sizeof(int))); + } - MPI_File_get_group(fh, &group); + errcode = MPI_File_get_group(fh, &group); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_group"); + } +#if VERBOSE if (!mynod) fprintf(stderr, "testing MPI_File_set_size\n"); - MPI_File_set_size(fh, 1000+15*sizeof(int)); +#endif + errcode = MPI_File_set_size(fh, 1000+15*sizeof(int)); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_set_size"); + } MPI_Barrier(MPI_COMM_WORLD); - MPI_File_sync(fh); - MPI_File_get_size(fh, &disp); - if (disp != 1000+15*sizeof(int)) fprintf(stderr, "file size = @LL@, should be %d\n\n", disp, (int) (1000+15*sizeof(int))); + errcode = MPI_File_sync(fh); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_sync"); + } + errcode = MPI_File_get_size(fh, &disp); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_size"); + } + if (disp != 1000+15*sizeof(int)) { + errs++; + fprintf(stderr, "file size = %@LL@, should be %d\n\n", + disp, (int) (1000+15*sizeof(int))); + } +#if VERBOSE if (!mynod) fprintf(stderr, "seeking to eof and testing MPI_File_get_position\n"); - MPI_File_seek(fh, 0, MPI_SEEK_END); - MPI_File_get_position(fh, &disp); - if (disp != 10) fprintf(stderr, "file pointer posn = @LL@, should be 10\n\n", disp); +#endif + errcode = MPI_File_seek(fh, 0, MPI_SEEK_END); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_seek"); + } + errcode = MPI_File_get_position(fh, &disp); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_position"); + } + if (disp != 10) { + errs++; + fprintf(stderr, "file pointer posn = %@LL@, should be 10\n\n", disp); + } +#if VERBOSE if (!mynod) fprintf(stderr, "testing MPI_File_get_byte_offset\n"); - MPI_File_get_byte_offset(fh, disp, &offset); - if (offset != (1000+20*sizeof(int))) fprintf(stderr, "byte offset = @LL@, should be %d\n\n", offset, (int) (1000+20*sizeof(int))); +#endif + errcode = MPI_File_get_byte_offset(fh, disp, &offset); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_byte_offset"); + } + if (offset != (1000+20*sizeof(int))) { + errs++; + fprintf(stderr, "byte offset = %@LL@, should be %d\n\n", + offset, (int) (1000+20*sizeof(int))); + } MPI_Barrier(MPI_COMM_WORLD); +#if VERBOSE if (!mynod) fprintf(stderr, "testing MPI_File_seek with MPI_SEEK_CUR\n"); - MPI_File_seek(fh, -10, MPI_SEEK_CUR); - MPI_File_get_position(fh, &disp); - MPI_File_get_byte_offset(fh, disp, &offset); - if (offset != 1000) - fprintf(stderr, "file pointer posn in bytes = @LL@, should be 1000\n\n", offset); +#endif + errcode = MPI_File_seek(fh, -10, MPI_SEEK_CUR); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_seek"); + } + errcode = MPI_File_get_position(fh, &disp); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_position"); + } + errcode = MPI_File_get_byte_offset(fh, disp, &offset); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_get_byte_offset"); + } + if (offset != 1000) { + errs++; + fprintf(stderr, "file pointer posn in bytes = %@LL@, should be 1000\n\n", offset); + } +#if VERBOSE if (!mynod) fprintf(stderr, "preallocating disk space up to 8192 bytes\n"); - MPI_File_preallocate(fh, 8192); +#endif + errcode = MPI_File_preallocate(fh, 8192); + if (errcode != MPI_SUCCESS) { + handle_error(errcode, "MPI_File_Preallocate"); + } +#if VERBOSE if (!mynod) fprintf(stderr, "closing the file and deleting it\n"); +#endif MPI_File_close(&fh); - + MPI_Barrier(MPI_COMM_WORLD); if (!mynod) MPI_File_delete(filename, MPI_INFO_NULL); + MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); + if (mynod == 0) { + if( toterrs > 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } MPI_Type_free(&newtype); MPI_Type_free(&filetype); MPI_Group_free(&group); free(filename); - MPI_Finalize(); + MPI_Finalize(); return 0; } diff --git a/src/libs/ck-libs/ampi/romio/test/noncontig.c b/src/libs/ck-libs/ampi/romio/test/noncontig.c index 3d2d76a6a9..bb435e53ac 100644 --- a/src/libs/ck-libs/ampi/romio/test/noncontig.c +++ b/src/libs/ck-libs/ampi/romio/test/noncontig.c @@ -1,6 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include @@ -9,9 +12,11 @@ #define SIZE 5000 +#define VERBOSE 0 int main(int argc, char **argv) { int *buf, i, mynod, nprocs, len, b[3]; + int errs=0, toterrs; MPI_Aint d[3]; MPI_File fh; MPI_Status status; @@ -28,7 +33,7 @@ int main(int argc, char **argv) MPI_Abort(MPI_COMM_WORLD, 1); } -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes (length first, then string) */ if (!mynod) { i = 1; @@ -81,7 +86,9 @@ int main(int argc, char **argv) MPI_Info_set(info, "ind_wr_buffer_size", "1107"); if (!mynod) { +#if VERBOSE fprintf(stderr, "\ntesting noncontiguous in memory, noncontiguous in file using independent I/O\n"); +#endif MPI_File_delete(filename, MPI_INFO_NULL); } MPI_Barrier(MPI_COMM_WORLD); @@ -112,16 +119,28 @@ int main(int argc, char **argv) */ for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } MPI_Type_free(&newtype); MPI_Info_free(&info); free(buf); diff --git a/src/libs/ck-libs/ampi/romio/test/noncontig_coll.c b/src/libs/ck-libs/ampi/romio/test/noncontig_coll.c index 509ff3ba10..f2bc82c46c 100644 --- a/src/libs/ck-libs/ampi/romio/test/noncontig_coll.c +++ b/src/libs/ck-libs/ampi/romio/test/noncontig_coll.c @@ -1,6 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include @@ -9,9 +12,11 @@ #define SIZE 5000 +#define VERBOSE 0 int main(int argc, char **argv) { int *buf, i, mynod, nprocs, len, b[3]; + int errs=0, toterrs; MPI_Aint d[3]; MPI_File fh; MPI_Status status; @@ -27,7 +32,7 @@ int main(int argc, char **argv) MPI_Abort(MPI_COMM_WORLD, 1); } -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -69,7 +74,9 @@ int main(int argc, char **argv) MPI_Type_free(&typevec); if (!mynod) { +#if VERBOSE fprintf(stderr, "\ntesting noncontiguous in memory, noncontiguous in file using collective I/O\n"); +#endif MPI_File_delete(filename, MPI_INFO_NULL); } MPI_Barrier(MPI_COMM_WORLD); @@ -90,16 +97,28 @@ int main(int argc, char **argv) for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } MPI_Type_free(&newtype); free(buf); diff --git a/src/libs/ck-libs/ampi/romio/test/noncontig_coll2.c b/src/libs/ck-libs/ampi/romio/test/noncontig_coll2.c index a1fb3ec813..e684048c12 100644 --- a/src/libs/ck-libs/ampi/romio/test/noncontig_coll2.c +++ b/src/libs/ck-libs/ampi/romio/test/noncontig_coll2.c @@ -1,19 +1,20 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include -#include "converse.h" // For Ctv* - /* tests noncontiguous reads/writes using collective I/O */ /* this test is almost exactly like noncontig_coll.c with the following changes: * * . generalized file writing/reading to handle arbitrary number of processors * . provides the "cb_config_list" hint with several permutations of the - * avaliable processors. + * avaliable processors. * [ makes use of code copied from ROMIO's ADIO code to collect the names of * the processors ] */ @@ -21,27 +22,30 @@ /* we are going to muck with this later to make it evenly divisible by however many compute nodes we have */ #define STARTING_SIZE 5000 -int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, - char *msg, int verbose); - -// cb_config_list_keyval will be initialized in main() -CtvStaticDeclare(int, cb_config_list_keyval); //= MPI_KEYVAL_INVALID; +int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, + char *msg, int verbose); #define ADIOI_Free free #define ADIOI_Malloc malloc #define FPRINTF fprintf -/* I have no idea what the "D" stands for; it's how things are done in adio.h - */ -struct ADIO_cb_name_arrayD { - int refct; +/* I have no idea what the "D" stands for; it's how things are done in adio.h + */ +struct ADIO_cb_name_arrayD { + int refct; int namect; char **names; -}; +}; typedef struct ADIO_cb_name_arrayD *ADIO_cb_name_array; +void handle_error(int errcode, char *str); +int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp); +void default_str(int mynod, int len, ADIO_cb_name_array array, char *dest); +void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest); +void reverse_alternating_str(int mynod, int len, ADIO_cb_name_array array, char *dest); +void simple_shuffle_str(int mynod, int len, ADIO_cb_name_array array, char *dest); -void handle_error(int errcode, char *str) +void handle_error(int errcode, char *str) { char msg[MPI_MAX_ERROR_STRING]; int resultlen; @@ -49,84 +53,32 @@ void handle_error(int errcode, char *str) fprintf(stderr, "%s: %s\n", str, msg); MPI_Abort(MPI_COMM_WORLD, 1); } - /* cb_copy_name_array() - attribute copy routine - */ -int cb_copy_name_array(MPI_Comm comm, - int *keyval, - void *extra, - void *attr_in, - void **attr_out, - int *flag) -{ - ADIO_cb_name_array array; - - array = (ADIO_cb_name_array) attr_in; - array->refct++; - - *attr_out = attr_in; - *flag = 1; /* make a copy in the new communicator */ - - return MPI_SUCCESS; -} - -/* cb_delete_name_array() - attribute destructor - */ -int cb_delete_name_array(MPI_Comm comm, - int *keyval, - void *attr_val, - void *extra) -{ - int i; - ADIO_cb_name_array array; - - array = (ADIO_cb_name_array) attr_val; - array->refct--; - - if (array->refct <= 0) { - /* time to free the structures (names, array of ptrs to names, struct) - */ - for (i=0; i < array->namect; i++) { - ADIOI_Free(array->names[i]); - } - if (array->names != NULL) ADIOI_Free(array->names); - ADIOI_Free(array); - } - - return MPI_SUCCESS; -} + /* cb_gather_name_array() - gather a list of processor names from all processes * in a communicator and store them on rank 0. - * + * * This is a collective call on the communicator(s) passed in. * * Obtains a rank-ordered list of processor names from the processes in * "dupcomm". * * Returns 0 on success, -1 on failure. - * - * NOTE: Needs some work to cleanly handle out of memory cases! + * + * NOTE: Needs some work to cleanly handle out of memory cases! */ int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) { + /* this is copied from ROMIO, but since this test is for correctness, + * not performance, note that we have removed the parts where ROMIO + * uses a keyval to cache the name array. We'll just rebuild it if we + * need to */ + char my_procname[MPI_MAX_PROCESSOR_NAME], **procname = 0; int *procname_len = NULL, my_procname_len, *disp = NULL, i; - int commsize, commrank, found; + int commsize, commrank; ADIO_cb_name_array array = NULL; - if (CtvAccess(cb_config_list_keyval) == MPI_KEYVAL_INVALID) { - MPI_Keyval_create((MPI_Copy_function *) cb_copy_name_array, - (MPI_Delete_function *) cb_delete_name_array, - &CtvAccess(cb_config_list_keyval), NULL); - } - else { - MPI_Attr_get(comm, CtvAccess(cb_config_list_keyval), (void *) &array, &found); - if (found) { - *arrayp = array; - return 0; - } - } - MPI_Comm_size(comm, &commsize); MPI_Comm_rank(comm, &commrank); @@ -137,7 +89,7 @@ int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) if (array == NULL) { return -1; } - array->refct = 1; + array->refct = 1; if (commrank == 0) { /* process 0 keeps the real list */ @@ -150,7 +102,7 @@ int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) procname = array->names; /* simpler to read */ procname_len = (int *) ADIOI_Malloc(commsize * sizeof(int)); - if (procname_len == NULL) { + if (procname_len == NULL) { return -1; } } @@ -160,7 +112,7 @@ int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) array->names = NULL; } /* gather lengths first */ - MPI_Gather(&my_procname_len, 1, MPI_INT, + MPI_Gather(&my_procname_len, 1, MPI_INT, procname_len, 1, MPI_INT, 0, comm); if (commrank == 0) { @@ -173,7 +125,7 @@ int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) for (i=0; i < commsize; i++) { /* add one to the lengths because we need to count the * terminator, and we are going to use this list of lengths - * again in the gatherv. + * again in the gatherv. */ procname_len[i]++; procname[i] = malloc(procname_len[i]); @@ -181,12 +133,12 @@ int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) return -1; } } - + /* create our list of displacements for the gatherv. we're going * to do everything relative to the start of the region allocated * for procname[0] * - * I suppose it is theoretically possible that the distance between + * I suppose it is theoretically possible that the distance between * malloc'd regions could be more than will fit in an int. We don't * cover that case. */ @@ -200,7 +152,7 @@ int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) /* now gather strings */ if (commrank == 0) { - MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, + MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, procname[0], procname_len, disp, MPI_CHAR, 0, comm); } @@ -208,7 +160,7 @@ int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) /* if we didn't do this, we would need to allocate procname[] * on all processes...which seems a little silly. */ - MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, + MPI_Gatherv(my_procname, my_procname_len + 1, MPI_CHAR, NULL, NULL, NULL, MPI_CHAR, 0, comm); } @@ -224,11 +176,6 @@ int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp) #endif } - /* store the attribute; we want to store SOMETHING on all processes - * so that they can all tell if we have gone through this procedure - * or not for the given communicator. - */ - MPI_Attr_put(comm, CtvAccess(cb_config_list_keyval), array); *arrayp = array; return 0; } @@ -243,12 +190,12 @@ void default_str(int mynod, int len, ADIO_cb_name_array array, char *dest) p = snprintf(ptr, len, "%s,", array->names[i]); ptr += p; } + /* chop off that last comma */ + dest[strlen(dest) - 1] = '\0'; } - /* chop off that last comma */ - dest[strlen(dest) - 1] = '\0'; MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); } -void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest) +void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest) { char *ptr; int i, p; @@ -258,8 +205,8 @@ void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest) p = snprintf(ptr, len, "%s,", array->names[i]); ptr += p; } + dest[strlen(dest) - 1] = '\0'; } - dest[strlen(dest) - 1] = '\0'; MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); } @@ -279,9 +226,9 @@ void reverse_alternating_str(int mynod, int len, ADIO_cb_name_array array, char p = snprintf(ptr, len, "%s,", array->names[i]); ptr += p; } - } - dest[strlen(dest) - 1] = '\0'; - MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); + dest[strlen(dest) - 1] = '\0'; + } + MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); } void simple_shuffle_str(int mynod, int len, ADIO_cb_name_array array, char *dest) @@ -298,8 +245,8 @@ void simple_shuffle_str(int mynod, int len, ADIO_cb_name_array array, char *dest p = snprintf(ptr, len, "%s,", array->names[i]); ptr += p; } + dest[strlen(dest) - 1] = '\0'; } - dest[strlen(dest) - 1] = '\0'; MPI_Bcast(dest, len, MPI_CHAR, 0, MPI_COMM_WORLD); } @@ -311,14 +258,13 @@ int main(int argc, char **argv) int cb_config_len; ADIO_cb_name_array array; - CtvInitialize(int, cb_config_list_keyval); - CtvAccess(cb_config_list_keyval) = MPI_KEYVAL_INVALID; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &mynod); + MPI_Comm_rank(MPI_COMM_WORLD, &mynod); - /* process 0 takes the file name as a command-line argument and + + /* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -377,7 +323,7 @@ int main(int argc, char **argv) errs += test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: default order", verbose); /* reverse order */ - reverse_str(mynod, cb_config_len, array, cb_config_string); + reverse_str(mynod, cb_config_len, array, cb_config_string); errs += test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: reverse order", verbose); /* reverse, every other */ @@ -389,10 +335,10 @@ int main(int argc, char **argv) errs += test_file(filename, mynod, nprocs, cb_config_string, "collective w/ hinting: permutation2", verbose); MPI_Allreduce(&errs, &sum_errs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); - + if (!mynod) { if (sum_errs) fprintf(stderr, "Found %d error cases\n", sum_errs); - else printf("No errors.\n"); + else printf(" No Errors\n"); } free(filename); free(cb_config_string); @@ -402,7 +348,7 @@ int main(int argc, char **argv) #define SEEDER(x,y,z) ((x)*1000000 + (y) + (x)*(z)) -int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, char *msg, int verbose) +int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, char *msg, int verbose) { MPI_Datatype typevec, newtype, t[3]; int *buf, i, b[3], errcode, errors=0; @@ -412,8 +358,13 @@ int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, char *msg, int SIZE = (STARTING_SIZE/nprocs)*nprocs; MPI_Info info; + if (mynod==0 && verbose) fprintf(stderr, "%s\n", msg); + buf = (int *) malloc(SIZE*sizeof(int)); - if (verbose) fprintf(stderr, "[%d/%d] caller buffer: %p\n",mynod, nprocs, buf); + if (buf == NULL) { + perror("test_file"); + MPI_Abort(MPI_COMM_WORLD, -1); + } if (cb_hosts != NULL ) { @@ -443,7 +394,7 @@ int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, char *msg, } MPI_Barrier(MPI_COMM_WORLD); - errcode = MPI_File_open(MPI_COMM_WORLD, filename, + errcode = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); if (errcode != MPI_SUCCESS) { handle_error(errcode, "MPI_File_open"); @@ -452,16 +403,22 @@ int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, char *msg, MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", info); for (i=0; i +#include +#include + +#define COUNT (200) +#undef TIMING + +void handle_error(int errcode, char *str); + +void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + +/* tests shared file pointer functions */ + +int main(int argc, char **argv) +{ + int *buf, i, rank, nprocs, len, sum; + int global_sum; + int errs=0, toterrs, errcode; + char *filename; + MPI_File fh; + MPI_Status status; + + MPI_Init(&argc,&argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + double wr_stime, wr_etime, wr_time, wr_sumtime; + double rd_stime, rd_etime, rd_time, rd_sumtime; + +/* process 0 takes the file name as a command-line argument and + broadcasts it to other processes */ + if (!rank) { + i = 1; + while ((i < argc) && strcmp("-fname", *argv)) { + i++; + argv++; + } + if (i >= argc) { + fprintf(stderr, "\n*# Usage: shared_fp -fname filename\n\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + argv++; + len = strlen(*argv); + filename = (char *) malloc(len+10); + strcpy(filename, *argv); + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + else { + MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); + filename = (char *) malloc(len+10); + MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); + } + + buf = (int *) malloc(COUNT * sizeof(int)); + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + + for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); +#ifdef TIMING + fprintf( stderr, "nprocs: %d bytes: %d write: %f read %f\n", + nprocs, COUNT*sizeof(int), wr_sumtime, rd_sumtime); +#endif + } + } + + MPI_Finalize(); + return 0; +} diff --git a/src/libs/ck-libs/ampi/romio/test/perf.c b/src/libs/ck-libs/ampi/romio/test/perf.c index a71d55dc6a..85698d2466 100644 --- a/src/libs/ck-libs/ampi/romio/test/perf.c +++ b/src/libs/ck-libs/ampi/romio/test/perf.c @@ -1,11 +1,14 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include -/* A simple performance test. The file name is taken as a +/* A simple performance test. The file name is taken as a command-line argument. */ #define SIZE (1048576*4) /* read/write size per node in bytes */ @@ -23,7 +26,7 @@ int main(int argc, char **argv) MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &mynod); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -53,7 +56,7 @@ int main(int argc, char **argv) buf = (int *) malloc(SIZE); for (j=0; j #include #include @@ -10,21 +13,22 @@ /* This is the same as simple.c, but uses the PMPI versions of all MPI functions in order to test the profiling interface. */ -/* Each process writes to separate files and reads them back. - The file name is taken as a command-line argument, and the process rank - is appended to it. */ +/* Each process writes to separate files and reads them back. + The file name is taken as a command-line argument, and the process rank + is appended to it. */ int main(int argc, char **argv) { int *buf, i, rank, nints, len; char *filename, *tmp; + int errs=0, toterrs; MPI_File fh; MPI_Status status; PMPI_Init(&argc,&argv); PMPI_Comm_rank(MPI_COMM_WORLD, &rank); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!rank) { i = 1; @@ -48,7 +52,7 @@ int main(int argc, char **argv) filename = (char *) malloc(len+10); PMPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); } - + buf = (int *) malloc(SIZE); nints = SIZE/sizeof(int); @@ -67,22 +71,33 @@ int main(int argc, char **argv) /* reopen the file and read the data back */ for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } free(buf); free(filename); free(tmp); PMPI_Finalize(); - return 0; + return 0; } diff --git a/src/libs/ck-libs/ampi/romio/test/rtest.in b/src/libs/ck-libs/ampi/romio/test/rtest.in new file mode 100644 index 0000000000..c6fd305843 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/test/rtest.in @@ -0,0 +1,131 @@ +#! /bin/sh +# +# Run some of the tests. If any arguments are provided, pass them to the +# test programs. +# +# -mvhome is needed for the ANL SP, and is ignored by others +args=@MPIRUNARGS@ +device=@DEVICE@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ +MPICH_VERSION=@MPICH_VERSION@ +STOPFILE=$HOME/.stopmpichtests +mpirun=${MPIRUN:-"@MPIRUN@"} +MAKE="@MAKE@" +FILENAME=test +# +# Load basic procedures +. ${top_srcdir}/runbase +# +# Set mpirun to the name/path of the mpirun program +FindMPIRUN +# +# +test_mpi2=@HAS_MPI2@ +runtests=1 +quiet=0 +makeeach=0 +writesummaryfile=no +MAKE="@MAKE@" +for arg in "$@" ; do + case $arg in + -checkonly ) + runtests=0 + ;; + -margs=*) + margs=`echo $arg | sed 's/-margs=//'` + args="$args $margs" + ;; + -summaryfile=*) + writesummaryfile=yes + summaryfile=`echo A$arg | sed 's/A-summaryfile=//'` + ;; + -small) + makeeach=1 + ;; + -fname=*) + FILENAME=`echo $arg|sed 's/-*fname=//'` + ;; + -quiet) + shift + quiet=1 + ;; + -help|-u) + echo "runtests [-checkonly] [-margs='...']" + echo "run tests in this directory. If -checkonly set, just run" + echo "the differences check (do NO rerun the test programs)." + echo "If -margs is used, these options are passed to mpirun." + echo "If -small is used, the examples are built, run, and deleted." + exit 1 + ;; + *) + if test -n "$arg" ; then + echo "runtests: Unknown argument ($arg)" + exit 1 + fi + ;; + esac +done + +# If the programs are not available, run make. +if [ ! -x simple -a $makeeach = 0 -a $runtests = 1 ] ; then + $MAKE default +fi + +testfiles="" +if [ $runtests = 1 ] ; then + + +RunTest simple 4 "**** Testing simple.c ****" "-fname $FILENAME" + +RunTest async 4 "**** Testing async.c ****" "-fname $FILENAME" + +RunTest atomicity 4 "**** Testing atomicity.out ****" "-fname $FILENAME" + +RunTest coll_test 4 "**** Testing coll_test.out ****" "-fname $FILENAME" + +RunTest excl 4 "**** Testing excl.c ****" "-fname $FILENAME" + +RunTest file_info 4 "**** Testing file_info.c ****" "-fname $FILENAME" + +RunTest i_noncontig 2 "**** Testing i_noncontig.c ****" "-fname $FILENAME" + +RunTest noncontig 2 "**** Testing noncontig.c ****" "-fname $FILENAME" + +RunTest noncontig_coll 2 "**** Testing noncontig_coll.c ****" "-fname $FILENAME" + +RunTest noncontig_coll2 4 "**** Testing noncontig_coll2.c ****" "-fname $FILENAME" + +RunTest misc 4 "**** Testing misc.c ****" "-fname $FILENAME" + +RunTest shared_fp 4 "**** Testing shared_fp.c ****" "-fname $FILENAME" + +RunTest split_coll 4 "**** Testing split_coll.c ****" "-fname $FILENAME" + +RunTest psimple 4 "**** Testing psimple.c ****" "-fname $FILENAME" + +RunTest error 1 "**** Testing error.c ****" "-fname $FILENAME" + +RunTest status 1 "**** Testing status.c ****" "-fname $FILENAME" + +# +# Run Fortran tests ONLY if Fortran available +if [ @HAS_FORTRAN@ = 1 ] ; then + RunTest fmisc 4 "**** Testing fmisc.f ****" "-fname $FILENAME" + + RunTest fcoll_test 4 "**** Testing fcoll_test.f ****" "-fname $FILENAME" + + RunTest pfcoll_test 4 "**** Testing pfcoll_test.f ****" "-fname $FILENAME" +fi + +else + # Just run checks + testfiles=`echo *.out` +fi + +echo '*** Checking for differences from expected output ***' +CheckAllOutput context.diff +exit 0 + + + diff --git a/src/libs/ck-libs/ampi/romio/test/runtests.in b/src/libs/ck-libs/ampi/romio/test/runtests.in index d93a9017fa..04cc0eddf5 100644 --- a/src/libs/ck-libs/ampi/romio/test/runtests.in +++ b/src/libs/ck-libs/ampi/romio/test/runtests.in @@ -1,7 +1,6 @@ #! /bin/sh -mpirun="./ampirun " -PARALLEL="-np" # How to specify the number of ranks (-np in a normal mpirun command) -STOPFILE=$HOME/.stopmpichtests +mpirun="./ampirun" +STOPFILE=${MPITEST_STOPTEST:-"$HOME/.stopmpichtests"} # # If the programs are not available, run make. runtests=1 @@ -11,10 +10,11 @@ quiet=0 MAKE="@MAKE@" srcdir=@srcdir@ check_canrun=0 +subset_only=0 FILENAME=test # Using shifts should remove args from the list. for arg in "$@" ; do - case $arg in + case $arg in -checkonly) shift runtests=0 @@ -39,6 +39,10 @@ for arg in "$@" ; do shift makeeach=1 ;; + -subset) + shift + subset_only=1 + ;; -fname=*) FILENAME=`echo $arg|sed 's/-*fname=//'` ;; @@ -56,6 +60,8 @@ for arg in "$@" ; do echo "at the end of the test rather than also after each test." echo "If -check is used, only a single simple test is run; this" echo "is used to check that mpirun can run an MPI program." + echo "If -subset is used, we skip tests for atomicity and shared" + echo "file pointers which can fail on some distributed file systems" exit 1 ;; *) @@ -69,13 +75,13 @@ done # MakeExe program-name MakeExe() { - if [ -s $STOPFILE ] ; then + if [ -s $STOPFILE ] ; then echo "Found stopfile; exiting" exit 0 fi if [ ! -x $1 ] ; then $MAKE $1 - if [ ! -x $1 ] ; then + if [ ! -x $1 ] ; then echo "Could not build executable $1; aborting tests" exit 1 fi @@ -84,7 +90,7 @@ MakeExe() { # CleanExe program-name CleanExe() { if [ $makeeach = 1 ] ; then - /bin/rm -f $1 $1.o + rm -f $1 $1.o fi } # Output marker @@ -112,7 +118,7 @@ CheckOutput() { grep -v 'FORTRAN STOP' ${bfile}.out > ${bfile}.tout if diff -b $bfile.tout $stdfile > /dev/null ; then true - elif [ -s $stdfile2 ] ; then + elif [ -s $stdfile2 ] ; then # check for alternate in case configuration has fewer datatypes if diff -b $bfile.tout $stdfile2 > /dev/null ; then true @@ -140,8 +146,8 @@ RunTest() { MakeExe simple rm -rf $FILENAME* echo "**** Testing ${1}.c ****" - mpirun $PARALLEL 4 ./${1} -fname $FILENAME "$@" >>${1}.out 2>1 - CheckOutput ${1} + mpirun -np 4 ./${1} -fname $FILENAME "$@" >>${1}.out 2>1 + CheckOutput ${1} CleanExe ${1} } @@ -160,8 +166,8 @@ testfiles="$testfiles simple.out" MakeExe simple \rm -f $FILENAME* echo '**** Testing simple.c ****' -$mpirun $PARALLEL 4 ./simple -fname $FILENAME "$@" >> simple.out 2>&1 -CheckOutput simple +$mpirun -np 4 ./simple -fname $FILENAME +# CheckOutput simple CleanExe simple # OutTime @@ -170,28 +176,42 @@ testfiles="$testfiles async.out" MakeExe async \rm -f $FILENAME* echo '**** Testing async.c ****' -$mpirun $PARALLEL 4 ./async -fname $FILENAME "$@" >> async.out 2>&1 -CheckOutput async +$mpirun -np 4 ./async -fname $FILENAME +# CheckOutput async CleanExe async # OutTime -testfiles="$testfiles atomicity.out" -\rm -f atomicity.out -MakeExe atomicity +testfiles="$testfiles async-multi.out" +\rm -f async-multi.out +MakeExe async-multiple \rm -f $FILENAME* -echo '**** Testing atomicity.c ****' -$mpirun $PARALLEL 4 ./atomicity -fname $FILENAME "$@" >> atomicity.out 2>&1 -CheckOutput atomicity -CleanExe atomicity +echo '**** Testing async-multiple.c ****' +$mpirun -np 4 ./async-multiple -fname $FILENAME +# CheckOutput async-multiple +CleanExe async-multiple # OutTime +if [ $subset_only -eq 0 ] ; then + testfiles="$testfiles atomicity.out" + \rm -f atomicity.out + MakeExe atomicity + \rm -f $FILENAME* + echo '**** Testing atomicity.c ****' + # Atomicity test recommends at least 8 processes (separate processors + # even better) + $mpirun -np 4 ./atomicity -fname $FILENAME + # CheckOutput atomicity + CleanExe atomicity + # + OutTime +fi testfiles="$testfiles coll_test.out" \rm -f coll_test.out MakeExe coll_test \rm -f $FILENAME* echo '**** Testing coll_test.c ****' -$mpirun $PARALLEL 4 ./coll_test -fname $FILENAME "$@" >> coll_test.out 2>&1 -CheckOutput coll_test +$mpirun -np 4 ./coll_test -fname $FILENAME +# CheckOutput coll_test CleanExe coll_test # OutTime @@ -200,8 +220,8 @@ testfiles="$testfiles excl.out" MakeExe excl \rm -f $FILENAME* echo '**** Testing excl.c ****' -$mpirun $PARALLEL 4 ./excl -fname $FILENAME "$@" >> excl.out 2>&1 -CheckOutput excl +$mpirun -np 4 ./excl -fname $FILENAME +# CheckOutput excl CleanExe excl # OutTime @@ -210,8 +230,8 @@ testfiles="$testfiles file_info.out" MakeExe file_info \rm -f $FILENAME* echo '**** Testing file_info.c ****' -$mpirun $PARALLEL 4 ./file_info -fname $FILENAME "$@" >> file_info.out 2>&1 -CheckOutput file_info +$mpirun -np 4 ./file_info -fname $FILENAME +# CheckOutput file_info CleanExe file_info # OutTime @@ -220,8 +240,8 @@ testfiles="$testfiles i_noncontig.out" MakeExe i_noncontig \rm -f $FILENAME* echo '**** Testing i_noncontig.c ****' -$mpirun $PARALLEL 2 ./i_noncontig -fname $FILENAME "$@" >> i_noncontig.out 2>&1 -CheckOutput i_noncontig +$mpirun -np 2 ./i_noncontig -fname $FILENAME +# CheckOutput i_noncontig CleanExe i_noncontig # OutTime @@ -230,8 +250,8 @@ testfiles="$testfiles noncontig.out" MakeExe noncontig \rm -f $FILENAME* echo '**** Testing noncontig.c ****' -$mpirun $PARALLEL 2 ./noncontig -fname $FILENAME "$@" >> noncontig.out 2>&1 -CheckOutput noncontig +$mpirun -np 2 ./noncontig -fname $FILENAME +# CheckOutput noncontig CleanExe noncontig # OutTime @@ -240,8 +260,8 @@ testfiles="$testfiles noncontig_coll.out" MakeExe noncontig_coll \rm -f $FILENAME* echo '**** Testing noncontig_coll.c ****' -$mpirun $PARALLEL 2 ./noncontig_coll -fname $FILENAME "$@" >> noncontig_coll.out 2>&1 -CheckOutput noncontig_coll +$mpirun -np 2 ./noncontig_coll -fname $FILENAME +# CheckOutput noncontig_coll CleanExe noncontig_coll # OutTime @@ -250,58 +270,93 @@ testfiles="$testfiles noncontig_coll2.out" MakeExe noncontig_coll2 \rm -f $FILENAME* echo '**** Testing noncontig_coll2.c ****' -$mpirun $PARALLEL 4 ./noncontig_coll2 -fname $FILENAME "$@" >> noncontig_coll2.out 2>&1 -CheckOutput noncontig_coll2 +$mpirun -np 4 ./noncontig_coll2 -fname $FILENAME +# CheckOutput noncontig_coll2 CleanExe noncontig_coll2 +MakeExe aggregation1 +echo '**** Testing aggregation1 ****' +$mpirun -np 4 ./aggregation1 -h -f $FILENAME +# CheckOutput aggregation1 +CleanExe aggregation1 +MakeExe aggregation2 +echo '**** Testing aggregation2 ****' +$mpirun -np 4 ./aggregation2 $FILENAME +# CheckOutput aggregation2 +CleanExe aggregation2 +MakeExe hindexed +echo '**** Testing hindexed ****' +$mpirun -np 4 ./hindexed $FILENAME +# CheckOutput hindexed +CleanExe hindexed # +#echo '**** Testing write_all_test (run 1)****' +#$mpirun -np 4 ./write_all_test -nzp 2 -zplace 2 -nzw 2 -naw 2 -size 100 \ +# -offm 8 -hints romio_cb_write enable -fname $FILENAME +#echo '**** Testing write_all_test (run 2)****' +#$mpirun -np 4 ./write_all_test -nzp 2 -zplace 2 -nzw 2 -naw 2 -size 100 \ +# -offm 4 -hints romio_cb_write enable -fname $FILENAME +#CleanExe write_all_test OutTime -testfiles="$testfiles misc.out" -\rm -f misc.out -MakeExe misc -\rm -f $FILENAME* -echo '**** Testing misc.c ****' -$mpirun $PARALLEL 4 ./misc -fname $FILENAME "$@" >> misc.out 2>&1 -CheckOutput misc -CleanExe misc -# -OutTime -testfiles="$testfiles shared_fp.out" -\rm -f shared_fp.out -MakeExe shared_fp -\rm -f $FILENAME* -echo '**** Testing shared_fp.c ****' -$mpirun $PARALLEL 4 ./shared_fp -fname $FILENAME "$@" >> shared_fp.out 2>&1 -CheckOutput shared_fp -CleanExe shared_fp -# -OutTime +if [ $subset_only -eq 0 ] ; then + testfiles="$testfiles misc.out" + \rm -f misc.out + MakeExe misc + \rm -f $FILENAME* + echo '**** Testing misc.c ****' + $mpirun -np 4 ./misc -fname $FILENAME + # CheckOutput misc + CleanExe misc + # + OutTime +fi +if [ $subset_only -eq 0 ] ; then + testfiles="$testfiles shared_fp.out" + \rm -f shared_fp.out + MakeExe shared_fp + \rm -f $FILENAME* + echo '**** Testing shared_fp.c ****' + $mpirun -np 4 ./shared_fp -fname $FILENAME + # CheckOutput shared_fp + CleanExe shared_fp + # + OutTime + testfiles="$testfiles ordered_fp.out" + \rm -f ordered_fp.out + MakeExe ordered_fp + \rm -f $FILENAME* + echo '**** Testing ordered_fp.c ****' + $mpirun -np 4 ./ordered_fp -fname $FILENAME + CleanExe ordered_fp + # + OutTime +fi testfiles="$testfiles split_coll.out" \rm -f split_coll.out MakeExe split_coll \rm -f $FILENAME* echo '**** Testing split_coll.c ****' -$mpirun $PARALLEL 4 ./split_coll -fname $FILENAME "$@" >> split_coll.out 2>&1 -CheckOutput split_coll +$mpirun -np 4 ./split_coll -fname $FILENAME +# CheckOutput split_coll CleanExe split_coll # OutTime -testfiles="$testfiles psimple.out" -\rm -f psimple.out -MakeExe psimple -\rm -f $FILENAME* -echo '**** Testing psimple.c ****' -$mpirun $PARALLEL 4 ./psimple -fname $FILENAME "$@" >> psimple.out 2>&1 -CheckOutput psimple -CleanExe psimple -# -OutTime +# testfiles="$testfiles psimple.out" +# \rm -f psimple.out +# MakeExe psimple +# \rm -f $FILENAME* +# echo '**** Testing psimple.c ****' +# $mpirun -np 4 ./psimple -fname $FILENAME +# # CheckOutput psimple +# CleanExe psimple +# # +# OutTime testfiles="$testfiles error.out" \rm -f error.out MakeExe error \rm -f $FILENAME* echo '**** Testing error.c ****' -$mpirun $PARALLEL 1 ./error -fname $FILENAME "$@" >> error.out 2>&1 -CheckOutput error +$mpirun -np 1 ./error -fname $FILENAME +# CheckOutput error CleanExe error # OutTime @@ -311,42 +366,44 @@ MakeExe status \rm -f $FILENAME* echo '**** Testing status.c ****' # Some systems have a status program. -$mpirun $PARALLEL 1 ./status -fname $FILENAME "$@" >> status.out 2>&1 -CheckOutput status +$mpirun -np 1 ./status -fname $FILENAME +# CheckOutput status CleanExe status # -if [ @NOF77@ = 0 ] ; then +if [ @NOF77@ = 0 ] ; then echo "" echo "FORTRAN TESTS" OutTime - testfiles="$testfiles fmisc.out" - \rm -f fmisc.out - MakeExe fmisc - \rm -f $FILENAME* - echo '**** Testing fmisc.f ****' - $mpirun $PARALLEL 4 ./fmisc -fname $FILENAME "$@" >> fmisc.out 2>&1 - CheckOutput fmisc - CleanExe fmisc -# - OutTime + if [ $subset_only -eq 0 ] ; then + testfiles="$testfiles fmisc.out" + \rm -f fmisc.out + MakeExe fmisc + \rm -f $FILENAME* + echo '**** Testing fmisc.f ****' + $mpirun -np 4 ./fmisc -fname $FILENAME + # CheckOutput fmisc + CleanExe fmisc + # + OutTime + fi testfiles="$testfiles fcoll_test.out" \rm -f fcoll_test.out MakeExe fcoll_test \rm -f $FILENAME* echo '**** Testing fcoll_test.f ****' - $mpirun $PARALLEL 4 ./fcoll_test -fname $FILENAME "$@" >> fcoll_test.out 2>&1 - CheckOutput fcoll_test + $mpirun -np 4 ./fcoll_test -fname $FILENAME + # CheckOutput fcoll_test CleanExe fcoll_test # OutTime - testfiles="$testfiles pfcoll_test.out" - \rm -f pfcoll_test.out - MakeExe pfcoll_test - \rm -f $FILENAME* - echo '**** Testing pfcoll_test.f ****' - $mpirun $PARALLEL 4 ./pfcoll_test -fname $FILENAME "$@" >> pfcoll_test.out 2>&1 - CheckOutput pfcoll_test - CleanExe pfcoll_test + # testfiles="$testfiles pfcoll_test.out" + # \rm -f pfcoll_test.out + # MakeExe pfcoll_test + # \rm -f $FILENAME* + # echo '**** Testing pfcoll_test.f ****' + # $mpirun -np 4 ./pfcoll_test -fname $FILENAME + # # CheckOutput pfcoll_test + # CleanExe pfcoll_test # echo "" fi @@ -360,46 +417,46 @@ else fi fi # -echo '*** Checking for differences from expected output ***' -/bin/rm -f iotests.diff -nodiff=1 -for file in $testfiles ; do - stdfile="${srcdir}/std/`basename $file .out`.std" - # if basename is sendrecv or isndrcv, then we may want to test - # with .std2 as well. We should really separate out the long double - # tests ... - if [ -s $stdfile ] ; then - stdfile2=${stdfile}2 - # Handle Fortran systems that generate stop statements - bfile="`basename $file .out`.tout" - rm -f ${bfile} - grep -v 'FORTRAN STOP' ${file} > ${bfile} - if diff -b $bfile $stdfile > /dev/null ; then - true - elif [ -s $stdfile2 ] ; then - # check for alternate in case configuration has fewer datatypes - if diff -b $bfile $stdfile2 > /dev/null ; then - true - else - echo "Differences in `basename $file .out`" >> iotests.diff - diff -b $bfile $stdfile >> iotests.diff - nodiff=0 - fi - else - echo "Differences in `basename $file .out`" >> iotests.diff - diff -b $bfile $stdfile >> iotests.diff - nodiff=0 - fi - rm -f ${bfile} - else - echo "Can not find file $stdfile to compare against for test `basename $file .out`" - nodiff=0 - fi -done -if [ -s iotests.diff ] ; then - cat iotests.diff -elif [ $nodiff = 1 ] ; then - echo "-- No differences found; test successful" -fi -exit 0 - +# echo '*** Checking for differences from expected output ***' +# rm -f iotests.diff +# nodiff=1 +# for file in $testfiles ; do +# stdfile="${srcdir}/std/`basename $file .out`.std" +# # if basename is sendrecv or isndrcv, then we may want to test +# # with .std2 as well. We should really separate out the long double +# # tests ... +# if [ -s $stdfile ] ; then +# stdfile2=${stdfile}2 +# # Handle Fortran systems that generate stop statements +# bfile="`basename $file .out`.tout" +# rm -f ${bfile} +# grep -v 'FORTRAN STOP' ${file} > ${bfile} +# if diff -b $bfile $stdfile > /dev/null ; then +# true +# elif [ -s $stdfile2 ] ; then +# # check for alternate in case configuration has fewer datatypes +# if diff -b $bfile $stdfile2 > /dev/null ; then +# true +# else +# echo "Differences in `basename $file .out`" >> iotests.diff +# diff -b $bfile $stdfile >> iotests.diff +# nodiff=0 +# fi +# else +# echo "Differences in `basename $file .out`" >> iotests.diff +# diff -b $bfile $stdfile >> iotests.diff +# nodiff=0 +# fi +# rm -f ${bfile} +# else +# echo "Can not find file $stdfile to compare against for test `basename $file .out`" +# nodiff=0 +# fi +# done +# if [ -s iotests.diff ] ; then +# cat iotests.diff +# elif [ $nodiff = 1 ] ; then +# echo "-- No differences found; test successful" +# fi + exit 0 + diff --git a/src/libs/ck-libs/ampi/romio/test/shared_fp.c b/src/libs/ck-libs/ampi/romio/test/shared_fp.c index a320c6d7c5..fbc0f4083a 100644 --- a/src/libs/ck-libs/ampi/romio/test/shared_fp.c +++ b/src/libs/ck-libs/ampi/romio/test/shared_fp.c @@ -1,17 +1,32 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include #define COUNT 1024 +void handle_error(int errcode, char *str); + +void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} + /* tests shared file pointer functions */ int main(int argc, char **argv) { int *buf, i, rank, nprocs, len, sum, global_sum; + int errs=0, toterrs, errcode; char *filename; MPI_File fh; MPI_Status status; @@ -19,7 +34,7 @@ int main(int argc, char **argv) MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!rank) { i = 1; @@ -28,7 +43,7 @@ int main(int argc, char **argv) argv++; } if (i >= argc) { - fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); + fprintf(stderr, "\n*# Usage: shared_fp -fname filename\n\n"); MPI_Abort(MPI_COMM_WORLD, 1); } argv++; @@ -43,7 +58,7 @@ int main(int argc, char **argv) filename = (char *) malloc(len+10); MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); } - + buf = (int *) malloc(COUNT * sizeof(int)); MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -51,18 +66,30 @@ int main(int argc, char **argv) for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } MPI_Finalize(); - return 0; + return 0; } diff --git a/src/libs/ck-libs/ampi/romio/test/simple.c b/src/libs/ck-libs/ampi/romio/test/simple.c index d35e91356c..7182a4c01f 100644 --- a/src/libs/ck-libs/ampi/romio/test/simple.c +++ b/src/libs/ck-libs/ampi/romio/test/simple.c @@ -1,27 +1,39 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include #define SIZE (65536) -/* Each process writes to separate files and reads them back. - The file name is taken as a command-line argument, and the process rank - is appended to it. */ +static void handle_error(int errcode, char *str) +{ + char msg[MPI_MAX_ERROR_STRING]; + int resultlen; + MPI_Error_string(errcode, msg, &resultlen); + fprintf(stderr, "%s: %s\n", str, msg); + MPI_Abort(MPI_COMM_WORLD, 1); +} +/* Each process writes to separate files and reads them back. + The file name is taken as a command-line argument, and the process rank + is appended to it. */ int main(int argc, char **argv) { int *buf, i, rank, nints, len; char *filename, *tmp; + int errs = 0, toterrs, errcode; MPI_File fh; MPI_Status status; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!rank) { i = 1; @@ -45,7 +57,7 @@ int main(int argc, char **argv) filename = (char *) malloc(len+10); MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); } - + buf = (int *) malloc(SIZE); nints = SIZE/sizeof(int); @@ -56,30 +68,52 @@ int main(int argc, char **argv) strcpy(tmp, filename); sprintf(filename, "%s.%d", tmp, rank); - MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fh); - MPI_File_write(fh, buf, nints, MPI_INT, &status); - MPI_File_close(&fh); + errcode = MPI_File_open(MPI_COMM_SELF, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); + if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open(1)"); + + errcode = MPI_File_write(fh, buf, nints, MPI_INT, &status); + if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_write"); + + errcode = MPI_File_close(&fh); + if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_clode (1)"); /* reopen the file and read the data back */ for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } free(buf); free(filename); free(tmp); MPI_Finalize(); - return 0; + return 0; } diff --git a/src/libs/ck-libs/ampi/romio/test/split_coll.c b/src/libs/ck-libs/ampi/romio/test/split_coll.c index 151c1f0711..da15701627 100644 --- a/src/libs/ck-libs/ampi/romio/test/split_coll.c +++ b/src/libs/ck-libs/ampi/romio/test/split_coll.c @@ -1,6 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include @@ -14,7 +17,7 @@ /* The file name is taken as a command-line argument. */ /* Note that the file access pattern is noncontiguous. */ - + int main(int argc, char **argv) { MPI_Datatype newtype; @@ -22,6 +25,7 @@ int main(int argc, char **argv) int order, nprocs, j, len; int array_of_dargs[3], array_of_psizes[3]; int *readbuf, *writebuf, bufcount, mynod, *tmpbuf, array_size; + int errs=0, toterrs; char *filename; MPI_File fh; MPI_Status status; @@ -31,7 +35,7 @@ int main(int argc, char **argv) MPI_Comm_rank(MPI_COMM_WORLD, &mynod); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!mynod) { i = 1; @@ -76,7 +80,7 @@ int main(int argc, char **argv) for (i=0; i 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } MPI_Type_free(&newtype); free(readbuf); diff --git a/src/libs/ck-libs/ampi/romio/test/status.c b/src/libs/ck-libs/ampi/romio/test/status.c index d4d79678a7..0fc673d7a6 100644 --- a/src/libs/ck-libs/ampi/romio/test/status.c +++ b/src/libs/ck-libs/ampi/romio/test/status.c @@ -1,25 +1,29 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ #include "mpi.h" -#include "mpio.h" /* not necessary with MPICH 1.1.1 or HPMPI 1.4 */ #include #include #include #define SIZE (65536) -/* Checks if the status objects is filled correctly by I/O functions */ +/* Checks if the status objects is filled correctly by I/O functions */ int main(int argc, char **argv) { int *buf, i, rank, nints, len, count, elements; char *filename, *tmp; + int errs=0, toterrs; MPI_File fh; MPI_Status status; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); -/* process 0 takes the file name as a command-line argument and +/* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!rank) { i = 1; @@ -43,7 +47,7 @@ int main(int argc, char **argv) filename = (char *) malloc(len+10); MPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); } - + buf = (int *) malloc(SIZE); nints = SIZE/sizeof(int); @@ -59,16 +63,31 @@ int main(int argc, char **argv) MPI_Get_count(&status, MPI_INT, &count); MPI_Get_elements(&status, MPI_INT, &elements); if (!rank) { - printf("count = %d, should be %d\n", count, nints); - printf("elements = %d, should be %d\n", elements, nints); + if (count != nints) { + errs++; + printf("count = %d, should be %d\n", count, nints); + } + if (elements != nints) { + errs++; + printf("elements = %d, should be %d\n", elements, nints); + } } MPI_File_close(&fh); + MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); + if (rank == 0) { + if( toterrs > 0) { + fprintf( stderr, "Found %d errors\n", toterrs ); + } + else { + fprintf( stdout, " No Errors\n" ); + } + } free(buf); free(filename); free(tmp); MPI_Finalize(); - return 0; + return 0; } diff --git a/src/libs/ck-libs/ampi/romio/test/std/async.std b/src/libs/ck-libs/ampi/romio/test/std/async.std deleted file mode 100644 index a965a70ed4..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/async.std +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/src/libs/ck-libs/ampi/romio/test/std/atomicity.std b/src/libs/ck-libs/ampi/romio/test/std/atomicity.std deleted file mode 100644 index 5e10bb1abd..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/atomicity.std +++ /dev/null @@ -1,4 +0,0 @@ - -testing contiguous accesses - -testing noncontiguous accesses diff --git a/src/libs/ck-libs/ampi/romio/test/std/coll_test.std b/src/libs/ck-libs/ampi/romio/test/std/coll_test.std deleted file mode 100644 index a965a70ed4..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/coll_test.std +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/src/libs/ck-libs/ampi/romio/test/std/error.std b/src/libs/ck-libs/ampi/romio/test/std/error.std deleted file mode 100644 index 6a4249321a..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/error.std +++ /dev/null @@ -1,9 +0,0 @@ -Tests if errors are reported correctly... -Should say "Invalid displacement argument" - -MPI_File_set_view: Invalid disp argument -------------- Processor 0 Exiting: Called CmiAbort ------------ -Reason: AMPI: Application called MPI_Abort()! - -Fatal error on PE 0> AMPI: Application called MPI_Abort()! - diff --git a/src/libs/ck-libs/ampi/romio/test/std/excl.std b/src/libs/ck-libs/ampi/romio/test/std/excl.std deleted file mode 100644 index a965a70ed4..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/excl.std +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/src/libs/ck-libs/ampi/romio/test/std/fcoll_test.std b/src/libs/ck-libs/ampi/romio/test/std/fcoll_test.std deleted file mode 100644 index d1eec2fcdd..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/fcoll_test.std +++ /dev/null @@ -1 +0,0 @@ - Done diff --git a/src/libs/ck-libs/ampi/romio/test/std/file_info.std b/src/libs/ck-libs/ampi/romio/test/std/file_info.std deleted file mode 100644 index 8c92275734..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/file_info.std +++ /dev/null @@ -1 +0,0 @@ -No errors. diff --git a/src/libs/ck-libs/ampi/romio/test/std/fmisc.std b/src/libs/ck-libs/ampi/romio/test/std/fmisc.std deleted file mode 100644 index f7f1756667..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/fmisc.std +++ /dev/null @@ -1,11 +0,0 @@ - testing MPI_FILE_GET_AMODE - setting atomic mode - reverting back to nonatomic mode - testing MPI_FILE_GET_VIEW - testing MPI_FILE_GET_BYTE_OFFSET - setting file size to 1060 bytes - seeking to eof and testing MPI_FILE_GET_POSITION - testing MPI_FILE_GET_BYTE_OFFSET - testing MPI_FILE_SEEK with MPI_SEEK_CUR - preallocating disk space up to 8192 bytes - closing the file and deleting it diff --git a/src/libs/ck-libs/ampi/romio/test/std/i_noncontig.std b/src/libs/ck-libs/ampi/romio/test/std/i_noncontig.std deleted file mode 100644 index 3c687e0015..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/i_noncontig.std +++ /dev/null @@ -1,6 +0,0 @@ - -testing noncontiguous in memory, noncontiguous in file using nonblocking I/O - -testing noncontiguous in memory, contiguous in file using nonblocking I/O - -testing contiguous in memory, noncontiguous in file using nonblocking I/O diff --git a/src/libs/ck-libs/ampi/romio/test/std/misc.std b/src/libs/ck-libs/ampi/romio/test/std/misc.std deleted file mode 100644 index 2692906f33..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/misc.std +++ /dev/null @@ -1,11 +0,0 @@ -testing MPI_File_get_amode -setting atomic mode -reverting back to nonatomic mode -testing MPI_File_get_view -testing MPI_File_get_byte_offset -testing MPI_File_set_size -seeking to eof and testing MPI_File_get_position -testing MPI_File_get_byte_offset -testing MPI_File_seek with MPI_SEEK_CUR -preallocating disk space up to 8192 bytes -closing the file and deleting it diff --git a/src/libs/ck-libs/ampi/romio/test/std/noncontig.std b/src/libs/ck-libs/ampi/romio/test/std/noncontig.std deleted file mode 100644 index e3530966b1..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/noncontig.std +++ /dev/null @@ -1,6 +0,0 @@ - -testing noncontiguous in memory, noncontiguous in file using independent I/O - -testing noncontiguous in memory, contiguous in file using independent I/O - -testing contiguous in memory, noncontiguous in file using independent I/O diff --git a/src/libs/ck-libs/ampi/romio/test/std/noncontig_coll.std b/src/libs/ck-libs/ampi/romio/test/std/noncontig_coll.std deleted file mode 100644 index da9084b60e..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/noncontig_coll.std +++ /dev/null @@ -1,6 +0,0 @@ - -testing noncontiguous in memory, noncontiguous in file using collective I/O - -testing noncontiguous in memory, contiguous in file using collective I/O - -testing contiguous in memory, noncontiguous in file using collective I/O diff --git a/src/libs/ck-libs/ampi/romio/test/std/noncontig_coll2.std b/src/libs/ck-libs/ampi/romio/test/std/noncontig_coll2.std deleted file mode 100644 index 8c92275734..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/noncontig_coll2.std +++ /dev/null @@ -1 +0,0 @@ -No errors. diff --git a/src/libs/ck-libs/ampi/romio/test/std/pfcoll_test.std b/src/libs/ck-libs/ampi/romio/test/std/pfcoll_test.std deleted file mode 100644 index d1eec2fcdd..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/pfcoll_test.std +++ /dev/null @@ -1 +0,0 @@ - Done diff --git a/src/libs/ck-libs/ampi/romio/test/std/psimple.std b/src/libs/ck-libs/ampi/romio/test/std/psimple.std deleted file mode 100644 index a965a70ed4..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/psimple.std +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/src/libs/ck-libs/ampi/romio/test/std/shared_fp.std b/src/libs/ck-libs/ampi/romio/test/std/shared_fp.std deleted file mode 100644 index a965a70ed4..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/shared_fp.std +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/src/libs/ck-libs/ampi/romio/test/std/simple.std b/src/libs/ck-libs/ampi/romio/test/std/simple.std deleted file mode 100644 index a965a70ed4..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/simple.std +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/src/libs/ck-libs/ampi/romio/test/std/split_coll.std b/src/libs/ck-libs/ampi/romio/test/std/split_coll.std deleted file mode 100644 index a965a70ed4..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/split_coll.std +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/src/libs/ck-libs/ampi/romio/test/std/status.std b/src/libs/ck-libs/ampi/romio/test/std/status.std deleted file mode 100644 index ae05b9256d..0000000000 --- a/src/libs/ck-libs/ampi/romio/test/std/status.std +++ /dev/null @@ -1,2 +0,0 @@ -count = 16384, should be 16384 -elements = 16384, should be 16384 diff --git a/src/libs/ck-libs/ampi/romio/util/.state-cache b/src/libs/ck-libs/ampi/romio/util/.state-cache new file mode 100644 index 0000000000..5505361a0f --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/util/.state-cache @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/libs/ck-libs/ampi/romio/util/nfslock.c b/src/libs/ck-libs/ampi/romio/util/nfslock.c new file mode 100644 index 0000000000..3d37434e83 --- /dev/null +++ b/src/libs/ck-libs/ampi/romio/util/nfslock.c @@ -0,0 +1,72 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * (C) 2004 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include +#include +#include +#include + +/* + * This program tests to see if fcntl returns success when asked to + * establish a file lock. This test is intended for use on file systems + * such as NFS that may not implement file locks. ROMIO makes use + * of file locks to implement certain operations, and may not work + * properly if file locks are not available. + * + * This is a simple test and has at least two limitations: + * + * 1. Some implementations of NFS are known to return success for + * setting a file lock when in fact no lock has been set. This + * test will not detect such erroneous implementations of NFS + * + * 2. Some implementations will hang (enter and wait indefinitately) + * within the fcntl call. This program will also hang in that case. + * Under normal conditions, this program should only take a few seconds to + * run. + * + * The program prints a message showing the success or failure of + * setting the file lock and sets the return status to 0 on success and + * non-zero on failure. If there is a failure, the system routine + * perror is also called to explain the reason. + */ + +/* style: allow:printf:2 sig:0 */ + +int main( int argc, char *argv[] ) +{ + struct flock lock; + int fd, err; + char *filename; + + /* Set the filename. Either arg[1] or conftest.dat */ + if (argc > 1 && argv[1]) { + filename = argv[1]; + } + else { + filename = "conftest.dat"; + } + + + lock.l_type = F_WRLCK; + lock.l_start = 0; + lock.l_whence = SEEK_SET; + lock.l_len = 100; + + fd = open(filename, O_RDWR | O_CREAT, 0644); + + err = fcntl(fd, F_SETLKW, &lock); + + if (err) { + printf( "Failed to set a file lock on %s\n", filename ); + perror( "Reason " ); + } + else { + printf( "fcntl claims success in setting a file lock on %s\n", filename ); + } + /* printf("err = %d, errno = %d\n", err, errno); */ + close(fd); + unlink( filename ); + return err; +} diff --git a/src/libs/ck-libs/ampi/romio/util/romioinstall.in b/src/libs/ck-libs/ampi/romio/util/romioinstall.in index 80299a23dd..95a6309231 100644 --- a/src/libs/ck-libs/ampi/romio/util/romioinstall.in +++ b/src/libs/ck-libs/ampi/romio/util/romioinstall.in @@ -15,22 +15,25 @@ PREFIX=@prefix@ ROMIO_HOME=@ROMIO_HOME@ ARCH=@ARCH@ RANLIB=@RANLIB@ +TOP_BUILD_DIR=@top_build_dir@ # LAM Do we want to install or uninstall? WANT_INSTALL=1 # # Default paths (set at configure time) - prefix=@prefix@ - exec_prefix=@exec_prefix@ - bindir=@bindir@ - sbindir=@sbindir@ - includedir=@includedir@ - #sysconfdir=@sysconfdir@ - libdir=@libdir@ - #sharedlib_dir=@sharedlib_dir@ - mandir=@mandir@ - htmldir=@htmldir@ - #datadir=@datadir@ - docdir=@docdir@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +includedir=@includedir@ +#sysconfdir=@sysconfdir@ +libdir=@libdir@ +#sharedlib_dir=@sharedlib_dir@ +mandir=@mandir@ +htmldir=@htmldir@ +# datarootdir required as of autoconf 2.60 +datarootdir=@datatrootdir@ +#datadir=@datadir@ +docdir=@docdir@ ## Location of sources #top_srcdir=@top_srcdir@ # @@ -40,6 +43,8 @@ XMODE=0755 replace=1 verbose=0 +failmode=soft + # Shell procedures to copy files and create directories # # We could use install, but install is too different and too hard to @@ -48,16 +53,16 @@ verbose=0 CP=cp # MkDir() { - if [ ! -e $1 ]; then mkdir $1 ; fi + if [ ! -e $1 ]; then mkdir $1 ; fi } CopyFile() { if [ -z "$3" ] ; then - mode=$MODE +mode=$MODE else - mode=$3 +mode=$3 fi if [ -d $2 ] ; then - dest=$2/`basename $1` +dest=$2/`basename $1` else dest=$2 fi @@ -76,7 +81,7 @@ else # We don't delete the file in the event that we are copying the # file over itself (we SHOULD check for that separately, by checking # that directories are distinct) - #if [ -f $dest ] ; then $Show /bin/rm -f $dest ; fi + #if [ -f $dest ] ; then $Show rm -f $dest ; fi $Show $CP $1 $dest rc=$? if [ $rc != 0 ] ; then @@ -84,7 +89,7 @@ else errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi else - echo "/bin/rm -f $dest" >> $UNINSTALLFILE + echo "rm -f $dest" >> $UNINSTALLFILE fi $Show chmod $mode $dest rc=$? @@ -99,7 +104,7 @@ fi # # A version of copy file that preserves file dates CopyFileP() { - CP="$CPRP -p" + CP="cp -p" CopyFile $1 $2 $3 CP=cp } @@ -152,10 +157,11 @@ if test "$WANT_INSTALL" = "1"; then CopyFile $file $includedir done - echo "copying directory $ROMIO_HOME/lib to $libdir" + MkDir $libdir + echo "copying directory $TOP_BUILD_DIR/lib to $libdir" #cp -r $ROMIO_HOME/lib $PREFIX #chmod 755 $PREFIX/lib - for file in $ROMIO_HOME/lib/* ; do + for file in $TOP_BUILD_DIR/lib/* ; do if [ -f $file ] ; then CopyFileP $file $libdir fi @@ -199,7 +205,8 @@ if test "$WANT_INSTALL" = "1"; then mv $exampledir/.romiotmp $exampledir/Makefile # - echo "/bin/rm -f $UNINSTALLFILE" >> $UNINSTALLFILE + MkDir $sbindir + echo "rm -f $UNINSTALLFILE" >> $UNINSTALLFILE # Add the directory removes to the UNINSTALL file for dir in $dirlist ; do echo "if [ -d $dir ] ; then rmdir $dir ; fi" >> $UNINSTALLFILE diff --git a/src/libs/ck-libs/ampi/romio/util/tarch b/src/libs/ck-libs/ampi/romio/util/tarch index 9a472b3b0a..ccccf4d514 100755 --- a/src/libs/ck-libs/ampi/romio/util/tarch +++ b/src/libs/ck-libs/ampi/romio/util/tarch @@ -53,20 +53,20 @@ for LARCH in $ARCHLIST ; do # LARCH4=`expr "$LARCH" : "\(....\)"` # LARCH6=`expr "$LARCH" : "\(......\)"` case $LARCH in - SUPER-UX) FARCH=SX4; break ;; - AIX|RIOS) FARCH=rs6000; break ;; - HP-UX) + SUPER-UX) FARCH=SX4; break ;; + AIX|RIOS) FARCH=rs6000; break ;; + HP-UX) if [ -a /dev/kmem ] ; then FARCH=hpux ; else FARCH=sppux ; fi break ;; - IRIX64|IRIX) FARCH=$LARCH ; break ;; - Linux) FARCH=LINUX ; break ;; - i586|i486|i86pc) + IRIX64|IRIX) FARCH=$LARCH ; break ;; + Linux) FARCH=LINUX ; break ;; + i586|i486|i86pc) GARCH=$LARCH ;; - sun4*) + sun4*) Version=`$UNAME -r` # In "improving" SunOS, the useful feature of "substr" was withdrawn # from expr. Can't let the users have life too easy, can we? This @@ -81,21 +81,27 @@ for LARCH in $ARCHLIST ; do FARCH=sun4 fi break ;; - hp9000*|hp7000*) + hp9000*|hp7000*) if [ -a /dev/kmem ] ; then FARCH=hpux ; else FARCH=sppux ; fi break ;; - mips|dec-5000) FARCH=dec5000 ; break ;; - IP12|iris-4d) GARCH=IRIX ;; - cray|CRAY*) GARCH=CRAY ;; + Darwin*) + FARCH=Darwin + break ;; + + mips|dec-5000) FARCH=dec5000 ; break ;; next) FARCH=NeXT ; break ;; KSR1|KSR2) FARCH=ksr ; break ;; FreeBSD) FARCH=freebsd ; break ;; OpenBSD) FARCH=openbsd ; break ;; NetBSD) FARCH=netbsd ; break ;; + + # The following are guesses + IP12|iris-4d) GARCH=IRIX ;; + cray|CRAY*) GARCH=CRAY ;; i386) GARCH=ipsc2 ;; ULTRIX|RISC) GARCH=dec5000 ;; esac -- 2.11.4.GIT