Spack Prototype for PSI
This commit is contained in:
104
packages/ffbidx/package.py
Normal file
104
packages/ffbidx/package.py
Normal file
@ -0,0 +1,104 @@
|
||||
# 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 ffbidx
|
||||
#
|
||||
# You can edit this file again by typing:
|
||||
#
|
||||
# spack edit ffbidx
|
||||
#
|
||||
# See the Spack documentation for more information on packaging.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
from spack.package import *
|
||||
|
||||
|
||||
class Ffbidx(CMakePackage, CudaPackage):
|
||||
"""Develop an indexer for fast feedback"""
|
||||
|
||||
homepage = "https://github.com/paulscherrerinstitute/fast-feedback-indexer.git"
|
||||
git = "https://github.com/paulscherrerinstitute/fast-feedback-indexer.git"
|
||||
|
||||
maintainers = ["hcstadler"]
|
||||
|
||||
version('main')
|
||||
|
||||
variant('build_type', default='Release',
|
||||
description='CMake build type',
|
||||
values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'))
|
||||
variant("cuda", default=True, description="Build with CUDA")
|
||||
variant("fast_indexer", default=True, description="Build the fast feedback indexer library" )
|
||||
variant("python", default=False, description="Build python module")
|
||||
variant("simple_data_files", default=False, description="Install simple data files")
|
||||
variant("simple_data_indexer", default=False, description="Build simple data reader library and indexer")
|
||||
variant("test_all", default=False, description="Enable testing")
|
||||
|
||||
depends_on("python@3.1.5:", when='+python')
|
||||
depends_on("py-numpy", when='+python')
|
||||
depends_on("eigen@3.4.0:", type=('build', 'link'), when='+simple_data_indexer')
|
||||
depends_on("eigen@3.4.0:", type=('build', 'link'), when='+fast_indexer')
|
||||
depends_on("cmake@3.21.0:", type='build')
|
||||
|
||||
conflicts('cuda_arch=none', when='+fast_indexer',
|
||||
msg='CUDA architecture is required when building the fast feedback indexer library')
|
||||
conflicts("~cuda", when='+fast_indexer',
|
||||
msg="The fast feedback indexer library requires CUDA'")
|
||||
conflicts('+python', when='~fast_indexer',
|
||||
msg='Python module needs the fast feedback indexer library')
|
||||
conflicts('+test_all', when='~simple_data_indexer~fast_indexer',
|
||||
msg='Tests need the build of both simple data reader and fast feedback indexer library')
|
||||
conflicts('+simple_data_indexer', when='~fast_indexer',
|
||||
msg='Simple data indexer needs the fast feedback indexer library')
|
||||
|
||||
# Conflicts for compilers without C++17 support
|
||||
conflicts('gcc@:6.5.0')
|
||||
conflicts('intel@:18.0.5')
|
||||
|
||||
# Add ctest stage if +test_all in spec
|
||||
@run_after('build')
|
||||
def test(self):
|
||||
if '+test_all' in self.spec:
|
||||
with working_dir(self.build_directory):
|
||||
ctest = Executable("ctest")
|
||||
ctest()
|
||||
|
||||
def cmake_args(self):
|
||||
args = [
|
||||
self.define('CMAKE_INSTALL_LIBDIR', 'lib'),
|
||||
self.define_from_variant('BUILD_FAST_INDEXER', 'fast_indexer'),
|
||||
self.define_from_variant('BUILD_FAST_INDEXER_STATIC', 'fast_indexer'),
|
||||
self.define_from_variant('SIMPLE_DATA_INDEXER', 'simple_data_indexer'),
|
||||
self.define_from_variant('REFINED_SIMPLE_DATA_INDEXER', 'simple_data_indexer'),
|
||||
self.define_from_variant('BUILD_SIMPLE_DATA_READER', 'simple_data_indexer'),
|
||||
self.define_from_variant('CMAKE_CUDA_ARCHITECTURES', 'cuda_arch'),
|
||||
self.define_from_variant('INSTALL_SIMPLE_DATA_FILES', 'simple_data_files'),
|
||||
self.define_from_variant('PYTHON_MODULE', 'python'),
|
||||
self.define_from_variant('TEST_ALL', 'test_all'),
|
||||
]
|
||||
|
||||
if 'python' in self.spec:
|
||||
python_root_dir = self.spec['python'].prefix
|
||||
args.append(self.define('Python3_ROOT_DIR', python_root_dir))
|
||||
print(f'using python from {python_root_dir}')
|
||||
|
||||
return args
|
||||
|
||||
# Set PATHS for run time
|
||||
def setup_run_environment(self, env):
|
||||
env.append_path('PATH', self.prefix.bin)
|
||||
env.append_path('CPATH', self.prefix.include)
|
||||
env.append_path('LD_LIBRARY_PATH', self.prefix.lib)
|
||||
env.append_path('LIBRARY_PATH', self.prefix.lib)
|
||||
env.append_path('PKG_CONFIG_PATH', self.prefix.share.ffbidx.pkgconfig)
|
||||
if '+python' in self.spec:
|
||||
env.append_path('PYTHONPATH', self.prefix.lib.ffbidx)
|
102
packages/hyquas/package.py
Normal file
102
packages/hyquas/package.py
Normal file
@ -0,0 +1,102 @@
|
||||
# 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=('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")
|
||||
variant("backend", default='blas', description="Build with backend type:", values=('serial', 'group', 'group-serial', 'blas', 'mix', 'blas-advance'))
|
||||
variant("schedule", default=True, description="Build with printing the schedule")
|
||||
variant("summary", default=True, description="Show the running details")
|
||||
variant("measure_stage", default=False, description="Measure time of each stage")
|
||||
variant("micro_bench", default=False, description="Compile micro-benchmarks")
|
||||
variant("eval_pp", default=False, description="Compile evaluator preprocess")
|
||||
variant("disable_assert", default=True, description="Use assert in cuda runtime")
|
||||
variant("use_double", default=True, description="Double or float precision")
|
||||
variant("overlap", default=True, description="Enable overlap")
|
||||
variant("mpi", default=False, description="Use mpi")
|
||||
variant("overlap_mat", default=True, description="Overlap initMatirx")
|
||||
variant("log_eval", default=False, description="Show logging of evaluator")
|
||||
variant("mat_size", default='7', description="Mat size", values=('4','5','6','7'))
|
||||
|
||||
conflicts("~cuda", msg="HyQuas requires CUDA")
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
env.set("NCCL_ROOT", self.spec['nccl'].prefix)
|
||||
|
||||
def setup_run_environment(self, env):
|
||||
env.set("HYQUAS_ROOT", self.stage.source_path)
|
||||
|
||||
@run_before('cmake')
|
||||
def build_cutt(self):
|
||||
cuda_arch = self.spec.variants['cuda_arch'].value[0]
|
||||
|
||||
# Filtering CMakefile & Makefile to change the cuda arch flags which are hardcoded
|
||||
CMakefile = FileFilter('CMakeLists.txt')
|
||||
CMakefile.filter("CUDA_NVCC_FLAGS .*", "CUDA_NVCC_FLAGS \"-Xcompiler -fopenmp -std=c++14 -O2 -g -arch=compute_{0} -code=sm_{0} --ptxas-options=-v -lineinfo -keep\")".format(cuda_arch))
|
||||
with working_dir('./third-party/cutt'):
|
||||
makefile = FileFilter('Makefile')
|
||||
makefile.filter("GENCODE_FLAGS := .*", "GENCODE_FLAGS := -gencode arch=compute_{0},code=sm_{0}".format(cuda_arch))
|
||||
|
||||
make()
|
||||
|
||||
def cmake_args(self):
|
||||
args = [
|
||||
self.define_from_variant('BACKEND', 'backend'),
|
||||
self.define_from_variant('SHOW_SUMMARY', 'summary'),
|
||||
self.define_from_variant('SHOW_SCHEDULE', 'schedule'),
|
||||
self.define_from_variant('MICRO_BENCH', 'micro_bench'),
|
||||
self.define_from_variant('USE_DOUBLE', 'use_double'),
|
||||
self.define_from_variant('DISABLE_ASSERT', 'disable_assert'),
|
||||
self.define_from_variant('ENABLE_OVERLAP', 'overlap'),
|
||||
self.define_from_variant('MEASURE_STAGE', 'measure_stage'),
|
||||
self.define_from_variant('EVALUATOR_PREPROCESS', 'eval_pp'),
|
||||
self.define_from_variant('USE_MPI', 'mpi'),
|
||||
self.define_from_variant('OVERLAP_MAT', 'overlap_mat'),
|
||||
self.define_from_variant('LOG_EVALUATOR', 'log_eval'),
|
||||
self.define_from_variant('MAT', 'mat_size')
|
||||
]
|
||||
|
||||
return args
|
||||
|
||||
def install(self, spec, prefix):
|
||||
mkdir(prefix.bin)
|
||||
with working_dir(self.stage.source_path):
|
||||
mkdirp('evaluator-preprocess/parameter-files')
|
||||
with working_dir(self.build_directory):
|
||||
install('main', prefix.bin)
|
23
packages/py-hiqsimulator/cmake-glog.patch
Normal file
23
packages/py-hiqsimulator/cmake-glog.patch
Normal file
@ -0,0 +1,23 @@
|
||||
diff --git a/cmake/Findglog.cmake b/cmake/Findglog.cmake
|
||||
index d3123c4..3425d0d 100644
|
||||
--- a/cmake/Findglog.cmake
|
||||
+++ b/cmake/Findglog.cmake
|
||||
@@ -176,17 +176,8 @@ if(glog_FOUND)
|
||||
gflags::gflags)
|
||||
else()
|
||||
# Make sure that the glog::glog target depends on gflags::gflags
|
||||
- get_target_property(_libraries glog::glog INTERFACE_LINK_LIBRARIES)
|
||||
- set(_new_libraries)
|
||||
- foreach(_dep ${_libraries})
|
||||
- if(_dep STREQUAL gflags)
|
||||
- list(APPEND _new_libraries gflags::gflags)
|
||||
- else()
|
||||
- list(APPEND _new_libraries ${_dep})
|
||||
- endif()
|
||||
- endforeach()
|
||||
set_target_properties(glog::glog
|
||||
- PROPERTIES INTERFACE_LINK_LIBRARIES ${_new_libraries})
|
||||
+ PROPERTIES INTERFACE_LINK_LIBRARIES gflags::gflags)
|
||||
endif()
|
||||
endif()
|
||||
|
58
packages/py-hiqsimulator/package.py
Normal file
58
packages/py-hiqsimulator/package.py
Normal file
@ -0,0 +1,58 @@
|
||||
# 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 py-hiqsimulator
|
||||
#
|
||||
# You can edit this file again by typing:
|
||||
#
|
||||
# spack edit py-hiqsimulator
|
||||
#
|
||||
# See the Spack documentation for more information on packaging.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
from spack.package import *
|
||||
|
||||
|
||||
class PyHiqsimulator(PythonPackage):
|
||||
"""Huawei HiQ is an open-source software framework for quantum computing. It is based on and compatible with ProjectQ.
|
||||
It aims at providing tools which facilitate inventing, implementing, testing, debugging, and running quantum algorithms
|
||||
using either classical hardware or actual quantum devices. You can find more about Huawei HiQ at
|
||||
http://hiq.huaweicloud.com"""
|
||||
|
||||
homepage = "https://hiqsimulator.readthedocs.io/en/latest/index.html"
|
||||
|
||||
git = "https://github.com/Huawei-HiQ/HiQsimulator"
|
||||
|
||||
maintainers = ["germanne"]
|
||||
|
||||
version('develop', submodules=True)
|
||||
|
||||
depends_on('py-setuptools@44.1.0', type='build')
|
||||
depends_on('py-mpi4py', type=("run"))
|
||||
depends_on('py-projectq@0.4.1', type=("run"))
|
||||
|
||||
depends_on("cmake", type="build")
|
||||
depends_on("openmpi", type=("run", "link"))
|
||||
depends_on("boost+mpi+program_options+numpy+python+system+thread+timer+chrono+atomic", type=("build", "run", "link"))
|
||||
depends_on("glog", type=("build", "run", "link"))
|
||||
|
||||
patch('cmake-glog.patch')
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
env.set('BOOST_ROOT', self.spec['boost'].prefix)
|
||||
|
||||
def install_options(self, spec, prefix):
|
||||
# FIXME: Add options to pass to setup.py install
|
||||
# FIXME: If not needed, delete this function
|
||||
options = []
|
||||
return options
|
38
packages/py-projectq/package.py
Normal file
38
packages/py-projectq/package.py
Normal file
@ -0,0 +1,38 @@
|
||||
# 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)
|
||||
|
||||
from spack.package import *
|
||||
|
||||
|
||||
class PyProjectq(PythonPackage):
|
||||
"""
|
||||
ProjectQ is an open-source software framework for quantum computing started
|
||||
at ETH Zurich. It allows users to implement their quantum programs in
|
||||
Python using a powerful and intuitive syntax. ProjectQ can then translate
|
||||
these programs to any type of back-end, be it a simulator run on a
|
||||
classical computer of an actual quantum chip.
|
||||
"""
|
||||
|
||||
# Homepage and git repository
|
||||
homepage = "https://projectq.ch"
|
||||
|
||||
url = 'https://github.com/ProjectQ-Framework/ProjectQ/archive/refs/tags/v0.4.1.tar.gz'
|
||||
git = 'https://github.com/ProjectQ-Framework/ProjectQ.git'
|
||||
|
||||
# Versions
|
||||
version("develop", branch="develop")
|
||||
version("0.3.6", commit="fa484fe037a3a1772127bbd00fe4628ddba34611")
|
||||
version("0.4.1", sha256="008f39f9e9cda47dde97020f640f89a9ee1488d37ab45d8fad78c112b15e695d")
|
||||
version("0.6.1", sha256="8d8f8694c49b85714957d6db9154af3b2f769133256157435fbc103c2dbcf1ae")
|
||||
|
||||
# Dependencies
|
||||
depends_on("py-setuptools", type=("build"))
|
||||
depends_on("py-numpy", type=("build", "run"))
|
||||
depends_on("py-scipy", type=("build", "run"))
|
||||
depends_on("py-future", type=("build", "run"))
|
||||
depends_on("py-requests", type=("build", "run"))
|
||||
# conflict with pybind11@2.2.0 -> see requirements.txt
|
||||
depends_on("py-pybind11@1.7:2.1,2.2.1:", type=("build", "run"))
|
||||
depends_on("py-networkx", type=("run"))
|
Reference in New Issue
Block a user