OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
cuda_dispatch.h
Go to the documentation of this file.
1// OpenNN: Open Neural Networks Library
2// www.opennn.net
3//
4// C U D A D I S P A T C H H E L P E R
5//
6// Artificial Intelligence Techniques SL
7// artelnics@artelnics.com
8
9#pragma once
10
11#ifdef OPENNN_HAS_CUDA
12
13 #define TRY_GPU_DISPATCH(view, ...) \
14 (::opennn::Configuration::instance().is_gpu() \
15 ? ((view).dispatch(__VA_ARGS__), true) \
16 : false)
17
18 #define IF_GPU(...) \
19 do { \
20 if (::opennn::Configuration::instance().is_gpu()) { \
21 __VA_ARGS__ \
22 } \
23 } while (0)
24
25#else
26
27 #define TRY_GPU_DISPATCH(view, ...) (false)
28
29 #define IF_GPU(...) ((void)0)
30
31#endif
32
33// OpenNN: Open Neural Networks Library.
34// Copyright(C) 2005-2026 Artificial Intelligence Techniques, SL.
35// Licensed under the GNU Lesser General Public License v2.1 or later.