-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from TauferLab/exported_core
Makes Core into Core and Client and Exposes Client API to Users
- Loading branch information
Showing
33 changed files
with
3,111 additions
and
3,104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#ifndef DYAD_CORE_DYAD_CORE_H | ||
#define DYAD_CORE_DYAD_CORE_H | ||
|
||
#if defined(DYAD_HAS_CONFIG) | ||
#include <dyad/dyad_config.hpp> | ||
#else | ||
#error "no config" | ||
#endif | ||
|
||
#include <dyad/common/dyad_rc.h> | ||
#include <dyad/common/dyad_structures.h> | ||
#include <dyad/core/dyad_ctx.h> | ||
#include <sys/types.h> | ||
#include <unistd.h> | ||
|
||
#ifdef __cplusplus | ||
#include <cstdint> | ||
#include <cstdio> | ||
#include <cstdlib> | ||
#else | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#if DYAD_PERFFLOW | ||
#define DYAD_CORE_FUNC_MODS __attribute__((annotate("@critical_path()"))) static | ||
#else | ||
#define DYAD_CORE_FUNC_MODS static inline | ||
#endif | ||
|
||
struct dyad_metadata { | ||
char *fpath; | ||
uint32_t owner_rank; | ||
}; | ||
typedef struct dyad_metadata dyad_metadata_t; | ||
|
||
/** | ||
* @brief Wrapper function that performs all the common tasks needed | ||
* of a producer | ||
* @param[in] ctx the DYAD context for the operation | ||
* @param[in] fname the name of the file being "produced" | ||
* | ||
* @return An error code from dyad_rc.h | ||
*/ | ||
DYAD_PFA_ANNOTATE DYAD_DLL_EXPORTED dyad_rc_t dyad_produce(dyad_ctx_t *ctx, | ||
const char *fname); | ||
|
||
/** | ||
* @brief Obtain DYAD metadata for a file in the consumer-managed directory | ||
* @param[in] ctx the DYAD context for the operation | ||
* @param[in] fname the name of the file for which metadata is obtained | ||
* @param[in] should_wait if true, wait for the file to be produced before | ||
* returning | ||
* @param[out] mdata a dyad_metadata_t object containing the metadata for | ||
* the file | ||
* | ||
* @return An error code from dyad_rc.h | ||
*/ | ||
DYAD_PFA_ANNOTATE DYAD_DLL_EXPORTED dyad_rc_t | ||
dyad_get_metadata(dyad_ctx_t *ctx, const char *fname, bool should_wait, | ||
dyad_metadata_t **mdata); | ||
|
||
DYAD_PFA_ANNOTATE DYAD_DLL_EXPORTED dyad_rc_t | ||
dyad_free_metadata(dyad_metadata_t **mdata); | ||
|
||
/** | ||
* @brief Wrapper function that performs all the common tasks needed | ||
* of a consumer | ||
* @param[in] ctx the DYAD context for the operation | ||
* @param[in] fname the name of the file being "consumed" | ||
* | ||
* @return An error code from dyad_rc.h | ||
*/ | ||
DYAD_PFA_ANNOTATE DYAD_DLL_EXPORTED dyad_rc_t dyad_consume(dyad_ctx_t *ctx, | ||
const char *fname); | ||
|
||
/** | ||
* @brief Wrapper function that performs all the common tasks needed | ||
* of a consumer | ||
* @param[in] ctx the DYAD context for the operation | ||
* @param[in] fname the name of the file being "consumed" | ||
* @param[in] mdata a dyad_metadata_t object containing the metadata for the | ||
* file User is responsible for deallocating this object | ||
* | ||
* @return An error code from dyad_rc.h | ||
*/ | ||
DYAD_PFA_ANNOTATE DYAD_DLL_EXPORTED dyad_rc_t dyad_consume_w_metadata( | ||
dyad_ctx_t *ctx, const char *fname, const dyad_metadata_t *mdata); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* DYAD_CORE_DYAD_CORE */ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef DYAD_COMMON_STRUCTURES_H | ||
#define DYAD_COMMON_STRUCTURES_H | ||
|
||
#if defined(DYAD_HAS_CONFIG) | ||
#include <dyad/dyad_config.hpp> | ||
#else | ||
#error "no config" | ||
#endif | ||
|
||
struct dyad_ctx; | ||
typedef struct dyad_ctx dyad_ctx_t; | ||
|
||
#endif /* DYAD_COMMON_STRUCTURES_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
set(DYAD_CLIENT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/dyad_client.c) | ||
set(DYAD_CLIENT_PRIVATE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../common/dyad_logging.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../common/dyad_profiler.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../common/dyad_structures_int.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../dtl/dyad_dtl_api.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../utils/utils.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../utils/murmur3.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/dyad_client_int.h) | ||
set(DYAD_CLIENT_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dyad/common/dyad_rc.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dyad/common/dyad_dtl.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dyad/common/dyad_envs.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dyad/common/dyad_structures.h | ||
${CMAKE_CURRENT_SOURCE_DIR}/../../../include/dyad/client/dyad_client.h) | ||
|
||
add_library(${PROJECT_NAME}_client SHARED ${DYAD_CLIENT_SRC} | ||
${DYAD_CLIENT_PUBLIC_HEADERS} ${DYAD_CLIENT_PRIVATE_HEADERS}) | ||
set_target_properties(${PROJECT_NAME}_client PROPERTIES CMAKE_INSTALL_RPATH | ||
"${CMAKE_INSTALL_PREFIX}/${DYAD_LIBDIR}") | ||
target_link_libraries(${PROJECT_NAME}_client PRIVATE Jansson::Jansson flux::core) | ||
target_link_libraries(${PROJECT_NAME}_client PRIVATE ${PROJECT_NAME}_utils | ||
${PROJECT_NAME}_murmur3 ${PROJECT_NAME}_dtl) | ||
target_link_libraries(${PROJECT_NAME}_client PUBLIC ${PROJECT_NAME}_ctx) | ||
|
||
target_compile_definitions(${PROJECT_NAME}_client PUBLIC BUILDING_DYAD=1) | ||
target_compile_definitions(${PROJECT_NAME}_client PUBLIC DYAD_HAS_CONFIG) | ||
target_include_directories(${PROJECT_NAME}_client PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src> # will be used for generated code | ||
$<INSTALL_INTERFACE:${DYAD_INSTALL_INCLUDE_DIR}>) # wil be used for sub projects | ||
target_include_directories(${PROJECT_NAME}_client SYSTEM PRIVATE ${JANSSON_INCLUDE_DIRS}) | ||
target_include_directories(${PROJECT_NAME}_client SYSTEM PRIVATE ${FluxCore_INCLUDE_DIRS}) | ||
|
||
if (TARGET DYAD_C_FLAGS_werror) | ||
target_link_libraries(${PROJECT_NAME}_client PRIVATE DYAD_C_FLAGS_werror) | ||
endif () | ||
|
||
if(DYAD_PROFILER STREQUAL "PERFFLOW_ASPECT") | ||
target_link_libraries(${PROJECT_NAME}_client PRIVATE perfflowaspect::perfflowaspect) | ||
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${perfflowaspect_INCLUDE_DIRS}) | ||
target_compile_definitions(${PROJECT_NAME}_client PRIVATE DYAD_PERFFLOW=1) | ||
endif() | ||
if(DYAD_PROFILER STREQUAL "DFTRACER") | ||
target_link_libraries(${PROJECT_NAME}_client PRIVATE ${DFTRACER_LIBRARIES}) | ||
endif() | ||
|
||
install( | ||
TARGETS ${PROJECT_NAME}_client | ||
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_CLIENT_PUBLIC_HEADERS}" STREQUAL "") | ||
dyad_install_headers("${DYAD_CLIENT_PUBLIC_HEADERS}" ${CMAKE_CURRENT_SOURCE_DIR}) | ||
endif() |
Oops, something went wrong.