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


Groups > comp.lang.forth > #20039 > unrolled thread

Parallel computing under Win32Forth

Started byjosv@planet.nl
First post2013-02-26 08:15 -0800
Last post2013-02-27 04:42 -0800
Articles 9 — 4 participants

Back to article view | Back to comp.lang.forth


Contents

  Parallel computing under Win32Forth josv@planet.nl - 2013-02-26 08:15 -0800
    Re: Parallel computing under Win32Forth Bruno Gauthier <bgauthier@free.fr> - 2013-02-26 19:41 +0100
      Re: Parallel computing under Win32Forth josv@planet.nl - 2013-02-27 04:39 -0800
    Re: Parallel computing under Win32Forth mhx@iae.nl (Marcel Hendrix) - 2013-02-26 22:40 +0200
      Re: Parallel computing under Win32Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-02-26 23:04 +0100
        Re: Parallel computing under Win32Forth josv@planet.nl - 2013-02-27 04:44 -0800
          Re: Parallel computing under Win32Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-02-28 02:04 +0100
            Re: Parallel computing under Win32Forth josv@planet.nl - 2013-02-28 07:01 -0800
      Re: Parallel computing under Win32Forth josv@planet.nl - 2013-02-27 04:42 -0800

#20039 — Parallel computing under Win32Forth

Fromjosv@planet.nl
Date2013-02-26 08:15 -0800
SubjectParallel computing under Win32Forth
Message-ID<6e4c628e-a2fd-4113-b85e-fffe7c8bdf47@googlegroups.com>
I just released OpenCL for Win32Forth.
With OpenCL it is possible to perform parallel computing 
on a number of CPU's or GPU's.
See http://www.khronos.org/opencl for specification, headers, 
and documentation.

OpenCL under Win32Forth is now able to detect the OpenCL devices and
to test them based on the code used of the OpenCL_Jumpstart_Guide.pdf 
with a small modification. The link to the guide is:
http://www.cs.cmu.edu/afs/cs/academic/class/15668-s11/www/cuda-doc/OpenCL_Jumpstart_Guide.pdf 

For the CPU there is a test for parallel computing without OpenCL 
and a test with OpenCL.

To get OpenCL for Intel CPU's see: 
http://software.intel.com/en-us/vcsource/tools/opencl-sdk
Download the SDK with the Button at the top right, 
install and reboot the PC. JAVA is not needed to run the test.

Then compile Paralleltest.f to see the tests.

.clPlatforms will show the most important properties of all 
the found OpenCL platforms and devices.

An initial test showed that there was a problem with a Radeon card.
Since I was not able to test this again. I am not certain if these 
problems are solved. There are no problems with Nvidia cards so far.

On my system OpenCL under Win32Forth shows the following:
 
Running the vector_add test under Win32Forth
with MultiTaskingClass.f and fmacro.f and WITHOUT OpenCL
for 3 arrays containing 8,000,000 32-bits floats each on:
Intel(R) Core(TM) i7 CPU 960  @ 3.20GHz (8 threads)
14 times: Elapsed time: 00:00:00.261
145752112  28.00000000E0
145752116  29.40000343E0
145752120  58.80000687E0
.../ Last 3 /...
177752100  235.1999520E6
177752104  235.1999840E6
177752108  28.00000000E0
----------

Used function in the kernel for OpenCL:
__kernel void vector_add( __global float *a, __global float *b,
__global float *c)
{ size_t i = get_global_id(0); c[i] = c[i] + a[i] + b[i]; }

Running the vector_add test WITH OpenCL under Win32Forth
for 3 arrays with 8,000,000 32-bits floats each on:
GeForce 210  (1,238Mhz 2 compute units)
14 times: Elapsed time: 00:00:00.592
105906176  28.00000000E0
105906180  29.40000343E0
105906184  58.80000687E0
.../ Last 3 /...
137906164  235.1999680E6
137906168  235.1999840E6
137906172  28.00000000E0
----------

Running the vector_add test WITH OpenCL under Win32Forth
for 3 arrays with 8,000,000 32-bits floats each on:
Intel(R) Core(TM) i7 CPU         960  @ 3.20GHz  (3,200Mhz 8 compute units)
14 times: Elapsed time: 00:00:00.139
269549696  28.00000000E0
269549700  29.40000343E0
269549704  58.80000687E0
.../ Last 3 /...
301549684  235.1999680E6
301549688  235.1999840E6
301549692  28.00000000E0
----------  
Win32Forth is not the fastest Forth.
Is anyone able to beat OpenCL by using his favorite 
Forth-system?

That means it runs 87% faster than vector_add test 
under Win32Forth with MultiTaskingClass.f and fmacro.f and 
WITHOUT OpenCL, on your system. 
That test will also run when there is no OpenCL environment is present

In Wf32Vector_add.f of the pack is a high-level source.

Parallel.zip can be downloaded from http://home.planet.nl/~josv
Use the index to find it in a quick way.
Jos

[toc] | [next] | [standalone]


#20044

FromBruno Gauthier <bgauthier@free.fr>
Date2013-02-26 19:41 +0100
Message-ID<512d01da$0$2210$426a34cc@news.free.fr>
In reply to#20039
Le 26/02/2013 17:15, josv@planet.nl a écrit :

> Jos
>
hi Jos,
and thank you for the release.

does the PTX language (pseudo assembler) can be used for ours nvidia cards ?
or is it reserved for the fermi /kepler models ?

bruno

here the results on my desktop :


Running the vector_add test under Win32Forth
with MultiTaskingClass.f and fmacro.f and WITHOUT OpenCL
for 3 arrays containing 8,000,000 32-bits floats each on:
Intel(R) Core(TM) i7 CPU 920  @ 2.67GHz (8 threads)
14 times: Elapsed time: 00:00:00.437
115408944  28.00000000E0
115408948  29.40000343E0
115408952  58.80000687E0
.../ Last 3 /...
147408932  235.1999520E6
147408936  235.1999840E6
147408940  28.00000000E0
----------

Used function in the kernel for OpenCL:
__kernel void vector_add( __global float *a, __global float *b,
__global float *c)
{ size_t i = get_global_id(0); c[i] = c[i] + a[i] + b[i]; }

Running the vector_add test WITH OpenCL under Win32Forth
for 3 arrays with 8,000,000 32-bits floats each on:
GeForce GT 230  (1,250Mhz 12 compute units)
14 times: Elapsed time: 00:00:00.109
74514432  28.00000000E0
74514436  29.40000343E0
74514440  58.80000687E0
.../ Last 3 /...
106514420  235.1999680E6
106514424  235.1999840E6
106514428  28.00000000E0
----------

Running the vector_add test WITH OpenCL under Win32Forth
for 3 arrays with 8,000,000 32-bits floats each on:
Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz  (2,670Mhz 8 compute units)
14 times: Elapsed time: 00:00:00.156
214761600  28.00000000E0
214761604  29.40000343E0
214761608  58.80000687E0
.../ Last 3 /...
246761588  235.1999680E6
246761592  235.1999840E6
246761596  28.00000000E0
----------  ok

[toc] | [prev] | [next] | [standalone]


#20058

Fromjosv@planet.nl
Date2013-02-27 04:39 -0800
Message-ID<e21e6d0f-952f-478c-bd24-b1f748afc5be@googlegroups.com>
In reply to#20044
Hi Bruno

Thank you for posting your timings.
Quite interesting to see that your GPU is faster than your CPU
for the vector_add test.

About PTX:
It should be possible to use PTX on nvidia cards.
That fact that OpenCL can be used on more platfoms than 
the nvidia platform made me to decide to go for OpenCL.

Jos

[toc] | [prev] | [next] | [standalone]


#20049

Frommhx@iae.nl (Marcel Hendrix)
Date2013-02-26 22:40 +0200
Message-ID<01631309018434@frunobulax.edu>
In reply to#20039
josv@planet.nl writes Re: Parallel computing under Win32Forth

> I just released OpenCL for Win32Forth.
> With OpenCL it is possible to perform parallel computing 
> on a number of CPU's or GPU's.
[..]
> On my system OpenCL under Win32Forth shows the following:
>
> Running the vector_add test under Win32Forth
> with MultiTaskingClass.f and fmacro.f and WITHOUT OpenCL
> for 3 arrays containing 8,000,000 32-bits floats each on:
> Intel(R) Core(TM) i7 CPU 960  @ 3.20GHz (8 threads)
> 14 times: Elapsed time: 00:00:00.261
[..]
> Running the vector_add test WITH OpenCL under Win32Forth
> for 3 arrays with 8,000,000 32-bits floats each on:
> GeForce 210  (1,238Mhz 2 compute units)
> 14 times: Elapsed time: 00:00:00.592
[..]
> Running the vector_add test WITH OpenCL under Win32Forth
> for 3 arrays with 8,000,000 32-bits floats each on:
> Intel(R) Core(TM) i7 CPU 960  @ 3.20GHz  (3,200Mhz 8 compute units)
> 14 times: Elapsed time: 00:00:00.139
[..]

Do I see correctly that the code using OpenCL is *slower* than the
code not using OpenCL?

> Win32Forth is not the fastest Forth.
> Is anyone able to beat OpenCL by using his favorite 
> Forth-system?


Running the vector_add test under iForth WITHOUT OpenCL
for 3 arrays containing 8,000,000 32-bits floats each with 2 threads
14 times: 0.152 seconds elapsed.
258801744  28.000000e0
258801748  29.400003e0
258801752  58.800007e0
.../ Last 3 /...
290801732  235.199952e6
290801736  235.199984e6
290801740  28.000000e0
----------  ok

Running the vector_add test under iForth WITHOUT OpenCL
for 3 arrays containing 8,000,000 32-bits floats each with 4 threads
14 times: 0.121 seconds elapsed.
258801744  28.000000e0
258801748  29.400003e0
258801752  58.800007e0
.../ Last 3 /...
290801732  235.199952e6
290801736  235.199984e6
290801740  28.000000e0
----------  ok

Running the vector_add test under iForth WITHOUT OpenCL
for 3 arrays containing 8,000,000 32-bits floats each with 8 threads
14 times: 0.104 seconds elapsed.
268304464  28.000000e0
268304468  29.400003e0
268304472  58.800007e0
.../ Last 3 /...
300304452  235.199952e6
300304456  235.199984e6
300304460  28.000000e0
----------  ok

This *NOT* using OpenCL, using iForth's threads.

-marcel

[toc] | [prev] | [next] | [standalone]


#20051

FromBernd Paysan <bernd.paysan@gmx.de>
Date2013-02-26 23:04 +0100
Message-ID<kgjbi1$r7l$1@online.de>
In reply to#20049
Marcel Hendrix wrote:

> josv@planet.nl writes Re: Parallel computing under Win32Forth
> 
>> I just released OpenCL for Win32Forth.
>> With OpenCL it is possible to perform parallel computing
>> on a number of CPU's or GPU's.
> [..]
>> On my system OpenCL under Win32Forth shows the following:
>>
>> Running the vector_add test under Win32Forth
>> with MultiTaskingClass.f and fmacro.f and WITHOUT OpenCL
>> for 3 arrays containing 8,000,000 32-bits floats each on:
>> Intel(R) Core(TM) i7 CPU 960  @ 3.20GHz (8 threads)
>> 14 times: Elapsed time: 00:00:00.261
> [..]
>> Running the vector_add test WITH OpenCL under Win32Forth
>> for 3 arrays with 8,000,000 32-bits floats each on:
>> GeForce 210  (1,238Mhz 2 compute units)
>> 14 times: Elapsed time: 00:00:00.592
> [..]
>> Running the vector_add test WITH OpenCL under Win32Forth
>> for 3 arrays with 8,000,000 32-bits floats each on:
>> Intel(R) Core(TM) i7 CPU 960  @ 3.20GHz  (3,200Mhz 8 compute units)
>> 14 times: Elapsed time: 00:00:00.139
> [..]
> 
> Do I see correctly that the code using OpenCL is *slower* than the
> code not using OpenCL?

No, the OpenCL version running on the Core i7 was about twice as fast as the 
Win32Forth code running on said Core i7.  The GeForce 210 is a several year 
old entry-level GPU, so don't expect great OpenCL performance.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

[toc] | [prev] | [next] | [standalone]


#20060

Fromjosv@planet.nl
Date2013-02-27 04:44 -0800
Message-ID<2f6309b3-bfed-415f-81c7-c74ff0fc2cb3@googlegroups.com>
In reply to#20051
Hi Bernd,
Thank you for trying.

> The GeForce 210 is a several year  old entry-level GPU, 
> so don't expect great OpenCL performance

That is absolutely right. 
But it runs OpenCL and that is great.

Jos

[toc] | [prev] | [next] | [standalone]


#20088

FromBernd Paysan <bernd.paysan@gmx.de>
Date2013-02-28 02:04 +0100
Message-ID<kgmaep$dep$1@online.de>
In reply to#20060
josv@planet.nl wrote:

> Hi Bernd,
> Thank you for trying.

I actually just looked at the source code.  OpenCL is similar to use as 
OpenGL Shader Language, which is not a coincidence ;-).

Suggestion: Use Forth's power to read in several lines from the input stream 
(e.g. until you read an "end-opencl" in a line of its own); and construct 
the OpenCL source out of that.  It would be much more read- and maintainable 
than the s" <a line>" +cKernel sequences.  Use the power of Forth!

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

[toc] | [prev] | [next] | [standalone]


#20096

Fromjosv@planet.nl
Date2013-02-28 07:01 -0800
Message-ID<f73c806f-902a-471f-99bb-332a5e799c5e@googlegroups.com>
In reply to#20088
27 Feb 2013 17:04:25 Bernd Paysan wrote:
+cKernel was a quick-fix will certainly disappear.
Normally OpenCL-code should be in a separate file with the extension .CL
So at some time there will be some kind of “Clload”

Jos 

> [...]
> Suggestion: Use Forth's power to read in several lines from the input stream 
> (e.g. until you read an "end-opencl" in a line of its own); and construct 
> the OpenCL source out of that.  It would be much more read- and maintainable 
> than the s" <a line>" +cKernel sequences.  Use the power of Forth!

[toc] | [prev] | [next] | [standalone]


#20059

Fromjosv@planet.nl
Date2013-02-27 04:42 -0800
Message-ID<d1b71bb9-be40-4b51-a412-9714ab848a2a@googlegroups.com>
In reply to#20049
Hi Marcel,

Thank you for accepting my challenge!
Your timings under iForth WITHOUT OpenCL are impressive.
Very nice that you are able to beat OpenCL!

> Do I see correctly that the code using OpenCL is *slower* than the 
> code not using OpenCL? 

That depends on which platform you look at.
My GPU is indeed slower. ( Elapsed time: 00:00:00.592)
But my CPU is faster (Elapsed time: 00:00:00.139)

Jos

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web