-
Notifications
You must be signed in to change notification settings - Fork 14
enable psm2 nameserver #307
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -453,11 +453,13 @@ crt_get_info_string(char **string) | |
| } else { | ||
| /* OFI_PORT is only for context 0 to use */ | ||
| port = crt_na_ofi_conf.noc_port; | ||
| crt_na_ofi_conf.noc_port = -1; | ||
| crt_na_ofi_conf.noc_port++; | ||
|
|
||
| D_ASPRINTF(*string, "%s://%s/%s:%d", plugin_str, | ||
| crt_na_ofi_conf.noc_domain, | ||
| crt_na_ofi_conf.noc_ip_str, port); | ||
| // D_ASPRINTF(*string, "%s://%s:%d", plugin_str, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments |
||
| // crt_na_ofi_conf.noc_ip_str, port); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments |
||
| } | ||
|
|
||
| if (*string == NULL) | ||
|
|
@@ -575,7 +577,11 @@ crt_hg_init(crt_phy_addr_t *addr, bool server) | |
| } | ||
| } | ||
|
|
||
| D_DEBUG(DB_NET, "in crt_hg_init, listen address: %s.\n", *addr); | ||
| if (server) | ||
| D_DEBUG(DB_NET, "listening address: %s.\n", *addr); | ||
| else | ||
| D_DEBUG(DB_NET, "passive address: %s.\n", *addr); | ||
|
|
||
| crt_gdata.cg_hg = hg_gdata; | ||
|
|
||
| out: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -545,8 +545,8 @@ crt_finalize(void) | |
| crt_gdata.cg_inited = 0; | ||
| gdata_init_flag = 0; | ||
|
|
||
| if (crt_gdata.cg_na_plugin == CRT_NA_OFI_SOCKETS) | ||
| crt_na_ofi_config_fini(); | ||
| // if (crt_gdata.cg_na_plugin == CRT_NA_OFI_SOCKETS) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not use C99 // comments |
||
| crt_na_ofi_config_fini(); | ||
| } else { | ||
| D_RWLOCK_UNLOCK(&crt_gdata.cg_rwlock); | ||
| } | ||
|
|
@@ -589,6 +589,55 @@ static inline na_bool_t is_integer_str(char *str) | |
| return NA_TRUE; | ||
| } | ||
|
|
||
| static inline int | ||
| crt_get_port(int *port) | ||
| { | ||
| int socketfd; | ||
| struct sockaddr_in tmp_socket; | ||
| socklen_t slen = sizeof(struct sockaddr); | ||
| int rc; | ||
|
|
||
| socketfd = socket(AF_INET, SOCK_STREAM, 0); | ||
| if (socketfd == -1) { | ||
| D_ERROR("cannot create socket, errno: %d(%s).\n", | ||
| errno, strerror(errno)); | ||
| D_GOTO(out, rc = -DER_ADDRSTR_GEN); | ||
| } | ||
| tmp_socket.sin_family = AF_INET; | ||
| tmp_socket.sin_addr.s_addr = INADDR_ANY; | ||
| tmp_socket.sin_port = 0; | ||
|
|
||
| rc = bind(socketfd, (const struct sockaddr *)&tmp_socket, | ||
| sizeof(tmp_socket)); | ||
| if (rc != 0) { | ||
| D_ERROR("cannot bind socket, errno: %d(%s).\n", | ||
| errno, strerror(errno)); | ||
| close(socketfd); | ||
| D_GOTO(out, rc = -DER_ADDRSTR_GEN); | ||
| } | ||
|
|
||
| rc = getsockname(socketfd, (struct sockaddr *)&tmp_socket, &slen); | ||
| if (rc != 0) { | ||
| D_ERROR("cannot create getsockname, errno: %d(%s).\n", | ||
| errno, strerror(errno)); | ||
| close(socketfd); | ||
| D_GOTO(out, rc = -DER_ADDRSTR_GEN); | ||
| } | ||
| rc = close(socketfd); | ||
| if (rc != 0) { | ||
| D_ERROR("cannot close socket, errno: %d(%s).\n", | ||
| errno, strerror(errno)); | ||
| D_GOTO(out, rc = -DER_ADDRSTR_GEN); | ||
| } | ||
|
|
||
| D_ASSERT(port != NULL); | ||
| *port = ntohs(tmp_socket.sin_port); | ||
| D_DEBUG(DB_ALL, "get a port: %d.\n", *port); | ||
|
|
||
| out: | ||
| return rc; | ||
| } | ||
|
|
||
| int crt_na_ofi_config_init(void) | ||
| { | ||
| char *port_str; | ||
|
|
@@ -678,13 +727,19 @@ int crt_na_ofi_config_init(void) | |
| port_str = getenv("OFI_PORT"); | ||
| if (crt_is_service() && port_str != NULL && strlen(port_str) > 0) { | ||
| if (!is_integer_str(port_str)) { | ||
| D_DEBUG(DB_ALL, "ignore invalid OFI_PORT %s.", | ||
| D_DEBUG(DB_ALL, "ignoring invalid OFI_PORT %s.", | ||
| port_str); | ||
| } else { | ||
| port = atoi(port_str); | ||
| D_DEBUG(DB_ALL, "OFI_PORT %d, use it as service " | ||
| D_DEBUG(DB_ALL, "OFI_PORT %d, using it as service " | ||
| "port.\n", port); | ||
| } | ||
| } else { | ||
| rc = crt_get_port(&port); | ||
| if (rc != 0) { | ||
| D_ERROR("crt_get_port failed, rc: %d.\n", rc); | ||
| D_GOTO(out, rc); | ||
| } | ||
| } | ||
| crt_na_ofi_conf.noc_port = port; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,7 @@ struct host { | |
| }; | ||
|
|
||
| static int my_rank; | ||
| volatile static int myflag = 0; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise statics to 0
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise statics to 0
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise statics to 0
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise statics to 0
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise statics to 0
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise statics to 0
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise statics to 0 |
||
|
|
||
| struct options_t { | ||
| int is_client; | ||
|
|
@@ -153,6 +154,8 @@ get_self_uri(struct host *h) | |
| char *p; | ||
| int len; | ||
| int rc; | ||
| while (myflag) | ||
| sched_yield(); | ||
|
|
||
| rc = crt_init(0, CRT_FLAG_BIT_SERVER | CRT_FLAG_BIT_PMIX_DISABLE | | ||
| CRT_FLAG_BIT_LM_DISABLE); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ | |
| #include <cart/api.h> | ||
|
|
||
| #include "crt_internal.h" | ||
| volatile int myflag = 0; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise globals to 0
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise globals to 0
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) do not initialise globals to 0 |
||
|
|
||
| #define DBG_PRINT(x...) \ | ||
| do { \ | ||
|
|
@@ -372,6 +373,9 @@ tc_cli_start_basic(char *local_group_name, char *srv_group_name, | |
| int attach_retries = opts.num_attach_retries; | ||
| int rc = 0; | ||
|
|
||
| while (myflag) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) Missing a blank line after declarations
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) Missing a blank line after declarations
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) Missing a blank line after declarations
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (style) Missing a blank line after declarations |
||
| sched_yield(); | ||
|
|
||
| D_ASSERTF(opts.is_initialized == true, "tc_test_init not called.\n"); | ||
|
|
||
| rc = d_log_init(); | ||
|
|
@@ -461,6 +465,8 @@ tc_srv_start_basic(char *srv_group_name, crt_context_t *crt_ctx, | |
| rc = d_log_init(); | ||
| D_ASSERT(rc == 0); | ||
|
|
||
| while (myflag) | ||
| sched_yield(); | ||
| if (init_opt) { | ||
| rc = crt_init_opt(srv_group_name, CRT_FLAG_BIT_SERVER | | ||
| CRT_FLAG_BIT_PMIX_DISABLE | | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(style) do not use C99 // comments