0001 function [XXf0,flag,text] = PETSc_Cloop_dke_ft(PETScparam,display_mode,dkepath)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 if nargin < 3,error('Wrong number of input arguments in PETSc_Cloop_dke_ft !');end
0025
0026 flag = 0;text = '';
0027
0028 initial_dir = cd;
0029 if ~exist(dkepath.temppath);
0030 mkdir(dkepath.temppath);
0031 end
0032 cd(dkepath.temppath);
0033
0034 dir_in = [dkepath.temppath,'/DKESolver_variables/'];
0035 dir_out = [dkepath.temppath,'/DKESolver_output/'];
0036
0037
0038
0039 nproc = nproc_dke_yp(display_mode,PETScparam,dkepath);
0040
0041 if nproc > 1,
0042 if isfield(dkepath.PETSc,'par'),
0043 if display_mode >= 1,info_dke_yp(2,'Matrix inversion by PETSc solver - parallel processing -');end
0044 [flag,text] = unix([dkepath.PETSc.mpipath,'mpirun -np ',int2str(nproc),' -machinefile .machines ',dkepath.PETSc.par,'/SolverLoop_DKE_c',' ',dir_in,' ',dir_out,' ',PETScparam.matrixtype,' ',PETScparam.kspmethod,' ',PETScparam.pcmethod]);
0045 elseif isfield(dkepath.PETSc,'seq'),
0046 if display_mode >= 1,info_dke_yp(2,'Matrix inversion by PETSc solver - sequential processing enforced, no parallel processing package on this machine ! -');end
0047 [flag,text] = unix([dkepath.PETSc.seq,'/SolverLoop_DKE_c',' ',dir_in,' ',dir_out,' ',PETScparam.matrixtype,' ',PETScparam.kspmethod, ' ',PETScparam.pcmethod]);
0048 else
0049 error('PETSc package not correctly named for LUKE: <pakage name+version>_P_<compiler name> or <pakage name+version>_S_<compiler name>');
0050 end
0051 elseif nproc == 1,
0052 if isfield(dkepath.PETSc,'seq'),
0053 if display_mode >= 1,info_dke_yp(2,'Matrix inversion by PETSc solver - sequential processing -');end
0054 [flag,text] = unix([dkepath.PETSc.seq,'/SolverLoop_DKE_c',' ',dir_in,' ',dir_out,' ',PETScparam.matrixtype,' ',PETScparam.kspmethod, ' ',PETScparam.pcmethod]);
0055 elseif isfield(dkepath.PETSc,'par'),
0056 if display_mode >= 1,info_dke_yp(2,'Matrix inversion by PETSc solver - parallel processing enforced, no sequential processing package on this machine ! -');end
0057 [flag,text] = unix([dkepath.PETSc.mpipath,'mpirun -np ',int2str(nproc),' -machinefile .machines ',dkepath.PETSc.par,'/SolverLoop_DKE_c',' ',dir_in,' ',dir_out,' ',PETScparam.matrixtype,' ',PETScparam.kspmethod,' ',PETScparam.pcmethod]);
0058 else
0059 error('PETSc package not correctly named for LUKE: <pakage name+version>_P_<compiler name> or <pakage name+version>_S_<compiler name>');
0060 end
0061 end
0062
0063 if exist([dkepath.temppath,'/DKESolver_output/XXf0']),
0064 XXf0 = ReadBinaryArray_mex_c([dkepath.temppath,'/DKESolver_output/XXf0']);
0065 else
0066 error(['PETSc is going wrong and solution XXf0 is not created in the sub-directory ',dkepath.temppath,'/DKESolver_output !']);
0067 end
0068
0069 cd(initial_dir);
0070
0071
0072