# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) # ---------------------------------------------------------------------------- # If you submit this package back to Spack as a pull request, # please first remove this boilerplate and all FIXME comments. # # This is a template package file for Spack. We've put "FIXME" # next to all the things you'll want to change. Once you've handled # them, you can save this file and test your package like this: # # spack install hyquas # # You can edit this file again by typing: # # spack edit hyquas # # See the Spack documentation for more information on packaging. # ---------------------------------------------------------------------------- from spack.package import * class Hyquas(CMakePackage, CudaPackage): """HyQuas is a Hybrid partitioner based Quantum circuit Simulation system on GPU, which supports both single-GPU, single-node-multi-GPU, and multi-node-multi-GPU quantum circuit simulation.""" homepage = "https://github.com/thu-pacman/HyQuas#readme" git = "https://github.com/thu-pacman/HyQuas.git" maintainers = ["germanne"] version('main', submodules=True) depends_on("cmake", type=('build')) depends_on("mpi", type=('build','link', 'run')) for value in CudaPackage.cuda_arch_values: depends_on("nccl@2.9.6-1+cuda cuda_arch={0}".format(value), type=('link', 'run'), when='cuda_arch={0}'.format(value)) variant("cuda", default=True, description="Build with CUDA") conflicts("~cuda", msg="HyQuas requires CUDA") build_directory = 'build' def setup_build_environment(self, env): cuda_arch = self.spec.variants['cuda_arch'].value[0] env.set('CUDA_NVCC_FLAGS', '-Xcompiler -fopenmp -std=c++14 -O2 -g -arch=compute_' + cuda_arch + '-code=sm_' + cuda_arch + '--ptxas-options=-v -lineinfo -keep') env.set('GENCODE_FLAGS', '-gencode arch=compute_' + cuda_arch +',code=sm_' + cuda_arch) # env.set("CUDA_HOME", self.spec['cuda'].prefix) env.set("NCCL_ROOT", self.spec['nccl'].prefix) @run_before('cmake') def build_cutt(self): with working_dir('./third-party/cutt'): make() def install(self, spec, prefix): mkdir(prefix.bin) with working_dir(self.build_directory): install('main', prefix.bin)