cuslines 2.0.0__py3-none-any.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.
- cuslines/__init__.py +13 -0
- cuslines/cuda_c/boot.cu +1066 -0
- cuslines/cuda_c/cudamacro.h +86 -0
- cuslines/cuda_c/cuwsort.cuh +171 -0
- cuslines/cuda_c/disc.h +1886 -0
- cuslines/cuda_c/generate_streamlines_cuda.cu +695 -0
- cuslines/cuda_c/globals.h +103 -0
- cuslines/cuda_c/ptt.cu +559 -0
- cuslines/cuda_c/ptt.cuh +47 -0
- cuslines/cuda_c/tracking_helpers.cu +290 -0
- cuslines/cuda_c/utils.cu +138 -0
- cuslines/cuda_python/__init__.py +13 -0
- cuslines/cuda_python/_globals.py +10 -0
- cuslines/cuda_python/cu_direction_getters.py +472 -0
- cuslines/cuda_python/cu_propagate_seeds.py +259 -0
- cuslines/cuda_python/cu_tractography.py +315 -0
- cuslines/cuda_python/cutils.py +64 -0
- cuslines-2.0.0.dist-info/METADATA +90 -0
- cuslines-2.0.0.dist-info/RECORD +22 -0
- cuslines-2.0.0.dist-info/WHEEL +5 -0
- cuslines-2.0.0.dist-info/licenses/LICENSE +26 -0
- cuslines-2.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
|
|
2
|
+
using namespace cuwsort;
|
|
3
|
+
|
|
4
|
+
template<typename REAL_T>
|
|
5
|
+
__device__ REAL_T interpolation_helper_d(const REAL_T*__restrict__ dataf, const REAL_T wgh[3][2], const long long coo[3][2], int dimy, int dimz, int dimt, int t) {
|
|
6
|
+
REAL_T __tmp = 0;
|
|
7
|
+
#pragma unroll
|
|
8
|
+
for (int i = 0; i < 2; i++) {
|
|
9
|
+
#pragma unroll
|
|
10
|
+
for (int j = 0; j < 2; j++) {
|
|
11
|
+
#pragma unroll
|
|
12
|
+
for (int k = 0; k < 2; k++) {
|
|
13
|
+
__tmp += wgh[0][i] * wgh[1][j] * wgh[2][k] *
|
|
14
|
+
dataf[coo[0][i] * dimy * dimz * dimt +
|
|
15
|
+
coo[1][j] * dimz * dimt +
|
|
16
|
+
coo[2][k] * dimt +
|
|
17
|
+
t];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return __tmp;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
template<int BDIM_X,
|
|
25
|
+
typename REAL_T,
|
|
26
|
+
typename REAL3_T>
|
|
27
|
+
__device__ int trilinear_interp_d(const int dimx,
|
|
28
|
+
const int dimy,
|
|
29
|
+
const int dimz,
|
|
30
|
+
const int dimt,
|
|
31
|
+
int dimt_idx, // If -1, get all
|
|
32
|
+
const REAL_T *__restrict__ dataf,
|
|
33
|
+
const REAL3_T point,
|
|
34
|
+
REAL_T *__restrict__ __vox_data) {
|
|
35
|
+
const REAL_T HALF = static_cast<REAL_T>(0.5);
|
|
36
|
+
|
|
37
|
+
// all thr compute the same here
|
|
38
|
+
if (point.x < -HALF || point.x+HALF >= dimx ||
|
|
39
|
+
point.y < -HALF || point.y+HALF >= dimy ||
|
|
40
|
+
point.z < -HALF || point.z+HALF >= dimz) {
|
|
41
|
+
return -1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
long long coo[3][2];
|
|
45
|
+
REAL_T wgh[3][2]; // could use just one...
|
|
46
|
+
|
|
47
|
+
const REAL_T ONE = static_cast<REAL_T>(1.0);
|
|
48
|
+
|
|
49
|
+
const REAL3_T fl = MAKE_REAL3(FLOOR(point.x),
|
|
50
|
+
FLOOR(point.y),
|
|
51
|
+
FLOOR(point.z));
|
|
52
|
+
|
|
53
|
+
wgh[0][1] = point.x - fl.x;
|
|
54
|
+
wgh[0][0] = ONE-wgh[0][1];
|
|
55
|
+
coo[0][0] = MAX(0, fl.x);
|
|
56
|
+
coo[0][1] = MIN(dimx-1, coo[0][0]+1);
|
|
57
|
+
|
|
58
|
+
wgh[1][1] = point.y - fl.y;
|
|
59
|
+
wgh[1][0] = ONE-wgh[1][1];
|
|
60
|
+
coo[1][0] = MAX(0, fl.y);
|
|
61
|
+
coo[1][1] = MIN(dimy-1, coo[1][0]+1);
|
|
62
|
+
|
|
63
|
+
wgh[2][1] = point.z - fl.z;
|
|
64
|
+
wgh[2][0] = ONE-wgh[2][1];
|
|
65
|
+
coo[2][0] = MAX(0, fl.z);
|
|
66
|
+
coo[2][1] = MIN(dimz-1, coo[2][0]+1);
|
|
67
|
+
|
|
68
|
+
if (dimt_idx == -1) {
|
|
69
|
+
for (int t = threadIdx.x; t < dimt; t += BDIM_X) {
|
|
70
|
+
__vox_data[t] = interpolation_helper_d(dataf, wgh, coo, dimy, dimz, dimt, t);
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
*__vox_data = interpolation_helper_d(dataf, wgh, coo, dimy, dimz, dimt, dimt_idx);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// if (threadIdx.x == 0) {
|
|
77
|
+
// printf("point: %f, %f, %f\n", point.x, point.y, point.z);
|
|
78
|
+
// printf("dimt_idx: %d\n", dimt_idx);
|
|
79
|
+
// // for(int i = 0; i < dimt; i++) {
|
|
80
|
+
// // printf("__vox_data[%d]: %f\n", i, __vox_data[i]);
|
|
81
|
+
// // }
|
|
82
|
+
// }
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
template<int BDIM_X,
|
|
87
|
+
int BDIM_Y,
|
|
88
|
+
typename REAL_T,
|
|
89
|
+
typename REAL3_T>
|
|
90
|
+
__device__ int check_point_d(const REAL_T tc_threshold,
|
|
91
|
+
const REAL3_T point,
|
|
92
|
+
const int dimx,
|
|
93
|
+
const int dimy,
|
|
94
|
+
const int dimz,
|
|
95
|
+
const REAL_T *__restrict__ metric_map) {
|
|
96
|
+
|
|
97
|
+
const int tidy = threadIdx.y;
|
|
98
|
+
|
|
99
|
+
const int lid = (threadIdx.y*BDIM_X + threadIdx.x) % 32;
|
|
100
|
+
const unsigned int WMASK = ((1ull << BDIM_X)-1) << (lid & (~(BDIM_X-1)));
|
|
101
|
+
|
|
102
|
+
__shared__ REAL_T __shInterpOut[BDIM_Y];
|
|
103
|
+
|
|
104
|
+
const int rv = trilinear_interp_d<BDIM_X>(dimx, dimy, dimz, 1, 0, metric_map, point, __shInterpOut+tidy);
|
|
105
|
+
__syncwarp(WMASK);
|
|
106
|
+
#if 0
|
|
107
|
+
if (threadIdx.y == 1 && threadIdx.x == 0) {
|
|
108
|
+
printf("__shInterpOut[tidy]: %f, TC_THRESHOLD_P: %f\n", __shInterpOut[tidy], TC_THRESHOLD_P);
|
|
109
|
+
}
|
|
110
|
+
#endif
|
|
111
|
+
if (rv != 0) {
|
|
112
|
+
return OUTSIDEIMAGE;
|
|
113
|
+
}
|
|
114
|
+
//return (__shInterpOut[tidy] > TC_THRESHOLD_P) ? TRACKPOINT : ENDPOINT;
|
|
115
|
+
return (__shInterpOut[tidy] > tc_threshold) ? TRACKPOINT : ENDPOINT;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
template<int BDIM_X,
|
|
119
|
+
int BDIM_Y,
|
|
120
|
+
typename REAL_T,
|
|
121
|
+
typename REAL3_T>
|
|
122
|
+
__device__ int peak_directions_d(const REAL_T *__restrict__ odf,
|
|
123
|
+
REAL3_T *__restrict__ dirs,
|
|
124
|
+
const REAL3_T *__restrict__ sphere_vertices,
|
|
125
|
+
const int2 *__restrict__ sphere_edges,
|
|
126
|
+
const int num_edges,
|
|
127
|
+
int samplm_nr,
|
|
128
|
+
int *__restrict__ __shInd,
|
|
129
|
+
const REAL_T relative_peak_thres,
|
|
130
|
+
const REAL_T min_separation_angle) {
|
|
131
|
+
|
|
132
|
+
const int tidx = threadIdx.x;
|
|
133
|
+
|
|
134
|
+
const int lid = (threadIdx.y*BDIM_X + threadIdx.x) % 32;
|
|
135
|
+
const unsigned int WMASK = ((1ull << BDIM_X)-1) << (lid & (~(BDIM_X-1)));
|
|
136
|
+
|
|
137
|
+
const unsigned int lmask = (1 << lid)-1;
|
|
138
|
+
|
|
139
|
+
// __shared__ int __shInd[BDIM_Y][SAMPLM_NR];
|
|
140
|
+
|
|
141
|
+
#pragma unroll
|
|
142
|
+
for(int j = tidx; j < samplm_nr; j += BDIM_X) {
|
|
143
|
+
__shInd[j] = 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
REAL_T odf_min = min_d<BDIM_X>(samplm_nr, odf, REAL_MAX);
|
|
147
|
+
odf_min = MAX(0, odf_min);
|
|
148
|
+
|
|
149
|
+
__syncwarp(WMASK);
|
|
150
|
+
|
|
151
|
+
// local_maxima() + _compare_neighbors()
|
|
152
|
+
// selecting only the indices corrisponding to maxima Ms
|
|
153
|
+
// such that M-odf_min >= relative_peak_thres
|
|
154
|
+
//#pragma unroll
|
|
155
|
+
for(int j = 0; j < num_edges; j += BDIM_X) {
|
|
156
|
+
if (j+tidx < num_edges) {
|
|
157
|
+
const int u_ind = sphere_edges[j+tidx].x;
|
|
158
|
+
const int v_ind = sphere_edges[j+tidx].y;
|
|
159
|
+
|
|
160
|
+
//if (u_ind >= NUM_EDGES || v_ind >= NUM_EDGES) { ERROR; }
|
|
161
|
+
|
|
162
|
+
const REAL_T u_val = odf[u_ind];
|
|
163
|
+
const REAL_T v_val = odf[v_ind];
|
|
164
|
+
|
|
165
|
+
//if (u_val != u_val || v_val != v_val) { ERROR_NANs; }
|
|
166
|
+
|
|
167
|
+
// only check that they are not equal
|
|
168
|
+
//if (u_val != v_val) {
|
|
169
|
+
// __shInd[tidy][u_val < v_val ? u_ind : v_ind] = -1; // benign race conditions...
|
|
170
|
+
//}
|
|
171
|
+
if (u_val < v_val) {
|
|
172
|
+
atomicExch(__shInd+u_ind, -1);
|
|
173
|
+
atomicOr( __shInd+v_ind, 1);
|
|
174
|
+
} else if (v_val < u_val) {
|
|
175
|
+
atomicExch(__shInd+v_ind, -1);
|
|
176
|
+
atomicOr( __shInd+u_ind, 1);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
__syncwarp(WMASK);
|
|
181
|
+
|
|
182
|
+
const REAL_T compThres = relative_peak_thres*max_mask_transl_d<BDIM_X>(samplm_nr, __shInd, odf, -odf_min, REAL_MIN);
|
|
183
|
+
#if 1
|
|
184
|
+
/*
|
|
185
|
+
if (!tidy && !tidx) {
|
|
186
|
+
for(int j = 0; j < SAMPLM_NR; j++) {
|
|
187
|
+
printf("local_max[%d]: %d (%f)\n", j, __shInd[tidy][j], odf[j]);
|
|
188
|
+
}
|
|
189
|
+
printf("maxMax with offset %f: %f\n", -odf_min, compThres);
|
|
190
|
+
}
|
|
191
|
+
__syncwarp(WMASK);
|
|
192
|
+
*/
|
|
193
|
+
// compact indices of positive values to the right
|
|
194
|
+
int n = 0;
|
|
195
|
+
|
|
196
|
+
for(int j = 0; j < samplm_nr; j += BDIM_X) {
|
|
197
|
+
|
|
198
|
+
const int __v = (j+tidx < samplm_nr) ? __shInd[j+tidx] : -1;
|
|
199
|
+
const int __keep = (__v > 0) && ((odf[j+tidx]-odf_min) >= compThres);
|
|
200
|
+
const int __msk = __ballot_sync(WMASK, __keep);
|
|
201
|
+
|
|
202
|
+
//__syncwarp(WMASK); // unnecessary
|
|
203
|
+
if (__keep) {
|
|
204
|
+
const int myoff = __popc(__msk & lmask);
|
|
205
|
+
__shInd[n + myoff] = j+tidx;
|
|
206
|
+
}
|
|
207
|
+
n += __popc(__msk);
|
|
208
|
+
//__syncwarp(WMASK); // should be unnecessary
|
|
209
|
+
}
|
|
210
|
+
__syncwarp(WMASK);
|
|
211
|
+
/*
|
|
212
|
+
if (!tidy && !tidx) {
|
|
213
|
+
for(int j = 0; j < n; j++) {
|
|
214
|
+
printf("local_max_compact[%d]: %d\n", j, __shInd[tidy][j]);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
__syncwarp(WMASK);
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
// sort local maxima indices
|
|
221
|
+
if (n < BDIM_X) {
|
|
222
|
+
REAL_T k = REAL_MIN;
|
|
223
|
+
int v = 0;
|
|
224
|
+
if (tidx < n) {
|
|
225
|
+
v = __shInd[tidx];
|
|
226
|
+
k = odf[v];
|
|
227
|
+
}
|
|
228
|
+
warp_sort<32, BDIM_X, WSORT_DIR_DEC>(&k, &v);
|
|
229
|
+
__syncwarp(WMASK);
|
|
230
|
+
|
|
231
|
+
if (tidx < n) {
|
|
232
|
+
__shInd[tidx] = v;
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
// ERROR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
236
|
+
}
|
|
237
|
+
__syncwarp(WMASK);
|
|
238
|
+
|
|
239
|
+
// __shInd[tidy][] contains the indices in odf correspoding to
|
|
240
|
+
// normalized maxima NOT sorted!
|
|
241
|
+
if (n != 0) {
|
|
242
|
+
// remove_similar_vertices()
|
|
243
|
+
// PRELIMINARY INEFFICIENT, SINGLE TH, IMPLEMENTATION
|
|
244
|
+
if (tidx == 0) {
|
|
245
|
+
const REAL_T cos_similarity = COS(min_separation_angle);
|
|
246
|
+
|
|
247
|
+
dirs[0] = sphere_vertices[__shInd[0]];
|
|
248
|
+
|
|
249
|
+
int k = 1;
|
|
250
|
+
for(int i = 1; i < n; i++) {
|
|
251
|
+
|
|
252
|
+
const REAL3_T abc = sphere_vertices[__shInd[i]];
|
|
253
|
+
|
|
254
|
+
int j = 0;
|
|
255
|
+
for(; j < k; j++) {
|
|
256
|
+
const REAL_T cos = FABS(abc.x*dirs[j].x+
|
|
257
|
+
abc.y*dirs[j].y+
|
|
258
|
+
abc.z*dirs[j].z);
|
|
259
|
+
if (cos > cos_similarity) {
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (j == k) {
|
|
264
|
+
dirs[k++] = abc;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
n = k;
|
|
268
|
+
}
|
|
269
|
+
n = __shfl_sync(WMASK, n, 0, BDIM_X);
|
|
270
|
+
__syncwarp(WMASK);
|
|
271
|
+
|
|
272
|
+
}
|
|
273
|
+
/*
|
|
274
|
+
if (!tidy && !tidx) {
|
|
275
|
+
for(int j = 0; j < n; j++) {
|
|
276
|
+
printf("local_max_compact_uniq[%d]: %d\n", j, __shInd[tidy][j]);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
__syncwarp(WMASK);
|
|
280
|
+
*/
|
|
281
|
+
#else
|
|
282
|
+
const int indMax = max_d<BDIM_X, SAMPLM_NR>(__shInd[tidy], -1);
|
|
283
|
+
if (indMax != -1) {
|
|
284
|
+
__ret = MAKE_REAL3(sphere_vertices[indMax][0],
|
|
285
|
+
sphere_vertices[indMax][1],
|
|
286
|
+
sphere_vertices[indMax][2]);
|
|
287
|
+
}
|
|
288
|
+
#endif
|
|
289
|
+
return n;
|
|
290
|
+
}
|
cuslines/cuda_c/utils.cu
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
template<int BDIM_X,
|
|
2
|
+
typename VAL_T>
|
|
3
|
+
__device__ VAL_T max_d(const int n, const VAL_T *__restrict__ src, const VAL_T minVal) {
|
|
4
|
+
|
|
5
|
+
const int tidx = threadIdx.x;
|
|
6
|
+
|
|
7
|
+
const int lid = (threadIdx.y*BDIM_X + threadIdx.x) % 32;
|
|
8
|
+
const unsigned int WMASK = ((1ull << BDIM_X)-1) << (lid & (~(BDIM_X-1)));
|
|
9
|
+
|
|
10
|
+
VAL_T __m = minVal;
|
|
11
|
+
|
|
12
|
+
for(int i = tidx; i < n; i += BDIM_X) {
|
|
13
|
+
__m = MAX(__m, src[i]);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#pragma unroll
|
|
17
|
+
for(int i = BDIM_X/2; i; i /= 2) {
|
|
18
|
+
const VAL_T __tmp = __shfl_xor_sync(WMASK, __m, i, BDIM_X);
|
|
19
|
+
__m = MAX(__m, __tmp);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return __m;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
template<int BDIM_X,
|
|
26
|
+
typename LEN_T,
|
|
27
|
+
typename VAL_T>
|
|
28
|
+
__device__ VAL_T max_mask_transl_d(const int n,
|
|
29
|
+
const LEN_T *__restrict__ srcMsk,
|
|
30
|
+
const VAL_T *__restrict__ srcVal,
|
|
31
|
+
const VAL_T offset,
|
|
32
|
+
const VAL_T minVal) {
|
|
33
|
+
|
|
34
|
+
const int tidx = threadIdx.x;
|
|
35
|
+
|
|
36
|
+
const int lid = (threadIdx.y*BDIM_X + threadIdx.x) % 32;
|
|
37
|
+
const unsigned int WMASK = ((1ull << BDIM_X)-1) << (lid & (~(BDIM_X-1)));
|
|
38
|
+
|
|
39
|
+
VAL_T __m = minVal;
|
|
40
|
+
|
|
41
|
+
for(int i = tidx; i < n; i += BDIM_X) {
|
|
42
|
+
const LEN_T sel = srcMsk[i];
|
|
43
|
+
if (sel > 0) {
|
|
44
|
+
__m = MAX(__m, srcVal[i]+offset);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#pragma unroll
|
|
49
|
+
for(int i = BDIM_X/2; i; i /= 2) {
|
|
50
|
+
const VAL_T __tmp = __shfl_xor_sync(WMASK, __m, i, BDIM_X);
|
|
51
|
+
__m = MAX(__m, __tmp);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return __m;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
template<int BDIM_X,
|
|
58
|
+
typename VAL_T>
|
|
59
|
+
__device__ VAL_T min_d(const int n, const VAL_T *__restrict__ src, const VAL_T maxVal) {
|
|
60
|
+
|
|
61
|
+
const int tidx = threadIdx.x;
|
|
62
|
+
|
|
63
|
+
const int lid = (threadIdx.y*BDIM_X + threadIdx.x) % 32;
|
|
64
|
+
const unsigned int WMASK = ((1ull << BDIM_X)-1) << (lid & (~(BDIM_X-1)));
|
|
65
|
+
|
|
66
|
+
VAL_T __m = maxVal;
|
|
67
|
+
|
|
68
|
+
for(int i = tidx; i < n; i += BDIM_X) {
|
|
69
|
+
__m = MIN(__m, src[i]);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#pragma unroll
|
|
73
|
+
for(int i = BDIM_X/2; i; i /= 2) {
|
|
74
|
+
const VAL_T __tmp = __shfl_xor_sync(WMASK, __m, i, BDIM_X);
|
|
75
|
+
__m = MIN(__m, __tmp);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return __m;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
template<int BDIM_X, typename REAL_T>
|
|
82
|
+
__device__ void prefix_sum_sh_d(REAL_T *num_sh, int __len) {
|
|
83
|
+
const int tidx = threadIdx.x;
|
|
84
|
+
|
|
85
|
+
const int lid = (threadIdx.y*BDIM_X + threadIdx.x) % 32;
|
|
86
|
+
const unsigned int WMASK = ((1ull << BDIM_X)-1) << (lid & (~(BDIM_X-1)));
|
|
87
|
+
|
|
88
|
+
#if 0
|
|
89
|
+
// for debugging
|
|
90
|
+
__syncwarp(WMASK);
|
|
91
|
+
if (tidx == 0) {
|
|
92
|
+
for (int j = 1; j < __len; j++) {
|
|
93
|
+
num_sh[j] += num_sh[j-1];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
__syncwarp(WMASK);
|
|
97
|
+
#else
|
|
98
|
+
for (int j = 0; j < __len; j += BDIM_X) {
|
|
99
|
+
if ((tidx == 0) && (j != 0)) {
|
|
100
|
+
num_sh[j] += num_sh[j-1];
|
|
101
|
+
}
|
|
102
|
+
__syncwarp(WMASK);
|
|
103
|
+
|
|
104
|
+
REAL_T __t_pmf;
|
|
105
|
+
if (j+tidx < __len) {
|
|
106
|
+
__t_pmf = num_sh[j+tidx];
|
|
107
|
+
}
|
|
108
|
+
for (int i = 1; i < BDIM_X; i*=2) {
|
|
109
|
+
REAL_T __tmp = __shfl_up_sync(WMASK, __t_pmf, i, BDIM_X);
|
|
110
|
+
if ((tidx >= i) && (j+tidx < __len)) {
|
|
111
|
+
__t_pmf += __tmp;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (j+tidx < __len) {
|
|
115
|
+
num_sh[j+tidx] = __t_pmf;
|
|
116
|
+
}
|
|
117
|
+
__syncwarp(WMASK);
|
|
118
|
+
}
|
|
119
|
+
#endif
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
template<typename REAL_T>
|
|
123
|
+
__device__ void printArrayAlways(const char *name, int ncol, int n, REAL_T *arr) {
|
|
124
|
+
printf("%s:\n", name);
|
|
125
|
+
|
|
126
|
+
for(int j = 0; j < n; j++) {
|
|
127
|
+
if ((j%ncol)==0) printf("\n");
|
|
128
|
+
printf("%10.8f ", arr[j]);
|
|
129
|
+
}
|
|
130
|
+
printf("\n");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
template<typename REAL_T>
|
|
134
|
+
__device__ void printArray(const char *name, int ncol, int n, REAL_T *arr) {
|
|
135
|
+
if (!threadIdx.x && !threadIdx.y && !blockIdx.x) {
|
|
136
|
+
printArrayAlways(name, ncol, n, arr);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .cu_tractography import GPUTracker
|
|
2
|
+
from .cu_direction_getters import (
|
|
3
|
+
ProbDirectionGetter,
|
|
4
|
+
PttDirectionGetter,
|
|
5
|
+
BootDirectionGetter,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"GPUTracker",
|
|
10
|
+
"ProbDirectionGetter",
|
|
11
|
+
"PttDirectionGetter",
|
|
12
|
+
"BootDirectionGetter",
|
|
13
|
+
]
|