Skip to content

Commit 3780089

Browse files
committed
clean up the usage of opal_output vs. printf
1 parent 824d488 commit 3780089

File tree

5 files changed

+72
-37
lines changed

5 files changed

+72
-37
lines changed

ompi/mca/sharedfp/individual/sharedfp_individual_iwrite.c

Lines changed: 6 additions & 3 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_iwrite(mca_io_ompio_file_t *fh,
2930
void *buf,
@@ -40,7 +41,8 @@ int mca_sharedfp_individual_iwrite(mca_io_ompio_file_t *fh,
4041

4142
if(fh->f_sharedfp_data==NULL){
4243
if ( mca_sharedfp_individual_verbose ) {
43-
printf("mca_sharedfp_individual_iwrite: opening the shared file pointer\n");
44+
opal_output(ompi_sharedfp_base_framework.framework_output,
45+
"mca_sharedfp_individual_iwrite: opening the shared file pointer\n");
4446
}
4547
shared_fp_base_module = fh->f_sharedfp;
4648

@@ -105,7 +107,8 @@ int mca_sharedfp_individual_write_ordered_begin(mca_io_ompio_file_t *fh,
105107

106108
if(fh->f_sharedfp_data==NULL){
107109
if ( mca_sharedfp_individual_verbose ) {
108-
printf("sharedfp_individual_write_ordered_begin - opening the shared file pointer\n");
110+
opal_output(ompi_sharedfp_base_framework.framework_output,
111+
"sharedfp_individual_write_ordered_begin - opening the shared file pointer\n");
109112
}
110113
shared_fp_base_module = fh->f_sharedfp;
111114

@@ -121,7 +124,7 @@ int mca_sharedfp_individual_write_ordered_begin(mca_io_ompio_file_t *fh,
121124
}
122125

123126
if ( true == fh->f_split_coll_in_use ) {
124-
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
127+
opal_output(0, "Only one split collective I/O operation allowed per file handle at any given point in time!\n");
125128
return MPI_ERR_REQUEST;
126129
}
127130

ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iread.c

Lines changed: 17 additions & 8 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
#include "ompi/mca/io/ompio/io_ompio.h"
2829

2930
int mca_sharedfp_lockedfile_iread(mca_io_ompio_file_t *fh,
@@ -41,7 +42,8 @@ int mca_sharedfp_lockedfile_iread(mca_io_ompio_file_t *fh,
4142

4243
if ( NULL == fh->f_sharedfp_data ) {
4344
if ( mca_sharedfp_lockedfile_verbose ) {
44-
printf("sharedfp_lockedfile_iread: opening the shared file pointer\n");
45+
opal_output(ompi_sharedfp_base_framework.framework_output,
46+
"sharedfp_lockedfile_iread: opening the shared file pointer\n");
4547
}
4648
shared_fp_base_module = fh->f_sharedfp;
4749

@@ -61,7 +63,8 @@ int mca_sharedfp_lockedfile_iread(mca_io_ompio_file_t *fh,
6163
bytesRequested = count * numofBytes;
6264

6365
if ( mca_sharedfp_lockedfile_verbose ) {
64-
printf("sharedfp_lockedfile_iread - Bytes Requested is %ld\n",bytesRequested);
66+
opal_output(ompi_sharedfp_base_framework.framework_output,
67+
"sharedfp_lockedfile_iread - Bytes Requested is %ld\n",bytesRequested);
6568
}
6669

6770

@@ -72,7 +75,8 @@ int mca_sharedfp_lockedfile_iread(mca_io_ompio_file_t *fh,
7275
ret = mca_sharedfp_lockedfile_request_position(sh,bytesRequested,&offset);
7376
if ( -1 != ret ) {
7477
if ( mca_sharedfp_lockedfile_verbose ) {
75-
printf("sharedfp_lockedfile_iread - Offset received is %lld\n",offset);
78+
opal_output(ompi_sharedfp_base_framework.framework_output,
79+
"sharedfp_lockedfile_iread - Offset received is %lld\n",offset);
7680
}
7781

7882
/* Read the file */
@@ -102,7 +106,8 @@ int mca_sharedfp_lockedfile_read_ordered_begin(mca_io_ompio_file_t *fh,
102106

103107
if(fh->f_sharedfp_data==NULL){
104108
if ( mca_sharedfp_lockedfile_verbose ) {
105-
printf("sharedfp_lockedfile_read_ordered_begin: opening the shared file pointer\n");
109+
opal_output(ompi_sharedfp_base_framework.framework_output,
110+
"sharedfp_lockedfile_read_ordered_begin: opening the shared file pointer\n");
106111
}
107112
shared_fp_base_module = fh->f_sharedfp;
108113

@@ -119,7 +124,8 @@ int mca_sharedfp_lockedfile_read_ordered_begin(mca_io_ompio_file_t *fh,
119124

120125

121126
if ( true == fh->f_split_coll_in_use ) {
122-
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
127+
opal_output(ompi_sharedfp_base_framework.framework_output,
128+
"Only one split collective I/O operation allowed per file handle at any given point in time!\n");
123129
return MPI_ERR_REQUEST;
124130
}
125131

@@ -155,7 +161,8 @@ int mca_sharedfp_lockedfile_read_ordered_begin(mca_io_ompio_file_t *fh,
155161
for ( i = 0; i < size ; i ++) {
156162
bytesRequested += buff[i];
157163
if ( mca_sharedfp_lockedfile_verbose ) {
158-
printf("sharedfp_lockedfile_read_ordered_begin: Bytes requested are %ld\n",bytesRequested);
164+
opal_output(ompi_sharedfp_base_framework.framework_output,
165+
"sharedfp_lockedfile_read_ordered_begin: Bytes requested are %ld\n",bytesRequested);
159166
}
160167
}
161168

@@ -170,7 +177,8 @@ int mca_sharedfp_lockedfile_read_ordered_begin(mca_io_ompio_file_t *fh,
170177
goto exit;
171178
}
172179
if ( mca_sharedfp_lockedfile_verbose ) {
173-
printf("sharedfp_lockedfile_read_ordered_begin: Offset received is %lld\n",offsetReceived);
180+
opal_output(ompi_sharedfp_base_framework.framework_output,
181+
"sharedfp_lockedfile_read_ordered_begin: Offset received is %lld\n",offsetReceived);
174182
}
175183
buff[0] += offsetReceived;
176184
for (i = 1 ; i < size; i++) {
@@ -190,7 +198,8 @@ int mca_sharedfp_lockedfile_read_ordered_begin(mca_io_ompio_file_t *fh,
190198
offset = offsetBuff - sendBuff;
191199

192200
if ( mca_sharedfp_lockedfile_verbose ) {
193-
printf("sharedfp_lockedfile_read_ordered_begin: Offset returned is %lld\n",offset);
201+
opal_output(ompi_sharedfp_base_framework.framework_output,
202+
"sharedfp_lockedfile_read_ordered_begin: Offset returned is %lld\n",offset);
194203
}
195204

196205
ret = ompio_io_ompio_file_iread_at_all ( sh->sharedfh, offset, buf, count, datatype, &fh->f_split_coll_req );

ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_iwrite.c

Lines changed: 17 additions & 9 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
#include "ompi/mca/io/ompio/io_ompio.h"
2829

2930
int mca_sharedfp_lockedfile_iwrite(mca_io_ompio_file_t *fh,
@@ -41,7 +42,8 @@ int mca_sharedfp_lockedfile_iwrite(mca_io_ompio_file_t *fh,
4142

4243
if(fh->f_sharedfp_data==NULL){
4344
if ( mca_sharedfp_lockedfile_verbose ) {
44-
printf("sharedfp_lockedfile_iwrite: opening the shared file pointer\n");
45+
opal_output(ompi_sharedfp_base_framework.framework_output,
46+
"sharedfp_lockedfile_iwrite: opening the shared file pointer\n");
4547
}
4648
shared_fp_base_module = fh->f_sharedfp;
4749

@@ -60,7 +62,8 @@ int mca_sharedfp_lockedfile_iwrite(mca_io_ompio_file_t *fh,
6062
opal_datatype_type_size ( &datatype->super, &numofBytes);
6163
bytesRequested = count * numofBytes;
6264
if ( mca_sharedfp_lockedfile_verbose ) {
63-
printf("sharedfp_lockedfile_iwrite: Bytes Requested is %ld\n",bytesRequested);
65+
opal_output(ompi_sharedfp_base_framework.framework_output,
66+
"sharedfp_lockedfile_iwrite: Bytes Requested is %ld\n",bytesRequested);
6467
}
6568

6669
/*Retrieve the shared file data struct*/
@@ -70,7 +73,8 @@ int mca_sharedfp_lockedfile_iwrite(mca_io_ompio_file_t *fh,
7073
ret = mca_sharedfp_lockedfile_request_position(sh,bytesRequested,&offset);
7174
if ( -1 != ret) {
7275
if ( mca_sharedfp_lockedfile_verbose ) {
73-
printf("sharedfp_lockedfile_iwrite: Offset received is %lld\n",offset);
76+
opal_output(ompi_sharedfp_base_framework.framework_output,
77+
"sharedfp_lockedfile_iwrite: Offset received is %lld\n",offset);
7478
}
7579

7680
/* Write to the file */
@@ -100,7 +104,8 @@ int mca_sharedfp_lockedfile_write_ordered_begin(mca_io_ompio_file_t *fh,
100104

101105
if(fh->f_sharedfp_data==NULL){
102106
if ( mca_sharedfp_lockedfile_verbose ) {
103-
printf("sharedfp_lockedfile_write_ordered_begin: opening the shared file pointer\n");
107+
opal_output(ompi_sharedfp_base_framework.framework_output,
108+
"sharedfp_lockedfile_write_ordered_begin: opening the shared file pointer\n");
104109
}
105110
shared_fp_base_module = fh->f_sharedfp;
106111

@@ -117,7 +122,7 @@ int mca_sharedfp_lockedfile_write_ordered_begin(mca_io_ompio_file_t *fh,
117122

118123

119124
if ( true == fh->f_split_coll_in_use ) {
120-
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
125+
opal_output(0, "Only one split collective I/O operation allowed per file handle at any given point in time!\n");
121126
return MPI_ERR_REQUEST;
122127
}
123128

@@ -153,7 +158,8 @@ int mca_sharedfp_lockedfile_write_ordered_begin(mca_io_ompio_file_t *fh,
153158
for ( i = 0; i < size ; i ++) {
154159
bytesRequested += buff[i];
155160
if ( mca_sharedfp_lockedfile_verbose ) {
156-
printf("sharedfp_lockedfile_write_ordered_begin: Bytes requested are %ld\n",bytesRequested);
161+
opal_output(ompi_sharedfp_base_framework.framework_output,
162+
"sharedfp_lockedfile_write_ordered_begin: Bytes requested are %ld\n",bytesRequested);
157163
}
158164
}
159165

@@ -168,7 +174,8 @@ int mca_sharedfp_lockedfile_write_ordered_begin(mca_io_ompio_file_t *fh,
168174
goto exit;
169175
}
170176
if ( mca_sharedfp_lockedfile_verbose ) {
171-
printf("sharedfp_lockedfile_write_ordered_begin: Offset received is %lld\n",offsetReceived);
177+
opal_output(ompi_sharedfp_base_framework.framework_output,
178+
"sharedfp_lockedfile_write_ordered_begin: Offset received is %lld\n",offsetReceived);
172179
}
173180
buff[0] += offsetReceived;
174181
for (i = 1 ; i < size; i++) {
@@ -188,8 +195,9 @@ int mca_sharedfp_lockedfile_write_ordered_begin(mca_io_ompio_file_t *fh,
188195
offset = offsetBuff - sendBuff;
189196

190197
if ( mca_sharedfp_lockedfile_verbose ) {
191-
printf("sharedfp_lockedfile_write_ordered_begin: Offset returned is %lld\n",offset);
192-
}
198+
opal_output(ompi_sharedfp_base_framework.framework_output,
199+
"sharedfp_lockedfile_write_ordered_begin: Offset returned is %lld\n",offset);
200+
}
193201

194202
ret = ompio_io_ompio_file_iwrite_at_all ( sh->sharedfh, offset, buf, count, datatype, &fh->f_split_coll_req );
195203
fh->f_split_coll_in_use = true;

ompi/mca/sharedfp/sm/sharedfp_sm_iread.c

Lines changed: 15 additions & 8 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_sm_iread(mca_io_ompio_file_t *fh,
2930
void *buf,
@@ -40,7 +41,8 @@ int mca_sharedfp_sm_iread(mca_io_ompio_file_t *fh,
4041

4142
if( NULL == fh->f_sharedfp_data){
4243
if ( mca_sharedfp_sm_verbose ) {
43-
printf("sharedfp_sm_iread: opening the shared file pointer\n");
44+
opal_output(ompi_sharedfp_base_framework.framework_output,
45+
"sharedfp_sm_iread: opening the shared file pointer\n");
4446
}
4547
shared_fp_base_module = fh->f_sharedfp;
4648

@@ -70,7 +72,8 @@ int mca_sharedfp_sm_iread(mca_io_ompio_file_t *fh,
7072

7173
if ( -1 != ret ) {
7274
if ( mca_sharedfp_sm_verbose ) {
73-
printf("sharedfp_sm_iread: Offset received is %lld\n",offset);
75+
opal_output(ompi_sharedfp_base_framework.framework_output,
76+
"sharedfp_sm_iread: Offset received is %lld\n",offset);
7477
}
7578
/* Read the file */
7679
ret = ompio_io_ompio_file_iread_at(sh->sharedfh,offset,buf,count,datatype,request);
@@ -99,7 +102,8 @@ int mca_sharedfp_sm_read_ordered_begin(mca_io_ompio_file_t *fh,
99102

100103
if ( NULL == fh->f_sharedfp_data){
101104
if ( mca_sharedfp_sm_verbose ) {
102-
printf("sharedfp_sm_read_ordered_begin: opening the shared file pointer\n");
105+
opal_output(ompi_sharedfp_base_framework.framework_output,
106+
"sharedfp_sm_read_ordered_begin: opening the shared file pointer\n");
103107
}
104108
shared_fp_base_module = fh->f_sharedfp;
105109

@@ -114,7 +118,7 @@ int mca_sharedfp_sm_read_ordered_begin(mca_io_ompio_file_t *fh,
114118
}
115119
}
116120
if ( true == fh->f_split_coll_in_use ) {
117-
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
121+
opal_output(0,"Only one split collective I/O operation allowed per file handle at any given point in time!\n");
118122
return MPI_ERR_REQUEST;
119123
}
120124

@@ -151,8 +155,9 @@ int mca_sharedfp_sm_read_ordered_begin(mca_io_ompio_file_t *fh,
151155
for (i = 0; i < size ; i ++) {
152156
bytesRequested += buff[i];
153157
if ( mca_sharedfp_sm_verbose ) {
154-
printf("mca_sharedfp_sm_read_ordered_begin: Bytes requested are %ld\n",
155-
bytesRequested);
158+
opal_output(ompi_sharedfp_base_framework.framework_output,
159+
"mca_sharedfp_sm_read_ordered_begin: Bytes requested are %ld\n",
160+
bytesRequested);
156161
}
157162
}
158163

@@ -167,7 +172,8 @@ int mca_sharedfp_sm_read_ordered_begin(mca_io_ompio_file_t *fh,
167172
goto exit;
168173
}
169174
if ( mca_sharedfp_sm_verbose ) {
170-
printf("mca_sharedfp_sm_read_ordered_begin: Offset received is %lld\n",offsetReceived);
175+
opal_output(ompi_sharedfp_base_framework.framework_output,
176+
"mca_sharedfp_sm_read_ordered_begin: Offset received is %lld\n",offsetReceived);
171177
}
172178

173179
buff[0] += offsetReceived;
@@ -187,7 +193,8 @@ int mca_sharedfp_sm_read_ordered_begin(mca_io_ompio_file_t *fh,
187193
/*Each process now has its own individual offset in recvBUFF*/
188194
offset = offsetBuff - sendBuff;
189195
if ( mca_sharedfp_sm_verbose ) {
190-
printf("mca_sharedfp_sm_read_ordered_begin: Offset returned is %lld\n",offset);
196+
opal_output(ompi_sharedfp_base_framework.framework_output,
197+
"mca_sharedfp_sm_read_ordered_begin: Offset returned is %lld\n",offset);
191198
}
192199

193200
/* read to the file */

ompi/mca/sharedfp/sm/sharedfp_sm_iwrite.c

Lines changed: 17 additions & 9 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_sm_iwrite(mca_io_ompio_file_t *fh,
2930
void *buf,
@@ -40,7 +41,8 @@ int mca_sharedfp_sm_iwrite(mca_io_ompio_file_t *fh,
4041

4142
if( NULL == fh->f_sharedfp_data){
4243
if ( mca_sharedfp_sm_verbose ) {
43-
printf("sharedfp_sm_iwrite - opening the shared file pointer\n");
44+
opal_output(ompi_sharedfp_base_framework.framework_output,
45+
"sharedfp_sm_iwrite - opening the shared file pointer\n");
4446
}
4547
shared_fp_base_module = fh->f_sharedfp;
4648

@@ -63,14 +65,16 @@ int mca_sharedfp_sm_iwrite(mca_io_ompio_file_t *fh,
6365
sh = fh->f_sharedfp_data;
6466

6567
if ( mca_sharedfp_sm_verbose ) {
66-
printf("sharedfp_sm_iwrite: Bytes Requested is %ld\n",bytesRequested);
68+
opal_output(ompi_sharedfp_base_framework.framework_output,
69+
"sharedfp_sm_iwrite: Bytes Requested is %ld\n",bytesRequested);
6770
}
6871
/* Request the offset to write bytesRequested bytes */
6972
ret = mca_sharedfp_sm_request_position(sh,bytesRequested,&offset);
7073

7174
if ( -1 != ret ) {
7275
if ( mca_sharedfp_sm_verbose ) {
73-
printf("sharedfp_sm_iwrite: Offset received is %lld\n",offset);
76+
opal_output(ompi_sharedfp_base_framework.framework_output,
77+
"sharedfp_sm_iwrite: Offset received is %lld\n",offset);
7478
}
7579
/* Write to the file */
7680
ret = ompio_io_ompio_file_iwrite_at(sh->sharedfh,offset,buf,count,datatype,request);
@@ -100,7 +104,8 @@ int mca_sharedfp_sm_write_ordered_begin(mca_io_ompio_file_t *fh,
100104

101105
if ( NULL == fh->f_sharedfp_data){
102106
if ( mca_sharedfp_sm_verbose ) {
103-
printf("sharedfp_sm_write_ordered_begin: opening the shared file pointer\n");
107+
opal_output(ompi_sharedfp_base_framework.framework_output,
108+
"sharedfp_sm_write_ordered_begin: opening the shared file pointer\n");
104109
}
105110
shared_fp_base_module = fh->f_sharedfp;
106111

@@ -115,7 +120,7 @@ int mca_sharedfp_sm_write_ordered_begin(mca_io_ompio_file_t *fh,
115120
}
116121
}
117122
if ( true == fh->f_split_coll_in_use ) {
118-
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
123+
opal_output(0, "Only one split collective I/O operation allowed per file handle at any given point in time!\n");
119124
return MPI_ERR_REQUEST;
120125
}
121126

@@ -152,8 +157,9 @@ int mca_sharedfp_sm_write_ordered_begin(mca_io_ompio_file_t *fh,
152157
for (i = 0; i < size ; i ++) {
153158
bytesRequested += buff[i];
154159
if ( mca_sharedfp_sm_verbose ) {
155-
printf("mca_sharedfp_sm_write_ordered_begin: Bytes requested are %ld\n",
156-
bytesRequested);
160+
opal_output(ompi_sharedfp_base_framework.framework_output,
161+
"mca_sharedfp_sm_write_ordered_begin: Bytes requested are %ld\n",
162+
bytesRequested);
157163
}
158164
}
159165

@@ -168,7 +174,8 @@ int mca_sharedfp_sm_write_ordered_begin(mca_io_ompio_file_t *fh,
168174
goto exit;
169175
}
170176
if ( mca_sharedfp_sm_verbose ) {
171-
printf("mca_sharedfp_sm_write_ordered_begin: Offset received is %lld\n",offsetReceived);
177+
opal_output(ompi_sharedfp_base_framework.framework_output,
178+
"mca_sharedfp_sm_write_ordered_begin: Offset received is %lld\n",offsetReceived);
172179
}
173180

174181
buff[0] += offsetReceived;
@@ -188,7 +195,8 @@ int mca_sharedfp_sm_write_ordered_begin(mca_io_ompio_file_t *fh,
188195
/*Each process now has its own individual offset in recvBUFF*/
189196
offset = offsetBuff - sendBuff;
190197
if ( mca_sharedfp_sm_verbose ) {
191-
printf("mca_sharedfp_sm_write_ordered_begin: Offset returned is %lld\n",offset);
198+
opal_output(ompi_sharedfp_base_framework.framework_output,
199+
"mca_sharedfp_sm_write_ordered_begin: Offset returned is %lld\n",offset);
192200
}
193201

194202
/* read to the file */

0 commit comments

Comments
 (0)