What problem does it solve?
Parallel MATLAB code often fails or runs inefficiently because workers lack loaded libraries, database connections, paths, or expensive pre-computed objects that exist only on the client. This Skill teaches the correct APIs for setting up per-worker state so parfor and parfeval loops run without serialization errors or repeated per-iteration overhead.
Core Features & Use Cases
- Per-Worker Resources: Create non-serializable resources like database connections and shared libraries on each worker using parallel.pool.Constant with build and cleanup functions.
- Pool Configuration: Set worker paths and environment variables via parpool name-value pairs or parfevalOnAll on existing pools without recreating them.
- Anti-Pattern Modernization: Refactor fragile spmd-based setup code into robust Constant-based patterns with automatic cleanup.
- Use Case: A user needs to run a parfor loop that queries a database. Instead of opening a connection every iteration, the Skill guides them to use createConnectionForPool so each worker holds one persistent connection with automatic teardown.
Quick Start
Ask the agent to set up a parallel.pool.Constant so each worker loads data from a MAT-file once before the parfor loop runs.