Skip to content
Open
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
8 changes: 7 additions & 1 deletion .github/workflows/compile_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ jobs:
lz4 \
pkgconf \
libzmq5 \
sqlite3
sqlite3 \
libboost-all-dev
pip3 --version && python3 --version
gcc --version
sudo pip3 install jsonschema cffi ply pyyaml
Expand Down Expand Up @@ -199,6 +200,11 @@ jobs:
# externals:
# - spec: "pkg-config@0.29.1"
# prefix: /usr
boost:
buildable: False
externals:
- spec: "boost@1.83.0"
prefix: /usr
gcc:
externals:
- spec: gcc@${GCC_VERSION} languages=c,c++
Expand Down
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,25 @@ include_directories(${CMAKE_SOURCE_DIR}/include) # public header
add_subdirectory(src/dyad)
#cmake_policy(SET CMP0079 NEW) # In case that we need more control over the target building order

if (DEFINED BOOST_ROOT)
message(STATUS "BOOST_ROOT: " ${BOOST_ROOT})
set(Boost_NO_SYSTEM_PATHS ON)
else ()
if (DEFINED ENV{BOOST_ROOT})
message(STATUS "ENV BOOST_ROOT: " $ENV{BOOST_ROOT})
set(Boost_NO_SYSTEM_PATHS ON)
endif ()
endif ()

# boost::multi_index is needed and is header-only
find_package(Boost
# HINTS ${BOOST_ROOT} $ENV{BOOST_ROOT}
REQUIRED COMPONENTS)
# regex filesystem system program_options)

message(STATUS "Boost_INCLUDE_DIRS: " ${Boost_INCLUDE_DIRS})
message(STATUS "Boost_LIBRARY_DIRS: " ${Boost_LIBRARY_DIRS})

# Write the configure file
configure_file("${CMAKE_SOURCE_DIR}/cmake/configure_files/dyad_config.hpp.in"
"${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/dyad/dyad_config.hpp" @ONLY)
Expand Down
4 changes: 1 addition & 3 deletions src/dyad/client/dyad_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,7 @@ dyad_rc_t dyad_produce (dyad_ctx_t *restrict ctx, const char *restrict fname)
// If the producer-managed path is NULL or empty, then the context is not
// valid for a producer operation. So, return DYAD_BADMANAGEDPATH
if (ctx->prod_managed_path == NULL) {
DYAD_LOG_ERROR (ctx,
"DYAD CLIENT: No or empty producer managed path was found %s",
ctx->prod_managed_path);
DYAD_LOG_ERROR (ctx, "DYAD CLIENT: No producer managed path was found");
rc = DYAD_RC_BADMANAGEDPATH;
goto produce_done;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dyad/dtl/margo_dtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ dyad_rc_t dyad_dtl_margo_send (const dyad_ctx_t* ctx, void* buf, size_t buflen)
margo_free_output (h, &resp);
margo_destroy (h);

DYAD_LOG_DEBUG (ctx, "[MARGO DTL] margo_send completed.", buflen);
DYAD_LOG_DEBUG (ctx, "[MARGO DTL] margo_send (buflen=%lu) completed.", buflen);

DYAD_C_FUNCTION_END ();
return rc;
Expand Down
1 change: 1 addition & 0 deletions src/dyad/service/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_subdirectory(flux_module)
add_subdirectory(residency)

set(DYAD_EXE "dyad_exe")
set(DYAD_EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/dyad_exe.c)
Expand Down
57 changes: 57 additions & 0 deletions src/dyad/service/residency/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
set(DYAD_FCACHE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/fcache.cpp)
set(DYAD_FCACHE_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/murmur3.h
${CMAKE_CURRENT_SOURCE_DIR}/../../utils/utils.h
${CMAKE_CURRENT_SOURCE_DIR}/../../../../include/dyad/common/dyad_rc.h
${CMAKE_CURRENT_SOURCE_DIR}/../../common/dyad_logging.h)
set(DYAD_FCACHE_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/fcache.hpp
${CMAKE_CURRENT_SOURCE_DIR}/fcache_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/dyad_cache.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../../include/dyad/common/dyad_structures.h)


add_library(${PROJECT_NAME}_fcache SHARED ${DYAD_FCACHE_SRC}
${DYAD_FCACHE_PRIVATE_HEADERS} ${DYAD_FCACHE_PUBLIC_HEADERS})
set_target_properties(${PROJECT_NAME}_fcache PROPERTIES CMAKE_INSTALL_RPATH
"${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}")

if(DYAD_LOGGER STREQUAL "CPP_LOGGER")
target_link_libraries(${PROJECT_NAME}_fcache PRIVATE ${CPP_LOGGER_LIBRARIES})
endif()
if(DYAD_PROFILER STREQUAL "DLIO_PROFILER")
target_link_libraries(${PROJECT_NAME}_fcache PRIVATE ${DLIO_PROFILER_LIBRARIES})
endif()

target_compile_definitions(${PROJECT_NAME}_fcache PUBLIC DYAD_HAS_CONFIG)
target_include_directories(${PROJECT_NAME}_fcache PUBLIC
${Boost_INCLUDE_DIRS}
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<INSTALL_INTERFACE:${DYAD_INSTALL_INCLUDE_DIR}>)

add_executable(test_fcache test_fcache.cpp)
target_compile_definitions(test_fcache PUBLIC DYAD_HAS_CONFIG)
target_link_libraries(test_fcache PUBLIC ${PROJECT_NAME}_fcache)
target_link_libraries(test_fcache PRIVATE ${PROJECT_NAME}_utils)
target_link_libraries(test_fcache PRIVATE ${PROJECT_NAME}_murmur3)

if(DYAD_LOGGER STREQUAL "CPP_LOGGER")
target_link_libraries(test_fcache PRIVATE ${CPP_LOGGER_LIBRARIES})
endif()
if(DYAD_PROFILER STREQUAL "DLIO_PROFILER")
target_link_libraries(test_cmp_fcache PRIVATE ${DLIO_PROFILER_LIBRARIES})
endif()


if (TARGET DYAD_CXX_FLAGS_werror)
target_link_libraries(${PROJECT_NAME}_fcache PRIVATE DYAD_CXX_FLAGS_werror)
endif ()

install(
TARGETS ${PROJECT_NAME}_fcache
EXPORT ${DYAD_EXPORTED_TARGETS}
LIBRARY DESTINATION ${DYAD_INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${DYAD_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${DYAD_INSTALL_BIN_DIR}
)
if(NOT "${DYAD_FCACHE_PUBLIC_HEADERS}" STREQUAL "")
dyad_install_headers("${DYAD_FCACHE_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR})
endif()
114 changes: 114 additions & 0 deletions src/dyad/service/residency/dyad_cache.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#ifndef DYAD_RESIDENCY_DYAD_CACHE_H
#define DYAD_RESIDENCY_DYAD_CACHE_H

#if defined(DYAD_HAS_CONFIG)
#include <dyad/dyad_config.hpp>
#else
#error "no config"
#endif

#include <dyad/service/residency/fcache.hpp>

#include <unordered_set>

namespace dyad_residency
{

template <typename Set>
class DYAD_Cache : public Cache<Set>
{
public:
using Cache<Set>::Sets;
using Cache<Set>::size;
using Cache<Set>::get_num_ways;
using Cache<Set>::get_num_sets;
using Cache<Set>::get_num_access;
using Cache<Set>::get_num_miss;
using Cache<Set>::reset_cnts;
using Cache<Set>::set_seed;
using Cache<Set>::get_level;
using Cache<Set>::set_level;
using Cache<Set>::set_space_max;
using Cache<Set>::get_space_max;
using Cache<Set>::get_space_used;
using PermSet = typename std::unordered_set<std::string>;

protected:
using Cache<Set>::m_ctx;
using Cache<Set>::m_set;
PermSet m_perm; ///< Permanent resident set

virtual unsigned int get_cache_set_id (const std::string& fname) const override;

public:
DYAD_Cache (unsigned int sz, const dyad_ctx_t* ctx) : Cache<Set> (sz, 0, ctx)
{
}

virtual ~DYAD_Cache () override
{
}

/// Initialize with a set of permant resident file names
virtual bool init (const std::vector<std::string>& files)
{
m_perm.clear ();
for (const auto& f : files) {
m_perm.insert (f);
}
return Cache<Set>::init ();
}

/// Allow adding a permant resident file
virtual bool add_perm (const std::string& f)
{
auto res = m_perm.emplace (f);
return res.second;
}

/// Allow removing a permant resident file
virtual bool del_perm (const std::string& f)
{
remove (f.c_str (), m_ctx);
return (m_perm.erase (f) > 0ul);
}

virtual bool access (const std::string& fname, size_t fsize = 0ul) override;

virtual std::ostream& print (std::ostream& os) const override;
};

/**
* Hard-coded to use only one set that is fully-associative.
*/
template <typename Set>
unsigned int DYAD_Cache<Set>::get_cache_set_id (const std::string& fname) const
{
return 0u;
}

template <typename Set>
bool DYAD_Cache<Set>::access (const std::string& fname, size_t fsize)
{
if (m_perm.count (fname) > 0u) {
return true;
}
return Cache<Set>::access (fname, fsize);
}

template <typename Set>
std::ostream& DYAD_Cache<Set>::print (std::ostream& os) const
{
Cache<Set>::print (os);
return os;
}

template <typename Set>
std::ostream& operator<< (std::ostream& os, const DYAD_Cache<Set>& cc)
{
return cc.print (os);
}

} // end of namespace dyad_residency

#endif // DYAD_RESIDENCY_DYAD_CACHE_H
Loading