Skip to content

Faster ptt#39

Open
36000 wants to merge 28 commits intodipy:masterfrom
36000:faster_ptt
Open

Faster ptt#39
36000 wants to merge 28 commits intodipy:masterfrom
36000:faster_ptt

Conversation

@36000
Copy link
Copy Markdown
Collaborator

@36000 36000 commented Mar 17, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 17, 2026 14:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes the PTT (Parallel Transport Tractography) direction getter by switching from global device memory to CUDA texture memory for ODF data, which enables hardware-accelerated trilinear interpolation. It also adds caching for FA and CSD ODF computations, and introduces a seed for reproducible seed generation.

Changes:

  • Replaced global memory reads with CUDA 3D texture memory lookups for PTT, adding texture allocation/deallocation in the GPU tracker and a new ptt_init.cu kernel for texture-based initial direction finding.
  • Added a DATA_T template parameter to genStreamlinesMergeProb_k and tracker_d to support both raw pointer and texture object data access paths.
  • Added FA and CSD ODF disk caching (--cache-dir) and a --seed-seed argument for reproducible seed generation in the run script.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
run_gpu_streamlines.py Added --cache-dir and --seed-seed CLI args; FA/ODF caching logic
cuslines/cuda_python/cu_tractography.py Texture memory allocation/deallocation for PTT; removed unused MEGABYTE import
cuslines/cuda_python/cu_direction_getters.py Updated kernel template names with DATA_T; handle texture objects in launch calls
cuslines/cuda_c/ptt_init.cu New kernel for PTT initial direction finding using texture memory
cuslines/cuda_c/ptt.cu Changed pmf parameter type to cudaTextureObject_t; replaced trilinear interp with tex3D
cuslines/cuda_c/generate_streamlines_cuda.cu Added DATA_T template parameter to tracker_d and genStreamlinesMergeProb_k; included ptt_init.cu
cuslines/cuda_python/cu_propagate_seeds.py Removed a TODO comment

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to speed up PTT (Parallel Transport Tractography) by moving more parameters to compile-time CUDA macros and introducing CUDA texture-memory paths, while also modernizing Python packaging/lint tooling and adding caching to the example runner.

Changes:

  • Refactor CUDA kernels + Python launch code to use compile-time macros and texture-backed data/metric maps (notably for PTT).
  • Add optional FA/CSD-ODF caching and deterministic seeding controls to run_gpu_streamlines.py.
  • Migrate packaging metadata into pyproject.toml and add Ruff + pre-commit configuration.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
setup.py Removed legacy setuptools build hook (previously used for build-time codegen).
pyproject.toml Adds Ruff config, moves URLs/package-data into pyproject, adds scipy + dev extras.
.pre-commit-config.yaml Adds Ruff + codespell hooks.
run_gpu_streamlines.py Reformats imports/args; adds --cache-dir and caching for FA/CSD ODF; adds --seed-seed.
cuslines/cuda_python/cutils.py Adds allocate_texture() helper and runtime imports for texture creation/copies.
cuslines/cuda_python/cu_tractography.py Allocates dataf/metric_map via textures (PTT + stopping map), compiles kernels via direction getter.
cuslines/cuda_python/cu_direction_getters.py Introduces macro-driven compilation and adds PTT direction getter implementation details.
cuslines/cuda_python/cu_propagate_seeds.py Minor import/format cleanup.
cuslines/cuda_python/_globals.py Updates shared constants module content/comments.
cuslines/cuda_python/init.py Reorders exports/imports.
cuslines/init.py Import ordering tweaks for backend-specific classes.
cuslines/boot_utils.py Formatting-only refactor.
cuslines/cuda_c/* (multiple) Kernel signature refactors, macro usage, PTT init kernel added, texture-based stopping checks, and related updates.
CLAUDE.md Updates repository documentation around constants/codegen conventions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants