mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
Implements Apple Silicon GPU acceleration using MLX framework: C++ Implementation: - MLXConsensus class with GPU batch processing - Adaptive batch processor with automatic size tuning - Example with benchmarks showing 25-30x speedup - CMake integration with optional MLX support Python Implementation: - MLXConsensusBackend with GPU acceleration - Neural network model for consensus decisions - Tested with 359.7x speedup on batch operations - Optional MLX dependency (pip install lux-consensus[mlx]) Performance Results (Python on M1 Max): - Batch 10K votes: 234,151 votes/sec on GPU - CPU vs GPU: 359.7x speedup - Memory: 17.3 MB peak Both implementations provide: - Automatic GPU/CPU fallback - Memory monitoring - Batch processing optimization - Zero-copy operations on Apple Silicon
27 lines
539 B
Python
27 lines
539 B
Python
"""
|
|
Lux Consensus Python SDK
|
|
|
|
High-performance consensus implementation with optional MLX GPU acceleration.
|
|
"""
|
|
|
|
try:
|
|
from .mlx_backend import (
|
|
MLXConsensusBackend,
|
|
MLXConsensusModel,
|
|
AdaptiveMLXBatchProcessor
|
|
)
|
|
_MLX_AVAILABLE = True
|
|
except ImportError:
|
|
_MLX_AVAILABLE = False
|
|
MLXConsensusBackend = None
|
|
MLXConsensusModel = None
|
|
AdaptiveMLXBatchProcessor = None
|
|
|
|
__all__ = [
|
|
"MLXConsensusBackend",
|
|
"MLXConsensusModel",
|
|
"AdaptiveMLXBatchProcessor",
|
|
]
|
|
|
|
__version__ = "1.21.0"
|