@@ -840,12 +840,15 @@ static int ompi_comm_allreduce_pmix_reduce_complete (ompi_comm_request_t *reques
840840 opal_pmix_pdata_t pdat ;
841841 opal_buffer_t sbuf ;
842842 int rc ;
843+ int bytes_written ;
844+ const int output_id = 0 ;
845+ const int verbosity_level = 1 ;
843846
844847 OBJ_CONSTRUCT (& sbuf , opal_buffer_t );
845848
846849 if (OPAL_SUCCESS != (rc = opal_dss .pack (& sbuf , context -> tmpbuf , (int32_t )context -> count , OPAL_INT ))) {
847850 OBJ_DESTRUCT (& sbuf );
848- fprintf ( stderr , "pack failed. rc %d\n" , rc );
851+ opal_output_verbose ( verbosity_level , output_id , "pack failed. rc %d\n" , rc );
849852 return rc ;
850853 }
851854
@@ -858,16 +861,36 @@ static int ompi_comm_allreduce_pmix_reduce_complete (ompi_comm_request_t *reques
858861 opal_dss .unload (& sbuf , (void * * )& info .data .bo .bytes , & info .data .bo .size );
859862 OBJ_DESTRUCT (& sbuf );
860863
861- if (cid_context -> send_first ) {
862- (void )asprintf (& info .key , "%s:%s:send:%d" , cid_context -> port_string , cid_context -> pmix_tag ,
863- cid_context -> iter );
864- (void )asprintf (& pdat .value .key , "%s:%s:recv:%d" , cid_context -> port_string , cid_context -> pmix_tag ,
865- cid_context -> iter );
864+ bytes_written = asprintf (& info .key ,
865+ cid_context -> send_first ? "%s:%s:send:%d"
866+ : "%s:%s:recv:%d" ,
867+ cid_context -> port_string ,
868+ cid_context -> pmix_tag ,
869+ cid_context -> iter );
870+
871+ if (bytes_written == -1 ) {
872+ opal_output_verbose (verbosity_level , output_id , "writing info.key failed\n" );
866873 } else {
867- (void )asprintf (& info .key , "%s:%s:recv:%d" , cid_context -> port_string , cid_context -> pmix_tag ,
868- cid_context -> iter );
869- (void )asprintf (& pdat .value .key , "%s:%s:send:%d" , cid_context -> port_string , cid_context -> pmix_tag ,
870- cid_context -> iter );
874+ bytes_written = asprintf (& pdat .value .key ,
875+ cid_context -> send_first ? "%s:%s:recv:%d"
876+ : "%s:%s:send:%d" ,
877+ cid_context -> port_string ,
878+ cid_context -> pmix_tag ,
879+ cid_context -> iter );
880+
881+ if (bytes_written == -1 ) {
882+ opal_output_verbose (verbosity_level , output_id , "writing pdat.value.key failed\n" );
883+ }
884+ }
885+
886+ if (bytes_written == -1 ) {
887+ // write with separate calls,
888+ // just in case the args are the cause of failure
889+ opal_output_verbose (verbosity_level , output_id , "send first: %d\n" , cid_context -> send_first );
890+ opal_output_verbose (verbosity_level , output_id , "port string: %s\n" , cid_context -> port_string );
891+ opal_output_verbose (verbosity_level , output_id , "pmix tag: %s\n" , cid_context -> pmix_tag );
892+ opal_output_verbose (verbosity_level , output_id , "iter: %d\n" , cid_context -> iter );
893+ return OMPI_ERR_OUT_OF_RESOURCE ;
871894 }
872895
873896 /* this macro is not actually non-blocking. if a non-blocking version becomes available this function
0 commit comments