Blender
V3.3
intern
cycles
device
cuda
cycles/device/cuda/util.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: Apache-2.0
2
* Copyright 2011-2022 Blender Foundation */
3
4
#pragma once
5
6
#ifdef WITH_CUDA
7
8
# ifdef WITH_CUDA_DYNLOAD
9
# include "cuew.h"
10
# else
11
# include <cuda.h>
12
# endif
13
14
CCL_NAMESPACE_BEGIN
15
16
class
CUDADevice;
17
18
/* Utility to push/pop CUDA context. */
19
class
CUDAContextScope {
20
public
:
21
CUDAContextScope(CUDADevice *device);
22
~CUDAContextScope();
23
24
private
:
25
CUDADevice *device;
26
};
27
28
/* Utility for checking return values of CUDA function calls. */
29
# define cuda_device_assert(cuda_device, stmt) \
30
{ \
31
CUresult result = stmt; \
32
if (result != CUDA_SUCCESS) { \
33
const char *name = cuewErrorString(result); \
34
cuda_device->set_error( \
35
string_printf("%s in %s (%s:%d)"
, name, #stmt, __FILE__, __LINE__)); \
36
} \
37
} \
38
(void)0
39
40
# define cuda_assert(stmt) cuda_device_assert(this, stmt)
41
42
# ifndef WITH_CUDA_DYNLOAD
43
/* Transparently implement some functions, so majority of the file does not need
44
* to worry about difference between dynamically loaded and linked CUDA at all. */
45
const
char
*cuewErrorString(CUresult
result
);
46
const
char
*cuewCompilerPath();
47
int
cuewCompilerVersion();
48
# endif
/* WITH_CUDA_DYNLOAD */
49
50
CCL_NAMESPACE_END
51
52
#endif
/* WITH_CUDA */
result
double result
Definition:
BLI_expr_pylike_eval_test.cc:348
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition:
cuda/compat.h:9
CCL_NAMESPACE_BEGIN
Definition:
python.cpp:37
Generated on Sat Jul 27 2024 14:57:55 for Blender by
doxygen
1.9.1