mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 00:57:33 +08:00
[NewFeature]Support dp multi api server && Fix some bug in mixed ep && merge develop (#3598)
* [Feature] update ep * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix queue ports idx * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * fix ci * Update engine.py * fix ci * fix some bug in mixed ep * add server fix and op fix * rm some log * fix code style * ltd fix * fix * fix * fix some bug * fix bug * fix bug * fix style * Update config.py * Update splitwise_connector.py * Update cache_messager.py * Update __init__.py * merge and fix * Update engine.py * Update common_engine.py * Update run_ci_xpu.sh * Update ernie_processor.py * Update ernie_processor.py --------- Co-authored-by: ltd0924 <ltd0924@sina.com> Co-authored-by: ltd0924 <32387785+ltd0924@users.noreply.github.com>
This commit is contained in:
@@ -18,6 +18,8 @@ from multiprocessing.shared_memory import SharedMemory
|
||||
|
||||
import numpy as np
|
||||
|
||||
from fastdeploy.utils import llm_logger
|
||||
|
||||
|
||||
def shared_memory_exists(name: str) -> bool:
|
||||
"""Check if a shared memory block with the given name exists.
|
||||
@@ -35,7 +37,7 @@ def shared_memory_exists(name: str) -> bool:
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"Unexpected error: {e}")
|
||||
llm_logger.error(f"Unexpected error: {e}")
|
||||
return False
|
||||
|
||||
|
||||
@@ -78,7 +80,9 @@ class IPCSignal:
|
||||
name = name + f".{suffix}"
|
||||
|
||||
if create:
|
||||
assert not shared_memory_exists(name), f"ShareMemory: {name} already exists"
|
||||
if shared_memory_exists(name):
|
||||
llm_logger.warning(f"ShareMemory: {name} already exists, delete it")
|
||||
SharedMemory(name=name, create=False).unlink()
|
||||
self.shm = SharedMemory(create=True, size=array.nbytes, name=name)
|
||||
self.value: np.ndarray = np.ndarray(array.shape, dtype=array.dtype, buffer=self.shm.buf)
|
||||
self.value[:] = array # Initialize with input array data
|
||||
|
Reference in New Issue
Block a user