I tried to run n2p_ex1.py from the following tutorial page
5.3.1 Using PETSc — NGS-Py 6.2.2305 documentation (ngsolve.org)
And I got the error message.
Invalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 keyTraceback (most recent call last):
File “/home/wan01937/Workspace/Fractal_boundary/fractal_boundary/n2p_ex1.py”, line 16, in
ngmesh = unit_cube.GenerateMesh(maxh=0.1).Distribute(comm)
TypeError: Distribute(): incompatible function arguments. The following argument types are supported:
1. (self: netgen.libngpy._meshing.Mesh, comm: netgen.libngpy._meshing.MPI_Comm) → netgen.libngpy._meshing.Mesh
Invoked with: <netgen.libngpy._meshing.Mesh object at 0x7f28d7967b70>, <mpi4py.MPI.Intracomm object at 0x7f2b0690c1b0>
A similar thing happens every time I try to use something like unit_cube.GenerateMesh(maxh=0.1).Distribute(comm). Does anyone have some idea about the problem?
It looks like the mpi4py communicator cannot be converted to a Netgen mpi-communicator. Did you run Netgen - cmake after installing mpi4py ?
Your CMakeCache.txt should contain:
//enable mpi parallelization
//enable mpi4py interface
If you are intrested in using PETSc I suggest you have a look into ngsPETSc (it supports more features then standard ngs2petsc, such as NEST matrix, non linear problems and it also gives you acess to more PETSc PC). You can find the docs, including how to install properly NGSolve here: Welcome to ngsPETSc’s documentation! — ngsPETSc 0.0.1 documentation
Thanks. I’ll try it once I get the MPI configuration done.
Thanks for your help. I followed the instruction on Build on Linux — NGS-Py 6.2.2305 documentation (ngsolve.org), with
cmake -DCMAKE_INSTALL_PREFIX=~/Workspace/ngsuite/ngsolve-install -DB
UILD_STUB_FILES=OFF -DUSE_MPI=ON ~/Workspace/ngsuite/ngsolve-src
However, the problem still exists, and I could not find USE_MPI4PY:BOOL=ON in my CMakeCache.txt, as attached. Is there anything else I need to do?
CMakeCache.txt (24.5 KB)
Btw, I can actually find what you wrote in the CMakeCache.txt in the directory /ngsolve-build/netgen. And I can see “Including MPI version 3.1” if I just start netgen. However, the mpi4py communicator still cannot be converted to a Netgen mpi-communica
CMakeCache.txt (23.2 KB)