0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mac Studio M2 Ultra に GROMACS 2023.4 を Install

Last updated at Posted at 2024-02-26

はじめに

  • 重たい計算が増えたので GPU を使いたい.
  • MacOS でも GROMACS の GPU が使いやすそうになった?ぽい.
  • そこで、GROMACS 2023.4 をソースからインストールしてみる.
  • Mac Studio M2 Ultra と ついでに Mac mini M2 にインストールしてみる.
  • こちらは自分用の備忘録なので、参考にする場合は自己責任でお願いします.
  • Mac Studio の性能を最大限に引き出せているかは謎...

インストール環境

  • Mac Studio (M2, 2023) Apple M2 Ultra 128 GB macOS Ventura 13.6.4
  • Mac mini (M2, 2023) Apple M2 16 GB macOS Sonoma 14.3.1

使用したもの

  • Xcode 15.2
  • Homebrew

Homebrew で必要なものをインストールする

brew install hwloc libomp opencl-headers llvm

色々と入れていたものもあるので足りない場合は、必要に応じて入れる.

clang のシンボリックリンクを作成する

sudo ln -sf /opt/homebrew/opt/llvm/bin/clang /usr/local/bin/clang
sudo ln -sf /opt/homebrew/opt/llvm/bin/clang++ /usr/local/bin/clang++

ターミナルを再起動し clang, clang++ のバージョンを確認

clang -v
---
Homebrew clang version 17.0.6
Target: arm64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /usr/local/bin

clang++ -v
---
Homebrew clang version 17.0.6
Target: arm64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /usr/local/bin

※ 2024.2.26 時点のバージョン

GROMACS 2023.4 をソースからビルドする

  • 本家から gromacs-2023.4.tar.gz をダウンロードする.
cd
cd Downloads
tar xvzf gromacs-2023.4.tar.gz
mkdir build
cd build
cmake ../ -DGMX_SIMD=ARM_NEON_ASIMD -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DGMX_MPI=OFF -DGMX_OPENMP=ON -DGMX_GPU=OpenCL -DBUILD_SHARED_LIBS=OFF -DGMX_HWLOC=ON -DCMAKE_INSTALL_PREFIX=/Users/${USER}/programs/mdprg/gromacs-2023.4_gpu -DREGRESSIONTEST_PATH=/Users/${USER}/programs/mdprg/regressiontests-2023.4
make -j4 check
make install

※ 事前に REGRESSIONTEST をダウンロードして、以下に解凍しています.
/Users/${USER}/programs/mdprg/regressiontests-2023.4
面倒くさい人は、 -DREGRESSIONTEST_DOWNLOAD=ON にする

PATH を通しておく

vi .bashrc
---
## GROMACS-2023.X SETTINGS
 source /Users/${USER}/programs/mdprg/gromacs-2023.4_gpu/bin/GMXRC

バージョン情報の確認

gmx --version
---
GROMACS version:    2023.4
Precision:          mixed
Memory model:       64 bit
MPI library:        thread_mpi
OpenMP support:     enabled (GMX_OPENMP_MAX_THREADS = 128)
GPU support:        OpenCL
NB cluster size:    8
SIMD instructions:  ARM_NEON_ASIMD
CPU FFT library:    fftw-3.3.8
GPU FFT library:    VkFFT internal (1.2.26-b15cb0ca3e884bdb6c901a12d87aa8aadf7637d8) with OpenCL backend
Multi-GPU FFT:      none
TNG support:        enabled
Hwloc support:      hwloc-2.10.0
Tracing support:    disabled
C compiler:         /usr/local/bin/clang Clang 17.0.6
C compiler flags:   -Wno-missing-field-initializers -O3 -DNDEBUG
C++ compiler:       /usr/local/bin/clang++ Clang 17.0.6
C++ compiler flags: -Wno-reserved-identifier -Wno-missing-field-initializers -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-source-uses-openmp -Wno-c++17-extensions -Wno-documentation-unknown-command -Wno-covered-switch-default -Wno-switch-enum -Wno-extra-semi-stmt -Wno-weak-vtables -Wno-shadow -Wno-padded -Wno-reserved-id-macro -Wno-double-promotion -Wno-exit-time-destructors -Wno-global-constructors -Wno-documentation -Wno-format-nonliteral -Wno-used-but-marked-unused -Wno-float-equal -Wno-conditional-uninitialized -Wno-conversion -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-unsafe-buffer-usage -Wno-unused-parameter -Wno-unused-variable -Wno-newline-eof -Wno-old-style-cast -Wno-zero-as-null-pointer-constant -Wno-unused-but-set-variable -Wno-sign-compare -Wno-cast-function-type-strict SHELL:-fopenmp=libomp -O3 -DNDEBUG
BLAS library:       External - detected on the system
LAPACK library:     External - detected on the system
OpenCL include dir: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/OpenCL.framework
OpenCL library:     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/OpenCL.framework

終わりに

  • これまでは倍精度を使っていた(汗)ので計算速度はかなり速くなった.
  • 体感としては 3 倍近く早くなった? 気がする.
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?