Difference between revisions of "MCNP"

From NEClusterWiki
Jump to navigation Jump to search
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== How to run MCNP5/MCNPX ==
 
== How to run MCNP5/MCNPX ==
  
The first step is to ensure that you have permission to use MCNP5/X from [http://rsicc.ornl.gov/Default.aspx 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!
+
The first step is to ensure that you have permission to use MCNP5/X from [http://rsicc.ornl.gov/Default.aspx 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 <code>module load MCNP5</code> or <code>module load MCNPX</code> 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 ===
 
=== Running MCNP5 ===
Line 9: Line 13:
 
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:
 
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:
  
<code>'''user@node:~/$''' mcnp5.both name=''mcnp_input''</code>
+
<code>'''user@node:~/$''' mcnp5 name=''mcnp_input''</code>
  
 
This will run your input using one thread on the node you're running on.
 
This will run your input using one thread on the node you're running on.
Line 17: Line 21:
 
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 [http://necluster.engr.utk.edu/ganglia/ 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!:
 
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 [http://necluster.engr.utk.edu/ganglia/ 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!:
  
<code>'''user@node:~/$''' mcnp5.both TASKS ''n'' name=''mcnp_input''</code>
+
<code>'''user@node:~/$''' mcnp5 TASKS ''n'' name=''mcnp_input''</code>
  
 
For this, ''n'' is the number of threads you want to run.
 
For this, ''n'' is the number of threads you want to run.
Line 26: Line 30:
  
 
* '''Machine File'''
 
* '''Machine File'''
<code> '''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</code>
+
<code> '''user@node:~/$''' mpirun -np ''#'' -machinefile ''machine_file'' mcnp5.mpi TASKS ''n'' name=''mcnp_input''</code>
  
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''.
+
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:
 
A typical ''machine_file'' would be something like this:
Line 41: Line 45:
 
'''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.
 
'''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:
+
* '''Command Line''':
  
<code>'''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</code>
+
<code>'''user@node:~/$''' mpirun -np ''#'' -host ''<host1,host2,...,hostn>'' mcnp5.mpi TASKS ''n'' name=''mcnp_input''</code>
  
 
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):
 
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):
  
<code>'''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</code>
+
<code>'''user@node:~/$''' mpirun -np 4 -host node2,node3,node4,node5 mcnp5.mpi TASKS ''n'' name=''mcnp_input''</code>
  
 
The same caveat regarding the master node applies.
 
The same caveat regarding the master node applies.
Line 53: Line 57:
 
=== Running MCNPX ===
 
=== Running MCNPX ===
  
COMING SOON!
+
MCNPX is run in a similar way to MCNP5.  There are two differences:
 +
 
 +
1) The executable is merely called <code>mcnpx</code>.
 +
 
 +
2) There is no OpenMP support, but there is MPI support.
  
 
== Common Problems ==
 
== Common Problems ==
  
COMING LESS SOON!
+
See the common problems section of [[TORQUE/Maui]].

Latest revision as of 17:09, 16 October 2018

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.