簡體   English   中英

Cuda Thrust String或Char Sort

[英]Cuda Thrust String or Char Sort

我試圖用cuda推力排序字符串。

我在這個鏈接上找到了一個樣本
https://github.com/bzip2-cuda/bzip2-cuda/blob/master/tst/string_sort_try0.cu

當我嘗試編譯時,我收到以下錯誤消息。 我該怎么辦才能修復它?

"Error 1 error : **no instance of overloaded function "thrust::pointer<Element, Tag, Reference, Derived>::operator= [with Element=char, Tag=thrust::device_system_tag, Reference=thrust::device_reference<char>, Derived=thrust::device_ptr<char>]" matches the argument list** C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v5.5\\include\\thrust\\device_ptr.h 109 1 CharSort "

代碼塊的一部分是

class device_string
{
public:
    int cstr_len;
    char* raw;
    thrust::device_ptr<char> cstr;

    static char* pool_raw;
    static thrust::device_ptr<char> pool_cstr;
    static thrust::device_ptr<char> pool_top;

    // Sets the variables up the first time its used.
    __host__ static void init()
    {
                static bool v = true;
            if( v )
            {
                    v = false;

                    pool_cstr = thrust::device_malloc(POOL_SZ);
                    pool_raw  = (char*)raw_pointer_cast( pool_cstr );
                    pool_top = pool_cstr;
            }
    }
    // Destructor for device variables used.

您可以通過更改以下代碼行來解決該特定問題:

                pool_cstr = thrust::device_malloc(POOL_SZ);

對此:

                pool_cstr = thrust::device_malloc<char>(POOL_SZ);

但正如@Eric指出的那樣,一旦你解決了這個問題,你就會遇到其他試圖編譯這段代碼的問題。

編輯:實際上剩下的問題似乎是所有警告,並產生一個似乎正確運行的可執行文件(使用上述修復)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM