Failed: Code Aster 13.4 Parallel with PETSc on Ubuntu 16.04

sponsored

いまさらですが、Code Aster 12.6のParallel版をつくろうと思い,

Ubuntu14.04上ではhttps://sites.google.com/site/codeastersalomemeca/home/code_asterno-heiretuka/code_asterno-heiretuka-12-6の方法で構築できたのですが、Ubuntu16.04では・・・失敗しました。

でもCode Aster 13.4再挑戦です(2017/09/17)。でも動作確認したら、MEDとHDF5がない!といわれて動きませんでした。とほほ(2017・09・26)

1.OpenBLAS

先のサイトの通りです。

$ cd ~/Install_Files/
$ tar xfvz OpenBLAS-0.2.18..tar.gz
$ cd OpenBLAS-0.2.18
$ make NO_AFFINITY=1 USE_OPENMP=1
$ make PREFIX=/opt/OpenBLAS install
$ echo /opt/OpenBLAS/lib | sudo tee -a /etc/ld.so.conf.d/openblas.conf
$ sudo ldconfig

2.通常のCodeAsterのインストール

、先のサイトの通りです。

$ cd ~/Install_Files
$ tar xfvz aster-full-src-12.6.0-3.noarch.tar.gz
$ cd aster-full-src-12.6.0/
$ sed -i "s:PREFER_COMPILER\ =\ 'GNU':PREFER_COMPILER\ =\'GNU_without_MATH'\nMATHLIB=\ '/opt/OpenBLAS/lib/libopenblas.a':g" setup.cfg
$ python setup.py install
並列計算用のホストファイルを作成するも参考のとおりに作成します。
$ echo "$HOSTNAME cpu=$(cat /proc/cpuinfo | grep processor | wc -l)" > /opt/aster/etc/codeaster/mpi_hostfile

3.ScaLAPACK

これも先のサイトと同じ。

$ cd ~/Install_Files
$ tar xfvz scalapack_installer.tgz
$ cd scalapack_installer_1.0.2
$ ./setup.py --lapacklib=/opt/OpenBLAS/lib/libopenblas.a --mpicc=mpicc --mpif90=mpif90 --mpiincdir=/usr/lib/openmpi/include --ldflags_c=-fopenmp --ldflags_fc=-fopenmp --prefix=/opt/scalapac

BLACS: error running BLACS test routines xCbtest というエラーが最後に表示されても、/opt/scalapack/lib/libscalapack.aのファイルが作成されていればOKなのも同じです。

ここまでは問題ありません。

4.Parmetis

$cd ~/
$tar xfvz parmetis-4.0.3.tgz 
$cd ~/parmetis-4.0.3
$make config -prefix=/opt/parmetis-4.0.3
$make all
$make install

5.SCOTCHとPTSCOTCH

$cd /opt
$ tar xfvz scotch-6.0.4.tgz
$cd /opt/scotch-6.0.4/src

そして、Makefile.incを修正します。

EXE =
LIB = .a
OBJ = .o

MAKE = make
AR = ar
ARFLAGS = -ruv
CAT = cat
CCS = gcc
CCP = mpicc
CCD = gcc -I /usr/include/mpi
CFLAGS = -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER -DSCOTCH_PTHREAD -DSCOTCH_DETERMINISTIC -Drestrict=__restrict
CLIBFLAGS =
LDFLAGS = -lz -lm -lrt -lpthread
CP = cp
LEX = flex -Pscotchyy -olex.yy.c
LN = ln
MKDIR = mkdir
MV = mv
RANLIB = ranlib
YACC = bison -pscotchyy -b y

そして、

$make scotch esmumps

../esumps内に出来たlibesumps.aは..scotch-6.0.4/libにcopyしておきます。

$make ptscotch ptesmumps

6.Mumps

Code_Asterのソースファイル中にあるmumps-5.1.1を、/optにコピーしてmpiコンパイラでコンパイルします。
$ cp ~/Install_Files/aster-full-src-13.4.0/SRC/mumps-5.1.1-aster2.tar.gz /opt/
$ cd /opt
$ tar xfvz mumps-5.1.1-aster2.tar.gz
$ mv mumps-5.1.1 mumps-5.1.1_mpi2
$ cd mumps-5.1.1_mpi2/

Makefile.incの中を

#
# This file is part of MUMPS 4.10.0, built on Tue May 10 12:56:32 UTC 2011
# modified for Code_Aster setup (see fields like ?CC?)
#
#Begin orderings

# NOTE that PORD is distributed within MUMPS by default. If you would like to
# use other orderings, you need to obtain the corresponding package and modify
# the variables below accordingly.
# For example, to have Metis available within MUMPS:
# 1/ download Metis and compile it
# 2/ uncomment (suppress # in first column) lines
# starting with LMETISDIR, LMETIS
# 3/ add -Dmetis in line ORDERINGSF
# ORDERINGSF = -Dpord -Dmetis
# 4/ Compile and install MUMPS
# make clean; make (to clean up previous installation)
#
# Metis/ParMetis and SCOTCH/PT-SCOTCH (ver 5.1 and later) orderings are now available for MUMPS.
#

#SCOTCHDIR = ?HOME_SCOTCH?
SCOTCHDIR = /opt/scotch-6.0.4
ISCOTCH = -I$(SCOTCHDIR)/include/

# You have to choose one among the following two lines depending on
# the type of analysis you want to perform. If you want to perform only
# sequential analysis choose the first (remember to add -Dscotch in the ORDERINGSF
# variable below); for both parallel and sequential analysis choose the second 
# line (remember to add -Dptscotch in the ORDERINGSF variable below)

LSCOTCH = -L$(SCOTCHDIR)/lib -lesmumps -lscotch -lscotcherr
#LSCOTCH = -L$(SCOTCHDIR)/lib -lptesmumps -lptscotch -lptscotcherr



LPORDDIR = $(topdir)/PORD/lib/
IPORD = -I$(topdir)/PORD/include/
LPORD = -L$(LPORDDIR) -lpord

METISDIR = /opt/aster/public/metis-5.1.0
#LMETISDIR = ?HOME_METIS?/lib
LMETISDIR = $(METISDIR)/lib/

IMETIS = -I$(METISDIR)/include/

# You have to choose one among the following two lines depending on
# the type of analysis you want to perform. If you want to perform only
# sequential analysis choose the first (remember to add -Dmetis in the ORDERINGSF
# variable below); for both parallel and sequential analysis choose the second 
# line (remember to add -Dparmetis in the ORDERINGSF variable below)

LMETIS = -L$(LMETISDIR) -lmetis
#LMETIS = -L$(LMETISDIR) -lparmetis -lmetis

# The following variables will be used in the compilation process.
# Please note that -Dptscotch and -Dparmetis imply -Dscotch and -Dmetis respectively.
#ORDERINGSF = -Dscotch -Dmetis -Dpord -Dptscotch -Dparmetis
#ORDERINGSF = -Dscotch -Dmetis -Dpord -Dparmetis
#ORDERINGSF = -Dpord -Dmetis
#ORDERINGSF = -Dpord -Dparmetis -Dmetis
ORDERINGSF = -Dscotch -Dpord -Dmetis
ORDERINGSC = $(ORDERINGSF)

LORDERINGS = $(LMETIS) $(LPORD) $(LSCOTCH)
IORDERINGSF = $(ISCOTCH) $(IMETIS)
IORDERINGSC = $(IMETIS) $(IPORD) $(ISCOTCH)

#End orderings
########################################################################
################################################################################

PLAT =
LIBEXT = .a
OUTC = -o 
OUTF = -o 
RM = /bin/rm -f
CC = mpicc
FC = mpif90
FL = mpif90
# WARNING: AR must ends with a blank space!
AR = ar vr 
#RANLIB = ranlib
RANLIB = echo
# See point 17 in the FAQ to have more details on the compilation of mpich with gfortran
SCALAP = /opt/scalapack/lib/libscalapack.a \
 /opt/OpenBLAS/lib/libopenblas.a

INCPAR = -I/usr/include/openmpi $(IPORD)
LIBPAR = $(SCALAP) -L/usr/lib -lmpi

#LIBPAR = $(SCALAP) -L/usr/local/lib/ -llamf77mpi -lmpi -llam
#LIBPAR = $(SCALAP) -lutil -ldl -lpthread
#LIBPAR = -lmpi++ -lmpi -ltstdio -ltrillium -largs -lt
INCSEQ = -I$(topdir)/libseq
LIBSEQ = -L$(topdir)/libseq -lmpiseq
#LIBBLAS = -L/usr/lib/xmm/ -lf77blas -latlas
LIBBLAS = -L/opt/OpenBLAS/lib/ -lopenblas
LIBOTHERS = -lpthread
#Preprocessor defs for calling Fortran from C (-DAdd_ or -DAdd__ or -DUPPER)
CDEFS = -DAdd_

#Begin Optimized options
#OPTF = -O -Dintel_ -DALLOW_NON_INIT ?F90FLAGS?
#OPTL = -O ?LDFLAGS?
#OPTC = -O ?CFLAGS?
OPTF = -O -Dintel_ -DALLOW_NON_INIT -ffixed-line-length-0 -x f77-cpp-input -fPIC -fopenmp -DDETERMINISTIC_PARALLEL_GRAPH
#OPTF = -O -Dintel_ -DALLOW_NON_INIT -ffixed-line-length-0 -x f77-cpp-input -fPIC -fopenmp 
OPTL = -O -fopenmp
OPTC = -O -fno-stack-protector -fPIC -fopenmp
#End Optimized options
#INCS = $(INCSEQ)
#LIBS = $(LIBSEQ)
#LIBSEQNEEDED = libseqneeded
INCS = $(INCPAR)
LIBS = $(LIBPAR)
LIBSEQNEEDED =

そして、

$make all

です。

7.PETSC

$ cp ~/Install_Files/petsc-3.7.6.tar.gz /opt
$ cd /opt
$ tar xfvz petsc-3.7.6.tar.gz
$ cd petsc-3.7.6

そして、configureです.。

./config/configure.py --configModules=PETSc.Configure --optionsModule=config.compilerOptions --with-mpi-dir=/usr/lib/openmpi --with-blas-lapack-lib=/opt/OpenBLAS/lib/libopenblas.a --download-hypre=yes --download-ml=yes --with-debugging=0 COPTFLAGS=-O1 CXXOPTFLAGS=-O1 FOPTFLAGS=-O1 --configModules=PETSc.Configure --optionsModule=PETSc.compilerOptions --with-x=0 --with-shared-libraries=0 --download-mumps=yes --with-scalapack-dir=/opt/scalapack --with-ptscotch-dir=/opt/scotch-6.0.4 --with-parmetis-dir=/opt/parmetis-4.0.3 --with-metis-dir=/opt/aster/public/metis-5.1.0 --download-mumps-commit=v5.1.1-p1

なぜか、

--with-mumps-dir=/opt/mumps-5.1.1-mpi2

が動作しない、というエラーがでるので、download-mumpsで代用です。mumps-5.0.25.1.1がダウンロードされました。(2017/9/23訂正)

Configureが終了したら、

$ make PETSC_DIR=/opt/petsc-3.7.6 PETSC_ARCH=arch-linux2-c-opt all
$ make PETSC_DIR=/opt/petsc-3.7.6 PETSC_ARCH=arch-linux2-c-opt test

して、コンパイルと成功の確認をします。

8.CODE ASTER再構築

bitbucketのTutorialを参考に、Code AsterのSourceをダウンロードします。

mkdir -p $HOME/dev/codeaster && cd $HOME/dev/codeaster
hg clone https://bitbucket.org/code_aster/codeaster-devtools devtools
hg clone https://bitbucket.org/code_aster/codeaster-src src

 

並列用設定ファイル:Ubuntu_gnu.py、

# encoding: utf-8

"""
Fichier de configuration WAF pour version séquentielle sur Ubuntu 12.04 :
- Compilateur : GNU
- BLAS : OpenBLAS
"""
import os

def configure(self):
 opts = self.options

# opts.with_prog_metis = True

# official_programs.configure(self)

self.env.append_unique('LINKFLAGS', ['-Wl,--allow-multiple-definition'])
# self.env.append_value('CXXFLAGS', ['-D_GLIBCXX_USE_CXX11_ABI=0'])
 self.env['ADDMEM'] = 350

self.env.append_value('LIBPATH', [
 '/opt/aster/public/hdf5-1.8.14/lib',
 '/opt/aster/public/med-3.2.1/lib',
 '/opt/aster/public/metis-5.1.0/lib',
 '/opt/aster/public/mfront-3.0.0/lib',
 '/opt/scotch-6.0.4/lib',
 '/opt/OpenBLAS/lib',])

self.env.append_value('INCLUDES', [
 '/opt/aster/public/hdf5-1.8.14/include',
 '/opt/aster/public/med-3.2.1/include',
 '/opt/aster/public/metis-5.1.0/include',
 '/opt/aster/public/mfront-3.0.0/include',
 '/opt/mumps-5.1.1-mpi2/include',
 '/opt/mumps-5.1.1-mpi2/include_seq',
 '/opt/scotch-6.0.4/include',
 '/opt/OpenBLAS/include'])

opts.maths_libs = 'openblas'
 opts.embed_math = True

opts.enable_med = True
 opts.hdf5_libs = 'hdf5 z'
 opts.embed_hdf5 = True
# opts.med_libs = 'med stdc++'
 opts.embed_med = True

# opts.enable_petsc = True

opts.enable_mfront = False

opts.enable_scotch = True
 opts.embed_scotch = True

opts.embed_aster = True
 opts.embed_fermetur = True

もう1つのUbuntu_gnu_mpi.py:

# encoding: utf-8

"""
Fichier de configuration WAF pour version parallèle sur Ubuntu 12.04 :
- Compilateur : GNU
- MPI : système (OpenMPI, Ubuntu 12.04)
- BLAS : OpenBLAS
- Scalapack : système (Ubuntu 12.04)
- PETSc : 
"""
import Ubuntu_gnu

def configure(self):
 opts = self.options
 Ubuntu_gnu.configure(self)

self.env.prepend_value('LIBPATH', [
 '/opt/parmetis-4.0.3/lib',
 '/opt/mumps-5.1.1-mpi2/lib',
 '/opt/petsc-3.7.6/arch-linux2-c-opt/lib',
 '/opt/scalapack/lib',])

self.env.prepend_value('INCLUDES', [
 '/opt/parmetis-4.0.3/include',
 '/opt/mumps-5.1.1-mpi2/include',
 '/opt/petsc-3.7.6/arch-linux2-c-opt/include',
 '/opt/petsc-3.7.6/include',])

self.env.append_value('LIB', ('X11',))

opts.parallel = True

opts.enable_mumps = True
 opts.mumps_version = '5.1.1'
 opts.mumps_libs = 'dmumps zmumps smumps cmumps mumps_common pord metis scalapack openblas esmumps scotch scotcherr'

opts.enable_petsc = True
 self.env.append_value('LIB_METIS', ('parmetis'))
 self.env.append_value('LIB_SCOTCH', ('ptscotch','ptscotcherr','ptscotcherrexit','ptesmumps'))

opts.petsc_libs='petsc HYPRE ml'
# opts.embed_petsc = True

そして、../codeaster/srcに移動して、

$ export ASTER_ROOT=/opt/aster
$ ./waf configure --use-config-dir=$ASTER_ROOT/13.4/share/aster --use-config=Ubuntu_gnu_mpi --prefix=$ASTER_ROOT/PAR13.4-petsc

ここで、blapacがない、とエラーが出たら、

Code_Aster installation » Parallel installation of aster-13.2: blacs not found

を参考に、対応しました。

$./waf build -p

途中Warningが大量にでましたが、buildは完了しました。

$./waf install

動作確認は、MEDとHDF5がない!といわれて動きませんでした。とほほ(2017・09・26)

コメント

タイトルとURLをコピーしました