|
26 | 26 |
|
27 | 27 | // global variables |
28 | 28 | ServerRpcContext_t* unifyfsd_rpc_context; |
| 29 | +char* margo_init_address; // = NULL |
| 30 | +bool margo_use_address; // = false |
29 | 31 | bool margo_use_tcp = true; |
30 | 32 | bool margo_lazy_connect; // = false |
31 | 33 | int margo_client_server_pool_sz = UNIFYFS_MARGO_POOL_SZ; |
@@ -99,31 +101,37 @@ static char* get_margo_addr_str(margo_instance_id mid) |
99 | 101 | /* setup_remote_target - Initializes the server-server margo target */ |
100 | 102 | static margo_instance_id setup_remote_target(void) |
101 | 103 | { |
102 | | - /* by default we try to use ofi */ |
103 | | - const char* margo_protocol = margo_use_tcp ? |
| 104 | + const char* server_addr = NULL; |
| 105 | + |
| 106 | + if (margo_use_address) { |
| 107 | + server_addr = margo_init_address; |
| 108 | + } else { |
| 109 | + /* by default we try to use ofi */ |
| 110 | + server_addr = margo_use_tcp ? |
104 | 111 | PROTOCOL_MARGO_OFI_TCP : PROTOCOL_MARGO_OFI_RMA; |
105 | | - if (!margo_protocol) { |
106 | | - /* when ofi is not available, fallback to using bmi */ |
107 | | - LOGWARN("OFI is not available, using BMI for margo rpc"); |
108 | | - margo_protocol = PROTOCOL_MARGO_BMI_TCP; |
| 112 | + if (!server_addr) { |
| 113 | + /* when ofi is not available, fallback to using bmi */ |
| 114 | + LOGWARN("OFI is not available, using BMI for margo rpc"); |
| 115 | + server_addr = PROTOCOL_MARGO_BMI_TCP; |
| 116 | + } |
109 | 117 | } |
110 | 118 |
|
111 | 119 | /* initialize margo */ |
112 | | - margo_instance_id mid = margo_init(margo_protocol, MARGO_SERVER_MODE, |
| 120 | + margo_instance_id mid = margo_init(server_addr, MARGO_SERVER_MODE, |
113 | 121 | margo_use_progress_thread, margo_server_server_pool_sz); |
114 | 122 | if (mid == MARGO_INSTANCE_NULL) { |
115 | 123 | LOGERR("margo_init(%s, SERVER_MODE, %d, %d) failed", |
116 | | - margo_protocol, margo_use_progress_thread, |
| 124 | + server_addr, margo_use_progress_thread, |
117 | 125 | margo_server_server_pool_sz); |
118 | | - if (margo_protocol == PROTOCOL_MARGO_OFI_TCP) { |
| 126 | + if (server_addr == PROTOCOL_MARGO_OFI_TCP) { |
119 | 127 | /* try "ofi+sockets" instead */ |
120 | | - margo_protocol = PROTOCOL_MARGO_OFI_SOCKETS; |
121 | | - mid = margo_init(margo_protocol, MARGO_SERVER_MODE, |
| 128 | + server_addr = PROTOCOL_MARGO_OFI_SOCKETS; |
| 129 | + mid = margo_init(server_addr, MARGO_SERVER_MODE, |
122 | 130 | margo_use_progress_thread, |
123 | 131 | margo_server_server_pool_sz); |
124 | 132 | if (mid == MARGO_INSTANCE_NULL) { |
125 | 133 | LOGERR("margo_init(%s, SERVER_MODE, %d, %d) failed", |
126 | | - margo_protocol, margo_use_progress_thread, |
| 134 | + server_addr, margo_use_progress_thread, |
127 | 135 | margo_server_server_pool_sz); |
128 | 136 | return mid; |
129 | 137 | } |
|
0 commit comments