Skip to content

Commit 9e87868

Browse files
authored
Update docs (#169)
1 parent bc97342 commit 9e87868

File tree

2 files changed

+59
-10
lines changed

2 files changed

+59
-10
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Integration with SGLang and other inference engines are in progress.
3030
Most users just need to deploy and run InfiniStore, and they don't need to understand how InfiniStore works internally. For these users, PIP is the recommended way to install:
3131

3232
```
33-
pip install InfiniStore
33+
pip install infinistore
3434
```
3535

3636
## Install from Source Code
@@ -53,7 +53,7 @@ pre-commit install
5353
After installation, either from PIP or from source code, run the following command to verify your installation is successful:
5454

5555
```
56-
InfiniStore --manage-port 8088
56+
infinistore --manage-port 8088
5757
curl http://127.0.0.1:8088/selftest
5858
```
5959

@@ -70,28 +70,28 @@ Your server machine may be equipped with TCP network or RDMA network. The comman
7070
For TCP/IP Network:
7171

7272
```
73-
InfiniStore --service-port 12345
73+
infinistore --service-port 12345
7474
```
7575

7676
For RDMA(RoCE):
7777

7878
```
79-
InfiniStore --service-port 12345 --dev-name mlx5_0 --link-type Ethernet
79+
infinistore --service-port 12345 --dev-name mlx5_0 --link-type Ethernet
8080
```
8181

8282
For RDMA(Infiniband):
8383

8484
```
85-
InfiniStore --service-port 12345 --dev-name mlx5_0 --link-type IB
85+
infinistore --service-port 12345 --dev-name mlx5_0 --link-type IB
8686
```
8787

8888
2. **Run InfiniStore Client**
8989

9090
Check the following example code to run an InfiniStore client:
9191

92-
* ```InfiniStore/example/client.py```
93-
* ```InfiniStore/example/client_async.py```
94-
* ```InfiniStore/example/client_async_single.py```
92+
* ```infinistore/example/client.py```
93+
* ```infinistore/example/client_async.py```
94+
* ```infinistore/example/client_async_single.py```
9595

9696
## Run Within a vLLM Cluster
9797

@@ -120,7 +120,7 @@ If you are submitting a code change, run the following unit test and pre-commit
120120
2. **Run Unit Tests**
121121

122122
```
123-
pytest InfiniStore/test_InfiniStore.py
123+
pytest infinistore/test_infinistore.py
124124
```
125125

126126
3. **Run Pre-commit Checks**

infinistore/lib.py

+50-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def tcp_read_cache(self, key: str, **kwargs) -> np.ndarray:
361361
362362
Parameters:
363363
key (str): The key associated with the cached item.
364-
**kwargs: Additional keyword arguments.
364+
``**kwargs``: Additional keyword arguments.
365365
366366
Returns:
367367
np.ndarray: The cached item retrieved from the TCP connection.
@@ -397,6 +397,31 @@ def tcp_write_cache(self, key: str, ptr: int, size: int, **kwargs):
397397
async def rdma_write_cache_async(
398398
self, blocks: List[Tuple[str, int]], block_size: int, ptr: int
399399
):
400+
"""
401+
Asynchronously writes data to the infinistore cache using RDMA.
402+
403+
This function performs an RDMA write operation to the infinistore cache.
404+
It requires an active RDMA connection and uses a semaphore to limit
405+
concurrent writes. The operation is completed asynchronously.
406+
407+
Args:
408+
blocks (List[Tuple[str, int]]): A list of tuples where each tuple
409+
contains a key (str) and an offset (int) representing the data
410+
blocks to be written.
411+
block_size (int): The size of each block to be written, in bytes.
412+
ptr (int): A pointer to the memory location containing the data to
413+
be written.
414+
415+
Raises:
416+
Exception: If RDMA is not connected or if the write operation fails.
417+
Returns:
418+
int: The result code of the write operation if successful.
419+
420+
Notes:
421+
- If the RDMA connection is not established, an exception is raised.
422+
- The semaphore ensures that the number of concurrent writes is
423+
limited.
424+
"""
400425
if not self.rdma_connected:
401426
raise Exception("this function is only valid for connected rdma")
402427

@@ -430,6 +455,30 @@ def _callback(code):
430455
async def rdma_read_cache_async(
431456
self, blocks: List[Tuple[str, int]], block_size: int, ptr: int
432457
):
458+
"""
459+
Asynchronously reads data from the RDMA cache.
460+
461+
This function performs an asynchronous RDMA read operation for the specified
462+
blocks of data. It requires an active RDMA connection and uses a semaphore
463+
to limit concurrent operations.
464+
465+
Args:
466+
blocks (List[Tuple[str, int]]): A list of tuples where each tuple contains
467+
a key (str) and an offset (int) specifying the data to be read.
468+
block_size (int): The size of each block to be read.
469+
ptr (int): A pointer to the memory location where the data will be stored.
470+
471+
Raises:
472+
Exception: If RDMA is not connected or if the RDMA read operation fails.
473+
InfiniStoreKeyNotFound: If some keys are not found in the RDMA cache.
474+
475+
Returns:
476+
int: The result code of the RDMA read operation (e.g., 200 for success).
477+
478+
Note:
479+
This function uses a callback mechanism to handle the result of the RDMA
480+
read operation. The semaphore is released after the operation completes.
481+
"""
433482
if not self.rdma_connected:
434483
raise Exception("this function is only valid for connected rdma")
435484
pass

0 commit comments

Comments
 (0)