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


Groups > comp.lang.forth > #22187

Re: Parallel FIB

From mhx@iae.nl (Marcel Hendrix)
Subject Re: Parallel FIB
Newsgroups comp.lang.forth
Message-ID <12999600988434@frunobulax.edu> (permalink)
Date 2013-05-03 07:04 +0200
References <2013May2.161355@mips.complang.tuwien.ac.at>
Organization Wanadoo

Show all headers | View raw


anton@mips.complang.tuwien.ac.at (Anton Ertl) writes Re: Parallel FIB

> mhx@iae.nl (Marcel Hendrix) writes:
>>I couldn't find a use for a 4th core, but the speedup is 
>>already about 7 times (2 times for a pure algorithm compare).


[..]
>                                     Given that
>
> phi^2 = phi+1
>
> it's not surprising that you see a factor of 2.  I would expect
>
> n 5 - fib
> n 6 - fib
>
> together to take the same amount of time as
>
> n 4 - fib
>
> So do the former calls in one thread, and your program will probably
> run faster (wall-clock time) on 2-core CPUs.
[..]

In the context of a benchmark the actual speed of solving the problem 
doesn't matter. What I am looking for is a way to put to work 
all 4 (n) cores to work so that they deliver a significant contribution 
to the final result.

Your suggestion speeds up the solving process, but decreases the
difference between serial and parallel. Still some thinking to be done.

-marcel

-- -----------
: pfib ( n1 -- n2 )
	TO n  n 6 < IF  n fib EXIT  ENDIF
	fibs OFF
	PAR
	  STARTP  n 5 - fib 8 * fibs LOCKED+! DROP  ENDP
	  STARTP  n 6 - fib 5 * fibs LOCKED+! DROP  ENDP
	ENDPAR
	fibs @ ;

: sfib ( n1 -- n2 )
	TO n  n 6 < IF  n fib EXIT  ENDIF
	n 5 - fib 8 * 
	n 6 - fib 5 * + ;

: bench	CR ." \ serial FIB(47)   : " TIMER-RESET #47  fib U. .ELAPSED 
	CR ." \ new FIB(47)      : " TIMER-RESET #47 sfib U. .ELAPSED 
	CR ." \ parallel FIB(47) : " TIMER-RESET #47 pfib U. .ELAPSED ; 

\ FORTH> bench ( 4, 5, 6 )
\ serial FIB(47)   : 4807526976 46.130 seconds elapsed.
\ new FIB(47)      : 4807526976 13.344 seconds elapsed. 
\ parallel FIB(47) : 4807526976 7.018 seconds elapsed. ok

\ FORTH> bench ( 5, 6 )
\ serial FIB(47)   : 4807526976 44.669 seconds elapsed.
\ new FIB(47)      : 4807526976 6.502 seconds elapsed.
\ parallel FIB(47) : 4807526976 4.160 seconds elapsed. ok
-- ---------------

-marcel

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


Thread

Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-02 01:20 +0200
  Re: Parallel FIB anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-02 14:13 +0000
    Re: Parallel FIB Paul Rubin <no.email@nospam.invalid> - 2013-05-02 08:25 -0700
    Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-03 07:04 +0200
      Re: Parallel FIB anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-03 12:26 +0000
        Re: Parallel FIB Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-03 15:23 +0200
          Re: Parallel FIB fred <email@address.com> - 2013-05-03 16:56 +0100
          Re: Parallel FIB Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-03 18:13 +0200
        Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-03 21:14 +0200
          Re: Parallel FIB anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-04 13:45 +0000
        Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-03 21:29 +0200
          Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-03 23:53 +0200
            Re: Parallel FIB Paul Rubin <no.email@nospam.invalid> - 2013-05-03 18:10 -0700
              Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-04 07:07 +0200
                Re: Parallel FIB mhx@iae.nl (Marcel Hendrix) - 2013-05-06 21:09 +0200
        Re: Parallel FIB albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-05-04 00:26 +0000

csiph-web