This source file includes following definitions.
- MPI_File_close
1
2
3
4
5
6
7
8 #include "mpioimpl.h"
9
10 #ifdef HAVE_WEAK_SYMBOLS
11
12 #if defined(HAVE_PRAGMA_WEAK)
13 #pragma weak MPI_File_close = PMPI_File_close
14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
15 #pragma _HP_SECONDARY_DEF PMPI_File_close MPI_File_close
16 #elif defined(HAVE_PRAGMA_CRI_DUP)
17 #pragma _CRI duplicate MPI_File_close as PMPI_File_close
18
19 #elif defined(HAVE_WEAK_ATTRIBUTE)
20 int MPI_File_close(MPI_File *fh) __attribute__((weak,alias("PMPI_File_close")));
21 #endif
22
23
24 #define MPIO_BUILD_PROFILING
25 #include "mpioprof.h"
26 #endif
27
28
29
30
31
32
33
34
35
36 int MPI_File_close(MPI_File *fh)
37 {
38 int error_code;
39 ADIO_File adio_fh;
40 static char myname[] = "MPI_FILE_CLOSE";
41 #ifdef MPI_hpux
42 int fl_xmpi;
43
44 HPMP_IO_WSTART(fl_xmpi, BLKMPIFILECLOSE, TRDTBLOCK, *adio_fh);
45 #endif
46
47 ROMIO_THREAD_CS_ENTER();
48
49 adio_fh = MPIO_File_resolve(*fh);
50
51
52 MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
53
54
55 if (ADIO_Feature(adio_fh, ADIO_SHARED_FP))
56 {
57 ADIOI_Free((adio_fh)->shared_fp_fname);
58
59
60
61
62
63 MPI_Barrier((adio_fh)->comm);
64 if ((adio_fh)->shared_fp_fd != ADIO_FILE_NULL) {
65 MPI_File *fh_shared = &(adio_fh->shared_fp_fd);
66 ADIO_Close((adio_fh)->shared_fp_fd, &error_code);
67 MPIO_File_free(fh_shared);
68
69 if (error_code != MPI_SUCCESS) goto fn_fail;
70
71 }
72 }
73
74
75
76
77
78
79
80
81
82 #if 0
83 error_code = PMPI_File_set_errhandler(*fh, MPI_ERRORS_RETURN);
84 if (error_code != MPI_SUCCESS) goto fn_fail;
85 #endif
86
87 ADIO_Close(adio_fh, &error_code);
88 MPIO_File_free(fh);
89
90 if (error_code != MPI_SUCCESS) goto fn_fail;
91
92
93 #ifdef MPI_hpux
94 HPMP_IO_WEND(fl_xmpi);
95 #endif
96
97 fn_exit:
98 ROMIO_THREAD_CS_EXIT();
99 return error_code;
100 fn_fail:
101
102 error_code = MPIO_Err_return_file(adio_fh, error_code);
103 goto fn_exit;
104
105 }