Skip to content

Commit

Permalink
add portion of rtt pinger
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrol aderholdt committed Nov 18, 2024
1 parent 8160e57 commit 2fc8fba
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/components/tl/ucp/tl_ucp.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ static ucs_config_field_t ucc_tl_ucp_context_config_table[] = {
ucc_offsetof(ucc_tl_ucp_context_config_t, service_throttling_thresh),
UCC_CONFIG_TYPE_UINT},

{"IP_ADDR", "127.0.0.1",
"IP address to use for RTT utility",
ucc_offsetof(ucc_tl_ucp_context_config_t, ip_addr),
UCC_CONFIG_TYPE_STRING},

{NULL}};

UCC_CLASS_DEFINE_NEW_FUNC(ucc_tl_ucp_lib_t, ucc_base_lib_t,
Expand Down
34 changes: 34 additions & 0 deletions src/components/tl/ucp/tl_ucp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,37 @@
#define ONESIDED_SYNC_SIZE 1
#define ONESIDED_REDUCE_SIZE 4

/* FERROL: remove once pinger is done
* */
#include <arpa/inet.h>
#include <unistd.h>
#include <linux/types.h>
struct pinger_attr {
int npeers;
struct sockaddr_storage sin;
__be16 port;
};

struct pinger_peer_attr {
struct sockaddr_storage sin;
__be16 port;
};

typedef void* pinger_t;
typedef void* pinger_pid_t;
typedef double pinger_rtt_t;

static inline int pinger_create(struct pinger_attr *attr, pinger_t *pinger) {
return 0;
}

static inline int pinger_destroy(pinger_t *pinger) {
return 0;
}

static inline int pinger_connect(pinger_t pinger, struct pinger_peer_attr *attr, pinger_pid_t *peer) { return 0; }
static inline int pinger_query(pinger_t pinger, pinger_pid_t peer, pinger_rtt_t *rtt) { *rtt = 1; return 0; }

typedef struct ucc_tl_ucp_iface {
ucc_tl_iface_t super;
} ucc_tl_ucp_iface_t;
Expand Down Expand Up @@ -87,6 +118,7 @@ typedef struct ucc_tl_ucp_context_config {
uint32_t pre_reg_mem;
uint32_t service_worker;
uint32_t service_throttling_thresh;
char ip_addr[16];
} ucc_tl_ucp_context_config_t;

typedef ucc_tl_ucp_lib_config_t ucc_tl_ucp_team_config_t;
Expand Down Expand Up @@ -128,6 +160,8 @@ typedef struct ucc_tl_ucp_context {
uint64_t n_rinfo_segs;
uint64_t ucp_memory_types;
int topo_required;
pinger_t pinger;
struct pinger_attr pinger_attr;
} ucc_tl_ucp_context_t;
UCC_CLASS_DECLARE(ucc_tl_ucp_context_t, const ucc_base_context_params_t *,
const ucc_base_config_t *);
Expand Down
12 changes: 11 additions & 1 deletion src/components/tl/ucp/tl_ucp_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ UCC_CLASS_INIT_FUNC(ucc_tl_ucp_context_t,
}
}

/* setup pinger info here */
tl_debug(self->super.super.lib, "Using IP %s for RTT", self->cfg.ip_addr);
//get_addr(self->cfg.ip_addr, (struct sockaddr *) &self->pinger_attr.sin);
self->pinger_attr.npeers = params->params.oob.n_oob_eps;
self->pinger_attr.port = 13007;

pinger_create(&self->pinger_attr, &self->pinger);

CHECK(UCC_OK != ucc_tl_ucp_eps_ephash_init(
params, self, &self->worker.ep_hash, &self->worker.eps),
"failed to allocate memory for endpoint storage", err_thread_mode,
Expand Down Expand Up @@ -594,7 +602,7 @@ ucc_status_t ucc_tl_ucp_get_context_attr(const ucc_base_context_t *context,
}

if (attr->attr.mask & UCC_CONTEXT_ATTR_FIELD_CTX_ADDR_LEN) {
packed_length = TL_UCP_EP_ADDRLEN_SIZE + ctx->worker.ucp_addrlen;
packed_length = TL_UCP_EP_ADDRLEN_SIZE + ctx->worker.ucp_addrlen + sizeof(struct pinger_attr);
if (ctx->cfg.service_worker != 0) {
packed_length +=
TL_UCP_EP_ADDRLEN_SIZE + ctx->service_worker.ucp_addrlen;
Expand All @@ -620,6 +628,8 @@ ucc_status_t ucc_tl_ucp_get_context_attr(const ucc_base_context_t *context,
ctx->service_worker.ucp_addrlen);
offset = PTR_OFFSET(offset, ctx->service_worker.ucp_addrlen);
}
memcpy(offset, &ctx->pinger_attr, sizeof(struct pinger_attr));
offset = PTR_OFFSET(offset, sizeof(struct pinger_attr));
if (NULL != ctx->remote_info) {
ucc_tl_ucp_ctx_remote_pack_data(ctx, offset);
}
Expand Down

0 comments on commit 2fc8fba

Please sign in to comment.