This page is dedicated to the compilation of MCNP5 on Debian with the GNU Fortran 90 compiler (gfortran), LAM-MPI and geometry plotting utility.
Extract MCNP5 into /usr/local/lib/MCNP5, and the data into /usr/local/lib/MCNP5/data, so that,
# ls -l /usr/local/lib/MCNP5/ total 32 drwxr-xr-x 2 root root 4096 2007-05-24 11:29 bin/ drwxr-xr-x 2 root root 4096 2006-04-10 17:13 data/ drwxr-xr-x 2 root root 4096 2005-12-01 15:03 Documents/ drwxr-xr-x 2 root root 4096 2005-12-01 15:04 Manual/ drwxr-xr-x 2 root root 4096 2006-01-19 08:19 Pstudy/ drwxr-xr-x 3 root root 4096 2005-12-01 15:03 Sample_problems/ drwxr-xr-x 8 root root 4096 2007-05-24 11:33 Source/ drwxr-xr-x 4 root root 4096 2005-12-01 15:03 Testing/
You may have to fix ownerchips and permissions.
# chown -R 0:0 /usr/local/lib/MCNP5 # chmod -R u+rw,go+r /usr/local/lib/MCNP5
may do the trick.
Edit ~/.bashrc and add,
# MCNP5 MCNP5=/usr/local/lib/MCNP5 export DATAPATH=$MCNP5/data export PATH=$PATH:$MCNP5/bin
Source .bashrc,
$ . .bashrc
or start a new terminal. Every MCNP5 user must edit ~/.bashrc the same way.
Install the package dpkg-dev,
# apt-get install dpkg-dev
Go to the MCNP5 source directory /usr/local/lib/MCNP5/Source.
Edit config/Linux.gcf so that the line,
ARCH := $(shell uname -p)
is replaced by,
ARCH := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
Install the package gfortran. MCNP needs explicitly f90. Make an alternative,
# update-alternatives --install /usr/bin/f90 f90 /usr/bin/gfortran 20
which you can remove with,
# update-alternatives --remove f90 /usr/bin/gfortran
if you uninstall gfortran later on (to avoid having dangling links).
If you are using Debian 4.0 (Etch), you may not be able to compile with optimization. The gfortran version 4.1 seems to break the code. If you upgrade to Debian 5.0 (Lenny), which carries version 4.3, optimization level 2 is possible, resulting in a 40% faster executable, comparable to the speeds obtained with comercial compilers (Intel and PGI Fortran).
Install packages lam-runtime and lam4-dev. Go to the MCNP5 source directory /usr/local/lib/MCNP5/Source. Compile MCNP5 with,
# make clean build CONFIG="cheap lam-mpi other" FC=f90 FOPT="-O2" MPI_ROOT=/usr/lib/lam
The FOPT="-O2" switch (optimization level 2) is only possible with gfortran version 4.2, or higher.
Move the executable,
# mv -vf src/mcnp5.mpi ../bin
Install the package libx11-dev. Go to the MCNP5 source directory /usr/local/lib/MCNP5/Source. Compile MCNP5 with,
# make clean build CONFIG="cheap plot seq other" FC=f90 FOPT="-O2"
The FOPT="-O2" switch (optimization level 2) is only possible with gfortran version 4.2, or higher.
Move the executable,
# mv -vf src/mcnp5 ../bin
Install packages rsh-client and rsh-server in every cluster node, including the master node. Edit /etc/hosts.equiv in each of them and grant password-less access to the master node for every user, for example,
master mpiuser
mpiuser should be able to log-in passwordlessly into every cluster node,
mpiuser@master:~$ rsh slave1 mpiuser@slave1:~$
To run the MPI version create in the running directory file lamhosts. List the host names of the cluster that will run the job, for example,
master slave1 slave2 slave3
If you have a single SMP or multi-core computer,
localhost
will do (make sure passwordless 'rsh localhost' works.)
Boot LAM with,
mpiuser@master:~$ lamboot -v
and run MCNP5 with,
mpiuser@master:~$ mpirun.lam -np 8 mcnp5.mpi name=mysimu
where -np is the number of processes to run in parallel.
You can clean or halt LAM,
mpiuser@master:~$ lamclean -v mpiuser@master:~$ lamhalt -v
To use the geometry plotting utility,
mpiuser@master:~$ mcnp5 ip name=simu
This document was generated using AFT v5.098