lisaanalysistools-cuda11x 1.1.15__cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. lisaanalysistools_cuda11x-1.1.15.dist-info/METADATA +283 -0
  2. lisaanalysistools_cuda11x-1.1.15.dist-info/RECORD +45 -0
  3. lisaanalysistools_cuda11x-1.1.15.dist-info/WHEEL +6 -0
  4. lisaanalysistools_cuda11x-1.1.15.dist-info/licenses/LICENSE +201 -0
  5. lisaanalysistools_cuda11x.libs/libcudart-d0da41ae.so.11.8.89 +0 -0
  6. lisatools/__init__.py +90 -0
  7. lisatools/_version.py +34 -0
  8. lisatools/analysiscontainer.py +474 -0
  9. lisatools/cutils/Detector.cu +307 -0
  10. lisatools/cutils/Detector.hpp +84 -0
  11. lisatools/cutils/__init__.py +129 -0
  12. lisatools/cutils/global.hpp +28 -0
  13. lisatools/datacontainer.py +312 -0
  14. lisatools/detector.py +867 -0
  15. lisatools/diagnostic.py +990 -0
  16. lisatools/git_version.py.in +7 -0
  17. lisatools/orbit_files/equalarmlength-orbits-best-fit-to-esa.h5 +0 -0
  18. lisatools/orbit_files/equalarmlength-orbits.h5 +0 -0
  19. lisatools/orbit_files/esa-trailing-orbits.h5 +0 -0
  20. lisatools/sampling/__init__.py +0 -0
  21. lisatools/sampling/likelihood.py +882 -0
  22. lisatools/sampling/moves/__init__.py +0 -0
  23. lisatools/sampling/moves/skymodehop.py +110 -0
  24. lisatools/sampling/prior.py +646 -0
  25. lisatools/sampling/stopping.py +320 -0
  26. lisatools/sampling/utility.py +411 -0
  27. lisatools/sensitivity.py +1556 -0
  28. lisatools/sources/__init__.py +6 -0
  29. lisatools/sources/bbh/__init__.py +1 -0
  30. lisatools/sources/bbh/waveform.py +106 -0
  31. lisatools/sources/defaultresponse.py +37 -0
  32. lisatools/sources/emri/__init__.py +1 -0
  33. lisatools/sources/emri/waveform.py +79 -0
  34. lisatools/sources/gb/__init__.py +1 -0
  35. lisatools/sources/gb/waveform.py +69 -0
  36. lisatools/sources/utils.py +459 -0
  37. lisatools/sources/waveformbase.py +41 -0
  38. lisatools/stochastic.py +327 -0
  39. lisatools/utils/__init__.py +0 -0
  40. lisatools/utils/constants.py +54 -0
  41. lisatools/utils/exceptions.py +95 -0
  42. lisatools/utils/parallelbase.py +11 -0
  43. lisatools/utils/utility.py +245 -0
  44. lisatools_backend_cuda11x/git_version.py +7 -0
  45. lisatools_backend_cuda11x/pycppdetector.cpython-310-x86_64-linux-gnu.so +0 -0
@@ -0,0 +1,307 @@
1
+ #include "stdio.h"
2
+ #include "global.hpp"
3
+ #include "Detector.hpp"
4
+ #include <iostream>
5
+ #include <stdexcept>
6
+ #include <string>
7
+ #include <sstream>
8
+
9
+ CUDA_DEVICE
10
+ int Orbits::get_window(double t)
11
+ {
12
+ int out = int(t / dt);
13
+ if ((out < 0) || (out >= N))
14
+ return -1;
15
+ else
16
+ return out;
17
+ }
18
+
19
+ CUDA_DEVICE
20
+ int Orbits::get_link_ind(int link)
21
+ {
22
+ if (link == 12)
23
+ return 0;
24
+ else if (link == 23)
25
+ return 1;
26
+ else if (link == 31)
27
+ return 2;
28
+ else if (link == 13)
29
+ return 3;
30
+ else if (link == 32)
31
+ return 4;
32
+ else if (link == 21)
33
+ return 5;
34
+ else
35
+ #ifdef __CUDACC__
36
+ printf("BAD link ind. Must be 12, 23, 31, 13, 32, 21.");
37
+ #else
38
+ throw std::invalid_argument("Bad link ind. Must be 12, 23, 31, 13, 32, 21.");
39
+ #endif // __CUDACC__
40
+ return -1;
41
+ }
42
+
43
+ CUDA_DEVICE
44
+ int Orbits::get_sc_ind(int sc)
45
+ {
46
+ if (sc == 1)
47
+ return 0;
48
+ else if (sc == 2)
49
+ return 1;
50
+ else if (sc == 3)
51
+ return 2;
52
+ else
53
+ {
54
+ #ifdef __CUDACC__
55
+ printf("BAD sc ind. Must be 1,2,3. %d\n", sc);
56
+ #else
57
+ std::ostringstream oss;
58
+ oss << "Bad sc ind. Must be 1,2,3. Input sc is " << sc << " " << std::endl;
59
+ std::string var = oss.str();
60
+ throw std::invalid_argument(var);
61
+ #endif // __CUDACC__
62
+ }
63
+ return 0;
64
+ }
65
+
66
+ CUDA_DEVICE
67
+ double Orbits::interpolate(double t, double *in_arr, int window, int major_ndim, int major_ind, int ndim, int pos)
68
+ {
69
+ double up = in_arr[((window + 1) * major_ndim + major_ind) * ndim + pos]; // down_ind * ndim + pos];
70
+ double down = in_arr[(window * major_ndim + major_ind) * ndim + pos];
71
+
72
+ // m *(x - x0) + y0
73
+ double fin = ((up - down) / dt) * (t - (dt * window)) + down;
74
+ // if ((ndim == 1))
75
+ // printf("%d %e %e %e %e \n", window, fin, down, up, (t - (dt * window)));
76
+
77
+ return fin;
78
+ }
79
+
80
+ CUDA_DEVICE
81
+ void Orbits::get_normal_unit_vec_ptr(Vec *vec, double t, int link)
82
+ {
83
+ Vec _tmp = get_normal_unit_vec(t, link);
84
+ vec->x = _tmp.x;
85
+ vec->y = _tmp.y;
86
+ vec->z = _tmp.z;
87
+ }
88
+
89
+ CUDA_DEVICE
90
+ Vec Orbits::get_normal_unit_vec(double t, int link)
91
+ {
92
+ int window = get_window(t);
93
+ if (window == -1)
94
+ {
95
+ // out of bounds
96
+ return Vec(0.0, 0.0, 0.0);
97
+ }
98
+
99
+ int link_ind = get_link_ind(link);
100
+
101
+ int up_ind = (window + 1) * nlinks + link_ind;
102
+ int down_ind = window * nlinks + link_ind;
103
+
104
+ // x (pos = 0) ndim = 3
105
+ double x_out = interpolate(t, n_arr, window, nlinks, link_ind, 3, 0);
106
+ // y (pos = 1)
107
+ double y_out = interpolate(t, n_arr, window, nlinks, link_ind, 3, 1);
108
+ // z (pos = 2)
109
+ double z_out = interpolate(t, n_arr, window, nlinks, link_ind, 3, 2);
110
+
111
+ return Vec(x_out, y_out, z_out);
112
+ }
113
+
114
+ CUDA_DEVICE
115
+ double Orbits::get_light_travel_time(double t, int link)
116
+ {
117
+ int window = get_window(t);
118
+ if (window == -1)
119
+ {
120
+ // out of bounds
121
+ return 0.0;
122
+ }
123
+
124
+ int link_ind = get_link_ind(link);
125
+ if ((link_ind < 0) || (link_ind >= 6))
126
+ printf("BAD %d\n", link_ind);
127
+ int up_ind = (window + 1) * (nlinks + link_ind);
128
+ int down_ind = window * (nlinks + link_ind);
129
+
130
+ // x (pos = 0), ndim = 1
131
+ double ltt_out = interpolate(t, ltt_arr, window, nlinks, link_ind, 1, 0);
132
+
133
+ return ltt_out;
134
+ }
135
+
136
+ CUDA_DEVICE
137
+ Vec Orbits::get_pos(double t, int sc)
138
+ {
139
+ int window = get_window(t);
140
+ if (window == -1)
141
+ {
142
+ // out of bounds
143
+ return Vec(0.0, 0.0, 0.0);
144
+ }
145
+
146
+ int sc_ind = get_sc_ind(sc);
147
+
148
+ // x (pos = 0), ndim = 3
149
+ double x_out = interpolate(t, x_arr, window, nspacecraft, sc_ind, 3, 0);
150
+ // y (pos = 1), ndim = 3
151
+ double y_out = interpolate(t, x_arr, window, nspacecraft, sc_ind, 3, 1);
152
+ // z (pos = 2), ndim = 3
153
+ double z_out = interpolate(t, x_arr, window, nspacecraft, sc_ind, 3, 2);
154
+ return Vec(x_out, y_out, z_out);
155
+ }
156
+
157
+ CUDA_DEVICE
158
+ void Orbits::get_pos_ptr(Vec *vec, double t, int sc)
159
+ {
160
+ Vec _tmp = get_pos(t, sc);
161
+ vec->x = _tmp.x;
162
+ vec->y = _tmp.y;
163
+ vec->z = _tmp.z;
164
+ }
165
+
166
+ #define NUM_THREADS 64
167
+
168
+
169
+ CUDA_KERNEL
170
+ void get_light_travel_time_kernel(double *ltt, double *t, int *link, int num, Orbits &orbits)
171
+ {
172
+ int start, end, increment;
173
+ #ifdef __CUDACC__
174
+ start = blockIdx.x * blockDim.x + threadIdx.x;
175
+ end = num;
176
+ increment = gridDim.x * blockDim.x;
177
+ #else // __CUDACC__
178
+ start = 0;
179
+ end = num;
180
+ increment = 1;
181
+ #endif // __CUDACC__
182
+
183
+ for (int i = start; i < end; i += increment)
184
+ {
185
+ ltt[i] = orbits.get_light_travel_time(t[i], link[i]);
186
+ }
187
+ }
188
+
189
+ void Orbits::get_light_travel_time_arr(double *ltt, double *t, int *link, int num)
190
+ {
191
+ #ifdef __CUDACC__
192
+ int num_blocks = std::ceil((num + NUM_THREADS - 1) / NUM_THREADS);
193
+
194
+ // copy self to GPU
195
+ Orbits *orbits_gpu;
196
+ gpuErrchk(cudaMalloc(&orbits_gpu, sizeof(Orbits)));
197
+ gpuErrchk(cudaMemcpy(orbits_gpu, this, sizeof(Orbits), cudaMemcpyHostToDevice));
198
+
199
+ get_light_travel_time_kernel<<<num_blocks, NUM_THREADS>>>(ltt, t, link, num, *orbits_gpu);
200
+ cudaDeviceSynchronize();
201
+ gpuErrchk(cudaGetLastError());
202
+
203
+ gpuErrchk(cudaFree(orbits_gpu));
204
+
205
+ #else // __CUDACC__
206
+
207
+ get_light_travel_time_kernel(ltt, t, link, num, *this);
208
+
209
+ #endif // __CUDACC__
210
+ }
211
+
212
+
213
+ CUDA_KERNEL
214
+ void get_pos_kernel(double *pos_x, double *pos_y, double *pos_z, double *t, int *sc, int num, Orbits &orbits)
215
+ {
216
+ int start, end, increment;
217
+ #ifdef __CUDACC__
218
+ start = blockIdx.x * blockDim.x + threadIdx.x;
219
+ end = num;
220
+ increment = gridDim.x * blockDim.x;
221
+ #else // __CUDACC__
222
+ start = 0;
223
+ end = num;
224
+ increment = 1;
225
+ #endif // __CUDACC__
226
+ Vec _tmp(0.0, 0.0, 0.0);
227
+
228
+ for (int i = start; i < end; i += increment)
229
+ {
230
+ _tmp = orbits.get_pos(t[i], sc[i]);
231
+ pos_x[i] = _tmp.x;
232
+ pos_y[i] = _tmp.y;
233
+ pos_z[i] = _tmp.z;
234
+ }
235
+ }
236
+
237
+ void Orbits::get_pos_arr(double *pos_x, double *pos_y, double *pos_z, double *t, int *sc, int num)
238
+ {
239
+ #ifdef __CUDACC__
240
+ int num_blocks = std::ceil((num + NUM_THREADS - 1) / NUM_THREADS);
241
+
242
+ // copy self to GPU
243
+ Orbits *orbits_gpu;
244
+ gpuErrchk(cudaMalloc(&orbits_gpu, sizeof(Orbits)));
245
+ gpuErrchk(cudaMemcpy(orbits_gpu, this, sizeof(Orbits), cudaMemcpyHostToDevice));
246
+
247
+ get_pos_kernel<<<num_blocks, NUM_THREADS>>>(pos_x, pos_y, pos_z, t, sc, num, *orbits_gpu);
248
+ cudaDeviceSynchronize();
249
+ gpuErrchk(cudaGetLastError());
250
+
251
+ gpuErrchk(cudaFree(orbits_gpu));
252
+
253
+ #else // __CUDACC__
254
+
255
+ get_pos_kernel(pos_x, pos_y, pos_z, t, sc, num, *this);
256
+
257
+ #endif // __CUDACC__
258
+ }
259
+
260
+
261
+ CUDA_KERNEL
262
+ void get_normal_unit_vec_kernel(double *normal_unit_vec_x, double *normal_unit_vec_y, double *normal_unit_vec_z, double *t, int *link, int num, Orbits &orbits)
263
+ {
264
+ int start, end, increment;
265
+ #ifdef __CUDACC__
266
+ start = blockIdx.x * blockDim.x + threadIdx.x;
267
+ end = num;
268
+ increment = gridDim.x * blockDim.x;
269
+ #else // __CUDACC__
270
+ start = 0;
271
+ end = num;
272
+ increment = 1;
273
+ #endif // __CUDACC__
274
+ Vec _tmp(0.0, 0.0, 0.0);
275
+
276
+ for (int i = start; i < end; i += increment)
277
+ {
278
+ _tmp = orbits.get_normal_unit_vec(t[i], link[i]);
279
+ normal_unit_vec_x[i] = _tmp.x;
280
+ normal_unit_vec_y[i] = _tmp.y;
281
+ normal_unit_vec_z[i] = _tmp.z;
282
+ }
283
+ }
284
+
285
+ void Orbits::get_normal_unit_vec_arr(double *normal_unit_vec_x, double *normal_unit_vec_y, double *normal_unit_vec_z, double *t, int *link, int num)
286
+ {
287
+ #ifdef __CUDACC__
288
+ int num_blocks = std::ceil((num + NUM_THREADS - 1) / NUM_THREADS);
289
+
290
+ // copy self to GPU
291
+ Orbits *orbits_gpu;
292
+ gpuErrchk(cudaMalloc(&orbits_gpu, sizeof(Orbits)));
293
+ gpuErrchk(cudaMemcpy(orbits_gpu, this, sizeof(Orbits), cudaMemcpyHostToDevice));
294
+
295
+ get_normal_unit_vec_kernel<<<num_blocks, NUM_THREADS>>>(normal_unit_vec_x, normal_unit_vec_y, normal_unit_vec_z, t, link, num, *orbits_gpu);
296
+ cudaDeviceSynchronize();
297
+ gpuErrchk(cudaGetLastError());
298
+
299
+ gpuErrchk(cudaFree(orbits_gpu));
300
+
301
+ #else // __CUDACC__
302
+
303
+ get_normal_unit_vec_kernel(normal_unit_vec_x, normal_unit_vec_y, normal_unit_vec_z, t, link, num, *this);
304
+
305
+ #endif // __CUDACC__
306
+ }
307
+
@@ -0,0 +1,84 @@
1
+ #ifndef __DETECTOR_HPP__
2
+ #define __DETECTOR_HPP__
3
+
4
+ #include "global.hpp"
5
+ #include <iostream>
6
+
7
+ class Vec
8
+ {
9
+ public:
10
+ double x;
11
+ double y;
12
+ double z;
13
+
14
+ CUDA_DEVICE
15
+ Vec(double x_, double y_, double z_)
16
+ {
17
+ x = x_;
18
+ y = y_;
19
+ z = z_;
20
+ }
21
+ };
22
+
23
+ class Orbits
24
+ {
25
+ public:
26
+ double dt;
27
+ int N;
28
+ double *n_arr;
29
+ double *ltt_arr;
30
+ double *x_arr;
31
+ int nlinks;
32
+ int nspacecraft;
33
+ double armlength;
34
+ int *links;
35
+ int *sc_r;
36
+ int *sc_e;
37
+
38
+ Orbits(double dt_, int N_, double *n_arr_, double *ltt_arr_, double *x_arr_, int *links_, int *sc_r_, int *sc_e_, double armlength_)
39
+ {
40
+ dt = dt_;
41
+ N = N_;
42
+ n_arr = n_arr_;
43
+ ltt_arr = ltt_arr_;
44
+ x_arr = x_arr_;
45
+ nlinks = 6;
46
+ nspacecraft = 3;
47
+
48
+ sc_r = sc_r_;
49
+ sc_e = sc_e_;
50
+ links = links_;
51
+ armlength = armlength_;
52
+ };
53
+
54
+ int get_sc_r_from_arr(int i)
55
+ {
56
+ return sc_r[i];
57
+ };
58
+
59
+ int get_sc_e_from_arr(int i)
60
+ {
61
+ return sc_e[i];
62
+ };
63
+
64
+ int get_link_from_arr(int i)
65
+ {
66
+ return links[i];
67
+ };
68
+
69
+ CUDA_DEVICE int get_window(double t);
70
+ CUDA_DEVICE Vec get_normal_unit_vec(double t, int link);
71
+ CUDA_DEVICE double interpolate(double t, double *in_arr, int window, int major_ndim, int major_ind, int ndim, int pos);
72
+ CUDA_DEVICE int get_link_ind(int link);
73
+ CUDA_DEVICE int get_sc_ind(int sc);
74
+ CUDA_DEVICE double get_light_travel_time(double t, int link);
75
+ CUDA_DEVICE Vec get_pos(double t, int sc);
76
+ CUDA_DEVICE void get_normal_unit_vec_ptr(Vec *vec, double t, int link);
77
+ CUDA_DEVICE void get_pos_ptr(Vec *vec, double t, int sc);
78
+ void get_light_travel_time_arr(double *ltt, double *t, int *link, int num);
79
+ void get_pos_arr(double *pos_x, double *pos_y, double *pos_z, double *t, int *sc, int num);
80
+ void get_normal_unit_vec_arr(double *normal_unit_vec_x, double *normal_unit_vec_y, double *normal_unit_vec_z, double *t, int *link, int num);
81
+ void dealloc() {};
82
+ };
83
+
84
+ #endif // __DETECTOR_HPP__
@@ -0,0 +1,129 @@
1
+ from __future__ import annotations
2
+ import dataclasses
3
+ import enum
4
+ import types
5
+ import typing
6
+ import abc
7
+ from typing import Optional, Sequence, TypeVar, Union
8
+ from ..utils.exceptions import *
9
+
10
+ from gpubackendtools.gpubackendtools import BackendMethods, CpuBackend, Cuda11xBackend, Cuda12xBackend
11
+ from gpubackendtools.exceptions import *
12
+
13
+ @dataclasses.dataclass
14
+ class LISAToolsBackendMethods(BackendMethods):
15
+ pycppDetector: object
16
+ # psd_likelihood: typing.Callable[(...), None]
17
+
18
+ class LISAToolsBackend:
19
+ # TODO: not ClassVar?
20
+ pycppDetector: object
21
+ # psd_likelihood: typing.Callable[(...), None]
22
+
23
+ def __init__(self, lisatools_backend_methods):
24
+
25
+ # set direct lisatools methods
26
+ # pass rest to general backend
27
+ assert isinstance(lisatools_backend_methods, LISAToolsBackendMethods)
28
+ self.pycppDetector = lisatools_backend_methods.pycppDetector
29
+ # self.psd_likelihood = lisatools_backend_methods.psd_likelihood
30
+
31
+
32
+ class LISAToolsCpuBackend(CpuBackend, LISAToolsBackend):
33
+ """Implementation of the CPU backend"""
34
+
35
+ _backend_name = "lisatools_backend_cpu"
36
+ _name = "lisatools_cpu"
37
+ def __init__(self, *args, **kwargs):
38
+ CpuBackend.__init__(self, *args, **kwargs)
39
+ LISAToolsBackend.__init__(self, self.cpu_methods_loader())
40
+
41
+ @staticmethod
42
+ def cpu_methods_loader() -> LISAToolsBackendMethods:
43
+ try:
44
+ import lisatools_backend_cpu.pycppdetector
45
+ # import lisatools_backend_cpu.psd
46
+
47
+ except (ModuleNotFoundError, ImportError) as e:
48
+ raise BackendUnavailableException(
49
+ "'cpu' backend could not be imported."
50
+ ) from e
51
+
52
+ numpy = LISAToolsCpuBackend.check_numpy()
53
+
54
+ return LISAToolsBackendMethods(
55
+ pycppDetector=lisatools_backend_cpu.pycppdetector.pycppDetector,
56
+ # psd_likelihood=lisatools_backend_cpu.psd.psd_likelihood,
57
+ xp=numpy,
58
+ )
59
+
60
+
61
+ class LISAToolsCuda11xBackend(Cuda11xBackend, LISAToolsBackend):
62
+
63
+ """Implementation of CUDA 11.x backend"""
64
+ _backend_name : str = "lisatools_backend_cuda11x"
65
+ _name = "lisatools_cuda11x"
66
+
67
+ def __init__(self, *args, **kwargs):
68
+ Cuda11xBackend.__init__(self, *args, **kwargs)
69
+ LISAToolsBackend.__init__(self, self.cuda11x_module_loader())
70
+
71
+ @staticmethod
72
+ def cuda11x_module_loader():
73
+ try:
74
+ import lisatools_backend_cuda11x.pycppdetector
75
+ import lisatools_backend_cuda11x.psd
76
+
77
+ except (ModuleNotFoundError, ImportError) as e:
78
+ raise BackendUnavailableException(
79
+ "'cuda11x' backend could not be imported."
80
+ ) from e
81
+
82
+ try:
83
+ import cupy
84
+ except (ModuleNotFoundError, ImportError) as e:
85
+ raise MissingDependencies(
86
+ "'cuda11x' backend requires cupy", pip_deps=["cupy-cuda11x"]
87
+ ) from e
88
+
89
+ return LISAToolsBackendMethods(
90
+ pycppDetector=lisatools_backend_cuda11x.pycppdetector.pycppDetector,
91
+ # psd_likelihood=lisatools_backend_cuda11x.psd.psd_likelihood,
92
+ xp=cupy,
93
+ )
94
+
95
+ class LISAToolsCuda12xBackend(Cuda12xBackend, LISAToolsBackend):
96
+ """Implementation of CUDA 12.x backend"""
97
+ _backend_name : str = "lisatools_backend_cuda12x"
98
+ _name = "lisatools_cuda12x"
99
+
100
+ def __init__(self, *args, **kwargs):
101
+ Cuda12xBackend.__init__(self, *args, **kwargs)
102
+ LISAToolsBackend.__init__(self, self.cuda12x_module_loader())
103
+
104
+ @staticmethod
105
+ def cuda12x_module_loader():
106
+ try:
107
+ import lisatools_backend_cuda12x.pycppdetector
108
+ # import lisatools_backend_cuda12x.psd
109
+
110
+ except (ModuleNotFoundError, ImportError) as e:
111
+ raise BackendUnavailableException(
112
+ "'cuda12x' backend could not be imported."
113
+ ) from e
114
+
115
+ try:
116
+ import cupy
117
+ except (ModuleNotFoundError, ImportError) as e:
118
+ raise MissingDependencies(
119
+ "'cuda12x' backend requires cupy", pip_deps=["cupy-cuda12x"]
120
+ ) from e
121
+
122
+ return LISAToolsBackendMethods(
123
+ pycppDetector=lisatools_backend_cuda12x.pycppdetector.pycppDetector,
124
+ # psd_likelihood=lisatools_backend_cuda12x.psd.psd_likelihood,
125
+ xp=cupy,
126
+ )
127
+
128
+
129
+ """List of existing backends, per default order of preference."""
@@ -0,0 +1,28 @@
1
+ #ifndef __GLOBAL_HPP__
2
+ #define __GLOBAL_HPP__
3
+
4
+ #ifdef __CUDACC__
5
+ #define CUDA_KERNEL __global__
6
+ #define CUDA_DEVICE __device__
7
+
8
+ #else // __CUDACC__
9
+ #define CUDA_KERNEL
10
+ #define CUDA_DEVICE
11
+
12
+ #endif // __CUDACC__
13
+
14
+ #ifdef __CUDACC__
15
+ #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
16
+ inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
17
+ {
18
+ if (code != cudaSuccess)
19
+ {
20
+ fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
21
+ if (abort) exit(code);
22
+ }
23
+ }
24
+
25
+ #endif
26
+
27
+
28
+ #endif // __GLOBAL_HPP__