none
请问C++ AMP支持哪些数据类型? RRS feed

  • 问题

  • 我找了很多英文 和 中文的网页,也没找到C++ AMP支持哪些数据类型。

    我目前使用的汉字,要存放2个字节,但我看到过大多数的array_view <const int,1> 要么像这个,用的是int 4字节,float 4字节,double 8字节。我到哪里才可以找到一张表格告诉我:“AMP支持的数据类型,及其长度”?

    如果我输入array_view <const unsigned short int,1> ,编译器就报错,这是不支持的类型。

    2013年9月27日 4:10

答案

  • 你好:

    你可以参考这个链接:http://blogs.msdn.com/b/nativeconcurrency/archive/2011/12/19/restrict-amp-restrictions-part-0-of-n-introduction.aspx


    Sunny Cao
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2013年9月30日 10:06
    版主
  • OpenNovo,你好:

    由于目前C + + AMP是建在Direct3D平台顶端。为了支持全部的C + +的基本类型我们不得不仿真那些不被DirectX 11支持的我们支持基本类型限制下面的列表
    •bool
    •int, unsigned int (__int32, unsigned __int32)
    •long, unsigned long
    •float, double
    •void
    •std::nullptr_t

    需要注意的是boolnullptr_t不像其他基本类型一样全部支持例如,数组中bool数组nullptr_t不支持的。(参考这个)

    基本类型的大小:

    bool

    1 byte

    char, unsigned char, signed char

    1 byte

    short, unsigned short

    2 bytes

    int, unsigned int

    4 bytes

    __intn

    8, 16, 32, 64, or 128 bits depending on the value of n. __intn is Microsoft-specific.

    long, unsigned long

    4 bytes

    float

    4 bytes

    double

    8 bytes

    long double1

    8 bytes

    long long

    Equivalent to __int64.

    array_view类:

    template <
       typename _Value_type,
       int _Rank = 1
    >
    class array_view : public _Array_view_base<_Rank,sizeof(_Value_type)/sizeof(int)>;
                         
    template <
       typename _Value_type,
       int _Rank                     
    >
    class array_view<const _Value_type, _Rank> : public _Array_view_base<_Rank,sizeof(_Value_type)/sizeof(int)>;
    你可以在这里下载C++ AMP例子:http://blogs.msdn.com/b/nativeconcurrency/archive/2012/01/30/c-amp-sample-projects-for-download.aspx


    Sunny Cao
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2013年10月1日 3:08
    版主

全部回复

  • 你好:

    你可以参考这个链接:http://blogs.msdn.com/b/nativeconcurrency/archive/2011/12/19/restrict-amp-restrictions-part-0-of-n-introduction.aspx


    Sunny Cao
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2013年9月30日 10:06
    版主
  • OpenNovo,你好:

    由于目前C + + AMP是建在Direct3D平台顶端。为了支持全部的C + +的基本类型我们不得不仿真那些不被DirectX 11支持的我们支持基本类型限制下面的列表
    •bool
    •int, unsigned int (__int32, unsigned __int32)
    •long, unsigned long
    •float, double
    •void
    •std::nullptr_t

    需要注意的是boolnullptr_t不像其他基本类型一样全部支持例如,数组中bool数组nullptr_t不支持的。(参考这个)

    基本类型的大小:

    bool

    1 byte

    char, unsigned char, signed char

    1 byte

    short, unsigned short

    2 bytes

    int, unsigned int

    4 bytes

    __intn

    8, 16, 32, 64, or 128 bits depending on the value of n. __intn is Microsoft-specific.

    long, unsigned long

    4 bytes

    float

    4 bytes

    double

    8 bytes

    long double1

    8 bytes

    long long

    Equivalent to __int64.

    array_view类:

    template <
       typename _Value_type,
       int _Rank = 1
    >
    class array_view : public _Array_view_base<_Rank,sizeof(_Value_type)/sizeof(int)>;
                         
    template <
       typename _Value_type,
       int _Rank                     
    >
    class array_view<const _Value_type, _Rank> : public _Array_view_base<_Rank,sizeof(_Value_type)/sizeof(int)>;
    你可以在这里下载C++ AMP例子:http://blogs.msdn.com/b/nativeconcurrency/archive/2012/01/30/c-amp-sample-projects-for-download.aspx


    Sunny Cao
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2013年10月1日 3:08
    版主
  • 谢谢大家,我会去研究一下你们提供的链接!
    2013年10月8日 2:12