Files
aitbc/migration_examples/config_migration.py
oib f353e00172 chore(security): enhance environment configuration, CI workflows, and wallet daemon with security improvements
- Restructure .env.example with security-focused documentation, service-specific environment file references, and AWS Secrets Manager integration
- Update CLI tests workflow to single Python 3.13 version, add pytest-mock dependency, and consolidate test execution with coverage
- Add comprehensive security validation to package publishing workflow with manual approval gates, secret scanning, and release
2026-03-03 10:33:46 +01:00

39 lines
961 B
Python

#!/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
)