new Package/scs (#13454)

* new package: SCS

* make flake8 happy

* add missing patch, improve style

* fix typo

* Update var/spack/repos/builtin/packages/scs/package.py

Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com>

* move filefilter to edit phase
This commit is contained in:
Sinan 2019-10-28 15:33:33 -07:00 committed by Adam J. Stewart
parent 1b3f546ba4
commit e5b1dbf4b4
2 changed files with 55 additions and 0 deletions

View File

@ -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)

View File

@ -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')