hi i am new at conding with cuda. for an presentation i trie to make 2 programs which show the speed advantage of the GPU in calculating.
i ve fast written a programm which calculattes the factorial of an int about 1 billion times. so now i tried to write it in visual 2005 with all the libs a headers from cuda.
but i always got an error message.
error message is always:
"1>d:\cuda\include\texture_types.h(105): error: expected a file name
1>d:\cuda\include\texture_types.h(107): error: expected a file name
1>d:\cuda\include\texture_types.h(109): error: expected a file name
"
Heres my code (should be an 32win console apllication):
global void factorial_gpu(int a, int b, int c)
{
int temp=1, k=1;
int i=blockIdx.xblockDim.x+threadIdx.x;
int j=blockIdx.yblockDim.y+threadIdx.y;
if( i <a && j <b) {
while (k <= c){ //factorial calculations
temp = temp*k;
k = k+1;
}
}
}
int main()
{ #define blocksize 512
int zahl,z,a=100000000,b=100000000;
printf(“\nof which integer the factorial has to be calculate?: “);
scanf_s(”%i”,&zahl);
The app you have written is kind of a smoke and mirrors thing if you plan on telling people that CUDA can do x factorials in only a fraction of a second because you’re using 32 bit integers which could only be used to compute 1! through 12! inclusive, at which point you might as well be using a constant lookup table since your input range is so limited. I think people will generally assume that when you say “computes a factorial” you mean larger factorials than that.
Calculating factorials for arbitrarily large integers would far more challenging and an efficient CUDA implementation would actually be somewhat interesting, though I’m betting it would still be substantially faster than on the CPU.
Will give GPU processing needs to be done to it.
Because CPU processing for a long time.
Code: SQL Plus Oracle - OraDB12c
CREATE OR REPLACE FUNCTION my_func
(p_digits IN VARCHAR2)
RETURN SYS.ODCIVARCHAR2LIST PIPELINED
AS
BEGIN
FOR v_rec IN
(SELECT DISTINCT REPLACE (SYS_CONNECT_BY_PATH (digit, '*'), '*', '') digits
FROM (SELECT LEVEL i, SUBSTR (p_digits, LEVEL, 1) digit
FROM DUAL
CONNECT BY LEVEL <= LENGTH (p_digits))
WHERE LEVEL = LENGTH (p_digits)
CONNECT BY NOCYCLE PRIOR i != i
ORDER BY digits)
LOOP
PIPE ROW (v_rec.digits);
END LOOP;