Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit f9a689f

Browse files
committed
cleanup the usage of printf vs. opal_output
1 parent eb4b932 commit f9a689f

17 files changed

+217
-128
lines changed

ompi/mca/sharedfp/individual/sharedfp_individual.c

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2013 University of Houston. All rights reserved.
12+
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
1313
* $COPYRIGHT$
1414
*
1515
* Additional copyrights may follow
@@ -26,6 +26,7 @@
2626
#include "ompi_config.h"
2727
#include "mpi.h"
2828
#include "ompi/mca/sharedfp/sharedfp.h"
29+
#include "ompi/mca/sharedfp/base/base.h"
2930
#include "ompi/mca/sharedfp/individual/sharedfp_individual.h"
3031

3132
/*
@@ -84,14 +85,16 @@ struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_individual_component_file
8485
if ( amode & MPI_MODE_WRONLY || amode & MPI_MODE_RDWR ) {
8586
wronly_flag=true;
8687
if ( mca_sharedfp_individual_verbose ) {
87-
printf("mca_sharedfp_individual_component_file_query: "
88-
"MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
88+
opal_output(ompi_sharedfp_base_framework.framework_output,
89+
"mca_sharedfp_individual_component_file_query: "
90+
"MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
8991
}
9092
} else {
9193
wronly_flag=false;
9294
if ( mca_sharedfp_individual_verbose ) {
93-
printf("mca_sharedfp_individual_component_file_query: Can not run!, "
94-
"MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
95+
opal_output(ompi_sharedfp_base_framework.framework_output,
96+
"mca_sharedfp_individual_component_file_query: Can not run!, "
97+
"MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
9598
}
9699
}
97100

@@ -102,27 +105,30 @@ struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_individual_component_file
102105
valuelen = MPI_MAX_INFO_VAL;
103106
ompi_info_get ( info,"OMPIO_SHAREDFP_RELAXED_ORDERING", valuelen, value, &flag);
104107
if ( flag ) {
105-
if ( mca_sharedfp_individual_verbose ) {
106-
printf("mca_sharedfp_individual_component_file_query: "
107-
"OMPIO_SHAREDFP_RELAXED_ORDERING=%s\n",value);
108+
if ( mca_sharedfp_individual_verbose ) {
109+
opal_output(ompi_sharedfp_base_framework.framework_output,
110+
"mca_sharedfp_individual_component_file_query: "
111+
"OMPIO_SHAREDFP_RELAXED_ORDERING=%s\n",value);
108112
}
109113
/* flag - Returns true if key defined, false if not (boolean). */
110114
relaxed_order_flag=true;
111-
}
112-
else {
113-
if ( mca_sharedfp_individual_verbose ) {
114-
printf("mca_sharedfp_individual_component_file_query: "
115-
"OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set. "
116-
"Set this key in order to increase this component's priority value.\n");
115+
}
116+
else {
117+
if ( mca_sharedfp_individual_verbose ) {
118+
opal_output(ompi_sharedfp_base_framework.framework_output,
119+
"mca_sharedfp_individual_component_file_query: "
120+
"OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set. "
121+
"Set this key in order to increase this component's priority value.\n");
117122
}
118123
}
119124
}
120125
else {
121126
if ( mca_sharedfp_individual_verbose ) {
122-
printf("mca_sharedfp_individual_component_file_query: "
123-
"OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set, "
124-
"got MPI_INFO_NULL. Set this key in order to increase "
125-
"this component's priority value.\n");
127+
opal_output(ompi_sharedfp_base_framework.framework_output,
128+
"mca_sharedfp_individual_component_file_query: "
129+
"OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set, "
130+
"got MPI_INFO_NULL. Set this key in order to increase "
131+
"this component's priority value.\n");
126132
}
127133
}
128134

ompi/mca/sharedfp/individual/sharedfp_individual_collaborate_data.c

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2013 University of Houston. All rights reserved.
12+
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
1313
* $COPYRIGHT$
1414
*
1515
* Additional copyrights may follow
@@ -24,6 +24,7 @@
2424
#include "mpi.h"
2525
#include "ompi/constants.h"
2626
#include "ompi/mca/sharedfp/sharedfp.h"
27+
#include "ompi/mca/sharedfp/base/base.h"
2728
#include "ompi/mca/io/ompio/io_ompio.h"
2829

2930
#include <stdlib.h>
@@ -55,8 +56,8 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
5556

5657
headnode = (mca_sharedfp_individual_header_record*)sh->selected_module_data;
5758
if ( NULL == headnode) {
58-
opal_output(0, "sharedfp_individual_collaborate_data: headnode is NULL but file is open\n");
59-
return OMPI_ERROR;
59+
opal_output(0, "sharedfp_individual_collaborate_data: headnode is NULL but file is open\n");
60+
return OMPI_ERROR;
6061
}
6162

6263
/* Number of nodes on each process is the sum of records
@@ -65,7 +66,8 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
6566
nodesoneachprocess = headnode->numofrecordsonfile + headnode->numofrecords;
6667

6768
if ( mca_sharedfp_individual_verbose ) {
68-
printf("Nodes of each process = %d\n",nodesoneachprocess);
69+
opal_output(ompi_sharedfp_base_framework.framework_output,
70+
"Nodes of each process = %d\n",nodesoneachprocess);
6971
}
7072

7173
countbuff = (int*)malloc(size * sizeof(int));
@@ -93,7 +95,7 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
9395

9496
if ( mca_sharedfp_individual_verbose) {
9597
for (i = 0; i < size ; i++) {
96-
printf("sharedfp_individual_collaborate_data: Countbuff[%d] = %d\n", i, countbuff[i]);
98+
opal_output(ompi_sharedfp_base_framework.framework_output,"sharedfp_individual_collaborate_data: Countbuff[%d] = %d\n", i, countbuff[i]);
9799
}
98100
}
99101

@@ -106,8 +108,9 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
106108
for(i = 0; i < size; i++) {
107109
displ[i] = totalnodes;
108110
if ( mca_sharedfp_individual_verbose ) {
109-
printf("sharedfp_individual_collaborate_data: displ[%d] = %d\n",i,displ[i]);
110-
}
111+
opal_output(ompi_sharedfp_base_framework.framework_output,
112+
"sharedfp_individual_collaborate_data: displ[%d] = %d\n",i,displ[i]);
113+
}
111114
totalnodes = totalnodes + countbuff[i];
112115
}
113116

@@ -156,10 +159,11 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
156159
idx = mca_sharedfp_individual_getoffset(ind_ts[i],timestampbuff,totalnodes);
157160

158161
if ( mca_sharedfp_individual_verbose ) {
159-
printf("sharedfp_individual_collaborate_data: Process %d writing %ld bytes to main file \n",
160-
rank,ind_recordlength[i]);
161-
}
162-
162+
opal_output(ompi_sharedfp_base_framework.framework_output,
163+
"sharedfp_individual_collaborate_data: Process %d writing %ld bytes to main file \n",
164+
rank,ind_recordlength[i]);
165+
}
166+
163167
/*Write into main data file*/
164168
ompio_io_ompio_file_write_at( sh->sharedfh, offsetbuff[idx], buff,
165169
ind_recordlength[i], MPI_BYTE, &status);
@@ -212,7 +216,7 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
212216
currnode = headnode->next;
213217

214218
if ( mca_sharedfp_individual_verbose ) {
215-
printf("Num is %d\n",num);
219+
opal_output(ompi_sharedfp_base_framework.framework_output,"Num is %d\n",num);
216220
}
217221

218222
if ( 0 == num ) {
@@ -235,8 +239,9 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
235239
}
236240

237241
if ( mca_sharedfp_individual_verbose ) {
238-
printf("sharedfp_individual_get_timestamps_and_reclengths: Numofrecords on file %d\n",
239-
headnode->numofrecordsonfile);
242+
opal_output(ompi_sharedfp_base_framework.framework_output,
243+
"sharedfp_individual_get_timestamps_and_reclengths: Numofrecords on file %d\n",
244+
headnode->numofrecordsonfile);
240245
}
241246

242247
if (headnode->numofrecordsonfile > 0) {
@@ -252,9 +257,10 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
252257

253258
metaoffset = metaoffset + sizeof(struct mca_sharedfp_individual_record2);
254259

255-
if ( mca_sharedfp_individual_verbose ) {
256-
printf("sharedfp_individual_get_timestamps_and_reclengths: Ctr = %d\n",ctr);
257-
}
260+
if ( mca_sharedfp_individual_verbose ) {
261+
opal_output(ompi_sharedfp_base_framework.framework_output,
262+
"sharedfp_individual_get_timestamps_and_reclengths: Ctr = %d\n",ctr);
263+
}
258264
ctr++;
259265
}
260266

@@ -266,9 +272,9 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
266272
/* Add the records from the linked list */
267273
currnode = headnode->next;
268274
while (currnode) {
269-
if ( mca_sharedfp_individual_verbose ) {
270-
printf("Ctr = %d\n",ctr);
271-
}
275+
if ( mca_sharedfp_individual_verbose ) {
276+
opal_output(ompi_sharedfp_base_framework.framework_output,"Ctr = %d\n",ctr);
277+
}
272278
/* Some error over here..need to check this code again */
273279
/*while(headnode->next != NULL)*/
274280

@@ -279,9 +285,10 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
279285
ctr = ctr + 1;
280286

281287
headnode->next = currnode->next;
282-
if ( mca_sharedfp_individual_verbose ) {
283-
printf("sharedfp_individual_get_timestamps_and_reclengths: node deleted from the metadatalinked list\n");
284-
}
288+
if ( mca_sharedfp_individual_verbose ) {
289+
opal_output(ompi_sharedfp_base_framework.framework_output,
290+
"sharedfp_individual_get_timestamps_and_reclengths: node deleted from the metadatalinked list\n");
291+
}
285292
free(currnode);
286293
currnode = headnode->next;
287294

ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2013 University of Houston. All rights reserved.
12+
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
1313
* $COPYRIGHT$
1414
*
1515
* Additional copyrights may follow
@@ -79,7 +79,8 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
7979
/* NOTE: Open the data file without shared file pointer */
8080
/*--------------------------------------------------------*/
8181
if ( mca_sharedfp_individual_verbose ) {
82-
printf("mca_sharedfp_individual_file_open: open data file.\n");
82+
opal_output(ompi_sharedfp_base_framework.framework_output,
83+
"mca_sharedfp_individual_file_open: open data file.\n");
8384
}
8485

8586
/* data filename created by appending .data.$rank to the original filename*/
@@ -104,7 +105,8 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
104105
/* NOTE: Open the meta file without shared file pointer */
105106
/*----------------------------------------------------------*/
106107
if ( mca_sharedfp_individual_verbose ) {
107-
printf("mca_sharedfp_individual_file_open: metadata file.\n");
108+
opal_output(ompi_sharedfp_base_framework.framework_output,
109+
"mca_sharedfp_individual_file_open: metadata file.\n");
108110
}
109111

110112
/* metadata filename created by appending .metadata.$rank to the original filename*/
@@ -160,7 +162,8 @@ int mca_sharedfp_individual_file_close (mca_io_ompio_file_t *fh)
160162

161163
if ( NULL == fh->f_sharedfp_data ){
162164
if ( mca_sharedfp_individual_verbose ) {
163-
printf("sharedfp_inidividual_file_close - shared file pointer structure not initialized\n");
165+
opal_output(ompi_sharedfp_base_framework.framework_output,
166+
"sharedfp_inidividual_file_close - shared file pointer structure not initialized\n");
164167
}
165168
return OMPI_SUCCESS;
166169
}

ompi/mca/sharedfp/individual/sharedfp_individual_insert_metadata.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2013 University of Houston. All rights reserved.
12+
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
1313
* $COPYRIGHT$
1414
*
1515
* Additional copyrights may follow
@@ -24,6 +24,7 @@
2424
#include "mpi.h"
2525
#include "ompi/constants.h"
2626
#include "ompi/mca/sharedfp/sharedfp.h"
27+
#include "ompi/mca/sharedfp/base/base.h"
2728

2829
#include <stdlib.h>
2930
#include <stdio.h>
@@ -44,8 +45,9 @@ int mca_sharedfp_individual_insert_metadata(int functype,long recordlength,struc
4445

4546

4647
if ( mca_sharedfp_individual_verbose ) {
47-
printf("sharedfp_individual_insert_metadata: Headnode->numofrecords = %d\n",
48-
headnode->numofrecords);
48+
opal_output(ompi_sharedfp_base_framework.framework_output,
49+
"sharedfp_individual_insert_metadata: Headnode->numofrecords = %d\n",
50+
headnode->numofrecords);
4951
}
5052
/* Check if the maximum limit is reached for the records in the linked list*/
5153
if (headnode->numofrecords == MAX_METADATA_RECORDS) {
@@ -113,12 +115,17 @@ int mca_sharedfp_individual_write_metadata_file(struct mca_sharedfp_base_data_t
113115
buff.recordlength = current->recordlength;
114116

115117
if ( mca_sharedfp_individual_verbose ) {
116-
printf("sharedfp_individual_write_metadata_file: Buff recordid %ld\n",buff.recordid);
117-
printf("sharedfp_individual_write_metadata_file: Buff timestamp %f\n", buff.timestamp);
118-
printf("sharedfp_individual_write_metadata_file: Buff localposition %lld\n",buff.localposition);
119-
printf("sharedfp_individual_write_metadata_file: Buff recordlength %ld\n",buff.recordlength);
120-
printf("sharedfp_individual_write_metadata_file: Size of buff %ld\n",sizeof(buff));
121-
}
118+
opal_output(ompi_sharedfp_base_framework.framework_output,
119+
"sharedfp_individual_write_metadata_file: Buff recordid %ld\n",buff.recordid);
120+
opal_output(ompi_sharedfp_base_framework.framework_output,
121+
"sharedfp_individual_write_metadata_file: Buff timestamp %f\n", buff.timestamp);
122+
opal_output(ompi_sharedfp_base_framework.framework_output,
123+
"sharedfp_individual_write_metadata_file: Buff localposition %lld\n",buff.localposition);
124+
opal_output(ompi_sharedfp_base_framework.framework_output,
125+
"sharedfp_individual_write_metadata_file: Buff recordlength %ld\n",buff.recordlength);
126+
opal_output(ompi_sharedfp_base_framework.framework_output,
127+
"sharedfp_individual_write_metadata_file: Size of buff %ld\n",sizeof(buff));
128+
}
122129

123130
headnode->next = current->next;
124131
free(current);

ompi/mca/sharedfp/individual/sharedfp_individual_read.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "mpi.h"
2525
#include "ompi/constants.h"
2626
#include "ompi/mca/sharedfp/sharedfp.h"
27+
#include "ompi/mca/sharedfp/base/base.h"
2728

2829
int mca_sharedfp_individual_read ( mca_io_ompio_file_t *fh,
2930
void *buf, int count, MPI_Datatype datatype, MPI_Status *status)

ompi/mca/sharedfp/individual/sharedfp_individual_write.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "mpi.h"
2525
#include "ompi/constants.h"
2626
#include "ompi/mca/sharedfp/sharedfp.h"
27+
#include "ompi/mca/sharedfp/base/base.h"
2728

2829
int mca_sharedfp_individual_write (mca_io_ompio_file_t *fh,
2930
void *buf,
@@ -40,7 +41,7 @@ int mca_sharedfp_individual_write (mca_io_ompio_file_t *fh,
4041

4142
if ( NULL == fh->f_sharedfp_data ) {
4243
if ( mca_sharedfp_individual_verbose ) {
43-
printf("sharedfp_individual_write: opening the shared file pointer file\n");
44+
opal_output(ompi_sharedfp_base_framework.framework_output,"sharedfp_individual_write: opening the shared file pointer file\n");
4445
}
4546
shared_fp_base_module = fh->f_sharedfp;
4647

@@ -104,7 +105,8 @@ int mca_sharedfp_individual_write_ordered (mca_io_ompio_file_t *fh,
104105

105106
if(fh->f_sharedfp_data==NULL){
106107
if ( mca_sharedfp_individual_verbose ) {
107-
printf("sharedfp_individual_write_ordered - opening the shared file pointer\n");
108+
opal_output(ompi_sharedfp_base_framework.framework_output,
109+
"sharedfp_individual_write_ordered - opening the shared file pointer\n");
108110
}
109111
shared_fp_base_module = fh->f_sharedfp;
110112

ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2013 University of Houston. All rights reserved.
12+
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
13+
* Copyright (c) 2015 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
1315
* $COPYRIGHT$
1416
*
1517
* Additional copyrights may follow
@@ -71,13 +73,15 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
7173

7274
/*Open a new file which will maintain the pointer for this file open*/
7375
if ( mca_sharedfp_lockedfile_verbose ) {
74-
printf("mca_sharedfp_lockedfile_file_open: open locked file.\n");
76+
opal_output(ompi_sharedfp_base_framework.framework_output,
77+
"mca_sharedfp_lockedfile_file_open: open locked file.\n");
7578
}
7679

7780

7881
module_data = (struct mca_sharedfp_lockedfile_data*)malloc(sizeof(struct mca_sharedfp_lockedfile_data));
7982
if ( NULL == module_data ) {
80-
printf("mca_sharedfp_lockedfile_file_open: Error, unable to malloc lockedfile_data struct\n");
83+
opal_output(ompi_sharedfp_base_framework.framework_output,
84+
"mca_sharedfp_lockedfile_file_open: Error, unable to malloc lockedfile_data struct\n");
8185
free (shfileHandle);
8286
free (sh);
8387
return OMPI_ERR_OUT_OF_RESOURCE;
@@ -103,7 +107,7 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
103107

104108
handle = open ( lockedfilename, O_RDWR, 0644 );
105109
if ( -1 == handle ) {
106-
printf("[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n", rank);
110+
opal_output(0, "[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n", rank);
107111
free (shfileHandle);
108112
free (sh);
109113
free(module_data);
@@ -132,7 +136,7 @@ int mca_sharedfp_lockedfile_file_close (mca_io_ompio_file_t *fh)
132136
if ( fh->f_sharedfp_data==NULL){
133137
/* Can happen with lazy_open being set */
134138
if ( mca_sharedfp_lockedfile_verbose ) {
135-
printf("sharedfp_lockedfile_file_close - shared file pointer structure not initialized\n");
139+
opal_output(0, "sharedfp_lockedfile_file_close - shared file pointer structure not initialized\n");
136140
}
137141
return OMPI_SUCCESS;
138142
}

0 commit comments

Comments
 (0)