Skip to content

Commit

Permalink
fix docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Aug 10, 2023
1 parent 372cae0 commit 108154b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions setup.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#!/usr/bin/env python3
"""
Compile CUDA source code and setup Python 3 package 'nimpa'
for namespace 'niftypet'.
"""
import logging
import re
import sys
from pathlib import Path

from setuptools import find_packages, setup
from setuptools_scm import get_version

from niftypet.ninst import cudasetup as cs
from niftypet.ninst import dinf
from niftypet.ninst import install_tools as tls

__version__ = get_version(root=".", relative_to=__file__)
Expand Down Expand Up @@ -53,9 +52,15 @@
import cuvec as cu
from skbuild import setup as sksetup
assert cu.include_path.is_dir()
nvcc_arches = {"{2:d}{3:d}".format(*i) for i in dinf.gpuinfo() if i[2:4] >= (3, 5)}
if nvcc_arches:
cmake_args.append("-DCMAKE_CUDA_ARCHITECTURES=" + ";".join(sorted(nvcc_arches)))
try:
from miutil import cuinfo
nvcc_arch_raw = map(cuinfo.compute_capability, range(cuinfo.num_devices()))
nvcc_arches = {"%d%d" % i for i in nvcc_arch_raw if i >= (3, 5)}
if nvcc_arches:
cmake_args.append("-DCMAKE_CUDA_ARCHITECTURES=" + ";".join(sorted(nvcc_arches)))
except Exception as exc:
if "sdist" not in sys.argv or any(i in sys.argv for i in ["build", "bdist", "wheel"]):
log.warning("Import or CUDA device detection error:\n%s", exc)
except Exception as exc:
log.warning("Import or CUDA device detection error:\n%s", exc)
setup(**setup_kwargs)
Expand Down

0 comments on commit 108154b

Please sign in to comment.