- Change file mode from 644 to 755 for all project files - Add chain_id parameter to get_balance RPC endpoint with default "ait-devnet" - Rename Miner.extra_meta_data to extra_metadata for consistency
39 lines
961 B
Python
Executable File
39 lines
961 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Configuration Migration Example
|
|
|
|
Shows how to migrate configuration to use the new abstraction layer.
|
|
"""
|
|
|
|
# BEFORE (CUDA-specific config)
|
|
# cuda_config = {
|
|
# "lib_path": "./liboptimized_field_operations.so",
|
|
# "device_id": 0,
|
|
# "memory_limit": 8*1024*1024*1024
|
|
# }
|
|
|
|
# AFTER (Backend-agnostic config)
|
|
from gpu_acceleration import ZKOperationConfig, GPUAccelerationManager, ComputeBackend
|
|
|
|
# Configuration for any backend
|
|
config = ZKOperationConfig(
|
|
batch_size=2048,
|
|
use_gpu=True,
|
|
fallback_to_cpu=True,
|
|
timeout=60.0,
|
|
memory_limit=8*1024*1024*1024 # 8GB
|
|
)
|
|
|
|
# Create manager with specific backend
|
|
gpu = GPUAccelerationManager(backend=ComputeBackend.CUDA, config=config)
|
|
gpu.initialize()
|
|
|
|
# Or auto-detect with config
|
|
from gpu_acceleration import create_gpu_manager
|
|
gpu = create_gpu_manager(
|
|
backend="cuda", # or None for auto-detect
|
|
batch_size=2048,
|
|
fallback_to_cpu=True,
|
|
timeout=60.0
|
|
)
|