4

is there any 16 bits long variable in CUDA? I need an unsigned integer of 16 bits. I've tried:

uint16
uint16_t

But no one is recognized by nvcc.

Frederico Schardong
  • 1,946
  • 6
  • 38
  • 62

2 Answers2

8

May be you should try ordinary c unsigned short?

otter
  • 515
  • 2
  • 7
5

CUDA 8 (compute capability 6.x) comes with half-precision intrinsics. You can use the 16-bit floating point data type half or the integral types short2 / char4. These mixed precision types are packed into 32-bit device registers, which can double your performance over just using unsigned short.

Community
  • 1
  • 1
plátano plomo
  • 1,672
  • 1
  • 18
  • 26
  • some SO answers suggest that using composite types also speeds up code https://stackoverflow.com/questions/26676806/efficiency-of-cuda-vector-types-float2-float3-float4 – Alleo Sep 21 '18 at 22:35