Add Google Cloud Storage reader support - #6467
Draft
mzient wants to merge 1 commit into
Draft
Conversation
DALI can read from S3 but not from GCS, so datasets on Google Cloud have to be staged elsewhere first. Add a gs:// backend mirroring the existing S3 layer: FileStream::Open and discover_files gain a gs:// branch, guarded by a new BUILD_GCS/GCS_ENABLED option that auto-disables when google-cloud-cpp is absent. Three details differ from the S3 path. google::cloud::storage::Client is not documented as safe for concurrent use of a single instance, while copies of it are and share the connection pool, so GCSClientManager hands out copies and GCSFileStream owns one instead of borrowing a shared pointer. There is no InitAPI/ShutdownAPI equivalent to serialize, as the library initializes libcurl lazily. Reads land directly in the caller's buffer via std::istream::read, so no preallocated stream buffer is needed, and ReadRange is right-open unlike the inclusive HTTP byte range. Download checksum validation is off by default: DALI only issues ranged reads and GCS reports checksums for whole objects, so a per-read CRC32C cannot be validated end-to-end. DALI_GCS_VERIFY_CHECKSUMS re-enables it, DALI_GCS_ENDPOINT_URL overrides the endpoint, and DALI_GCS_ANONYMOUS selects insecure credentials for public buckets and emulators. Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Category:
New feature (non-breaking change which adds functionality)
Description:
DALI can read from S3 but not from GCS, so datasets on Google Cloud have to be staged elsewhere first. Add a gs:// backend mirroring the existing S3 layer: FileStream::Open and discover_files gain a gs:// branch, guarded by a new BUILD_GCS/GCS_ENABLED option that auto-disables when google-cloud-cpp is absent.
Three details differ from the S3 path. google::cloud::storage::Client is not documented as safe for concurrent use of a single instance, while copies of it are and share the connection pool, so GCSClientManager hands out copies and GCSFileStream owns one instead of borrowing a shared pointer. There is no InitAPI/ShutdownAPI equivalent to serialize, as the library initializes libcurl lazily. Reads land directly in the caller's buffer via std::istream::read, so no preallocated stream buffer is needed, and ReadRange is right-open unlike the inclusive HTTP byte range.
Download checksum validation is off by default: DALI only issues ranged reads and GCS reports checksums for whole objects, so a per-read CRC32C cannot be validated end-to-end. DALI_GCS_VERIFY_CHECKSUMS re-enables it, DALI_GCS_ENDPOINT_URL overrides the endpoint, and DALI_GCS_ANONYMOUS selects insecure credentials for public buckets and emulators.
Additional information:
Affected modules and functionalities:
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A