lion03 / thrust

Automatically exported from code.google.com/p/thrust
Apache License 2.0
0 stars 0 forks source link

thrust::sort does not sort a device_vector<int> when using "-arch=sm_n" with n > 10 #310

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Please post a short, self-contained code sample which reproduces the
problem:
It looks like thrust::sort only sorts a device_vector<int> when the code is 
compiled with "-arch=sm_10". Using sm_13, sm_20, or sm_21 prints the values of 
the device_vector in the original, unsorted order.

What is the expected output?
> nvcc -arch=sm_10 sortInts.cu -o sortInts  && ./sortInts 
9
1
8
2
7
3
6
4
5
3
4
2
3
1
0
-1
-1
0
1
1
2
2
3
3
3
4
4
5
6
7
8
9

What do you see instead?
> nvcc -arch=sm_13 sortInts.cu -o sortInts  && ./sortInts 
9
1
8
2
7
3
6
4
5
3
4
2
3
1
0
-1
9
1
8
2
7
3
6
4
5
3
4
2
3
1
0
-1

What version of Thrust are you using?
1.3.0

Which version of nvcc?
> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2010 NVIDIA Corporation
Built on Thu_Nov_11_15:26:50_PST_2010
Cuda compilation tools, release 3.2, V0.2.1221

Which host compiler?
> gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)

On what operating system?
MacOSX 10.6.6

Please provide any additional information below.

Original issue reported on code.google.com by ingo.jae...@gmail.com on 18 Feb 2011 at 11:49

Attachments:

GoogleCodeExporter commented 8 years ago
Could you tell us what GPU you have?

Original comment by wnbell on 18 Feb 2011 at 12:03

GoogleCodeExporter commented 8 years ago
NVIDIA GeForce 9400M

Original comment by ingo.jae...@gmail.com on 18 Feb 2011 at 12:40

GoogleCodeExporter commented 8 years ago
Ok, that makes sense.  The GeForce 9400M supports "Compute Capability" 1.1 
which corresponds to arch=sm_11 [1].  The higher compute capabilities will not 
be compatible with your hardware and should produce an error when the program 
is run.  

I'm not sure why no error is being printed in this case.  When I compile and 
run a similar program [2] on my GPU that supports Compute Capability 1.1 (just 
like yours) I get the expected error message:

$ nvcc -arch=sm_13 sort.cu
$ ./a.out 
sorting integers
terminate called after throwing an instance of 'thrust::system::system_error'
  what():  invalid device function 
Aborted

Compiling with -arch=sm_10 or -arch=sm_11 should eliminate the problem.

[1] http://en.wikipedia.org/wiki/CUDA#Supported_GPUs
[2] http://code.google.com/p/thrust/source/browse/examples/sort.cu

Original comment by wnbell on 18 Feb 2011 at 12:55

GoogleCodeExporter commented 8 years ago
Alright, thanks for the update! Sorry for the confusion.

Original comment by ingo.jae...@gmail.com on 20 Feb 2011 at 8:48