Need help adding a new solver to the petsc library

Xavier Lacoste lacoste at labri.fr
Fri Nov 21 11:43:06 CST 2008


Barry Smith a écrit :
>
> On Nov 21, 2008, at 10:23 AM, Xavier Lacoste wrote:
>
>> Barry Smith a écrit :
>>>
>>> On Nov 21, 2008, at 8:05 AM, Xavier Lacoste wrote:
>>>
>>>> Hello,
>>>>
>>>> I have some new questions.
>>>>
>>>> I haded a MPIAIJ to CSC conversion routine.
>>>
>>>   There is no such beast, computing it is painful.
>>>
>>>   What we do for solvers that need it is to just pass the CSR 
>>> version and then instead of doing a solve in the package we do
>>> a transpose solve from the package.
>> Ok, I'll try this, do you have an example of solver using CSC with 
>> this method ?
>
>    This is how we handle Superlu; see src/mat/impls/aij/seq/superlu
>
>>
>>>>
>>>> I managed to run ex19 on the solver PaStiX like it is done for 
>>>> mumps but my matrix must be badly constructed (PaStiX doesn't 
>>>> succeed in computing  the solution withe the given problem...).
>>>> Is there a way to dump the MPIAIJ matrix into a matrixmarket format 
>>>> so that I can check what's wrong with the CSC built ?
>>>
>>>   No we don't have any matrix output to matrixmarket format.
>>>
>>>  Does the code run correctly on 1 process?
>>>
>> No, because I only implemented the mpiaij subclass, not the seqaij 
>> one, I get an error when launchin on one processor, but I can run the 
>> code on two, I just have numerical issues.
>
>    You can create and use mpiaij matrices on one process so you should 
> not "get an error when launchin on one processor,".
>
>    NEVER EVER EVER EVER EVER try to debug a 2 process  case when you 
> don't know if a 1 process case runs!  Make sure it runs
> properly on one process first.
>
>    Barry
>
Hello again,

this is the error I got when using ex19 with 1 processor (I copied 
arguments from mumps runex19_9 example)

 mpirun -n 1 ./ex19 -dmmg_nlevels 4 -snes_monitor_short -pc_type 
redundant -mat_type aij -redundant_pc_factor_mat_solver_package pastix 
-pc_redundant_number 1
lid velocity = 0.0016, prandtl # = 1, grashof # = 1
Plip
Plup
  0 SNES Function norm 0.0406612
[0]PETSC ERROR: --------------------- Error Message 
------------------------------------
[0]PETSC ERROR: No support for this operation for this object type!
[0]PETSC ERROR: Matrix format seqaij does not have a solver pastix. 
Perhaps you must config/configure.py with --download-pastix!


Thanks for taking time to help me

XL.
>>
>>
>>>
>>>>
>>>>
>>>> Second question, in the petsc-dev/config/PETSc/packages/Scotch.py I 
>>>> wrote, do I have a way to check if libz.a is present, so that I can 
>>>> decide if I compile with -DCOMMON_FILE_COMPRESS_GZ and -lz ? 
>>>> (libz.a requirement is depending of an optional feature of Scotch...)
>>>
>>>  In your PaStiX.py you can add something like
>>>    if self.libraries.add('-lz','function_in_library'):
>>>      self.addDefine('HAVE_WHAT_YOU_WANT_STRINGH',1)
>> Ok, thanks I'll try this
>>
>> XL.
>>>
>>>  Barry
>>>
>>>
>>>>
>>>>
>>>> thanks,
>>>>
>>>> XL.
>>>>
>>>>
>>>> Barry Smith a écrit :
>>>>>
>>>>>    Take a look at, for example, MatGetFactor_MPIAIJ_mumps (in 
>>>>> src/mat/impls/aij/mpi/mumps)
>>>>> you will need to create one for pastix and then take a look at 
>>>>> MatCreate_MPIAIJ and see
>>>>> how the mumps function is registered, you will need to register in 
>>>>> the same way.
>>>>>
>>>>>   Barry
>>>>>
>>>>>
>>>>>
>>>>> On Nov 7, 2008, at 10:07 AM, Xavier Lacoste wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm still working on adding PaStiX into PETSc.
>>>>>>
>>>>>> I managed to pass the configure and "make all test" steps.
>>>>>> (./config/configure.py -with-scotch=1 -download-scotch=ifneeded 
>>>>>> -with-pastix -download-pastix=ifneeded )
>>>>>>
>>>>>>
>>>>>> Here are the modification I made on petsc-dev version 
>>>>>> 12911:0e70d56474b2
>>>>>>
>>>>>> http://dept-info.labri.fr/~lacoste/petsc/adding_pastix_12911_0e70d56474b2.patch 
>>>>>>
>>>>>>
>>>>>> - I added PaStiX.py package
>>>>>> - I modified Scotch.py package to use last version
>>>>>> - I modified partition/impls/scotch.c so that it compiles (it 
>>>>>> would not work in the current state)
>>>>>> - I had aij/mpi/pastix/pastix.c file to make an interface to pastix.
>>>>>> - I tried to use example 19 with pastix, like it is done with 
>>>>>> mumps but pastix solver is not found :
>>>>>>
>>>>>> http://dept-info.labri.fr/~lacoste/petsc/error_log
>>>>>>
>>>>>> Now, I have to know how to tell petsc it has a new solver 
>>>>>> implementing mpiaij.
>>>>>>
>>>>>> How can I do that ?
>>>>>>
>>>>>> After that I should be able to test if my implementation of 
>>>>>> mpiaij matrix is working or not.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> XL.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Barry Smith a écrit :
>>>>>>>
>>>>>>> Please send your $PETSC_ARCH/conf/configure.log and 
>>>>>>> $PETSC_ARCH/conf/make.log to petsc-maint at mcs.anl.gov (not to 
>>>>>>> this email address)
>>>>>>> and we'll take a look.  Also send your modified Scotch.py file.
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>>
>>>>>>> Barry
>>>>>>>
>>>>>>> On Nov 3, 2008, at 10:45 AM, Xavier Lacoste wrote:
>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> I want to add the solver PaStiX 
>>>>>>>> (https://gforge.inria.fr/projects/pastix/) to the PETSc library.
>>>>>>>> I Check-outed the last hg version of PETSc and started adding 
>>>>>>>> my PaStiX.py script, based on MUMPS one, in 
>>>>>>>> petsc-dev/config/PETSc/packages/ .
>>>>>>>> I modified first Scotch.py wich wasn't updated because PaStiX 
>>>>>>>> needs Scotch.
>>>>>>>>
>>>>>>>> My problem is that I couldn't succed in configuring PETSCc with 
>>>>>>>> "--with-pastix=1 etc." because i don't know how to say PETSc 
>>>>>>>> that PaStiX needs the "-L/Scotch/dir -lscotch etc."
>>>>>>>>
>>>>>>>> I have the setupDependencies :
>>>>>>>>
>>>>>>>>
>>>>>>>> def setupDependencies(self, framework):
>>>>>>>> PETSc.package.Package.setupDependencies(self, framework)
>>>>>>>> self.mpi        = framework.require('config.packages.MPI',self)
>>>>>>>> self.blasLapack = 
>>>>>>>> framework.require('config.packages.BlasLapack',self)
>>>>>>>> self.scotch     = framework.require('PETSc.packages.Scotch',self)
>>>>>>>> self.deps       = [self.mpi,self.blasLapack,self.scotch]
>>>>>>>> return
>>>>>>>>
>>>>>>>> But it didn't helped, the -L/scotchdir/lib is still missing...
>>>>>>>>
>>>>>>>> > Executing: mpicc  -o conftest    -g  conftest.o  
>>>>>>>> -Wl,-rpath,/home/xl/pastix/lib -L/home/xl/pastix/lib -lpastix 
>>>>>>>> -lpthread -lscotch -llapack -lblas *
>>>>>>>> > -L/usr/lib/gcc/i486-linux-gnu/4.3.2 -L/lib -ldl -lgcc_s 
>>>>>>>> -lgfortranbegin -lgfortran -lm 
>>>>>>>> -L/usr/lib/gcc/i486-linux-gnu/4.3.2 -L/usr/lib/gcc/i486-linux-gnu
>>>>>>>> > -L/usr/lib/gcc/i486-linux-gnu/4.3.2 
>>>>>>>> -L/usr/lib/gcc/i486-linux-gnu 
>>>>>>>> -L/usr/lib/gcc/i486-linux-gnu/4.3.2 -L/usr/lib/gcc/i486-linux-gnu
>>>>>>>> > -L/usr/lib/gcc/i486-linux-gnu/4.3.2 -L/lib -L/lib -lm 
>>>>>>>> -L/usr/lib/gcc/i486-linux-gnu/4.3.2 
>>>>>>>> -L/usr/lib/gcc/i486-linux-gnu/4.3.2 -L/lib -ldl -lgcc_s -ldl
>>>>>>>> > sh:
>>>>>>>> > Possible ERROR while running linker: /usr/bin/ld: cannot find 
>>>>>>>> -lscotch
>>>>>>>>
>>>>>>>> Hope i'm on the good Mailing list for this kind of questions.
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> XL.
>>>>>>>> PaStiX team, INRIA-Bordeaux-Sud-Ouest, France.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>




More information about the petsc-dev mailing list