diff --git a/test/hello/Makefile b/test/hello/Makefile new file mode 100644 index 00000000..a2961e75 --- /dev/null +++ b/test/hello/Makefile @@ -0,0 +1,39 @@ +BASEDIR=../.. +INCDIR=$(BASEDIR)/include +include $(INCDIR)/Make.inc.psblas +# +# Libraries used +LIBDIR=$(BASEDIR)/lib +PSBLAS_LIB= -L$(LIBDIR) -lpsb_util -lpsb_krylov -lpsb_prec -lpsb_base +LDLIBS=$(PSBLDLIBS) +# +# Compilers and such +# +CCOPT= -g +FINCLUDES=$(FMFLAG)$(INCDIR) $(FMFLAG). + + +EXEDIR=./runs + +all: hello pingpong + +hello: hello.o + $(F90LINK) hello.o -o hello $(PSBLAS_LIB) $(LDLIBS) + /bin/mv hello $(EXEDIR) + +pingpong: pingpong.o + $(F90LINK) pingpong.o -o pingpong $(PSBLAS_LIB) $(LDLIBS) + /bin/mv pingpong $(EXEDIR) + + + +clean: + /bin/rm -f hello.o pingpong.o + $(EXEDIR)/hello +verycleanlib: + (cd ../..; make veryclean) +lib: + (cd ../../; make library) + + + diff --git a/test/hello/hello.f90 b/test/hello/hello.f90 new file mode 100644 index 00000000..f84de007 --- /dev/null +++ b/test/hello/hello.f90 @@ -0,0 +1,21 @@ +program hello + use psb_base_mod + implicit none + integer iam, np, icontxt, ip, jp, idummy + + call psb_init(icontxt) + call psb_info(icontxt,iam,np) + ! have all processes check in + if ((iam >= 0).and.(iam < np)) then + if (iam == 0) then + do ip = 1, np-1 + call psb_rcv(icontxt,idummy,ip) + enddo + write(*,*) 'Hello, world: all ',np, & + & ' processes checked in!' + else + call psb_snd(icontxt,idummy,0) + endif + end if + call psb_exit(icontxt) +end program hello diff --git a/test/hello/pingpong.f90 b/test/hello/pingpong.f90 new file mode 100644 index 00000000..1415b996 --- /dev/null +++ b/test/hello/pingpong.f90 @@ -0,0 +1,49 @@ +program pingpong + use psb_base_mod + implicit none + integer(psb_ipk_) :: iam, np, icontxt, ip, jp, idummy + integer(psb_ipk_), parameter :: nmax=2**16 + integer(psb_ipk_) :: i,j,k,n + real(psb_dpk_) :: v(nmax) + real(psb_dpk_) :: t0, t1, t2, mbs, bytes + + + call psb_init(icontxt) + call psb_info(icontxt,iam,np) + ! have all processes check in + if ((iam >= 0).and.(iam < np)) then + if (iam == 0) then + do ip = 1, np-1 + call psb_rcv(icontxt,idummy,ip) + enddo + write(*,*) 'Hello, world: all ',np, & + & ' processes checked in!' + else + call psb_snd(icontxt,idummy,0) + endif + end if + + n = 1 + call psb_barrier(icontxt) + if (iam == 0) then + do i=1, 16 + t0 = psb_wtime() + call psb_snd(icontxt,v(1:n),1) + call psb_rcv(icontxt,v(1:n),1) + t1 = psb_wtime() + bytes = done*n*psb_sizeof_dp + mbs = 2.d0*(bytes/(t1-t0))*1.d-6 + write(*,*) 'pingpong: ',n,bytes,mbs + n = n * 2 + end do + else if (iam == 1) then + do i=1, 16 + call psb_rcv(icontxt,v(1:n),0) + call psb_snd(icontxt,v(1:n),0) + n = n * 2 + end do + end if + + call psb_barrier(icontxt) + call psb_exit(icontxt) +end program pingpong