覆盖 nvcc 的 header 搜索顺序

Overriding header search order for nvcc

我有一个使用 Thrust 的 CUDA 项目。 Thrust 随 CUDA 工具包一起提供,但我想使用我检查过的更新版本。

我用 -isystem=/path/to/thrust 调用 nvcc 但底层编译器调用看起来像

gcc ... "-I/usr/local/cuda-10.1/bin/../targets/x86_64-linux/include"  -isystem "/path/to/thrust"

由于 gcc 从左到右搜索目录,这意味着首先找到工具包的推力 headers。

我能否在不修改 CUDA 工具包或编写编译器包装脚本的情况下覆盖此行为以先找到我的 Thrust 结帐?

我只需要使用 -I 而不是 -isystem

我还了解到 -Xcompiler --foo,--bar 允许我在需要时注入其他参数。