83 lines
2.2 KiB
Bash
83 lines
2.2 KiB
Bash
#!/bin/bash
|
|
|
|
# Simple optimized processing script (no root required)
|
|
# Focuses on Python-level optimizations for 192 cores
|
|
|
|
set -e
|
|
|
|
echo "🚀 Starting optimized processing for 192 cores..."
|
|
|
|
# Set environment variables for optimal performance
|
|
export PYTHONUNBUFFERED=1
|
|
export PYTHONOPTIMIZE=2
|
|
export OMP_NUM_THREADS=192
|
|
export MKL_NUM_THREADS=192
|
|
export OPENBLAS_NUM_THREADS=192
|
|
export VECLIB_MAXIMUM_THREADS=192
|
|
export NUMEXPR_NUM_THREADS=192
|
|
|
|
# Install dependencies if needed
|
|
echo "📦 Installing dependencies..."
|
|
pip install -r requirements_optimized.txt
|
|
|
|
# Check if Vosk service is running
|
|
echo "🔍 Checking Vosk service status..."
|
|
if ! curl -s http://localhost:5000/ > /dev/null; then
|
|
echo "⚠️ Vosk service not running. Starting service..."
|
|
|
|
# Start Vosk service
|
|
cd ../vosk_service
|
|
chmod +x start_with_deps.sh
|
|
./start_with_deps.sh &
|
|
VOSK_PID=$!
|
|
echo "✅ Vosk service started with PID: $VOSK_PID"
|
|
|
|
# Wait for service to be ready
|
|
echo "⏳ Waiting for service to be ready..."
|
|
for i in {1..30}; do
|
|
if curl -s http://localhost:5000/ > /dev/null; then
|
|
echo "✅ Service is ready!"
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
else
|
|
echo "✅ Vosk service is already running"
|
|
fi
|
|
|
|
# Start performance monitoring
|
|
echo "📊 Starting performance monitoring..."
|
|
python monitor_performance.py &
|
|
MONITOR_PID=$!
|
|
echo "✅ Performance monitor started with PID: $MONITOR_PID"
|
|
|
|
# Function to cleanup on exit
|
|
cleanup() {
|
|
echo "🧹 Cleaning up..."
|
|
if [ ! -z "$VOSK_PID" ]; then
|
|
kill $VOSK_PID 2>/dev/null || true
|
|
fi
|
|
if [ ! -z "$MONITOR_PID" ]; then
|
|
kill $MONITOR_PID 2>/dev/null || true
|
|
fi
|
|
echo "✅ Cleanup complete"
|
|
}
|
|
|
|
# Set trap to cleanup on script exit
|
|
trap cleanup EXIT
|
|
|
|
# Run the optimized processing
|
|
echo "🎯 Starting optimized processing with 192 cores..."
|
|
echo "📊 Configuration:"
|
|
echo " - CPU cores: 192"
|
|
echo " - Batch size: 32"
|
|
echo " - Max concurrent requests: 48"
|
|
echo " - Process pool workers: 192"
|
|
echo ""
|
|
|
|
# Run the optimized script
|
|
python batch_confirm_hf_optimized.py
|
|
|
|
echo "✅ Processing complete!"
|
|
echo "📈 Check performance_plot.png for detailed performance analysis"
|
|
echo "📊 Check performance_log.json for raw performance data" |