Actual source code: launch.m

petsc-3.12.1 2019-10-22
Report Typos and Errors
  1: function result = launch(program,np,opt)
  2: %
  3: %  launch(program,np)
  4: %  Starts up PETSc program
  5: %
  6: % Unfortunately does not emit an error code if the launch fails and one cannot see the output
  7: % including error messages from the PETSc code.
  8: %
  9: % To debug problems we recommend commenting out the launch script from the Matlab script and
 10: % in a separate terminal starting the PETSc program manually, for example petscmpiexec -n 1 ./ex1 -info other options
 11: % The Matlab script will block on the PetscOpenSocket() until the PETSc executable is started.

 13: %  see also @sreader/sreader() and PetscBinaryRead()
 14: %
 15: if nargin < 2
 16:   np = 1;
 17: else if nargin < 3
 18:   opt = ''
 19: end
 20: end

 22: %
 23: % to run parallel jobs make sure petscmpiexec is in your path
 24: % with the particular PETSC_ARCH environmental varable set
 25: %command = ['petscmpiexec -np ' int2str(np) ' ' program opt ' &'];
 26: command = [ program opt ' &'];
 27: fprintf(1,['Executing: ' command])

 29: result = system(command)
 30: