PETSc_Cloop_dke_ft

PURPOSE ^

SYNOPSIS ^

function [XXf0,flag,text] = PETSc_Cloop_dke_ft(PETScparam,display_mode,dkepath)

DESCRIPTION ^

Link with the parallel matrix solver package PETSc written in C. The first
order collision calculation is done in C (see PETSc_dke_ft when it is done
in MatLab). It is assumed that all variables are passed with the
writeCloopinput_dke_ft.m function

Solve the linear system of equation AX=B(X)

 INPUTS:

   - PETScparam: Structure for controling PETSc program. 
   - display_mode: display some results [1,1]
   - dkepath: paths structure

 OUTPUTS:

   - XXf0: Solution of the linear system of equation [n,1]
   - flag: execution flag (see the PETSC documentation) [1,1]
   - text: execution documentation (see the PETSC documentation)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [XXf0,flag,text] = PETSc_Cloop_dke_ft(PETScparam,display_mode,dkepath)
0002 %
0003 %Link with the parallel matrix solver package PETSc written in C. The first
0004 %order collision calculation is done in C (see PETSc_dke_ft when it is done
0005 %in MatLab). It is assumed that all variables are passed with the
0006 %writeCloopinput_dke_ft.m function
0007 %
0008 %Solve the linear system of equation AX=B(X)
0009 %
0010 % INPUTS:
0011 %
0012 %   - PETScparam: Structure for controling PETSc program.
0013 %   - display_mode: display some results [1,1]
0014 %   - dkepath: paths structure
0015 %
0016 % OUTPUTS:
0017 %
0018 %   - XXf0: Solution of the linear system of equation [n,1]
0019 %   - flag: execution flag (see the PETSC documentation) [1,1]
0020 %   - text: execution documentation (see the PETSC documentation)
0021 
0022 %By Joan Decker (CEA-DRFC, joan.decker@cea.fr) ,Yves Peysson (CEA-DRFC,yves.peysson@cea.fr), Frederic Teisseire (CEA-DRFC)
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);%Create calculation directory
0031 end
0032 cd(dkepath.temppath);%Move to calculation directory
0033 %
0034 dir_in = [dkepath.temppath,'/DKESolver_variables/'];
0035 dir_out = [dkepath.temppath,'/DKESolver_output/'];
0036 %
0037 % Computer management
0038 %
0039 nproc = nproc_dke_yp(display_mode,PETScparam,dkepath);
0040 %
0041 if nproc > 1,%Parallel processing is invoked
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,%Sequential processing is invoked
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);%return to the initial working directory
0070 
0071 
0072

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.