Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #20412

Re: pde2 floating point benchmark code

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!postnews2.euro.net!news.wanadoo.nl!not-for-mail
From mhx@iae.nl (Marcel Hendrix)
Subject Re: pde2 floating point benchmark code
Newsgroups comp.lang.forth
Message-ID <79911496008434@frunobulax.edu> (permalink)
Date Thu, 7 Mar 2013 21:12:56 +0200
References <ef18d174-b46c-42e1-9a23-22ae22a90e0c@googlegroups.com>
X-Newsreader iForth 2.0 console (October 21, 2006)
Lines 78
Organization Wanadoo
NNTP-Posting-Date 07 Mar 2013 20:12:45 GMT
NNTP-Posting-Host s529d937f.adsl.online.nl
X-Trace 1362687165 dr7.euro.net 217 82.157.147.127:51040
X-Complaints-To abuse@wanadoo.nl
Xref csiph.com comp.lang.forth:20412

Show key headers only | View raw


krishna.myneni@ccreweb.org writes Re: pde2 floating point benchmark code
[..]
>>>                       The Fortran code is compiled and used transparently, and
>>> the speedup is enormous. Native code Forth compilers could use this
>>> hybrid R program for comparison. The link is
>>> ftp://ccreweb.org/software/R/pde/diffusion-fast.R
>
>> Compare what to what?

> I meant, compare the execution time of the R program's calculation 
> (for diffusion-fast.R) with the execution time of the compiled Forth program ...

Can you quote numbers? I don't have R installed.
[..]
> The method of lines calculation program may be found at

> ftp://ccreweb.org/software/R/pde/pde-example.R

> It outputs a rather nice color image of the spatial-temporal solution, and 
> worth looking at if you have installed or can install R on your system.

Could you post a picture? I can't read the R syntax to do it with my native 
plotters :-)

>> ( 50% of the time is needed to copy the arrays around )

More like 25% for the fast floating-point < 80 bits.

> Not sure how to get around this problem. Even though the calculation might 
> be done in-place with some extra variables, I don't know if the memory 
> shuffling can be minimized significantly.

Swapping pointers works.

-marcel

-- --------------------
NEEDS -xopg

.dfloat.p
\ .xfloat.p
\ .arbitrary.p

LET 0.5e:      GVAL D	-- Diffusion coefficient
LET 20.0:      GVAL u_ext
LET 0.01:      GVAL dx
LET 4e-5:      GVAL dt
LET D*dt/dx^2: GVAL kk	-- choose dt so that fk < 0.5

LET INTEGER(1+10/dx): =: nx

nx GARRAY x
nx GARRAY u_x_0
nx GARRAY u_i
nx GARRAY u_ip1

: INIT ( -- )
	nx 0 DO  LET x[i]=double[i]*dx:  
		 LET u_x_0[i]=1:  
		 LET u_i[i]=1:  
	   LOOP ; INIT

: EVOLVE ( n -- )
	u_ip1 u_i LOCALS| u_ip1 u_i |
	0 ?DO	nx 1- 1 DO  LET u_ip1[i]=kk*(u_i[i+1]-2*u_i[i]+u_i[i-1])+u_i[i]:  LOOP
		LET  u_ip1[0]=u_ip1[1]:	\ b.c.: u_x(0, t) = 0
		LET  u_ip1[nx-1]=u_ext:	\ b.c.: u(10, t) = u_ext
		u_ip1  u_i TO u_ip1  TO u_i
	 LOOP ;

-- Compute the solution at t=1
TIMER-RESET  #25000 evolve  CR .ELAPSED  LET. u_i[nx-2]:

\ xfloat:     0.192 seconds elapsed. 1.9848403070438166106e+0001
\  (new)      0.156 seconds elapsed. 1.9848403070438166106e+0001
\ arbitrary: 43.132 seconds elapsed. 1.9848403070438166105436153141988337094009e+0001
\  (new)     41.382 seconds elapsed. 1.9848403070438166105436153141988337094009e+0001

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pde2 floating point benchmark code krishna.myneni@ccreweb.org - 2013-03-04 18:02 -0800
  Re: pde2 floating point benchmark code Mark Wills <markrobertwills@yahoo.co.uk> - 2013-03-04 23:23 -0800
    Re: pde2 floating point benchmark code krishna.myneni@ccreweb.org - 2013-03-05 05:22 -0800
  Re: pde2 floating point benchmark code Doug Hoffman <glidedog@gmail.com> - 2013-03-05 12:11 -0500
    Re: pde2 floating point benchmark code krishna.myneni@ccreweb.org - 2013-03-05 16:11 -0800
      Re: pde2 floating point benchmark code Doug Hoffman <glidedog@gmail.com> - 2013-03-06 04:26 -0500
        Re: pde2 floating point benchmark code krishna.myneni@ccreweb.org - 2013-03-06 05:22 -0800
          Re: pde2 floating point benchmark code Doug Hoffman <glidedog@gmail.com> - 2013-03-06 09:44 -0500
  Re: pde2 floating point benchmark code krishna.myneni@ccreweb.org - 2013-03-05 16:17 -0800
    Re: pde2 floating point benchmark code mhx@iae.nl (Marcel Hendrix) - 2013-03-06 23:06 +0200
      Re: pde2 floating point benchmark code krishna.myneni@ccreweb.org - 2013-03-07 04:57 -0800
        Re: pde2 floating point benchmark code m.a.m.hendrix@tue.nl - 2013-03-07 05:49 -0800
        Re: pde2 floating point benchmark code mhx@iae.nl (Marcel Hendrix) - 2013-03-07 21:12 +0200
          Re: pde2 floating point benchmark code krishna.myneni@ccreweb.org - 2013-03-07 16:07 -0800
      Re: pde2 floating point benchmark code Doug Hoffman <glidedog@gmail.com> - 2013-03-10 09:17 -0400
        Re: pde2 floating point benchmark code mhx@iae.nl (Marcel Hendrix) - 2013-03-10 18:33 +0200
          Re: pde2 floating point benchmark code Doug Hoffman <glidedog@gmail.com> - 2013-03-11 04:54 -0400
    Re: pde2 floating point benchmark code humptydumpty <ouatubi@gmail.com> - 2013-03-07 22:32 -0800
      Re: pde2 floating point benchmark code Krishna Myneni <krishna.myneni@ccreweb.org> - 2013-03-08 05:19 -0800
        Re: pde2 floating point benchmark code mhx@iae.nl (Marcel Hendrix) - 2013-03-08 21:04 +0200
          Re: pde2 floating point benchmark code Krishna Myneni <krishna.myneni@ccreweb.org> - 2013-03-08 16:31 -0800
            Re: pde2 floating point benchmark code Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-09 00:56 +0000
              Re: pde2 floating point benchmark code Krishna Myneni <krishna.myneni@ccreweb.org> - 2013-03-08 19:52 -0800
                Re: pde2 floating point benchmark code Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2013-03-09 09:09 +0000
            Re: pde2 floating point benchmark code mhx@iae.nl (Marcel Hendrix) - 2013-03-09 13:37 +0200
              Re: pde2 floating point benchmark code Krishna Myneni <krishna.myneni@ccreweb.org> - 2013-03-09 06:28 -0800
              Re: pde2 floating point benchmark code mhx@iae.nl (Marcel Hendrix) - 2013-03-09 17:58 +0200
        Re: pde2 floating point benchmark code humptydumpty <ouatubi@gmail.com> - 2013-03-08 12:23 -0800
          Re: pde2 floating point benchmark code Krishna Myneni <krishna.myneni@ccreweb.org> - 2013-03-08 16:43 -0800

csiph-web