What problem does it solve?
MATLAB code compiled to CUDA with GPU Coder often underperforms due to redundant computation, memory copies between CPU and GPU, and insufficient kernel parallelism. This Skill iteratively profiles, rewrites, and benchmarks a MATLAB design file until performance targets are met or diagnostics are resolved.
Core Features & Use Cases
- Iterative Optimization Loop: Compiles with codegen, benchmarks with convergence-based timing, applies structural rewrites, and verifies numerical equivalence against the original function at every step.
- Diagnostic-Driven Fixes: Profiles generated code with gpuPerformanceAnalyzer and maps each diagnostic (e.g., UseGpuInput, KernelLaunchOverheadLargeInLoop) to a targeted source-level fix.
- GPU Coder Primitives Reference: Guides use of kernel pragmas, parallel reductions, atomics, stencils, and memory placement from a curated reference document.
- Use Case: You have a MATLAB function that compiles to a slow GPU MEX. This Skill benchmarks the baseline, restructures loops for kernel fusion, eliminates CPU-GPU memory copies flagged by the profiler, and delivers a verified faster version with a full performance report.
Quick Start
Optimize my MATLAB function myKernel.m for GPU Coder and profile it with gpuPerformanceAnalyzer until the generated CUDA code is as fast as possible.