spy v3.0.0
Andrée Borrel
Loading...
Searching...
No Matches
Accelerators

The accelerator programming models the code is compiled with. More...

Detailed Description

The accelerator programming models the code is compiled with.

These report how the current translation unit is being compiled, not what the machine holds: they are true when the compiler was asked for CUDA or for SYCL, whatever device is present.

Variables

constexpr auto spy::supports::cuda = spy_implementation_defined {}
 CUDA usage indicator.
constexpr auto spy::supports::sycl = spy_implementation_defined {}
 SYCL usage indicator.

Variable Documentation

◆ cuda

auto spy::supports::cuda = spy_implementation_defined {}
inlineconstexpr

#include <spy/accelerator.hpp>

CUDA usage indicator.

Retrieves the information about wether or not current file is compiled using NVCC. Note that this indicator works in both .cpp and .cu files.

Example

#include <iostream>
#include <spy/spy.hpp>
int main()
{
if constexpr(spy::supports::cuda) std::cout << "Compiling with CUDA supports\n";
else std::cout << "No accelerator supports\n";
}
constexpr auto cuda
CUDA usage indicator.
Definition accelerator.hpp:94

◆ sycl

auto spy::supports::sycl = spy_implementation_defined {}
inlineconstexpr

#include <spy/accelerator.hpp>

SYCL usage indicator.

Retrieves the information about wether or not current file is compiled with SYCL supports.

Example

#include <iostream>
#include <spy/spy.hpp>
int main()
{
if constexpr(spy::supports::sycl) std::cout << "Compiling with SYCL supports.\n";
else std::cout << "No accelerator supports\n";
}
constexpr auto sycl
SYCL usage indicator.
Definition accelerator.hpp:68