Problem running Pincell Depletion Example

Hello, whenever I try to run the Pincell Depletion example, the process seems to go in an infinite loop. While I run the example I get the following messages in the terminal

RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

And

ERROR: Failed to open HDF5 file with mode ‘w’: statepoint.100.h5

Is there any way to remedy this?

OpenMC’s depletion capability relies on the Python multiprocessing module to run calculations in parallel. Depending on how new processes are created, you can run into some problematic behavior as discussed here. In you case, you may just want to disable the use of multiprocessing to avoid issues, which can be done by adding:

openmc.deplete.pool.USE_MULTIPROCESSING = False

at the beginning of your script.

1 Like

Hi,

I tried to put this line at the very beginning of my script, however, it looks the depletion is still run in parallel, anything run with my implementation?

import numpy as np
import glob
import sys
import matplotlib.pyplot as plt
import os

import openmc
import openmc.deplete

# parallel computing
#openmc.deplete.pool.NUM_PROCESSES = 5
openmc.deplete.pool.USE_MULTIPROCESSING = False

###############################################################################
# Create materials for the problem
uo2 = openmc.Material(name='UO2 fuel at 4.0% wt enrichment', temperature = 900)
....

Thanks!

That flag will prevent the depletion solver from starting new processes (via Python’s multiprocessing module); however, OpenMC’s transport solve may still use multiple threads. If you’re trying to avoid that, you can change the OMP_NUM_THREADS environment variable.

I see. This explains, Thank you!