1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *   Copyright (C) 1997 University of Chicago.
5  *   See COPYRIGHT notice in top-level directory.
6  */
7 
8 #include "mpioimpl.h"
9 
10 #ifdef HAVE_WEAK_SYMBOLS
11 
12 #if defined(HAVE_PRAGMA_WEAK)
13 #pragma weak MPI_File_read_all_end = PMPI_File_read_all_end
14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
15 #pragma _HP_SECONDARY_DEF PMPI_File_read_all_end MPI_File_read_all_end
16 #elif defined(HAVE_PRAGMA_CRI_DUP)
17 #pragma _CRI duplicate MPI_File_read_all_end as PMPI_File_read_all_end
18 /* end of weak pragmas */
19 #elif defined(HAVE_WEAK_ATTRIBUTE)
20 int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status *status) __attribute__((weak,alias("PMPI_File_read_all_end")));
21 #endif
22 
23 /* Include mapping from MPI->PMPI */
24 #define MPIO_BUILD_PROFILING
25 #include "mpioprof.h"
26 #endif
27 
28 /*@
29     MPI_File_read_all_end - Complete a split collective read using
30     individual file pointer
31 
32 Input Parameters:
33 . fh - file handle (handle)
34 
35 Output Parameters:
36 . buf - initial address of buffer (choice)
37 . status - status object (Status)
38 
39 .N fortran
40 @*/
MPI_File_read_all_end(MPI_File fh,void * buf,MPI_Status * status)41 int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status *status)
42 {
43     int error_code;
44     static char myname[] = "MPI_FILE_IREAD";
45 
46     error_code = MPIOI_File_read_all_end(fh, buf, myname, status);
47 
48     return error_code;
49 }
50 
51 /* prevent multiple definitions of this routine */
52 #ifdef MPIO_BUILD_PROFILING
MPIOI_File_read_all_end(MPI_File fh,void * buf,char * myname,MPI_Status * status)53 int MPIOI_File_read_all_end(MPI_File fh,
54 			    void *buf,
55 			    char *myname,
56 			    MPI_Status *status)
57 {
58     int error_code = MPI_SUCCESS;
59     ADIO_File adio_fh;
60 
61     MPIU_UNREFERENCED_ARG(buf);
62 
63     MPIU_THREAD_CS_ENTER(ALLFUNC,);
64 
65     adio_fh = MPIO_File_resolve(fh);
66 
67     /* --BEGIN ERROR HANDLING-- */
68     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
69 
70     if (!(adio_fh->split_coll_count)) {
71 	error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
72 					  myname, __LINE__, MPI_ERR_IO,
73 					  "**iosplitcollnone", 0);
74 	error_code = MPIO_Err_return_file(adio_fh, error_code);
75 	goto fn_exit;
76     }
77     /* --END ERROR HANDLING-- */
78 
79 #ifdef HAVE_STATUS_SET_BYTES
80     if (status != MPI_STATUS_IGNORE)
81        *status = adio_fh->split_status;
82 #endif
83     adio_fh->split_coll_count = 0;
84 
85 fn_exit:
86     MPIU_THREAD_CS_EXIT(ALLFUNC,);
87 
88     return error_code;
89 }
90 #endif
91