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

Raise minimum to -std=c++14 and remove support for CUDA 8.0 and gcc 4.9 #900

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

BenjaminW3
Copy link
Member

C++14 allows us to remove boilerplate code and lets us use new language
features (auto return type deduction, std::integer_sequence, generic
lambdas, ...).
GCC 4.9 as well as CUDA 8.0 do not support C++14 fully and are therefore
not supported anymore.

This removes more than 700 lines of boilerplate code! 🎉

@BenjaminW3 BenjaminW3 added this to the Version 0.5.0 milestone Dec 24, 2019
@BenjaminW3 BenjaminW3 requested a review from a team December 24, 2019 13:13
@BenjaminW3 BenjaminW3 force-pushed the topic-c++14 branch 6 times, most recently from 928e8c7 to acc4a78 Compare December 28, 2019 14:27
@BenjaminW3
Copy link
Member Author

BenjaminW3 commented Dec 28, 2019

@ComputationalRadiationPhysics/alpaka-developers I would like to get your feedback:
When C++14 is enabled (-std=c++14) then many of the standard library functions are now constexpr.
This reults in many errors of the kind: error #2891: calling a constexpr __host__ function("operator()") from a __device__ function("foldr") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. because std::plus, std::multiplies, std::min, std::max, std::epsilon and friends are now constexpr. So they can not be used in C++14 within kernels and large parts of alpaka when '--expt-relaxed-constexpr' is not defined.
This problem is independent of this PR and already exists independentently of making C++14 the default. It is not visible in CI because we do not test this combination.
My ask is now: Can we make the definition of --expt-relaxed-constexpr mandatory?

@ax3l
Copy link
Member

ax3l commented Dec 29, 2019

Good call, has my support. (Many CUDA/C++ developers I know argue this should be default in NVCC anyway.)

@psychocoderHPC
Copy link
Member

This problem is independent of this PR and already exists independentently of making C++14 the default. It is not visible in CI because we do not test this combination.
My ask is now: Can we make the definition of --expt-relaxed-constexpr mandatory?

I would like it. The only problem with this flag is that it is pulling all host code signatures into the device compile path. Compiling will fail if you include a host library header e.g. jsoncpp in the user code where bitfields are used for host structures because nvcc is not supporting bitfields on the device.

@ax3l
Copy link
Member

ax3l commented Jan 2, 2020 via email

@BenjaminW3
Copy link
Member Author

BenjaminW3 commented Jan 2, 2020

@psychocoderHPC

The only problem with this flag is that it is pulling all host code signatures into the device compile path.

Shouldn't it only bring the constexpr __host__ functions into the device compile path? Does it also bring all structs into the device compile path even when they do not have a contexpr constructor?

@psychocoderHPC
Copy link
Member

I tried to reproduce the bitfield issue in a mini-app but without success.

The original error was with the lib jsonCpp -> json.h(647): error: "Bitfields and field types containing bitfields are not supported in packed structures and unions for device compilation!"
Since the used app is closed source it is not possible to provide the original code :-(

@BenjaminW3 I think the future development of alpaka without host side constexpr functions will become very hard, so you have green light from my side to make --expt-relaxed-constexpr mandatory.

psychocoderHPC
psychocoderHPC previously approved these changes Jan 3, 2020
@psychocoderHPC
Copy link
Member

@BenjaminW3 could you please rebase to resolve the merge issue

@BenjaminW3
Copy link
Member Author

I resolved the conflicts.

@BenjaminW3 BenjaminW3 force-pushed the topic-c++14 branch 6 times, most recently from edac340 to b355778 Compare January 5, 2020 09:28
C++14 allows us to remove boilerplate code and lets us use new language
features (auto return type deduction, std::integer_sequence, generic
lambdas, ...).
GCC 4.9 as well as CUDA 8.0 do not support C++14 fully and are therefore
not supported anymore.
@BenjaminW3
Copy link
Member Author

I finally got a green build. Please approve and merge! I already have 3 follow-up PRs in the queue ;-)

include/alpaka/meta/Filter.hpp Show resolved Hide resolved
README.md Show resolved Hide resolved
@psychocoderHPC psychocoderHPC merged commit 7180827 into alpaka-group:develop Jan 6, 2020
@BenjaminW3 BenjaminW3 deleted the topic-c++14 branch January 6, 2020 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants