From: Justin Lebar Date: Fri, 16 Sep 2016 04:14:02 +0000 (+0000) Subject: [CUDA] [doc] Note that you can use std::min/max from device code with C++14. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c53e38407dbb6995fcbdae7238a0116d903f0aad;p=llvm [CUDA] [doc] Note that you can use std::min/max from device code with C++14. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281702 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/CompileCudaWithLLVM.rst b/docs/CompileCudaWithLLVM.rst index 1bd094e55ba..9af9b14b4e5 100644 --- a/docs/CompileCudaWithLLVM.rst +++ b/docs/CompileCudaWithLLVM.rst @@ -132,8 +132,8 @@ Standard library support In clang and nvcc, most of the C++ standard library is not supported on the device side. -``math.h`` and ``cmath`` ------------------------- +```` and ```` +---------------------------- In clang, ``math.h`` and ``cmath`` are available and `pass `_ @@ -161,8 +161,8 @@ available. std::sinf(0.); // nvcc - no such function } -``std::complex`` ----------------- +```` +------------------ nvcc does not officially support ``std::complex``. It's an error to use ``std::complex`` in ``__device__`` code, but it often works in ``__host__ @@ -182,6 +182,12 @@ implicitly ``__host__ __device__`` (this corresponds to nvcc's ``constexpr``, so you can use these with clang. (nvcc does not currently support C++14.) +```` +--------------- + +In C++14, many useful functions from ```` (notably, ``std::min`` and +``std::max``) become constexpr. You can therefore use these in device code, +when compiling with clang. Detecting clang vs NVCC from code =================================