mirror of
https://github.com/Lizonghang/prima.cpp.git
synced 2025-09-05 17:29:02 +00:00
fix: replace localhost to 127.0.0.1
This commit is contained in:
parent
fbbc30c950
commit
104e3b2356
3 changed files with 17 additions and 17 deletions
|
@ -3438,8 +3438,8 @@ struct llama_context {
|
|||
struct ggml_tensor * inp_KQ_mask_cross; // F32 [n_outputs_enc, n_batch]
|
||||
|
||||
// sockets
|
||||
std::string master_ip = "localhost";
|
||||
std::string next_node_ip = "localhost";
|
||||
std::string master_ip = "127.0.0.1";
|
||||
std::string next_node_ip = "127.0.0.1";
|
||||
uint32_t data_port = 9000;
|
||||
uint32_t signal_port = 10000;
|
||||
zmq::context_t * sock_context = nullptr;
|
||||
|
@ -20453,11 +20453,11 @@ static uint32_t map_rank_to_port(uint32_t rank, uint32_t data_port) {
|
|||
}
|
||||
|
||||
static std::string try_connect(llama_context * ctx, uint32_t rank, TopoRebuildHelperInfo * infos, uint32_t n_world, zmq::socket_t ** socket){
|
||||
auto prv_rank = (rank - 1 + n_world) % n_world;
|
||||
std::string ip = infos[prv_rank].dev_info.next_ip;
|
||||
auto prev_rank = (rank - 1 + n_world) % n_world;
|
||||
std::string ip = infos[prev_rank].dev_info.next_ip;
|
||||
auto port = map_rank_to_port(rank, ctx->data_port);
|
||||
|
||||
if(!isPortOpen(ip, port)){
|
||||
if (!is_port_open(ip, port)) {
|
||||
*socket = nullptr;
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
|
||||
bool isPortOpen(const std::string& ip, uint32_t port, int timeout_sec) {
|
||||
bool is_port_open(const std::string& ip, uint32_t port, int timeout_sec) {
|
||||
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0) return false;
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
typedef unsigned int uint32_t;
|
||||
|
||||
bool isPortOpen(const std::string& ip, uint32_t port, int timeout_sec = 2);
|
||||
bool is_port_open(const std::string& ip, uint32_t port, int timeout_sec = 2);
|
Loading…
Add table
Reference in a new issue