C++并行应用开发包,Thrust v1.6.0 发布

fmms 12年前
     <p>Thrust 是一个开源的 C++ 库用于开发高性能并行应用程序,以 C++ 标准模板库为蓝本实现,Thrust 带来一系列并行计算领域的抽象层。</p>    <p><img title="Thrust logo" alt="C++并行应用开发包,Thrust v1.6.0 发布" src="https://simg.open-open.com/show/a2d885ebf2f2ee12242c3f02c3b8d221.gif" width="90" height="90" /></p>    <p>下面示例代码用来并行结算 100 个随机数的和:</p>    <pre class="brush:cpp; toolbar: true; auto-links: false;">#include         <thrust host_vector.h="">            #include           <thrust device_vector.h="">              #include             <thrust generate.h="">                #include               <thrust reduce.h="">                  #include                 <thrust functional.h="">                    #include                   <algorithm>                     #include                     <cstdlib>                       int main(void)  {    // generate random data serially    thrust::host_vector                      <int>                         h_vec(100);    std:generate(h_vec.begin(), h_vec.end(), rand);      // transfer to device and compute sum    thrust::device_vector                        <int>                           d_vec = h_vec;    int x = thrust::reduce(d_vec.begin(), d_vec.end(), 0, thrust::plus                          <int>                            ());    return 0;  }                          </int>                        </int>                      </int>                    </cstdlib>                  </algorithm>                </thrust>              </thrust>            </thrust>          </thrust>        </thrust></pre>    <br />    <br /> Thrust v1.6.0 发布,该版本允许开发者扩展和定制 Thrust 算法,甚至是重新开发整个全新的并行处理后端。同时 1.6 版本还增加对基于 TBB (Threading Building Blocks) 库的后端系统,可更好的将 Thrust 算法已现有的已依赖 TBB 运行的应用进行集成,用于智能的任务调度。    <p></p>