GPU vs CPU Performance Analysis - January 5, 2025, 15:30
This folder contains a complete analysis of GPU vs CPU performance for PCAP pattern matching, including all code and data used to generate the results.
Quick Reproduction Steps
Section titled “Quick Reproduction Steps”-
Install Dependencies:
Terminal window pip install cupy-cuda12x scapy pandas colorama -
Run Complete Benchmark:
Terminal window python comprehensive_pattern_benchmark.py -
Run Specific Test:
Terminal window python comprehensive_pattern_benchmark.py --test-id test_001 -
Resume Interrupted Benchmark:
Terminal window python comprehensive_pattern_benchmark.py --resume-from test_019 -
Quick Validation (first 3 tests):
Terminal window python comprehensive_pattern_benchmark.py --quick
Note: Requires NVIDIA GPU with CUDA support. Results saved to comprehensive_benchmark_progress.csv.
Contents
Section titled “Contents”Analysis Report
Section titled “Analysis Report”GPU_vs_CPU_Performance_Analysis_2025-01-05_15-30.md- Complete analysis report with findings, methodology, and conclusions
Benchmark Code
Section titled “Benchmark Code”comprehensive_pattern_benchmark.py- Main benchmark script that orchestrates CPU vs GPU comparisonspcap_gpu_scanner.py- GPU-accelerated PCAP scanner implementationgpu_kernels.py- CUDA kernel implementations for pattern matching algorithms
PCAP Generation Scripts
Section titled “PCAP Generation Scripts”create_large_synthetic_pcap.py- Generates PCAP files with small packets (43-139 bytes average)create_large_packet_pcap.py- Generates PCAP files with large packets (~26KB average)
Data Files
Section titled “Data Files”comprehensive_benchmark_progress.csv- Complete benchmark results from 25 test scenarios
Key Findings
Section titled “Key Findings”- Packet Size Critical: GPU performance heavily depends on packet characteristics
- Small Packets: GPU is 20-300x slower than CPU and consistently times out
- Large Packets: GPU can be competitive (0.19-1.11x speedup) on smaller files
- Algorithm Selection: Dynamic algorithm selection based on pattern count
- Validation Issues: 40% of tests failed due to GPU timeouts
Test Coverage
Section titled “Test Coverage”- 25/30 tests completed (83%)
- PCAP Sizes: 50MB, 100MB, 200MB, 500MB, 1000MB
- Packet Types: Small packets (43-139 bytes) vs Large packets (~26KB)
- Pattern Counts: 1, 7, 14 patterns
- Algorithms: Boyer-Moore-Horspool, Aho-Corasick, Vectorized Multi-Pattern, PFAC
Reproducibility
Section titled “Reproducibility”All code is included to reproduce the analysis. See the methodology section in the main report for detailed execution instructions.
Generated
Section titled “Generated”- Date: January 5, 2025
- Time: 15:30
- Status: Analysis complete, 5 tests remaining (1GB large packet scenarios)