Commit c26ba8e72d0d3149d72c43e9405f825014e80dcd
1 parent
d55dcfb5ae
Exists in
master
and in
3 other branches
Added a timing test between besrj and bsjn
git-svn-id: https://lxsd.femto-st.fr/svn/fvn@62 b657c933-2333-4658-acf2-d3c7c2708721
Showing 6 changed files with 62 additions and 1 deletions Inline Diff
fvn_test/Makefile
1 | 1 | |||
include $(BTREE)/Make.inc | 2 | 2 | include $(BTREE)/Make.inc | |
3 | 3 | |||
programs = test_fac$(exext) test_matinv$(exext) test_specfunc$(exext) \ | 4 | 4 | programs = test_fac$(exext) test_matinv$(exext) test_specfunc$(exext) \ | |
test_det$(exext) test_matcon$(exext) test_matev$(exext) test_sparse$(exext) test_inter1d$(exext) \ | 5 | 5 | test_det$(exext) test_matcon$(exext) test_matev$(exext) test_sparse$(exext) test_inter1d$(exext) \ | |
test_inter2d$(exext) test_inter3d$(exext) test_akima$(exext) test_lsp$(exext) test_muller$(exext) \ | 6 | 6 | test_inter2d$(exext) test_inter3d$(exext) test_akima$(exext) test_lsp$(exext) test_muller$(exext) \ | |
test_integ$(exext) test_bsyn$(exext) test_bsjn$(exext) test_bskn$(exext) test_bsin$(exext) test_operators$(exext) test_ze1$(exext) \ | 7 | 7 | test_integ$(exext) test_bsyn$(exext) test_bsjn$(exext) test_bskn$(exext) test_bsin$(exext) test_operators$(exext) test_ze1$(exext) \ | |
test_dbesri$(exext) test_dbesrj$(exext) | 8 | 8 | test_besri$(exext) test_besrj$(exext) test_bestime$(exext) | |
9 | 9 | |||
prog:$(programs) | 10 | 10 | prog:$(programs) | |
11 | 11 | |||
clean: | 12 | 12 | clean: | |
rm -f {*.o,*.oo,*.ipo,*.a,*.mod,*.dat} | 13 | 13 | rm -f {*.o,*.oo,*.ipo,*.a,*.mod,*.dat} | |
rm -f $(programs) | 14 | 14 | rm -f $(programs) | |
15 | 15 | |||
%$(exext): %.o | 16 | 16 | %$(exext): %.o |
fvn_test/test_besri.f90
File was created | 1 | program test_dbesri | ||
2 | use fvn_fnlib | |||
3 | implicit none | |||
4 | ! Variables locales ----------------------------- | |||
5 | integer :: i,n,nstep,norder | |||
6 | real(kind=dp_kind), dimension(:), allocatable :: bessvec0 | |||
7 | real(kind=dp_kind), dimension(:,:), allocatable:: bessvec1,bessvec2 | |||
8 | real(kind=dp_kind) :: x,xstep,xmax | |||
9 | ||||
10 | ||||
11 | open (unit=1, file='dbesri.dat') | |||
12 | write (1,*) '# n, x, bsin(n,x), b(n) in dbesri(x,norder+1,b)' | |||
13 | write (1,*) '# arg x from 0 to 20, 201 points' | |||
14 | write (1,*) '# order n from 0 to 20' | |||
15 | ||||
16 | norder = 20 | |||
17 | nstep = 200 | |||
18 | xmax=20.d0 | |||
19 | xstep=xmax/nstep | |||
20 | allocate(bessvec1(0:nstep,0:norder),bessvec2(0:nstep,0:norder)) | |||
21 | allocate(bessvec0(0:norder)) | |||
22 | ||||
23 | do i=0,nstep !loop on x | |||
24 | x=i*xstep | |||
25 | call dbesri(x,norder+1,bessvec0) | |||
26 | bessvec2(i,:)=bessvec0 | |||
27 | do n=0,norder !loop on rank, for dbesjn only | |||
28 | bessvec1(i,n)=bsin(n,x) | |||
29 | enddo | |||
30 | enddo | |||
31 | ||||
32 | do n=0,norder | |||
33 | do i=0,nstep | |||
34 | x=i*xstep | |||
35 | write (1,*) n,x,bessvec1(i,n), bessvec2(i,n) | |||
36 | enddo |
fvn_test/test_besrj.f90
File was created | 1 | program test_dbesrj | ||
2 | use fvn_fnlib | |||
3 | implicit none | |||
4 | ! Variables locales ----------------------------- | |||
5 | integer :: i,n,nstep,norder | |||
6 | real(kind=dp_kind), dimension(:), allocatable :: bessvec0 | |||
7 | real(kind=dp_kind), dimension(:,:), allocatable:: bessvec1,bessvec2 | |||
8 | real(kind=dp_kind) :: x,xstep,xmax | |||
9 | ||||
10 | ||||
11 | open (unit=1, file='dbesrj.dat') | |||
12 | write (1,*) '# n, x, bsjn(n,x), b(n) in dbesrj(x,norder+1,b)' | |||
13 | write (1,*) '# arg x from 0 to 50, 501 points' | |||
14 | write (1,*) '# order n from 0 to 50' | |||
15 | ||||
16 | norder = 50 | |||
17 | nstep = 500 | |||
18 | xmax=50.d0 | |||
19 | xstep=xmax/nstep | |||
20 | allocate(bessvec1(0:nstep,0:norder),bessvec2(0:nstep,0:norder)) | |||
21 | allocate(bessvec0(0:norder)) | |||
22 | ||||
23 | do i=0,nstep !loop on x | |||
24 | x=i*xstep | |||
25 | call dbesrj(x,norder+1,bessvec0) | |||
26 | bessvec2(i,:)=bessvec0 | |||
27 | do n=0,norder !loop on rank, for dbesjn only | |||
28 | bessvec1(i,n)=bsjn(n,x) | |||
29 | enddo | |||
30 | enddo | |||
31 | ||||
32 | do n=0,norder | |||
33 | do i=0,nstep | |||
34 | x=i*xstep | |||
35 | write (1,*) n,x,bessvec1(i,n), bessvec2(i,n) | |||
36 | enddo |
fvn_test/test_bestime.f90
File was created | 1 | program bestime | ||
2 | use fvn_fnlib | |||
3 | implicit none | |||
4 | ||||
5 | real(kind=dp_kind) :: x,xmin,xmax,xstep,t1,t2,bes,b(51) | |||
6 | integer(kind=ip_kind) :: npoints,iter,n,i,it,nn | |||
7 | ||||
8 | ||||
9 | iter=10000 | |||
10 | n=10 | |||
11 | npoints=200 | |||
12 | xmin=-50. | |||
13 | xmax=50. | |||
14 | xstep=(xmax-xmin)/dble(npoints) | |||
15 | ||||
16 | write(*,*) "Computation time comparison between bsjn and besrj" | |||
17 | write(*,*) "bsjn is faster when computing J_n for only one value of n" | |||
18 | write(*,*) "besrj is faster when computing J_n for n=0 to n" | |||
19 | ||||
20 | call cpu_time(t1) | |||
21 | do it=1,iter | |||
22 | do i=1,npoints | |||
23 | x=xmin+i*xstep | |||
24 | do nn=0,n | |||
25 | bes=bsjn(nn,x) | |||
26 | end do | |||
27 | end do | |||
28 | end do | |||
29 | call cpu_time(t2) | |||
30 | write (*,'("Calculating "(I10)" values of J_n for n=0 to "(I3)" with bsjn :")') iter*npoints,n | |||
31 | write(*,*) t2-t1 | |||
32 | ||||
33 | call cpu_time(t1) | |||
34 | do it=1,iter | |||
35 | do i=1,npoints | |||
36 | x=xmin+i*xstep | |||
37 | bes=bsjn(n,x) | |||
38 | end do | |||
39 | end do | |||
40 | call cpu_time(t2) | |||
41 | write (*,'("Calculating "(I10)" values of J_n for n="(I3)" with bsjn :")') iter*npoints,n | |||
42 | write(*,*) t2-t1 | |||
43 | ||||
44 | ||||
45 | ! Calcultate J_n(x) on 200 points for n=0 to 50 with besrj | |||
46 | ! do it iter times to have a sufficient time value | |||
47 | call cpu_time(t1) | |||
48 | do it=1,iter | |||
49 | do i=1,npoints |
fvn_test/test_dbesri.f90
program test_dbesri | 1 | File was deleted | ||
use fvn_fnlib | 2 | |||
implicit none | 3 | |||
! Variables locales ----------------------------- | 4 | |||
integer :: i,n,nstep,norder | 5 | |||
real(kind=dp_kind), dimension(:), allocatable :: bessvec0 | 6 | |||
real(kind=dp_kind), dimension(:,:), allocatable:: bessvec1,bessvec2 | 7 | |||
real(kind=dp_kind) :: x,xstep,xmax | 8 | |||
9 | ||||
10 | ||||
open (unit=1, file='dbesri.dat') | 11 | |||
write (1,*) '# n, x, bsin(n,x), b(n) in dbesri(x,norder+1,b)' | 12 | |||
write (1,*) '# arg x from 0 to 20, 201 points' | 13 | |||
write (1,*) '# order n from 0 to 20' | 14 | |||
15 | ||||
norder = 20 | 16 | |||
nstep = 200 | 17 | |||
xmax=20.d0 | 18 | |||
xstep=xmax/nstep | 19 | |||
allocate(bessvec1(0:nstep,0:norder),bessvec2(0:nstep,0:norder)) | 20 | |||
allocate(bessvec0(0:norder)) | 21 | |||
22 | ||||
do i=0,nstep !loop on x | 23 | |||
x=i*xstep | 24 | |||
call dbesri(x,norder+1,bessvec0) | 25 | |||
bessvec2(i,:)=bessvec0 | 26 | |||
do n=0,norder !loop on rank, for dbesjn only | 27 | |||
bessvec1(i,n)=bsin(n,x) | 28 | |||
enddo | 29 | |||
enddo | 30 | |||
31 | ||||
do n=0,norder | 32 | |||
do i=0,nstep | 33 | |||
x=i*xstep | 34 | |||
write (1,*) n,x,bessvec1(i,n), bessvec2(i,n) | 35 | |||
enddo | 36 |
fvn_test/test_dbesrj.f90
program test_dbesrj | 1 | File was deleted | ||
use fvn_fnlib | 2 | |||
implicit none | 3 | |||
! Variables locales ----------------------------- | 4 | |||
integer :: i,n,nstep,norder | 5 | |||
real(kind=dp_kind), dimension(:), allocatable :: bessvec0 | 6 | |||
real(kind=dp_kind), dimension(:,:), allocatable:: bessvec1,bessvec2 | 7 | |||
real(kind=dp_kind) :: x,xstep,xmax | 8 | |||
9 | ||||
10 | ||||
open (unit=1, file='dbesrj.dat') | 11 | |||
write (1,*) '# n, x, bsjn(n,x), b(n) in dbesrj(x,norder+1,b)' | 12 | |||
write (1,*) '# arg x from 0 to 50, 501 points' | 13 | |||
write (1,*) '# order n from 0 to 50' | 14 | |||
15 | ||||
norder = 50 | 16 | |||
nstep = 500 | 17 | |||
xmax=50.d0 | 18 | |||
xstep=xmax/nstep | 19 | |||
allocate(bessvec1(0:nstep,0:norder),bessvec2(0:nstep,0:norder)) | 20 | |||
allocate(bessvec0(0:norder)) | 21 | |||
22 | ||||
do i=0,nstep !loop on x | 23 | |||
x=i*xstep | 24 | |||
call dbesrj(x,norder+1,bessvec0) | 25 | |||
bessvec2(i,:)=bessvec0 | 26 | |||
do n=0,norder !loop on rank, for dbesjn only | 27 | |||
bessvec1(i,n)=bsjn(n,x) | 28 | |||
enddo | 29 | |||
enddo | 30 | |||
31 | ||||
do n=0,norder | 32 | |||
do i=0,nstep | 33 | |||
x=i*xstep | 34 | |||
write (1,*) n,x,bessvec1(i,n), bessvec2(i,n) | 35 | |||
enddo | 36 |