MATLAB: How to run MATLAB Parallel Server as a non-root user on Linux

MATLAB Parallel Server

How can I run MATLAB Parallel Server as a non-root user on Linux?

Best Answer

You can modify the $MATLABROOT/toolbox/parallel/bin/mjs_def.sh file to allow for a non-root user to start and run the MJS processes on cluster nodes. Inside the mjs_def.sh file, you will see variables for PIDBASE, LOCKBASE, LOGBASE, and CHECKPOINTBASE.
Assign each variable to a location where the non-root account that you plan to run the service as can write. For example, if you made the directory /var/mdce-cfg writable, you could make a subfolder for each base, and point the respective variables to the respective directories. For example, you could create the writable directory:
/var/mjs-cfg/mdce_pid
for PIDBASE,
/var/mjs-cfg/mdce_log
for LOGBASE, and so on. Once you have created the necessary locations and assigned the variables in mjs_def.sh to the respective locations, you will be able to start the service on cluster nodes as the non-root user.
NOTE: Starting in R2019a the following name changes occurred:
  • MATLAB Distributed Computing Server was renamed to MATLAB Parallel Server
  • mdce_def was renamed to mjs_def
  • mdce binary was renamed to mjs
  • mjs_def.bat file is in $MATLAB/R20XXx/toolbox/distcomp/bin for R2019a and earlier.