This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Mpirun Wrong Results

0 votes

Hello !

I have a problem with mpirun .When i execute mpirun -np 2 python program.py ,i get 2 prints instead of 1 and the results are different with execution of python program.py .In other words multithreading gives different results in comparison to one thread!

The problem i am solving is a NonLinear and the code is :

sol=Function(system)
F=a1+a2+a3+a4+a5-l1-l2-l3-l4-l5
R=action(F,sol)
DR=derivative(R,sol)

problem=NonlinearVariationalProblem(R,sol,J=DR,form_compiler_parameters=ffc_options)
solver=NonlinearVariationalSolver(problem)
prm = solver.parameters
prm['newton_solver']['linear_solver'] = 'gmres'
prm['newton_solver']['absolute_tolerance'] = 1E-7
prm['newton_solver']['relative_tolerance'] = 1E-7
prm['newton_solver']['preconditioner'] = 'hypre_euclid' 
prm['newton_solver']['relaxation_parameter'] = 1.0

I haven't written any code for parallel execution.
Can you give me any help of what should i do in order to get it work?

Thanks in advance!

asked Aug 24, 2016 by AgisM FEniCS Novice (260 points)

2 Answers

0 votes

This is not multithreading, but parallel execution using message passing (MPI). How do you know your results are really different? With an iterative method, you do not get an exact solution, only something close to a tolerance.

answered Aug 24, 2016 by chris_richardson FEniCS Expert (31,740 points)

I executed the same problem with one and 2 threads and with two threads i got a result of 0.69 and with 1 thread i got 0.97 .This difference in my problem is huge.

This problem was in my laptop (Dolfin 2016.1.0)
I tried it in the cluster and i got a message that my solution failed to converge.

Error: Unable to solve linear system using PETSc Krylov solver.
*** Reason: Solution failed to converge in 0 iterations (PETSc reason DIVERGED_NANORINF, residual norm ||r|| = inf).
*** Where: This error was encountered inside PETScKrylovSolver.cpp.
*** Process: 0


*** DOLFIN version: 1.3.0
*** Git changeset: unknown

0 votes

Hello again!
I managed to solve it but now when i plot the results in paraview ,the borders of the partitions from the execution are visible.

That means either that the transition from one partition to another is not correct or that it's a visualization problem.

Could you help me?
Thanks in advance!

answered Aug 30, 2016 by AgisM FEniCS Novice (260 points)
...