Serpent2 Installation on OS X El Capitan with MacPorts

Compiler issues (Intel compiler, mpicc, etc.), data libraries and everything needed to get Serpent running is discussed here
Post Reply
Rodrigo de Oliveira
Posts: 1
Joined: Tue Feb 23, 2016 7:59 pm
Security question 1: No
Security question 2: 92

Serpent2 Installation on OS X El Capitan with MacPorts

Post by Rodrigo de Oliveira » Tue Feb 23, 2016 8:56 pm

By Jaakko's request, I decided to report the successful installation of Serpen2 on OS X El Capitan and write an installation procedure for the community.

On some comments about it. Do not attempt to compile Serpent2 dependencies manually (libGD and openmpi). Its time consuming, frustrating, hard to maintain and is most likely problematic to reproduce. There is also no benefit to it.

MacPorts contains all the dependencies, so the installation can actually be done without breaking a sweat. I considered other package managers and though I personally like Homebrew, I just went for the one that would give me the least amount of problems.

Also note that I used CFLAGS += -I/opt/local/include and LDFLAGS += -L/opt/local/lib flags in the makefile as per Andrei Fokau's suggestion. The reason that I did not set the environmental variables despite of Jaakko's previous comments on it (see: http://ttuki.vtt.fi/serpent/viewtopic.p ... 50e70#p138) is because the MacPorts is designed to work in separate of the OS X libraries. Setting the variables would allow other programs to use the MacPorts library, but then it could cause other system's problems in case you need to uninstall MacPorts. This takes a bit more space but I found this separation important to keep the system perfectly independent of my changes.

The complete and painless install procedure as performed follows, and I suggest no improvisations on it.


install MacPorts from https://www.macports.org/install.php

open terminal and install GCC 5.3.0 (this is the latest stable version as of this post)

Code: Select all

sudo port install gcc5
change the compiler used to the GCC just installed

Code: Select all

port select --list gcc
sudo port select --set gcc mp-gcc5
note: compilers from MacPorts have mp- before name

check that PATH points to MacPorts working directory /opt/local/bin

Code: Select all

echo $PATH
install Serpent dependencies, which will be compiled with the latest GCC since we set it up before

Code: Select all

sudo port install gd2
sudo port install openmpi-gcc5
change the openmpi select to point to the right compiler

Code: Select all

port select --list mpi
sudo port select --set mpi openmpi-gcc5-fortran
check link of GCC with mpi

Code: Select all

mpicc --version
It should say that mpi is pointing to GCC 5.3.0 as we installed before

on terminal, navigate to /opt
make the Serpent directories and go into it

Code: Select all

mkdir Serpent/bin && cd Serpent/bin
on Finder move the Serpent2 files into the folder just created and extract Serpent2 files and updates in /opt/Serpent/bin (make sure the files are in this bin directory, not one on top of it)
open makefile on a text editor and comment CC that points to GCC. Uncomment the sections of parallel mpi

note: CC=mpicc is ok as-is since installing MacPorts added /opt/local/bin to PATH

add MacPorts libraries to makefile by copying and pasting these 2 lines into it

Code: Select all

CFLAGS  += -I/opt/local/include
LDFLAGS += -L/opt/local/lib
save makefile and compile Serpent2 on terminal (Finally! I was starting to get anxious!)

Code: Select all

make clean
make
now all the files including the ones just created (sss2 and *.o) should be in /opt/Serpent/bin. Add it to the END of PATH permanently for the sake of convenience.

on terminal navigate to home directory ~/ (or just open a new terminal that should start right there) and open the hidden file .profile

Code: Select all

open -e .profile
at the end of the file add the serpent bin directory. It should look like:

Code: Select all

export PATH=$PATH:/opt/Serpent/bin
also at .profile add the variable for serpent data

Code: Select all

export SERPENT_DATA=/opt/Serpent/xsdata
save the .profile and manually copy the cross-section data library to /opt/Serpent/xsdata

update the library path on the first line of the *.xsdir files and execute the xsdirconvert.pl scrip to generate the *.xsdata

Restart the system so that the changes to .profile take place

Serpent can now be executed painlessly from the terminal in any form: sss2, mpirun sss2 or sss2 -mpi

Enjoy XD

Post Reply