Make CUDA a weak dependency using package extensions#80
Merged
Conversation
Set persist credentials to false.
📦 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Move CUDA from [deps] to [weakdeps] - Add TrackingCUDAExt extension 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove 'using CUDA' statement - Remove GPU file inclusion - Remove GPU type exports (moved to extension) - Keep abstract type for extension dispatch 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Extension activates when CUDA is loaded and provides GPU types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
All CUDA-specific code now lives in TrackingCUDAExt extension. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Export the following types and functions required by TrackingCUDAExt: Types: - AbstractCorrelator - AbstractDownconvertAndCorrelator - MultipleSystemType - MultipleSystemSatsState Functions: - get_num_accumulators - get_correlator_sample_shifts - calc_signal_samples_to_integrate - update - get_code_frequency - get_code_length - get_codes - get_modulation - get_secondary_code - update_accumulator This resolves the UndefVarError: AbstractCorrelator not defined error that prevented the CUDA extension from loading. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Declare global variables in Tracking module for GPU types - Use __init__ function in TrackingCUDAExt to assign types to parent module - GPU types (GPUSatDownconvertAndCorrelator, GPUSystemDownconvertAndCorrelator, GPUDownconvertAndCorrelator) and convert_code_to_texture_memory function are now accessible via Tracking.* when CUDA is loaded - Extension exports don't propagate to parent module, so explicit assignment via @eval in __init__ is required Fixes issue where GPU types existed in TrackingCUDAExt but were not accessible in the Tracking namespace despite export statements.
…ngCUDAExt - Remove __init__() from extension (user requested to avoid it) - Remove global declarations from main module - Update extension to use simple export pattern - Update test imports to use Tracking.TrackingCUDAExt.GPUDownconvertAndCorrelator - GPU types now accessible as Tracking.TrackingCUDAExt.TypeName 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Note that GPU features require explicit CUDA loading - Add GPU support section with usage example 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Created ext/TrackingCUDAExt/test/runtests.jl with GPU-specific tests - Extracted GPU downconvert_and_correlate tests from test/downconvert_and_correlate.jl - Extracted "Track multiple signals with GPU" test from test/track.jl - Removed CUDA imports and GPUDownconvertAndCorrelator imports from main test files - Updated test/Project.toml to remove CUDA and Pkg dependencies - Main tests now run without CUDA dependency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updated extension tests to properly access GPU types using Base.get_extension instead of direct module reference, which is the correct pattern for Julia package extensions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updated the CI pipeline to test GPU functionality from the extension tests instead of the main test suite, since GPU tests have been moved to ext/TrackingCUDAExt/test/. Changes: - Run GPU extension tests directly using the extension test environment - First instantiate the extension test dependencies - Then execute the GPU test suite - Removed standard julia-test plugin in favor of custom commands 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
The CI was failing because Pkg.instantiate() alone doesn't resolve the local Tracking package's dependencies (like Statistics). Adding Pkg.develop(PackageSpec(path=pwd())) before instantiate ensures all transitive dependencies are properly resolved. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Extension test Manifest.toml files are environment-specific and should not be tracked in git. Added pattern to .gitignore to exclude all extension test Manifests. These files are regenerated by CI via Pkg.instantiate(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Removed .github/workflows/documenter.yml and docs/Project.toml which were accidentally included in commit e119311. These files are not related to the CUDA weak dependency implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Update README to show the standard Julia pattern for accessing extension types via Base.get_extension(). This is the idiomatic approach that avoids incremental compilation issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
The extension needs to explicitly import downconvert_and_correlate and downconvert_and_correlate! from the parent Tracking module in order to add GPU-specific method implementations. Without this import, the GPU methods are defined in the extension's namespace only and don't extend the generic functions from Tracking, causing MethodError when calling with GPU types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add missing imports for get_num_samples (not exported) and update (exported by both CUDA and Tracking) to resolve UndefVarError and name conflict warning in the GPU extension. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
zsoerenm
enabled auto-merge (rebase)
November 19, 2025 14:08
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.

Make CUDA a weak dependency using package extensions
Converts CUDA from a hard dependency to a weak dependency using Julia's package extension system (Julia 1.10+). This allows CPU-only users to install and use Tracking.jl without downloading CUDA, while maintaining full GPU functionality for users who need it.
Changes
Package Configuration
[deps]to[weakdeps]and added[extensions]sectionTrackingCUDAExtactivates automatically when CUDA is loadedCode Organization
ext/TrackingCUDAExt/ext/TrackingCUDAExt/TrackingCUDAExt.jlext/TrackingCUDAExt/downconvert_and_correlate_gpu.jl(346 lines)src/Tracking.jlTesting
test/Project.toml- all 100,000+ tests now run without CUDAext/TrackingCUDAExt/test/(222 lines) - run separately with CUDA availableDocumentation
using CUDA)Base.get_extension(Tracking, :TrackingCUDAExt)CI/CD
using CUDAto their codeUsage
CPU-only (no CUDA required)
With GPU support
Benefits