日曜日, 12月 17, 2017

フリーの最適化ソフト DAKOTAをFedora24にインストール

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/dakota /home/.../dakota-6.7.0.src
という感じでインストールを試したところ

CMake Error at CMakeLists.txt:245 (enable_language):
  No CMAKE_CXX_COMPILER could be found.
  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.
というエラーが出てうまくいきません。
そこで
sudo yum install gcc-c++
を実行して
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/dakota /home/.../dakota-6.7.0.src -CMAKE_CXX_COMPILER=/usr/bin/g++
を試してみると、今度は
CMake Error at CMakeLists.txt:315 (find_package):
  Could not find a package configuration file provided by "LAPACK" with any
  of the following names:
    LAPACKConfig.cmake
    lapack-config.cmake
  Add the installation prefix of "LAPACK" to CMAKE_PREFIX_PATH or set
  "LAPACK_DIR" to a directory containing one of the above files.  If "LAPACK"
  provides a separate development package or SDK, be sure it has been
  installed.
というエラーが出てしまいます。そこでliblapack.so.3gf(シンボリックリンク)があるのが/usr/lib
なので
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/dakota /home/.../dakota-6.7.0.src -CMAKE_CXX_COMPILER=/usr/bin/g++ -CMAKE_LAPACK_DIR=/usr/lib
を試してみると、だいぶ進みますが
CMake Error at packages/external/teuchos/cmake/tribits/modules/FindPythonInterp.cmake:119 (IF):
  if given arguments:
    "VERSION_LESS" "2.4"
  Unknown arguments specified
というエラーが出ます。
を参考に
dakota-6.7.0.src/ackages/external/teuchos/cmake/tribits/modules/FindPythonInterp.cmake
を修正します。
今度は
CMake Error at packages/external/teuchos/cmake/tribits/package_arch/TribitsTplDeclareLibraries.cmake:342 (MESSAGE):
  Could not find the BLAS Library! Please manually set BLAS_LIBRARY_DIRS
  and/or BLAS_LIBRARY_NAMES or just TPL_BLAS_LIBRARIES to point to the BLAS
  libraries!
というエラーが出ます。

そこで~/.bashrcに
export BLAS_LIBS=/usr/lib
export LAPACK_LIBS=/usr/lib
と記述して
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/dakota /home/hiromitsu/Simulation/dakota-6.7.0.src -CMAKE_CXX_COMPILER=/usr/bin/g++ -CMAKE_LAPACK_DIR=/usr/lib/ -DBLAS_LIBS=/usr/lib/libblas.so.3gf.0 -DLAPACK_LIBS=/usr/lib/liblapack.so.3gf.0
と実行すると、さらに進みますが

CMake Error at packages/external/acro/packages/colin/CMakeLists.txt:11 (message):
   Cannot build colin without Boost.  Please enable USE_BOOST and set Boost_INCLUDE_DIR

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Boost_INCLUDE_DIR (ADVANCED)
というエラーが出ます。

今日はここまで。。。

フリーの最適化ソフト DAKOTAをFedora24にインストール(事前準備)

http://mogura7.zenno.info/~et/wordpress/ocse/?p=871#more-871
を参考に、事前準備を実施。

Boostは上記サイトにあるようにインストールできるが、
BLAS, LAPACKは
動的ライブラリ(*.so)が必要とのこと。

そこで
https://qiita.com/AnchorBlues/items/69c1744de818b5e045ab
にある手順をベースにしつつも
make.incのgfortranでのコンパイルオプションに
-fPICを追加してコンパイル。

コンパイル後、
BLAS/SRC/で
gfortran -shared -lpthread -lgomp -o libblas.so *.o
sudo ln -s /home/.../lapack-3.8.0/BLAS/SRC/libblas.so /usr/lib/libblas.so.3gf.0

SRC/で
gfortran -shared -lpthread -lgomp -o liblapack.so *.o
sudo ln -s  /home/.../lapack-3.8.0/SRC/liblapack.so /usr/lib/liblapack.so.3gf
を実行
https://qiita.com/_akisato/items/d5de60e38b5a69387bde
を参考にしてみた)。

ただし、まだ正しく*.soが作成できたかは不明。
これからDAKOTAのインストールを試してみる。

Fedora24用 gfortran rpmファイル

事情により再びFedoraで数値計算をする必要が出たが、
gfortranがyumでインストールできないため
下記サイトからrpmファイルをダウンロードして
インストール。

su
(パスワード入力)
rpm -ivh gcc-gfortran-6.3.1-1.fc24.x86_64.rpm
でインストール

http://rpm.pbone.net/index.php3/stat/4/idpl/39452465/dir/fedora_24/com/gcc-gfortran-6.3.1-1.fc24.x86_64.rpm.html

なんで最新版のFedoraではないかというと、既にインストール済で
その環境をそのまま使いたかったから。