Mercurial > minori
comparison dep/fmt/test/cuda-test/cuda-cpp14.cu @ 343:1faa72660932
*: transfer back to cmake from autotools
autotools just made lots of things more complicated than
they should have and many things broke (i.e. translations)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Thu, 20 Jun 2024 05:56:06 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
342:adb79bdde329 | 343:1faa72660932 |
---|---|
1 // Direct NVCC command line example: | |
2 // | |
3 // nvcc ./cuda-cpp14.cu -x cu -I"../include" -l"fmtd" -L"../build/Debug" \ | |
4 // -std=c++14 -Xcompiler /std:c++14 -Xcompiler /Zc:__cplusplus | |
5 | |
6 // Ensure that we are using the latest C++ standard for NVCC | |
7 // The version is C++14 | |
8 // | |
9 // https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#c-cplusplus-language-support | |
10 // https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros | |
11 static_assert(__cplusplus >= 201402L, "expect C++ 2014 for nvcc"); | |
12 | |
13 #include <fmt/core.h> | |
14 | |
15 #include <cuda.h> | |
16 #include <iostream> | |
17 | |
18 extern auto make_message_cpp() -> std::string; | |
19 extern auto make_message_cuda() -> std::string; | |
20 | |
21 int main() { | |
22 std::cout << make_message_cuda() << std::endl; | |
23 std::cout << make_message_cpp() << std::endl; | |
24 } | |
25 | |
26 auto make_message_cuda() -> std::string { | |
27 return fmt::format("nvcc compiler \t: __cplusplus == {}", __cplusplus); | |
28 } |