[1135] | 1 | %'command_launch_python': creates the command strings for opening a programme in python with a Linux system('GLNX86','GLNXA64','MACI64') |
---|
| 2 | %------------------------------------------------------------------------ |
---|
| 3 | % function cmd=command_launch_matlab(filelog,ActionPath,ActionName,inputxml) |
---|
| 4 | % |
---|
| 5 | %OUTPUT |
---|
| 6 | % cmd=set of system commands (char string) to write |
---|
| 7 | |
---|
| 8 | % |
---|
| 9 | %INPUT: |
---|
| 10 | % filelog: name (char string) of the file to collect the output in the Matlab command window |
---|
| 11 | % ActionPath: path to the programme to launch |
---|
| 12 | % ActionName: name of the programme to launch |
---|
| 13 | % inputxml: full name, including path, of the xml input parameter file for the programme ActionName |
---|
| 14 | % option: ='bacground' or 'cluster' depending on the launching option |
---|
| 15 | |
---|
| 16 | function cmd=command_launch_python(filelog,ActionPath,ActionName,inputxml) |
---|
| 17 | cmd = ['LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | pyp "l = x.split('':'');...' ... |
---|
| 18 | ' l = [s for s in l if ''matlab'' not in s]; print('':''.join(l))") ' ... |
---|
| 19 | 'python -m ' ActionName ' ' inputxml]; |
---|
| 20 | |
---|
| 21 | % Matlab case: |
---|
| 22 | % ThreadOption=''; |
---|
| 23 | % if strcmp(option,'cluster') |
---|
| 24 | % ThreadOption='-singleCompThread'; |
---|
| 25 | % inputxml={inputxml};% single input parameter file |
---|
| 26 | % end |
---|
| 27 | % matlab_ver = ver('MATLAB'); |
---|
| 28 | % matlab_version = matlab_ver.Version; |
---|
| 29 | % cmd=[... |
---|
| 30 | % '#!/bin/bash\n'... |
---|
| 31 | % 'source /etc/profile\n'... |
---|
| 32 | % 'module purge\n'... |
---|
| 33 | % 'module load matlab/' matlab_version '\n'...% CHOICE OF THE SAME MATLAB VERSION AS THE CURRENT MATLAB SESSION (not mandatory) |
---|
| 34 | % 'time_start=$(date +%%s)\n'... |
---|
| 35 | % 'matlab -nodisplay -nosplash -nojvm ''' ThreadOption ''' -logfile ''' filelog ''' <<END_MATLAB\n'...%launch the new Matlab session without display |
---|
| 36 | % 'addpath(''' path_uvmat ''');\n'... |
---|
| 37 | % 'addpath(''' ActionPath ''');\n']; |
---|
| 38 | % for iprocess=1:numel(inputxml) |
---|
| 39 | % cmd=[cmd '' ActionName '(''' inputxml{iprocess} ''');\n']; |
---|
| 40 | % end |
---|
| 41 | % cmd=[cmd 'exit\n' 'END_MATLAB\n']; |
---|
| 42 | % if strcmp(option,'background') |
---|
| 43 | % cmd=[cmd ... |
---|
| 44 | % 'time_end=$(date +%%s)\n'... |
---|
| 45 | % 'echo "global time = " $(($time_end - $time_start)) >> ''' filelog '''\n']; |
---|
| 46 | % end |
---|
| 47 | % |
---|
| 48 | % %% case cluster: |
---|
| 49 | % % matlab_ver = ver('MATLAB'); |
---|
| 50 | % % matlab_version = matlab_ver.Version; |
---|
| 51 | % % cmd=[... |
---|
| 52 | % % '#!/bin/bash\n'... |
---|
| 53 | % % 'source /etc/profile\n'... |
---|
| 54 | % % 'module purge\n'... |
---|
| 55 | % % 'module load matlab/' matlab_version '\n'...% CHOICE OF CURRENT MATLAB VERSION |
---|
| 56 | % % 'matlab -nodisplay -nosplash -nojvm -singleCompThread -logfile ''' filelog{iprocess} ''' <<END_MATLAB\n'...% open a new Matlab session without display |
---|
| 57 | % % 'addpath(''' path_series ''');\n'... |
---|
| 58 | % % 'addpath(''' ActionPath ''');\n'... |
---|
| 59 | % % '' ActionName '(''' filexml{iprocess} ''');\n'...% launch the Matlab function selected by the GUI 'series' |
---|
| 60 | % % 'exit\n'... |
---|
| 61 | % % 'END_MATLAB\n']; |
---|
| 62 | % % end |
---|
| 63 | |
---|
| 64 | |
---|