Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: thrust/system/cuda/detail/util.h missing include header for std::terminate #1278

Closed
1 task done
rnburn opened this issue Jan 12, 2024 · 1 comment
Closed
1 task done
Labels
bug Something isn't working right.

Comments

@rnburn
Copy link

rnburn commented Jan 12, 2024

Is this a duplicate?

Type of Bug

Compile-time Error

Component

CUB

Describe the bug

#include "cub/cub.cuh" fails with the error message:

In file included from external/local_cuda/cuda/include/cub/cub.cuh:54:
In file included from external/local_cuda/cuda/include/cub/device/device_adjacent_difference.cuh:33:
In file included from external/local_cuda/cuda/include/cub/device/dispatch/dispatch_adjacent_difference.cuh:30:
In file included from external/local_cuda/cuda/include/cub/agent/agent_adjacent_difference.cuh:37:
In file included from external/local_cuda/cuda/include/thrust/system/cuda/detail/core/util.h:32:
external/local_cuda/cuda/include/thrust/system/cuda/detail/util.h:203:29: error: no member named 'terminate' in namespace 'std'; did you mean simply 'terminate'?
  203 |   NV_IF_TARGET(NV_IS_HOST, (std::terminate();), (asm("trap;");));
      |                             ^~~~~
external/local_cuda/cuda/include/nv/detail/__target_macros:504:75: note: expanded from macro 'NV_IF_TARGET'
  504 | #  define NV_IF_TARGET(cond, ...)    _NV_BLOCK_EXPAND(_NV_TARGET_IF(cond, __VA_ARGS__))
      |                                                                           ^~~~~~~~~~~
external/local_cuda/cuda/include/nv/detail/__target_macros:467:74: note: expanded from macro '_NV_TARGET_IF'
  467 | #    define _NV_TARGET_IF(cond, t, ...) _NV_IF( _NV_ARCH_COND_CAT(cond), t, __VA_ARGS__)
      |                                                                          ^
external/local_cuda/cuda/include/nv/detail/__preprocessor:44:61: note: expanded from macro '_NV_IF'
   44 | #define _NV_IF(cond, t, f) _NV_IF1(_NV_EVAL(cond), _NV_EVAL(t), _NV_EVAL(f))
      |                                                             ^
note: (skipping 23 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
external/local_cuda/cuda/include/nv/detail/__preprocessor:87:47: note: expanded from macro '_NV_STRIP_PAREN'
   87 | #define _NV_STRIP_PAREN(...) _NV_STRIP_PAREN1(__VA_ARGS__)
      |                                               ^~~~~~~~~~~
external/local_cuda/cuda/include/nv/detail/__preprocessor:86:48: note: expanded from macro '_NV_STRIP_PAREN1'
   86 | #define _NV_STRIP_PAREN1(...) _NV_STRIP_PAREN2 __VA_ARGS__
      |                                                ^~~~~~~~~~~
external/local_cuda/cuda/include/nv/detail/__preprocessor:85:31: note: expanded from macro '_NV_STRIP_PAREN2'
   85 | #define _NV_STRIP_PAREN2(...) __VA_ARGS__
      |                               ^~~~~~~~~~~
external/local_cuda/cuda/include/thrust/system/cuda/detail/util.h:201:1: note: 'terminate' declared here
  201 | terminate()
      | ^
1 error generated when compiling for host.
INFO: Elapsed time: 6.975s, Critical Path: 6.15s
INFO: 4 processes: 4 internal.
FAILED: Build did NOT complete successfully

I was able to workaround the issue by adding #include <exception> before #include "cub/cub.cuh"; it looks like the header file is missing an include for std::terminate.

Note: I'm using a fairly non-standard build environment (clang with libc++ instead of libstdc++).

Here is the file that produces the error: https://github.com/spaceandtimelabs/blitzar/blob/95823fcd5f2cae49bebcdf27da2cbf393ad3a7d1/sxt/algorithm/transform/prefix_scan.cc

How to Reproduce

You can reproduce the issue by following the build instructions here: https://github.com/spaceandtimelabs/blitzar/tree/95823fcd5f2cae49bebcdf27da2cbf393ad3a7d1?tab=readme-ov-file#usage
for the commit spaceandtimelabs/blitzar@95823fc

Expected behavior

No compilation error

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Jun_13_19:16:58_PDT_2023
Cuda compilation tools, release 12.2, V12.2
@rnburn rnburn added the bug Something isn't working right. label Jan 12, 2024
@github-project-automation github-project-automation bot moved this to Todo in CCCL Jan 12, 2024
@miscco
Copy link
Contributor

miscco commented Jan 13, 2024

@rnburn thanks a lot for bringing this up. We always appreciate feedback / bug reports especially for slightly nonstandard build environments.

In this case I am happy to inform you that this has already been fixed. This should already be in the 12.3 CTK.

@miscco miscco closed this as completed Jan 13, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in CCCL Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right.
Projects
Archived in project
Development

No branches or pull requests

2 participants