zoukankan      html  css  js  c++  java
  • Win7 VS2013环境cuda_7.5.18的一些坑

    thrust库的sort算法,在x86平台使用就崩溃,x64就没问题,搜了下好像是很早的版本,4开始就有这样的问题了,原因不明。

    http://stackoverflow.com/questions/33220674/thrustsort-crashes-invalid-argument

    测试代码

     1 #include <iostream>
     2 #include <ctime>
     3 
     4 
     5 #include <thrust/host_vector.h>
     6 #include <thrust/device_vector.h>
     7 #include <thrust/sort.h>
     8 #include <thrust/reduce.h>
     9 
    10 
    11 
    12 using std::cout;
    13 using std::endl;
    14 
    15 using thrust::host_vector;
    16 using thrust::device_vector;
    17 
    18 int Sequence()
    19 {
    20     //static int i = 0;
    21     //return ++i;
    22 
    23     return rand() % 11;
    24 }
    25 
    26 
    27 int main()
    28 {
    29     host_vector<int> hv(10);
    30     device_vector<int> dv(10);
    31 
    32     srand((unsigned int)time(0));
    33 
    34     thrust::generate(hv.begin(), hv.end(), Sequence);
    35 
    36 
    37     for (auto i : hv)
    38     {
    39         cout << i << endl;
    40     }
    41 
    42     cout << endl;
    43 
    44     dv = hv;
    45 
    46     thrust::sort(dv.begin(), dv.end());//will crash on x86,works fine on x64
    47 
    48     for (auto i : dv)
    49     {
    50         cout << i << endl;
    51     }
    52 
    53     cout << endl;
    54 
    55     float sum = thrust::reduce(dv.begin(), dv.end());//sum
    56     cout << "Sum : " << sum << endl;
    57 
    58     
    59 
    60 
    61     return 0;
    62 }

    然后想吐槽一下cuda的编译速度,不知道是不是默认参数的原因,就算编译个简单的hello world,

    估计也是史上最慢的编译器没有之一,什么原因让编译如此之慢,越来越对cuda没兴趣了,

    打算完成一个Opengl版的cuda简单光线追踪应用就放弃,入门与放弃。

  • 相关阅读:
    Devexpress treeList
    sql rowversion
    2015年8月9日 开始 devsxpress 学习
    定时执行任务
    Dexpress 中 grid的使用
    新版 itextsharp pdf code
    jquery ui 中的插件开发
    Centos7下git服务器及gogs部署
    JAVA(TOMCAT)远程调试
    分布式文件系统笔记(慢慢补充)
  • 原文地址:https://www.cnblogs.com/kileyi/p/5499755.html
Copyright © 2011-2022 走看看