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

[BUG] dolfinx MPI_ABORT due to tqdm progress bar #895

Closed
RemDelaporteMathurin opened this issue Oct 17, 2024 · 1 comment · Fixed by #894
Closed

[BUG] dolfinx MPI_ABORT due to tqdm progress bar #895

RemDelaporteMathurin opened this issue Oct 17, 2024 · 1 comment · Fixed by #894
Labels
bug Something isn't working fenicsx Issue that is related to the fenicsx support good first issue Good for newcomers

Comments

@RemDelaporteMathurin
Copy link
Collaborator

Describe the bug
We recently realised kaelyndunnell/hisp#18 that using the tqdm progress bar could cause crashes when it isn't closed after calling run

To Reproduce

with dolfinx>=0.8 run:

import festim as F

my_model = F.HydrogenTransportProblem()

my_model.mesh = F.Mesh1D([0, 0.1, 0.2, 0.3, 0.5, 1])

tungsten = F.Material(D_0=1, E_D=0)

w_subdomain = F.VolumeSubdomain1D(id=1, borders=[0, 1], material=tungsten)

my_model.subdomains = [w_subdomain]

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

my_model.temperature = 500

my_model.boundary_conditions = []


my_model.settings = F.Settings(atol=1e-10, rtol=1e-10, final_time=1)

my_model.settings.stepsize = F.Stepsize(initial_value=0.1)

my_model.initialise()
my_model.run()


class RandomClass:  # this triggers the crash
    def __init__(self):
        pass

** Fix **

The progress bar needs to be closed. All we need to do is add self.progress_bar.close() at the end of

FESTIM/festim/problem.py

Lines 105 to 119 in 77c97b3

def run(self):
"""Runs the model"""
if self.settings.transient:
# Solve transient
if self.show_progress_bar:
self.progress_bar = tqdm.autonotebook.tqdm(
desc=f"Solving {self.__class__.__name__}",
total=self.settings.final_time,
unit_scale=True,
)
while self.t.value < self.settings.final_time:
self.iterate()
if self.show_progress_bar:
self.progress_bar.refresh() # refresh progress bar to show 100%

It can also be closed manually after calling run.

@RemDelaporteMathurin RemDelaporteMathurin added bug Something isn't working good first issue Good for newcomers fenicsx Issue that is related to the fenicsx support labels Oct 17, 2024
@RemDelaporteMathurin
Copy link
Collaborator Author

@kaelyndunnell I think you can fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fenicsx Issue that is related to the fenicsx support good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant