Menu

Compile

Bradley S. Meyer

Introduction

This tutorial demonstrates how to compile the example codes of wn_sparse_solve. It assumes you are in a Linux or Unix environment. If you are using a different operating system, please adjust the following instructions as appropriate . (Microsoft windows users may wish to use Cygwin, a linux/unix-like environment for Windows. To install Cygwin, please see the following blog post.)

Check for Dependencies

The wn_sparse_solve codes depend on libxml2, the XML C parser and toolkit of Gnome, gsl, the GNU Scientific Library, SPARSKIT, a basic tool-kit for sparse matrix calculations, and wn_matrix.

To find out if you have libxml2 properly installed on your system, type at the command line:

xml2-config

If libxml2 is properly installed, the command will return a Usage description and a list of Options. Note that you can check which version of libxml2 is installed by typing

xml2-config --version

If libxml2 is not properly installed, the result of running xml2-config will be the line

xml2-config: command not found

In this case, you will need to install libxml2 by following the appropriate instructions from this blog post before compiling libnucnet codes.

To find out if you have gsl properly installed on your system, type at the command line:

gsl-config

If gsl is properly installed, the command will return a Usage description and a list of Options. Note that you can check which version of gsl is installed by typing

gsl-config --version

If gsl is not properly installed, the result of running gsl-config will be the line

gsl-config: command not found

In this case, you will need to install gsl by following the appropriate instructions from this blog post before compiling libnucnet codes.

To find out if you have xsltproc properly installed on your system, type at the command line:

xslt-config

If it is not installed, install it as you did libxml2.

To install wn_matrix, see the download and compile tutorials for the latest release of wn_matrix. To install Sparskit2, follow the instructions immediately below.

Download SPARSKIT2

After downloading wn_sparse_solve, go to the directory examples/ of the distribution. For example, if your current installation of wn_sparse_solve is in the directory ~/modules/wn_sparse_solve/0.8/src/, thpe

cd ~/modules/wn_sparse_solve/0.8/examples

Now type

make sparskit

This will download SPARSKIT2_F95 into the directory ~/modules/.

Compile the Examples

After downloading wn_sparse_solve (and installing SPARSKIT2 if necessary), go to the directory examples/ of the distribution. For example, if your current installation of wn_sparse_solve is in the directory ~/modules/wn_sparse_solve/0.8/src/, type

cd ~/modules/wn_sparse_solve/0.8/examples

Now compile the examples by typing:

make all

This will generate all the executable files. You can also make them separately. For example, type

make basic_solve_sparse

to generate the executable basic_solve_sparse.

Please note that we have the compiler flags set for gcc and for memory checking with Valgrind. You may wish to edit the Makefile. Look for this part of the Makefile:

 #///////////////////////////////////////////////////////////////////////////////
# Edit the following lines to give the path to the wn_matrix codes, to choose
# the compiler (gcc or g++), the flag for compiling fortran with g++,
# and to choose whether you will check executable with Valgrind:
#///////////////////////////////////////////////////////////////////////////////

GC=gcc
FC=gfortran

MATRIXDIR = ../../../wn_matrix/0.20/src/

SP_VERSION=1.1.0
SPARSKIT_PRE=SPARSKIT2_F95
SPARSKITDIR = ../../../$(SPARSKIT_PRE)

VALGRIND=yes
PROFILE=no

#///////////////////////////////////////////////////////////////////////////////
# End of lines to be edited.
#///////////////////////////////////////////////////////////////////////////////

You should only need to change the lines in this section. For example, you might want to change the compiler from gcc to g++ by setting GC=g++ or to optimize by setting VALGRIND=no. (Note that Valgrind works better without optimization.)

Clean the Examples

To remove the object files created during compilation, type

make clean

To remove all the object and executable files, type

make cleanall


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.