Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dolfinx 0.8 #764

Merged

Conversation

RemDelaporteMathurin
Copy link
Collaborator

This PR just updates the version of dolfinx to 0.8.0

Copy link

codecov bot commented Apr 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.92%. Comparing base (8ebaedd) to head (4249ef7).
Report is 12 commits behind head on fenicsx.

Additional details and impacted files
@@           Coverage Diff            @@
##           fenicsx     #764   +/-   ##
========================================
  Coverage    98.92%   98.92%           
========================================
  Files           36       36           
  Lines         1580     1580           
========================================
  Hits          1563     1563           
  Misses          17       17           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RemDelaporteMathurin RemDelaporteMathurin added the fenicsx Issue that is related to the fenicsx support label Apr 26, 2024
@RemDelaporteMathurin
Copy link
Collaborator Author

RemDelaporteMathurin commented Apr 26, 2024

There is a random error ocuring on both conda and docker when running test_xdmf.py. Although it seems that all the tests pass in this file so I don't really know what is going on here.

[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see https://petsc.org/release/faq/#valgrind and https://petsc.org/release/faq/
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run 
[0]PETSC ERROR: to get more information on the crash.
[0]PETSC ERROR: Run with -malloc_debug to check if memory corruption is causing the crash.
Abort(59) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0

@RemDelaporteMathurin
Copy link
Collaborator Author

The error that we are seeing here might be related to FEniCS/dolfinx#3162

We'll wait for a fix before merging this

@jhdark
Copy link
Collaborator

jhdark commented Apr 30, 2024

There is now 0.8.1 released, not sure if that helps with this bug?

@RemDelaporteMathurin
Copy link
Collaborator Author

I've narrowed down the error to using

my_model.solver.convergence_criterion = "incremental"
ksp = my_model.solver.krylov_solver
opts = PETSc.Options()
option_prefix = ksp.getOptionsPrefix()
opts[f"{option_prefix}ksp_type"] = "cg"
opts[f"{option_prefix}pc_type"] = "gamg"
opts[f"{option_prefix}pc_factor_mat_solver_type"] = "mumps"
ksp.setFromOptions()

Running just test_multispecies_problem gives:

Solving H transport problem: 100%|█████████████████████████████████████████████████████████████████████████| 10.0/10.0 [00:02<00:00, 4.74it/s]
WARNING! There are options you set that were not used!
WARNING! could be spelling mistake, etc!
There is one unused database option. It is:
Option left: name:-nls_solve_pc_factor_mat_solver_type value: mumps source: code

@RemDelaporteMathurin
Copy link
Collaborator Author

MWE to reproduce the random segmentation fault

import numpy as np
import festim as F
from petsc4py import PETSc

for i in range(2):

    my_model = F.HydrogenTransportProblem()
    my_model.mesh = F.Mesh1D(np.linspace(0, 1, num=1000))

    my_mat = F.Material(D_0=1.9e-7, E_D=0.2, name="my_mat")
    my_subdomain = F.VolumeSubdomain1D(id=1, borders=[0, 1], material=my_mat)
    my_model.subdomains = [my_subdomain]

    my_model.species = [F.Species("H")]

    my_model.temperature = 500

    my_model.settings = F.Settings(atol=1e10, rtol=1e-10, transient=False)

    my_model.initialise()

    my_model.solver.convergence_criterion = "incremental"
    ksp = my_model.solver.krylov_solver
    opts = PETSc.Options()
    option_prefix = ksp.getOptionsPrefix()
    opts[f"{option_prefix}ksp_type"] = "cg"
    opts[f"{option_prefix}pc_type"] = "gamg"
    opts[f"{option_prefix}pc_factor_mat_solver_type"] = "mumps"
    ksp.setFromOptions()

    my_model.run()

Randomly produces

[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see https://petsc.org/release/faq/#valgrind and https://petsc.org/release/faq/
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run 
[0]PETSC ERROR: to get more information on the crash.
[0]PETSC ERROR: Run with -malloc_debug to check if memory corruption is causing the crash.
Abort(59) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0

@RemDelaporteMathurin
Copy link
Collaborator Author

I noticed that removing the lines

my_model.solver.convergence_criterion = "incremental"
ksp = my_model.solver.krylov_solver
opts = PETSc.Options()
option_prefix = ksp.getOptionsPrefix()
opts[f"{option_prefix}ksp_type"] = "cg"
opts[f"{option_prefix}pc_type"] = "gamg"
opts[f"{option_prefix}pc_factor_mat_solver_type"] = "mumps"
ksp.setFromOptions()

removes the random segfault

@RemDelaporteMathurin RemDelaporteMathurin merged commit 02a374f into festim-dev:fenicsx Aug 20, 2024
7 of 8 checks passed
@RemDelaporteMathurin RemDelaporteMathurin deleted the update-dolfinx-0.8 branch August 20, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fenicsx Issue that is related to the fenicsx support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants