MCNPX 2.6.X on Linux

MCNPX 2.6.X on Linux (Gentoo or Debian) using Intel 9.1 or GNU GCC

*****************
INTRODUCTION ****
*****************

This short write up would be a basic procedure guide to the installation of
various MCNPX beta versions on Linux machines. The first part describes the
compiling-installation process of MCNPX using the Intel Compiler version 9.1
both for the Fortran90 and for the C/C++ case (and without using MPICH
libraries). The second one will cover the same but using the GNU GCC compiler
both for Fortran90 and for C/C++ (always without MPICH libraries). Lastly
the third one will use always the GNU GCC compiler but with the use of the
MPICH libraries to make use of the multiprocessing capability of the code.

Marco Calviani
marco.calviani@lnl.infn.it

=====================================================

Note before the beginning: it is suggested to run the building process in
a different directory with respect to the installation directory in order
to avoid mixing source files with the compiled ones.

# ———————————————————-
# MCNPX 2.6a/b/c built with Intel Compiler 9.1 (ifort+icc)
# ———————————————————-

The tested version of the Intel Compiler was:
9.1.036 for the Fortran90 compiler (ifort, was ifc)
9.1.042 for the C/C++ compiler (icc)

1) Make sure that the compiler is correctly installed, and that the listed
variables has been defined (if for example the Intel icc compiler installation
directory is /opt/intel/compiler91 and Intel ifort compiler installation
directory is /opt/intel/fortran91):

IA32ROOT=/opt/intel/compiler91
INTEL_FLEXLM_LICENSE=/opt/intel/compiler91/licenses
LDPATH=/opt/intel/compiler91/lib
MANPATH=/opt/intel/compiler91/man
PATH=/opt/intel/compiler91/bin
ROOTPATH=/opt/intel/compiler91/bin

IA32ROOT=/opt/intel/fortran91
INTEL_FLEXLM_LICENSE=/opt/intel/fortran91/licenses
LDPATH=/opt/intel/fortran91/lib
MANPATH=/opt/intel/fortran91/man
PATH=/opt/intel/fortran91/bin
ROOTPATH=/opt/intel/fortran91/bin

(in the case you have Gentoo Linux you can simply emerge the corresponding
ebuild dev-lang/icc-9.1.042 and dev-lang/ifc-9.1.036 after having previously
downloaded the tar.gz files at put the in /usr/portage/distfiles)

2) Decompress appropriately the tar file containing the source file of MCNPX
and run the configure script with the following options (suppose you want to
install MCNPX in /usr/local/mcnpx the Fortran executable is ifort and the
C/C++ executable icc)

$ ./configure –prefix=/usr/local/mcnpx –with-FC=ifort \
              –with-CC=icc \
              –host=i686-pc-linux \
              –with-FFLAGS=”-DUNIX=1 -DLINUX=1″ \
              –with-CFLAGS=”-DUNIX=1 -DLINUX=1″

$ make
(….)

Before running the make tests process it is necessary to modify the
src/test/Makefile.h, in particular one has to search for the following
variables TARCH, TSYS, TFC and TCC and make them looks like this:

TARCH = intel
TSYS = linux
TFC = ifc
TCC = icc

(that is existing tabulated results)

It is important to put for the TFC variable ifc instead of ifort otherwise
comparison results will not be found.

$ make tests

$ make install

3) Definition of environmental variables: before running MCNPX it is necessary
to define environmental variables PATH and DATAPATH, and this can be done
either defining the variable in each user’s .bashrc or using a global
definition like the /etc/bash/bashrc (or /etc/bash.bashrc depending on the
Linux distribution). In the case of Gentoo Linux it is possible to create a
99mcnpx file in /etc/env.d directory with the variable definition directly
inside the file (perform an — env-update — followed by a — source
/etc/profile — command).

PATH=/usr/local/mcnpx/bin
DATAPATH=/usr/local/mcnpx/DATA

In the DATA directory you should put the MCNP/MCNPX data libraries. Please
note that a link to the libraries contained in the lib/ directory, phtlib,
bertin and barpol.dat to the DATA directory is required.

$ cd /usr/local/mcnpx/DATA
$ ln -s ../lib/phtlib .
$ ln -s ../lib/bertin .
$ ln -s ../lib/barpol.dat .

Appropriately create the mcnpx/DATA/xsdir if not present, copying the xsdir1
file to xsdir

4) If the environmental variables have been correctly set, the system should
respond correctly to the mcnpx program call.

=====================================================

# ————————————————————————————
# MCNPX 2.6a/b/c built with GNU compiler (GCC-4.1.1) (gcc+gfortran(f90)), without MPI
# ————————————————————————————

Since the source build of MCNPX needs a Fortran 90 compatible compiler if one
wants to use the GNU GCC opensource compiler it is mandatory to switch to GCC4
where the gfortran (Fortran 90) executable is present. As suggested in the
title GCC version 4.1.1 have been tested.

1) As f90 is explicitly required by MCNPX during the building process, make a
symbolic link between gfortran and f90:

Example:
$ cd /usr/i686-pc-linux-gnu/gcc-bin/4.1.1
$ ln -s gfortran f90

2) Decompress appropriately the tar file containing the source file of MCNPX:
in order for the GNU compiler to work it is necessary to modify some source .F
files and in particular this files:

src/bertin/getexm.F
src/htape3x/getexm.F
src/mcnpx/mcnpf/getexm.F
src/phtlib/mcnpf/getexm.F
src/xsex3/getexm.F

in which this line:

integer(ki4), external :: iargc    !/*ge5f        8*/

has to be transformed in:

integer(ki4) :: iargc              !/*ge5f        8*/

3) Run the configure script with the following options (supposing you want to
install MCNPX in /usr/local/mcnpx):

$ ./configure –prefix=/usr/local/mcnpx \
              –with-FC=f90 \
              –with-CC=gcc \
              –host=i686-pc-linux \
              –with-FFLAGS=”-DUNIX=1 -DLINUX=1 -DG95=1″ \
              –with-CFLAGS=”-DUNIX=1 -DLINUX=1″

$ make
(….)

Before running the make tests process, it is necessary to modify the
src/test/Makefile.h, in particular one has to search for the following variables
TARCH, TSYS, TFC and TCC and make them looks like this:

TARCH = intel
TSYS = linux
TFC = ifc
TCC = icc

(that is existing tabulated results)

$ make tests

$ make install

4) Definition of environmental variables: before running MCNPX it is necessary
to define environmental variables PATH and DATAPATH, and this can be done
either defining the variable in each user’s .bashrc or using a global definition
like the /etc/bash/bashrc (or /etc/bash.bashrc depending on the Linux
distribution). In the case of Gentoo Linux it is possible to create a 99mcnpx
file in /etc/env.d directory with the variable definition directly inside the
file (perform an — env-update — command followed by a — source /etc/profile
— command).

PATH=/usr/local/mcnpx/bin
DATAPATH=/usr/local/mcnpx/DATA

In the DATA directory you should put the MCNP/MCNPX data libraries. Please note
that a link to the libraries contained in the lib/ directory, phtlib, bertin and
barpol.dat to the DATA directory is required.

$ cd /usr/local/mcnpx/DATA
$ ln -s ../lib/phtlib .
$ ln -s ../lib/bertin .
$ ln -s ../lib/barpol.dat .

Appropriately create the mcnpx/DATA/xsdir if not present, copying the xsdir1
file to xsdir.

5) If the environmental variables have been correctly set, the system should
respond correctly to the mcnpx program call.

=======================================================

# ———————————————————————————
# MCNPX 2.6a/b/c built with GNU compiler (GCC-4.1.1) (gcc+gfortran(f90)), with MPI
# ———————————————————————————

A simple modification of the above configuration lead to the possibility exploit the
parallel ability of MCNPX via MPI (Message-Passing Interface). I’ve tested the
installation with MPICH2 libraries version 1.0.3 that can be found at this site
http://www-unix.mcs.anl.gov/mpi/mpich2 .

Please note that, as underlined in the MPICH2 web page, “MPICH2 replaces MPICH1 and
should be used instead of MPICH1 except for the case of clusters with heterogeneous
data representations (e.g., different lengths for integers or different byte
ordering). MPICH2 does not yet support those systems (support is planned for 2007)”.

This libraries are useful if you have a multiple core and/or biprocessor system and
you want to make fully use of the available resources.

Here are listed the differences that one has to follow with respect to the version
without MPI.

0) (so before point 1) ) First of all install the MPICH2 libraries: you should find
that the installation of MPICH2 created, among others, two executables in /usr/bin:

/usr/bin/mpif90  (compiles and links MPI programs written in Fortran 90)
/usr/bin/mpicc   (compiles and links MPI programs written in C)

that will be used to compile MCNPX. It is important to use this command, particularly
when linking programs, as they provide the necessary libraries. Please keep note of
where the MPICH libraries are installed since this information will be required in
the configure step.
Example:

/usr/lib64/libmpich.a
/usr/lib64/libmpich.so
/usr/lib64/libmpichcxx.a
/usr/lib64/libmpich.so.0.0
/usr/lib64/libmpichf90.a
/usr/lib64/libmpich.so.0

1) and 2) the same as the version without MPICH

3) Run the configure script with the following options (suppose you want to install
MCNPX in /usr/local/mcnpx):

$ ./configure –prefix=/usr/local/mcnpx \
              –with-FC=mpif90 \
              –with-CC=mpicc \
              –host=i686-pc-linux \
              –with-FFLAGS=”-DUNIX=1 -DLINUX=1 -DG95=1″ \
              –with-CFLAGS=”-DUNIX=1 -DLINUX=1″ \
              –with-MPILIB=”-L/usr/lib64 -lmpich”

$ make
(….)

Before running the make tests process, it is necessary to modify the
src/test/Makefile.h, in particular one has to search for the following variables
TARCH, TSYS, TFC and TCC and make them looks like this:

TARCH = intel
TSYS = linux
TFC = ifc
TCC = icc

(that is existing tabulated results)

$ make tests

$ make install

4) and 5) the same as the version without MPICH

6) In order to use the MPI capability, it is necessary to perform the following
steps:

a) create a mpd.conf file in which a variable MPD_SECRET_WORD is defined
b) start the MPI daemon with
   $ mpd &
c) starts an MCNPX (or in general a parallel) job with (the -np option specify
the number of processes to use):
   $ mpiexec -np 4 mcnpx inp=test n=test. > /dev/null
d) obtain a list of running jobs with
   $ mpdlistjobs
e) .. and kill them, if required with
   $ mpdkilljob (jobnum)
f) take down all MPD daemons with
   $ mpdallexit

=============================================================

*************
FINAL REMARKS
*************

Some tracking differences have been observed with both the compilers. Most of
them are not relevant because they involve scored values changes well within
the errors or others are just positioning differences inside the files. Other
changes are being investigated.

=============================================================

*****************
POSSIBLE PROBLEMS that can be encountered during MCNPX installation:
*****************

—- not using -DUNIX=1 -DLINUX=1 with gcc:

mcnpc/mcnpc.c:204: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:266: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:289: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:354: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:379: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:401: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:424: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:454: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:544: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:568: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:598: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:623: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:671: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:733: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:773: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:804: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:831: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:857: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:888: error: expected identifier or ‘(‘ before ‘{‘ token
mcnpc/mcnpc.c:915: error: expected identifier or ‘(‘ before ‘{‘ token

or other problems of syntax with mcnpc.c.

— not using the mpif90 and mpicc when compiling with MPILIB flag:

usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../lib64/libmpich.so: undefined
reference to `aio_read64′
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../lib64/libmpich.so:
undefined reference to `aio_error64′
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../lib64/libmpich.so:
undefined reference to `aio_suspend64′
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../lib64/libmpich.so:
undefined reference to `aio_write64′
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../lib64/libmpich.so:
undefined reference to `aio_return64′

— not using -DG95 with gcc (gfortran):

f90 -lgfortranbegin -lgfortran -lm -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../.. -lm -lgcc_s  -o mcnpx f77main/f77main.o mcnpf.a mcnpf/GLOBAL1_zc.o mcnpf/GLOBAL2_vv.o mcnpf/GLOBAL3_st.o mcnpf/GLOBAL4_cg.o mcnpf/GLOBAL4_mb.o mcnpf/GLOBAL4_lk.o mcnpf/GLOBAL5_cm.o mcnpf/GLOBAL6_ht.o mcnpf/IMCN_jc.o mcnpf/GKSSIM_gs.o mcnpf/LAMBDA_lm.o mcnpf/LAMBDA_lt.o mcnpf/MCPLOT_mp.o mcnpf/PLOT_pc.o mcnpf/GLOBAL6_mc.o mcnpf/cemmod.o mcnpc.a utils.a gvaviv.a lcs.a lcs/btbd.o lcs/cabd.o lcs/e0bd.o lcs/elbd.o lcs/h1bd.o lcs/hebd.o lcs/inbd.o lcs/isbd.o lcs/phbd.o lcs/pqbd.o dedx.a dedx/atmdat.o meshtal.a histp.a spabi.a spabi/bdincl1.o spabi/bdincl2.o fluka89.a fluka89/bdnopt.o fluka89/blkdt1.o fluka89/blkdt2.o fluka89/blkdt3.o fluka89/blkdt4.o fluka89/blkdt5.o fluka89/blkdt6.o fluka89/blkdt7.o fluka89/f2bd.o hexs.a hexs/nebd.o hexs/xsbd.o -L/usr/lib64 -lX11
mcnpf.a(ttyint.o): In function `ttyint_’:
ttyint.F:(.text+0x18): undefined reference to `signal_’
collect2: ld returned 1 exit status

— not modifying the src/Test/Makefile.h file:

cp: ../../../v26c/src/Test/Test.intel.irix.ifort./usr/bin/gcc/
outp??: No such file or directory
make[2]: *** [out-links] Error 1

or similar.

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

2 Responses

  1. gate io giriş 말해보세요:

    At the beginning, I was still puzzled. Since I read your article, I have been very impressed. It has provided a lot of innovative ideas for my thesis related to gate.io. Thank u. But I still have some doubts, can you help me? Thanks.

  2. Registro 말해보세요:

    Your point of view caught my eye and was very interesting. Thanks. I have a question for you.

페이스북/트위트/구글 계정으로 댓글 가능합니다.