ucx icon indicating copy to clipboard operation
ucx copied to clipboard

UCP: Implementation of routine to query datatype attributes

Open rdietric opened this issue 2 years ago • 12 comments

What

Implementation of the the routine ucp_dt_query according to PR #8120. Currently, the only datatype attribute to query is the packed size.

Why ?

The size of a message or data transfer is a performance-relevant information. Performance tools should be able to query this information similar to MPI_Type_size to query the size of any MPI datatype

How ?

For contig data types, the return value of ucp_contig_dt_elem_size() provides the element size. For generic data types, a field packed_size has been added to ucp_dt_generic_t, which is set with the user-defined pack routine. When the size of the generic data type is queried, the value of this field is used. All other data types are not supported and UCS_ERR_INVALID_PARAM is returned as ucs_status_t.

A unit tests verifies the expected behavior for contig, iov and generic data types. It is also checked that UCS_ERR_UNSUPPORTED is returned, if the generic datatype is queried before packing.

rdietric avatar Apr 22 '22 10:04 rdietric

/azp run

yosefe avatar May 09 '22 11:05 yosefe

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar May 09 '22 11:05 azure-pipelines[bot]

Since nobody reviewed yet, I rebased to have the new ucp.h with ucp_dt_query in the branch. I also fixed a bug in the implementation and another issue in the unit test. The current pipeline failures seem unrelated to this PR.

rdietric avatar Jun 03 '22 07:06 rdietric

@rakhmets, can you please review?

brminich avatar Jun 08 '22 07:06 brminich

LGTM besides :

  • API doc review by @tonycurtis
  • Set default value of count to 1 and use it for contig types
  • Fix CI failures

yosefe avatar Aug 22 '22 12:08 yosefe

@tonycurtis @shamisp can you pls review?

yosefe avatar Aug 23 '22 06:08 yosefe

I squashed the commits and all checks have passed.

rdietric avatar Aug 29 '22 13:08 rdietric

👍 @tonycurtis @shamisp can you pls review the API change?

yosefe avatar Aug 31 '22 08:08 yosefe

On Sep 4, 2022, at 11:29 AM, Yossi Itigin @.***> wrote:

@yosefe commented on this pull request.

In src/ucp/api/ucp.h https://github.com/openucx/ucx/pull/8150#discussion_r962332275:

  */
  • size_t packed_size;
  • const void *buffer;
  • /**
  • * Number of elements in @a buffer.
    
  • * This value is optional.
    
  • * If @ref UCP_DATATYPE_ATTR_FIELD_COUNT is not set in @ref field_mask, the
    
  • * value of this field defaults to 1.
    

@tonycurtis https://github.com/tonycurtis @shamisp https://github.com/shamisp if the default is 0, it means that if this parameter is not supplied the function will always return 0. and that is essentially as if we're making this parameter mandatory. IMO it should be 1 by default since the neutral value w.r.t. multiplication is 1.

A NULL pointer encapsulating data of length 1 seems weird. Maybe the semantics of this routine need to be revisited?

tony

tonycurtis avatar Sep 04 '22 15:09 tonycurtis

A NULL pointer encapsulating data of length 1 seems weird. Maybe the semantics of this routine need to be revisited? tony

The pointer itself is not mandatory for calculating the size. The single mandatory parameter is the datatype itself, and count=1 by default would mean to calculate the size of a single element.

yosefe avatar Sep 04 '22 15:09 yosefe

A NULL pointer encapsulating data of length 1 seems weird. Maybe the semantics of this routine need to be revisited? tony

The pointer itself is not mandatory for calculating the size. The single mandatory parameter is the datatype itself, and count=1 by default would mean to calculate the size of a single element.

@shamisp @tonycurtis WDYT?

yosefe avatar Sep 19 '22 07:09 yosefe

Yeah, that sounds good

On Wed, Sep 21, 2022 at 7:53 PM Pavel Shamis (Pasha) < @.***> wrote:

@.**** commented on this pull request.

In src/ucp/api/ucp.h https://github.com/openucx/ucx/pull/8150#discussion_r977070472:

  */
  • size_t packed_size;
  • const void *buffer;
  • /**
  • * Number of elements in @a buffer.
    
  • * This value is optional.
    
  • * If @ref UCP_DATATYPE_ATTR_FIELD_COUNT is not set in @ref field_mask, the
    
  • * value of this field defaults to 1.
    

If @ref UCP_DATATYPE_ATTR_FIELD_COUNT is not set in @ref field_mask, the function executes the query for a single ucp_datatype_t . I think this sounds better. @tonycurtis https://github.com/tonycurtis ?

— Reply to this email directly, view it on GitHub https://github.com/openucx/ucx/pull/8150#discussion_r977070472, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABB6C2CHAD6ILYZGNKVOGRDV7ONXBANCNFSM5UB5KY4A . You are receiving this because you were mentioned.Message ID: @.***>

tonycurtis avatar Sep 21 '22 23:09 tonycurtis