Ejemplo n.º 1
0
  void set_map(const std::map<GlobalOrdinal,GlobalOrdinal> &map) {
    std::vector<GlobalOrdinal> rows;
    std::vector<GlobalOrdinal> ids;
    int size=map.size();
    rows.reserve(size);
    ids.reserve(size);

    for(typename std::map<GlobalOrdinal,GlobalOrdinal>::const_iterator it=map.begin(); it!=map.end(); ++it) {
      ids.push_back(it->first);
      rows.push_back(it->second);
    }
    d_ids.resize(size);
    d_rows.resize(size);

    cudaMemcpyAsync(thrust::raw_pointer_cast(&d_ids[0]),&ids[0],size*sizeof(GlobalOrdinal),cudaMemcpyHostToDevice,CudaManager::s1);
    cudaMemcpyAsync(thrust::raw_pointer_cast(&d_rows[0]),&rows[0],size*sizeof(GlobalOrdinal),cudaMemcpyHostToDevice,CudaManager::s1);
  }
Ejemplo n.º 2
0
 static void resize( thrust::device_vector< T > &x , const thrust::device_vector< T > &y )
 {
     x.resize( y.size() );
 }