-
Notifications
You must be signed in to change notification settings - Fork 22
Optional gams.transfer backend for read + write (opt-in, v2.1.0) #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
23e94ed
test: trim release-planning note from test_symbol_types_round_trip do…
elainethale 2923be7
docs: stage gams.transfer backend (v2.1.0) with symmetric architectur…
elainethale dd81362
refactor: extract gdxcc read primitive behind a GdxBackend ABC
elainethale c0fc00e
refactor: move GDX metadata reading into GdxccBackend.open_read
elainethale e72cbf0
refactor: move GDX write path + handle ownership into GdxccBackend
elainethale 9cf687d
docs: record GdxFile.H as a v3.0.0 deprecation candidate in Known warts
elainethale c26fc13
refactor: unify set-text reads through GdxFile.load_all (Phase 0)
elainethale 03f5762
style: drop trailing whitespace in test_symbol_types_round_trip docst…
elainethale 0c64ffb
feat: opt-in backend selection + symbol-subset reads (Step 1)
elainethale ad70f9b
feat: gams.transfer read backend (Phase A)
elainethale 927847c
fix: HAVE_GAMS_TRANSFER reflects usability, not just importability
elainethale 2fc182e
feat: read Aliases as Sets in both backends
elainethale 33ce9d2
docs: record v2.1.0 progress (Phase 0/Step 1/Phase A) and alias-as-Se…
elainethale e16aa44
feat: gams.transfer write backend (Phase B)
elainethale c640423
test: document gdxcc vs gams_transfer read/write speed across fixtures
elainethale 4ee6467
feat: --backend flag for the CLIs; document GAMS/engine configuration…
elainethale 8ddbcb1
fix: address Copilot PR #111 review (special-value parity, probe, typ…
elainethale e0f7de4
fix: address Copilot PR #111 review (round 2) + docstring cleanup
elainethale 11f9dc3
release: prep v2.1.0 (version bump, CHANGES, ROADMAP)
elainethale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,62 @@ | ||
| """Generate tests/data/alias_fixture.gdx. | ||
|
|
||
| A 1D parent Set plus an Alias of it, used by the backend read-parity tests. | ||
| gdxpds has no API for *writing* aliases (to_gdx infers types from DataFrame | ||
| shape and never emits an alias), so this is built with the raw gdxcc bindings | ||
| (gdxAddAlias), the same low-level approach used in build_set_text_fixture.py. | ||
| Committed to the repo; only re-run this if the schema changes. | ||
|
|
||
| Usage (from repo root, with the venv active and $env:GAMS_DIR set): | ||
|
|
||
| python dev\\build_alias_fixture.py | ||
|
|
||
| Schema: | ||
| Set t : 1D, elements a / b / c | ||
| Alias at : alias of t | ||
| """ | ||
|
|
||
| import os | ||
|
|
||
| import gdxpds.gdx | ||
|
|
||
| try: | ||
| from gams.core import gdx as gdxcc | ||
| except ImportError: | ||
| import gdxcc | ||
|
|
||
| OUT_PATH = os.path.abspath( | ||
| os.path.join(os.path.dirname(__file__), "..", "tests", "data", "alias_fixture.gdx") | ||
| ) | ||
|
|
||
| ELEMENTS = ["a", "b", "c"] | ||
|
|
||
|
|
||
| def main(): | ||
| with gdxpds.gdx.GdxFile() as f: | ||
| if not gdxcc.gdxOpenWrite(f.H, OUT_PATH, "gdxpds"): | ||
| raise gdxpds.gdx.GdxError(f.H, f"Could not open {OUT_PATH!r} for writing") | ||
| f.universal_set.write() | ||
|
|
||
| # Parent set t = {a, b, c}. | ||
| if not gdxcc.gdxDataWriteStrStart( | ||
| f.H, "t", "parent set", 1, gdxpds.gdx.GamsDataType.Set.value, 0 | ||
| ): | ||
| raise gdxpds.gdx.GdxError(f.H, "Could not start writing data for symbol t") | ||
| gdxcc.gdxSymbolSetDomainX(f.H, 1, ["*"]) | ||
| values = gdxcc.doubleArray(gdxcc.GMS_VAL_MAX) | ||
| values[gdxcc.GMS_VAL_LEVEL] = 0.0 | ||
| for elem in ELEMENTS: | ||
| gdxcc.gdxDataWriteStr(f.H, [elem], values) | ||
| gdxcc.gdxDataWriteDone(f.H) | ||
|
|
||
| # Alias at -> t. | ||
| if not gdxcc.gdxAddAlias(f.H, "t", "at"): | ||
| raise gdxpds.gdx.GdxError(f.H, "Could not add alias at -> t") | ||
|
|
||
| gdxcc.gdxClose(f.H) | ||
|
|
||
| print(f"Wrote {OUT_PATH} ({os.path.getsize(OUT_PATH)} bytes)") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.