[petsc-users] coupling with Matlab and parallel solution

Benjamin Sanderse B.Sanderse at cwi.nl
Fri Sep 3 10:08:29 CDT 2010


Hi Barry, 

Could you figure out something with the codes I sent you?

Thanks,

Ben

Op 2 sep 2010, om 13:45 heeft Barry Smith het volgende geschreven:

> 
> 
>  Matlab is never aware the vector is parallel. Please send me the code and I'll figure out what is going on.
> 
>   Barry
> 
> On Sep 2, 2010, at 2:07 PM, Benjamin Sanderse wrote:
> 
>> That sounds great, but there is one issue I am encountering. I switched vector types to VECMPI and matrix type to MATMPIAIJ, but when running Matlab I get the following error:
>> 
>> Found unrecogonized header 0 in file. If your file contains complex numbers
>> then call PetscBinaryRead() with "complex" as the second argument
>> Error in ==> PetscBinaryRead at 27
>> if nargin < 2
>> 
>> ??? Output argument "varargout" (and maybe others) not assigned during call to 
>> "/ufs/sanderse/Software/petsc-3.1-p4/bin/matlab/PetscBinaryRead.m>PetscBinaryRead".
>> 
>> Error in ==> test_petsc_par at 57
>> 	x4 = PetscBinaryReady(PS);
>> 
>> Could it be that Matlab does not understand the "parallel" vector which is returned by Petsc? Currently I have this done with VecView as follows:
>> 
>> fd = PETSC_VIEWER_SOCKET_WORLD;
>> ...
>> KSPSolve(ksp,b,x);
>> ...
>> VecView(fd,x);
>> 
>> Thanks for the help!
>> 
>> Ben
>> 
>> Op 2 sep 2010, om 10:09 heeft Barry Smith het volgende geschreven:
>> 
>>> 
>>> On Sep 2, 2010, at 10:51 AM, Benjamin Sanderse wrote:
>>> 
>>>> Hello all,
>>>> 
>>>> I figured out the coupling with Matlab and I can send back and forth matrices and vectors between Petsc and Matlab. Actually, I send only once a matrix from Matlab to Petsc and then repeatedly send new right hand sides from Matlab->Petsc and the solution vector from Petsc->Matlab. That works great.
>>>> I know want to see if the matrix that is send from (serial) Matlab to Petsc can be stored as a parallel matrix in Petsc so that subsequent computations with different right hand sides can be performed in parallel by Petsc. Does this simply work by using MatLoad and setting Mattype MPIAIJ? Or is something more fancy required?
>>> 
>>> In theory this can be done using the same code as sequential only with parallel vectors VECMPI  and matrices. MATMPIAIJ
>>> 
>>> Barry
>>> 
>>>> 
>>>> Thanks,
>>>> 
>>>> Ben
>>> 
>> 
> 



More information about the petsc-users mailing list