1111 * Copyright (c) 2004-2005 The Regents of the University of California.
1212 * All rights reserved.
1313 * Copyright (c) 2008-2016 University of Houston. All rights reserved.
14- * Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
15- * Copyright (c) 2012-2013 Inria. All rights reserved.
16- * Copyright (c) 2015 Research Organization for Information Science
17- * and Technology (RIST). All rights reserved.
14+ *
1815 * $COPYRIGHT$
1916 *
2017 * Additional copyrights may follow
2724#include "ompi/communicator/communicator.h"
2825#include "ompi/datatype/ompi_datatype.h"
2926
30- #include "common_ompio_print_queue .h"
27+ #include "ompi/mca/common/ompio/common_ompio .h"
3128
32- mca_common_ompio_print_queue * coll_write_time = NULL ;
33- mca_common_ompio_print_queue * coll_read_time = NULL ;
3429
3530/* Print queue related function implementations */
36- int common_ompio_set_print_queue (mca_common_ompio_print_queue * * q ,
37- int queue_type ){
38-
39- int ret = OMPI_SUCCESS ;
40-
41- switch (queue_type ) {
42-
43- case WRITE_PRINT_QUEUE :
44- * q = coll_write_time ;
45- break ;
46- case READ_PRINT_QUEUE :
47- * q = coll_read_time ;
48- break ;
49- }
50-
51- if (NULL == q ){
52- ret = OMPI_ERROR ;
53- }
54- return ret ;
55-
56- }
57-
31+ int mca_common_ompio_initialize_print_queue ( mca_common_ompio_print_queue * * r ){
5832
59- int common_ompio_initialize_print_queue (void * r ){
60-
61- mca_common_ompio_print_queue * q ;
33+ mca_common_ompio_print_queue * q = NULL ;
6234 int ret = OMPI_SUCCESS ;
6335
6436 q = (mca_common_ompio_print_queue * ) malloc ( sizeof (mca_common_ompio_print_queue ));
6537 if ( NULL == q ) {
6638 ret = OMPI_ERR_OUT_OF_RESOURCE ;
6739 }
6840 q -> first = 0 ;
69- q -> last = COMMON_OMPIO_QUEUESIZE - 1 ;
41+ q -> last = MCA_COMMON_OMPIO_QUEUESIZE - 1 ;
7042 q -> count = 0 ;
7143
72- * r = ( void * ) * q ;
44+ * r = q ;
7345 return ret ;
7446}
75- int common_ompio_register_print_entry (int queue_type ,
76- mca_common_ompio_print_entry x ){
7747
78- int ret = OMPI_SUCCESS ;
79- mca_common_ompio_print_queue * q = NULL ;
80-
81- ret = common_ompio_set_print_queue (& q , queue_type );
82-
83- if (ret != OMPI_ERROR ){
84- if (q -> count >= COMMON_OMPIO_QUEUESIZE ){
85- return OMPI_ERROR ;
86- }
87- else {
88- q -> last = (q -> last + 1 ) % COMMON_OMPIO_QUEUESIZE ;
89- q -> entry [q -> last ] = x ;
90- q -> count = q -> count + 1 ;
91- }
48+ int mca_common_ompio_register_print_entry ( mca_common_ompio_print_queue * q ,
49+ mca_common_ompio_print_entry x )
50+ {
51+ if (q -> count >= MCA_COMMON_OMPIO_QUEUESIZE ){
52+ return OMPI_ERROR ;
9253 }
93- return ret ;
94- }
95-
96- int common_ompio_unregister_print_entry (int queue_type ,
97- mca_common_ompio_print_entry * x ){
98-
99- int ret = OMPI_SUCCESS ;
100- mca_common_ompio_print_queue * q = NULL ;
101- ret = common_ompio_set_print_queue (& q , queue_type );
102- if (ret != OMPI_ERROR ){
103- if (q -> count <= 0 ){
104- return OMPI_ERROR ;
105- }
106- else {
107- * x = q -> entry [q -> first ];
108- q -> first = (q -> first + 1 ) % COMMON_OMPIO_QUEUESIZE ;
109- q -> count = q -> count - 1 ;
110- }
54+ else {
55+ q -> last = (q -> last + 1 ) % MCA_COMMON_OMPIO_QUEUESIZE ;
56+ q -> entry [q -> last ] = x ;
57+ q -> count = q -> count + 1 ;
11158 }
59+
11260 return OMPI_SUCCESS ;
11361}
11462
115- int common_ompio_empty_print_queue (int queue_type ){
116-
117- int ret = OMPI_SUCCESS ;
118- mca_common_ompio_print_queue * q = NULL ;
119- ret = common_ompio_set_print_queue (& q , queue_type );
120-
121- assert (ret != OMPI_ERROR );
122- (void )ret ; // silence compiler warning
123- if (q -> count == 0 )
124- return 1 ;
125- else
126- return 0 ;
63+ int mca_common_ompio_unregister_print_entry ( mca_common_ompio_print_queue * q ,
64+ mca_common_ompio_print_entry * x )
65+ {
12766
67+ if (q -> count <= 0 ){
68+ return OMPI_ERROR ;
69+ }
70+ else {
71+ * x = q -> entry [q -> first ];
72+ q -> first = (q -> first + 1 ) % MCA_COMMON_OMPIO_QUEUESIZE ;
73+ q -> count = q -> count - 1 ;
74+ }
12875
76+ return OMPI_SUCCESS ;
12977}
13078
131- int common_ompio_full_print_queue (int queue_type ){
132-
133-
134- int ret = OMPI_SUCCESS ;
135- mca_common_ompio_print_queue * q = NULL ;
136- ret = common_ompio_set_print_queue (& q , queue_type );
79+ int mca_common_ompio_empty_print_queue (mca_common_ompio_print_queue * q )
80+ {
81+ if (q -> count == 0 ) {
82+ return 1 ;
83+ }
84+
85+ return 0 ;
86+ }
13787
138- assert ( ret != OMPI_ERROR );
139- (void )ret ; // silence compiler warning
140- if (q -> count < COMMON_OMPIO_QUEUESIZE )
141- return 0 ;
142- else
143- return 1 ;
88+ int mca_common_ompio_full_print_queue (mca_common_ompio_print_queue * q )
89+ {
90+ if (q -> count < MCA_COMMON_OMPIO_QUEUESIZE ) {
91+ return 0 ;
92+ }
14493
94+ return 1 ;
14595}
14696
14797
148- int common_ompio_print_time_info ( int queue_type ,
149- char * name ,
150- mca_io_ompio_file_t * fh ){
98+ int mca_common_ompio_print_time_info ( mca_common_ompio_print_queue * q ,
99+ char * name ,
100+ struct mca_io_ompio_file_t * fh ){
151101
152102 int i = 0 , j = 0 , nprocs_for_coll = 0 , ret = OMPI_SUCCESS , count = 0 ;
153103 double * time_details = NULL , * final_sum = NULL ;
154104 double * final_max = NULL , * final_min = NULL ;
155105 double * final_time_details = NULL ;
156- mca_common_ompio_print_queue * q = NULL ;
157-
158- ret = common_ompio_set_print_queue (& q , queue_type );
159106
160- assert (ret != OMPI_ERROR );
161107 nprocs_for_coll = q -> entry [0 ].nprocs_for_coll ;
162- time_details = (double * ) malloc (4 * sizeof (double ));
108+ time_details = (double * ) calloc (4 , sizeof (double ));
163109 if ( NULL == time_details ){
164110 ret = OMPI_ERR_OUT_OF_RESOURCE ;
165111 goto exit ;
@@ -187,24 +133,13 @@ int common_ompio_print_time_info(int queue_type,
187133 goto exit ;
188134 }
189135
190- final_time_details =
191- (double * )malloc
192- (fh -> f_size * 4 * sizeof (double ));
136+ final_time_details = (double * )calloc (fh -> f_size , 4 * sizeof (double ));
193137 if (NULL == final_time_details ){
194138 ret = OMPI_ERR_OUT_OF_RESOURCE ;
195139 goto exit ;
196140 }
197141
198142 count = 4 * fh -> f_size ;
199- for (i = 0 ;i < count ;i ++ ){
200- final_time_details [i ] = 0.0 ;
201- }
202-
203-
204- }
205-
206- for (i = 0 ; i < 4 ; i ++ ){
207- time_details [i ] = 0.0 ;
208143 }
209144
210145 if (q -> count > 0 ){
@@ -221,17 +156,18 @@ int common_ompio_print_time_info(int queue_type,
221156 }
222157 }
223158
224- fh -> f_comm -> c_coll .coll_gather (time_details ,
225- 4 ,
226- MPI_DOUBLE ,
227- final_time_details ,
228- 4 ,
229- MPI_DOUBLE ,
230- 0 ,
231- fh -> f_comm ,
232- fh -> f_comm -> c_coll .coll_gather_module );
233-
234-
159+ ret = fh -> f_comm -> c_coll .coll_gather (time_details ,
160+ 4 ,
161+ MPI_DOUBLE ,
162+ final_time_details ,
163+ 4 ,
164+ MPI_DOUBLE ,
165+ 0 ,
166+ fh -> f_comm ,
167+ fh -> f_comm -> c_coll .coll_gather_module );
168+
169+ if ( OMPI_SUCCESS != ret ) {
170+ }
235171
236172 if (!fh -> f_rank ){
237173
0 commit comments