How to run OpenMC with MPI? Tutorial of OpenMC in Parallel

Hi OpenMC family!

I’m doing depletion simulation in OpenMC and this is taking a while, so that’s motivation me to try run OpenMC in more that one computer to increase the speed. In the laboratory of my university have 4 computers with ArchLinux available to simulate at the same time like a cluster. I tried harder, but didn’t worked.

Step-by-step of what I did

First I read the OpenMC documentation, but there just say we need to supply the mpi_args argument to openmc.run(), like:

openmc.run(mpi_args=['mpiexec', '-n', '32'])

So I tried find information in internet and there say things like we set the SSH without password. So I created a openmc user for every computer [nuclear212, nuclear213, nuclear214, nuclear215] doing:

sudo useradd -m openmc
sudo usermod -aG wheel openmc
sudo passwd openmc

And in the main computer (nuclear215) I did:

ssh-keygen -t rsa
ssh-copy-id openmc@nuclear214
ssh-copy-id openmc@nuclear213
ssh-copy-id openmc@nuclear212

To install the OpenMC in every computer I did:

sudo pacman -Syu openmpi #to update the computer and install OpenMPI
paru -S miniconda3 #To install miniconda
echo "#MiniConda3" >> ~/.bashrc #We need to source miniconda on bashrc
echo "[ -f /opt/miniconda3/etc/profile.d/conda.sh ] && source /opt/miniconda3/etc/profile.d/conda.sh" >> ~/.bashrc
echo "" >> ~/.bashrc
conda config --add channels conda-forge #Here folowing the quick install guide
conda create -n openmc-env
conda activate openmc-env
conda install mamba
mamba install vtk openmc[version=0.14.0,build=dagmc_mpi_openmpi_py312h87dd1e5_101] #Chossing the build to make sure we take the OpenMC+OpenMPI
paru -S nuclear-data #to install cross-sections
echo "#OpenMC" >> ~/.bashrc #Put the cross-sections on bashrc
echo "var=`echo /opt/nuclear-data/*hdf5 | head -n1`" >> ~/.bashrc
echo "export OPENMC_CROSS_SECTIONS=$var/cross_sections.xml" >> ~/.bashrc
echo "" >> ~/.bashrc

Ok, so now we have OpenMC with OpenMPI in every computer and the main computer have access to the other’s with SSH without password. So I tried to run the commands specifing the hosts. As we are using OpenMPI with OpenMP we need just 1 node MPI per machine, because the OpenMP take care of use every threds avaliable of that machine. So I tried to run with command (just 2 computers as a first try):

openmc.run(mpi_args=['mpiexec', '-np', '2', '--hosts', 'nuclear215,nuclear214' ])

Give a error because MPI can’t find the openmc command. I figure out when I run ssh nuclear214 openmc the bash can’t find openmc command. But if I run ssh nuclear214 and after login run openmc, so bash find it. I read that because the non-interactive SSH do not run the bashrc. So I cheated… I put a symbolic link in /bin to the binary openmc from the conda environment:

sudo ln -s /home/openmc/.conda/envs/openmc-env/bin/openmc /bin/

When I run, the MPI complain can’t find orted, so I did the same with orted:

sudo ln -s /home/openmc/.conda/envs/openmc-env/bin/orted /bin/

Ok, now I run and IT WORKS?!?!
So so…:
The OpenMC instance in main computer (nuclear215) it’s running, loading nuclides, etc. But the secondary instance (nuclear214) send a message “can’t find the XML input files”, so crash the MPI.

Questions

1 - Isn’t the Python API responsible for sending the XML files that it generalizes to all machines that OpenMC will run on?

2 - How MPI can fint the openmc binary in other machines using the conda envrolvment in right way?

3 - Am I on the right or wrong path to being able to run OpenMC in cluster mode?

4 - How MPI works to speedup the simulation of transport? I mean, it share particles between the machines? Or both machines simulate separate and take a average of the result?


Thanks guys, I’m new in the MPI world, first time trying it!
I’m a master degree studant of Nuclear Engennier at UFMG, a brasilian university

I made some progress…

Buiding

I tried to compile in ArchLinux using a modification of openmc-git AUR script.

My PKGBUILD is the following:

pkgname=openmc-ompi-nopy
pkgver=v0.14.0
pkgrel=1
pkgdesc="OpenMC build with OpenMPI and but without python env."
arch=('x86_64')
url="https://github.com/openmc-dev/openmc"
license=('MIT')

source=("${pkgname}::git+${url}.git")

pkgver() {
    cd "$pkgname"
    git checkout master > /dev/null  #Mude o repostório para a brench master (última versão estável) #Necessário descartar a saída padrão
    git describe --tags | sed 's/-.*//'
}

md5sums=('SKIP')

depends=( 
    hdf5-openmpi
    openssh
    fmt
)

makedepends=(
    base-devel
    cmake
    git
    fmt
)

conflicts=(
    openmc-git
)

provides=("${pkgname%-pkgver}")

build() {
    cd $srcdir/${pkgname}
    rm -rf build
    mkdir build && cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENMC_USE_MPI=ON -DHDF5_PREFER_PARALLEL=ON -DCMAKE_INSTALL_PREFIX=/opt/openmc

    _ccores=$(nproc)
    # check if _ccores is a positive integer, if not, serial build
    if [[ "${_ccores}" =~ ^[1-9][0-9]*$ ]]; then
        make -j ${_ccores}
    else
        make
    fi
}

package() {
    cd $srcdir/${pkgname}/build                       #Vá para o diretório build
    make DESTDIR="$pkgdir/" install                   #Execute o comando "make intall" mas com diretório destino como o pacote "$pkgdir/"
    rm -rf $srcdir/${pkgname}/build                   #Sendo a instalação bem sucedida remova os arquivos de compilação
    mkdir $pkgdir/opt/openmc/openmc-src               #Crie um diretório para hospedar o código fonte no diretório de instalação dentro do pacote
    cp -r $srcdir/${pkgname}/* $pkgdir/opt/openmc/openmc-src #Copie o código fonte
    rm -rf $srcdir                                    #Delete o código fonte
    mkdir -p $pkgdir/usr/bin                          #Crie o diretório /usr/bin no pacote
    ln -s /opt/openmc/bin/openmc $pkgdir/usr/bin      #Crie um link simbólico para o binário do openmc em /usr/bin
}

I build OpenMC using makepkg -s and send the packages to others machine with:

scp openmc-ompi-nopy-v0.14.0-1-x86_64.pkg.tar.zst  USER@HOST:/home/openmc

And installed using:

sudo pacman -U openmc-ompi-nopy-v0.14.0-1-x86_64.pkg.tar.zst

after SSH loging.

Running

For testing, lets run just in one computer:

[openmc@nuclear215 testeMPI]$ mpiexec --host nuclear215:8 openmc 
                                %%%%%%%%%%%%%%%
                           %%%%%%%%%%%%%%%%%%%%%%%%
                        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                                    %%%%%%%%%%%%%%%%%%%%%%%%
                                     %%%%%%%%%%%%%%%%%%%%%%%%
                 ###############      %%%%%%%%%%%%%%%%%%%%%%%%
                ##################     %%%%%%%%%%%%%%%%%%%%%%%
                ###################     %%%%%%%%%%%%%%%%%%%%%%%
                ####################     %%%%%%%%%%%%%%%%%%%%%%
                #####################     %%%%%%%%%%%%%%%%%%%%%
                ######################     %%%%%%%%%%%%%%%%%%%%
                #######################     %%%%%%%%%%%%%%%%%%
                 #######################     %%%%%%%%%%%%%%%%%
                 ######################     %%%%%%%%%%%%%%%%%
                  ####################     %%%%%%%%%%%%%%%%%
                    #################     %%%%%%%%%%%%%%%%%
                     ###############     %%%%%%%%%%%%%%%%
                       ############     %%%%%%%%%%%%%%%
                          ########     %%%%%%%%%%%%%%
                                      %%%%%%%%%%%

                 | The OpenMC Monte Carlo Code
       Copyright | 2011-2023 MIT, UChicago Argonne LLC, and contributors
         License | https://docs.openmc.org/en/latest/license.html
         Version | 0.14.0
        Git SHA1 | fa2330103de61a864c958d1a7250f11e5dd91468
       Date/Time | 2024-03-09 21:56:30
   MPI Processes | 8
  OpenMP Threads | 2

 Reading settings XML file...
 Reading cross sections XML file...
 Reading materials XML file...
 Reading geometry XML file...
 Reading U234 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/U234.h5
 Reading U235 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/U235.h5
 Reading U238 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/U238.h5
 Reading H1 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/H1.h5
 Reading H2 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/H2.h5
 Reading O16 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/O16.h5
 Reading O17 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/O17.h5
 Reading O18 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/O18.h5
 Reading N14 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/N14.h5
 Reading N15 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/N15.h5
 Reading Ar36 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ar36.h5
 WARNING: Negative value(s) found on probability table for nuclide Ar36 at 294K
 Reading Ar38 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ar38.h5
 Reading Ar40 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ar40.h5
 Reading Al27 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Al27.h5
 Reading C12 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/C12.h5
 Reading C13 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/C13.h5
 Reading S32 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/S32.h5
 Reading S33 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/S33.h5
 Reading S34 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/S34.h5
 Reading S36 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/S36.h5
 Reading P31 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/P31.h5
 Reading Si28 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Si28.h5
 Reading Si29 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Si29.h5
 Reading Si30 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Si30.h5
 Reading Fe54 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Fe54.h5
 Reading Fe56 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Fe56.h5
 Reading Fe57 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Fe57.h5
 Reading Fe58 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Fe58.h5
 Reading Mn55 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mn55.h5
 Reading Cr50 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Cr50.h5
 Reading Cr52 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Cr52.h5
 Reading Cr53 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Cr53.h5
 Reading Cr54 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Cr54.h5
 Reading Ni58 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni58.h5
 Reading Ni60 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni60.h5
 Reading Ni61 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni61.h5
 Reading Ni62 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni62.h5
 Reading Ni64 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni64.h5
 Reading Mo92 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo92.h5
 Reading Mo94 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo94.h5
 Reading Mo95 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo95.h5
 Reading Mo96 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo96.h5
 Reading Mo97 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo97.h5
 Reading Mo98 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo98.h5
 Reading Mo100 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo100.h5
 Reading Pu239 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Pu239.h5
 Reading Be9 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Be9.h5
 Minimum neutron data temperature: 250 K
 Maximum neutron data temperature: 2500 K
 Preparing distributed cell instances...
 Reading plot XML file...
 Writing summary.h5 file...
 Maximum neutron transport energy: 20000000 eV for H1
 Initializing source particles...

 ====================>     K EIGENVALUE SIMULATION     <====================

  Bat./Gen.      k            Average k
  =========   ========   ====================
        1/1    0.83603
        2/1    0.97081
        3/1    0.88631
        4/1    0.87834
        5/1    0.89345
        6/1    0.83243
        7/1    0.90361
        8/1    0.83341
        9/1    0.94309
       10/1    0.85747
       11/1    0.83933
       12/1    0.85382    0.84657 +/- 0.00725
       13/1    0.80887    0.83400 +/- 0.01325
       14/1    0.84356    0.83639 +/- 0.00967
       15/1    0.86930    0.84297 +/- 0.00997
       16/1    0.83614    0.84184 +/- 0.00822
       17/1    0.83941    0.84149 +/- 0.00696
       18/1    0.88976    0.84752 +/- 0.00853
       19/1    0.83604    0.84625 +/- 0.00763
       20/1    0.85160    0.84678 +/- 0.00684
       21/1    0.83381    0.84560 +/- 0.00630
       22/1    0.84979    0.84595 +/- 0.00576
       23/1    0.83532    0.84513 +/- 0.00536
       24/1    0.82321    0.84357 +/- 0.00521
       25/1    0.82223    0.84215 +/- 0.00505
       26/1    0.90498    0.84607 +/- 0.00614
       27/1    0.83042    0.84515 +/- 0.00584
       28/1    0.85783    0.84586 +/- 0.00555
       29/1    0.81314    0.84413 +/- 0.00553
       30/1    0.84385    0.84412 +/- 0.00525
       31/1    0.75623    0.83993 +/- 0.00651
       32/1    0.80788    0.83848 +/- 0.00638
       33/1    0.84838    0.83891 +/- 0.00611
       34/1    0.81042    0.83772 +/- 0.00597
       35/1    0.86619    0.83886 +/- 0.00584
       36/1    0.85214    0.83937 +/- 0.00563
       37/1    0.83449    0.83919 +/- 0.00542
       38/1    0.79670    0.83767 +/- 0.00544
       39/1    0.84111    0.83779 +/- 0.00525
       40/1    0.82462    0.83735 +/- 0.00509
       41/1    0.78847    0.83578 +/- 0.00517
       42/1    0.83413    0.83572 +/- 0.00501
       43/1    0.81309    0.83504 +/- 0.00490
       44/1    0.84792    0.83542 +/- 0.00477
       45/1    0.81257    0.83476 +/- 0.00468
       46/1    0.79782    0.83374 +/- 0.00466
       47/1    0.84209    0.83396 +/- 0.00454
       48/1    0.82200    0.83365 +/- 0.00443
       49/1    0.80931    0.83302 +/- 0.00436
       50/1    0.86090    0.83372 +/- 0.00430
       51/1    0.82170    0.83343 +/- 0.00421
       52/1    0.86707    0.83423 +/- 0.00418
       53/1    0.85796    0.83478 +/- 0.00412
       54/1    0.78721    0.83370 +/- 0.00417
       55/1    0.85921    0.83427 +/- 0.00412
       56/1    0.83722    0.83433 +/- 0.00403
       57/1    0.86159    0.83491 +/- 0.00398
       58/1    0.79786    0.83414 +/- 0.00397
       59/1    0.85020    0.83447 +/- 0.00391
       60/1    0.81580    0.83409 +/- 0.00384
       61/1    0.79723    0.83337 +/- 0.00384
       62/1    0.81063    0.83293 +/- 0.00379
       63/1    0.81697    0.83263 +/- 0.00373
       64/1    0.80498    0.83212 +/- 0.00369
       65/1    0.84480    0.83235 +/- 0.00363
       66/1    0.85653    0.83278 +/- 0.00359
       67/1    0.82968    0.83273 +/- 0.00353
       68/1    0.84543    0.83295 +/- 0.00348
       69/1    0.88935    0.83390 +/- 0.00355
       70/1    0.85665    0.83428 +/- 0.00351
       71/1    0.82560    0.83414 +/- 0.00345
       72/1    0.86198    0.83459 +/- 0.00343
       73/1    0.79221    0.83392 +/- 0.00344
       74/1    0.83712    0.83397 +/- 0.00339
       75/1    0.86450    0.83444 +/- 0.00337
       76/1    0.88360    0.83518 +/- 0.00340
       77/1    0.90145    0.83617 +/- 0.00349
       78/1    0.83994    0.83623 +/- 0.00344
       79/1    0.82537    0.83607 +/- 0.00339
       80/1    0.82661    0.83593 +/- 0.00335
       81/1    0.88215    0.83658 +/- 0.00336
       82/1    0.89677    0.83742 +/- 0.00342
       83/1    0.87525    0.83794 +/- 0.00341
       84/1    0.87113    0.83839 +/- 0.00339
       85/1    0.83902    0.83840 +/- 0.00335
       86/1    0.85019    0.83855 +/- 0.00331
       87/1    0.88361    0.83914 +/- 0.00332
       88/1    0.84717    0.83924 +/- 0.00328
       89/1    0.85723    0.83947 +/- 0.00324
       90/1    0.84112    0.83949 +/- 0.00320
       91/1    0.82314    0.83929 +/- 0.00317
       92/1    0.77332    0.83848 +/- 0.00323
       93/1    0.83936    0.83849 +/- 0.00319
       94/1    0.82525    0.83833 +/- 0.00316
       95/1    0.77798    0.83762 +/- 0.00320
       96/1    0.79802    0.83716 +/- 0.00320
       97/1    0.86597    0.83749 +/- 0.00318
       98/1    0.81762    0.83727 +/- 0.00315
       99/1    0.83910    0.83729 +/- 0.00311
      100/1    0.88466    0.83782 +/- 0.00312
 Creating state point statepoint.100.h5...

 =======================>     TIMING STATISTICS     <=======================

 Total time for initialization     = 2.9245e+00 seconds
   Reading cross sections          = 2.8973e+00 seconds
 Total time in simulation          = 8.3410e-01 seconds
   Time in transport only          = 6.9938e-01 seconds
   Time in inactive batches        = 1.0086e-01 seconds
   Time in active batches          = 7.3324e-01 seconds
   Time synchronizing fission bank = 1.2698e-01 seconds
     Sampling source sites         = 1.3046e-03 seconds
     SEND/RECV source sites        = 4.5505e-04 seconds
   Time accumulating tallies       = 4.1398e-04 seconds
   Time writing statepoints        = 3.0814e-03 seconds
 Total time for finalization       = 1.9480e-06 seconds
 Total time elapsed                = 3.7773e+00 seconds
 Calculation Rate (inactive)       = 99146.1 particles/second
 Calculation Rate (active)         = 122742 particles/second

 ============================>     RESULTS     <============================

 k-effective (Collision)     = 0.84048 +/- 0.00283
 k-effective (Track-length)  = 0.83782 +/- 0.00312
 k-effective (Absorption)    = 0.84819 +/- 0.00359
 Combined k-effective        = 0.84252 +/- 0.00250
 Leakage Fraction            = 0.02019 +/- 0.00053

So I put the *.XML input files generate by OpenMC Python API in both computers and try again:

[openmc@nuclear215 testeMPI]$ mpiexec --host nuclear215:1,nuclear214:1 openmc 
                                %%%%%%%%%%%%%%%
                           %%%%%%%%%%%%%%%%%%%%%%%%
                        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                                    %%%%%%%%%%%%%%%%%%%%%%%%
                                     %%%%%%%%%%%%%%%%%%%%%%%%
                 ###############      %%%%%%%%%%%%%%%%%%%%%%%%
                ##################     %%%%%%%%%%%%%%%%%%%%%%%
                ###################     %%%%%%%%%%%%%%%%%%%%%%%
                ####################     %%%%%%%%%%%%%%%%%%%%%%
                #####################     %%%%%%%%%%%%%%%%%%%%%
                ######################     %%%%%%%%%%%%%%%%%%%%
                #######################     %%%%%%%%%%%%%%%%%%
                 #######################     %%%%%%%%%%%%%%%%%
                 ######################     %%%%%%%%%%%%%%%%%
                  ####################     %%%%%%%%%%%%%%%%%
                    #################     %%%%%%%%%%%%%%%%%
                     ###############     %%%%%%%%%%%%%%%%
                       ############     %%%%%%%%%%%%%%%
                          ########     %%%%%%%%%%%%%%
                                      %%%%%%%%%%%

                 | The OpenMC Monte Carlo Code
       Copyright | 2011-2023 MIT, UChicago Argonne LLC, and contributors
         License | https://docs.openmc.org/en/latest/license.html
         Version | 0.14.0
        Git SHA1 | fa2330103de61a864c958d1a7250f11e5dd91468
       Date/Time | 2024-03-09 21:50:36
   MPI Processes | 2
  OpenMP Threads | 2

 Reading settings XML file...
 Reading cross sections XML file...
 Reading materials XML file...
 Reading geometry XML file...
 Reading U234 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/U234.h5
 Reading U235 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/U235.h5
 Reading U238 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/U238.h5
 Reading H1 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/H1.h5
 Reading H2 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/H2.h5
 Reading O16 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/O16.h5
 Reading O17 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/O17.h5
 Reading O18 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/O18.h5
 Reading N14 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/N14.h5
 Reading N15 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/N15.h5
 Reading Ar36 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ar36.h5
 WARNING: Negative value(s) found on probability table for nuclide Ar36 at 294K
 Reading Ar38 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ar38.h5
 Reading Ar40 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ar40.h5
 Reading Al27 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Al27.h5
 Reading C12 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/C12.h5
 Reading C13 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/C13.h5
 Reading S32 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/S32.h5
 Reading S33 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/S33.h5
 Reading S34 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/S34.h5
 Reading S36 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/S36.h5
 Reading P31 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/P31.h5
 Reading Si28 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Si28.h5
 Reading Si29 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Si29.h5
 Reading Si30 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Si30.h5
 Reading Fe54 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Fe54.h5
 Reading Fe56 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Fe56.h5
 Reading Fe57 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Fe57.h5
 Reading Fe58 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Fe58.h5
 Reading Mn55 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mn55.h5
 Reading Cr50 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Cr50.h5
 Reading Cr52 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Cr52.h5
 Reading Cr53 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Cr53.h5
 Reading Cr54 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Cr54.h5
 Reading Ni58 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni58.h5
 Reading Ni60 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni60.h5
 Reading Ni61 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni61.h5
 Reading Ni62 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni62.h5
 Reading Ni64 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Ni64.h5
 Reading Mo92 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo92.h5
 Reading Mo94 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo94.h5
 Reading Mo95 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo95.h5
 Reading Mo96 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo96.h5
 Reading Mo97 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo97.h5
 Reading Mo98 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo98.h5
 Reading Mo100 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Mo100.h5
 Reading Pu239 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Pu239.h5
 Reading Be9 from /opt/nuclear-data/endfb-viii.0-hdf5/neutron/Be9.h5
 Minimum neutron data temperature: 250 K
 Maximum neutron data temperature: 2500 K
 Preparing distributed cell instances...
 Reading plot XML file...
 Writing summary.h5 file...
 Maximum neutron transport energy: 20000000 eV for H1
 Initializing source particles...

 ====================>     K EIGENVALUE SIMULATION     <====================

  Bat./Gen.      k            Average k
  =========   ========   ====================
        1/1    0.83603
        2/1    0.97081
        3/1    0.88631
        4/1    0.87834
        5/1    0.89345
        6/1    0.83243
        7/1    0.90361
        8/1    0.83341
        9/1    0.94309
       10/1    0.85747
       11/1    0.83933
       12/1    0.85382    0.84657 +/- 0.00725
       13/1    0.80887    0.83400 +/- 0.01325
       14/1    0.84356    0.83639 +/- 0.00967
       15/1    0.86930    0.84297 +/- 0.00997
       16/1    0.83614    0.84184 +/- 0.00822
       17/1    0.83941    0.84149 +/- 0.00696
       18/1    0.88976    0.84752 +/- 0.00853
       19/1    0.83604    0.84625 +/- 0.00763
       20/1    0.85160    0.84678 +/- 0.00684
       21/1    0.83381    0.84560 +/- 0.00630
       22/1    0.84979    0.84595 +/- 0.00576
       23/1    0.83532    0.84513 +/- 0.00536
       24/1    0.82321    0.84357 +/- 0.00521
       25/1    0.82223    0.84215 +/- 0.00505
       26/1    0.90498    0.84607 +/- 0.00614
       27/1    0.83042    0.84515 +/- 0.00584
       28/1    0.85783    0.84586 +/- 0.00555
       29/1    0.81314    0.84413 +/- 0.00553
       30/1    0.84385    0.84412 +/- 0.00525
       31/1    0.75623    0.83993 +/- 0.00651
       32/1    0.80788    0.83848 +/- 0.00638
       33/1    0.84838    0.83891 +/- 0.00611
       34/1    0.81042    0.83772 +/- 0.00597
       35/1    0.86619    0.83886 +/- 0.00584
       36/1    0.85214    0.83937 +/- 0.00563
       37/1    0.83449    0.83919 +/- 0.00542
       38/1    0.79670    0.83767 +/- 0.00544
       39/1    0.84111    0.83779 +/- 0.00525
       40/1    0.82462    0.83735 +/- 0.00509
       41/1    0.78847    0.83578 +/- 0.00517
       42/1    0.83413    0.83572 +/- 0.00501
       43/1    0.81309    0.83504 +/- 0.00490
       44/1    0.84792    0.83542 +/- 0.00477
       45/1    0.81257    0.83476 +/- 0.00468
       46/1    0.79782    0.83374 +/- 0.00466
       47/1    0.84209    0.83396 +/- 0.00454
       48/1    0.82200    0.83365 +/- 0.00443
       49/1    0.80931    0.83302 +/- 0.00436
       50/1    0.86090    0.83372 +/- 0.00430
       51/1    0.82170    0.83343 +/- 0.00421
       52/1    0.86707    0.83423 +/- 0.00418
       53/1    0.85796    0.83478 +/- 0.00412
       54/1    0.78721    0.83370 +/- 0.00417
       55/1    0.85921    0.83427 +/- 0.00412
       56/1    0.83722    0.83433 +/- 0.00403
       57/1    0.86159    0.83491 +/- 0.00398
       58/1    0.79786    0.83414 +/- 0.00397
       59/1    0.85020    0.83447 +/- 0.00391
       60/1    0.81580    0.83409 +/- 0.00384
       61/1    0.79723    0.83337 +/- 0.00384
       62/1    0.81063    0.83293 +/- 0.00379
       63/1    0.81697    0.83263 +/- 0.00373
       64/1    0.80498    0.83212 +/- 0.00369
       65/1    0.84480    0.83235 +/- 0.00363
       66/1    0.85653    0.83278 +/- 0.00359
       67/1    0.82968    0.83273 +/- 0.00353
       68/1    0.84543    0.83295 +/- 0.00348
       69/1    0.88935    0.83390 +/- 0.00355
       70/1    0.85665    0.83428 +/- 0.00351
       71/1    0.82560    0.83414 +/- 0.00345
       72/1    0.86198    0.83459 +/- 0.00343
       73/1    0.79221    0.83392 +/- 0.00344
       74/1    0.83712    0.83397 +/- 0.00339
       75/1    0.86450    0.83444 +/- 0.00337
       76/1    0.88360    0.83518 +/- 0.00340
       77/1    0.90145    0.83617 +/- 0.00349
       78/1    0.83994    0.83623 +/- 0.00344
       79/1    0.82537    0.83607 +/- 0.00339
       80/1    0.82661    0.83593 +/- 0.00335
       81/1    0.88215    0.83658 +/- 0.00336
       82/1    0.89677    0.83742 +/- 0.00342
       83/1    0.87525    0.83794 +/- 0.00341
       84/1    0.87113    0.83839 +/- 0.00339
       85/1    0.83902    0.83840 +/- 0.00335
       86/1    0.85019    0.83855 +/- 0.00331
       87/1    0.88361    0.83914 +/- 0.00332
       88/1    0.84717    0.83924 +/- 0.00328
       89/1    0.85723    0.83947 +/- 0.00324
       90/1    0.84112    0.83949 +/- 0.00320
       91/1    0.82314    0.83929 +/- 0.00317
       92/1    0.77332    0.83848 +/- 0.00323
       93/1    0.83936    0.83849 +/- 0.00319
       94/1    0.82525    0.83833 +/- 0.00316
       95/1    0.77798    0.83762 +/- 0.00320
       96/1    0.79802    0.83716 +/- 0.00320
       97/1    0.86597    0.83749 +/- 0.00318
       98/1    0.81762    0.83727 +/- 0.00315
       99/1    0.83910    0.83729 +/- 0.00311
      100/1    0.88466    0.83782 +/- 0.00312
 Creating state point statepoint.100.h5...

And got stuck here… Wait and wait, it never ends.


It’s really working! When I tried to put more nodes runned MUCH MORE FASTER. Like:

mpiexec --host nuclear215:8,nuclear214:8,nuclear213:8,nuclear212:6 openmc

But always get stuck on “Creating state point” …

@paulromano do you have any idea why the simulation got stuck on “Creating state point” when using MPI with more than 1 computer?

I’m not only having this problem, I saw someone in OpenMC forum saying have the same problem.

Finally find a solution!

The problem is with the package parallel HDF5 (hdf5-openmpi package).

The solution is simply compile the OpenMC with serial HDF5 (hdf5 package).

Source: Depletion simulation on supercomputer gets stuck between depletion steps.
And: Allow depletion with MPI and serial HDF5 by paulromano · Pull Request #1566 · openmc-dev/openmc · GitHub

My new package build is:

pkgname=openmc-ompi-nopy
pkgver=v0.15.0
pkgrel=1
pkgdesc="OpenMC build with OpenMPI but without hdf5-openmpi, and without python env."
arch=('x86_64')
url="https://github.com/openmc-dev/openmc"
license=('MIT')

source=("${pkgname}::git+${url}.git")

pkgver() {
    cd "$pkgname"
    git checkout master > /dev/null  # Change to brench master (last version stable)
    git describe --tags | sed 's/-.*//'
}

md5sums=('SKIP')

depends=( 
    hdf5
    openssh
    fmt
)

makedepends=(
    hdf5
    base-devel
    cmake
    git
    fmt
)

conflicts=(
    openmc-git
    hdf5-openmpi
)

provides=("${pkgname%-pkgver}")

build() {
    cd $srcdir/${pkgname}
    rm -rf build
    mkdir build && cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENMC_USE_MPI=ON -DCMAKE_INSTALL_PREFIX=/opt/openmc

    _ccores=$(nproc)
    # check if _ccores is a positive integer, if not, serial build
    if [[ "${_ccores}" =~ ^[1-9][0-9]*$ ]]; then
        make -j ${_ccores}
    else
        make
    fi
}

package() {
    cd $srcdir/${pkgname}/build
    make DESTDIR="$pkgdir/" install
    rm -rf $srcdir/${pkgname}/build
    mkdir $pkgdir/opt/openmc/openmc-src
    cp -r $srcdir/${pkgname}/* $pkgdir/opt/openmc/openmc-src
    rm -rf $srcdir
    mkdir -p $pkgdir/usr/bin
    ln -s /opt/openmc/bin/openmc $pkgdir/usr/bin
}

Save this as a file called PKGBUILD. To compile and install on ArchLinux family (Manjaro, etc) run this command in the same folder of PKGBUILD file:

makepkg -si #or use just -s to just compile

To create a python envrolvment in your user:

cd ~
python -m venv openmc-env
source openmc-env/bin/activate
cp -r /opt/openmc/openmc-src/ ~/
cd openmc-src/
python -m pip install .
rm -rf ~/openmc-src/

In the cluster you need the python envrolvment just in the father computer.

You need run the comand below every time you open the terminal in the father computer before run openmc python:

source openmc-env/bin/activate

Or you can put this command in the ~/.bashrc file.

1 Like