root / synthbench / euroben-dm / mod2ci / .svn / text-base / nrm2.f.svn-base @ 0:839f52ef7657
History | View | Annotate | Download (735 Bytes)
1 |
Function nrm2( n, x ) Result( sum ) |
---|---|
2 |
! --------------------------------------------------------------------- |
3 |
Use numerics |
4 |
Use floptime |
5 |
Use mpi_module |
6 |
Implicit None |
7 |
|
8 |
Integer :: n |
9 |
Real(l_) :: x(n) |
10 |
|
11 |
Integer :: i |
12 |
Real(l_) :: lsum, sum |
13 |
! --------------------------------------------------------------------- |
14 |
lsum = 0.0_l_ |
15 |
Do i = 1, n |
16 |
lsum = lsum + x(i)*x(i) |
17 |
End Do |
18 |
Call MPI_Allreduce( lsum, sum, 1, rtyp, MPI_Sum, comm, ierr ) |
19 |
flops = flops + 2*n ! --- Keep track of flops. |
20 |
! --------------------------------------------------------------------- |
21 |
End Function nrm2 |