[求助]nvcc编译Thrust代码示例出错
#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;
}在联想深腾GPU集群上运行报错:
[xulunfan@ustcgpu demo]$ nvcc demo.cu -o csr
[xulunfan@ustcgpu demo]$ ./csr
terminate called after throwing an instance of 'thrust::system::detail::bad_alloc'
what(): N6thrust6system6detail9bad_allocE: no CUDA-capable device is detected
已放弃
nvcc版本:release 4.1, V0.2.1221
相关推荐
CUDA编译器nvcc的说明
介绍了CUDA的编译器nvcc以及nvcc的有关优化指令
nvcc编译器配置——实用详细步骤
经过查阅资料及多次实验,总结出此详细的配置步骤,用于CUDA的编译器——NVCC的配置。
Thrust CUDA实例程序
Thrust实例程序 v1.2是个CUDA并行算法库,含有一个类似于C++标准模板库(STL)的界面。Thrust提供了一个灵活的高级GPU编程接口,可以极大地增强开放者的生产力,可以利用Thrust迅速开发高性能的应用程序。这是一个非常重要的第三方CUDA开发库。 Thrust is a CUDA library of parallel algorithms with an interface resembling the C++ Standard Template Library (STL). Thrust provides a flexible high-level interface for GPU programming that greatly enhances developer productivity. Develop high-performance applications rapidly with Thrust!
nvcc编译器GPU代码编译[源码]
本文详细介绍了nvcc编译器在GPU代码编译中的应用,包括GPU多代架构、特性列表、应用兼容性、虚拟架构及其特性列表、兼容性补全机制(即时编译和胖二进制)以及nvcc的具体示例。文章强调了不同GPU架构之间的二进制兼容性问题,并提供了如何通过虚拟架构和真实架构的选择来最大化应用程序的兼容性和性能。此外,还介绍了nvcc的简写和扩展符号,以及虚拟架构标识宏的使用,为开发者提供了实用的编译指导和技巧。
CUDA NVCC编译器模板
CUDA的确很强大,但它的编译器配置累坏很多人,虽然文档里写的很清楚,可对于很多新人来说还有有些难度,这个是CODEblocks下的NVCC编译器模板


