autodock-gpu: build with the specified cuda_arch (#42244)

The CUDA target should be specified at build time, otherwise
by default `autodock-gpu` will be built for compute capabilities
52, 60, 61, 70, which may cause errors on unsopported cards.
This commit is contained in:
Loris Ercole 2024-01-23 21:52:38 +01:00 committed by GitHub
parent 890a46c071
commit 4c86ecc531
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,7 +6,7 @@
from spack.package import *
class AutodockGpu(MakefilePackage):
class AutodockGpu(MakefilePackage, CudaPackage):
"""AutoDock-GPU: AutoDock for GPUs and other accelerators.
OpenCL and Cuda accelerated version of AutoDock 4.2.6. It
leverages its embarrasingly parallelizable LGA by processing
@ -30,14 +30,19 @@ class AutodockGpu(MakefilePackage):
multi=False,
)
variant("overlap", default=False, description="Overlap CPU and GPU operations")
variant("cuda", default=True, description="Build with CUDA")
depends_on("cuda")
conflicts("~cuda") # the cuda variant is mandatory
conflicts("+cuda", when="cuda_arch=none")
@property
def build_targets(self):
spec = self.spec
return [
"DEVICE={0}".format(spec.variants["device"].value.upper()),
"TARGETS={0}".format(" ".join(spec.variants["cuda_arch"].value)),
"GPU_INCLUDE_PATH={0}".format(spec["cuda"].prefix.include),
"GPU_LIBRARY_PATH={0}".format(spec["cuda"].libs.directories[0]),
"OVERLAP={0}".format("ON" if "+overlap" in spec else "OFF"),