Difference between revisions of "インストールと実行"

From salmon
Jump to: navigation, search
(CMakeを用いたビルド)
(単一プロセス計算のためのビルド)
Line 130: Line 130:
 
=== 単一プロセス計算のためのビルド ===
 
=== 単一プロセス計算のためのビルド ===
  
In default, the python script assumes parallel execution.
+
標準設定では、pythonスクリプトは並列実行を前提としています。
If you use a single processor machine, specify <code>--disable-mpi</code> in executing the python script:
+
もし単一プロセスマシンを利用する場合は、pythonスクリプトの実行の際に<code>--disable-mpi</code>を指定してください。
  
 
   $ python ../configure.py --arch=<ARCHITECTURE> --disable-mpi
 
   $ python ../configure.py --arch=<ARCHITECTURE> --disable-mpi

Revision as of 12:51, 6 January 2018

必要条件

このガイドでは、ユーザはUnixとそのコマンドライン操作について基礎的な知識を有していることを仮定します。 SALMONのインストールにあたり、以下のパッケージが必要です。

  • Fortran90/Cコンパイラ。このパッケージは、ユーザが以下のいずれかのコンパイラを利用できることを仮定します。
    • GCC (Gnu Compiler Collection)
    • Intel Fortran/C Compiler
    • Fujitsu Compiler (at FX100 / K-Computer)
  • 以下の線形代数パッケージのいずれか。
    • BLAS/LAPACK
    • Intel Math Kernel Library (MKL)
    • Fujitsu Scientific Subroutine Library 2 (SSL-II)
  • ビルドツール。
    • CMake

もし他のコンパイラを利用する場合は、ビルドスクリプト(Cmake)を変更することが必要です。#configure.pyスクリプトの付加的な選択肢をご覧ください。 もしあなたの計算機環境で数値ライブラリがインストールされていない場合は、あなた自身でBLAS/LAPACKをインストールすることが必要です。 インストールでのトラブルシューティングをご覧ください。

SALMONのインストールでは、CMakeの利用を第一の選択肢としています。 あなたの利用環境でCMakeツールを使うことに問題がある場合は、GNU makeツールの利用も可能です。 インストールでのトラブルシューティングをご覧ください。

ダウンロード

SALMONの最新バージョンは、ダウンロードからダウンロードすることができます。 ダウンロードしたファイルsalmon-<VERSION>.tar.gzからファイルを抽出するために、コマンドラインから以下のコマンドを入力します。

$ tar –zxvf ./salmon-<VERSION>.tar.gz

ファイルの抽出後、以下のディレクトリが生成されます。

SALMON
 |- src        Source codes
 |- example    Samples
 |- makefiles   GNU Makefiles for building
 |- cmakefiles   CMake related files
 |- makefiles   GNU Makefiles for building

ビルド

SALMONをコンパイルし実行可能なバイナリファイルを作成するため、最初の選択肢としてCMakeを利用します。 もしあなたの環境でCMakeを用いたSALMONのビルドに失敗した場合は、Gnu Makeを用いることも可能です。 #GNU Makefileを用いたビルドを参照してください。

CMakeが利用できることの確認

最初にあなたの環境でCMakeが利用可能かどうかを確認します。Unixコマンドラインから以下をタイプしてください。

$ cmake --version

もしCMakeがあなたのシステムにインストールされていない場合は、cmake: command not found のようなエラーメッセージが表示されます。 もしCMakeがあなたのシステムにインストールされている場合は、バージョンナンバーが表示されます。 SALMONをビルドするためには、バージョン3.0.2以降のCMakeが必要です。 あなたのシステムで、バージョン3.0.2以降のCMakeがインストールされていることが確認できたら、#CMakeを用いたビルドに進んでください。 しかし、多くのシステムで古いバージョンのCMakeがインストールされています。 あなたのシステムでCMakeがインストールされていない場合、あるいは古いバージョンのCMakeがインストールされている場合は、新しいバージョンをあなた自身でインストールすることが必要です。これは簡単な作業であり、以下で説明します。

CMakeのインストール

CMakeは、複数のプラットフォームに対応したビルドツールです。 あなたの環境でCMakeを利用可能にする最も簡単な方法は、CMakeのバイナリ配布をdownload pageから入手することです。 バイナリ配布のファイル名は、cmake-<VERSION>-<PLATFORM>.tar.gz)となっています。 標準的なUnix環境では、Linux x86_64プラットフォームに対するファイルが適切です。

バイナリファイルをダウンロードするために、以下の作業を行います。 まず、あなたは現在、SALMONのダウンロードファイルからファイルを抽出したディレクトリにいるとします。そして、CMakeのバージョン3.8.2を利用するものとします。 最初に、ブラウザからダウンロードリンクのURLを取得し、Unixコマンドラインから次のように入力します。

$ wget https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz

次に、取得したアーカイブを解凍します。

$ tar -zxvf cmake-3.8.2-Linux-x86_64.tar.gz

すると、あなたのディレクトリにバイナリファイルmake-3.8.2-Linux-x86_64/bin/cmakeが得られます。

cmakeコマンドがコマンドラインから利用可能となるように、環境変数$PATHを、CMakeの実行ファイルが$PATHで指定されたディレクトリの内部にあるように設定することが必要です。 あなたがbash shellを利用している場合は、$PATH変数を指定しているファイル~/.bashrcを修正することが必要です。 あなたのログイン・ディレクトリから、次のコマンドを入力してください。

$ export PATH=<SALMON_INSTALLATION_DIRECTORY>/cmake-3.8.2-Linux-x86_64/bin:$PATH

そして、環境をリロードするために、

$ source ~/.bashrc

を入力してください。

CMakeを用いたビルド

バージョン3.0.2以降のCMakeがあなたの環境で利用できることを確認後、以下のステップに進んでください。 あなたがSALMONディレクトリにいるとします。

  • 一時的なディレクトリbuildを作成し、そのディレクトリに移動してください。
$ mkdir build
$ cd build
  • pythonスクリプトconfigure.pyを実行し、makeを行なってください。
$ python ../configure.py –arch=ARCHITECTURE --prefix=../
$ make
$ make install

pythonスクリプトの実行にあたり、あなたのシステムの持つCPUのアーキテクチャを表すARCHITECTURE、例えばintel-avx、を指定することが必要です。 ARCHITECTURE'の選択肢は、以下の通りです。

arch Detail Compiler Numerical Library
intel-knl Intel Knights Landing Intel Compiler Intel MKL
intel-knc Intel Knights Corner Intel Compiler Intel MKL
intel-avx Intel Processer (Ivy-, Sandy-Bridge) Intel Compiler Intel MKL
intel-avx2 Intel Processer (Haswell, Broadwell ..) Intel Compiler Intel MKL
fujitsu-fx100 FX100 Supercomputer Fujitsu Compiler SSL-II
fujitsu-k Fujitsu FX100 / K-computer Fujitsu Compiler SSL-II

ビルドに成功すると、salmon/binディレクトリにファイルsalmon.cpuが生成されます。 もしメニーコア・アーキテクチャであるintel-knlまたはintel-kncを指定した場合、ファイルsalmon.mic、または’’salmon.cpusalmon.micの両方が得られます。

単一プロセス計算のためのビルド

標準設定では、pythonスクリプトは並列実行を前提としています。 もし単一プロセスマシンを利用する場合は、pythonスクリプトの実行の際に--disable-mpiを指定してください。

 $ python ../configure.py --arch=<ARCHITECTURE> --disable-mpi

SALMONの実行に必要となるファイル

To run SALMON, at least two kinds of files are required for any calculations. One is an input file with the filename extension *.inp* that should be read from the standard input stdin. This file should be prepared in the Fortran90 namelist format. Pseudopotential files of relevant elements are also required. Depending on your purpose, some other files may also be necessary. For example, coordinates of atomic positions of the target material may be either written in the input file or prepared as a separate file.

擬ポテンシャル

SALMON utilizes norm-conserving pseudpotentials. You may find pseudopotentials of some elements in the samples prepared in Exercises. In SALMON, several formats of pseudopotentials may be usable. Pseudopotentials with an extension .fhi that can be obtained from the website listed below. (This is a part of previous atomic data files for the abinit code.)

pseudopotential website
Pseudopotentials for the ABINIT code https://www.abinit.org/sites/default/files/PrevAtomicData/psp-links/psp-links/lda_fhi

Filenames of the pseudopotentials should be written in the input file.

入力ファイル

Input files are composed of several blocks of namelists,

&namelist1
  variable1 = int_value
  variable2 = 'char_value'
 /
&namelist2
  variable1 = real8_value
  variable2 = int_value1, int_value2, int_value3
/

A block of namelists starts with &namelist line and ends with / line. The blocks may appear in any order.

Between two lines of &namelist and /, descriptions of variables and their values appear. Note that many variables have their default values so that it is not necessary to give values for all variables. Descriptions of the variables may appear at any position if they are between &namelist and /.

SALMON describes electron dynamics in systems with both isolated and periodic boundary conditions. The boundary condition is specified by the variable iperiodic in the namelist &system.

Calculations are usually achieved in two steps; first, the ground state calculation is carried out and then electron dynamics calculations in real time is carried out. A choice of the calculation mode is specified by the variable calc_mode in the namelist &calculation. For isolated systems, the ground state and the electron dynamics calculations should be carried out as two separate executions. First the ground state calculation is carried out specifying calc_mode = 'GS' . Then the real-time electron dynamics calculation is carried out specifying calc_mode = 'RT' . For periodic systems, two calculations should be carried out as a single execution specifying calc_mode = 'GS_RT' .

In Exercises, we prepare six exercises that cover typical calculations feasible by SALMON. We prepare explanations of the input files of the tutorials that will help to prepare input files of your own interests.

There are more than 20 groups of namelists. A complete list of namelist variables is given in the file SALMON/manual/input_variables.md. Namelist variables that are used in our tutorials are explained at Input variables.

SALMONの実行

Before running SALMON, the following preparations are required as described above: The executable file of salmon.cpu (and salmon.mic if your system is the many-core machine) should be built from the source file of SALMON. An input file inputfile.inp and pseudopotential files should also be prepared.

The execution of the calculation can be done as follows: In single process environment, type the following command:

$ salmon.cpu < inputfile.inp > fileout.out

In multiprocess environment in which the command to execute parallel calculations using MPI is mpiexec, type the following command:

$ mpiexec -n NPROC salmon.cpu < inputfile.inp > fileout.out

where NPROC is the number of MPI processes that you will use. In many-core processor (e.g. intel-knl) environment, the execution command is

$ mpiexec.hydra -n NPROC salmon.mic < inputfile.inp > fileout.out

The execution command and the job submission procedure depends much on local environment. We summarize general conditions to execute SALMON:

  • salmon runs in both single-process and multi-process environments using MPI.
  • executable files are prepared as /salmon/bin/salmon.cpu and/or /salmon/bin/salmon.mic in the standard build procedure.
  • to start calculations, inputfile.inp should be read through stdin.

付録

configure.pyスクリプトの付加的な選択肢

コンパイラと環境変数の手動指定

In executing configure.py, you may manually specify compiler and environment variables instead of specifying the architecture, for example:

$ python ../configure.py FC=mpiifort CC=mpiicc FFLAGS="-xAVX" CFLAGS="-restrict -xAVX"

The major options of configure.py are as follows:

Commandline switch Detail
-a ARCH, --arch=ARCH Target architecture
--enable-mpi, --disable-mpi enable/disable MPI parallelization.
---enable-scalapack, --disable-scalapack enable/disable computations with ScaLAPACK library
FC, FFLAGS User-defined Fortran Compiler, and the compiler options
CC, CFLAGS User-defined C Compiler, and the compiler options


単一プロセス計算のためのビルド

If you use a single processor machine, specify --disable-mpi in executing the python script:

 $ python ../configure.py --arch=<ARCHITECTURE> --disable-mpi

GCC/GFortran環境でのビルド

If you use GCC/GFortran compiler, specify the following flags in executing the python script:

$ python ../configure.py FC=gfortran CC=gcc FFLAG=-O3 CFLAG=-O3

GNU Makefileを用いたビルド

If CMake build fails in your environment, we recommend you to try to use Gnu Make for the build process. First, enter the directory makefiles:

$ cd SALMON/makefiles

In the directory, Makefile files are prepared for several architectures:

  • fujitsu
  • gnu
  • gnu-without-mpi
  • intel
  • intel-avx
  • intel-avx2
  • intel-knc
  • intel-knl
  • intel-without-mpi

Makefile files with -without-mpi indicate that they are for single processor environment. Choose Makefile appropriate for your environment, and execute the make command:

$ make -f Makefile.PLATFORM

If the make proceeds successful, a binary file is created in the directory SALMON/bin/.