-
Notifications
You must be signed in to change notification settings - Fork 8
Faster ptt #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
36000
wants to merge
28
commits into
dipy:master
Choose a base branch
from
36000:faster_ptt
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Faster ptt #39
Changes from 9 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
5f338dc
transition to tex
36000 e55bea2
more prog
36000 9f83d5d
in progress
36000 436854c
in progress
36000 11a5465
add rng seed for seeds
36000 5af7623
in progress
36000 bf705d9
in progress
36000 bbf107b
in progress
36000 c8299f3
WIP ptt tex memory
36000 8e3e550
return to st
36000 ad20879
remove this
36000 fc32030
massive improvement to PTT: ODF LUT
36000 f1eb21e
add black
36000 0ec372d
ruff linting, begin setting constants in header using JIT
36000 b0b414b
JIT compile more constants
36000 8009706
better norms in ptt
36000 f3edc76
quick simplification
36000 7122085
no more autogenerating _globals.py
36000 b352c4c
copilot fixes
36000 be893d0
up max curvature
36000 b53cc96
ruff
36000 f9e9ba0
finally, fixed this
36000 842e53c
no hard error on exit
36000 a441afd
bf
36000 879d78a
informative message
36000 e3ee23d
better ptt params
36000 98275fb
properly init cuda
36000 50b29bc
cuda python 12 compa
36000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| template<int BDIM_X, | ||
| int BDIM_Y, | ||
| typename REAL_T, | ||
| typename REAL3_T> | ||
| __global__ void getNumStreamlinesPtt_k( | ||
| const REAL_T max_angle, | ||
| const REAL_T relative_peak_thres, | ||
| const REAL_T min_separation_angle, | ||
| const long long rndSeed, | ||
| const int nseed, | ||
| const REAL3_T *__restrict__ seeds, | ||
| const int dimx, | ||
| const int dimy, | ||
| const int dimz, | ||
| const int dimt, | ||
| const cudaTextureObject_t *__restrict__ pmf, | ||
| const REAL3_T *__restrict__ sphere_vertices, | ||
| const int2 *__restrict__ sphere_edges, | ||
| const int num_edges, | ||
| REAL3_T *__restrict__ shDir0, | ||
| int *slineOutOff) { | ||
|
|
||
| const int tidx = threadIdx.x; | ||
| const int tidy = threadIdx.y; | ||
|
|
||
| const int slid = blockIdx.x*blockDim.y + threadIdx.y; | ||
| const size_t gid = blockIdx.x * blockDim.y * blockDim.x + blockDim.x * threadIdx.y + threadIdx.x; | ||
|
|
||
| const int lid = (threadIdx.y*BDIM_X + threadIdx.x) % 32; | ||
| const unsigned int WMASK = ((1ull << BDIM_X)-1) << (lid & (~(BDIM_X-1))); | ||
|
|
||
| const int n32dimt = ((dimt+31)/32)*32; | ||
|
|
||
| if (slid >= nseed) { | ||
| return; | ||
| } | ||
|
|
||
| REAL3_T *__restrict__ __shDir = shDir0+slid*dimt; | ||
| curandStatePhilox4_32_10_t st; | ||
| curand_init(rndSeed, gid, 0, &st); | ||
|
|
||
| extern __shared__ REAL_T __sh[]; | ||
| REAL_T *__pmf_data_sh = __sh + tidy*n32dimt; | ||
|
|
||
| REAL3_T point = seeds[slid]; | ||
|
|
||
| #pragma unroll | ||
| for (int i = tidx; i < dimt; i += BDIM_X) { | ||
| // REAL_T z_query = point.z + (REAL_T)(i * dimz); | ||
| // __pmf_data_sh[i] = tex3D<REAL_T>(*pmf, point.x, point.y, z_query); | ||
|
|
||
36000 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| REAL_T x_query = (REAL_T)(i * dimx) + point.x; | ||
| __pmf_data_sh[i] = tex3D<REAL_T>(*pmf, x_query, point.y, point.z); | ||
| } | ||
| __syncwarp(WMASK); | ||
|
|
||
| const REAL_T absolpmf_thresh = PMF_THRESHOLD_P * max_d<BDIM_X>(dimt, __pmf_data_sh, REAL_MIN); | ||
| __syncwarp(WMASK); | ||
|
|
||
| #pragma unroll | ||
| for(int i = tidx; i < dimt; i += BDIM_X) { | ||
| if (__pmf_data_sh[i] < absolpmf_thresh) { | ||
| __pmf_data_sh[i] = 0.0; | ||
| } | ||
| } | ||
| __syncwarp(WMASK); | ||
|
|
||
| int *__shInd = reinterpret_cast<int *>(__sh + BDIM_Y*n32dimt) + tidy*n32dimt; | ||
| int ndir = peak_directions_d< | ||
| BDIM_X, | ||
| BDIM_Y>(__pmf_data_sh, | ||
| __shDir, | ||
| sphere_vertices, | ||
| sphere_edges, | ||
| num_edges, | ||
| dimt, | ||
| __shInd, | ||
| relative_peak_thres, | ||
| min_separation_angle); | ||
|
|
||
| if (tidx == 0) { | ||
| slineOutOff[slid] = ndir; | ||
| } | ||
|
|
||
| return; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.