MATLAB: How to set the LD_LIBRARY_PATH for the worker processes in MATLAB Distributed Computing Engine 1.0.1 (R14SP2) on Solaris 5.8

ld_library_pathMATLAB Parallel ServerParallel Computing Toolboxthreadworker

I want all my MDCE worker threads to start up with a particular directory in their path. I start the job managers and worker processes as the "dce" user, for whom I set LD_LIBRARY_PATH in its ~dce/.cshrc. But the worker processes run with their default LD_LIBRARY_PATH.
I also tried putting the following in startworker.sh before it starts Java, and restarted the workers:
LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
But the workers still have the default LD_LIBRARY_PATH.
The SETENV command will not work because that is a csh command, whereas I am using sh.

Best Answer

To work around this issue, you need to set the environment variable in the process mdced. There are two ways this can be done:
1. In the shell that you are about to start the mdce service in, set the LD_LIBRARY_PATH before starting the service. All child processes of mdced, including MATLAB, will pick up the path.
2. Modify the 'mdce_def.sh' file to set the LD_LIBRARY_PATH variable. The 'mdce_def.sh' file is always sourced by all MDCE startup and shutdown scripts. Hence, MATLAB will pick up the variable if it is set in the script prior to starting the MDCE services.