Merge pull request #1243 from davydden/pkg/atlas_urls
atlas: fix urls and shared libs
This commit is contained in:
commit
91004158c6
@ -23,20 +23,24 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from spack import *
|
from spack import *
|
||||||
|
from spack.package_test import *
|
||||||
from spack.util.executable import Executable
|
from spack.util.executable import Executable
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
|
||||||
class Atlas(Package):
|
class Atlas(Package):
|
||||||
"""
|
"""Automatically Tuned Linear Algebra Software, generic shared ATLAS is an
|
||||||
Automatically Tuned Linear Algebra Software, generic shared ATLAS is an approach for the automatic generation and
|
approach for the automatic generation and optimization of numerical
|
||||||
optimization of numerical software. Currently ATLAS supplies optimized versions for the complete set of linear
|
software. Currently ATLAS supplies optimized versions for the complete set
|
||||||
algebra kernels known as the Basic Linear Algebra Subroutines (BLAS), and a subset of the linear algebra routines
|
of linear algebra kernels known as the Basic Linear Algebra Subroutines
|
||||||
in the LAPACK library.
|
(BLAS), and a subset of the linear algebra routines in the LAPACK library.
|
||||||
"""
|
"""
|
||||||
homepage = "http://math-atlas.sourceforge.net/"
|
homepage = "http://math-atlas.sourceforge.net/"
|
||||||
|
|
||||||
version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da',
|
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)
|
||||||
|
# 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',
|
resource(name='lapack',
|
||||||
url='http://www.netlib.org/lapack/lapack-3.5.0.tgz',
|
url='http://www.netlib.org/lapack/lapack-3.5.0.tgz',
|
||||||
md5='b1d3e3e425b2e44a06760ff173104bdf',
|
md5='b1d3e3e425b2e44a06760ff173104bdf',
|
||||||
@ -44,7 +48,7 @@ class Atlas(Package):
|
|||||||
when='@3:')
|
when='@3:')
|
||||||
|
|
||||||
version('3.11.34', '0b6c5389c095c4c8785fd0f724ec6825',
|
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')
|
variant('shared', default=True, description='Builds shared library')
|
||||||
|
|
||||||
@ -66,9 +70,24 @@ def install(self, spec, prefix):
|
|||||||
|
|
||||||
options = []
|
options = []
|
||||||
if '+shared' in spec:
|
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_stage = self.stage[1]
|
||||||
lapack_tarfile = os.path.basename(lapack_stage.fetcher.url)
|
lapack_tarfile = os.path.basename(lapack_stage.fetcher.url)
|
||||||
lapack_tarfile_path = join_path(lapack_stage.path, lapack_tarfile)
|
lapack_tarfile_path = join_path(lapack_stage.path, lapack_tarfile)
|
||||||
@ -81,4 +100,35 @@ def install(self, spec, prefix):
|
|||||||
make('check')
|
make('check')
|
||||||
make('ptcheck')
|
make('ptcheck')
|
||||||
make('time')
|
make('time')
|
||||||
|
if '+shared' in spec:
|
||||||
|
with working_dir('lib'):
|
||||||
|
make('shared_all')
|
||||||
|
|
||||||
make("install")
|
make("install")
|
||||||
|
self.install_test()
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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)
|
||||||
|
49
var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.c
Normal file
49
var/spack/repos/builtin/packages/atlas/test_cblas_dgemm.c
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#include <cblas.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user