Skip to content

How To Install CalculiX 2.6 multi-thread on Ubuntu

calculix thumbnail

In order to improve the operational capabilities of the tools used in analysis we found the task of enabling CalculiX solvers to work with more than one core.

There is no point on buying an expensive computer with 6 cores when only are going to use one.

The documentation for how to do this is already on the Internet for all of you who knows how to get it, the issue is in all these incomprehensible or wrong sources which can waste our time. Older versions, different programs or libraries, different platforms or just poor documentation is normally found.

Fixing all this here is Tutorial of how to do it easily:

Note: To run the default executable downloaded from CalculiX web page in current versions of Ubuntu, just to do a symbolic link like this: “sudo ln-s / usr/lib/x86_64-linux-gnulibgfortran.so.3 / usr/lib/libgfortran.so.2” . Changing “/ usr/lib/x86_64-linux-gnu” for the address where libgfortran.so3 is installed.

1. Start by installing all the necessary tools for our work, as we compile the packages we ensure that we have in our system the following programs.   

  • gcc-4.4
  • gfortran (same G95)   
  • make   
  • libcnf-dev   
  • libextutils-f77   
  • f2c   
  • liblapack-dev   
  • libblas-dev   
  • liblapack3gf ( and all its dependencies)

2. Then Download this files:

Unpack all these files in /usr/local folder making overwriting the content of ARPACK folder with PATCH.

3. Now compile SPOOLES, we should make some changes before we use MAKE, the changes are:

  • In /usr/local/spooles.2.2/Tree/src/makeGlobalLib change:       
drawTree.c to draw.c
  • In /usr/local/spooles.2.2/Make.inc change:                
CC = /usr/lang-4.0/bin/cc to CC = /usr/bin/cc
  • On spooles.2.2 folder make:

            $ sudo make lib
            $ cd MT/src/
            $ sudo make

3. Now compile ARPACK, we should make some changes before we use MAKE, the changes are:

  • In /usr/local/ARPACK/ARmake.inc change:
home = $(HOME)/ARPACK to home = /usr/local/ARPACK
PLAT = SUN4 to PLAT = linux
FC = f77 to FC = gfortran
FFLAGS = -O -cg89 to FFLAGS = -O2
MAKE = /bin/make to MAKE = /usr/bin/make
  • In /usr/local/ARPACK/UTIL/second.f change:

            EXTERNAL ETIME to *EXTERNAL ETIME

  • On ARPAK folder make:
$ sudo make lib

3. Finally compiling CalculiX:.

  • In /usr/local/CalculiX/ccx_2.6/src lets make sure that Makefile ist exatly like this:
    CFLAGS = -Wall -O3 -I ../../../spooles.2.2 -DARCH=”Linux” -DSPOOLES -DARPACK -DMATRIXSTORAGE -DUSE_MT=1
    FFLAGS = -Wall -O3
    CC=cc
    FC=gfortran
    .c.o :
    $(CC) $(CFLAGS) -c $<
    .f.o :
    $(FC) $(FFLAGS) -c $<
    include Makefile.inc
    SCCXMAIN = ccx_2.6.c
    OCCXF = $(SCCXF:.f=.o)
    OCCXC = $(SCCXC:.c=.o)
    OCCXMAIN = $(SCCXMAIN:.c=.o)
    DIR=../../../spooles.2.2
    LIBS = \
    $(DIR)/MT/src/spoolesMT.a \
    $(DIR)/spooles.a \
    ../../../ARPACK/libarpack_linux.a \
    -lpthread -lm
    ccx_2.6_MT: $(OCCXMAIN) ccx_2.6_MT.a $(LIBS)
    ./date.pl; $(CC) $(CFLAGS) -c ccx_2.6.c; $(FC) -Wall -O3 -o $@ $(OCCXMAIN) ccx_2.6_MT.a $(LIBS)
    ccx_2.6_MT.a: $(OCCXF) $(OCCXC)
    ar vr $@ $?
  • Finishing with:                
$ sudo make

4. By this point CalculiX compiling will create an executable named “ccx_2.6_MT” witch is the one we have been looking for, now just put it on your work folder /usr/local/bin for example right next to the “cgx_2.3” executable downloades from CalculiX web page, remember to add run permisions. ( an advise: change the names to just “ccx” and “cgx” for easy use)

5. Usage:

$ export OMP_NUM_THREADS=#       
$ ccx -i jobname

*Change # for the number of threads you want to use, 1 by default.

Leave a Reply