AI Blocks › Build and ship software
Parallel worker setup helper
Give it code that fails on workers. Get paths, variables and shared objects set up on each worker.
Parallel worker setup helper is a free AI skill for the job "Build and ship software". Give the instructions to an AI assistant that supports the required files and tools, then review its output.
Free · No account · BSD 2 Clause licence · Made by MathWorks · Level: advanced
Made by MathWorks. See the original on GitHub; we copied it as it is, with its licence.
What it does
Parallel MATLAB code that stops failing on workers because each worker has the paths, variables and objects it needs. It fixes errors like undefined function, cannot serialize or slow data transfer. Workers share your path but do not inherit loaded libraries, open database connections or heavy objects. The skill shows which tool fits each case. Use parallel.pool.Constant for items that cannot be copied, parfevalOnAll to run setup once on every worker, and pool options for settings set at start. It also replaces the setup-with-spmd habit that wastes time. You need MATLAB with Parallel Computing Toolbox.
You give it
- Your MATLAB code
- The error message (optional)
- What each worker needs, such as a library or data file
You get
- The cause of the worker failure
- Setup code using the right parallel tool
- Reduced data transfer
- Cleaned-up replacement for spmd setup
Use it when
- A parfor loop works in a normal for loop but errors on workers.
- Each worker needs its own database connection.
- Large data is copied again on every loop pass and it is slow.
- You use spmd only to set things up before a loop.
How to use it
- Add it to your AI once: download it and add the folder to Claude, ChatGPT or Codex as a skill.
- Ask for the job in your own words. Your AI opens the skill when it fits.
- It works best when your AI can run MATLAB.