How can I use FileDependencies to make a standalone executable program available to my workers running MATLAB Distributed Computing Engine 2.0 (R14SP3+)?

2 views (last 30 days)
I have successfully used FileDependencies to transfer MATLAB files and data files to my MATLAB Distributed Computing Engine workers. However, when I transfer standalone executables with the FileDependencies property, and try to invoke them using a SYSTEM call, I receive the following error:
'myFile.exe' is not recognized as an internal or external command,
operable program or batch file.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Jan 2010
This issue occurs because the temporary directory for FileDependencies is added to the MATLAB path only, and not to the system path. This is the expected behavior. If you are using Release R2006b or later, use the getFileDependencyDir function in your task function to locate the executable on the workers' path, for example:
%Find the current directory for FileDependencies.
ddir = getFileDependencyDir;
%Change to that directory to invoke an executable.
cdir = cd(ddir);
%Invoke the executable.
[OK, output] = system('myexecutable');
%Change back to the original directory.
cd(ddir);
The getFileDependencyDir function does not ship with versions of MATLAB Distributed Computing Engine prior to Release R2006b. If you are using an older version, download the attached P-file, getFileDependencyDir.p, and make it available to your workers via the "FileDependencies" property of the job:
set(job, 'FileDependencies', {'myFile.exe', 'getFileDependencyDir.p'})
In your task code, use getFileDependencyDir in the same way as shown above, i.e., have the workers navigate to the directory containing the executable to run it from there.
An alternative to using "FileDependencies" is to put the executable on a shared file system accessible to all workers and update the system paths of all workers to include the path to the executable.

More Answers (0)

Categories

Find more on MATLAB Parallel Server 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!