Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test section in readme #10

Merged
merged 8 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ profile_default/
ipython_config.py

cmake-build-debug-remote-host
CMakeLists.txt
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
Expand Down
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.16)
project(nvme)

find_package(Torch REQUIRED
PATHS $ENV{CMAKE_TORCH_PATH} # look here
NO_DEFAULT_PATH)
find_library(TORCH_PYTHON_LIBRARY torch_python PATHS $ENV{CMAKE_TORCH_PATH}/lib)

find_library(URING PATHS $ENV{CMAKE_URING_PATH})

include_directories($ENV{CMAKE_AIO_PATH}/include)
link_directories($ENV{CMAKE_AIO_PATH}/lib)

include_directories($ENV{CMAKE_PYTHON_PATH}/include)
link_directories($ENV{CMAKE_PYTHON_PATH}/lib)

include_directories(csrc)
include_directories(csrc/include)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

add_executable(test_asyncio tests/test_asyncio.cpp
csrc/include/asyncio.h
csrc/include/uring.h
csrc/include/aio.h
tests/catch.hpp
csrc/uring.cpp
csrc/aio.cpp)
target_link_libraries(test_asyncio "${TORCH_LIBRARIES}" uring aio python3 ${TORCH_PYTHON_LIBRARY})

add_executable(test_space_mgr tests/test_space_mgr.cpp
csrc/include/space_mgr.h
tests/catch.hpp
csrc/space_mgr.cpp)
target_link_libraries(test_space_mgr "${TORCH_LIBRARIES}" python3 ${TORCH_PYTHON_LIBRARY})
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,34 @@
> This is a demo.

## Dependencies

- [liburing](https://github.com/axboe/liburing)
- [libaio](https://pagure.io/libaio)
- [libtorch](https://github.com/pytorch/pytorch)

## Install

```shell
pip install -v --no-cache-dir -e .
```

## How to test
`tests/test_asyncio.cpp` is a simple demo to test `AsyncIO` class. To compile:

We have C++ test scrpits for `AsyncIO` and `SpaceManager` class. To run the tests:

```shell
g++ tests/test_asyncio.cpp csrc/aio.cpp -luring
./a.out
export CMAKE_TORCH_PATH=/path/to/libtorch
export CMAKE_URING_PATH=/path/to/liburing
export CMAKE_AIO_PATH=/path/to/libaio
export CMAKE_PYTHON_PATH=/path/to/python
mkdir build
cd build
cmake ..
make
./test_asyncio
./test_space_mgr
```

You will get a `test.txt` which is filled with `"TEST ME AGAIN!!!"`.

Currently, we can save and load Pytorch Tensor:

```python
Expand Down
3 changes: 2 additions & 1 deletion tests/test_asyncio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ void callback_empty()
{
}

TEST_CASE( "Test async io fucntion of libaio") {
TEST_CASE( "Test async io fucntion of libaio and liburing") {

AsyncIO *aios[] = {
new AIOAsyncIO(1),
new AIOAsyncIO(10),
Expand Down