CUDA Primes Generation

こ雲淡風輕ζ 提交于 2019-12-03 15:49:36

(unsigned) long long int provides 64-bits. There is no in-built non-vector integer type that is wider than 64 bits. However, you could easily build your own 128-bit integer type. For example:

typedef struct {
  unsigned long long int lo;
  unsigned long long int hi;
} my_uint128;

my_uint128 add_uint128 (my_uint128 a, my_uint128 b)
{
  my_uint128 res;
  res.lo = a.lo + b.lo;
  res.hi = a.hi + b.hi + (res.lo < a.lo);
  return res;
} 

If a higher performance solution is desired, consider mapping a 128-bit integer to a uint4 and using inline PTX for a more efficient handling of the carries between the four 32-bit chunks. source

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!