AMPI #952: update ROMIO to MPICH2-1.4.1p1
[charm.git] / src / libs / ck-libs / ampi / romio / mpi-io / write_alle.c
blob4187552953ec5c6b566325729b7879b4417fbb1f
1 /* -*- Mode: C; c-basic-offset:4 ; -*- */
2 /*
4 * Copyright (C) 1997 University of Chicago.
5 * See COPYRIGHT notice in top-level directory.
6 */
8 #include "mpioimpl.h"
10 #ifdef HAVE_WEAK_SYMBOLS
12 #if defined(HAVE_PRAGMA_WEAK)
13 #pragma weak MPI_File_write_all_end = PMPI_File_write_all_end
14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
15 #pragma _HP_SECONDARY_DEF PMPI_File_write_all_end MPI_File_write_all_end
16 #elif defined(HAVE_PRAGMA_CRI_DUP)
17 #pragma _CRI duplicate MPI_File_write_all_end as PMPI_File_write_all_end
18 /* end of weak pragmas */
19 #endif
21 /* Include mapping from MPI->PMPI */
22 #define MPIO_BUILD_PROFILING
23 #include "mpioprof.h"
24 #endif
26 /*@
27 MPI_File_write_all_end - Complete a split collective write using individual file pointer
29 Input Parameters:
30 . fh - file handle (handle)
32 Output Parameters:
33 . buf - initial address of buffer (choice)
34 . status - status object (Status)
36 .N fortran
37 @*/
38 int MPI_File_write_all_end(MPI_File mpi_fh, void *buf, MPI_Status *status)
40 int error_code;
41 static char myname[] = "MPI_FILE_WRITE_ALL_END";
43 error_code = MPIOI_File_write_all_end(mpi_fh, buf, myname, status);
45 return error_code;
48 /* prevent multiple definitions of this routine */
49 // #ifdef MPIO_BUILD_PROFILING
50 int MPIOI_File_write_all_end(MPI_File mpi_fh,
51 void *buf,
52 char *myname,
53 MPI_Status *status)
55 int error_code;
56 ADIO_File fh;
58 MPIU_UNREFERENCED_ARG(buf);
60 MPIU_THREAD_CS_ENTER(ALLFUNC,);
62 fh = MPIO_File_resolve(mpi_fh);
64 /* --BEGIN ERROR HANDLING-- */
65 MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
67 if (!(fh->split_coll_count))
69 error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
70 myname, __LINE__, MPI_ERR_IO,
71 "**iosplitcollnone", 0);
72 error_code = MPIO_Err_return_file(fh, error_code);
73 goto fn_exit;
75 /* --END ERROR HANDLING-- */
77 #ifdef HAVE_STATUS_SET_BYTES
78 /* FIXME - we should really ensure that the split_datatype remains
79 valid by incrementing the ref count in the write_allb.c routine
80 and decrement it here after setting the bytes */
81 if (status != MPI_STATUS_IGNORE)
82 *status = fh->split_status;
83 #endif
84 fh->split_coll_count = 0;
86 error_code = MPI_SUCCESS;
88 fn_exit:
89 MPIU_THREAD_CS_EXIT(ALLFUNC,);
91 return error_code;
93 // #endif