1) ダウンロード、解凍
少し
ディレクトリを取得: hypre-master
ソースファイルはsrcディレクトリの下にあります
src には次のディレクトリが含まれます。
2) cmakeコンパイル
新しいバージョン
HYPRE_RELEASE_NAME = hypre
HYPRE_RELEASE_VERSION = 2.26.0
HYPRE_RELEASE_DATE = 2022/10/14
HYPRE_RELEASE_TIME = 00:00:00
HYPRE_RELEASE_BUGS = https://github.com/hypre-space/hypre/issues
。/構成、設定
cd cmbuild
cmake ..
作る
生成される:
6564172 11 月 28 日 11:30 libHYPRE.a
3) サンプルをコンパイルする
cd hypre-master/src/test
間違いを犯す
/thfs1/software/spack/optv018/linux-ubuntu20.04-aarch64/gcc-8.5.0/gcc-9.3.0-g3g7tub/bin/gcc -O2 -DHAVE_CONFIG_H -I. -I/thfs1/home/monkeycode/tianya/software/hypre-master/src/hypre/include -I/thfs1/software/mpich/mpi-n-gcc9.3.0/include -DHYPRE_TIMING -DHYPRE_FORTRAN -c zboxloop.c -o zboxloop.obj
zboxloop.c:17:10: fatal error: _hypre_struct_mv.hpp: No such file or directory
17 | #include "_hypre_struct_mv.hpp"
/thfs1/software/spack/optv018/linux-ubuntu20.04-aarch64/gcc-8.5.0/gcc-9.3.0-g3g7tub/bin/gcc -O2 -DHAVE_CONFIG_H -I. -I/thfs1/home/***/hypre-master/src/hypre/include -I/thfs1/software/mpich/mpi-n-gcc9.3.0/include -DHYPRE_TIMING -DHYPRE_FORTRAN -c sstruct.c
In file included from sstruct.c:14:
/thfs1/home/***/hypre-master/src/hypre/include/HYPRE_sstruct_ls.h:14:10: fatal error: HYPRE_sstruct_mv.h: No such file or directory
14 | #include "HYPRE_sstruct_mv.h"
MPI ヘッダーがない場合:
/thfs1/home/***/software/hypre-master/src/hypre/include/HYPRE_utilities.h:20:10: fatal error: mpi.h: No such file or directory
20 | #include "mpi.h"
| ^~~~~~~
mpiライブラリをリンクしていません
/thfs1/software/spack/optv018/linux-ubuntu20.04-aarch64/gcc-8.5.0/gcc-9.3.0-g3g7tub/bin/gcc -o ij ij.o -L/thfs1/home/***/hypre-master/src/hypre/lib -lHYPRE -Wl,-rpath,/thfs1/home/***/hypre-master/src/hypre/lib -lm
/usr/bin/ld: /thfs1/home/***/hypre-master/src/hypre/lib/libHYPRE.a(mpistubs.c.o): in function `hypre_MPI_Init':
mpistubs.c:(.text+0x8): undefined reference to `MPI_Init'
/usr/bin/ld: /thfs1/home/***/hypre-master/src/hypre/lib/libHYPRE.a(mpistubs.c.o): in function `hypre_MPI_Finalize':
mpistubs.c:(.text+0x10): undefined reference to `MPI_Finalize'
pcg.c:(.text+0x8b4): undefined reference to `pow'
/usr/bin/ld: pcg.c:(.text+0xc00): undefined reference to `sqrt'
/usr/bin/ld: pcg.c:(.text+0xf28): undefined reference to `sqrt'
/usr/bin/ld: pcg.c:(.text+0xf48): undefined reference to `sqrt'
/usr/bin/ld: pcg.c:(.text+0xf58): undefined reference to `sqrt'
罪はありますが、そうではありません
解決:
config/Makefile.configを変更する
107 ##################################################################
108 ## MPI options
109 ##################################################################
110 MPIINCLUDE = -I/thfs1/software/mpich/mpi-n-gcc9.3.0/include
111 MPILIBDIRS = -I/thfs1/software/mpich/mpi-n-gcc9.3.0/lib
112 MPILIBS = -lmpi
113 MPIFLAGS =
以上がmpiヘッダファイル、ライブラリ、リンク関数等です。
-lmを追加しました
Hypre 自体のヘッダー ファイルが欠落しているため、この config/Makefile.config も設定する必要がある場合があります。
による -I/thfs1/home/***/hypre-master/src/hypre/include
そこで、さまざまな .h と .hpp をすべて /thfs1/home/***/hypre-master/src/hypre/include ディレクトリにコピーします。
4)
作る
生成されたさまざまな実行可能ファイル
実行 ./ij_mm
出力は問題ありません
CPU #OMP THREADS 1
Laplacian: num_fun = 1
(nx, ny, nz) = (10, 10, 10)
(Px, Py, Pz) = (1, 1, 1)
(cx, cy, cz) = (1.000000, 1.000000, 1.000000)
=============================================
Generate Matrices:
=============================================
Generate Matrices:
wall clock time = 0.000380 seconds
wall MFLOPS = 0.000000
cpu clock time = 0.000380 seconds
cpu MFLOPS = 0.000000
A 1000 x 1000, NNZ 6400, RNZ 6
--- rep 0 (out of 10) ---
--- rep 1 (out of 10) ---
--- rep 2 (out of 10) ---
--- rep 3 (out of 10) ---
--- rep 4 (out of 10) ---
--- rep 5 (out of 10) ---
--- rep 6 (out of 10) ---
--- rep 7 (out of 10) ---
--- rep 8 (out of 10) ---
--- rep 9 (out of 10) ---
=============================================
Device Parcsr Matrix-by-Matrix, A*A:
=============================================
Device Parcsr Matrix-by-Matrix, A*A:
wall clock time = 0.000360 seconds
wall MFLOPS = 0.000000
cpu clock time = 0.000361 seconds
cpu MFLOPS = 0.000000
B 1000 x 1000, NNZ 20920, RNZ 20
./struct
Using HYPRE_RELEASE_VERSION: 2.26.0
Running with these driver parameters:
(nx, ny, nz) = (10, 10, 10)
(istart[0],istart[1],istart[2]) = (-3, -3, -3)
(Px, Py, Pz) = (1, 1, 1)
(bx, by, bz) = (1, 1, 1)
(px, py, pz) = (0, 0, 0)
(cx, cy, cz) = (1.000000, 1.000000, 1.000000)
(conx,cony,conz)= (0.000000, 0.000000, 0.000000)
(n_pre, n_post) = (1, 1)
dim = 3
skip = 0
sym = 1
rap = 0
relax = 1
jump = 0
solver ID = 0
=============================================
Struct Interface:
=============================================
Struct Interface:
wall clock time = 0.000384 seconds
wall MFLOPS = 0.000000
cpu clock time = 0.000385 seconds
cpu MFLOPS = 0.000000
=============================================
Setup phase times:
=============================================
SMG Setup:
wall clock time = 0.009755 seconds
wall MFLOPS = 0.000000
cpu clock time = 0.009758 seconds
cpu MFLOPS = 0.000000
=============================================
Solve phase times:
=============================================
SMG Solve:
wall clock time = 0.011196 seconds
wall MFLOPS = 0.000000
cpu clock time = 0.011011 seconds
cpu MFLOPS = 0.000000
Iterations = 5
Final Relative Residual Norm = 1.375560e-07
見た目は大丈夫です。