天河超算,安装Hypre

1)下载,解压

得到目录:hypre-master

源文件在src目录下面

src包含如下目录:

天河超算,安装Hypre_第1张图片 

 

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

./configure

cd cmbuild

cmake ..

make

生成了:

 6564172 Nov 28 11:30 libHYPRE.a
 

3)编译例子

cd hypre-master/src/test

make会出错

/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'

还有sin, cos没有的

解决方法:

修改 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去cp到/thfs1/home/***/hypre-master/src/hypre/include 这个目录下。

4)

make

生成了各种可执行文件

天河超算,安装Hypre_第2张图片

 

运行./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

看起来没有问题。

你可能感兴趣的:(linux,运维,服务器)