[petsc-users] Status about using PETSC with MATLAB

2020-04-14 Thread Bao Kai
Hi, I saw some discussion in the mailing list, while not a lot. I am wondering the current status about using PETSc with MATLAB before I dig in. To be short, Would I be able to use the non-linear solver or linear solver with a MATLAB code? For example, I have a simulation code with MATLAB, I wa

[petsc-users] 1D DMSWARM in 1D DMPlex mesh

2020-04-14 Thread Hill, Reuben
Hi all, I might be missing something obvious, but I can't tell from the documentation if 1D coordinate DMSWARMs (immersed in interval DMPlex meshes) are supported. Does anyone know? I've successfully implemented 2D and 3D coordinate DMSwarms in 2D and 3D DMPlexes using DMSwarmSetPointCoordinat

Re: [petsc-users] 1D DMSWARM in 1D DMPlex mesh

2020-04-14 Thread Matthew Knepley
On Tue, Apr 14, 2020 at 5:49 AM Hill, Reuben wrote: > Hi all, > > I might be missing something obvious, but I can't tell from the > documentation if 1D coordinate DMSWARMs (immersed in interval DMPlex > meshes) are supported. Does anyone know? > > I've successfully implemented 2D and 3D coordinat

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Sajid Ali
Hi Jed/PETSc-developers, My goal is to invert a set of these PDE's to obtain a series of parameters F_t (with TSSolve and TSAdjoint for function/gradient computation). I was planning to use TAO for setting up the inverse problem but given that TAO doesn't support complex scalars, I'm re-thinking a

Re: [petsc-users] MPI error for large number of processes and subcomms

2020-04-14 Thread Randall Mackie
Hi Junchao, We have tried your two suggestions but the problem remains. And the problem seems to be on the MPI_Isend line 117 in PetscGatherMessageLengths and not MPI_AllReduce. We have now tried Intel MPI, Mpich, and OpenMPI, and so are thinking the problem must be elsewhere and not MPI. Give

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Zhang, Hong via petsc-users
On Mar 27, 2019, at 8:07 PM, Sajid Ali via petsc-users mailto:petsc-users@mcs.anl.gov>> wrote: Hi, I'm able to solve the following equation using complex numbers (with ts_type cn and pc_type gamg) : u_t = A*u'' + F_t*u; (where A = -1j/(2k) amd u'' refers to u_xx+

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Sajid Ali
Hi Hong, Apologies for creating unnecessary confusion by continuing the old thread instead of creating a new one. While I looked into converting the complex PDE formulation to a real valued formulation in the past hoping for better performance, my concern now is with TAO being incompatible with c

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Matthew Knepley
On Tue, Apr 14, 2020 at 2:44 PM Sajid Ali wrote: > Hi Hong, > > Apologies for creating unnecessary confusion by continuing the old thread > instead of creating a new one. > > While I looked into converting the complex PDE formulation to a real > valued formulation in the past hoping for better pe

Re: [petsc-users] MPI error for large number of processes and subcomms

2020-04-14 Thread Junchao Zhang
There is an MPI_Allreduce in PetscGatherNumberOfMessages, that is why I doubted it was the problem. Even if users configure petsc with 64-bit indices, we use PetscMPIInt in MPI calls. So it is not a problem. Try -vecscatter_type mpi1 to restore to the original VecScatter implementation. If the prob

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Sajid Ali
Hi Matthew, The TAO manual states that (preface, page vi) "However, TAO is not compatible with PETSc installations using complex data types." (The tao examples all require !complex builds. When I tried to run them with a petsc build with +complex the compiler complains of incompatible pointer type

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Stefano Zampini
Tao does not support --with-scalar-type=complex Il Mar 14 Apr 2020, 22:09 Matthew Knepley ha scritto: > On Tue, Apr 14, 2020 at 2:44 PM Sajid Ali < > sajidsyed2...@u.northwestern.edu> wrote: > >> Hi Hong, >> >> Apologies for creating unnecessary confusion by continuing the old thread >> instead

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Mark Adams
First, you need to order your equations (r_0, i_0, r_1, i_1, ...) and then set a block size of two (times the real block size of your equations) in the matrix, for GAMG to work. PETSc can do this for you with fieldsplit. The symmetric stuff that GAMG requaries is just for the (parallel) graph coar

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Zhang, Hong via petsc-users
Sorry for the time travel. As far as I know, optimization over complex-valued parameters is not a well-defined problem. I am not sure how you can develop an optimization algorithm for it. Perhaps our optimization experts have better suggestions in this direction. The real-valued formulation see

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Stefano Zampini
Not true in general when you minimize an objective function as a functional of the parameter only For same methods (Newton for example, gradient descent, etc) the state variables do no enter the minimization, so it should be fine to have complex-valued state variables > On Apr 15, 2020, at 1:0

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Matthew Knepley
On Tue, Apr 14, 2020 at 6:26 PM Stefano Zampini wrote: > Not true in general when you minimize an objective function as a > functional of the parameter only > For same methods (Newton for example, gradient descent, etc) the state > variables do no enter the minimization, so it should be fine to h

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Dener, Alp via petsc-users
This is correct. As long as the optimization variables and the objective function, and it’s gradient are real valued, intermediate variables (such as PDE states) can be complex. In principle it is also possible to minimize real valued functions in complex variables by converting to rectangular

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Jed Brown
We'd have complex values in vectors that contain the likes of gradients with respect to (real-valued) parameters so there would likely need to be lots of PetscRealPart() within TAO. It won't just compile if we turn on complex, but these changes should be feasible and is surely a better solution th

Re: [petsc-users] Converting complex PDE to real for KNL performance ?

2020-04-14 Thread Zhang, Hong via petsc-users
In Sajid’s problem, the optimization variables (F_t in the equation u_t = A*(u_xx + u_yy) + F_t*u) are complex-valued. The gradients should also be complex-valued. The objective function may be real-valued. Hong (Mr.) On Apr 14, 2020, at 5:52 PM, Dener, Alp mailto:ade...@anl.gov>> wrote: This

Re: [petsc-users] inserting multiple rows together into a matrix

2020-04-14 Thread Bin Liu
Thanks for your example. My problem is resolved. Meanwhile I am wondering, if it is possible to make this example more flexible. I mean what if the columns in each row are different? Is there any way to insert them all together? Regards Bin From: Junchao Zhang [mailto:junchao.zh...@gmail.com] S

Re: [petsc-users] inserting multiple rows together into a matrix

2020-04-14 Thread Bin Liu
Thanks Jacob. In my problem the rows/columns are not contiguous. Your suggestions are also very good. I will think about how to make use it somewhere else in my code. Best Bin From: Jacob Faibussowitsch [mailto:jacob@gmail.com] Sent: Monday, 13 April 2020 11:47 PM To: Junchao Zhang Cc: Bin