Skip to content

Commit 69fe6e5

Browse files
authored
Merge pull request #15 from NiftyPET/devel
next release v0.10.0
2 parents ec75333 + 7e57c81 commit 69fe6e5

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ jobs:
6767
- id: dist
6868
uses: casperdcl/deploy-pypi@v2
6969
with:
70+
requirements: twine setuptools wheel setuptools_scm[toml] tqdm miutil[web]
7071
build: true
7172
password: ${{ secrets.PYPI_TOKEN }}
7273
upload: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') }}
73-
requirements: twine setuptools>=42 wheel setuptools_scm[toml]>=3.4 tqdm miutil[web]>=0.7.0
7474
- name: Changelog
7575
run: git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
7676
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')

niftypet/ninst/cudasetup.py

+31-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
prefix = sys.prefix
2525
pyhdr = get_python_inc() # Python header paths
26-
mincc = 35 # minimum required CUDA compute capability
26+
minc_c = 3, 5 # minimum required CUDA compute capability
27+
mincc = minc_c[0] * 10 + minc_c[1]
2728

2829

2930
def path_niftypet_local():
@@ -103,17 +104,40 @@ def dev_setup():
103104

104105
from miutil import cuinfo
105106

107+
# map from CUDA device order (CC) to NVML order (PCI bus)
108+
nvml_id = [
109+
i
110+
for _, i in sorted(
111+
((cuinfo.compute_capability(i), i) for i in range(cuinfo.num_devices())),
112+
reverse=True,
113+
)
114+
]
106115
if "DEVID" in Cnt:
107116
devid = int(Cnt["DEVID"])
108-
ccstr = cuinfo.nvcc_flags(devid)
109-
ccs = ["{:d}{:d}".format(*cuinfo.compute_capability(devid))]
117+
ccstr = cuinfo.nvcc_flags(nvml_id[devid])
118+
ccs = ["{:d}{:d}".format(*cuinfo.compute_capability(nvml_id[devid]))]
110119
else:
111-
devid = cuinfo.num_devices() - 1
112-
if devid == -1:
120+
devid = 0
121+
devs = cuinfo.num_devices()
122+
if devs < 1:
123+
return ""
124+
ccstr = ";".join(
125+
sorted(
126+
{
127+
cuinfo.nvcc_flags(i)
128+
for i in range(devs)
129+
if cuinfo.compute_capability(i) >= minc_c
130+
}
131+
)
132+
)
133+
if not ccstr:
113134
return ""
114-
ccstr = ";".join(set(map(cuinfo.nvcc_flags, range(devid + 1))))
115135
ccs = sorted(
116-
{"{:d}{:d}".format(*cuinfo.compute_capability(i)) for i in range(devid + 1)}
136+
{
137+
"{:d}{:d}".format(*cuinfo.compute_capability(i))
138+
for i in range(devs)
139+
if cuinfo.compute_capability(i) >= minc_c
140+
}
117141
)
118142

119143
# passing this setting to resources.py

0 commit comments

Comments
 (0)