This source file includes following definitions.
- MPI_File_set_atomicity
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_set_atomicity = PMPI_File_set_atomicity
14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
15 #pragma _HP_SECONDARY_DEF PMPI_File_set_atomicity MPI_File_set_atomicity
16 #elif defined(HAVE_PRAGMA_CRI_DUP)
17 #pragma _CRI duplicate MPI_File_set_atomicity as PMPI_File_set_atomicity
18
19 #elif defined(HAVE_WEAK_ATTRIBUTE)
20 int MPI_File_set_atomicity(MPI_File fh, int flag) __attribute__((weak,alias("PMPI_File_set_atomicity")));
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
37 int MPI_File_set_atomicity(MPI_File fh, int flag)
38 {
39 int error_code, tmp_flag;
40 static char myname[] = "MPI_FILE_SET_ATOMICITY";
41 ADIO_Fcntl_t *fcntl_struct;
42 ADIO_File adio_fh;
43
44 ROMIO_THREAD_CS_ENTER();
45
46 adio_fh = MPIO_File_resolve(fh);
47
48
49 MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
50
51
52 ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code);
53
54 if (flag) flag = 1;
55
56
57 tmp_flag = flag;
58 MPI_Bcast(&tmp_flag, 1, MPI_INT, 0, adio_fh->comm);
59
60
61 if (tmp_flag != flag) {
62 error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
63 myname, __LINE__, MPI_ERR_ARG,
64 "**notsame", 0);
65 error_code = MPIO_Err_return_file(adio_fh, error_code);
66 goto fn_exit;
67 }
68
69
70 if (adio_fh->atomicity == flag){
71 error_code = MPI_SUCCESS;
72 goto fn_exit;
73 }
74
75
76 fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t));
77 fcntl_struct->atomicity = flag;
78 ADIO_Fcntl(adio_fh, ADIO_FCNTL_SET_ATOMICITY, fcntl_struct, &error_code);
79
80
81
82 if (error_code != MPI_SUCCESS)
83 error_code = MPIO_Err_return_file(adio_fh, error_code);
84
85
86 ADIOI_Free(fcntl_struct);
87
88 fn_exit:
89 ROMIO_THREAD_CS_EXIT();
90 return error_code;
91 }