diff --git a/.github/workflows/executor-memcuda.yml b/.github/workflows/executor-memcuda.yml index 60cef29..a5b4335 100644 --- a/.github/workflows/executor-memcuda.yml +++ b/.github/workflows/executor-memcuda.yml @@ -68,6 +68,7 @@ jobs: ninja && \ # 构建 CUDA 执行器 + apt install -y libhiredis-dev && \ cd ../../mem-cuda && \ mkdir -p build && cd build && \ cmake -DCMAKE_BUILD_TYPE=Release \ diff --git a/executor/mem-cuda/CMakeLists.txt b/executor/mem-cuda/CMakeLists.txt index 6cdd76c..68fecfd 100644 --- a/executor/mem-cuda/CMakeLists.txt +++ b/executor/mem-cuda/CMakeLists.txt @@ -9,8 +9,7 @@ find_path(REDISPP_INCLUDE redis++/redis++.h) find_library(HIREDIS_LIB hiredis) add_subdirectory(src) -add_subdirectory(tools) -add_subdirectory(test) +# add_subdirectory(test) message(STATUS "mem-cuda: CUDA toolkit at ${CUDAToolkit_ROOT}") message(STATUS "mem-cuda: redis++ include: ${REDISPP_INCLUDE}, hiredis lib: ${HIREDIS_LIB}") diff --git a/executor/mem-cuda/src/CMakeLists.txt b/executor/mem-cuda/src/CMakeLists.txt index 2763618..4c3040d 100644 --- a/executor/mem-cuda/src/CMakeLists.txt +++ b/executor/mem-cuda/src/CMakeLists.txt @@ -3,8 +3,6 @@ cmake_minimum_required(VERSION 3.18) # src/CMakeLists.txt - memcuda core (clean) set(SRCS - registry/redis_client.cpp - registry/registry.cpp ipc/ipc.cpp allocator/cuda_pool.cpp runtime/lifecycle.cpp diff --git a/executor/mem-cuda/src/registry/redis_client.cpp b/executor/mem-cuda/src/registry/redis_client.cpp deleted file mode 100644 index acbc32a..0000000 --- a/executor/mem-cuda/src/registry/redis_client.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "redis_client.h" - -#include - -namespace memcuda { - -RedisClient::RedisClient(const std::string& uri) { - auto* r = new sw::redis::Redis(uri); - redis_impl_ = static_cast(r); -} - -RedisClient::~RedisClient() { - auto* r = static_cast(redis_impl_); - delete r; -} - -bool RedisClient::HSet(const std::string& key, const std::string& field, const std::string& value) { - auto* r = static_cast(redis_impl_); - return r->hset(key, field, value); -} - -bool RedisClient::HGet(const std::string& key, const std::string& field, std::string& out) const { - auto* r = static_cast(redis_impl_); - auto val = r->hget(key, field); - if (!val) { - return false; - } - out = *val; - return true; -} - -std::unordered_map RedisClient::HGetAll(const std::string& key) const { - auto* r = static_cast(redis_impl_); - std::unordered_map res; - r->hgetall(key, std::inserter(res, res.begin())); - return res; -} - -long long RedisClient::LPush(const std::string& key, const std::string& value) { - auto* r = static_cast(redis_impl_); - return r->lpush(key, value); -} - -bool RedisClient::BRPop(const std::string& key, int timeout_seconds, std::string& out) const { - auto* r = static_cast(redis_impl_); - auto item = r->brpop(key, std::chrono::seconds(timeout_seconds)); - if (!item) { - return false; - } - out = item->second; - return true; -} - -std::string RedisClient::Eval(const std::string& script, - const std::vector& keys, - const std::vector& args) const { - auto* r = static_cast(redis_impl_); - return r->eval(script, keys.begin(), keys.end(), args.begin(), args.end()); -} - -} diff --git a/executor/mem-cuda/src/registry/redis_client.h b/executor/mem-cuda/src/registry/redis_client.h deleted file mode 100644 index 5b5f0b9..0000000 --- a/executor/mem-cuda/src/registry/redis_client.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace memcuda { - -class RedisClient { -public: - explicit RedisClient(const std::string& uri); - ~RedisClient(); - - bool HSet(const std::string& key, const std::string& field, const std::string& value); - bool HGet(const std::string& key, const std::string& field, std::string& out) const; - std::unordered_map HGetAll(const std::string& key) const; - - long long LPush(const std::string& key, const std::string& value); - bool BRPop(const std::string& key, int timeout_seconds, std::string& out) const; - - std::string Eval(const std::string& script, - const std::vector& keys, - const std::vector& args) const; - -private: - void* redis_impl_; -}; - -}