Open reddydpusc opened 4 years ago
A better long-term fix for this issue would be to detect the presence of SLURM and preface the use of setenv() with a function such as ~running_under_SLURM() to prevent setting PATH and LD_LIBRARY_PATH when SLURM is present. Because setting either PATH or LD_LIBRARY_PATH incorrectly can prevent finding SLURM, it might be best to do system('ps -e | grep slurred') to see if the SLURM daemon is running or not.
The use of the MATLAB setenv() function to set the PATH and LD_LIBRARY_PATH environment variables breaks the environment setup up by the modules for FSL and mrtrix3 (and others) on the Hyperion supercomputer. Because these packages can be (and usually are) installed in non-standard places in server environments, the assumptions made by the nii_preprocess() pipeline as to the locations of the packages are incorrect.
Changes were made to nii_fmri/nii_batch12.m to make the program simply report non-standard installations of FSL, as long as the FSLDIR variable is set, and the path pointed to by FSLDIR and it exists and is a directory.
An overloaded version of the MATLAB setenv() function is provided in the file _setenv.m, which prevents setting PATH and LD_LIBRARY_PATH, and passes other environment variables along to the builtin MATLAB setenv(). To enable this function on the supercomputer, or if the user wishes to set the PATH and LD_LIBRARY_PATH statically ahead or execution, simply remove the underscore.
Note that disabling the code above by using an underscore needs to be tested. If the underscore fails to disable the code so the builtin setenv() runs, I recommend placing an "_" before setenv in the code itself.