MCNP

From NEClusterWiki
Revision as of 03:04, 4 November 2011 by WikiSysop (talk | contribs)
Jump to navigation Jump to search

How to run MCNP5/MCNPX

The first step is to ensure that you have permission to use MCNP5/X from RSICC. Once you have permission, let me know so I can add you to the mcnp5 group on the cluster. This will set up your shell environment automatically so you can run MCNP5/X with ease!

Running MCNP5

Basic Run

Running MCNP5 in it's most basic form involves calling the MCNP5 executable with several arguments. As an example, you can run MCNP5 with the input file called mcnp_input as such:

user@node:~/$ mcnp5.both name=mcnp_input

This will run your input using one thread on the node you're running on.

OpenMP Run

MCNP5 supports OpenMP so that you can run using multiple threads on your selected node. Since none of the cluster nodes have only one core it is very advantageous to use this option to obtain an almost linear increase in speed as threads are added. Remember to check Ganglia to see how many cores the node you want to run on has. Running MCNP5 in this fashion is almost as easy as running just one thread, so there's no reason not to do it!:

user@node:~/$ mcnp5.both TASKS n name=mcnp_input

For this, n is the number of threads you want to run.

MPI Run

For the ultimate in speed you can use OpenMPI to run your case on multiple nodes at the same time. You can combine MPI with OpenMP to run multiple threads on multiple nodes. Running with MPI is slightly more involved since you have to remember the use absolute paths to make sure everything is picked up. Also, you need to specify which nodes to run on. There are two ways to do this: 1) Using a machine file, 2) From the command line.

  • Machine File

user@node:~/$ /opt/openmpi-1.4.3/bin/mpirun -np # -machinefile machine_file /opt/MCNP5-1.60/bin/linux/mcnp5.both TASKS n name=mcnp_input balance

Where # is the number of nodes you want to run on and machine_file is a text file containing a list of nodes that you want to run out. Note that # has to be less to or equal than the number of nodes you list in your machine_file.

A typical machine_file would be something like this:

node2
node3
node4
node5

For this example # would be 4.

Note: MCNP requires one node to be the master node. This node will be the first node that you list in the machine file. Thus, if you run MCNP5 like the above example, MCNP will tell you that it is only running on 3 nodes. The number of threads on the master node will always be 1, regardless of what you set n to in the TASKS argument. If, in our example we say TASKS 4, MCNP will use 13 threads total: 1 on node2 (master node), and 4 on node3, node4, and node5.

  • Command Line:

user@node:~/$ /opt/openmpi-1.4.3/bin/mpirun -np # -host <host1,host2,...,hostn> /opt/MCNP5-1.60/bin/linux/mcnp5.both TASKS n name=mcnp_input balance

In this method, you just list your hosts in a comma separated block. Continuing with the example from the previous section (running on 4 nodes):

user@node:~/$ /opt/openmpi-1.4.3/bin/mpirun -np 4 -host node2,node3,node4,node5 /opt/MCNP5-1.60/bin/linux/mcnp5.both TASKS n name=mcnp_input balance

The same caveat regarding the master node applies.

Running MCNPX

COMING SOON!

Common Problems

COMING LESS SOON!