Skip to content

Commit c42b749

Browse files
add option to choose interface (#255)
* add option to connect to a given network interface * Committing clang-format changes * fix conflict * include header * enable output on failure --------- Co-authored-by: github-actions <github-actions[bot]@users.noreply.github.com>
1 parent 90563dd commit c42b749

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

.github/workflows/macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
sudo sh -c 'echo "`ipconfig getifaddr en0` PDC" >> /etc/hosts'
3434
sudo scutil --set HostName PDC
3535
export HG_TRANSPORT="sockets"
36-
ctest -L serial
36+
ctest -L serial --output-on-failure

.github/workflows/ubuntu-cache.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
2929
- name: Test PDC
3030
working-directory: build
31-
run: ctest -L serial
31+
run: ctest -L serial --output-on-failure

.github/workflows/ubuntu-no-cache.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
2929
- name: Test PDC
3030
working-directory: build
31-
run: ctest -L serial
31+
run: ctest -L serial --output-on-failure

src/api/pdc_client_connect.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "pdc_transforms_common.h"
4444
#include "pdc_client_connect.h"
4545
#include "pdc_logger.h"
46+
#include "pdc_malloc.h"
4647

4748
#include "mercury.h"
4849
#include "mercury_macros.h"
@@ -1354,7 +1355,7 @@ PDC_Client_mercury_init(hg_class_t **hg_class, hg_context_t **hg_context, int po
13541355
{
13551356
perr_t ret_value = SUCCEED;
13561357
char na_info_string[NA_STRING_INFO_LEN];
1357-
char hostname[HOSTNAME_LEN];
1358+
char * hostname;
13581359
int local_server_id;
13591360
/* Set the default mercury transport
13601361
* but enable overriding that to any of:
@@ -1378,14 +1379,19 @@ PDC_Client_mercury_init(hg_class_t **hg_class, hg_context_t **hg_context, int po
13781379
if ((hg_transport = getenv("HG_TRANSPORT")) == NULL) {
13791380
hg_transport = default_hg_transport;
13801381
}
1381-
memset(hostname, 0, sizeof(hostname));
1382-
gethostname(hostname, sizeof(hostname));
1382+
if ((hostname = getenv("HG_HOST")) == NULL) {
1383+
hostname = PDC_malloc(HOSTNAME_LEN);
1384+
memset(hostname, 0, HOSTNAME_LEN);
1385+
gethostname(hostname, HOSTNAME_LEN - 1);
1386+
}
13831387
sprintf(na_info_string, "%s://%s:%d", hg_transport, hostname, port);
13841388
if (pdc_client_mpi_rank_g == 0) {
1385-
LOG_INFO("==PDC_CLIENT: using %.7s\n", na_info_string);
1389+
LOG_INFO("==PDC_CLIENT: using %s\n", na_info_string);
13861390
fflush(stdout);
13871391
}
13881392

1393+
free(hostname);
1394+
13891395
// gni starts here
13901396
#ifdef PDC_HAS_CRAY_DRC
13911397
/* Acquire credential */

src/server/pdc_server.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include "pdc_server_region_cache.h"
5959
#include "pdc_server_region_transfer_metadata_query.h"
6060
#include "pdc_logger.h"
61+
#include "pdc_malloc.h"
6162

6263
#ifdef PDC_HAS_CRAY_DRC
6364
#include <rdmacred.h>
@@ -783,7 +784,7 @@ PDC_Server_init(int port, hg_class_t **hg_class, hg_context_t **hg_context)
783784
int i = 0;
784785
char self_addr_string[ADDR_MAX];
785786
char na_info_string[NA_STRING_INFO_LEN];
786-
char hostname[HOSTNAME_LEN];
787+
char * hostname;
787788
struct hg_init_info init_info = {0};
788789

789790
/* Set the default mercury transport
@@ -817,11 +818,16 @@ PDC_Server_init(int port, hg_class_t **hg_class, hg_context_t **hg_context)
817818
if ((hg_transport = getenv("HG_TRANSPORT")) == NULL) {
818819
hg_transport = default_hg_transport;
819820
}
820-
memset(hostname, 0, HOSTNAME_LEN);
821-
gethostname(hostname, HOSTNAME_LEN - 1);
821+
if ((hostname = getenv("HG_HOST")) == NULL) {
822+
hostname = PDC_malloc(HOSTNAME_LEN);
823+
memset(hostname, 0, HOSTNAME_LEN);
824+
gethostname(hostname, HOSTNAME_LEN - 1);
825+
}
822826
snprintf(na_info_string, NA_STRING_INFO_LEN, "%s://%s:%d", hg_transport, hostname, port);
823827
if (pdc_server_rank_g == 0)
824-
LOG_INFO("==PDC_SERVER[%d]: using %.7s\n", pdc_server_rank_g, na_info_string);
828+
LOG_INFO("==PDC_SERVER[%d]: using %s\n", pdc_server_rank_g, na_info_string);
829+
830+
free(hostname);
825831

826832
// Clean up all the tmp files etc
827833
HG_Cleanup();

0 commit comments

Comments
 (0)