tahamajs's picture
download
raw
10.6 kB
#!/bin/bash
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m'
print_status() {
echo -e "${GREEN}[INFO]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_header() {
echo -e "${CYAN}================================${NC}"
echo -e "${CYAN}$1${NC}"
echo -e "${CYAN}================================${NC}"
}
command_exists() {
command -v "$1" >/dev/null 2>&1
}
check_python_version() {
if command_exists python3; then
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d. -f1)
PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d. -f2)
if [ "$PYTHON_MAJOR" -gt 3 ] || ([ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -ge 8 ]); then
print_status "Python version $PYTHON_VERSION is compatible"
return 0
else
print_error "Python version $PYTHON_VERSION is too old. Need 3.8+"
return 1
fi
else
print_error "Python3 not found. Please install Python 3.8+"
return 1
fi
}
check_system_requirements() {
print_header "System Requirements Check"
if ! check_python_version; then
exit 1
fi
if command_exists free; then
MEMORY_GB=$(free -g | awk '/^Mem:/{print $2}')
if [ "$MEMORY_GB" -lt 4 ]; then
print_warning "Low memory detected: ${MEMORY_GB}GB. Recommended: 8GB+"
else
print_status "Memory: ${MEMORY_GB}GB (sufficient)"
fi
fi
CPU_CORES=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo "unknown")
print_status "CPU cores: $CPU_CORES"
if command_exists nvidia-smi; then
GPU_INFO=$(nvidia-smi --query-gpu=name,memory.total --format=csv,noheader,nounits | head -1)
print_status "GPU detected: $GPU_INFO"
else
print_warning "No NVIDIA GPU detected. Analysis will run on CPU only."
fi
echo ""
}
setup_virtual_environment() {
print_header "Virtual Environment Setup"
if [ ! -d "venv" ]; then
print_status "Creating virtual environment..."
python3 -m venv venv
else
print_status "Virtual environment already exists"
fi
print_status "Activating virtual environment..."
source venv/bin/activate
print_status "Upgrading pip..."
pip install --upgrade pip
echo ""
}
install_dependencies() {
print_header "Dependency Installation"
if [ ! -f "requirements.txt" ]; then
print_error "requirements.txt not found!"
exit 1
fi
print_status "Installing Python dependencies..."
pip install -r requirements.txt
print_status "Verifying critical packages..."
python3 -c "
import numpy, torch, matplotlib, seaborn, plotly, pandas
print('โœ… All critical packages imported successfully')
"
print_status "Checking AI packages..."
python3 -c "
try:
import google.generativeai
print('โœ… Gemini API available')
except ImportError:
print('โŒ Gemini API not available')
try:
import langchain
print('โœ… LangChain available')
except ImportError:
print('โŒ LangChain not available')
try:
import langgraph
print('โœ… LangGraph available')
except ImportError:
print('โŒ LangGraph not available')
"
echo ""
}
create_directories() {
print_header "Directory Setup"
print_status "Creating output directories..."
mkdir -p visualizations
mkdir -p results/plots
mkdir -p results/data
mkdir -p results/models
mkdir -p results/logs
mkdir -p results/reports
mkdir -p logs
mkdir -p ai_reports
mkdir -p workflow_outputs
mkdir -p memory_vectorstore
print_status "Directory structure created"
echo ""
}
run_basic_tests() {
print_header "Basic Functionality Tests"
if [ ! -f "test_basic.py" ]; then
print_error "test_basic.py not found!"
exit 1
fi
print_status "Running basic functionality test..."
python3 test_basic.py
if [ -f "test_ai_features.py" ]; then
print_status "Running AI features test..."
python3 test_ai_features.py
else
print_warning "test_ai_features.py not found - skipping AI features test"
fi
if [ $? -eq 0 ]; then
print_status "โœ… Basic tests passed!"
else
print_error "โŒ Basic tests failed!"
exit 1
fi
echo ""
}
run_main_analysis() {
print_header "Advanced Memory Systems Analysis"
if [ ! -f "main.py" ]; then
print_error "main.py not found!"
exit 1
fi
print_status "Starting comprehensive memory analysis..."
print_status "This includes:"
print_status " - Memory access pattern analysis"
print_status " - Cache-aware algorithm benchmarks"
print_status " - Memory-efficient neural network analysis"
print_status " - Advanced memory systems analysis"
print_status " - Distributed memory systems analysis"
print_status " - Advanced simulators analysis"
print_status " - Interactive visualizations"
print_status " - AI-powered analysis with Gemini API"
print_status " - LangChain memory management"
print_status " - LangGraph workflow orchestration"
echo ""
python3 main.py
if [ $? -eq 0 ]; then
print_status "โœ… Analysis completed successfully!"
else
print_error "โŒ Analysis failed!"
exit 1
fi
echo ""
}
display_results() {
print_header "Analysis Results"
if [ -d "visualizations" ]; then
print_status "๐Ÿ“Š Results saved to visualizations/ directory"
print_status "๐Ÿ“‹ Check visualizations/final_report.txt for summary"
print_status "๐ŸŒ Open visualizations/interactive_report.html for interactive report"
echo ""
print_status "Generated files:"
ls -la visualizations/ | head -20
if [ $(ls -1 visualizations/ | wc -l) -gt 20 ]; then
print_status "... and $(($(ls -1 visualizations/ | wc -l) - 20)) more files"
fi
echo ""
print_status "Total size of results:"
du -sh visualizations/ 2>/dev/null || echo "Unable to calculate size"
else
print_warning "No visualizations directory found"
fi
if [ -d "ai_reports" ]; then
print_status "๐Ÿค– AI-generated reports saved to ai_reports/ directory"
ls -la ai_reports/ | head -10
echo ""
fi
if [ -d "workflow_outputs" ]; then
print_status "๐Ÿ”„ Workflow outputs saved to workflow_outputs/ directory"
ls -la workflow_outputs/ | head -10
echo ""
fi
echo ""
}
run_jupyter_notebook() {
if [ "$1" = "--notebook" ]; then
print_header "Jupyter Notebook Mode"
print_status "Starting Jupyter notebook..."
print_status "Open http://localhost:8888 in your browser"
print_status "Press Ctrl+C to stop the notebook server"
echo ""
jupyter notebook CA20.ipynb
fi
}
cleanup() {
print_header "Cleanup"
if [ -n "$VIRTUAL_ENV" ]; then
print_status "Deactivating virtual environment..."
deactivate
fi
print_status "Cleanup completed"
echo ""
}
show_help() {
echo "CA20: Advanced Memory Systems in AI - Execution Script"
echo ""
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --help, -h Show this help message"
echo " --notebook, -n Run Jupyter notebook instead of main analysis"
echo " --test-only, -t Run only basic tests"
echo " --skip-tests, -s Skip basic tests"
echo ""
echo "Examples:"
echo " $0 # Run complete analysis"
echo " $0 --notebook # Start Jupyter notebook"
echo " $0 --test-only # Run only basic tests"
echo " $0 --skip-tests # Skip tests and run analysis directly"
echo ""
}
main() {
# Change to project root directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_ROOT"
print_status "Working directory: $PROJECT_ROOT"
echo ""
SKIP_TESTS=false
TEST_ONLY=false
NOTEBOOK_MODE=false
while [[ $# -gt 0 ]]; do
case $1 in
--help|-h)
show_help
exit 0
;;
--notebook|-n)
NOTEBOOK_MODE=true
shift
;;
--test-only|-t)
TEST_ONLY=true
shift
;;
--skip-tests|-s)
SKIP_TESTS=true
shift
;;
*)
print_error "Unknown option: $1"
show_help
exit 1
;;
esac
done
print_header "CA20: Advanced Memory Systems in AI"
print_status "Starting comprehensive memory analysis..."
echo ""
check_system_requirements
setup_virtual_environment
install_dependencies
create_directories
if [ "$SKIP_TESTS" = false ]; then
run_basic_tests
fi
if [ "$TEST_ONLY" = true ]; then
print_status "Test-only mode: Skipping main analysis"
elif [ "$NOTEBOOK_MODE" = true ]; then
run_jupyter_notebook
else
run_main_analysis
display_results
fi
cleanup
if [ "$TEST_ONLY" = false ] && [ "$NOTEBOOK_MODE" = false ]; then
print_header "Analysis Complete"
print_status "๐ŸŽ‰ CA20 Advanced Memory Systems Analysis with AI Features completed successfully!"
print_status "๐Ÿ“Š Check the visualizations/ directory for traditional results"
print_status "๐Ÿค– Check the ai_reports/ directory for AI-generated insights"
print_status "๐Ÿ”„ Check the workflow_outputs/ directory for workflow results"
print_status "๐Ÿ“‹ Read visualizations/final_report.txt for detailed summary"
print_status "๐ŸŒ Open visualizations/interactive_report.html for interactive report"
echo ""
print_status "Thank you for using CA20!"
fi
}
trap cleanup EXIT
main "$@"

Xet Storage Details

Size:
10.6 kB
ยท
Xet hash:
85bf77a28eb517b5f7cd242668605fa1291388b2140a4fd05ab532179dcc7a71

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.