ECKIT-635 FAM Mock and data structures on FAM via OpenFAM lib#209
ECKIT-635 FAM Mock and data structures on FAM via OpenFAM lib#209mcakircali wants to merge 240 commits intodevelopfrom
Conversation
new option OPENFAM (requires OpenFAM and gRPC packages) FAM source files
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 57 out of 58 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 57 out of 58 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ca84fec to
682537f
Compare
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
ECKIT-635
|
|
||
| ecbuild_add_option( FEATURE OPENFAM | ||
| DEFAULT OFF | ||
| REQUIRED_PACKAGES "LibUUID REQUIRED" "OpenFAM 3.2.0 REQUIRED" |
There was a problem hiding this comment.
You definitely do not need to repeat "REQUIRED" within the REQUIRED_PACKAGES.
Also, for something truly optional, I don't know that we want to pollute the output with error messages for optional packages.
Typically something like:
find_package(LibUUID QUIET)
find_package(OpenFAM 3.2 QUIET)
ecbuild_add_option(
FEATURE OPENFAM_MOCK
DEFAULT NOT OpenFAM_FOUND
CONDITION LibUUID_FOUND
DESCRITION "Use dummy implementation of FAM for testing"
)
ecbuild_add_option(
FEATURE OPENFAM
DEFAULT ON
CONDITION (OpenFAM_FOUND OR HAVE_OPENFAM_MOCK) AND LibUUID_FOUND)
DESCRIPTION "OPENFAM suuport"
)
(Code not tested, apologies for any typos/errors)
| REQUIRED_PACKAGES "LibUUID REQUIRED" | ||
| DESCRIPTION "Enables OpenFAM Mock for testing and development." ) | ||
|
|
||
| if( eckit_HAVE_OPENFAM_MOCK ) |
There was a problem hiding this comment.
The logic here is not quite right. See suggestion for previous comment.
| namespace mock { | ||
|
|
||
| //---------------------------------------------------------------------------------------------------------------------- | ||
| /// Capacity (@note: don't just change values) |
There was a problem hiding this comment.
Can you explain what these values are, where they come from, and why they should not just be changed. That is not obvious at all.
|
|
||
| // Build time check that State fits into the shared-memory segment. | ||
| // Leave at least 16 MiB for the data area. | ||
| static_assert(sizeof(State) + 16 * 1024 * 1024 <= g_shm_total_size, |
There was a problem hiding this comment.
Why 16MiB? That is a bit of a magic number here?
| void reset(); | ||
|
|
||
| /// Same as reset() but must be called while the mutex is held (e.g., during initialization). | ||
| void resetUnlocked(); |
There was a problem hiding this comment.
Is this something we want to have as a public method?
| new_object.put(length, offsetof(FamListNode, length)); | ||
| new_object.put(data, sizeof(FamListNode), length); | ||
|
|
||
| // 2. Link into list: use CAS-loop to atomically update head.next |
There was a problem hiding this comment.
Be explicit. CAS === Compare-And-Swap.
| /// | ||
| /// Supports multiple readers and writers operating concurrently without locks. | ||
| /// Implements wait-free insertion and logical deletion, with version-based ABA detection. | ||
| class FamList { |
There was a problem hiding this comment.
This class really is great.
|
|
||
| /// Check if key already exists | ||
| /// @note: This check-then-insert sequence is not atomic. | ||
| /// concurrent inserts of the same key may both insert resulting duplicates. |
There was a problem hiding this comment.
Please come and discuss. I want to understand what needs to be done to make this 'right'.
Can we write a test case that fails due to the non-atomicity.
|
|
||
| /// Encode a key-value pair into a flat buffer for storage in FamList nodes. | ||
| /// Layout: [key (KeySize bytes)] [value data (length bytes)] | ||
| static Buffer encode(const key_type& key, const void* data, size_type length) { |
There was a problem hiding this comment.
Do we need to construct a contiguous buffer, and write that to FAM. IS that more efficient than writing the data to FAM directly in two chunks, only doing the assembly in-situ?
| } | ||
| ++bucket_; | ||
| } | ||
| // we reached the end |
There was a problem hiding this comment.
some of these comments are pretty uninformative.
Description
Adds a FAM-backed unordered map (plus supporting list/session/URI infrastructure) and an OpenFAM mock implementation to enable development/testing without a real OpenFAM deployment.
Introduces:
Contributor Declaration
By opening this pull request, I affirm the following:
🌦️ >> Documentation << 🌦️
https://sites.ecmwf.int/docs/dev-section/eckit/pull-requests/PR-209