Bootstrap: docker
From: ubuntu:22.04
%environment
export INTEL_MPI_DIR="/tmp/intel"
export INCLUDE_DIR="$INTEL_MPI_DIR/include"
export LIB_DIR="$INTEL_MPI_DIR/lib"
%post -c /bin/bash
export DEBIAN_FRONTEND=noninteractive
export TZ=Etc/UTC
# Install necessary dependencies
apt update && apt upgrade -y
apt install -y build-essential wget gfortran cmake unzip gcc g++ libgcc-10-dev libx11-dev libxext-dev libxft-dev libxmu-dev libboost-all-dev libquadmath0
source /tmp/intel/oneapi/setvars.sh
wget https://www.ssisc.org/lis/dl/lis-2.1.7.zip -O /tmp/lis-2.1.7.zip
unzip /tmp/lis-2.1.7.zip -d /tmp/
cd /tmp/lis-2.1.7
./configure --prefix=/usr/local --enable-f90 --enable-mpi --enable-shared --enable-saamg --enable-quad --enable-sse2 --enable-fma 'CFLAGS=-O3 -march=x86-64 -mtune=generic -frounding-math -fsignaling-nans' 'FCFLAGS=-O3 -march=x86-64 -mtune=generic -frounding-math -fsignaling-nans'
make
make check
make install
建造的
(base) bash-4.4$ apptainer build --bind /opt/intel:/tmp/intel min_example.sif min_example.def
im在Quad Precision(我需要的)中遇到特定问题。当它到达构建的制作检查部分时
=== Running test test.sh
checking linear solvers...
number of processes = 2
matrix size = 100 x 100 (460 nonzero entries)
initial vector x : all components set to 0
precision : double
linear solver : BiCG
preconditioner : none
convergence condition : ||b-Ax||_2 <= 1.0e-12 * ||b-Ax_0||_2
matrix storage format : CSR
linear solver status : normal end
BiCG: number of iterations = 15
BiCG: double = 15
BiCG: quad = 0
BiCG: elapsed time = 1.502484e-04 sec.
BiCG: preconditioner = 1.370907e-06 sec.
BiCG: matrix creation = 2.086163e-07 sec.
BiCG: linear solver = 1.488775e-04 sec.
BiCG: relative residual = 2.035749e-16
checking eigensolvers...
number of processes = 2
matrix size = 100 x 100 (460 nonzero entries)
initial vector x : all components set to 1
precision : double
eigensolver : CR
convergence condition : ||lx-(B^-1)Ax||_2 <= 1.0e-12 * ||lx||_2
matrix storage format : CSR
shift : 0.000000e+00
linear solver : BiCG
preconditioner : none
eigensolver status : normal end
CR: mode number = 0
CR: eigenvalue = 1.620281e-01
CR: number of iterations = 45
CR: elapsed time = 1.337633e-03 sec.
CR: preconditioner = 2.384186e-07 sec.
CR: matrix creation = 2.384186e-07 sec.
CR: linear solver = 1.117587e-05 sec.
CR: relative residual = 5.478047e-13
checking Fortran interface...
number of processes = 2
initial vector x : all components set to 0
precision : double
linear solver : BiCG
preconditioner : none
convergence condition : ||b-Ax||_2 <= 1.0e-12 * ||b-Ax_0||_2
matrix storage format : CSR
linear solver status : normal end
number of iterations = 6
1 1.000000e+00
2 1.000000e+00
3 1.000000e+00
4 1.000000e+00
5 1.000000e+00
6 1.000000e+00
7 1.000000e+00
8 1.000000e+00
9 1.000000e+00
10 1.000000e+00
11 1.000000e+00
12 1.000000e+00
checking double-double precision operations...
number of processes = 2
n = 200, gamma = 2.000000
initial vector x : all components set to 0
precision : double
linear solver : BiCG
preconditioner : none
convergence condition : ||b-Ax||_2 <= 1.0e-12 * ||b-Ax_0||_2
matrix storage format : CSR
linear solver status : LIS_MAXITER(code=4)
BiCG: number of iterations = 1001
BiCG: double = 1001
BiCG: quad = 0
BiCG: elapsed time = 6.739244e-03 sec.
BiCG: preconditioner = 1.043081e-07 sec.
BiCG: matrix creation = 1.043081e-07 sec.
BiCG: linear solver = 6.739140e-03 sec.
BiCG: relative residual = 1.159273e+00
number of processes = 2
n = 200, gamma = 2.000000
lis_solver.c(527) : lis_solve_kernel : error ILL_ARG :Quad precision is not enabled
checking SAAMG preconditioner...
number of processes = 2
matrix size = 100 x 100 (460 nonzero entries)
initial vector x : all components set to 0
precision : double
linear solver : CG
preconditioner : SAAMG
convergence condition : ||b-Ax||_2 <= 1.0e-12 * ||b-Ax_0||_2
matrix storage format : CSR
linear solver status : normal end
CG: number of iterations = 15
CG: double = 15
CG: quad = 0
CG: elapsed time = 1.426786e-04 sec.
CG: preconditioner = 1.490116e-06 sec.
CG: matrix creation = 2.235174e-07 sec.
CG: linear solver = 1.411885e-04 sec.
CG: relative residual = 2.177091e-16
PASS: test.sh
=============
1 test passed
请参阅错误代码lis_solver.c(527):lis_solve_kernel:错误ill_arg:未启用Quad Precision 我尝试了一堆不同的配置变体,并与Ubuntu:20.04一起运行,没有成功。让我知道是否有人有任何想法!
错误指示LIS库不是在Quad Precision支持的情况下构建的,即使您在
lis_solver.c(527) : lis_solve_kernel : error ILL_ARG : Quad precision is not enabled
命令中包括了--enable-quad
标志。由于缺少依赖关系或不正确的配置,可能会出现此问题。这是解决问题和解决问题的分步指南:
1。验证Quad Precision依赖项
LIS中的四分之一的精度支持需要特定的库和编译器支持。确保已安装以下依赖关系:libquadmath:此库提供Quad-precision Math函数。 GCC带有四边形精度支持:确保您的GCC版本支持Quad Precision(
./configure
)。
__float128
部分以安装以下依赖项:
%post
apt install -y libquadmath0 libquadmath-dev gcc gfortran
--enable-quad
)。
修改您的
-lquadmath
./configure
运行后,请检查输出以确保启用四边形精度支持。寻找类似:
./configure --prefix=/usr/local --enable-f90 --enable-mpi --enable-shared --enable-saamg --enable-quad --enable-sse2 --enable-fma \
'CFLAGS=-O3 -march=x86-64 -mtune=generic -frounding-math -fsignaling-nans -lquadmath' \
'FCFLAGS=-O3 -march=x86-64 -mtune=generic -frounding-math -fsignaling-nans -lquadmath'
如果说
./configure
,配置或依赖项存在问题。
4。调试构建过程如果仍未启用Quad Precision,则可以调试构建过程:
检查:运行
checking for quad-precision support... yes
后,检查no
config.log
或
./configure
的行。
config.log
手动测试QuadPrecision:通过编译小型测试程序来验证您的编译器是否支持Quad Precision:
quad
__float128
there是更新的容器定义文件,具有必要的更改:
grep -i quad /tmp/lis-2.1.7/config.log
grep -i float128 /tmp/lis-2.1.7/config.log
6。构建容器用更新的定义文件重新构建容器:echo -e '#include <quadmath.h>\nint main() { __float128 x = 1.0Q; return 0; }' > test.c
gcc -o test test.c -lquadmath
./test
7。验证容器中的Quad精度
构建容器后,验证Quad Precision已启用:
libquadmath
运行一个测试程序以检查四方精度支持:
Bootstrap: docker
From: ubuntu:22.04
%environment
export INTEL_MPI_DIR="/tmp/intel"
export INCLUDE_DIR="$INTEL_MPI_DIR/include"
export LIB_DIR="$INTEL_MPI_DIR/lib"
%post -c /bin/bash
export DEBIAN_FRONTEND=noninteractive
export TZ=Etc/UTC
# Install necessary dependencies
apt update && apt upgrade -y
apt install -y build-essential wget gfortran cmake unzip gcc g++ libgcc-10-dev libx11-dev libxext-dev libxft-dev libxmu-dev libboost-all-dev libquadmath0 libquadmath-dev
source /tmp/intel/oneapi/setvars.sh
# Download and build LIS
wget https://www.ssisc.org/lis/dl/lis-2.1.7.zip -O /tmp/lis-2.1.7.zip
unzip /tmp/lis-2.1.7.zip -d /tmp/
cd /tmp/lis-2.1.7
./configure --prefix=/usr/local --enable-f90 --enable-mpi --enable-shared --enable-saamg --enable-quad --enable-sse2 --enable-fma \
'CFLAGS=-O3 -march=x86-64 -mtune=generic -frounding-math -fsignaling-nans -lquadmath' \
'FCFLAGS=-O3 -march=x86-64 -mtune=generic -frounding-math -fsignaling-nans -lquadmath'
make
make check
make install
如果成功运行,则启用了四边形精度。
运行容器内的LIS测试,以确保四边形精度正常:
apptainer build --bind /opt/intel:/tmp/intel min_example.sif min_example.def
安装
apptainer shell min_example.sif
和echo -e '#include <quadmath.h>\n#include <stdio.h>\nint main() { __float128 x = 1.0Q; printf("Quad precision supported!\\n"); return 0; }' > test.c
gcc -o test test.c -lquadmath
./test
确保编译器支持四边形精度(
cd /tmp/lis-2.1.7
make check
lis_solver.c(527)
输出中启用了。
使用libquadmath
重新建立容器并验证Quad Precision支持。