-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves headers around and modifies CMake to make core/ctx usable as an…
… external library
- Loading branch information
Showing
19 changed files
with
2,703 additions
and
2,681 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef DYAD_CORE_DYAD_H | ||
#define DYAD_CORE_DYAD_H | ||
|
||
// clang-format off | ||
#include <dyad/core/dyad_ctx.h> | ||
#include <dyad/core/dyad_core.h> | ||
// clang-format on | ||
|
||
#endif /* DYAD_CORE_DYAD_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#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 <sys/types.h> | ||
#include <unistd.h> | ||
|
||
#ifdef __cplusplus | ||
#include <cstdio> | ||
#include <cstdlib> | ||
#else | ||
#include <stdbool.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 | ||
DYAD_DLL_EXPORTED extern const struct dyad_ctx dyad_ctx_default; | ||
|
||
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.
This file was deleted.
Oops, something went wrong.
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,69 @@ | ||
#ifndef DYAD_COMMON_STRUCTURES_INT_H | ||
#define DYAD_COMMON_STRUCTURES_INT_H | ||
|
||
#if defined(DYAD_HAS_CONFIG) | ||
#include <dyad/dyad_config.hpp> | ||
#else | ||
#error "no config" | ||
#endif | ||
|
||
#include <dyad/common/dyad_structures.h> | ||
|
||
#ifdef __cplusplus | ||
#include <cstdint> | ||
#else | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @struct dyad_ctx | ||
*/ | ||
struct dyad_ctx { | ||
// Internal | ||
void *h; // the Flux handle for DYAD | ||
struct dyad_dtl *dtl_handle; // Opaque handle to DTL info | ||
const char *fname; // Used to track which file is getting processed. | ||
bool use_fs_locks; // Used to track if fs locks should be used. | ||
char *prod_real_path; // producer managed real path | ||
char *cons_real_path; // consumer managed real path | ||
uint32_t prod_managed_len; // length of producer path managed by DYAD | ||
uint32_t cons_managed_len; // length of consumer path managed by DYAD | ||
uint32_t prod_real_len; // length of producer managed real path | ||
uint32_t cons_real_len; // length of consumer managed real path | ||
uint32_t prod_managed_hash; // hash of producer path managed by DYAD | ||
uint32_t cons_managed_hash; // hash of consumer path managed by DYAD | ||
uint32_t prod_real_hash; // hash of producer managed real path | ||
uint32_t cons_real_hash; // hash of consumer managed real path | ||
uint32_t delim_len; // length of path delimiter | ||
// User Facing | ||
bool debug; // if true, perform debug logging | ||
bool check; // if true, perform some check logging | ||
bool reenter; // if false, do not recursively enter DYAD | ||
bool initialized; // if true, DYAD is initialized | ||
bool shared_storage; // if true, the managed path is shared | ||
bool async_publish; // Enable asynchronous publish by producer | ||
bool fsync_write; // Apply fsync after write by producer | ||
unsigned int key_depth; // Depth of bins for the Flux KVS | ||
unsigned int key_bins; // Number of bins for the Flux KVS | ||
uint32_t rank; // Flux rank for DYAD | ||
uint32_t service_mux; // Number of Flux brokers sharing node-local storage | ||
uint32_t node_idx; // Index of the node hosting broker(s) | ||
int pid; // unix process id, obtained by getpid() | ||
char *kvs_namespace; // Flux KVS namespace for DYAD | ||
char *prod_managed_path; // producer path managed by DYAD | ||
char *cons_managed_path; // consumer path managed by DYAD | ||
bool | ||
relative_to_managed_path; // relative path is relative to the managed path | ||
}; | ||
typedef void *ucx_ep_cache_h; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // DYAD_COMMON_STRUCTURES_INT_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
Oops, something went wrong.