[petsc-users] Calling MATLAB code within a parallel C/C++ code

2020-06-08 Thread Amneet Bhalla
Hi Folks, My parallel application written in C++ (which also uses PETSc library for linear solvers) requires calling control and optimization toolbox of MATLAB at every time step to get a small number of double values. Likewise the MATLAB function will need to know some values from the parallel C+

Re: [petsc-users] Calling MATLAB code within a parallel C/C++ code

2020-06-08 Thread Amneet Bhalla
You should use the PetscMatlabEngine > https://www.mcs.anl.gov/petsc/petsc-3.13/docs/manualpages/Sys/PetscMatlabEngine.html > > Barry > > > On Jun 8, 2020, at 7:09 PM, Amneet Bhalla wrote: > > Hi Folks, > > My parallel application written in C++ (which also use

Re: [petsc-users] Calling MATLAB code within a parallel C/C++ code

2020-06-09 Thread Amneet Bhalla
eEvaluate(PETSC_MATLAB_ENGINE_WORLD,"MPI_Comm_rank"); > src/vec/vec/tests/ex31.c: ierr = > PetscMatlabEnginePut(PETSC_MATLAB_ENGINE_WORLD,(PetscObject)x);CHKERRQ(ierr); > src/vec/vec/tests/ex31.c: ierr = > PetscMatlabEngineEvaluate(PETSC_MATLAB_ENGINE_WORLD,"x = x + >

Re: [petsc-users] Calling MATLAB code within a parallel C/C++ code

2020-06-09 Thread Amneet Bhalla
-leng -lmex -lmx -lmat -lut -licudata -licui18n -licuuc On Tue, Jun 9, 2020 at 2:20 PM Amneet Bhalla wrote: > Do these additional configure flags for MATLAB look OK? > > --with-matlab=1 --with-matlab-dir=/Applications/MATLAB_R2019b.app > --with-matlab-engine=1 > --with-ma

Re: [petsc-users] Calling MATLAB code within a parallel C/C++ code

2020-06-09 Thread Amneet Bhalla
t; > On Tue, Jun 9, 2020 at 4:27 PM Amneet Bhalla > wrote: > >> Forgot to mention that configure found the following about MATLAB >> >> Matlab: >> >> Includes: -I/Applications/MATLAB_R2019b.app/extern/include >> >> /Applications/MA

Re: [petsc-users] Calling MATLAB code within a parallel C/C++ code

2020-06-09 Thread Amneet Bhalla
--Junchao Zhang > > > On Tue, Jun 9, 2020 at 4:27 PM Amneet Bhalla > wrote: > >> Forgot to mention that configure found the following about MATLAB >> >> Matlab: >> >> Includes: -I/Applications/MATLAB_R2019b.app/extern/include >> >> /Ap

Re: [petsc-users] Calling MATLAB code within a parallel C/C++ code

2020-06-09 Thread Amneet Bhalla
35568122/why-isnt-dyld-library-path-being-propagated-here > >Anyways try my branch and that should work. > >Barry > > > > On Jun 9, 2020, at 5:09 PM, Amneet Bhalla wrote: > > > That's where I also found it. Thanks, Sanjay! > > (This path is

Re: [petsc-users] Calling MATLAB code within a parallel C/C++ code

2020-06-11 Thread Amneet Bhalla
what you can do is copy the > config/BuildSystem/config/MatlabEngine.py to your PETSc 3.12.2 version and > the configure > should work (it won't automatically run the test case but you can test it > manually). > > Barry > > > On Jun 9, 2020, at 5:48 PM, Amneet Bhalla

Re: [petsc-users] Calling MATLAB code within a parallel C/C++ code

2020-06-11 Thread Amneet Bhalla
This is so cool! Thank you for providing a gateway to MATLAB via PETSc. On Thu, Jun 11, 2020 at 6:21 PM Barry Smith wrote: > > > On Jun 11, 2020, at 2:47 PM, Amneet Bhalla wrote: > > Ok, I'm able to call and use MATLAB functionality from PETSc. If I'm > u

Re: [petsc-users] Using Petsc-Matlab engine on a cluster

2020-11-10 Thread Amneet Bhalla
Thank you Barry! We will definitely try this out and let you know. We also found an inconvenient work around. We registered the ip of a head compute node on Mathworks.com, which generated a license file. Then we activated Matlab on this compute node offline by pointing it to the license file. This

Re: [petsc-users] Using Petsc-Matlab engine on a cluster

2020-11-10 Thread Amneet Bhalla
Mark, unfortunately we do not have an experienced cluster admin. We mostly instruct the admin on matters like these. On Tue, Nov 10, 2020 at 4:22 AM Mark Adams wrote: > You need to talk to your system administrator or whoever installed the > Matlab licence, or Matlab. > Good luck, > Mark > > On

Re: [petsc-users] Convergence rate for spatially varying Helmholtz system

2021-09-30 Thread Amneet Bhalla
>> If you want to solve systems accurately, you should non-dimensionalize the system prior to discretization. This would mean that your C and b have elements in the [1, D] range, where D is the dynamic range of your problem, say 1e4, rather than these huge numbers you have now. @Matt: We have done

Re: [petsc-users] Convergence rate for spatially varying Helmholtz system

2021-09-30 Thread Amneet Bhalla
> > >For a diagonal system with this modest range of values Jacobi should > converge in a single iteration. > This is what I wanted to confirm (and my expectation also). There could be a bug in the way we are setting up the linear operators in the preconditioner and the matrix-free solver. We

Re: [petsc-users] GMRES for outer solver

2022-04-30 Thread Amneet Bhalla
How about using a fixed number of Richardson iterations as a Krylov preconditioner to a GMRES solver? Would that lead to a linear operation? On Sat, Apr 30, 2022 at 8:21 PM Jed Brown wrote: > In general, no. A fixed number of Krylov iterations (CG, GMRES, etc.) is a > nonlinear operation. > > A

Re: [petsc-users] GMRES for outer solver

2022-05-02 Thread Amneet Bhalla
ot;FGMRES" as the outer solver (which supports only right >> preconditioning). >> >> 2. Is it also possible to not get "-nan" when || b || = 0? >> >> >> Regards, >> Rama >> >> On Sun, May 1, 2022 at 12:12 AM Dave May wrote: >>

Re: [petsc-users] GMRES for outer solver

2022-05-02 Thread Amneet Bhalla
Knepley wrote: > On Mon, May 2, 2022 at 1:56 PM Amneet Bhalla > wrote: > >> Thanks Matt and Barry. Since we are using MATSHELL, we printed max norm >> of || b || and || A*x ||, the two things that have all the physics of the >> problem. Both are coming out to be finite (n

Re: [petsc-users] Error with PetscMatlabEngineCreate

2022-06-10 Thread Amneet Bhalla
Thanks Barry. Adding absolute paths made it work with "master" hostname. We have added both options in our code just in case the NULL hostname does not work on a different machine. https://github.com/IBAMR/cfd-mpc-wecs/blob/main/main.cpp#L346-L361 On Fri, Jun 10, 2022 at 1:48 PM Barry Smith wrote

[petsc-users] Calling Pytorch and Python within PETSc C/C++ code

2022-06-13 Thread Amneet Bhalla
Hi Guys, Is there a PETSc interface to make calls to Python scripts or libraries (e.g., Pytorch) from a C/C++ code making use of PETSc? If so, are there some examples that I refer to? Thanks, -- --Amneet

Re: [petsc-users] Calling Pytorch and Python within PETSc C/C++ code

2022-06-13 Thread Amneet Bhalla
on scripts or libraries from C/C++ > code. If you are looking for ways to use PETSc and PyTorch together, it is > best to build your application in Python so that you can use both petsc4py > and PyTorch. See the following code for an example: > https://github.com/caidao22/pnode >

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Amneet Bhalla
On Monday, October 10, 2016, Barry Smith wrote: > > > On Oct 10, 2016, at 4:01 PM, Kong, Fande > wrote: > > > > Hi All, > > > > I know how to remove the null spaces from a singular system using > creating a MatNullSpace and attaching it to Mat. > > > > I was really wondering what is the philosop

[petsc-users] Matrix-free TS

2017-03-27 Thread Amneet Bhalla
Hi Folks, I am thinking of trying TS module of PETSc to free myself of maintaining time stepping part of the code and to try different time integrators easily. The problem that I am considering is incompressible Navier Stokes with variable coefficients solved using projection method. The method w

Re: [petsc-users] Matrix-free TS

2017-03-27 Thread Amneet Bhalla
On Mon, Mar 27, 2017 at 10:42 AM, Matthew Knepley wrote: > 1) sounds easier and matches your current code. Great! For matrix free TS, the form of F(t,u,u_t) = rho u*_t - div ( sigma) as written "on paper" and should not contain time stepping factors like (1/2) that comes from CN? Similarly

Re: [petsc-users] PETSc build asks for network connections

2023-03-19 Thread Amneet Bhalla
> I think its due to some of the system calls from MPI. > > You can verify this with a '--with-mpi=0' build. > > I wonder if there is a way to build mpich or openmpi - that doesn't > trigger Apple's firewall.. > > Satish > > On Sun, 19 Mar 2023, Amn

Re: [petsc-users] PETSc build asks for network connections

2023-03-19 Thread Amneet Bhalla
rewall-rules > > > On Mar 19, 2023, at 5:25 PM, Amneet Bhalla wrote: > > Yes, this is MPI that is triggering the apple firewall. If I allow it it > gets added to the allowed list (see the screenshot) and it does not trigger > the firewall again. However, this needs to be done f

Re: [petsc-users] Error while building PETSc with MATLAB

2023-09-01 Thread Amneet Bhalla
Hi Srinivas, As discussed earlier you don’t need libMesh for the WEC application. You can just work with PETSc 3.17.5 that builds with Matlab. Do you have a specific reason for wanting to build libMesh? Thanks, —Amneet On Thu, Aug 31, 2023 at 10:16 PM INTURU SRINIVAS 20PHD0548 via petsc-users <

[petsc-users] MPI barrier issue using MatZeroRows

2023-11-28 Thread Amneet Bhalla
Hi Folks, I am using MatZeroRows() to set Dirichlet boundary conditions. This works fine for the serial run and the solver produces correct results (verified through analytical solution). However, when I run the case in parallel, the simulation gets stuck at MatZeroRows(). My understanding is that

Re: [petsc-users] MPI barrier issue using MatZeroRows

2023-11-28 Thread Amneet Bhalla
; once after the loop so it can exchange the needed information with the > other MPI processes to get the row indices to the right place. > > Barry > > > > > On Nov 28, 2023, at 6:44 PM, Amneet Bhalla wrote: > > > Hi Folks, > > I am using MatZeroRows() to set Di

Re: [petsc-users] MPI barrier issue using MatZeroRows

2023-11-28 Thread Amneet Bhalla
I added that option but the code still gets stuck at the same call MatZeroRows with 3 processors. On Tue, Nov 28, 2023 at 7:23 PM Amneet Bhalla wrote: > > > On Tue, Nov 28, 2023 at 6:42 PM Barry Smith wrote: > >> >> for (int co

Re: [petsc-users] MPI barrier issue using MatZeroRows

2023-11-29 Thread Amneet Bhalla
rows during MatSetValues. However, that would lengthen my code and I was trying to avoid that. On Wed, Nov 29, 2023 at 10:02 AM Matthew Knepley wrote: > On Wed, Nov 29, 2023 at 12:30 PM Amneet Bhalla > wrote: > >> Ok, I added both, but it still hangs. Here, is bt from all three t

Re: [petsc-users] MPI barrier issue using MatZeroRows

2023-11-29 Thread Amneet Bhalla
: > > > On Nov 29, 2023, at 2:11 PM, Matthew Knepley wrote: > > On Wed, Nov 29, 2023 at 1:55 PM Amneet Bhalla > wrote: > >> So the code logic is after the matrix is assembled, I iterate over all >> distributed patches in the domain to see which of the patch is

Re: [petsc-users] MPI barrier issue using MatZeroRows

2023-11-29 Thread Amneet Bhalla
Ah, I also tried without step 2 (i.e., manually doing MPI_allgatherv for Dirichlet rows), and that also works. So it seems that each processor needs to send in their own Dirichlet rows, and not a union of them. Is that correct? On Wed, Nov 29, 2023 at 3:48 PM Amneet Bhalla wrote: > Thanks Ba

Re: [petsc-users] MPI barrier issue using MatZeroRows

2023-11-29 Thread Amneet Bhalla
Awesome! MatZeroRows is very useful and simplified the code logic. On Wed, Nov 29, 2023 at 5:14 PM Matthew Knepley wrote: > On Wed, Nov 29, 2023 at 7:27 PM Amneet Bhalla > wrote: > >> Ah, I also tried without step 2 (i.e., manually doing MPI_allgatherv for >> Dirichlet

[petsc-users] Configure issues with scalapack

2024-08-19 Thread Amneet Bhalla
Hi Folks, I am trying to build PETSc with MUMPS which requires building/downloading scalapack. I used the following configure command to do this: ./configure --PETSC_ARCH=linux-opt --with-debugging=0 --download-hypre=1 --with-x=0 -download-mumps -download-scalapack -download-parmetis -download-me

[petsc-users] Error during PETSc build on Edison

2018-01-29 Thread Amneet Bhalla
Hi, I am trying to build PETSc (v3.7.7) locally in my home directory on NERSC (Edison). However, I am getting the following error during the configuration stage. === TESTING: checkFortranNameMangling from c

Re: [petsc-users] Error during PETSc build on Edison

2018-01-29 Thread Amneet Bhalla
Hi Satish --- I am trying GNU. I am configuring with these additional flags, and it seems to be past that point. I will let you know if it works fine all the way. The reason I am not using prebuilt PETSc on NERSC is that I want to be consistent with C++, C, and fortran compilers with all the 3rd pa

[petsc-users] Handling singular matrix in KSP and ASM

2015-05-27 Thread Amneet Bhalla
Hi Folks, We are dealing with a singular matrix that arises from Stokes' equation with Dirichlet velocity BCs. The way we are handling it is to pass nullspace info to KSP, i.e, vector of {u,p} = {0,1}, and letting the matrix to be singular. However, we are using ASM as the preconditioner and when

[petsc-users] PCASM subdomains

2015-06-04 Thread Amneet Bhalla
Hi Folks, I have a basic question regarding matrix size as created by subdomains in PCASM. In the PCASMSetLocalSubdomains(PC pc,PetscInt n,IS is[],IS is_local[]) routine, I am defining is[] to be the local+overlapping DOFs and is_local [] to be the nonoverlapping local DOFs only. Now if I grab th

Re: [petsc-users] PCASM subdomains

2015-06-04 Thread Amneet Bhalla
Thanks! They indeed are for the overlapping division. I just wanted to confirm it to debug my code, which I now think is giving me the right size of the subdomain matrices. On Thu, Jun 4, 2015 at 2:11 PM, Matthew Knepley wrote: > On Thu, Jun 4, 2015 at 3:47 PM, Amneet Bhalla >

[petsc-users] with hypre

2012-08-03 Thread Amneet Bhalla
Hi All, I am trying to solve system of PDEs on AMR grid. I using PETSc 's Krylov solver for that. This requires me to use a FAC preconditioner with a non-Krylov solver for the level 0. I actually tried PETSc's Krylov Solver for level 0 (by building MPIAIJ Mat and Vec), but it does not really impr

[petsc-users] with hypre

2012-08-03 Thread Amneet Bhalla
d ex4 of hypre. Can you point me to PETSc's examples of AMG, ML or GAMG? On Fri, Aug 3, 2012 at 7:47 AM, Matthew Knepley wrote: > On Fri, Aug 3, 2012 at 7:28 AM, Amneet Bhalla wrote: > >> Hi All, >> >> I am trying to solve system of PDEs on AMR grid. I using PETSc

[petsc-users] with hypre

2012-08-03 Thread Amneet Bhalla
package but it didn't work either. On Fri, Aug 3, 2012 at 8:24 AM, Matthew Knepley wrote: > On Fri, Aug 3, 2012 at 8:12 AM, Amneet Bhalla wrote: > >> Thanks Matt for a quick reply. >> >> Attached is the Makefile I used for building ex9. I used the same >>

[petsc-users] with hypre

2012-08-03 Thread Amneet Bhalla
Thanks Matt for pointing to Makefile manual. I just included these lines include $(PETSC_DIR)/conf/variables LIBS = $(PETSC_LIB) in the hypre's makefile and it is now working. This issue is resolved. I will try to write preconditioner using hypre's multigrid solvers. Example files which you poin

[petsc-users] with hypre

2012-08-03 Thread Amneet Bhalla
I see... Do I need to have some external package for gamg? I am getting this error Unable to find requested PC type gamg! Also its not listed in -pc_type options when I do -help On Fri, Aug 3, 2012 at 2:21 PM, Barry Smith wrote: > > On Aug 3, 2012, at 1:34 PM, Amneet Bhalla

[petsc-users] gmg vs amg

2012-08-04 Thread Amneet Bhalla
Hi All, Is it almost always the case that for structured mesh, geometric multigrid would be faster than algebraic multigrid solver/preconditioner? Basically I want to know If I had a choice between pfmg , gamg and boomeramg for structured grid what should I choose? Thanks, -- Amneet ---

[petsc-users] MATNEST with shell matrices

2013-02-21 Thread Amneet Bhalla
Hi All, I want to solve a system of equations which looks like A x + Bu = f1 C x + Du = f2 A, B, C, and D as shell operators and {x , u, f1, and f2} are non-native PETSc vectors. This is how I am thinking of solving it in PETSc 1) Define shell operators which d

[petsc-users] MATNEST with shell matrices

2013-02-21 Thread Amneet Bhalla
On Thu, Feb 21, 2013 at 2:57 PM, Jed Brown wrote: > that you're happy with and that performs well with fieldsplit or custom > preconditioning that will be amenable to your MatShells Is fieldsplit an alternative approach to MatNest and VecNest? The problem is that I am working on nonnative PETSc

[petsc-users] MATNEST with shell matrices

2013-02-21 Thread Amneet Bhalla
matrices using (?) b) Create vectors using On Thu, Feb 21, 2013 at 3:24 PM, Matthew Knepley wrote: > On Thu, Feb 21, 2013 at 4:20 PM, Amneet Bhalla gmail.com>wrote: > >> >> On Thu, Feb 21, 2013 at 2:57 PM, Jed Brown wrote: >> >>> that you'

[petsc-users] MATNEST with shell matrices

2013-02-21 Thread Amneet Bhalla
at we want is PETSc's algorithm (and NOT the data structures) to solve the problem. On Thu, Feb 21, 2013 at 5:06 PM, Jed Brown wrote: > > On Thu, Feb 21, 2013 at 4:19 PM, Amneet Bhalla gmail.com>wrote: > >> Can you guys comment on what example case would be best to start o

[petsc-users] MATNEST with shell matrices

2013-02-21 Thread Amneet Bhalla
Jed, so to use VecGetSubVector() with a regular Vec; it would need to set Vec->map->bs = no_of_components that I want to solve for? I understand that a wrapper code needs to be written for gelling SAMRAI data field and PETSc Vec; I am referring to such vector wrapper here. On Thu, Feb 21, 2013 at

[petsc-users] Extracting Vec from VecNest

2013-02-27 Thread Amneet Bhalla
I have packaged few vectors into a single Vec. I want to extract components of this composite Vec at some time in the code. Doing things this way is giving me an error. static const int NO_COMPS = ...; Vec array_x[NO_COMPS] = {.}; Vec x; VecCreateNest(PETSC_COMM_WORLD, NO_COMPS, PETSC_NULL, a

[petsc-users] MATNEST with shell matrices

2013-02-28 Thread Amneet Bhalla
Hi Jed, I have registered MatShell that operates on VecNest (which is composed of shell vectors) with KSP. When I am solving sytem of equations using this KSP, I am getting some errors. The sequence of events from gdb are: #0 0x in ?? () #1 0x009856fd in VecGetArrayRead

[petsc-users] MATNEST with shell matrices

2013-02-28 Thread Amneet Bhalla
I am all for doing things the legal way :-) Where should this routine be added and how should it look like for shell vectors? I had assumed that such changes should be done in user defined MatGetVecs routine. Clearly this is not happening. Can you comment on proper construction of duplicated Vecs

[petsc-users] MATNEST with shell matrices

2013-03-01 Thread Amneet Bhalla
Jed this is output from gdb: #0 0x in ?? () #1 0x009857fd in VecGetArrayRead (x=0x33ba0b0, a=0x7fff1f0cf100) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/include/petsc-private/vecimpl.h:350 #2 0x0098f67f in VecGetArray_Nest (X=0x33c0850, x=0x7fff1f0cf2

Re: [petsc-users] Configure error after upgrading GCC

2018-12-10 Thread Amneet Bhalla via petsc-users
onsModule=config.compilerOptions --CC=mpicc --FC=mpif90 > --with-debugging=1 --download-hypre=1 --with-x=0 --PETSC_ARCH=linux-dbg > > If specifying compilers - also specify a C++ compiler. > > --CC=mpicc --FC=mpif90 --CXX=mpicxx > > Satish > > > On Sun, 9 Dec 20

Re: [petsc-users] Cross-compilation cluster

2019-03-14 Thread Amneet Bhalla via petsc-users
Hmmn, ok. I will try it out. On Thu, Mar 14, 2019 at 9:34 AM Matthew Knepley wrote: > On Thu, Mar 14, 2019 at 10:05 AM Amneet Bhalla > wrote: > >> I need the serial built of Silo and HDF5 libraries. I am sure that the >> MPI wrappers are coming from the serial compiler