Linux behave different then Windows?

Hi,

does anybody know why the same CUDA code behave different if I compile and run it in Linux than Windows?(…I am using also CUBLAS library…)

Thanks

What does “behave different” mean? And what versions of Windows, Linux and hardware are you comparing?

What does “behave different” mean? And what versions of Windows, Linux and hardware are you comparing?

I m using the same computer with different OS (Windows Vista and Linux Ubuntu 10).

With “different Behave” I mean the output, I implemented a linear solver and in Windows Vista the result is correct instead in Linux the result is incorrect.

Any idea?

I m using the same computer with different OS (Windows Vista and Linux Ubuntu 10).

With “different Behave” I mean the output, I implemented a linear solver and in Windows Vista the result is correct instead in Linux the result is incorrect.

Any idea?

How different are the results? Is the linux version returning plausible results (so a little different, but sensible looking), or is it returning rubbish?

My initial thought was that you were moving from Linux to a WDDM version of windows and things didn’t work. What you are asking about sounds different, but it is impossible to comment without some concrete description of what exactly the problem is.

How different are the results? Is the linux version returning plausible results (so a little different, but sensible looking), or is it returning rubbish?

My initial thought was that you were moving from Linux to a WDDM version of windows and things didn’t work. What you are asking about sounds different, but it is impossible to comment without some concrete description of what exactly the problem is.

The result should be around “0” and in Linux in something completely different! I dont know what is wrong…

The result should be around “0” and in Linux in something completely different! I dont know what is wrong…

Can someone run the code and tell me the result?

Thanks

Attached is the code with the Makefile…

Can someone run the code and tell me the result?

Thanks

Attached is the code with the Makefile…

It’s your code, but this looks reasonable to me :

avidday@cuda:~/build/minres$ ./out

This program find the solution 'x' of the system Ax=b 

The A matrix is 

6	  8	  2	  0	  0	  0	  

8	  8	  7	  6	  0	  0	  

2	  7	  8	  7	  4	  0	  

0	  6	  7	  3	  7	  2	  

0	  0	  4	  7	  2	  9	  

0	  0	  0	  2	  9	  8	  

The b vector is 

33	  48	  51	  57	  21	  87	  

Time elapsed to solve the problem with GPU: 0.457248 

The unknowns x are 

5.92987	  0.441867	  -3.05712	  3.07098	  9.75183	  -0.863549	  

The value of A*x is 

32.9999	  

47.9999	  

51	  

57	  

21.0001	  

87.0001	  

This is A*x - b that should be '0' 

-9.15527e-05	  

-0.000106812	  

7.62939e-06	  

3.43323e-05	  

7.24792e-05	  

6.86646e-05

This was run on a GTX470 with a Ubuntu 9.04 x86_64 host using the CUDA 3.0 and the 195.36.24 driver.

It’s your code, but this looks reasonable to me :

avidday@cuda:~/build/minres$ ./out

This program find the solution 'x' of the system Ax=b 

The A matrix is 

6	  8	  2	  0	  0	  0	  

8	  8	  7	  6	  0	  0	  

2	  7	  8	  7	  4	  0	  

0	  6	  7	  3	  7	  2	  

0	  0	  4	  7	  2	  9	  

0	  0	  0	  2	  9	  8	  

The b vector is 

33	  48	  51	  57	  21	  87	  

Time elapsed to solve the problem with GPU: 0.457248 

The unknowns x are 

5.92987	  0.441867	  -3.05712	  3.07098	  9.75183	  -0.863549	  

The value of A*x is 

32.9999	  

47.9999	  

51	  

57	  

21.0001	  

87.0001	  

This is A*x - b that should be '0' 

-9.15527e-05	  

-0.000106812	  

7.62939e-06	  

3.43323e-05	  

7.24792e-05	  

6.86646e-05

This was run on a GTX470 with a Ubuntu 9.04 x86_64 host using the CUDA 3.0 and the 195.36.24 driver.

Unbelievable!!! In my computer it doent work! I am using CUDA 3.1 and 256.40 driver…

Can you send me the makefile you use to compile the files…maybe I am using wrong flags! Or Do you think I need to change driver or Cuda version?

Thank you very much Avidday!

Unbelievable!!! In my computer it doent work! I am using CUDA 3.1 and 256.40 driver…

Can you send me the makefile you use to compile the files…maybe I am using wrong flags! Or Do you think I need to change driver or Cuda version?

Thank you very much Avidday!

I used your makefile, didn’t change anything except for the path where the toolkit and SDK are installed.,

I used your makefile, didn’t change anything except for the path where the toolkit and SDK are installed.,

I found the problem! I forgot to initialize to zero a vector on the beginning !
The strange thing is that in Windows all the memory location after a cudaMalloc are initialized to zero, why that ?

I found the problem! I forgot to initialize to zero a vector on the beginning !
The strange thing is that in Windows all the memory location after a cudaMalloc are initialized to zero, why that ?

Probably a complete accident. C (and by extension CUDA) makes no guarantees about the state of memory returned by the standard memory allocation operations.