How to install asl and ibamr tools:

ASL 和 IBAMR 都是有限元分析的工具,流体力学等,ASL可以使用GPU加速计算,

主机配置,i7 6代,1060, 32G,500G,ubuntu1604。

安装ASL、配置依赖、安装、运行测试:

1.GPU DRIVER && CUDA SDK OpenCL

  在Ubuntu 软件源下载GPU驱动。

  NVIDIA 官网下载cuda run安装包,安装时候不要选择图形图像显示驱动的安装。

装一些依赖:

 sudo apt-get install clinfo dkms xz-utils openssl libnuma1 libpciaccess0 bc curl libssl-dev lsb-core libicu-dev -y
 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get install mono-complete -y

2.CMAKE

 sudo apt-get install libncurses5-dev cmake-curses-gui -y
 sudo apt-get install build-essential -y
wget http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz
tar xf cmake-3.11..tar.gz && cd cmake-3.11. && ./configure
make -j8 && sudo make install

3.OpenGL

 sudo apt-get install build-essential libgl1-mesa-dev freeglut3-dev libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev gfortran  doxygen graphviz -y

4.VTK

The Visualization Toolkit (VTK) is an open-source, freely available software system for 3D computer graphics, image processing, and visualization.

又是一个神乎其技的开源工具。

 sudo apt-get install libvtk6.
wget https://www.vtk.org/files/release/6.3/VTK-6.3.0.zip
unzip VTK-6.3..zip
mkdir VTK-build && cd VTK-build&&ccmake ../VTK-6.3.

然后按“c”确认配置生成可编译文件,直到“g”选项出现,然后按“g”即可

 make -j8
sudo make install

5.BOOST

首先安装一个低版本的boost,这个是给ASL用的。

 sudo apt-get install libboost1.-all-dev -y

6.ASL

 unzip ASL-0.1..zip
mkdir build-asl && cd build-asl
cmake -D OpenCL_INCLUDE_DIR=/usr/local/cuda-9.0/include/ -G "Unix Makefiles" ../ASL-0.1.
cmake -D OpenCL_LIBRARY=/usr/local/cuda-9.0/lib64/libOpenCL.so -G "Unix Makefiles" ../ASL-0.1.
make -j8
sudo make install

运行实例:

 cd examples/flow/locomotive
wget http://asl.org.il/input_data/locomotive.stl
./asl-locomotive --input locomotive.stl

====================================================================================================================

安装IBAMR、配置依赖、安装、运行测试:此处已经是旧版的ibamr了下载其源码需要找到GitHub上倒数第二个版本v0.2 https://github.com/IBAMR/IBAMR/releases

1.安装BOOST

 mkdir sfw && cd sfw && mkdir linux && cd linux && mkdir boost && cd boost
unzip boost_1_60_0.zip
mv boost_1_60_0 1.6.
export BOOST_ROOT=$HOME/sfw/linux/boost/1.6.
mkdir $BOOST_ROOT/include
ln -s $BOOST_ROOT/boost $BOOST_ROOT/include
7 sudo apt install libz-dev m4 gfortran -y

2.安装eigen

 cd sfw && cd linux && mkdir eigen && cd eigen
下载 eigen 3.3.
tar -jxvf 3.3..tar.bz2
cmake eigen-eigen-f562a193118d
make -j8 && sudo make install

3.安装HDF5

 cd sfw/linux && mkdir hdf5 && cd hdf5
下载 hdf5-1.8..tar.bz2
tar xvjf ~/hdf5-1.8..tar.bz2
cd hdf5-1.8.
./configure \
CC=gcc \
CXX=g++ \
FC=gfortran \
F77=gfortran \
--enable-production \
--disable-debug \
--prefix=$HOME/sfw/linux/hdf5/1.8.
 make -j8 && make check && sudo make install

4.安装SILO

 cd $HOME/sfw/linux
tar xvfz silo-4.10.tar.gz && cd silo-4.10
./configure \
CC=gcc \
CXX=g++ \
FC=gfortran \
F77=gfortran \
--prefix=$HOME/sfw/linux/silo/4.10 \
--disable-silex
 make -j8 && sudo make install

5.安装MUPARSER

 sudo apt-get install libmuparser-dev -y

6.安装OpenMPI

 cd $HOME/sfw/linux

 tar xvfj openmpi-1.10..tar.bz2
cd openmpi-1.10. ./configure \
CC=gcc \
CXX=g++ \
FC=gfortran \
F77=gfortran \
--prefix=$HOME/sfw/linux/openmpi/1.10. \
--disable-mpi-cxx-seek \
--disable-heterogeneous \
--enable-orterun-prefix-by-default make -j8 && make check && sudo make install

7.安装PETSC

  7.1首先编译debug 版:

 sudo apt-get install libblas-dev liblapack-dev -y

 cd $HOME/sfw && mkdir petsc && cd petsc

 wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.7.2.tar.gz

 tar xvfz petsc-3.7..tar.gz

 mv petsc-3.7. 3.7. && cd 3.7.

 export PETSC_DIR=$PWD

 export PETSC_ARCH=linux-debug

./config/configure.py \
--CC=$HOME/sfw/linux/openmpi/1.10./bin/mpicc \
--CXX=$HOME/sfw/linux/openmpi/1.10./bin/mpicxx \
--FC=$HOME/sfw/linux/openmpi/1.10./bin/mpif90 \
--LDFLAGS="-L$HOME/sfw/linux/openmpi/1.10.2/lib -Wl,-rpath,$HOME/sfw/linux/openmpi/1.10.2/lib" \
--with-debugging= \
--with-c++-support \
--download-hypre= make && make test

  7.2再编译optimize版:

 export PETSC_DIR=$PWD

 export PETSC_ARCH=linux-opt

./config/configure.py \
--CC=$HOME/sfw/linux/openmpi/1.10./bin/mpicc \
--CXX=$HOME/sfw/linux/openmpi/1.10./bin/mpicxx \
--FC=$HOME/sfw/linux/openmpi/1.10./bin/mpif90 \
--COPTFLAGS="-O3" \
--CXXOPTFLAGS="-O3" \
--FOPTFLAGS="-O3" \
--LDFLAGS="-L$HOME/sfw/linux/openmpi/1.10.2/lib -Wl,-rpath,$HOME/sfw/linux/openmpi/1.10.2/lib" \
--with-default-arch= \
--PETSC_ARCH=$PETSC_ARCH \
--with-debugging= \
--with-c++-support \
--with-hypre= \
--download-hypre= \
--with-x=\ make && make test

8.安装SAMRAI

 cd $HOME/sfw && mkdir samrai && cd samrai && mkdir 2.4.&& cd 2.4.

 tar xvfz SAMRAI-v2.4.4.tar.gz && mv SAMRAI SAMRAI-2.4.

然后要打一个补丁

 wget https://github.com/IBAMR/IBAMR/releases/download/v0.1-rc1/SAMRAI-v2.4.4-patch-121212.gz

 cd SAMRAI-2.4.

 gunzip -c ../SAMRAI-v2.4.4-patch-.gz | patch -p2

 ./source/scripts/includes --link

 cd $HOME/sfw/samrai/2.4.

 mkdir objs-debug && cd objs-debug

../SAMRAI-2.4./configure \
--prefix=$HOME/sfw/samrai/2.4./linux-g++-debug \
--with-CC=gcc \
--with-CXX=g++ \
--with-F77=gfortran \
--with-MPICC=$HOME/sfw/linux/openmpi/1.10./bin/mpicc \
--with-hdf5=$HOME/sfw/linux/hdf5/1.8. \
--without-hypre \
--with-silo=$HOME/sfw/linux/silo/4.10 \
--without-blaslapack \
--without-cubes \
--without-eleven \
--without-kinsol \
--without-petsc \
--without-sundials \
--without-x \
--with-doxygen \
--with-dot \
--enable-debug \
--disable-opt \
--enable-implicit-template-instantiation \
--disable-deprecated make -j8 && sudo make install

优化版本:

 cd $HOME/sfw/samrai/2.4. &&mkdir objs-opt &&cd objs-opt

../SAMRAI-2.4./configure \
CFLAGS="-O3" \
CXXFLAGS="-O3" \
FFLAGS="-O3" \
--prefix=$HOME/sfw/samrai/2.4./linux-g++-opt \
--with-CC=gcc \
--with-CXX=g++ \
--with-F77=gfortran \
--with-MPICC=$HOME/sfw/linux/openmpi/1.10./bin/mpicc \
--with-hdf5=$HOME/sfw/linux/hdf5/1.8. \
--without-hypre \
--with-silo=$HOME/sfw/linux/silo/4.10 \
--without-blaslapack \
--without-cubes \
--without-eleven \
--without-kinsol \
--without-petsc \
--without-sundials \
--without-x \
--with-doxygen \
--with-dot \
--disable-debug \
--enable-opt \
--enable-implicit-template-instantiation \
--disable-deprecated make -j8 && sudo make install

9.安装libMesh

 cd $HOME/sfw/linux &&mkdir libmesh &&cd libmesh &&mkdir 1.0. &&cd 1.0.

 wget https://github.com/libMesh/libmesh/releases/download/v1.0.0/libmesh-1.0.0.tar.gz

 THEN: tar xvfz libmesh-1.0..tar.gz && mv libmesh-1.0. LIBMESH &&cd $HOME/sfw/linux/libmesh/1.0. && mkdir objs-debug && cd objs-debug

 export BOOST_ROOT=$HOME/sfw/linux/boost/1.6.

../LIBMESH/configure \
--prefix=$HOME/sfw/linux/libmesh/1.0./1.0.-debug \
--with-methods=dbg \
PETSC_DIR=$HOME/sfw/petsc/3.7. \
PETSC_ARCH=linux-debug \
CC=$HOME/sfw/linux/openmpi/1.10./bin/mpicc \
CXX=$HOME/sfw/linux/openmpi/1.10./bin/mpicxx \
FC=$HOME/sfw/linux/openmpi/1.10./bin/mpif90 \
F77=$HOME/sfw/linux/openmpi/1.10./bin/mpif90 \
--enable-triangle \
--disable-cxx11 \
--disable-openmp \
--disable-perflog \
--disable-strict-lgpl \
--disable-pthreads \
--disable-cppthreads \
--disable-unique-ptr make -j8 && sudo make install

然后安装优化版:

 cd $HOME/sfw/linux/libmesh/1.0. &&mkdir objs-opt &&cd objs-opt

 export BOOST_ROOT=$HOME/sfw/linux/boost/1.6.

../LIBMESH/configure \
--prefix=$HOME/sfw/linux/libmesh/1.0./1.0.-opt \
--with-methods=opt \
PETSC_DIR=$HOME/sfw/petsc/3.7. \
PETSC_ARCH=linux-opt \
CC=$HOME/sfw/linux/openmpi/1.10./bin/mpicc \
CXX=$HOME/sfw/linux/openmpi/1.10./bin/mpicxx \
FC=$HOME/sfw/linux/openmpi/1.10./bin/mpif90 \
F77=$HOME/sfw/linux/openmpi/1.10./bin/mpif90 \
--enable-triangle \
--disable-cxx11 \
--disable-openmp \
--disable-perflog \
--disable-strict-lgpl \
--disable-pthreads \
--disable-cppthreads \
--disable-unique-ptr
make -j8 && sudo make install

终于到了主角,10.安装IBAMR

 cd $HOME/sfw && mkdir ibamr && cd ibamr

 git clone https://github.com/IBAMR/IBAMR.git

 THEN:4

 tar xvfj ibamr.tar.bz2 && cd $HOME/sfw/ibamr && mkdir ibamr-objs-dbg && cd ibamr-objs-dbg

 export BOOST_ROOT=$HOME/sfw/linux/boost/1.6. && export PETSC_ARCH=linux-debug && export PETSC_DIR=$HOME/sfw/petsc/3.7.

../IBAMR/configure \
CFLAGS="-g -O1 -Wall" \
CXXFLAGS="-g -O1 -Wall" \
FCFLAGS="-g -O1 -Wall" \
CC=$HOME/sfw/linux/openmpi/1.10./bin/mpicc \
CXX=$HOME/sfw/linux/openmpi/1.10./bin/mpicxx \
FC=$HOME/sfw/linux/openmpi/1.10./bin/mpif90 \
CPPFLAGS="-DOMPI_SKIP_MPICXX" \
--with-hypre=$PETSC_DIR/$PETSC_ARCH \
--with-samrai=$HOME/sfw/samrai/2.4./linux-g++-debug \
--with-hdf5=$HOME/sfw/linux/hdf5/1.8. \
--with-silo=$HOME/sfw/linux/silo/4.10 \
--with-boost=$HOME/sfw/linux/boost/1.6. \
--enable-libmesh \
--with-libmesh=$HOME/sfw/linux/libmesh/1.0./1.0.-debug \
--with-libmesh-method=dbg
make lib -j8 && make examples -j8

然后安装优化版本

 cd $HOME/sfw/ibamr && mkdir ibamr-objs-opt && cd ibamr-objs-opt && export PETSC_ARCH=linux-opt && export PETSC_DIR=$HOME/sfw/petsc/3.7.

../IBAMR/configure \
CC=$HOME/sfw/linux/openmpi/1.10./bin/mpicc \
CXX=$HOME/sfw/linux/openmpi/1.10./bin/mpicxx \
F77=$HOME/sfw/linux/openmpi/1.10./bin/mpif90 \
FC=$HOME/sfw/linux/openmpi/1.10./bin/mpif90 \
MPICC=$HOME/sfw/linux/openmpi/1.10./bin/mpicc \
MPICXX=$HOME/sfw/linux/openmpi/1.10./bin/mpicxx \
CFLAGS="-O3 -Wall" \
CXXFLAGS="-O3 -Wall -std=gnu++11" \
FFLAGS="-O3 -Wall" \
FCFLAGS="-O3 -Wall" \
CPPFLAGS="-DOMPI_SKIP_MPICXX" \
--with-hypre=$PETSC_DIR/$PETSC_ARCH \
--with-samrai=$HOME/sfw/samrai/2.4./linux-g++-opt \
--with-hdf5=$HOME/sfw/linux/hdf5/1.8. \
--with-silo=$HOME/sfw/linux/silo/4.10 \
--with-boost=$HOME/sfw/linux/boost/1.6. \
--enable-libmesh \
--with-libmesh=$HOME/sfw/linux/libmesh/1.0./1.0.-opt \
--with-libmesh-method=opt
make -j8 &&make check

运行实例程序:

 cd $HOME/sfw/ibamr/ibamr-objs-opt/examples/IB/staggered_grid/explicit/ex1

 make examples

 ./main2d input2d

Advanced Simulation Library(ASL)&& An adaptive and distributed-memory parallel implementation of the immersed boundary (IB) method (IBAMR)-LMLPHP

完,qsy。

05-06 15:36