pulsatrix
Loading...
Searching...
No Matches
host_guard.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <cstdio>
9#include <cstdlib>
10
12
27#define PULSATRIX_REQUIRE_HOST(tensor) \
28 do { \
29 if ((tensor).device() != ::pulsatrix::DeviceType::Cpu) { \
30 std::fprintf(stderr, \
31 "PULSATRIX_ASSERT failed: PULSATRIX_REQUIRE_HOST(%s): host-only code path " \
32 "reached with a non-Cpu tensor at %s:%d\n", \
33 #tensor, __FILE__, __LINE__); \
34 std::abort(); \
35 } \
36 } while (0)
Abstract interface isolating vendor-specific memory/compute operations from Tensor/ComputationGraph.