Avoiding loading .mat files every time standalone exe is called

I have a standalone exe (compiled using mcc) that loads a number of .mat files at the beginning of its execution and then does some work analzying data. I've placed this exe on a server to create a web service out of the program. The issue is that I start the exe for each request and each time the program has to load these .mat files, which is a significant amount of the total execution time.
Is there a good way to avoid this? My initial thought was to call the exe at server boot time and having it always running and waiting for new requests that it would get via continuously checking a log file (as it's tough to pass args to the standalone exe once it's already started running). The problem is that the work done on each request could take a number of minutes and would be blocking the web service during that time, so I'd like to spawn a new process each time that could do the work yet refer to those loaded .mat files.
Is this something that can be done using Matlab's Parallel Computing Toolbox? Can the features provided in the toolbox be used easily in a standalone application?
Thanks for your help.

답변 (2개)

Walter Roberson
Walter Roberson 2014년 4월 4일
편집: Walter Roberson 2014년 4월 4일

0 개 추천

Consider having it get the requests via tcp or udp.
The Parallel Computing Toolbox is not able to spawn new processes in the form you want. You could, though, have a pool of processes in the form of SPMD labs, with the inactive labs waiting to be broadcast a message that told them what work to do.
I have never been clear as to what I/O is possible in the labs.

댓글 수: 1

I might have to do something like a pool of processes. Is there a better way of migrating a whole matlab app to a web service that doesn't need matlab than mcc? I thought about matlab builder ja, but the app is rather large and I didn't write it. Would using matlab builder ja have let me use some java threading/fork features?

댓글을 달려면 로그인하십시오.

Image Analyst
Image Analyst 2014년 4월 4일
To determine if the app is running in the development environment or as a standalone app you check isdeployed :
if isdeployed
% It's a stand alone executable.
% Skip loading mat file.
else
% It's the MATLAB development environment
% Load the mat files
storedStructure = load(fullMatFileName1); %etc. for other mat files.
end

댓글 수: 2

I still need the data that's in the mat files when the application is deployed
OK fine. So load the mat files when and where you want to. Just avoid loading them in the OpeningFcn function which gets run on startup because you said you don't want to load them upon startup. For example, load them when the user clicks a button or something.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

질문:

2014년 4월 4일

댓글:

2014년 4월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by