Skip to content
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
2 changes: 1 addition & 1 deletion capio/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set(ARGS_BUILD_UNITTESTS OFF CACHE INTERNAL "")
FetchContent_Declare(
capio_cl
GIT_REPOSITORY https://github.com/High-Performance-IO/CAPIO-CL.git
GIT_TAG v1.1.1
GIT_TAG v1.3.4
)

FetchContent_MakeAvailable(args capio_cl)
Expand Down
22 changes: 12 additions & 10 deletions capio/server/capio_server.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


#include <algorithm>
#include <args.hxx>
#include <array>
Expand All @@ -18,10 +20,11 @@
#include <unordered_set>
#include <vector>

#include "capiocl.hpp"
#include "capiocl/engine.h"
#include "capiocl/parser.h"
#include "utils/capiocl_adapter.hpp"

std::string workflow_name;

#include "client-manager/client_manager.hpp"
#include "common/env.hpp"
#include "common/logger.hpp"
Expand Down Expand Up @@ -57,8 +60,8 @@ std::mutex nfiles_mutex;
* can only access it through a const reference. This prevents any modifications to the engine
* outside of those permitted by the capiocl::Engine class itself.
*/
capiocl::Engine *capio_cl_engine;
const capiocl::Engine &CapioCLEngine::get() { return *capio_cl_engine; }
capiocl::engine::Engine *capio_cl_engine;
const capiocl::engine::Engine &CapioCLEngine::get() { return *capio_cl_engine; }

static constexpr std::array<CSHandler_t, CAPIO_NR_REQUESTS> build_request_handlers_table() {
std::array<CSHandler_t, CAPIO_NR_REQUESTS> _request_handlers{0};
Expand Down Expand Up @@ -226,11 +229,10 @@ int parseCLI(int argc, char **argv) {
std::cout << CAPIO_LOG_SERVER_CLI_LEVEL_INFO << "parsing config file: " << token
<< std::endl;

std::tie(workflow_name, capio_cl_engine) =
capiocl::Parser::parse(token, resolve_path, store_all_in_memory);
capio_cl_engine = capiocl::parser::Parser::parse(token, resolve_path, store_all_in_memory);
} else if (noConfigFile) {
workflow_name = std::string_view(get_capio_workflow_name());
capio_cl_engine = new capiocl::Engine();
capio_cl_engine = new capiocl::engine::Engine();
capio_cl_engine->setWorkflowName(get_capio_workflow_name());
if (store_all_in_memory) {
capio_cl_engine->setAllStoreInMemory();
}
Expand All @@ -239,7 +241,7 @@ int parseCLI(int argc, char **argv) {
<< std::endl
<< CAPIO_LOG_SERVER_CLI_LEVEL_WARNING
<< "Obtained from environment variable current workflow name: "
<< workflow_name.data() << std::endl;
<< capio_cl_engine->getWorkflowName() << std::endl;
} else {
std::cout << CAPIO_LOG_SERVER_CLI_LEVEL_ERROR
<< "Error: no config file provided. To skip config file use --no-config option!"
Expand Down Expand Up @@ -293,7 +295,7 @@ int main(int argc, char **argv) {

open_files_location();

shm_canary = new CapioShmCanary(workflow_name);
shm_canary = new CapioShmCanary(capio_cl_engine->getWorkflowName());
storage_manager = new StorageManager();
client_manager = new ClientManager();

Expand Down
2 changes: 1 addition & 1 deletion capio/server/include/handlers/close.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ inline void handle_close(int tid, int fd) {
c_file.close();
LOG("File was closed", path.c_str());

if (CapioCLEngine::get().getCommitRule(path) == capiocl::commit_rules::ON_CLOSE &&
if (CapioCLEngine::get().getCommitRule(path) == capiocl::commitRules::ON_CLOSE &&
c_file.is_closed()) {
LOG("Capio File %s is closed and commit rule is on_close. setting it to complete and "
"starting batch handling",
Expand Down
2 changes: 1 addition & 1 deletion capio/server/include/handlers/exig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inline void handle_exit_group(int tid) {
for (auto &path : files) {

LOG("Handling file %s", path.c_str());
if (CapioCLEngine::get().getCommitRule(path) == capiocl::commit_rules::ON_TERMINATION) {
if (CapioCLEngine::get().getCommitRule(path) == capiocl::commitRules::ON_TERMINATION) {
CapioFile &c_file = storage_manager->get(path);
if (c_file.is_dir()) {
LOG("file %s is dir", path.c_str());
Expand Down
3 changes: 2 additions & 1 deletion capio/server/include/utils/capiocl_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#define CAPIO_CAPIOCL_ADAPTER_HPP

#include "capiocl.hpp"
#include "capiocl/engine.h"
/// @brief const wrapper to class instance of capiocl::Engine
class CapioCLEngine final {
public:
/// @brief Get a const reference to capiocl::Engine instance
const static capiocl::Engine &get();
const static capiocl::engine::Engine &get();
};

#endif // CAPIO_CAPIOCL_ADAPTER_HPP
12 changes: 6 additions & 6 deletions capio/server/src/client_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

#include "utils/capiocl_adapter.hpp"

extern std::string workflow_name;

#include "client-manager/client_manager.hpp"
#include "common/constants.hpp"
#include "common/queue.hpp"
#include "utils/capiocl_adapter.hpp"
#include "utils/common.hpp"

ClientManager::ClientManager()
: requests{SHM_COMM_CHAN_NAME, CAPIO_REQ_BUFF_CNT, CAPIO_REQ_MAX_SIZE, workflow_name} {
: requests{SHM_COMM_CHAN_NAME, CAPIO_REQ_BUFF_CNT, CAPIO_REQ_MAX_SIZE,
CapioCLEngine::get().getWorkflowName()} {
server_println(CAPIO_LOG_SERVER_CLI_LEVEL_INFO, "ClientManager initialization completed.");
}

Expand All @@ -23,17 +23,17 @@ void ClientManager::registerClient(pid_t tid, const std::string &app_name, const

ClientDataBuffers buffers{
new SPSCQueue(SHM_SPSC_PREFIX_WRITE + std::to_string(tid), get_cache_lines(),
get_cache_line_size(), workflow_name),
get_cache_line_size(), CapioCLEngine::get().getWorkflowName()),
new SPSCQueue(SHM_SPSC_PREFIX_READ + std::to_string(tid), get_cache_lines(),
get_cache_line_size(), workflow_name)};
get_cache_line_size(), CapioCLEngine::get().getWorkflowName())};

data_buffers.emplace(tid, buffers);
app_names.emplace(tid, app_name);
files_created_by_producer.emplace(tid, std::initializer_list<std::string>{});
files_created_by_app_name.emplace(app_name, std::initializer_list<std::string>{});

responses.try_emplace(tid, SHM_COMM_CHAN_NAME_RESP + std::to_string(tid), CAPIO_REQ_BUFF_CNT,
sizeof(off_t), workflow_name);
sizeof(off_t), CapioCLEngine::get().getWorkflowName());

if (wait) {
std::thread t([&, target_tid = tid]() {
Expand Down