summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/scs/make_gpu.patch14
-rw-r--r--var/spack/repos/builtin/packages/scs/package.py41
2 files changed, 55 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/scs/make_gpu.patch b/var/spack/repos/builtin/packages/scs/make_gpu.patch
new file mode 100644
index 0000000000..3e38d832cc
--- /dev/null
+++ b/var/spack/repos/builtin/packages/scs/make_gpu.patch
@@ -0,0 +1,14 @@
+diff --git a/Makefile.orig b/Makefile
+index b4f2bc9..8a28fc4 100644
+--- a/Makefile.orig
++++ b/Makefile
+@@ -129,7 +129,8 @@ install: $(INSTALL_INC_FILES) $(INSTALL_TARGETS)
+ $(INSTALL) -d $(INSTALL_INC_DIR) $(INSTALL_LIB_DIR)
+ $(INSTALL) -m 644 $(INSTALL_INC_FILES) $(INSTALL_INC_DIR)
+ $(INSTALL) -m 644 $(INSTALL_TARGETS) $(INSTALL_LIB_DIR)
+-install_gpu: $(INSTALL_INC_FILES) $(INSTALL_GPU_TARGETS)
++install_gpu: $(INSTALL_INC_FILES) $(INSTALL_GPU_TARGETS) $(INSTALL_TARGETS)
+ $(INSTALL) -d $(INSTALL_INC_DIR) $(INSTALL_LIB_DIR)
+ $(INSTALL) -m 644 $(INSTALL_INC_FILES) $(INSTALL_INC_DIR)
+ $(INSTALL) -m 644 $(INSTALL_GPU_TARGETS) $(INSTALL_LIB_DIR)
++ $(INSTALL) -m 644 $(INSTALL_TARGETS) $(INSTALL_LIB_DIR)
diff --git a/var/spack/repos/builtin/packages/scs/package.py b/var/spack/repos/builtin/packages/scs/package.py
new file mode 100644
index 0000000000..db086a99d1
--- /dev/null
+++ b/var/spack/repos/builtin/packages/scs/package.py
@@ -0,0 +1,41 @@
+# Copyright 2013-2019 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 import *
+
+
+class Scs(MakefilePackage):
+ """A C package that solves convex cone problems via operator splitting"""
+
+ homepage = "https://github.com/cvxgrp/scs"
+ url = "https://github.com/cvxgrp/scs/archive/2.1.1.tar.gz"
+
+ version('2.1.1', sha256='0e20b91e8caf744b84aa985ba4e98cc7235ee33612b2bad2bf31ea5ad4e07d93')
+
+ variant('cuda', default=False, description='Build with Cuda support')
+
+ depends_on('blas')
+ depends_on('lapack')
+ depends_on('cuda', when='+cuda')
+
+ # make sure install_gpu target installs all libs not only the gpu ones
+ patch('make_gpu.patch')
+
+ def edit(self, spec, prefix):
+ filter_file(r'-lblas', spec['blas'].libs.ld_flags, 'scs.mk')
+ filter_file(r'-llapack', spec['lapack'].libs.ld_flags, 'scs.mk')
+
+ def build(self, spec, prefix):
+ if '+cuda' in spec:
+ make('default', 'gpu')
+ else:
+ make()
+
+ def install(self, spec, prefix):
+ if '+cuda' in spec:
+ make('PREFIX=' + prefix, 'install_gpu')
+ else:
+ make('PREFIX=' + prefix, 'install')