Compiling Fenics Simulations

On the cluster, there are a couple of details necessary to know how to make your code work properly. Below are some of these details.

Setting Environment Variables

All the FEniCS source is in:

/bio/tools/system/pkg/fenics/*

The FEniCS tools are built in:

/bio/tools/4.2.1/fenics

In order to link your simulations correctly one needs to set the following environment variables:

export PATH="/bio/tools/4.2.1/fenics/bin:$PATH"
export LD_LIBRARY_PATH="/bio/tools/4.2.1/fenics/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/bio/tools/4.2.1/fenics/lib/pkgconfig:$PKG_CONFIG_PATH"
export PYTHONPATH="/bio/tools/4.2.1/fenics/lib/python/site-packages:$PYTHONPATH"

Alternatively, one can just source the dolfin.conf file

source /bio/tools/system/pkg/fenics/dolfin/dolfin.conf

Dolfin Makefile

Dofin uses the pkg-config software to set the compiler and linking flags. This means that the dolfin.pc file needs to be in your PKG_CONFIG_PATH environment variable. This allows the typical dolfin makefile to be very simple.

CFLAGS  = `pkg-config --cflags dolfin`
LIBS    = `pkg-config --libs dolfin`
CXX     = `pkg-config --variable=compiler dolfin`

DEST    = dolfin-stokes-demo
OBJECTS = main.o

all: $(DEST)

install:

clean:
        -rm -f *.o core *.core $(OBJECTS) $(DEST)

$(DEST): $(OBJECTS)
         $(CXX) -o $@ $(OBJECTS) $(CFLAGS) $(LIBS)

.cpp.o:
        $(CXX) $(CFLAGS) -c $<
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.