# unsupported device type

**URL:** <https://forums.developer.nvidia.com/t/unsupported-device-type/131874>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [July 25, 2010, 9:19am UTC](https://forums.developer.nvidia.com/t/unsupported-device-type/131874 "2010-07-25T09:19:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhsuan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mhsuan](https://forums.developer.nvidia.com/u/mhsuan)\
**Post date:** [July 25, 2010, 9:19am UTC](https://forums.developer.nvidia.com/t/unsupported-device-type/131874/1 "2010-07-25T09:19:40Z")

</div>

I have downloaded from the internet a simple MPI+PGI CUDA source code as follows.

* * *

! 08/07/2009 I.N. Kozin, STFC Daresbury Lab  
! igor.kozin @ [stfc.ac.uk](http://stfc.ac.uk)  
!  
! simple direct matrix-matrix multiplication  
! c(n3,n1) = a(n3,n2) x b(n2,n1)  
! using MPI, PGI accelerator compiler and device allocation  
!  
! user selectable parameters:  
! work in single or double precision  
! integer, parameter :: WP  
! do or don’t do device allocation  
! logical, parameter :: device\_allocation  
!  
! how to compile for GPU:  
! mpif90 -fast -o matrix-mult-mpi.exe matrix-mult-mpi.f90 -ta=nvidia -Minfo  
!  
! how to compile for CPU:  
! make sure device\_allocation = .FALSE.  
! mpif90 -fast -o matrix-mult-mpi.exe matrix-mult-mpi.f90 -Minfo  
!  
! how to run:  
! mpiexec -n 4 -machinefile hosts ./matrix-mult-mpi.exe n1 n2 n3 iter

module precision  
! select single or double precision  
!integer, parameter :: WP = KIND(1.0)  
integer, parameter :: WP = KIND(1.0D0)  
end module precision

program main  
use accel\_lib  
use mpi  
use precision  
implicit none

!logical, parameter :: device\_allocation = .FALSE.  
logical, parameter :: device\_allocation = .TRUE.  
integer, parameter :: nn = 1000  
integer :: i,j,k,n1,n2,n3,iter,n1t  
real(WP), allocatable :: a(:,:), b(:,:)  
real(WP), allocatable, target :: ct(:,:)  
real(WP), pointer :: c(:,:)  
real mflop, msize  
double precision :: tstart, tend, walltime  
integer :: narg,iargc  
integer :: ierr, size, rank, n1size, n1start, n1end  
integer :: ibuffer(4)  
character\*10 :: arg  
integer stat(MPI\_STATUS\_SIZE), columntype  
integer :: mytag = 1  
! accel  
integer(acc\_device\_kind) devicetype  
integer devicenum, num\_devices

n1=nn; n2=nn; n3=nn; iter=2

write(6,\*) “step 1”

call MPI\_INIT(ierr)  
call MPI\_COMM\_SIZE( MPI\_COMM\_WORLD, size, ierr)  
call MPI\_COMM\_RANK( MPI\_COMM\_WORLD, rank, ierr)

write(6,\*) “step 2”

!===============================================  
if(rank == 0) then  
! input processing  
narg=iargc()

! check command line input  
if (narg == 0) then  
write(6,\*) “./matrix-mult-mpi.exe n1 n2 n3 iter”  
stop  
end if

if (narg \> 0) then  
call getarg(1,arg)  
read(arg,‘(i10)’) n1  
end if

if (narg \> 1) then  
call getarg(2,arg)  
read(arg,‘(i10)’) n2  
end if

if (narg \> 2) then  
call getarg(3,arg)  
read(arg,‘(i10)’) n3  
end if

if (narg \> 3) then  
call getarg(4,arg)  
read(arg,‘(i10)’) iter  
end if

endif

write(6,\*) “step 3”  
!===============================================  
! initialise GPU

! set the accelerator device  
if(device\_allocation) then  
! devicetype = 0 ! none  
! devicetype = 2 ! host  
devicetype = 3 ! nvidia  
! write(6,‘(a12,i10)’) ’ devicetype=',devicetype  
  
  
! get number of devices  
! num\_devices = acc\_get\_num\_devices(devicetype)  
num\_devices = 1

write(6,\*) “step 4”

if(rank == 0) write(6,_) ‘number of devices per host=’, num\_devices  
devicenum = mod(rank,num\_devices)  
write(6,_) ’ rank=‘, rank, ’ devicenum=’, devicenum  
! set accel device  
call acc\_set\_device\_num(devicenum,devicetype)  
! call acc\_set\_device(3)

write(6,\*) “step 5”

call acc\_init(devicetype)

endif

… (not shown due to irrelevance)

* * *

The log of compiling and linking is

* * *

PVF Build Log  
Begin rebuild: clean project  
Deleting intermediate and output files for project ‘MPI\_CUDA\_Test’, configuration ‘Debug’

Compiling Project …

C:\Program Files\Microsoft HPC Pack 2008 SDK\Include\mpi.f90

c:\program files\pgi\win32\10.4\bin\pgfortran.exe -Hx,123,8 -Hx,123,0x40000 -Hx,0,0x40000000 -Mx,0,0x40000000 -Hx,0,0x20000000 -g -Bstatic -Mbackslash -Mmpi=msmpi -Mcuda -Mfree -I"c:\program files\pgi\win32\10.4\include" -I"C:\Program Files\PGI\Microsoft Open Tools 9\include" -I"C:\Program Files\PGI\Microsoft Open Tools 9\PlatformSDK\include" -Ktrap=fp -ta=nvidia,fastmath,wait -Minform=warn -Mprof=func,msmpi,dwarf -module “Win32\Debug” -Minfo=accel,ccff,ftn,intensity,loop,lre,opt,par,vect -o “Win32\Debug\mpi.obj” -c “C:\Program Files\Microsoft HPC Pack 2008 SDK\Include\mpi.f90”

## Command exit code: 0 \

matrix-mult-mpi.f90

c:\program files\pgi\win32\10.4\bin\pgfortran.exe -Hx,123,8 -Hx,123,0x40000 -Hx,0,0x40000000 -Mx,0,0x40000000 -Hx,0,0x20000000 -g -Bstatic -Mbackslash -Mmpi=msmpi -Mcuda -Mfree -I"c:\program files\pgi\win32\10.4\include" -I"C:\Program Files\PGI\Microsoft Open Tools 9\include" -I"C:\Program Files\PGI\Microsoft Open Tools 9\PlatformSDK\include" -Ktrap=fp -ta=nvidia,fastmath,wait -Minform=warn -Mprof=func,msmpi,dwarf -module “Win32\Debug” -Minfo=accel,ccff,ftn,intensity,loop,lre,opt,par,vect -o “Win32\Debug\matrix-mult-mpi.obj” -c “D:\MPI\_CUDA\_Test\matrix-mult-mpi.f90”

Command exit code: 0

## Command output: [main: 197, Possible copy in and copy out of c in call to mmult mmult: 227, Generating copyin(b(:n2,:n1)) Generating copyin(a(:n3,:n2)) Generating copy(c(:n3,:n1)) Generating compute capability 1.3 kernel 229, Loop is parallelizable 231, Loop carried dependence of ‘c’ prevents parallelization Loop carried backward dependence of ‘c’ prevents vectorization 233, Loop is parallelizable Accelerator kernel generated 229, !$acc do parallel, vector(16) 231, !$acc do seq Cached references to size [16x16] block of ‘a’ Cached references to size [16x16] block of ‘b’ 233, !$acc do parallel, vector(16) Using register for ‘c’ ] \

Linking…

c:\program files\pgi\win32\10.4\bin\pgfortran.exe -Wl,/libpath:“c:\program files\pgi\win32\10.4\lib” -Wl,/libpath:“C:\Program Files\PGI\Microsoft Open Tools 9\lib” -Wl,/libpath:“C:\Program Files\PGI\Microsoft Open Tools 9\PlatformSDK\lib” -Yl,“C:\Program Files\PGI\Microsoft Open Tools 9\bin” -g -Bstatic -Mmpi=msmpi -Mcuda -ta=nvidia,fastmath,wait -Mprof=func,msmpi,dwarf -o “D:\MPI\_CUDA\_Test\Win32\Debug\MPI\_CUDA\_Test.exe” -Wl,/libpath:“C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\i386” “Win32\Debug\matrix-mult-mpi.obj” “Win32\Debug\mpi.obj”

Command exit code: 0

Command output: [c:\program files\pgi/win32/10.4/lib\msmpi.obj : warning LNK4042: object specified more than once; extras ignored]

MPI\_CUDA\_Test build succeeded.

* * *

The output of executing pgaccelinfo is

* * *

CUDA Driver Version 3010

Device Number: 0  
Device Name: Tesla C2050  
Device Revision Number: 2.0  
Global Memory Size: 2817720320  
Number of Multiprocessors: 14  
Number of Cores: 448  
Concurrent Copy and Execution: Yes  
Total Constant Memory: 65536  
Total Shared Memory per Block: 49152  
Registers per Block: 32768  
Warp Size: 32  
Maximum Threads per Block: 1024  
Maximum Block Dimensions: 1024, 1024, 64  
Maximum Grid Dimensions: 65535 x 65535 x 1  
Maximum Memory Pitch: 2147483647B  
Texture Alignment 512B  
Clock Rate: 1147 MHz  
Current free memory 2701131776  
Upload time (4MB) 16 microseconds  
Download time 15 microseconds  
Upload bandwidth 262144 MB/sec  
Download bandwidth 279620 MB/sec

* * *

Running the executable generates the following output

* * *

$ ./MPI\_CUDA\_Test.exe 800 200 200 2  
Usage error: call to acc\_set\_device with unsupported device type: 4715104  
step 1  
step 2  
step 3  
step 4  
number of devices per host= 1  
rank= 0 devicenum= 0

* * *

The explicit setting “devicetype = 3” seems not seen by and passed to the routine “acc\_set\_device\_num”.  
What’s wrong with it?

On the other hand, if I uncomment the line “num\_devices = acc\_get\_num\_devices(devicetype)”, the linking output indicates an unresolved external symbol \_ACC\_GET\_NUM\_DEVICE.  
Again, why is this routine not recognized?

Thank you very much.

M-H Chung

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [July 26, 2010, 6:51pm UTC](https://forums.developer.nvidia.com/t/unsupported-device-type/131874/2 "2010-07-26T18:51:21Z")

</div>

Hi M-H Chung,

Mixing the PGI Accelerator model with CUDA Fortran isn’t supported in the 10.4 compiler on Win32. Try removing the “-Mcuda” flag.

- Mat

---

<div class="post-metadata">

**Author:** ![mhsuan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mhsuan](https://forums.developer.nvidia.com/u/mhsuan)\
**Post date:** [July 27, 2010, 12:35am UTC](https://forums.developer.nvidia.com/t/unsupported-device-type/131874/3 "2010-07-27T00:35:56Z")

</div>

Removing -Mcuda still generates similar errors:

* * *

$ ./MPI\_CUDA\_Test.exe 800 200 200 2  
step 1  
step 2  
step 3  
step 4  
number of devices per host= 1  
rank= 0 devicenum= 0  
Usage error: call to acc\_set\_device with unsupported device type: 4715104

* * *

BTW, the error message moves to the firstline in the terminal out text if the code is run under the cygwin bash shell.

* * *

$ ./MPI\_CUDA\_Test.exe 800 200 200 2  
Usage error: call to acc\_set\_device with unsupported device type: 4715104  
step 1  
step 2  
step 3  
step 4  
number of devices per host= 1  
rank= 0 devicenum= 0

* * *

Thank you very much.

M-H Chung

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [July 27, 2010, 10:54pm UTC](https://forums.developer.nvidia.com/t/unsupported-device-type/131874/4 "2010-07-27T22:54:18Z")

</div>

Hi M-H Chung,

I tried without success to recreate your issue here, so I’m not sure what’s wrong.

> Usage error: call to acc\_set\_device with unsupported device type: 4715104

This seems to imply that value of ‘devicetype’ contains the number 4715104, which is most likely a garbage value. It should be ‘3’.

Can you double check that ‘devicetype’ does get set? Also, can you print out ‘devicetype’ right before the call to ‘acc\_set\_device\_num’?

```plaintext
print *, 'Device Type: ', devicetype, ' Dev Num:', devicenum
call acc_set_device_num(devicenum,devicetype)

```

- Mat

---

<div class="post-metadata">

**Author:** ![mhsuan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mhsuan](https://forums.developer.nvidia.com/u/mhsuan)\
**Post date:** [July 28, 2010, 2:17am UTC](https://forums.developer.nvidia.com/t/unsupported-device-type/131874/5 "2010-07-28T02:17:07Z")

</div>

Hi Mat,

The terminal output after adding the two lines you suggested is

```nohighlight
D:\MPI_CUDA_Test\Win32\Debug>.\MPI_CUDA_Test.exe 800 200 200 2
 step 1
 step 2
 step 3
 step 4
 number of devices per host= 1
  rank= 0 devicenum= 0
 Device Type: 3 Dev Num: 0
Usage error: call to acc_set_device with unsupported device type: 4715132

```

It’s so strange!

M-H

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [July 28, 2010, 4:33pm UTC](https://forums.developer.nvidia.com/t/unsupported-device-type/131874/6 "2010-07-28T16:33:38Z")

</div>

Hi M-H,

Can you try updating your compiler to version 10.6 or wait til next week when 10.8 is out with CUDA 3.1 support? We just added support for Fermi in 10.4 and I wondering if there was a compatibility issue.

- Mat

---

<div class="post-metadata">

**Author:** ![mhsuan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mhsuan](https://forums.developer.nvidia.com/u/mhsuan)\
**Post date:** [July 30, 2010, 3:26am UTC](https://forums.developer.nvidia.com/t/unsupported-device-type/131874/7 "2010-07-30T03:26:31Z")

</div>

Hi Mat,  
  
  
Exactly the same error message occurred when I ran the code compiled by v10.6. Any other possible reasons? Thanks a lot.

M-H
