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]: compile error with c++20 #2488

Closed
1 task done
mhkim90 opened this issue Oct 1, 2024 · 4 comments
Closed
1 task done

[BUG]: compile error with c++20 #2488

mhkim90 opened this issue Oct 1, 2024 · 4 comments
Assignees
Labels
bug Something isn't working right.

Comments

@mhkim90
Copy link

mhkim90 commented Oct 1, 2024

Is this a duplicate?

Type of Bug

Compile-time Error

Component

Thrust

Describe the bug

Build time failure:

In file included from /usr/local/cuda/include/cuda/std/tuple:18,
                 from /usr/local/cuda/include/thrust/tuple.h:36,
                 from /usr/local/cuda/include/thrust/detail/tuple_transform.h:21,
                 from /usr/local/cuda/include/thrust/detail/raw_reference_cast.h:23,
                 from /usr/local/cuda/include/thrust/system/cuda/detail/malloc_and_free.h:23,
                 from /usr/local/cuda/include/thrust/system/detail/adl/malloc_and_free.h:42,
                 from /usr/local/cuda/include/thrust/system/detail/generic/memory.inl:22,
                 from /usr/local/cuda/include/thrust/system/detail/generic/memory.h:69,
                 from /usr/local/cuda/include/thrust/detail/reference.h:28,
                 from /usr/local/cuda/include/thrust/memory.h:26,
                 from /usr/local/cuda/include/thrust/device_ptr.h:25,
                 from /cuda_test/test.h:3,
                 from /cuda_test/test.cpp:1:
/usr/local/cuda/include/cuda/std/detail/libcxx/include/tuple: In substitution of 'template<class ... _Tp> template<class _Tuple> template<class _Tuple2> using _PreferTupleLikeConstructor = cuda::std::__4::__tuple_constraints<_Tp>::__valid_tuple_like_constraints_rank_one<_Tuple>::_PreferTupleLikeConstructorImpl<_Tuple2> [with _Tuple2 = _Tuple; _Tuple = _Tuple; _Tp = {_Tp ...}]':
/usr/local/cuda/include/cuda/std/detail/libcxx/include/tuple:647:43:   required from here
/usr/local/cuda/include/cuda/std/detail/libcxx/include/tuple:647:43: internal compiler error: Segmentation fault
  647 |         _PreferTupleLikeConstructor<_Tuple>::value;

It happens after the commit:

commit 61c1fd043ac0942805bab97429fdf72242182314
Author: Michael Schellenberger Costa <[email protected]>
Date:   Fri Oct 20 03:57:20 2023 -0700

    Replace `thrust::tuple` implementation with `cuda::std::tuple` (#262)

The compile error occurs even though only a thrust header is included without actual code.
It may be a gcc issue, but I don't know the cause right now.

How to Reproduce

Environment

System: RHEL 8.6
GCC: 10.2.1 20201112 (Red Hat 10.2.1-8)
CMake: 3.23.2
CUDA: 12.6.1

CMakeList.txt

cmake_minimum_required(VERSION 3.10)

project(test)

set(CMAKE_CXX_STANDARD 20)

INCLUDE_DIRECTORIES("/usr/local/cuda/include;")

set(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda") 
find_package(CUDA)

SET(CMAKE_CXX_FLAGS "")

add_executable(test
    test.cpp
)

find_library(cudart NAME libcudart.so HINTS "/usr/local/cuda/targets/x86_64-linux/lib")

target_link_libraries(test PRIVATE ${cudart})

test.cpp

#include "test.h"
#include <iostream>

int main(int argc, char** argv) {
    return 0;
}

test.h

#pragma once

#include <thrust/device_ptr.h>

namespace util {

}

Expected behavior

Build success

Reproduction link

No response

Operating System

RHEL 8.6

nvidia-smi output

I think the issue is not related to it.

NVCC version

I think it is not related to nvcc.

@mhkim90 mhkim90 added the bug Something isn't working right. label Oct 1, 2024
@github-project-automation github-project-automation bot moved this to Todo in CCCL Oct 1, 2024
@fbusato
Copy link
Contributor

fbusato commented Oct 1, 2024

thanks for reporting. I opened an internal bug to track the issue (nvbug 4889562)

@fbusato fbusato self-assigned this Oct 3, 2024
@fbusato
Copy link
Contributor

fbusato commented Oct 4, 2024

The compiler team replied that the error is reported by GCC, not nvcc. They also tried to reproduce the bug, but without success. I've tried the same with similar configurations and can't reproduce the bug.

@mhkim90
Copy link
Author

mhkim90 commented Oct 4, 2024

Hi,

I tried it with more recent version of gcc 10 (gcc-10.3.1-1.2.0.1), it is now successfully compiled.
So it seems to happen only older version of gcc 10 (gcc-10.2.1-8.2.0.1)

Feel free to close the issue.

Thanks.

@fbusato fbusato closed this as completed Oct 5, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in CCCL Oct 5, 2024
@miscco
Copy link
Collaborator

miscco commented Oct 14, 2024

To be a more specific here, we always require the latest version of a given host compiler, so for gcc-10 that would be gcc-10.5

That is due to the fact that new minor versions of compilers do not introduce breaking changes but do fix critical bugs.

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

3 participants