Navigation Menu

Skip to content

Commit

Permalink
Introduced blas_src_info for building BLAS library from sources if AT…
Browse files Browse the repository at this point in the history
…LAS or BLAS libraries are not available.
  • Loading branch information
pearu committed Jun 29, 2002
1 parent a3036f3 commit d7bf56d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 23 deletions.
12 changes: 7 additions & 5 deletions INSTALL.txt
Expand Up @@ -37,8 +37,8 @@ NOTES
LAPACK/BLAS libraries installed in your system or Fortran
LAPACK/BLAS sources to be accessible by SciPy setup scripts (use
LAPACK_SRC/BLAS_SRC environment variables to indicate the location
of the corresponding source directories). XXX: Building BLAS from
sources is not implemented yet.
of the corresponding source directories).


GETTING SCIPY
=============
Expand All @@ -53,6 +53,7 @@ See
Daily snapshot of SciPy CVS repository is available in
ftp://scipy.org/pub/


INSTALLATION
============

Expand All @@ -68,6 +69,7 @@ computer.

XXX: From rpm,deb,zip,..


TESTING
=======

Expand All @@ -78,6 +80,7 @@ To test SciPy installation, run in python

where the test level can vary from 1 to 10.


KNOWN PROBLEMS
==============

Expand Down Expand Up @@ -122,7 +125,6 @@ lists. Please include the following information to your message:
full output (both stdout and stderr) of the SciPy installation
command can be very helpful.

Before complaining problems with SciPy, you may find the following notes
useful:
You may find the following notes useful:
http://www.tuxedo.org/~esr/faqs/smart-questions.html
http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
19 changes: 13 additions & 6 deletions Lib/linalg/setup_linalg.py
Expand Up @@ -19,7 +19,7 @@

from scipy_distutils.system_info import get_info,dict_append,\
AtlasNotFoundError,LapackNotFoundError,BlasNotFoundError,\
LapackSrcNotFoundError
LapackSrcNotFoundError,BlasSrcNotFoundError

def configuration(parent_package=''):
from interface_gen import generate_interface
Expand All @@ -32,17 +32,24 @@ def configuration(parent_package=''):

atlas_info = get_info('atlas')
#atlas_info = {} # uncomment if ATLAS is available but want to use
# Fortran LAPACK/ATLAS; useful for testing
# Fortran LAPACK/BLAS; useful for testing
f_libs = []
blas_info,lapack_info,lapack_src_info = {},{},{}
blas_info,lapack_info = {},{}
if not atlas_info:
warnings.warn(AtlasNotFoundError.__doc__)
blas_info = get_info('blas')
#blas_info = {} # test building BLAS from sources.
if not blas_info:
warnings.warn(BlasNotFoundError.__doc__)
blas_src_info = get_info('blas_src')
if not blas_src_info:
raise BlasSrcNotFoundError,BlasSrcNotFoundError.__doc__
dict_append(blas_info,libraries=['blas_src'])
f_libs.append(fortran_library_item(\
'blas_src',blas_src_info['sources'],
))
lapack_info = get_info('lapack')
#lapack_info = {} # test building LAPACK from sources.
if not blas_info:
#TODO: build from blas sources (see lapack_src below)
raise BlasNotFoundError,BlasNotFoundError.__doc__
if not lapack_info:
warnings.warn(LapackNotFoundError.__doc__)
lapack_src_info = get_info('lapack_src')
Expand Down
37 changes: 25 additions & 12 deletions Lib/linalg/tests/test_blas.py
Expand Up @@ -14,27 +14,36 @@
from scipy_base.testing import assert_almost_equal, assert_array_equal
from scipy_base.testing import ScipyTestCase
import unittest

from scipy_distutils.misc_util import PostponedException

import os,sys
d = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,d)
import cblas
import fblas
#import cblas
#import fblas
try: import fblas
except: fblas = PostponedException()
try: import cblas
except: cblas = PostponedException()
del sys.path[0]


class test_blas1_simple(ScipyTestCase):
class test_cblas1_simple(ScipyTestCase):

def check_axpy(self):
for p in 'sd':
f = getattr(cblas,p+'axpy')
assert_array_almost_equal(f(5,[1,2,3],[2,-1,3]),[7,9,18])
f = getattr(fblas,p+'axpy')
assert_array_almost_equal(f([1,2,3],[2,-1,3],a=5),[7,9,18])
for p in 'cz':
f = getattr(cblas,p+'axpy')
assert_array_almost_equal(f(5,[1,2j,3],[2,-1,3]),[7,10j-1,18])

class test_fblas1_simple(ScipyTestCase):

def check_axpy(self):
for p in 'sd':
f = getattr(fblas,p+'axpy')
assert_array_almost_equal(f([1,2,3],[2,-1,3],a=5),[7,9,18])
for p in 'cz':
f = getattr(fblas,p+'axpy')
assert_array_almost_equal(f([1,2j,3],[2,-1,3],a=5),[7,10j-1,18])
def check_copy(self):
Expand Down Expand Up @@ -99,7 +108,7 @@ def check_amax(self):
assert_equal(f([-5,4+3j,6]),1)
#XXX: need tests for rot,rotm,rotg,rotmg

class test_blas2_simple(ScipyTestCase):
class test_fblas2_simple(ScipyTestCase):

def check_gemv(self):
for p in 'sd':
Expand All @@ -112,7 +121,7 @@ def check_gemv(self):
assert_array_almost_equal(f(3j,[[3-4j]],[-4],3,[5j]),[-48-21j])


class test_blas3_simple(ScipyTestCase):
class test_fblas3_simple(ScipyTestCase):

def check_gemm(self):
for p in 'sd':
Expand All @@ -127,9 +136,13 @@ def check_gemm(self):
def test_suite(level=1):
suites = []
if level > 0:
suites.append( unittest.makeSuite(test_blas1_simple,'check_') )
suites.append( unittest.makeSuite(test_blas2_simple,'check_') )
suites.append( unittest.makeSuite(test_blas3_simple,'check_') )
if not isinstance(fblas,PostponedException):
suites.append( unittest.makeSuite(test_fblas1_simple,'check_') )
suites.append( unittest.makeSuite(test_fblas2_simple,'check_') )
suites.append( unittest.makeSuite(test_fblas3_simple,'check_') )
if not isinstance(cblas,PostponedException):
suites.append( unittest.makeSuite(test_cblas1_simple,'check_') )

import test_fblas
suite = test_fblas.test_suite(level)
suites.append(suite)
Expand Down

0 comments on commit d7bf56d

Please sign in to comment.