Difference between revisions of "Installation/Mac OS/OpenFOAM 2.3.x"

From OpenFOAMWiki
(Kicked off this page)
 
(Introduction and Notes)
Line 7: Line 7:
 
; None at the moment on this wiki page
 
; None at the moment on this wiki page
 
: Anyone reading this is welcome to updating this section. You can take inspiration on the other existing pages that are referenced on the parent page: [[Installation/Mac OS]]
 
: Anyone reading this is welcome to updating this section. You can take inspiration on the other existing pages that are referenced on the parent page: [[Installation/Mac OS]]
 
  
 
[[Category:Installing OpenFOAM on Mac OS]]
 
[[Category:Installing OpenFOAM on Mac OS]]
 +
 +
Here are notes on installing OpenFOAM 2.3.x on OSX 10.9 with macports for dependencies.
 +
 +
=== Install Dependencies ===
 +
 +
sudo port install gcc48
 +
sudo port select --set gcc mp-gcc48
 +
sudo port install openmpi-gcc48
 +
sudo port select --set mpi openmpi-gcc48-fortran
 +
sudo port install boost +openmpi
 +
sudo port install cgal
 +
sudo port install ccache
 +
sudo port install flex
 +
sudo port install scotch -mpich +gcc48 +openmpi
 +
sudo port install metis +gcc48
 +
 +
And for completeness:
 +
 +
sudo port select --set llvm mp-llvm-3.5
 +
sudo port select --set python python27
 +
sudo port select --set db db48
 +
 +
Note, before installing and upon running "port select --summary", you should get something that looks like this:
 +
 +
$ port select --summary
 +
Name    Selected              Options
 +
====    ========              =======
 +
db      db48                  db48 none
 +
gcc    mp-gcc48              mp-gcc48 none
 +
llvm    mp-llvm-3.5            mp-llvm-3.5 none
 +
mpi    openmpi-gcc48-fortran  openmpi-gcc48-fortran none
 +
python  python27              python25-apple python26-apple python27 python27-apple none
 +
 +
 +
=== Create a volume and mount it ===
 +
 +
hdiutil create -size 8.3g -type SPARSEBUNDLE -fs HFSX -volname OpenFOAM -fsargs -s OpenFOAM.sparsebundle
 +
mkdir -p OpenFOAM
 +
hdiutil attach -mountpoint $HOME/OpenFOAM OpenFOAM.sparsebundle
 +
cd OpenFOAM
 +
git clone https://github.com/OpenFOAM/OpenFOAM-2.3.x
 +
cd OpenFOAM-2.3.x
 +
 +
 +
=== Get the patch ===
 +
 +
http://sourceforge.net/p/openfoam-extend/svn/HEAD/tree/trunk/Breeder_2.3/distroPatches/MacPatch/OpenFOAM-2.3.x-Mac.patch
 +
 +
Download the above and place it in the OpenFOAM-2.3.x directory.
 +
 +
=== Apply the patch ===
 +
 +
patch -p1<OpenFOAM-2.3.x-Mac.patch
 +
 +
=== Update the OpenFOAM-2.3.x/etc/bashrc ===
 +
 +
Append these lines to the /path/to/OpenFOAM-2.3.x/etc/bashrc (change the "/path/to" to whatever your fully qualified path would be):
 +
 +
echo "WM_CC=mpicc" >> /path/to/OpenFOAM-2.3.x/etc/bashrc
 +
echo "WM_CXX=mpicxx" >> /path/to/OpenFOAM-2.3.x/etc/bashrc
 +
 +
Note: using the mpi wrappers (mpicc, mpicxx) revolves errors locating mpi header files, i.e. "mpi.h" - no sideffects were observed in the logs.
 +
 +
=== Install ===
 +
 +
source etc/bashrc && WM_NCOMPPROCS=$(sysctl -n hw.ncpu)
 +
./Allwmake > log.Allwmake 2>&1
 +
 +
Note, you may notice this message:
 +
 +
"Proper OpenMPI not installed. Either do 'port install openmpi-mp' or 'port install openmpi-default'"
 +
 +
Ignore it. Using mpicc and mpicxx wrappers will take care of includes and linking.
 +
 +
It might also complain about the ulimit, ignore this as well. (If you are on 10.9 and you try to change this, you will get an error anyway). Do the following instead, if needed:
 +
 +
Add this line:
 +
limit maxfiles 16384 32768
 +
to:
 +
/etc/launchd.conf
 +
(create it if it does not exist, and restart to take effect)
 +
 +
=== Update your bash profile ===
 +
 +
Update your ~/.bash_profile to load the OpenFOAM bashrc file by adding:
 +
 +
if [ -f $HOME/OpenFOAM/OpenFOAM-2.3.x/etc/bashrc ]; then
 +
  . $HOME/OpenFOAM/OpenFOAM-2.3.x/etc/bashrc
 +
fi
 +
 +
to your ~/.bash_profile (assuming you have mounted the volume, this will load the openfoam bashrc file and setup your environment).
 +
 +
All steps were taken from bash history file after compilation and testing.

Revision as of 05:57, 16 February 2015

1 Known Guides For Building OpenFOAM 2.3.x on Mac OS X

The known guides for building OpenFOAM 2.3.x on Mac OS X are as follows:

2 Introduction and Notes

None at the moment on this wiki page
Anyone reading this is welcome to updating this section. You can take inspiration on the other existing pages that are referenced on the parent page: Installation/Mac OS

Here are notes on installing OpenFOAM 2.3.x on OSX 10.9 with macports for dependencies.

2.1 Install Dependencies

sudo port install gcc48 
sudo port select --set gcc mp-gcc48 
sudo port install openmpi-gcc48
sudo port select --set mpi openmpi-gcc48-fortran
sudo port install boost +openmpi
sudo port install cgal
sudo port install ccache
sudo port install flex
sudo port install scotch -mpich +gcc48 +openmpi
sudo port install metis +gcc48

And for completeness:

sudo port select --set llvm mp-llvm-3.5
sudo port select --set python python27 
sudo port select --set db db48

Note, before installing and upon running "port select --summary", you should get something that looks like this:

$ port select --summary
Name    Selected               Options
====    ========               =======
db      db48                   db48 none
gcc     mp-gcc48               mp-gcc48 none
llvm    mp-llvm-3.5            mp-llvm-3.5 none
mpi     openmpi-gcc48-fortran  openmpi-gcc48-fortran none
python  python27               python25-apple python26-apple python27 python27-apple none


2.2 Create a volume and mount it

hdiutil create -size 8.3g -type SPARSEBUNDLE -fs HFSX -volname OpenFOAM -fsargs -s OpenFOAM.sparsebundle
mkdir -p OpenFOAM
hdiutil attach -mountpoint $HOME/OpenFOAM OpenFOAM.sparsebundle
cd OpenFOAM
git clone https://github.com/OpenFOAM/OpenFOAM-2.3.x
cd OpenFOAM-2.3.x


2.3 Get the patch

http://sourceforge.net/p/openfoam-extend/svn/HEAD/tree/trunk/Breeder_2.3/distroPatches/MacPatch/OpenFOAM-2.3.x-Mac.patch

Download the above and place it in the OpenFOAM-2.3.x directory.

2.4 Apply the patch

patch -p1<OpenFOAM-2.3.x-Mac.patch

2.5 Update the OpenFOAM-2.3.x/etc/bashrc

Append these lines to the /path/to/OpenFOAM-2.3.x/etc/bashrc (change the "/path/to" to whatever your fully qualified path would be):

echo "WM_CC=mpicc" >> /path/to/OpenFOAM-2.3.x/etc/bashrc
echo "WM_CXX=mpicxx" >> /path/to/OpenFOAM-2.3.x/etc/bashrc

Note: using the mpi wrappers (mpicc, mpicxx) revolves errors locating mpi header files, i.e. "mpi.h" - no sideffects were observed in the logs.

2.6 Install

source etc/bashrc && WM_NCOMPPROCS=$(sysctl -n hw.ncpu)
./Allwmake > log.Allwmake 2>&1

Note, you may notice this message:

"Proper OpenMPI not installed. Either do 'port install openmpi-mp' or 'port install openmpi-default'" 

Ignore it. Using mpicc and mpicxx wrappers will take care of includes and linking.

It might also complain about the ulimit, ignore this as well. (If you are on 10.9 and you try to change this, you will get an error anyway). Do the following instead, if needed:

Add this line:

limit maxfiles 16384 32768 

to:

/etc/launchd.conf 

(create it if it does not exist, and restart to take effect)

2.7 Update your bash profile

Update your ~/.bash_profile to load the OpenFOAM bashrc file by adding:

if [ -f $HOME/OpenFOAM/OpenFOAM-2.3.x/etc/bashrc ]; then
  . $HOME/OpenFOAM/OpenFOAM-2.3.x/etc/bashrc
fi

to your ~/.bash_profile (assuming you have mounted the volume, this will load the openfoam bashrc file and setup your environment).

All steps were taken from bash history file after compilation and testing.