boostorg / boostorg/multi_array

NVCC unable to compile multi_arrays

未关闭
#34 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
32
派生
39
PR 合并指标
30 天内没有已合并 PR

描述

I am trying to use multi_arrays in a CUDA GPU project and NVCC is unable to compile it.
NVCC version is 12.3 (error also occurs with other versions)
Boost version is 1.84.0 (error also occurs with other versions)

I used the following command to compile:
`nvcc -o C:/_repro/output.exe C:/_repro/main.cu -IC:/boost_1_84_0`

I am using the following code (main.cu):
```C++
#include

int main()
{
boost::multi_array my_arr;
return 0;
}
```

I get the following errors:
```
C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2988: unrecognizable template declaration/definition
C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2143: syntax error: missing ')' before '<'
C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2143: syntax error: missing ';' before '<'
C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2238: unexpected token(s) preceding ';'
C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2059: syntax error: '<'
C:/boost_1_84_0\boost/multi_array/base.hpp(414): error C2059: syntax error: ')'
C:/boost_1_84_0\boost/multi_array/base.hpp(494): error C2143: syntax error: missing ';' before '}'
C:/boost_1_84_0\boost/multi_array/base.hpp(494): error C2238: unexpected token(s) preceding ';'
```

Several more errors occur when I attempt to use further multi_array functionality such as extents and indexing, this is just a minimal example. Additionally, the code compiles just fine when you change the file extention to .cpp, but I assume this is just NVCC falling back on the default cl.exe compiler. I specifically need multi_arrays to compile within a .cu file along with CUDA device code.

Any help is much appreciated, thank you.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Reproduce the minimal example from main.cu with the shown NVCC command, then inspect boost/multi_array/base.hpp around lines 408 and 414 where NVCC reports syntax errors. Compare the .cu and .cpp compilation paths; done means the minimal multi_array declaration compiles in a .cu file with NVCC.

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
data
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。