次の方法で共有


array::array コンストラクター

array クラスの新しいインスタンスを初期化します。 array<T,N> の既定のコンストラクターがありません。 すべてのコンストラクターは CPU でのみ実行されます。 これらは、Direct3D ターゲットで実行することはできません。

explicit array(
   const Concurrency::extent<_Rank> & _Extent
) restrict(cpu);

explicit array(
   int _E0
) restrict(cpu);

explicit array(
   int _E0,
   int _E1
) restrict(cpu);

explicit array(
   int _E0,
   int _E1,
   int _E2
) restrict(cpu);

array(
   const Concurrency::extent<_Rank>& _Extent,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

array(
   int _E0,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

array(
   int _E0,
   int _E1,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

array(
   int _E0,
   int _E1,
   int _E2,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

array(
   const Concurrency::extent<_Rank>& _Extent,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

array(
   int _E0,
   accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

array(
   int _E0,
   int _E1,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

array(
   int _E0,
   int _E1,
   int _E2,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   _InputIterator _Src_last
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   _InputIterator _Src_first,
   _InputIterator _Src_last
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   _InputIterator _Src_first
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   _InputIterator _Src_last
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   _InputIterator _Src_last
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av,
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

template <
   typename _InputIterator
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av
) restrict(cpu);

explicit array(
   const array_view<const _Value_type, _Rank>& _Src
) restrict(cpu);

array(
   const array_view<const _Value_type, _Rank>& _Src,
   accelerator_view _Av
   access_type _Cpu_access_type = access_type_auto
) restrict(cpu);

array(
   const array_view<const _Value_type, _Rank>& _Src,
   accelerator_view _Av,
   accelerator_view _Associated_Av
) restrict(cpu);

array(
   const array& _Other
) restrict(cpu);

array(
   array && _Other
) restrict(cpu);

パラメーター

  • _Associated_Av
    配列の優先ターゲットの位置を指定する accelerator_view。

  • _Av
    配列の位置を指定する accelerator_view オブジェクト。

  • _Cpu_access_type
    CPU 上の配列に必要な access_type。 このパラメーターには、CPU の access_type 決定をランタイムに任せる access_type_auto の既定値があります。 配列の実際の CPU access_typeget_cpu_access_type メソッドを使用してクエリを実行できます。

  • _Extent
    配列の各次元の範囲。

  • _E0
    このセクションの範囲の最上位のコンポーネント。

  • _E1
    このセクションの範囲の最上位の次のコンポーネント。

  • _E2
    このセクションの範囲の最下位のコンポーネント。

  • _InputIterator
    入力列挙子の型。

  • _Src
    コピーするオブジェクト。

  • _Src_first
    ソース コンテナーへの先頭の反復子。

  • _Src_last
    ソース コンテナーへの終了の反復子。

  • _Other
    その他のデータ ソース。

  • _Rank
    セクションのランク。

  • _Value_type
    コピーされた要素のデータ型。

解説

ステージング コンストラクターには、コンストラクターのパラメーターとして 2 つの accelerator_view オブジェクトがあります。 ステージング配列は、2 つのアクセラレータ (CPU と、Direct3D アクセラレータ) 間の繰り返しコピーを最適化するためのヒントとして使用されます。 ステージング配列はデータ転送のために最適化され、安定したユーザー スペースのメモリがありません。 これらは、CPU とアクセラレータ間で効率的な直接メモリ アクセス (DMA) 転送が行われるように正しいハードウェア アラインメントの DirectX ステージング バッファーによってサポートされます。 ステージング配列の accelerator_view プロパティは、構築に使用された最初のアクセラレータ引数の値を返します。 次のコードに示すように、ステージング配列の内容が転送操作に含まれている場合、これを変更または確認することはできません。

class SimulationServer 
{ 
    array<float,2> acceleratorArray; 
    array<float,2> stagingArray; 
public: 
    SimulationServer(const accelerator_view& av) 
        :acceleratorArray(extent<2>(1000,1000), av), 
         stagingArray(extent<2>(1000,1000), accelerator("cpu"), 
         accelerator("gpu")) 
    { 
    } 
 
    void OnCompute() 
    { 
        array<float,2> &a = acceleratorArray; 
        ApplyNetworkChanges(stagingArray.data()); 
        
        // Starting here, you can't change or examine contents.
        a = stagingArray; 
        parallel_for_each(a.extents, [&](index<2> idx) 
        { 
           // Update a[idx] according to simulation. 
        } 
        stagingArray = a; 
        
        // Starting here, you can change or examine contents.
        SendToClient(stagingArray.data()); 
     } 
}; 

必要条件

ヘッダー: amp.h

名前空間: Concurrency

参照

関連項目

array クラス