Home Classes FAQ Forum Getting The Code Manual Reference Collection User Symposia Contact the MCNP Team

Frequently Asked Questions

General
Cloud / Linux / macOS / Windows
Parallel Processing

General

How should I reference the MCNP code in reports and papers?

MCNP6.2, Either or both of:

  • C. J. Werner, et al., "MCNP6.2 Release Notes", Los Alamos National Laboratory, report LA-UR-18-20808 (2018).
  • C. J. Werner (editor), "MCNP Users Manual - Code Version 6.2", Los Alamos National Laboratory, report LA-UR-17-29981 (2017).

MCNP6.1.1:

  • J. T. Goorley, "MCNP6.1.1-Beta Release Notes", LA-UR-14-24680 (2014).

MCNP6.1:

  • J. T. Goorley, et al., "Initial MCNP6 Release Overview", Nuclear Technology, 180, pp 298-315 (Dec 2012).

MCNP5:

  • X-5 Monte Carlo Team, i "MCNP - Version 5, Vol. I: Overview and Theory", LA-UR-03-1987 (2003).

MCNPX:

  • D.B. Pelowitz, Ed., "MCNPX Users Manual Version 2.7.0" LA-CP-11-00438 (2011).

Can you send me a copy of the MCNP code?

No. See How to Get the Code.

Can the MCNP code run on GPUs (or graphics cards, or video processors)?

No. MCNP6 can run in parallel using the different cpu-cores in any computer (threading), or using different nodes in a cluster (MPI), or both. See the discussion of parallel processing in this FAQ page.

While Monte Carlo codes can certainly be adapted to vector-style parallelism using GPUs, many structural and algorithmic changes are required. The effort required to adapt a very large, mature Monte Carlo code such as MCNP to GPUs is huge, and there are no current plans to do so.

Cloud

An Internet-based "Cloud" installation the MCNP code is provided by Oak Ridge National Laboratory. All questions regarding this service should be sent to the RSICC email.

Linux

Considerations on building MCNP5—MCNP6.2

The MCNP6 build system uses the GNU version of make, so you need to be careful about any environment variables that affect building and testing.

The MCNP developers always compile the code with multiple threads: make build GNUJ=8 which would be equivalent to setting the environment variable MAKEFLAGS as: export MAKEFLAGS=' -j 8 ' && make build

For running REGRESSION tests or other tests, parallel execution using multiple make instances does not work, since some of the tests must be run in a certain order.

  • To run the tests sequentially: make test
  • To run the tests threaded: make test NTRD=8
Do not use the -j 8 flag for make, and do not set it via the MAKEFLAGS environment variable.

macOS

MCNP on Mac OS X: Environment Variables

If you use the Terminal application on Macs, note that it reads only the .bash_profile from your home directory when it starts, and it does NOT read the .bashrc file.

The MCNP6 install scripts put the settings for the environment variables PATH and DATAPATH into your .bashrc file, but NOT into your .bash_profile.

To fix this, do the following: cd && cat .bashrc >> .bash_profile Exit from the Terminal app, and then restart it. Type env to see if the PATH and DATAPATH settings include the MCNP locations.

If you use the X11 app and an xterm window, the .bashrc file is read when the app starts. You can check the environment variables by typing env.

Also be aware that at some places (e.g., at LANL), the sysadmins put special .bashrc and .bash_profile files into your home directory, or possibly even alter the system defaults, to enforce certain security policies. If that is true at your location, then you may need to check the files or talk to the sysadmins about what to do.

MCNP on Mac OS X 10.8 (Mountain Lion)

To fully utilize the MCNP plotting, testing, and build procedures, users should make sure that basic unix utility commands and X11 plot support are available. On older versions of Mac OS X, X11 support was provided via an SDK and the necessary unix commands (eg, make) were available by default.

Apple changed very much for OS X 10.8 (Mountain Lion). Before installing MCNP on Mountain Lion, these steps are necessary, and only take minutes:

  1. Go to the App Store, then download and install the Xcode package (it's free).
  2. Open (double-click) Xcode, then select "Preferences" from the menu items. Under Preferences, select "Downloads", and then "Command line tools". This installs some basic unix command line utilities, such as "make".
  3. Install Xquartz, the replacement for X11 (it's free): From the Finder, go to "Applications", then "Utilities". Open (double-click) the X11 app. A window will appear with instructions for downloading and installing the Xquartz package.

MCNP on Mac OS X 10.9 (Mavericks)

This is for people who build MCNP6 from the source code on Macs. Others can disregard.

I recently upgraded a MacBook Pro from OS X 10.8 to OS X 10.9 (Mavericks), and ran into trouble building MCNP6 from source coding. Apple has continued to change a number of things, without providing any useful guidance. Here is what I had to do to be able to build MCNP6:

  1. Reinstall XQuartz. Even if you had previously installed it, it needs to be updated for OS X 10.9. Click on /Applications/Utilities/X11.app, then the link for XQuartz and follow the download/install directions.
  2. Download and install Xcode 5 from the App store. Even if you previously installed Xcode and it appears to be present, you need to install Xcode 5 for use with OS X 10.9.
  3. Install the Xcode command line tools. Even if you previously did this, you need to do it again for Xcode 5. The old way to do this does not appear to be available (from Xcode preferences, downloads), but a command-line method works. From the Terminal app or an X11 xterm window: xcode-select --install (Need sudo privileges to do it this way)
  4. Fix the C++ stdlib usage: Edit the file MCNP6/Source/Darwin.gcf, Search for CCFLAGS, Append this to the end of the CCFLAGS settings: -stdlib=libstdc++
  5. Remove any old ".o" files and rebuild from scratch: cd MCNP6 && make realclean && make build GNUJ=4 && make test NTRD=4

Microsoft Windows

Where is the mcnp_env.bat file? I can't find it.

The mcnp_env.bat file is created when you install MCNP6. It is placed into the home folder of the user who performed the installation. If you can't find it, do this from a command window: echo %HOMEDRIVE%%HOMEPATH%

If someone else installed MCNP6 for you (e.g., a system administrator or computer support person), you should ask them to copy the mcnp_env.bat file from their folder %HOMEDRIVE%%HOMEPATH% to yours.

How can I run MCNP6 from a Windows .bat script, without using the MCNP Command window?

You need to use a text editor to create a file, called myjob.bat below, that includes commands to set the proper Windows environment variables for MCNP6 and Windows, and then runs MCNP6.

For example, assuming that C:\my_mcnp\ is where you installed MCNP, put the following in the myjob.bat file. Then you can run the job by double-clicking the myjob.bat file, which contains:

      @ PATH C:\my_mcnp\MCNP_CODE\bin;%PATH%
      @ set DATAPATH=C:\my_mcnp\MCNP_DATA
      @ set DISPLAY=localhost:0
      start/wait  mcnp6  i=myinp.txt   tasks 4
      pause

The start/wait and pause are optional. The start/wait allows the batch file to pick up where it left off if you interrupt a run, then return to it (after checking status or plotting). The pause keeps the window open after MCNP6 completes, so that you can see any messages. (Thanks to Mark Hogue for the suggestions.)

I installed Xming and started it, but I still get the message "xlib: unable to connect to server display"

During the MCNP6 installation process for Windows computers, a file called mcnp_env.bat is created in your %HOME% folder. This file is invoked when the MCNP command window is started (i.e., by double-clicking on the MCNP command window desktop shortcut). It sets several environment variables that are used by Windows and MCNP: %PATH%, %DATAPATH%, and %DISPLAY%.

By default, the mcnp_env.bat file sets the %DISPLAY% variable to ":0.0", which works for most X11 servers. However, Xming needs a different setting: "localhost:0".

This is easy to fix. Use Notepad or Wordpad to open the file mcnp_env.bat in your %HOME% folder and

  1. Change the last line in the file from "@ set DISPLAY=:0.0" to "@ set DISPLAY=localhost:0". Note: Do NOT include any trailing blanks.
  2. Do not change anything else (unless you know what you're doing).
  3. Save the file. Then exit Notepad or Wordpad. Also exit from any MCNP command window that was previously open.

After that, MCNP plotting with Xming should work correctly.

How can I fix the error "This application was unable to start correctly (0xc000007b)"?

Typical situation: I've tried multiple installs of the MCNP6 package from RSICC on two machines with Windows 7 and one in XP. In all cases with Windows 7 the installation looks good, but it will not run. I get this error when trying to run the test problems: The fact that I succeeded on the XP machine suggests that this is not user error. Any suggestions?

We have seen this problem a number of times -- it's due to Windows, not MCNP. Here are 2 possible solutions:

  1. Earlier versions of Windows 7 did NOT include this DLL file: msvcr100.dll A later WIndows upgrade did include that DLL file. So, one possible solution to your problem is: upgrade your Windows 7 to the latest version (i.e., apply patches or updates).
  2. If you don't want to do that (or aren't allowed), then here is a workaround:
    1. In the folder MCNP_CODE\MCNP6\bin\windows there are files named x64_msvcr100.dll and x86_msvcr100.dll. If you have a 64-bit Windows OS (probably), then choose the x64_ version; if a 32-bit Windows OS, then choose the x86_ version.
    2. Copy that file to the folder MCNP_CODE\bin and then rename it (in the new folder) as msvcr100.dll
    3. Then, also copy that new file to the folder MCNP_CODE\MCNP6\bin
That should fix the problem. (It did for us on an un-updated Windows 7 system.) Run the installation tests to check.

CAUTION: This msvcr100.dll file will be used by anything that needs it, if you run from the MCNP command window, since it puts MCNP_CODE\bin first on its execution search path. If you someday bring your Windows 7 up to date, then you will want to delete the file MCNP_CODE\bin\msvcr100.dll

You may want to discuss either of the above fixes with your computer sysadmin.

Parallel Processing

This section refers to the July 2013 release of MCNP6.1 from RSICC and newer versions of the MCNP code.

MCNP6 supports 2 types of parallel processing that can be used separately or together:

  • Threading: OpenMP threading on a single multicore computer (eg, laptop, office computer) or on a single node of a server or cluster (eg, 1 node in a cluster, with 1 or more processors or cores sharing memory)
  • MPI: Message-passing between nodes on a cluster using some external MPI environment and libraries.

Details on Threading

All recent computers use multi-core processors. By default, MCNP6 will only use one of the processor cores (to avoid consuming all of the system resources). If you want to use more than one CPU core, just add tasks n to the MCNP execution line command, where "n" is the number of CPU cores that you want MCNP6 to use.

For example, mcnp6 i=myinp.txt tasks 4 would direct MCNP6 to use 4 cpu-cores when following histories. The value "n" should be chosen considering your specific processor: For my laptop, with an Intel i7 with 2 cpu-cores and 2 hyperthreads per core, one might use "tasks 4".

The default version of MCNP6 from the installation includes the aforementioned threading capability. It is not necessary to copy other versions, rename executables, etc. Just run the code with the appropriate "tasks n" supplied.

Details on MPI and High-performance Computing Clusters

If you want to run MCNP6 using multiple nodes on a cluster, then you must first install an MPI package on your cluster.

For Windows clusters, the precompiled MCNP6 executable is based on the MPICH2 package obtained from Argonne National Laboratory. That was found to be reasonably easy to install in precompiled binaries. The MCNP6 executable for 64-bit Windows is found at MCNP_CODE\MCNP6\bin\windows\mcnp6_windows_x86_64_omp_mp and should be copied (and renamed) to MCNP_CODE\bin\mcnp6_mpi.exe. You can then run an MPI job as mpirun -np 8 mcnp6_mpi i=myinp.txt.

For macOS and Linux, you will need to install a version of MPI. The MCNP development team uses OpenMPI from The OpenMPI website. Then, you must compile the MCNP6 executable yourself, so that the proper linkage to MPI libraries is made. For example, one might use the command cd ~/MyMCNP/MCNP_CODE/MCNP6 && make CONFIG='intel plot omp openmpi' install.

When MCNP6 is built for MPI, an executable called mcnp6.mpi is created in the MCNP_CODE/MCNP6/bin directory. You should also copy this to the MCNP_CODE/bin directory. Then an MPI job can be run as mpirun -np 8 mcnp6.mpi i=myinp.txt

Details on Combining Threading & MPI

If MPI is installed, and an mcnp6.mpi executable was built, then threading and MPI can both be used. For an 8-node cluster with 16 cpu-cores per node, you could run with 128 cpu-cores by

    mpirun -np 8 -bynode mcnp6.mpi i=myinp.txt tasks 16

Other Comments on High-performance Computing Clusters

Unfortunately, most clusters are configured differently, with job queuing systems such as Moab or LSF, different "module" packages, different versions of MPI, etc. Installing MPI & having the cluster software configured consistently is not for beginners. You may need to consult with your cluster administrator, or enlist the aid of some talented young student...