Skip to content

Commit f6a0a6b

Browse files
committed
Update README
1 parent 8bbf636 commit f6a0a6b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@ pip install cufile-python
1010

1111
## Usage
1212

13-
```python
14-
from cufile import CUFILE
13+
Basic usage with the `CuFile` context manager:
1514

16-
# Example usage
17-
cufile = CUFILE()
18-
# Add your usage examples here
15+
```python
16+
from cufile import CuFile
17+
import torch
18+
import ctypes
19+
20+
# allocate an empty buffer in VRAM
21+
t = torch.empty((1024, 1024, 16), dtype=torch.float32, device="cuda")
22+
with CuFile("test.bin", "r") as f:
23+
f.read(ctypes.c_void_p(t.data_ptr()), t.nbytes)
1924
```
2025

26+
Alternatively one could `import cufile.bindings` and use it as if calling libcufile from C++.
27+
2128
## Development
2229

2330
To set up the development environment:

0 commit comments

Comments
 (0)