MCNP

From NEClusterWiki
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. You can then load the MCNP5 or MCNPX module with module load MCNP5 or module load MCNPX respectively.

THIS INFORMATION HAS BEEN LARGELY SUPERSEDED BY THE TORQUE/Maui AND Beginners Guide to MCNP with Torque PAGES! IT IS KEPT FOR LEGACY REASONS.

Please DELETE runtape files if you don't need them!

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 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 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:~/$ mpirun -np # -machinefile machine_file mcnp5.mpi TASKS n name=mcnp_input

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 than or equal to 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:~/$ mpirun -np # -host <host1,host2,...,hostn> mcnp5.mpi TASKS n name=mcnp_input

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:~/$ mpirun -np 4 -host node2,node3,node4,node5 mcnp5.mpi TASKS n name=mcnp_input

The same caveat regarding the master node applies.

Running MCNPX

MCNPX is run in a similar way to MCNP5. There are two differences:

1) The executable is merely called mcnpx.

2) There is no OpenMP support, but there is MPI support.

Common Problems

See the common problems section of TORQUE/Maui.