C Board  

Go Back   C Board > Community Boards > Contests Board

Reply
 
LinkBack Thread Tools Display Modes
Old 11-26-2008, 10:58 PM   #16
Rampaging 35 Stone Welsh
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 2,927
Its __int64 and thats final. If you want to recast it inside your function go ahead, but the interface is set in stone. Sorry if thats a bit blunt but there has to be one set interface or Ill end up rewriting the test program for every entry. If I do it for one person ill end up doing it for everyone.

If you have need of a specific header file state what you need, don't ask me to open it up for no reason. The only exception that comes to mind are the headers for OpenMP or for DirectX(HLSL). I see no reason that any other headers shodul be needed, but liek I said, if you need a specific header file, ask first.
__________________
He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet

Last edited by abachler; 11-27-2008 at 07:41 AM.
abachler is offline   Reply With Quote
Old 11-27-2008, 01:35 PM   #17
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,472
Why you would use HLSL for this is beyond me.
__________________
If you aim at everything you will hit something but you won't know what it is.
Bubba is offline   Reply With Quote
Old 11-27-2008, 10:01 PM   #18
Rampaging 35 Stone Welsh
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 2,927
gpgpu.org
thats why.
__________________
He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet
abachler is offline   Reply With Quote
Old 11-28-2008, 04:30 AM   #19
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,472
That will only work on DX10+ or possibly even DX11 when compute shaders are introduced. As of right now there would not be a way to transfer the 100 thousand prime numbers back to the software. That would require a ton of floating point textures and a ton of surface locks to read the values. NVidia Cuda is only available in 9+ series cards and is going to be used with their acquired PhysX chips on the video card.
__________________
If you aim at everything you will hit something but you won't know what it is.
Bubba is offline   Reply With Quote
Old 11-28-2008, 05:36 AM   #20
Internet Superhero
 
Join Date: Sep 2006
Location: Denmark
Posts: 449
Quote:
Originally Posted by Bubba View Post
NVidia Cuda is only available in 9+ series cards and is going to be used with their acquired PhysX chips on the video card.
Wrong, all 8XXX Geforce cards support both PhysX and CUDA, including Abachlers 8600GT. PhysX requires 256MB of dedicated VRAM though so integrated cards won't do PhysX, only CUDA...
__________________
How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.
Neo1 is offline   Reply With Quote
Old 11-28-2008, 07:31 AM   #21
Rampaging 35 Stone Welsh
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 2,927
There is also RapidMind, which I also have installed along with CUDA.
__________________
He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet
abachler is offline   Reply With Quote
Old 11-28-2008, 12:34 PM   #22
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,472
I'd be interested to see how you are going to get 100 thousand primes off of the video card and back into software. Shaders are not meant to communicate back down to the software level - at least not until DX11 and even then I'm a bit fuzzy on the compute shaders functionality.
You could render the primes to a floating point texture but that would be completely inefficient. In the current architecture this does not sound like a good idea. I'm not saying it's not possible but it goes against the design of the shader paradigm...for now.

I would think using SSE2/3/4? would be a better choice than HLSL.
__________________
If you aim at everything you will hit something but you won't know what it is.
Bubba is offline   Reply With Quote
Old 11-28-2008, 04:31 PM   #23
Chinese pâté
 
foxman's Avatar
 
Join Date: Jul 2007
Location: Canada
Posts: 406
Quote:
I would think using SSE2/3/4? would be a better choice than HLSL.
Depending on exactly which CPU he has, SSE3 might not even be available (SSE4 was introduced in Penryn, so we can forget about it, but I don't think it would have been useful anyway).

abachler, are you running a 32 or 64 bit OS ? Some Pentium 4 support the x86-64 ISA, some don't.

Oh and I tought CUDA wasn't supported by Visual Studio 2008 express edition. Well.

Oh, and what are we winning ?
__________________
I hate real numbers.
foxman is offline   Reply With Quote
Old 11-28-2008, 04:42 PM   #24
Rampaging 35 Stone Welsh
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 2,927
Its a matter of the number of shaders available, operating in parallel, which amortize the innefficiency of the actual operation to produce superior absolute throughput.

SSE3 is available, but VS2008 only supports SSE2.

Well, CUDA is installed, but it is limited to the low level API, I havent fulyl explored what those limits are, so I will have to get back to you on that. I believe the full API requires 2005 or 2003, neither of which I have.

The versions I run are 4.0 for 80 bit long double access, 6.0 , and 2008 because its free.

I have CUDA 2.0 Final installed, and RapidMind 3.1 ( ineed to check for a new versin fo that).
__________________
He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet

Last edited by abachler; 11-28-2008 at 10:10 PM.
abachler is offline   Reply With Quote
Old 11-29-2008, 10:41 AM   #25
Chinese pâté
 
foxman's Avatar
 
Join Date: Jul 2007
Location: Canada
Posts: 406
Here's my entry. It follows the contest rules. I'm targeting the best user-time possible.

Oh man, what a waste of time.
Attached Files
File Type: cpp PrimeFunc.cpp (3.0 KB, 112 views)
__________________
I hate real numbers.
foxman is offline   Reply With Quote
Old 11-29-2008, 01:41 PM   #26
Rampaging 35 Stone Welsh
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 2,927
Violates rules 1 and 6 (no external files, no file access functions).

It also takes longer than the original code it was based on. Probably due to setting up the file mapping.
__________________
He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet
abachler is offline   Reply With Quote
Old 11-29-2008, 03:46 PM   #27
C++ Witch
 
laserlight's Avatar
 
Join Date: Oct 2003
Location: Singapore
Posts: 10,365
Ah well, I decided to give it a try with an obvious brute force implementation. Note that as this is in C++, I have included <cmath> instead of <math.h>.

Interestingly, switching from std::sqrt() to the method that abachler advocated in this Prime numbers thread made no difference (it was only very marginally worse, and that could have just been due to timing inaccuracy). Therefore, it would have been better (according to my timings) to just not include any headers at all and use that method, but I decided to go with my original method anyway.

EDIT:
hmm... I think that 3 is not actually a seed value in my case since I am testing it for primality, hence I am uploading a modified version that has just one seed value, namely, 2.
Attached Files
File Type: cpp PrimeFunc.cpp (1.0 KB, 88 views)
__________________
C + C++ Compiler: MinGW port of GCC
Build + Version Control System: SCons + Bazaar

Look up a C/C++ Reference and learn How To Ask Questions The Smart Way

Last edited by laserlight; 11-29-2008 at 03:57 PM.
laserlight is online now   Reply With Quote
Old 11-29-2008, 04:17 PM   #28
Rampaging 35 Stone Welsh
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 2,927
well, the actual contest is to generate primes greater than 2^32. I changed one line of your code (the typedef) so it woudl compile. Other than failign the magnitude test it looks like it woudl work.

Code:
// typedef unsigned __int64  PrimeType;
 
#define PrimeType unsigned __int64 



Attached Images
 
__________________
He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet

Last edited by abachler; 11-29-2008 at 04:35 PM.
abachler is offline   Reply With Quote
Old 11-30-2008, 05:32 AM   #29
C++ Witch
 
laserlight's Avatar
 
Join Date: Oct 2003
Location: Singapore
Posts: 10,365
Quote:
Originally Posted by abachler
well, the actual contest is to generate primes greater than 2^32.
Right, I misread the rubric. Looks like you still have zero valid entries, heh.
__________________
C + C++ Compiler: MinGW port of GCC
Build + Version Control System: SCons + Bazaar

Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
laserlight is online now   Reply With Quote
Old 11-30-2008, 06:48 AM   #30
Chinese pâté
 
foxman's Avatar
 
Join Date: Jul 2007
Location: Canada
Posts: 406
Quote:
Originally Posted by laserlight View Post
Looks like you still have zero valid entries, heh.


Right.
__________________
I hate real numbers.
foxman is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
xor linked list adramalech C Programming 23 10-14-2008 10:13 AM
prime number program with function mackieinva C Programming 17 09-20-2007 08:36 AM
Prime Number stops after 29, but why? Daveo C Programming 22 09-17-2004 10:55 AM
Somewhat new to c++, adding Prime number and Sqrt featre to program... thynksheraze C++ Programming 3 01-14-2003 10:34 PM
Random number generator Caze C++ Programming 6 12-03-2002 08:10 AM


All times are GMT -6. The time now is 07:42 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22