1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2006 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2008-2013 University of Houston. All rights reserved.
13 * Copyright (c) 2018 Research Organization for Information Science
14 * and Technology (RIST). All rights reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 *
21 * These symbols are in a file by themselves to provide nice linker
22 * semantics. Since linkers generally pull in symbols by object fules,
23 * keeping these symbols as the only symbols in this file prevents
24 * utility programs such as "ompi_info" from having to import entire
25 * modules just to query their version and parameters
26 */
27
28 #include "ompi_config.h"
29 #include "mpi.h"
30 #include "ompi/mca/sharedfp/sharedfp.h"
31 #include "ompi/mca/sharedfp/base/base.h"
32 #include "ompi/mca/sharedfp/sm/sharedfp_sm.h"
33
34 /*
35 * *******************************************************************
36 * ************************ actions structure ************************
37 * *******************************************************************
38 */
39 /* IMPORTANT: Update here when adding sharedfp component interface functions*/
40 static mca_sharedfp_base_module_1_0_0_t sm = {
41 mca_sharedfp_sm_module_init, /* initalise after being selected */
42 mca_sharedfp_sm_module_finalize, /* close a module on a communicator */
43 mca_sharedfp_sm_seek,
44 mca_sharedfp_sm_get_position,
45 mca_sharedfp_sm_read,
46 mca_sharedfp_sm_read_ordered,
47 mca_sharedfp_sm_read_ordered_begin,
48 mca_sharedfp_sm_read_ordered_end,
49 mca_sharedfp_sm_iread,
50 mca_sharedfp_sm_write,
51 mca_sharedfp_sm_write_ordered,
52 mca_sharedfp_sm_write_ordered_begin,
53 mca_sharedfp_sm_write_ordered_end,
54 mca_sharedfp_sm_iwrite,
55 mca_sharedfp_sm_file_open,
56 mca_sharedfp_sm_file_close
57 };
58 /*
59 * *******************************************************************
60 * ************************* structure ends **************************
61 * *******************************************************************
62 */
63
64 int mca_sharedfp_sm_component_init_query(bool enable_progress_threads,
65 bool enable_mpi_threads)
66 {
67 /* Nothing to do */
68
69 return OMPI_SUCCESS;
70 }
71
72 struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_sm_component_file_query(ompio_file_t *fh, int *priority)
73 {
74 int i;
75 ompi_proc_t *proc;
76 ompi_communicator_t * comm = fh->f_comm;
77 int size = ompi_comm_size(comm);
78
79 *priority = 0;
80
81 /* test, and update priority. All processes have to be
82 ** on a single node.
83 ** original test copied from mca/coll/sm/coll_sm_module.c:
84 */
85 ompi_group_t *group = comm->c_local_group;
86
87 for (i = 0; i < size; ++i) {
88 proc = ompi_group_peer_lookup(group,i);
89 if (!OPAL_PROC_ON_LOCAL_NODE(proc->super.proc_flags)){
90 opal_output(ompi_sharedfp_base_framework.framework_output,
91 "mca_sharedfp_sm_component_file_query: Disqualifying myself: (%d/%s) "
92 "not all processes are on the same node.",
93 comm->c_contextid, comm->c_name);
94 return NULL;
95 }
96 }
97 /* This module can run */
98 *priority = mca_sharedfp_sm_priority;
99 return &sm;
100 }
101
102 int mca_sharedfp_sm_component_file_unquery (ompio_file_t *file)
103 {
104 /* This function might be needed for some purposes later. for now it
105 * does not have anything to do since there are no steps which need
106 * to be undone if this module is not selected */
107
108 return OMPI_SUCCESS;
109 }
110
111 int mca_sharedfp_sm_module_init (ompio_file_t *file)
112 {
113 return OMPI_SUCCESS;
114 }
115
116
117 int mca_sharedfp_sm_module_finalize (ompio_file_t *file)
118 {
119 return OMPI_SUCCESS;
120 }