Mac PETSc のインストール

brew install petsc でもインストールできるのだが,それだと Ubuntu と同じで GeoClaw の Boussinesq モデルを回す時にうまくいかなかったので.

要件

brew install で入れた openblas と lapack を見つけてもらうために環境変数を定義しておく.

## OpenBLAS
export CPATH="/opt/homebrew/opt/openblas/include:$CPATH"
export DYLD_LIBRARY_PATH="/opt/homebrew/opt/openblas/lib:$DYLD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig:$PKG_CONFIG_PATH"
## LAPACK
export CPATH="/opt/homebrew/opt/lapack/include:$CPATH"
export DYLD_LIBRARY_PATH="/opt/homebrew/opt/lapack/lib:$DYLD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/lapack/lib/pkgconfig:$PKG_CONFIG_PATH"

CPATH とか DYLD_LIBRARY_PATH まで広範に定義しておきたくなければ LDFLAGS と CPPFLAGS にしておく.

export LDFLAGS="-L/opt/homebrew/opt/lapack/lib"
export CPPFLAGS="-I/opt/homebrew/opt/lapack/include"


petsc-3.24.0

PETSC_ARCH が違うだけで Ubuntu でやった方法と同じ.

wget https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-3.24.0.tar.gz
tar zxvf petsc-3.24.0.tar.gz
cd petsc-3.24.0
./configure --prefix="$HOME/local/src/petsc"
make PETSC_DIR="$HOME/local/src/petsc-3.24.0" PETSC_ARCH=arch-darwin-c-debug all
make PETSC_DIR="$HOME/local/src/petsc-3.24.0" PETSC_ARCH=arch-darwin-c-debug install

Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2025-10-04 (Sat) 07:12:17 (44d)