在配置和构建 PETSc 之后,我已经成功地运行了几个示例。特别是,我正在使用这个示例。我已经能够使用以下命令运行该程序:
使 ex2 mpiexec -n 4 ./ex2 -m 40 -n 40
产生以下输出:
Norm of error 0.000642883 iterations 26
Norm of error 0.000642883 iterations 26
Norm of error 0.000642883 iterations 26
Norm of error 0.000642883 iterations 26
这似乎告诉我,同一个问题被解决了 4 次,而不是由四个并行处理器解决一次。可疑,我再次使用
mpiexec -n 4 ./ex2 -m 40 -n 40 -log_summary
它产生了以下输出(请注意,它表示 ./ex2 仅使用 1 个处理器运行:
Norm of error 0.000642883 iterations 26
************************************************************************************************************************
*** WIDEN YOUR WINDOW TO 120 CHARACTERS. Use 'enscript -r -fCourier9' to print this document ***
************************************************************************************************************************
---------------------------------------------- PETSc Performance Summary: ----------------------------------------------
./ex2 on a petsc-arc named utepgeon01.utep.edu with 1 processor, by pmdelgado2 Tue Jan 24 22:16:23 2012
Using Petsc Release Version 3.2.0, Patch 6, Wed Jan 11 09:28:45 CST 2012
Max Max/Min Avg Total
Time (sec): 6.203e-02 1.00000 6.203e-02
Objects: 4.500e+01 1.00000 4.500e+01
Flops: 3.230e+06 1.00000 3.230e+06 3.230e+06
Flops/sec: 5.207e+07 1.00000 5.207e+07 5.207e+07
Memory: 7.996e+05 1.00000 7.996e+05
MPI Messages: 0.000e+00 0.00000 0.000e+00 0.000e+00
MPI Message Lengths: 0.000e+00 0.00000 0.000e+00 0.000e+00
MPI Reductions: 4.730e+02 1.00000
我知道我正在使用的计算机有 4 个处理器(键入后grep processor /proc/cpuinfo)。检查我的 reconfigure-petsc-arch.py 文件后,我看到以下内容:
#!/usr/bin/python
if __name__ == '__main__':
import sys
import os
sys.path.insert(0, os.path.abspath('config'))
import configure
configure_options = [
'--download-f-blas-lapack=1',
'--download-mpich=1',
'--with-cc=gcc',
'--with-fc=gfortran',
'PETSC_ARCH=petsc-arch',
]
configure.petsc_configure(configure_options)
我还需要做些什么来分配并行求解线性系统的工作吗?