Search This Blog

Saturday, February 23, 2013

How to install OpenFOAM on CentOS


  1. Package Installation
    • sudo yum groupinstall -y 'Development Tools'
    • sudo yum install  -y openmpi openmpi-devel openmpi-devel.x86_64 qt-devel
    • sudo yum install  -y  cc gcc-c++ bison ncurses-devel tix.x86_64 glibc-devel flex zlib-devel libXt-devel binutils-devel
    • sudo yum install -y gcc44 gcc44-c++ zlib-devel
    • yum upgrade -y 
  2. Check your OS architecture to forcefully load Open-MPI into the environment
    • uname -m
    1. If 32 bit:
      • mpi-selector --system --set openmpi-1.4-gcc-i386
    2. If 64 bit:
      • mpi-selector --system --set openmpi-1.4-gcc-x86_64
    • In my case, "openmpi-1.4-gcc-x86_64" is not listed by executing "mpi-selector --list". To register openmpi-1.4-gcc-x86_64:
      • mpi-selector  --register openmpi-1.4-gcc-x86_64  --source-dir  /usr/lib64/openmpi/1.4-gcc/etc
  3. Log out and log in again.  If you did step 1 and 2 as root, at this time log in as a regular user.
  4. Download and unpack
    • cd ~
    • mkdir OpenFOAM
    • cd OpenFOAM
    • wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.1.1.tgz?use_mirror=mesh" -O OpenFOAM-2.1.1.tgz
    • wget "http://downloads.sourceforge.net/foam/ThirdParty-2.1.1.tgz?use_mirror=mesh" -O ThirdParty-2.1.1.tgz
    • tar xzf OpenFOAM-2.1.1.tgz 
    • tar xzf ThirdParty-2.1.1.tgz
  5. For X86 #here you can change 4 to the number of cores you've got
    • source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc WM_NCOMPPROCS=4 WM_COMPILER=Gcc44 WM_MPLIB=SYSTEMOPENMPI
    • export WM_CC='gcc44'
    • export WM_CXX='g++44'
    • echo "source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc $FOAM_SETTINGS" >> $HOME/.bashrc
    • echo "export WM_CC='gcc44'; export WM_CXX='g++44'" >> $HOME/.bashrc
    • sed -i -e 's=gcc=$(WM_CC)=' OpenFOAM-2.1.1/wmake/rules/linux64Gcc44/c
    • sed -i -e 's=g++=$(WM_CXX)=' OpenFOAM-2.1.1/wmake/rules/linux64Gcc44/c++
  6. Now let's build OpenFOAM. It usually takes 30 minutes to 6 hours.
    •  #Go into OpenFOAM's main source folder
      • cd OpenFOAM-2.1.1
    • # This next command will take a while... somewhere between 30 minutes to 3-6 hours.
      • ./Allwmake > make.log 2>&1
    • #Run it a second time for getting a summary of the installation
      • ./Allwmake > make.log 2>&1


Preliminary
OpenFOAM uses libmpi.so.1.  If this is not found in   /usr/lib64/openmpi/1.4-gcc/lib, then do followings

  • Log in as root
  • cd /usr/lib64/openmpi/1.4-gcc/lib
  • ln  -s  libmpi.so  libmpi.so.1

This is to make a symbolic link from libmpi.so to libmpi.so.1, which should be done all the nodes if OpenFoam will be run in parallel. 

Related links:

http://wiki.hpc.ufl.edu/doc/From_mpi-selector_to_environment_modules
http://na-inet.jp/na/pccluster/centos_x86_64-en.html

No comments:

Labels

Blog Archive

Bacteria

Loading...