-
Notifications
You must be signed in to change notification settings - Fork 0
Step by step guide
- Introduction
- Step 1: Compilers
- Step 2: MPI library
- Step 3: BLAS and LAPACK libraries
- Step 4: FFTW library
- Step 5: ScaLAPACK library
- Step 6: Compiler toolkit
- Step 7: Building software with compiler toolkit
- Step 8: Updating the compiler: automatic dependency resolution
## Introduction
This step-by-step guide will guide you through putting together a self-contained compiler toolkit, and using that toolkit to build a software package. It is assumed you have already configured EasyBuild.
For more information on what a compiler toolkit is and why EasyBuild uses them, see the Compiler toolkits wiki page.
In this guide, we will put together the goalf
toolkit, which consists of:
- the GNU Compiler Collection (GCC), a set of open-source C/C++/Fortran compilers named gcc, g++ and gfortran
- the OpenMPI library, which provides support for building MPI (Message Passing Interface) applications
- the ATLAS and LAPACK libraries, which provide highly tuned linear algebra routines
- the FFTW library, which provides fast discrete Fourier transform routines
- the ScaLAPACK library, which provides MPI-enabled LAPACK routines
Note that the name we give to the toolkit is arbitrary; you might as well name it myToolkit
.
The build times specified for each of the toolkit components below are estimates, based on the build times observed on a laptop with a quad-core Intel Core i5 2.4GHz processor and 8GB of physical memory, running Fedora 16 Linux (64-bit) with a 3.x kernel.
## Step 1: CompilersThe first step is to build the set of compilers that will be used in our toolkit. They are used further on for building the libraries that make up our toolkit and for building the software packages we wish to deploy on our system.
We aim to make this entire process as self-contained as possible, by reducing the dependencies on existing (external) system libraries. This is important for compilers that already are part of a toolchain, as they most often rely on the presence of certain tools in the system.
GCC supports a so-called bootstrap build, in which the compiler is built in 3 stages: once using the system compiler, once with the compiler obtained from stage 1, and finally using the compiler from stage 2.
This bootstrap build procedure is implemented by the GCC easyblock that comes with EasyBuild, so you do not need to worry about it.
Just provide EasyBuild with a specification file that describes which GCC version you wish to build, and you will obtain a self-contained GCC build.
Create a specification file GCC-4.6.3.eb
with the following contents:
name="GCC"
version='4.6.3'
homepage='http://gcc.gnu.org/'
description="The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, and Ada,
as well as libraries for these languages (libstdc++, libgcj,...)."
toolkit={'name':'dummy','version':'dummy'}
sources=['%s-%s.tar.gz'%(name.lower(),version),
'gmp-5.0.4.tar.bz2',
'mpfr-3.0.1.tar.gz',
'mpc-0.9.tar.gz',
]
sourceURLs=['http://ftpmirror.gnu.org/%(name)s/%(name)s-%(version)s' % {'name':name.lower(), 'version':version}, # GCC auto-resolving HTTP mirror
'http://ftpmirror.gnu.org/gmp', # idem for GMP
'http://ftpmirror.gnu.org/mpfr', # idem for MPFR
'http://www.multiprecision.org/mpc/download', # MPC official
]
languages=['c','c++','fortran','lto']
moduleclass='compiler'
# building GCC sometimes fails if make parallelism is too high, so let's limit it
maxparallel=4
Most of entries in the specification files should be clear (if not, see Specification files).
Some remarks:
-
The dummy toolkit specifies that we use the system compiler to kickstart the GCC bootstrap build. However, after completing the build procedure, the resulting GCC will be self-contained because it did not use the system compiler in the final build stage.
-
EasyBuild will try and download the requires source files given the paths in sourceURLs, unless they are available in the source path already.
-
The
languages
config entry is specific to the GCC easyblock, and specifies for which programming languages support should be enabled. -
Because of problems with parallel building for some of the libraries on which GCC depends, we limit parallel building to a maximum of 4 simultaneous jobs. EasyBuild auto-detects how many cores you have in your system, and will build in parallel accordingly.
Instruct EasyBuild to build GCC by providing it the specification file:
<path>/easybuild/easybuild.sh GCC-4.6.3.eb
Building GCC v4.6.3 with a bootstrap build as performed by the GCC easyblock takes about 35 minutes (on the aforementioned system).
Once the installation is complete, you should see a message like COMPLETED: Installation ended successfully
appearing, both on the command line output and in the log file created by EasyBuild.
To verify that EasyBuild has produced a working GCC build, load the GCC/4.6.3
module provided and check the version:
module load GCC/4.6.3
gcc --version | grep ^gcc
This should yield something like gcc (GCC) 4.6.3
as output.
The next step is to build OpenMPI, that will serve as MPI library in the goalf
compiler toolkit.
Again, just create a specification file and build/install OpenMPI using EasyBuild.
Create a specification file OpenMPI-1.4.5-no-OFED.eb
with the following contents:
name='OpenMPI'
version='1.4.5'
versionsuffix="-no-OFED" # no InfiniBand support, so add version suffix
homepage='http://www.open-mpi.org/'
description="The Open MPI Project is an open source MPI-2 implementation."
toolkit={'name':'GCC','version':'4.6.3'}
sources=['%s-%s.tar.gz'%(name.lower(),version)]
sourceURLs=['http://www.open-mpi.org/software/ompi/v%s/downloads' % '.'.join(version.split('.')[0:2])]
configopts='--with-threads=posix --enable-shared '
moduleclass='lib'
sanityCheckPaths = {
'files':["bin/%s" % binfile for binfile in ["ompi_info", "opal_wrapper", "orterun"]] +
["lib/lib%s.so" % libfile for libfile in ["mca_common_sm", "mpi_cxx", "mpi_f77" ,"mpi_f90",
"mpi", "openmpi_malloc", "open-pal", "open-rte"]],
'dirs':["include/openmpi/ompi/mpi/cxx"]
}
Some specific remarks with regard to this specification file:
-
We specify that EasyBuild should add a version suffix
-no-OFED
for this build, because we are not enabling InfiniBand (IB) support (using the OFED stack) in this OpenMPI build procedure. We disabled this because enabling IB support requires several other system libraries to be installed, and we prefer not to bother you with those for the sake of this demo. -
We are using the GCC built in the previous step as a toolkit for building OpenMPI, as specified by the
toolkit
config entry. -
OpenMPI follows the more-or-less standard
configure
/make
/make install
build procedure, and thus there's no real need for a dedicated OpenMPI easyblock. Because there is not easyblock available by default, EasyBuild will fall back to the default Application easyblock that implements thisconfigure
/make
/make install
build procedure. -
Non-default configure options are specified using the
configopts
config entry, and we specify which files and directories are expected to be installed using thesanityCheckPaths
config entry.
Instruct EasyBuild to build OpenMPI by providing it the specification file:
<path>/easybuild/easybuild.sh OpenMPI-1.4.5-no-OFED.eb
Building and installing OpenMPI should only take about 7 minutes.
## Step 3: BLAS and LAPACK libraries(more soon)
## Step 4: FFTW library(more soon)
## Step 5: ScaLAPACK library(more soon)
## Step 6: Compiler toolkit(more soon)
## Step 7: Building software with compiler toolkit(more soon)
## Step 8: Updating the compiler: automatic dependency resolution(more soon)