Running GUI and script in parallel with communication
4 views (last 30 days)
Show older comments
Hey all,
I am wondering if it is possible to run an interactive GUI in parallel with another script and have the two communicate. The setup is this:
The GUI m-file controls a microscopy setup consisting of multiple components including a camera (pco.edge). When recording video, images are placed into a large buffer in main memory that was allocated and made persistent via a c++ mex file. Most of the functionality of the microscopy setup is controlled via mex files.
The Saver m-file should run in parallel, saving images to disk after they have been stored to the buffer thus allowing that memory to be reused. (Don't worry, synchronized access has been figured out, i.e. data that hasn't been written to disk won't be overwritten with new data, old data that has been written won't be written again; and also how to handle these situations if/when they arise)
Both processes need to be able to access the buffer, and the GUI needs to inform the Saver: where to save (directory), how many images to save, and the index of where to start saving from in the buffer. The Saver should inform the GUI when it has finished saving a group of images and which group it has saved.
The reason this is desired is that the images can be quite large (10.5 MB per image), readout from the camera is fast, and writing to disk is slowish. Also, for a given experiment, many videos will be taken with specific intervals between the end of one video and the start of another. Saving images sequentially after a video is recorded throws a monkey wrench into the desired behavior.
I have investigated MatlabMPI, but cannot get it to run (mcc errors all over the place). The system is 64-bit windows w/ i7 hex-core processor, 24 GB RAM, MatLab R2011a.
Any thoughts? Can this be done? Any other information you need?
0 Comments
Answers (1)
Walter Roberson
on 15 Sep 2011
Unfortunately, this is a bit dubious in MATLAB, as MATLAB tends to be single-threaded for I/O. The only supported mechanism I can think of at the moment that might work is if you had the Parallel Computing Toolbox and were to use SPMD .
Have you considered using an SSD (Solid State Disc) ?
A mixed strategy could potentially work out: mmemmap() the buffer on to a ramdisk, write to the buffer in one MATLAB session, and pull from it and write to regular disk in a different MATLAB session.
Any strategy that collects data faster than you can write to hard drive is going to need some kind of RAM buffer.
0 Comments
See Also
Categories
Find more on External Language Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!