Lines Matching refs:code

11 This document describes how to compile CUDA code with clang, and gives some
29 Before you build CUDA code, you'll need to have installed the CUDA SDK. See
50 compiling CUDA code by noticing that your filename ends with ``.cu``.
56 .. code-block:: console
75 pass e.g. ``-L/usr/local/cuda/lib``. (In CUDA, the device code and host code
76 always have the same pointer widths, so if you're compiling 64-bit code for
77 the host, you're also compiling 64-bit code for the device.) Note that as of
97 Flags that control numerical code
100 If you're using GPUs, you probably care about making numerical code run fast.
121 this flag can affect numerical code.
157 .. code-block:: c++
176 ``std::complex`` in ``__device__`` code, but it often works in ``__host__
177 __device__`` code due to nvcc's interpretation of the "wrong-side rule" (see
190 ``std::max``) become constexpr. You can therefore use these in device code,
193 Detecting clang vs NVCC from code
197 still want to detect when you're compiling CUDA code specifically with clang.
201 compiling for device code, and that host compiler may in fact be clang.
203 When clang is actually compiling CUDA code -- rather than being used as a
209 .. code-block:: c++
212 // clang compiling CUDA code, host mode.
216 // clang compiling CUDA code, device mode.
239 files: ``H``, containing source code for the host, and ``D``, containing
240 source code for the device.
248 ``S_arch``, containing GPU machine code (SASS) for ``arch``.
255 ``H``; nvcc generates code that calls into this header to e.g. launch
259 of the host and device code is present and must be semantically-correct in both
264 * Compile the input ``.cu`` file for device, using clang. ``__host__`` code
266 generating code for the host at this time.
271 nvcc, clang always generates SASS code.
276 * Compile ``H`` using clang. ``__device__`` code is parsed and must be
277 semantically correct, even though we're not generating code for the device
285 code for the host and each device architecture?
303 .. code-block:: c++
312 .. code-block:: c++
322 .. code-block:: c++
330 .. code-block:: c++
357 program is malformed if we emit code for this HD function. We call this the
364 .. code-block:: c++
389 .. code-block:: c++
412 nvcc only emits a warning for ``not_inline_hd``; device code is allowed to call
413 ``not_inline_hd``. In its generated code, nvcc may omit ``not_inline_hd``'s
414 call to ``host_only`` entirely, or it may try to generate code for
433 .. code-block:: c++
460 To make code like this compatible with clang, we recommend you separate it out
461 into two classes. If you need to write code that works on both host and
465 .. code-block:: c++
473 // Now host and device code can call MakeStruct().
479 .. code-block:: c++
495 // Now host and device code can call MakeStruct().
502 Modern CPUs and GPUs are architecturally quite different, so code that's fast
504 LLVM to make it generate good GPU code. Among these changes are:
507 reduce redundancy within straight-line code.
512 most effective on code along dominator paths.
536 SROA, which sometimes speed up code by over 10x.