Skip to content

Commit

Permalink
DAOS-16159 control: Accept UCX full transport names (daos-stack#14768)
Browse files Browse the repository at this point in the history
- Include the original UCX transport name (e.g. "ucx+rc_verbs") in
  the list of accepted UCX providers, alongside the aliases (e.g.
  "ucx+rc_v", "ucx+rc").

Signed-off-by: Kris Jacque <kris.jacque@intel.com>
  • Loading branch information
kjacque authored and grom72 committed Jul 25, 2024
1 parent 0336d31 commit 8936367
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 26 deletions.
6 changes: 6 additions & 0 deletions src/control/lib/hardware/cart/cart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,15 @@ func TestCart_Provider_GetFabricInterfaces(t *testing.T) {
Name: "test0:1",
OSName: "test0",
Providers: hardware.NewFabricProviderSet(
&hardware.FabricProvider{
Name: "ucx+rc_verbs",
},
&hardware.FabricProvider{
Name: "ucx+rc_v",
},
&hardware.FabricProvider{
Name: "ucx+ud_verbs",
},
&hardware.FabricProvider{
Name: "ucx+ud_v",
},
Expand Down
41 changes: 27 additions & 14 deletions src/control/lib/hardware/cart/ucx.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,23 @@ func getProviderSetFromUCXTransport(transport string) *hardware.FabricProviderSe
}
genericTransport := strings.Split(transport, "_")[0]

providers := hardware.NewFabricProviderSet()
priority := 0 // by default use the highest
daosProv := ucxTransportToDAOSProvider(transport)
if daosProv == "ucx+tcp" {
priority = ucxTCPPriority // TCP is less desirable than other options if this is Infiniband
daosProv := ucxTransportToDAOSProviders(transport)
for _, p := range daosProv {
if p == "ucx+tcp" {
priority = ucxTCPPriority // TCP is less desirable than other options if this is Infiniband
}
providers.Add(
&hardware.FabricProvider{
Name: p,
Priority: priority,
},
)
}
providers := hardware.NewFabricProviderSet(
&hardware.FabricProvider{
Name: daosProv,
Priority: priority,
},
)
if shouldAddGeneric(transport) {
providers.Add(&hardware.FabricProvider{
Name: ucxTransportToDAOSProvider(genericTransport),
Name: "ucx+" + genericTransport,
Priority: priority,
})
}
Expand All @@ -65,12 +68,22 @@ func shouldAddGeneric(transport string) bool {
return false
}

// ucxTransportToDAOSProvider translates the UCX transport type to a DAOS fabric provider string.
func ucxTransportToDAOSProvider(transport string) string {
// ucxTransportToDAOSProviders translates the UCX transport type to a set of DAOS fabric provider
// strings.
func ucxTransportToDAOSProviders(transport string) []string {
prefix := "ucx+"
provs := []string{prefix + transport}
alias := ucxTransportToAlias(transport)
if alias != transport {
provs = append(provs, prefix+alias)
}
return provs
}

func ucxTransportToAlias(transport string) string {
transportPieces := strings.Split(transport, "_")
if len(transportPieces) < 2 {
return prefix + transport
return transport
}

// Transport strings from the library need to be translated to the supported aliases.
Expand All @@ -83,5 +96,5 @@ func ucxTransportToDAOSProvider(transport string) string {
// accelerated Mellanox transport
transportPieces[1] = "x"
}
return prefix + strings.Join(transportPieces, "_")
return strings.Join(transportPieces, "_")
}
33 changes: 21 additions & 12 deletions src/control/lib/hardware/cart/ucx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func TestCart_getProviderSetFromUCXTransport(t *testing.T) {
"dc": {
in: "dc_mlx5",
expSet: hardware.NewFabricProviderSet(
&hardware.FabricProvider{
Name: "ucx+dc_mlx5",
},
&hardware.FabricProvider{
Name: "ucx+dc_x",
},
Expand Down Expand Up @@ -87,6 +90,9 @@ func TestCart_getProviderSetFromUCXTransport(t *testing.T) {
"add generic rc": {
in: "rc_verbs",
expSet: hardware.NewFabricProviderSet(
&hardware.FabricProvider{
Name: "ucx+rc_verbs",
},
&hardware.FabricProvider{
Name: "ucx+rc_v",
},
Expand All @@ -102,6 +108,9 @@ func TestCart_getProviderSetFromUCXTransport(t *testing.T) {
"add generic ud": {
in: "ud_mlx5",
expSet: hardware.NewFabricProviderSet(
&hardware.FabricProvider{
Name: "ucx+ud_mlx5",
},
&hardware.FabricProvider{
Name: "ucx+ud_x",
},
Expand All @@ -125,54 +134,54 @@ func TestCart_getProviderSetFromUCXTransport(t *testing.T) {
}
}

func TestCart_ucxTransportToDAOSProvider(t *testing.T) {
func TestCart_ucxTransportToAlias(t *testing.T) {
for name, tc := range map[string]struct {
in string
exp string
}{
"custom": {
in: "custom",
exp: "ucx+custom",
exp: "custom",
},
"rc_verbs": {
in: "rc_verbs",
exp: "ucx+rc_v",
exp: "rc_v",
},
"rc_mlx5": {
in: "rc_mlx5",
exp: "ucx+rc_x",
exp: "rc_x",
},
"ud_verbs": {
in: "ud_verbs",
exp: "ucx+ud_v",
exp: "ud_v",
},
"ud_mlx5": {
in: "ud_mlx5",
exp: "ucx+ud_x",
exp: "ud_x",
},
"dc_mlx5": {
in: "dc_mlx5",
exp: "ucx+dc_x",
exp: "dc_x",
},
"dc": {
in: "dc",
exp: "ucx+dc",
exp: "dc",
},
"tcp": {
in: "tcp",
exp: "ucx+tcp",
exp: "tcp",
},
"rc": {
in: "rc",
exp: "ucx+rc",
exp: "rc",
},
"ud": {
in: "ud",
exp: "ucx+ud",
exp: "ud",
},
} {
t.Run(name, func(t *testing.T) {
test.AssertEqual(t, tc.exp, ucxTransportToDAOSProvider(tc.in), "")
test.AssertEqual(t, tc.exp, ucxTransportToAlias(tc.in), "")
})
}
}

0 comments on commit 8936367

Please sign in to comment.