cuslines 2.0.0__tar.gz

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-2.0.0/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ 3. Neither the name of the copyright holder nor the names of its
14
+ contributors may be used to endorse or promote products derived from
15
+ this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: cuslines
3
+ Version: 2.0.0
4
+ Summary: GPU-accelerated tractography package
5
+ Requires-Python: >=3.7
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: numpy
9
+ Requires-Dist: nibabel
10
+ Requires-Dist: tqdm
11
+ Requires-Dist: dipy
12
+ Requires-Dist: trx-python
13
+ Requires-Dist: cuda-python
14
+ Requires-Dist: cuda-core
15
+ Requires-Dist: cuda-cccl
16
+ Dynamic: license-file
17
+
18
+ # GPUStreamlines
19
+
20
+ ## Installation
21
+ To install, simply run `pip install .` in the top-level repository directory.
22
+
23
+ ## Running the examples
24
+ This repository contains several example usage scripts.
25
+
26
+ The script `run_gpu_streamlines.py` demonstrates how to run any diffusion MRI dataset on the GPU. It can also run on the CPU for reference, if the argument `--device=cpu` is used. If not data is passed, it will donaload and use the HARDI dataset.
27
+
28
+ To run the baseline CPU example on a random set of 1000 seeds, this is the command and example output:
29
+ ```
30
+ $ python run_gpu_streamlines.py --device=cpu --output-prefix small --nseeds 1000
31
+ parsing arguments
32
+ Fitting Tensor
33
+ Computing anisotropy measures (FA,MD,RGB)
34
+ slowadcodf
35
+ Bootstrap direction getter
36
+ streamline gen
37
+ Generated 2746 streamlines from 1000 seeds, time: 6.713643550872803 s
38
+ Saved streamlines to small.1_1.trk, time 0.22669768333435059 s
39
+ Completed processing 1000 seeds.
40
+ Initialization time: 12.355878829956055 sec
41
+ Streamline generation total time: 6.9404990673065186 sec
42
+ Streamline processing: 6.713643550872803 sec
43
+ File writing: 0.22669768333435059 sec
44
+ ```
45
+
46
+ To run the same case on a single GPU, this is the command and example output:
47
+ ```
48
+ $ python run_gpu_streamlines.py --output-prefix small --nseeds 1000 --ngpus 1
49
+ parsing arguments
50
+ Fitting Tensor
51
+ Computing anisotropy measures (FA,MD,RGB)
52
+ slowadcodf
53
+ Bootstrap direction getter
54
+ streamline gen
55
+ Creating GPUTracker with 1 GPUs...
56
+ Generated 2512 streamlines from 1000 seeds, time: 0.21228599548339844 s
57
+ Saved streamlines to small.1_1.trk, time 0.17112255096435547 s
58
+ Completed processing 1000 seeds.
59
+ Initialization time: 14.81659483909607 sec
60
+ Streamline generation total time: 0.3834989070892334 sec
61
+ Streamline processing: 0.21228599548339844 sec
62
+ File writing: 0.17112255096435547 sec
63
+ Destroy GPUTracker...
64
+ ```
65
+
66
+ Note that if you experience memory errors, you can adjust the `--chunk-size` flag.
67
+
68
+ To run on more seeds, we suggest setting the `--write-method trx` flag in the GPU script to not get bottlenecked by writing files.
69
+
70
+ ## Running on AWS with Docker
71
+ First, set up an AWS instance with GPU and ssh into it (we recommend a P3 instance with at least 1 V100 16 GB GPU and a Deep Learning AMI Ubuntu 18.04 v 33.0.). Then do the following:
72
+ 1. Log in to GitHub docker registry:
73
+ ```
74
+ $ docker login -u <github id> docker.pkg.github.com
75
+ ```
76
+ 2. Enter your GitHub access token. If you do not have one, create it on the GitHub general security settings page and enable package read access for that token.
77
+ 3. Pull the container:
78
+ ```
79
+ $ docker pull docker.pkg.github.com/dipy/gpustreamlines/gpustreamlines:latest
80
+ ```
81
+ 4. Run the code, mounting the current directory into the container for easy result retrieval:
82
+ ```
83
+ $ docker run --gpus=all -v ${PWD}:/opt/exec/output:rw -it docker.pkg.github.com/dipy/gpustreamlines/gpustreamlines:latest \
84
+ python run_gpu_streamlines.py --ngpus 1 --output-prefix output/hardi_gpu_full --use-fast-write
85
+ ```
86
+ 5. The code produces a number of independent track files (one per processed "chunk"), but we have provided a merge script to combine them into a single trk file. To merge files, run:
87
+ ```
88
+ $ docker run --gpus=all -v ${PWD}:/opt/exec/output:rw -it docker.pkg.github.com/dipy/gpustreamlines/gpustreamlines:latest \
89
+ ./merge_trk.sh -o output/hardi_tracks.trk output/hardi_gpu_full*
90
+ ```
@@ -0,0 +1,73 @@
1
+ # GPUStreamlines
2
+
3
+ ## Installation
4
+ To install, simply run `pip install .` in the top-level repository directory.
5
+
6
+ ## Running the examples
7
+ This repository contains several example usage scripts.
8
+
9
+ The script `run_gpu_streamlines.py` demonstrates how to run any diffusion MRI dataset on the GPU. It can also run on the CPU for reference, if the argument `--device=cpu` is used. If not data is passed, it will donaload and use the HARDI dataset.
10
+
11
+ To run the baseline CPU example on a random set of 1000 seeds, this is the command and example output:
12
+ ```
13
+ $ python run_gpu_streamlines.py --device=cpu --output-prefix small --nseeds 1000
14
+ parsing arguments
15
+ Fitting Tensor
16
+ Computing anisotropy measures (FA,MD,RGB)
17
+ slowadcodf
18
+ Bootstrap direction getter
19
+ streamline gen
20
+ Generated 2746 streamlines from 1000 seeds, time: 6.713643550872803 s
21
+ Saved streamlines to small.1_1.trk, time 0.22669768333435059 s
22
+ Completed processing 1000 seeds.
23
+ Initialization time: 12.355878829956055 sec
24
+ Streamline generation total time: 6.9404990673065186 sec
25
+ Streamline processing: 6.713643550872803 sec
26
+ File writing: 0.22669768333435059 sec
27
+ ```
28
+
29
+ To run the same case on a single GPU, this is the command and example output:
30
+ ```
31
+ $ python run_gpu_streamlines.py --output-prefix small --nseeds 1000 --ngpus 1
32
+ parsing arguments
33
+ Fitting Tensor
34
+ Computing anisotropy measures (FA,MD,RGB)
35
+ slowadcodf
36
+ Bootstrap direction getter
37
+ streamline gen
38
+ Creating GPUTracker with 1 GPUs...
39
+ Generated 2512 streamlines from 1000 seeds, time: 0.21228599548339844 s
40
+ Saved streamlines to small.1_1.trk, time 0.17112255096435547 s
41
+ Completed processing 1000 seeds.
42
+ Initialization time: 14.81659483909607 sec
43
+ Streamline generation total time: 0.3834989070892334 sec
44
+ Streamline processing: 0.21228599548339844 sec
45
+ File writing: 0.17112255096435547 sec
46
+ Destroy GPUTracker...
47
+ ```
48
+
49
+ Note that if you experience memory errors, you can adjust the `--chunk-size` flag.
50
+
51
+ To run on more seeds, we suggest setting the `--write-method trx` flag in the GPU script to not get bottlenecked by writing files.
52
+
53
+ ## Running on AWS with Docker
54
+ First, set up an AWS instance with GPU and ssh into it (we recommend a P3 instance with at least 1 V100 16 GB GPU and a Deep Learning AMI Ubuntu 18.04 v 33.0.). Then do the following:
55
+ 1. Log in to GitHub docker registry:
56
+ ```
57
+ $ docker login -u <github id> docker.pkg.github.com
58
+ ```
59
+ 2. Enter your GitHub access token. If you do not have one, create it on the GitHub general security settings page and enable package read access for that token.
60
+ 3. Pull the container:
61
+ ```
62
+ $ docker pull docker.pkg.github.com/dipy/gpustreamlines/gpustreamlines:latest
63
+ ```
64
+ 4. Run the code, mounting the current directory into the container for easy result retrieval:
65
+ ```
66
+ $ docker run --gpus=all -v ${PWD}:/opt/exec/output:rw -it docker.pkg.github.com/dipy/gpustreamlines/gpustreamlines:latest \
67
+ python run_gpu_streamlines.py --ngpus 1 --output-prefix output/hardi_gpu_full --use-fast-write
68
+ ```
69
+ 5. The code produces a number of independent track files (one per processed "chunk"), but we have provided a merge script to combine them into a single trk file. To merge files, run:
70
+ ```
71
+ $ docker run --gpus=all -v ${PWD}:/opt/exec/output:rw -it docker.pkg.github.com/dipy/gpustreamlines/gpustreamlines:latest \
72
+ ./merge_trk.sh -o output/hardi_tracks.trk output/hardi_gpu_full*
73
+ ```
@@ -0,0 +1,13 @@
1
+ from .cuda_python import (
2
+ GPUTracker,
3
+ ProbDirectionGetter,
4
+ PttDirectionGetter,
5
+ BootDirectionGetter
6
+ )
7
+
8
+ __all__ = [
9
+ "GPUTracker",
10
+ "ProbDirectionGetter",
11
+ "PttDirectionGetter",
12
+ "BootDirectionGetter"
13
+ ]