├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── README.md
├── lib
├── base
│ ├── asm.h
│ ├── common.h
│ ├── init.cpp
│ ├── init.h
│ ├── logging.cpp
│ ├── logging.h
│ ├── macro.h
│ ├── thread.cpp
│ └── thread.h
├── common
│ ├── config.cpp
│ ├── config.h
│ ├── http_status.cpp
│ ├── http_status.h
│ ├── protocol.h
│ ├── stat.h
│ ├── subprocess.cpp
│ ├── subprocess.h
│ ├── time.h
│ ├── uv.cpp
│ └── uv.h
├── ipc
│ ├── base.cpp
│ ├── base.h
│ ├── fifo.cpp
│ ├── fifo.h
│ ├── shm_region.cpp
│ ├── shm_region.h
│ ├── spsc_queue-inl.h
│ └── spsc_queue.h
├── rdma
│ ├── bit_map.cpp
│ ├── bit_map.h
│ ├── infinity.cpp
│ ├── infinity.h
│ ├── queue_pair.cpp
│ ├── queue_pair.h
│ ├── rdma_macro.h
│ ├── shared_memory.cpp
│ └── shared_memory.h
├── runtime
│ ├── event_driven_worker.cpp
│ ├── event_driven_worker.h
│ ├── worker_lib.cpp
│ └── worker_lib.h
├── server
│ ├── connection_base.h
│ ├── io_worker.cpp
│ ├── io_worker.h
│ ├── poller.cpp
│ ├── poller.h
│ ├── server_base.cpp
│ └── server_base.h
└── utils
│ ├── appendable_buffer.h
│ ├── bench.cpp
│ ├── bench.h
│ ├── bst.h
│ ├── buffer_pool.h
│ ├── docker.cpp
│ ├── docker.h
│ ├── dynamic_library.h
│ ├── env_variables.h
│ ├── exp_moving_avg.h
│ ├── fs.cpp
│ ├── fs.h
│ ├── http_parser.c
│ ├── http_parser.h
│ ├── io.h
│ ├── object_pool.h
│ ├── perf_event.cpp
│ ├── perf_event.h
│ ├── procfs.cpp
│ ├── procfs.h
│ ├── random.cpp
│ ├── random.h
│ ├── socket.cpp
│ └── socket.h
└── src
├── dpu
├── agent
│ ├── CMakeLists.txt
│ ├── agent.cpp
│ ├── agent.h
│ ├── agent_main.cpp
│ ├── engine_connection.cpp
│ ├── engine_connection.h
│ ├── gateway_connection.cpp
│ └── gateway_connection.h
└── gateway
│ ├── CMakeLists.txt
│ ├── engine_connection.cpp
│ ├── engine_connection.h
│ ├── func_call_context.h
│ ├── gateway_main.cpp
│ ├── grpc_connection.cpp
│ ├── grpc_connection.h
│ ├── http_connection.cpp
│ ├── http_connection.h
│ ├── server.cpp
│ └── server.h
└── host
├── engine
├── CMakeLists.txt
├── agent_connection.cpp
├── agent_connection.h
├── dispatcher.cpp
├── dispatcher.h
├── engine.cpp
├── engine.h
├── engine_main.cpp
├── gateway_connection.cpp
├── gateway_connection.h
├── message_connection.cpp
├── message_connection.h
├── monitor.cpp
├── monitor.h
├── tracer.cpp
├── tracer.h
├── worker_manager.cpp
└── worker_manager.h
├── launcher
├── CMakeLists.txt
├── engine_connection.cpp
├── engine_connection.h
├── func_process.cpp
├── func_process.h
├── launcher.cpp
├── launcher.h
└── launcher_main.cpp
└── worker
├── cpp
├── CMakeLists.txt
├── func_worker.cpp
├── func_worker.h
├── func_worker_interface.h
└── func_worker_main.cpp
└── python
├── CMakeLists.txt
├── faas
└── __init__.py
└── module.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | cmake-build-debug/
2 | .idea/
3 | src/host/worker/python/faas/_faas_native.so
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "deps/libuv"]
2 | path = deps/libuv
3 | url = https://github.com/libuv/libuv.git
4 | [submodule "deps/http-parser"]
5 | path = deps/http-parser
6 | url = https://github.com/nodejs/http-parser.git
7 | [submodule "deps/abseil-cpp"]
8 | path = deps/abseil-cpp
9 | url = https://github.com/abseil/abseil-cpp.git
10 | [submodule "deps/json"]
11 | path = deps/json
12 | url = https://github.com/nlohmann/json.git
13 | [submodule "deps/nghttp2"]
14 | path = deps/nghttp2
15 | url = https://github.com/nghttp2/nghttp2.git
16 | [submodule "deps/GSL"]
17 | path = deps/GSL
18 | url = https://github.com/microsoft/GSL.git
19 | [submodule "deps/fmt"]
20 | path = deps/fmt
21 | url = https://github.com/fmtlib/fmt.git
22 | [submodule "deps/pybind11"]
23 | path = deps/pybind11
24 | url = https://github.com/pybind/pybind11.git
25 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(Fuyao)
2 | cmake_minimum_required(VERSION 3.16)
3 | set(CMAKE_CXX_STANDARD 17)
4 | set(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
5 |
6 | # enable build library
7 | set(PYTHON_LIBRARY_BUILD OFF)
8 | set(CPP_LIBRARY_BUILD ON)
9 |
10 | # header
11 | include_directories(${BASE_DIR}/lib)
12 | include_directories(${BASE_DIR}/src)
13 |
14 | add_compile_options(-fPIC)
15 | add_compile_options(-fexceptions)
16 |
17 | # deps
18 | set(ENABLE_LIB_ONLY 1) # used by nghttp2 to disable unnecessary component builds
19 |
20 | add_subdirectory(${BASE_DIR}/deps/abseil-cpp abseil)
21 | add_subdirectory(${BASE_DIR}/deps/fmt fmt)
22 | add_subdirectory(${BASE_DIR}/deps/GSL gsl)
23 | add_subdirectory(${BASE_DIR}/deps/json json)
24 | add_subdirectory(${BASE_DIR}/deps/libuv libuv)
25 | add_subdirectory(${BASE_DIR}/deps/nghttp2 nghttp2)
26 |
27 | # rdma verbs
28 | set(ENV{PKG_CONFIG_PATH} /usr/lib/x86_64-linux-gnu/pkgconfig)
29 | set(ENV{PKG_CONFIG_EXECUTABLE} /usr/bin/pkg-config)
30 | find_package(PkgConfig REQUIRED)
31 | pkg_check_modules(LIBIBVERBS REQUIRED IMPORTED_TARGET libibverbs)
32 |
33 | # dpu submodule
34 | add_subdirectory(${BASE_DIR}/src/dpu/gateway gateway)
35 | add_subdirectory(${BASE_DIR}/src/dpu/agent agent)
36 |
37 | # host submodule
38 | add_subdirectory(${BASE_DIR}/src/host/engine engine)
39 | add_subdirectory(${BASE_DIR}/src/host/launcher launcher)
40 |
41 | # cpp runtime library
42 | if (CPP_LIBRARY_BUILD)
43 | set(FUNC_WORKER_CPP_LIBRARIES_NAME worker_cpp)
44 | add_subdirectory(${BASE_DIR}/src/host/worker/cpp/ worker_cpp)
45 | endif()
46 |
47 | # python runtime library
48 | if (PYTHON_LIBRARY_BUILD)
49 | add_subdirectory(${BASE_DIR}/deps/pybind11 pybind11)
50 |
51 | # Replace it based on the actual situation
52 | set(PYTHON_INCLUDE_DIR /usr/include/python3.8)
53 | set(LIBRARY_OUTPUT_PATH ${BASE_DIR}/src/host/worker/python/faas)
54 | set(FUNC_WORKER_PYTHON_OUTPUT_NAME _faas_native)
55 | add_subdirectory(${BASE_DIR}/src/host/worker/python/ worker_python)
56 | endif ()
57 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Fuyao
2 | ---
3 |
4 | ## structure
5 |
6 |
7 | Fuyao
8 | |---deps
9 | |---lib
10 | |---base
11 | |---common
12 | |---ipc
13 | |---rdma
14 | |---runtime
15 | |---server
16 | |---utils
17 | |---src
18 | |---dpu
19 | |---agent
20 | |---gateway
21 | |---host
22 | |---engine
23 | |---launcher
24 | |---worker
25 | |---cpp
26 |
27 |
28 | ## How to use it?
29 |
30 | [Fuyao-benchmarks](https://github.com/guoweiu/Fuyao-benchmarks)
--------------------------------------------------------------------------------
/lib/base/asm.h:
--------------------------------------------------------------------------------
1 | //#pragma once
2 | #ifndef LUMINE_ASM_H
3 | #define LUMINE_ASM_H
4 |
5 | namespace faas {
6 |
7 | inline void asm_volatile_memory() {
8 | asm volatile("" : : : "memory");
9 | }
10 |
11 | inline void asm_volatile_pause() {
12 | asm volatile("pause");
13 | }
14 |
15 | } // namespace faas
16 |
17 | #endif //LUMINE_ASM_H
--------------------------------------------------------------------------------
/lib/base/common.h:
--------------------------------------------------------------------------------
1 | #ifndef LUMINE_COMMON_H
2 | #define LUMINE_COMMON_H
3 |
4 | // C includes
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | // C++ includes
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | // STL containers
28 | #include