Skip to content

Commit a541ab9

Browse files
authored
Merge pull request #8066 from devreal/spc-pml-ucx
PML UCX: add SPC instrumentation for sent/received message sizes
2 parents 9f114c6 + 91a9420 commit a541ab9

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

ompi/mca/pml/ucx/pml_ucx.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "opal/mca/pmix/pmix-internal.h"
2121
#include "ompi/attribute/attribute.h"
2222
#include "ompi/message/message.h"
23+
#include "ompi/runtime/ompi_spc.h"
2324
#include "ompi/mca/pml/base/pml_base_bsend.h"
2425
#include "opal/mca/common/ucx/common_ucx.h"
2526
#if OPAL_CUDA_SUPPORT
@@ -627,6 +628,13 @@ int mca_pml_ucx_recv(void *buf, size_t count, ompi_datatype_t *datatype, int src
627628
status = ucp_request_test(req, &info);
628629
if (status != UCS_INPROGRESS) {
629630
mca_pml_ucx_set_recv_status_safe(mpi_status, status, &info);
631+
632+
#if SPC_ENABLE == 1
633+
size_t dt_size;
634+
ompi_datatype_type_size(datatype, &dt_size);
635+
SPC_USER_OR_MPI(tag, dt_size*count,
636+
OMPI_SPC_BYTES_RECEIVED_USER, OMPI_SPC_BYTES_RECEIVED_MPI);
637+
#endif
630638
return OMPI_SUCCESS;
631639
}
632640
}
@@ -827,6 +835,13 @@ int mca_pml_ucx_isend(const void *buf, size_t count, ompi_datatype_t *datatype,
827835
mca_pml_ucx_send_completion);
828836
#endif
829837

838+
#if SPC_ENABLE == 1
839+
size_t dt_size;
840+
ompi_datatype_type_size(datatype, &dt_size);
841+
SPC_USER_OR_MPI(tag, dt_size*count,
842+
OMPI_SPC_BYTES_SENT_USER, OMPI_SPC_BYTES_SENT_MPI);
843+
#endif
844+
830845
if (req == NULL) {
831846
PML_UCX_VERBOSE(8, "returning completed request");
832847
*request = &ompi_pml_ucx.completed_send_req;
@@ -918,6 +933,13 @@ int mca_pml_ucx_send(const void *buf, size_t count, ompi_datatype_t *datatype, i
918933
return OMPI_ERROR;
919934
}
920935

936+
#if SPC_ENABLE == 1
937+
size_t dt_size;
938+
ompi_datatype_type_size(datatype, &dt_size);
939+
SPC_USER_OR_MPI(tag, dt_size*count,
940+
OMPI_SPC_BYTES_SENT_USER, OMPI_SPC_BYTES_SENT_MPI);
941+
#endif
942+
921943
#if HAVE_DECL_UCP_TAG_SEND_NBR
922944
if (OPAL_LIKELY((MCA_PML_BASE_SEND_BUFFERED != mode) &&
923945
(MCA_PML_BASE_SEND_SYNCHRONOUS != mode))) {

ompi/mca/pml/ucx/pml_ucx_request.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "pml_ucx_request.h"
1414
#include "ompi/mca/pml/base/pml_base_bsend.h"
1515
#include "ompi/message/message.h"
16+
#include "ompi/runtime/ompi_spc.h"
1617
#include <inttypes.h>
1718

1819

@@ -71,6 +72,9 @@ mca_pml_ucx_recv_completion_internal(void *request, ucs_status_t status,
7172
(void*)req, ucs_status_string(status), info->sender_tag,
7273
info->length);
7374

75+
SPC_USER_OR_MPI(PML_UCX_TAG_GET_MPI_TAG(info->sender_tag), info->length,
76+
OMPI_SPC_BYTES_RECEIVED_USER, OMPI_SPC_BYTES_RECEIVED_MPI);
77+
7478
mca_pml_ucx_set_recv_status(&req->req_status, status, info);
7579
PML_UCX_ASSERT( !(REQUEST_COMPLETE(req)));
7680
ompi_request_complete(req, true);

0 commit comments

Comments
 (0)