[llvm-bugs] [Bug 44803] New: "dynamic initialization is not supported" when compiling CUDA + Thrust code

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 5 11:08:57 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44803

            Bug ID: 44803
           Summary: "dynamic initialization is not supported" when
                    compiling CUDA + Thrust code
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: CUDA
          Assignee: unassignedclangbugs at nondot.org
          Reporter: daniel.jasinski at gmail.com
                CC: llvm-bugs at lists.llvm.org

When compiling the following piece of code with on Windows:

```

#include <thrust/device_vector.h>
#include <thrust/transform.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/copy.h>

using namespace thrust;

int main()
{
    int size = 100;
    device_vector<int> v(100);

    auto counter = make_counting_iterator(0);
    copy(counter, counter + size, v.begin());

    auto multiply = [] __host__ __device__ (const int&x){ return x * x;};
    transform(v.begin(), v.end(), v.begin(), multiply);
}

```

I get the following series of errors:

```

thrust/functional.h:1452:74: error: dynamic initialization is not supported for
__device__, __constant__, and __shared__ variables.
static const __device__ thrust::detail::functional::placeholder<0>::type _1;
thrust/functional.h:1461:74: error: dynamic initialization is not supported for
__device__, __constant__, and __shared__ variables.
static const __device__ thrust::detail::functional::placeholder<1>::type _2;

...

thrust/functional.h:1533:74: error: dynamic initialization is not supported for
__device__, __constant__, and __shared__ variables.
static const __device__ thrust::detail::functional::placeholder<9>::type _10;

```


I used the latest release of Thrust.
I checked the type being initialized and it looks like it has no data and an
empty constructor.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200205/991b436d/attachment.html>


More information about the llvm-bugs mailing list