How to debug C-Code that runs on a Worker with the Parallel Computing Toolbox?

1 view (last 30 days)
I am running different Simulink models in parallel using the parallel computing toolbox. The models are using custom C-code that seems to provide false results when running on differentr workers. How can I debug the s-functions that runs on a worker?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 5 Dec 2013
You can debug the C code that runs in a MATLAB process launched the parallel computing toolbox with a C-compiler such as “Microsoft Visual C++”.
 
For this, follow the below steps:
1. Compile your c code with Visual C++ with a debug flag.
2. Start a of MATLAB sessions for parallel computation
3. Find out the process id of the MATLAB process you need to debug. This can be done with following code:
 
spmd % By default creates pool and uses all workers
feature getpid
end
 
4. Open the c file with Visual Studio and place break point in it.
5. Attach Visual Studio to the corresponding MATLAB process
6. Run and debug your c-code in the corresponding MATLAB worker
 

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2010a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!