From 6f7e12d49b65be4e91ff01a857682c6af0782648 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 13 Jul 2016 14:19:13 +0200 Subject: atlas: fix urls and use lapack 3.6.0 --- var/spack/repos/builtin/packages/atlas/package.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index c43d92c34f..6e91f21815 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -36,15 +36,15 @@ class Atlas(Package): homepage = "http://math-atlas.sourceforge.net/" version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da', - url='http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2', preferred=True) + url='https://sourceforge.net/projects/math-atlas/files/Stable/3.10.2/atlas3.10.2.tar.bz2', preferred=True) resource(name='lapack', - url='http://www.netlib.org/lapack/lapack-3.5.0.tgz', - md5='b1d3e3e425b2e44a06760ff173104bdf', + url='http://www.netlib.org/lapack/lapack-3.6.0.tgz', + md5='f2f6c67134e851fe189bb3ca1fbb5101', destination='spack-resource-lapack', when='@3:') version('3.11.34', '0b6c5389c095c4c8785fd0f724ec6825', - url='http://sourceforge.net/projects/math-atlas/files/Developer%20%28unstable%29/3.11.34/atlas3.11.34.tar.bz2/download') + url='http://sourceforge.net/projects/math-atlas/files/Developer%20%28unstable%29/3.11.34/atlas3.11.34.tar.bz2') variant('shared', default=True, description='Builds shared library') -- cgit v1.2.3-70-g09d2 From 4ecf481337de9ed92737aa0ce1213070a47debf3 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 13 Jul 2016 22:07:27 +0200 Subject: atlas: fix shared libs; set compilers --- var/spack/repos/builtin/packages/atlas/package.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index 6e91f21815..662a282548 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -66,9 +66,24 @@ class Atlas(Package): options = [] if '+shared' in spec: - options.append('--shared') + options.extend([ + '--shared' + ]) + # TODO: for non GNU add '-Fa', 'alg', '-fPIC' ? - # Lapack resource + # configure for 64-bit build + options.extend([ + '-b', '64' + ]) + + # set compilers: + options.extend([ + '-C', 'ic', spack_cc, + '-C', 'if', spack_f77 + ]) + + # Lapack resource to provide full lapack build. Note that + # ATLAS only provides a few LAPACK routines natively. lapack_stage = self.stage[1] lapack_tarfile = os.path.basename(lapack_stage.fetcher.url) lapack_tarfile_path = join_path(lapack_stage.path, lapack_tarfile) @@ -81,4 +96,8 @@ class Atlas(Package): make('check') make('ptcheck') make('time') + if '+shared' in spec: + with working_dir('lib'): + make('shared_all') + make("install") -- cgit v1.2.3-70-g09d2 From 0c0b37800d53cf9c56646ebd48e74723996a2aa4 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 13 Jul 2016 22:15:06 +0200 Subject: atlas: set (blas|lapack)_shared_lib --- var/spack/repos/builtin/packages/atlas/package.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index 662a282548..20ac0a7879 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -101,3 +101,16 @@ class Atlas(Package): make('shared_all') make("install") + + def setup_dependent_package(self, module, dspec): + # libsatlas.[so,dylib,dll ] contains all serial APIs (serial lapack, + # serial BLAS), and all ATLAS symbols needed to support them. Whereas + # libtatlas.[so,dylib,dll ] is parallel (multithreaded) version. + name = 'libsatlas.%s' % dso_suffix + libdir = find_library_path(name, + self.prefix.lib64, + self.prefix.lib) + + if '+shared' in self.spec: + self.spec.blas_shared_lib = join_path(libdir, name) + self.spec.lapack_shared_lib = self.spec.blas_shared_lib -- cgit v1.2.3-70-g09d2 From f6a4a6b00f9e5a112f450b2e5b278003bfa10250 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 13 Jul 2016 23:29:11 +0200 Subject: atlas: add install_test --- var/spack/repos/builtin/packages/atlas/package.py | 16 +++++++ .../builtin/packages/atlas/test_cblas_dgemm.c | 49 ++++++++++++++++++++++ .../builtin/packages/atlas/test_cblas_dgemm.output | 12 ++++++ 3 files changed, 77 insertions(+) create mode 100644 var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.c create mode 100644 var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.output (limited to 'var') diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index 20ac0a7879..0cb15de411 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -23,9 +23,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +from spack.package_test import * from spack.util.executable import Executable import os.path + class Atlas(Package): """ Automatically Tuned Linear Algebra Software, generic shared ATLAS is an approach for the automatic generation and @@ -101,6 +103,7 @@ class Atlas(Package): make('shared_all') make("install") + self.install_test() def setup_dependent_package(self, module, dspec): # libsatlas.[so,dylib,dll ] contains all serial APIs (serial lapack, @@ -114,3 +117,16 @@ class Atlas(Package): if '+shared' in self.spec: self.spec.blas_shared_lib = join_path(libdir, name) self.spec.lapack_shared_lib = self.spec.blas_shared_lib + + def install_test(self): + source_file = join_path(os.path.dirname(self.module.__file__), + 'test_cblas_dgemm.c') + blessed_file = join_path(os.path.dirname(self.module.__file__), + 'test_cblas_dgemm.output') + + include_flags = ["-I%s" % join_path(self.spec.prefix, "include")] + link_flags = ["-L%s" % join_path(self.spec.prefix, "lib"), + "-lsatlas"] + + output = compile_c_and_execute(source_file, include_flags, link_flags) + compare_output_file(output, blessed_file) diff --git a/var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.c b/var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.c new file mode 100644 index 0000000000..2cb90fb883 --- /dev/null +++ b/var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.c @@ -0,0 +1,49 @@ +#include +#include + +double m[] = { + 3, 1, 3, + 1, 5, 9, + 2, 6, 5 +}; + +double x[] = { + -1, 3, -3 +}; + +#ifdef __cplusplus +extern "C" { +#endif + + void dgesv_(int *n, int *nrhs, double *a, int *lda, + int *ipivot, double *b, int *ldb, int *info); + +#ifdef __cplusplus +} +#endif + +int main(void) { + int i; + // blas: + double A[6] = {1.0, 2.0, 1.0, -3.0, 4.0, -1.0}; + double B[6] = {1.0, 2.0, 1.0, -3.0, 4.0, -1.0}; + double C[9] = {.5, .5, .5, .5, .5, .5, .5, .5, .5}; + cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans, + 3, 3, 2, 1, A, 3, B, 3, 2, C, 3); + for (i = 0; i < 9; i++) + printf("%f\n", C[i]); + + // lapack: + int ipiv[3]; + int j; + int info; + int n = 1; + int nrhs = 1; + int lda = 3; + int ldb = 3; + dgesv_(&n,&nrhs, &m[0], &lda, ipiv, &x[0], &ldb, &info); + for (i=0; i<3; ++i) + printf("%5.1f\n", x[i]); + + return 0; +} diff --git a/var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.output b/var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.output new file mode 100644 index 0000000000..01404462c4 --- /dev/null +++ b/var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.output @@ -0,0 +1,12 @@ +11.000000 +-9.000000 +5.000000 +-9.000000 +21.000000 +-1.000000 +5.000000 +-1.000000 +3.000000 + -0.3 + 3.0 + -3.0 -- cgit v1.2.3-70-g09d2 From bef7e2645a624523e5ee269814650f0f39e9498d Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 13 Jul 2016 23:29:54 +0200 Subject: atlas: flake8 fixes --- var/spack/repos/builtin/packages/atlas/package.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index 0cb15de411..f3b3887885 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -29,11 +29,11 @@ import os.path class Atlas(Package): - """ - Automatically Tuned Linear Algebra Software, generic shared ATLAS is an approach for the automatic generation and - optimization of numerical software. Currently ATLAS supplies optimized versions for the complete set of linear - algebra kernels known as the Basic Linear Algebra Subroutines (BLAS), and a subset of the linear algebra routines - in the LAPACK library. + """Automatically Tuned Linear Algebra Software, generic shared ATLAS is an + approach for the automatic generation and optimization of numerical + software. Currently ATLAS supplies optimized versions for the complete set + of linear algebra kernels known as the Basic Linear Algebra Subroutines + (BLAS), and a subset of the linear algebra routines in the LAPACK library. """ homepage = "http://math-atlas.sourceforge.net/" -- cgit v1.2.3-70-g09d2 From 565bd5f51e418a0e0da26e5a81eb98e3896a9c62 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Sat, 16 Jul 2016 07:19:56 +0200 Subject: atlas: revert to lapack 3.5.0 --- var/spack/repos/builtin/packages/atlas/package.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index f3b3887885..f9d5da6166 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -39,9 +39,11 @@ class Atlas(Package): version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da', url='https://sourceforge.net/projects/math-atlas/files/Stable/3.10.2/atlas3.10.2.tar.bz2', preferred=True) + # not all packages (e.g. Trilinos@12.6.3) stopped using deprecated in 3.6.0 + # Lapack routines. Stick with 3.5.0 until this is fixed. resource(name='lapack', - url='http://www.netlib.org/lapack/lapack-3.6.0.tgz', - md5='f2f6c67134e851fe189bb3ca1fbb5101', + url='http://www.netlib.org/lapack/lapack-3.5.0.tgz', + md5='b1d3e3e425b2e44a06760ff173104bdf', destination='spack-resource-lapack', when='@3:') -- cgit v1.2.3-70-g09d2