mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 00:17:25 +08:00
[BugFix] replace ftok with custom_ftok in get_output/save_output ops (#6822)
* [BugFix] replace ftok with custom_ftok in get_output/save_output ops * [Test] add unit test for custom_ftok * [Chore] create custom_ftok.h * [Chore] reorganize header file * [Fix] fix cache messager msg_queue_id+rank_id conflict
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
#include <sys/types.h>
|
||||
#include "custom_ftok.h"
|
||||
#include "msg_utils.h"
|
||||
#include "paddle/extension.h"
|
||||
|
||||
@@ -33,9 +34,9 @@ void GetOutputKVSignal(const paddle::Tensor& x,
|
||||
std::string msg_que_str(msg_que_str_tmp);
|
||||
msg_queue_id = std::stoi(msg_que_str);
|
||||
}
|
||||
msg_queue_id += rank_id;
|
||||
msg_queue_id = msg_queue_id << 4 + rank_id;
|
||||
static struct msgdatakv msg_rcv;
|
||||
static key_t key = ftok("/opt/", msg_queue_id);
|
||||
static key_t key = custom_ftok("/opt/", msg_queue_id);
|
||||
static int msgid = msgget(key, IPC_CREAT | 0666);
|
||||
|
||||
int* out_data = const_cast<int*>(x.data<int>());
|
||||
@@ -77,10 +78,7 @@ void GetOutputEp(const paddle::Tensor& x,
|
||||
#ifdef GET_OUTPUT_DEBUG
|
||||
std::cout << "msg_queue_id is: " << msg_queue_id << std::endl;
|
||||
#endif
|
||||
// static key_t key = ftok("/dev/shm", msg_queue_id);
|
||||
// static int msgid = msgget(key, IPC_CREAT | 0666);
|
||||
|
||||
key_t key = ftok("/dev/shm", msg_queue_id);
|
||||
key_t key = custom_ftok("/dev/shm", msg_queue_id);
|
||||
int msgid = msgget(key, IPC_CREAT | 0666);
|
||||
|
||||
#ifdef GET_OUTPUT_DEBUG
|
||||
|
||||
Reference in New Issue
Block a user