高性能计算程序示例之24
源代码在线查看: readme.txt
1. compile:
mpicc cjacobi.c -o cjacobi -lm
2. run:
mpirun -np 4 cjacobi
3. result:
Input of file "dataIn.txt"
8 8
1.000000 3.000000 4.000000 4.000000 5.000000 6.000000 7.000000 8.000000
3.000000 1.000000 2.000000 2.000000 3.000000 4.000000 5.000000 6.000000
4.000000 2.000000 1.000000 2.000000 3.000000 3.000000 2.000000 1.000000
1.000000 2.000000 3.000000 4.000000 4.000000 6.000000 7.000000 8.000000
4.000000 5.000000 5.000000 6.000000 7.000000 8.000000 1.000000 1.000000
2.000000 2.000000 2.000000 3.000000 4.000000 5.000000 7.000000 3.000000
2.000000 4.000000 5.000000 7.000000 9.000000 0.000000 2.000000 3.000000
1.000000 2.000000 4.000000 6.000000 2.000000 7.000000 8.000000 1.000000
the 0st envalue:-5.539342
the 1st envalue:9.369179
the 2st envalue:2.678424
the 3st envalue:0.378010
the 4st envalue:30.210718
the 5st envalue:-1.180327
the 6st envalue:-10.858351
the 7st envalue:-3.058303
Iteration num = 4
Whole running time = 0.142161 seconds
Distribute data time = 0.003757 seconds
Parallel compute time = 0.132369 seconds