Recompile OpenFoam from double precison to single precision

copyright (C) 2011-2017 iesensor.com

Recompile OpenFoam from double precison to single precision

————Why?
For, I just want to play with GPGPU
Some of the ATI cards does not support double precision for openCL;
use speedIT openfoam plugin on cuda platform。

Follow the instructions for compile OF
http://www.openfoam.com/download/source.php

————–preparation
make sure you have install the Double precison OF sucessfully,
There are quite a lot dependencies, you must meet, or the compiling will stop with error.

you DO need to download src pack.

check gcc version, must be >=4.4,

export WM_COMPILER=<pathofgcc44>/gcc

or edit the wmake/rulels/<platform>/c  and c++

% cd $HOME/OpenFOAM/OpenFOAM-1.7.1/wmake/rules/linux64Gcc
% vim c
cc = gcc44 -m64
% vim c++
CC = g++44 -m64

—————edit env. var.
gedit $WM_PROJECT_DIR /etc/bashrc
# change from default DP to SP
the file look like

# WM_ARCH_OPTION = 32 | 64
: ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION
# this is the OS , 32bit Linux or 64bit linux, leave it because you just recompile it

# WM_PRECISION_OPTION = DP | SP
: ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION

————check the env
$ source ~/.bashrc
$ env|grep WM_*

WM_OPTIONS=linux64GccSPOpt
WM_PRECISION_OPTION=SP    # just check this line,
WM_ARCH_OPTION=64      #if you OS is 64bit,

—————–test compilation
$foamSystemCheck

—————-compile
Go to the top-level source directory $WM_PROJECT_DIR
and execute the top-level build script ./Allwmake.

——————test
$icoFoam
Thirdparty

————done.

Tested on OF1.7.1  Linux64 or Linux32

May 2011

BSD documentation licensed Free for non-commercial usage only
Author: Qingfeng XIA copyright (C) 2011-2013 http://www.iesensor.com
please keep the original link in your reference. http://www.iesensor.com/blog/2011/05/20/recompile-openfoam-from-double-precison-to-single-precision/
This entry was posted in Uncategorized. Bookmark the permalink.