Hi Dave, The script seems to work with the following changes.
4c4 < from fipy.meshes.grid2D import Grid2D --- > #from fipy.meshes.grid2D import Grid2D Problem here is that "from fipy import Grid2D" is not the same as "from fipy.meshes.grid2D import Grid2D", which doesn't work correctly in parallel. This state of affairs is entirely heinous. I'm going to file a bug and try and fix it today. 11c11,13 < --- > from fipy import raw_input > from fipy import Grid2D > from fipy import parallel FiPy has its own "raw_input", which deals with the parallel environment correctly. There is not much more that can be done other than better documentation. If we did less "from fipy import *" in the examples it might improve things. I'm also importing the "Grid2D" factory function rather than the "Grid2D" class. They absolutey need different names. 14,16c16,18 < from mpi4py import MPI < comm = MPI.COMM_WORLD < rank = comm.Get_rank() --- > # from mpi4py import MPI > # comm = MPI.COMM_WORLD > # rank = comm.Get_rank() Don't need the above. You can use "paralllel.procID". "parallel" is just a wrapper for both Mpi4py's and Trilinos's communicators. We need both of them for FiPy, hence the wrapper. We should probably rename parallel to parallelComm or something like that. 44c52 < viewer = MatplotlibViewer(phi) --- > viewer = MatplotlibViewer(phi, datamax=1., datamin=0.) Makes the upper plot not rescale to a small number. 64c72 < if rank == 0: --- > if parallel.procID == 0: Use parallel. The above changes seem to fix and the solution looks correct when compared with the serial solution. On Thu, Jan 10, 2013 at 10:04 AM, dely <[email protected]> wrote: > Thanks for looking at this. I have attached a short script (solve.py) that > illustrates the behavior described in my initial e-mail. I receive the > following output if the line, "from fipy import *", is commented out in the > script: > > $ mpirun -np 2 python setvalue.py > Press Enter to continue...Traceback (most recent call last): > File "setvalue.py", line 41, in <module> > raw_input("Press Enter to continue...") > EOFError: EOF when reading a line > Dealt with if you use "from fipy import raw_input". > > Press Enter to continue... > > If I include the "from fipy import *" line, I do not get this error and > the values appear to be broadcast correctly. However, if I switch > to PeriodicGrid2DLeftRight mesh, the improper broadcasting appears again. > PeriodicGrids don't work at all in parallel. They should really take a serial comm by default. > > Finally, in all cases, the solution to the diffusion equation solved for > in solve.py appears to be incorrect when run in parallel. > It should be correct now, but let me know if it isn't. I've attached the corrected script as well. Cheers, -- Daniel Wheeler
solveNew.py
Description: Binary data
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
