1 | %'cluster_command_psmn': creates the command string for launching jobs in the PSMN cluster |
---|
2 | %------------------------------------------------------------------------ |
---|
3 | % function cmd=cluster_command_psmn(ListProcess,ActionFullName,DirLog,NbProcess, NbCore,CPUTimeProcess) |
---|
4 | % |
---|
5 | %OUTPUT |
---|
6 | % cmd=system command (char string) to launch jobs |
---|
7 | %% |
---|
8 | % |
---|
9 | %INPUT: |
---|
10 | % ListProcessFile: name of the file containing the list of processes to perform |
---|
11 | % ActionFullName: name given to the action (function activated by series) |
---|
12 | % DirLog: name of the folder used to store the log files from calculations |
---|
13 | % NbProcess: number of processes in the list, these processed are grouped by the systwm into jobs dipatched to NbCore cores |
---|
14 | % NbCore: number of computer cores to which the processes are dispatched |
---|
15 | % CPUTimeProcess: estimated CPU time for an individual process (in min) |
---|
16 | |
---|
17 | function cmd=cluster_command_psmn(ListProcessFile, ActionFullName, DirLog, NbProcess, NbCore, CPUTimeProcess) |
---|
18 | SubmitScriptFile = regexprep(ListProcessFile, '\job_list.txt\>', 'submit_script.sh'); |
---|
19 | fid_list = fopen(ListProcessFile, 'r'); |
---|
20 | fid_submit = fopen(SubmitScriptFile, 'w'); |
---|
21 | i=1; |
---|
22 | while(true) |
---|
23 | process = fgets(fid_list); |
---|
24 | if(process == -1) |
---|
25 | break |
---|
26 | end |
---|
27 | n = numel(process); |
---|
28 | process = process(1:(n-1)); % on enlÚve le trailing \n |
---|
29 | LogFile = regexprep(regexprep(process, '0_EXE\>', '0_LOG'), '\.sh\>', '.log'); |
---|
30 | fwrite(fid_submit, ['qsub -V '... |
---|
31 | '-e ' LogFile ' '... |
---|
32 | '-o ' LogFile ' '... |
---|
33 | '-q piv_debian* '... |
---|
34 | '-P PIV '... |
---|
35 | '-N UVmat_' num2str(i) ' '... |
---|
36 | process char(10)]); |
---|
37 | i=i+1; |
---|
38 | end |
---|
39 | fclose(fid_list); |
---|
40 | fclose(fid_submit); |
---|
41 | system(['chmod +x ' SubmitScriptFile]); |
---|
42 | cmd = SubmitScriptFile; |
---|
43 | end |
---|