The CPU vs the GPU contest.

S

Skybuck Flying

Hello,

In this contest the CPU will face the GPU.

Which processor will execute the code/concept faster ?

// cpu/serial concept code is:

var
mTable : array of array of integer;
mRowCount : integer;
mColumnCount : integer;

procedure AllocateTable;
begin
mRowCount := 8000;
mColumnCount := 9000;
SetLength( mTable, mRowCount, mColumnCount );
end;

procedure WorkToDo;
var
vRowIndex1 : integer;
vRowIndex2 : integer;
vColumnIndex : integer;
vValue1 : integer;
vValue2 : integer;
begin
vRowIndex1 := 5;
vRowIndex2 := 8;
vValue1 := 5;
vValue2 := 10;
// calculations could be done in parallel on GPU.
for vColumnIndex := 0 to mColumnCount-1 do
begin
mTable[ vRowIndex1, vColumnIndex ] := (mTable[ vRowIndex1,
vColumnIndex ] * vValue1) - (mTable[ vRowIndex2, vColumnIndex ] * vValue2);
end;
end;

For cpu:
MMX/XMM/SIMD/SSE/SSE2 version could be made.

For gpu:
OpenGL or DirectX version could be made.

This is a contest between the CPU and GPU thus helping each other is
allowed.

My test system will be:

X2 3800+ and two GTX 7900 512 MB cards.

^^^ Code may be heavily optimized for this system or similiar ^^^.

Alternative test system could be:

Pentium III 450 mhz and FX5200 with 128 MB ram.

^^^ can be ignored.

Code can be in ASM, C/C++ or Delphi.

Bye,
Skybuck.
 
D

David T. Ashley

Skybuck Flying said:
// cpu/serial concept code is:

var
mTable : array of array of integer;
mRowCount : integer;
mColumnCount : integer;

procedure AllocateTable;
begin
mRowCount := 8000;
mColumnCount := 9000;
SetLength( mTable, mRowCount, mColumnCount );
end;

procedure WorkToDo;
var
vRowIndex1 : integer;
vRowIndex2 : integer;
vColumnIndex : integer;
vValue1 : integer;
vValue2 : integer;
begin
vRowIndex1 := 5;
vRowIndex2 := 8;
vValue1 := 5;
vValue2 := 10;
// calculations could be done in parallel on GPU.
for vColumnIndex := 0 to mColumnCount-1 do
begin
mTable[ vRowIndex1, vColumnIndex ] := (mTable[ vRowIndex1,
vColumnIndex ] * vValue1) - (mTable[ vRowIndex2, vColumnIndex ] *
vValue2);
end;
end;

#1)Thanks for posting Pascal (or something similar) to a C-language group.

#2)Are you Archimedes Plutonium?
 
O

//\\\\o//\\\\annabee


Better SkyBuck then HLA. The guy is funny, dont be so hard on him.
What he is doing I belive is sarcasm. His whole name is just a taunt.
He is maybe overdoing it, but he is actually more entertaining then the
guys that does what he does, for real.

And "SkyBuck" is really a very funny name. Also sarcasm, I belive.
 
R

Richard Heathfield

[all crossposting removed]

David T. Ashley said:
#1)Thanks for posting Pascal (or something similar) to a C-language group.

#2)Are you Archimedes Plutonium?

Mr Flying has posted quite a few articles to comp.lang.c in the past - 263,
according to Google. It is not known whether any of them demonstrate C
knowledge, but this is generally considered unlikely.
 
E

Evenbit

//\o//\annabee <Free said:
Better SkyBuck then HLA. The guy is funny, dont be so hard on him.

Well, what I find funny is that after all these years of Randy
preaching to you RosAsmites about your sinful "copy-n-paste"
programming style, there comes a post in the HLA forum from a dude
asking how to locate and delete all the unused variables in his
mountain of "copy-n-paste" code. We promise to sand-paper the HLA
tatoo from his butt before we toss him in your camp for a proper
branding. ;-)

Nathan.
 
O

//\\\\o//\\\\annabee

Well, what I find funny is that after all these years of Randy
preaching to you RosAsmites about your sinful "copy-n-paste"
programming style,

Randall Hyde is an idiot. And he is a weak idiot.
Even if I find it hard to think it could be worth the bodder to tell you
what this is all about, I try one more time in the rare hope it could be
understood.

Many times, the best way to reuse some code, is to call for it.
Put it under some routinelabel, and call it. But this is not allways true.
Sometimes, copying and pasting it, and rewrite in the new purpose, under a
new routine lable, makes for just a minute or two of programmer work.
While in that case, rewriting the ONE routine, to cover both cases, will
lead to a much more bloated routine, because now it has to take care of
two _similar_ but still _diffrent_ tasks. And this will be more work. This
will also make both the routine and the code that calls to it harder to
read, and it will also make BOTH the first and the second instance of the
routine call slower.

Second, doing theese things are RARE. _Very_ rare.

Third. Copying code that has errors makes for multiplications of this
error. This is the source of his claim. But copying good code makes for
two good code snipplets that runs faster, are more easy to read. And dont
forget, they _ARE_ diffrent.

Randall Hyde is a machine of generalizations, and also a machine at FUD
producing. He is a derranged idiot. And if you belive him over Betov, so
are you.
there comes a post in the HLA forum from a dude
asking how to locate and delete all the unused variables in his
mountain of "copy-n-paste" code. We promise to sand-paper the HLA
tatoo from his butt before we toss him in your camp for a proper
branding. ;-)

I spent someday a few hours of removing all the dead code and variables
from my source. A one time small job, at the end of the developing cycle.
Everything is much easier in a monosource.
 
S

Skybuck Flying

Richard Heathfield said:
[all crossposting removed]

David T. Ashley said:
#1)Thanks for posting Pascal (or something similar) to a C-language
group.

You're welcome.

Pascal and C are very similiar.

Let me know if you have any problems converting it to the C language.

?

I haven't seen any Pascal/Delphi GPGPU programming code yet.

Maybe you C experts know or can find me some nice C code which does actually
what I want.

Bye,
Skybuck.
 
S

Skybuck Flying

You're welcome.

Pascal and C are very similiar.

Let me know if you have any problems converting it to the C language.

?

I haven't seen any Pascal/Delphi GPGPU programming code yet.

Maybe you C experts know or can find me some nice C code which does actually
what I want.

Bye,
Skybuck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top