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 5 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
39 changes: 39 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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)

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

include_directories($ENV{CMAKE_URING_PATH}/src/include)
link_directories($ENV{CMAKE_URING_PATH}/src)

include_directories($ENV{CMAKE_AIO_PATH}/src/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个路径为什么有src

link_directories($ENV{CMAKE_AIO_PATH}/src)

include_directories(csrc)
include_directories(csrc/include)

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 ${TORCH_PYTHON_LIBRARY})

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

## Dependencies

- [liburing](https://github.com/axboe/liburing)
- [libaio](https://pagure.io/libaiohttps://pagure.io/libaiohttps://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
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