# Exit code -9 when running simulation

**URL:** <https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114>\
**Category:** User Support\
**Created:** [November 25, 2014, 12:23am UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114 "2014-11-25T00:23:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Xia](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@John\_Xia](https://openmc.discourse.group/u/John_Xia)\
**Post date:** [November 25, 2014, 12:23am UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/1 "2014-11-25T00:23:52Z")

</div>

Hi folks,

I’m trying to use OpenMC in xsgen, in which I use OpenMC to calculate transport over many separate timesteps. It worked great for the first time-step (yay!).

In the second time step, I had transmuted the materials some, and as I ran OpenMC it exited after printing “Creating unionized energy grid…” with the exit code -9. What does this mean?

I’ve put some log files and the XML files on this gist: [https://gist.github.com/jdangerx/d68f5358e34f9b7d619e](https://gist.github.com/jdangerx/d68f5358e34f9b7d619e)

I’d be grateful for any insight into this.

Thanks,  
John

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [November 25, 2014, 3:40am UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/2 "2014-11-25T03:40:25Z")

</div>

I’m almost positive you ran out of memory. Try adding \<energy\_grid\> nuclide \</energy\_grid\> to your settings.xml and you should be all set.

Best regards,  
Paul

---

<div class="post-metadata">

**Author:** ![John\_Xia](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@John\_Xia](https://openmc.discourse.group/u/John_Xia)\
**Post date:** [November 26, 2014, 3:57pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/3 "2014-11-26T15:57:12Z")

</div>

Thanks! That worked! However I made it segfault. I recompiled with debug flags and got this:

At line 2266 of file /home/john/openmc/src/tally.F90  
Fortran runtime error: Index ‘-1’ of dimension 1 of array ‘tally\_maps%items’ below lower bound of 1

The full output and tallies.xml are here: [https://gist.github.com/jdangerx/2c9ade73f1f2e007367d](https://gist.github.com/jdangerx/2c9ade73f1f2e007367d)

John

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [November 28, 2014, 2:18pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/4 "2014-11-28T14:18:30Z")

</div>

Hi John- I’m not able to reproduce the segfault you’re getting. Did you make any changes to the xml files in that gist other than adding \<energy\_grid\>? What version/git SHA1 of OpenMC are you using?

Best,  
Paul

---

<div class="post-metadata">

**Author:** ![John\_Xia](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@John\_Xia](https://openmc.discourse.group/u/John_Xia)\
**Post date:** [December 1, 2014, 4:25am UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/5 "2014-12-01T04:25:51Z")

</div>

The only change was to add \<energy\_grid\> to settings. The git SHA1 is:

```auto
c2d9f6d1a5dcced954d460952fabfa8795dcf71b

```

```auto
Hope that's helpful!

```

```auto
Thanks,
John

```

---

<div class="post-metadata">

**Author:** ![John\_Xia](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@John\_Xia](https://openmc.discourse.group/u/John_Xia)\
**Post date:** [December 2, 2014, 5:22pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/6 "2014-12-02T17:22:06Z")

</div>

I just tried the version from the dev branch (git sha: 0f1270e0059d4b1135ca006d7bde6e07694f1036), and it threw the same error - though at a different line:

At line 2247 of file /home/john/openmc/src/tally.F90  
Fortran runtime error: Index ‘-1’ of dimension 1 of array ‘tally\_maps%items’ below lower bound of 1

It also runs into this error on both dev and master with the following config files:  
[https://gist.github.com/jdangerx/b5a0f07be79ec8a6e92c](https://gist.github.com/jdangerx/b5a0f07be79ec8a6e92c)

John

---

<div class="post-metadata">

**Author:** ![Anthony\_Scopatz](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Anthony\_Scopatz](https://openmc.discourse.group/u/Anthony_Scopatz)\
**Post date:** [December 2, 2014, 7:02pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/7 "2014-12-02T19:02:52Z")

</div>

Hello Paul,

I am also seeing a very similar error on my machine (below). My only thought is that this could be an issue triggered by the NNDC data set. John and I are both using this data. Which data set were you using? Could you try re-running with NNDC? Thanks!

Be Well  
Anthony

$ openmc

.d88888b. 888b d888 .d8888b.  
d88P" "Y88b 8888b d8888 d88P Y88b  
888 888 88888b.d88888 888 888  
888 888 88888b. .d88b. 88888b. 888Y88888P888 888  
888 888 888 "88b d8P Y8b 888 “88b 888 Y888P 888 888  
888 888 888 888 88888888 888 888 888 Y8P 888 888 888  
Y88b. .d88P 888 d88P Y8b. 888 888 888 " 888 Y88b d88P  
“Y88888P” 88888P” "Y8888 888 888 888 888 “Y8888P”  
**888** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
888  
888

Copyright: 2011-2014 Massachusetts Institute of Technology  
License: [http://mit-crpg.github.io/openmc/license.html](http://mit-crpg.github.io/openmc/license.html)  
Version: 0.6.1  
Git SHA1: 0f1270e0059d4b1135ca006d7bde6e07694f1036  
Date/Time: 2014-12-02 12:58:01

---

<div class="post-metadata">

**Author:** ![John\_Xia](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@John\_Xia](https://openmc.discourse.group/u/John_Xia)\
**Post date:** [December 16, 2014, 2:29am UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/8 "2014-12-16T02:29:05Z")

</div>

I’ve done a little more digging on this, so here’s an info dump. I ask of you:

1. What debugger do you recommend/use?

2. Any idea why we are getting this error?

I’m still on the dev branch, and the segfault is still occuring here:

At line 2247 of file /home/john/openmc/src/tally.F90  
Fortran runtime error: Index ‘-1’ of dimension 1 of array ‘tally\_maps%items’ below lower bound of 1

I have done the following:

- acquired MCNP - we were wondering if the culprit was the NNDC data, so I got MCNP and used their cross-sections instead. I still get the same segfault, at the same place in the code. So I guess it wasn’t a difference in the data.

- run OpenMC with gdb:

I set a breakpoint at line 2247 of tally.F90 on the develop branch, where the error occurs. The erroring line is:  
! Check how many elements there are for this item  
n = size(tally\_maps(filter\_type) % items(filter\_value) % elements)

When I tell gdb to p tally\_maps or anything related (tally\_maps(filter\_type), etc) it gives me Unhandled dwarf expression opcode 0x97.

Here are the local variables at this point.

@(gdb) info locals

bin = 0  
i\_tally\_check = 1076252894  
n = 2

Additionally, I checked filter\_value, since that’s what we’re indexing tally\_maps%items by.

@(gdb) p filter\_value  
$3 = 1

That’s not -1! Here is filter\_type, the other thing we’re indexing by, for good measure.

@(gdb) p filter\_type  
$4 = 2

I noticed a few lines earlier (2241) that we check to see if tally\_maps(filter\_type) % items(filter\_value) % elements is allocated at all:

! If there are no scoring bins for this item, then return immediately  
if (.not. allocated(tally\_maps(filter\_type) % items(filter\_value) % elements)) then  
bin = NO\_BIN\_FOUND  
return  
end if

(NO\_BIN\_FOUND is -1.) So I checked if this check was working. I expected this command to output .TRUE. :

@(gdb) p allocated(tally\_maps(filter\_type) % items(filter\_value) % elements)  
No symbol “allocated” in current context.

That’s strange - I think this might be an issue with GDB where it doesn’t know what “allocated” means. I searched around on Google and SO and have gotten some vague recommendations for Archer GDB which has “better Fortran support” but nobody with this specific issue.

Thanks!

John

---

<div class="post-metadata">

**Author:** ![Anthony\_Scopatz](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Anthony\_Scopatz](https://openmc.discourse.group/u/Anthony_Scopatz)\
**Post date:** [December 16, 2014, 2:45am UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/9 "2014-12-16T02:45:32Z")

</div>

Hi All,

It is worth noting that I have been able to reproduce this on my machine too.

Be Well  
Anthony

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [December 16, 2014, 5:30pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/10 "2014-12-16T17:30:01Z")

</div>

I’m still unable to reproduce this for some reason. I am also using NNDC data, and I’ve tried with both develop and master. What compiler are you guys using, and how are you building? Also, are you both on Macs?

Thanks,  
Paul

---

<div class="post-metadata">

**Author:** ![Anthony\_Scopatz](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Anthony\_Scopatz](https://openmc.discourse.group/u/Anthony_Scopatz)\
**Post date:** [December 16, 2014, 5:34pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/11 "2014-12-16T17:34:27Z")

</div>

Hi Paul,

I think that we are both on Linux. I am on Ubuntu and John is on Arch. I am using gfortran v4.8.2. I am using make to build. Should I be using CMake?

Be Well  
Anthony

---

<div class="post-metadata">

**Author:** ![John\_Xia](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@John\_Xia](https://openmc.discourse.group/u/John_Xia)\
**Post date:** [December 16, 2014, 5:44pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/12 "2014-12-16T17:44:27Z")

</div>

Hi Paul,

I am on Arch, with gfortran v4.9.2. To build, I’m running:

cd src/build

cmake -DCMAKE\_INSTALL\_PREFIX=$HOME/.local --DEBUG …

make install

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [December 16, 2014, 5:49pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/13 "2014-12-16T17:49:43Z")

</div>

If you take a peek at the Makefile, you’ll see that it just calls CMake under the hood anyway, so that shouldn’t be an issue. I just tried running having compiled with both 4.8.2 and 4.9.2 and can’t reproduce the error. I’m running out of ideas here…

Paul

---

<div class="post-metadata">

**Author:** ![Anthony\_Scopatz](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Anthony\_Scopatz](https://openmc.discourse.group/u/Anthony_Scopatz)\
**Post date:** [December 16, 2014, 6:06pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/14 "2014-12-16T18:06:14Z")

</div>

Weird. I am doing a fully clean build, install, and redownloading the NNDC data. John, can you do the same?

---

<div class="post-metadata">

**Author:** ![Anthony\_Scopatz](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Anthony\_Scopatz](https://openmc.discourse.group/u/Anthony_Scopatz)\
**Post date:** [December 16, 2014, 6:36pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/15 "2014-12-16T18:36:08Z")

</div>

Hi Paul,

Are you converting your NNDC data to the binary format, or are you leaving them in ASCII. I am leaving them in ASCII.

Be Well  
Anthony

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [December 16, 2014, 6:44pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/16 "2014-12-16T18:44:27Z")

</div>

Mine are converted to binary – I suppose that could be a source of differences. I’ll try with ASCII when I have a chance.

Paul

---

<div class="post-metadata">

**Author:** ![Anthony\_Scopatz](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Anthony\_Scopatz](https://openmc.discourse.group/u/Anthony_Scopatz)\
**Post date:** [December 16, 2014, 7:25pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/17 "2014-12-16T19:25:50Z")

</div>

So I just tried this with binary NNCD and it has the same error.

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [December 16, 2014, 8:25pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/18 "2014-12-16T20:25:31Z")

</div>

I’ll try redownloading the NNDC data to see if I get the error that way.

Paul

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [December 16, 2014, 8:35pm UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/19 "2014-12-16T20:35:26Z")

</div>

I’ll try redownloading the NNDC data to see if I get the error that way.

Paul

---

<div class="post-metadata">

**Author:** ![John\_Xia](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@John\_Xia](https://openmc.discourse.group/u/John_Xia)\
**Post date:** [December 18, 2014, 6:44am UTC](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114/20 "2014-12-18T06:44:01Z")

</div>

For what it’s worth the bug is still around on my system after a full rebuild and redownload of the NNDC data, converted to binary.

I was grousing about this to a friend and he wondered if there were some other library being linked in that was different between our systems, do you think that might be worth considering?

[Next page](https://openmc.discourse.group/t/exit-code-9-when-running-simulation/114.md?page=2)
