Issue using compiled code in a singularity container
7 次查看(过去 30 天)
显示 更早的评论
Hi,
I've containerised a few processing steps into Docker images using compiled MATLAB code, which works fine. However, as I will need to run this code in a HPC environment, I need to convert these to Singularity images. Unfortuantely, after the conversion, one of my processing steps crashes with the following error:
Failed to create a directory required to extract the CTF file.
Please make sure that you have the appropriate permissions and re-run the application
Error initiliazing CTF Archive:
Some error has occured in the file: core/mclCtfFileExtractor.cpp, at line 62.
The error message is:
Failed to create a directory required to extract the CTF file.
Please make sure that you have the appropriate permissions and re-run the application
It looks like it tries to unpack some MCR related files into /root. I've tried to chmod 777 that directory, along with a lot of other directories, but this does not fix the error. Additionally, I tried to change where it will be unpacked to (see https://au.mathworks.com/matlabcentral/answers/234664-changing-the-location-of-unpacking-for-deployed-application), but this seemed to have no effect at all.
My build command for the standalone application is
Nopts = {'-p',fullfile(matlabroot,'toolbox','signal'),...
'-p' fullfile(matlabroot, 'toolbox', 'images'),...
'-p', fullfile(matlabroot, 'toolbox', 'stats')};
if ~exist(Nopts{2},'dir')
fprintf("No signal toolbox found!");
Nopts = {};
end
Ropts = {'-R','-singleCompThread'} ;
if ~ismac && spm_check_version('matlab','8.4') >= 0
Ropts = [Ropts, {'-R','-softwareopengl'}];
end
mcc('-m', '-v', '-C', '-R', '-nodisplay',...
'-w', 'enable',...
'-o','custom_code',...
'-d',outdir,...
'-N',Nopts{:},...
Ropts{:},...
'-a', '/opt/spm12',...
'-a', '/opt/custom_code/',...
gateway);
and the docker/singularity container is built on Ubuntu 20.04.
Has anyone encountered such a problem before, or know of any potential solutions? Any help would be greatly appreciated.
Cheers,
Aaron
0 个评论
回答(1 个)
Sebastian
2023-3-24
You can mount a writable overlay image when starting the singularity/apptainer container and matlab will write all its files to that image despite not having write access to the main container image. When creating the overlay image, make all directories that matlab needs to write to (i.e. where the CTF file is).
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!