Skip to content
Browse files

ENH: scipy.linalg build almost complete.

  • Loading branch information...
1 parent a93924c commit ab4effb48f6f4b0378acd540916e50c53d836469 @cournape cournape committed Jun 3, 2011
Showing with 136 additions and 27 deletions.
  1. +8 −5 bento.info
  2. +49 −22 bscript
  3. +20 −0 scipy/linalg/bento.info
  4. +59 −0 scipy/linalg/bscript
View
13 bento.info
@@ -35,23 +35,26 @@ Classifiers:
HookFile:
bscript,
- scipy/fftpack/bscript
+ scipy/fftpack/bscript,
+ scipy/linalg/bscript
Recurse:
scipy/cluster,
- scipy/fftpack
+ scipy/fftpack,
+ scipy/linalg
DataFiles: tests
TargetDir: $sitedir/scipy
SourceDir: scipy
Files:
- cluster/tests/*.py,
constants/tests/*.py,
- fftpack/tests/*.py
+ fftpack/tests/*.py,
+ linalg/tests/*.py
Library:
Packages:
scipy,
scipy.cluster,
scipy.constants,
- scipy.fftpack
+ scipy.fftpack,
+ scipy.linalg
View
71 bscript
@@ -40,6 +40,32 @@ def c_template(self, node):
if "c" in self.features:
self.source.append(outs[0])
+# FIXME: abstract those module gen tasks...
+class write_module(waflib.Task.Task):
+ color = "CYAN"
+ vars = ["CONTENT"]
+ def run(self):
+ # FIXME: put actual data here
+ self.outputs[0].write(self.env.CONTENT)
+
+@waflib.TaskGen.feature("gen_pymodule")
+def process_write_config(self):
+ if not hasattr(self, "content"):
+ raise ValueError("task gen %r expects a 'content' argument" % self.name)
+ else:
+ self.env.CONTENT = self.content
+ output = self.path.find_or_declare(self.target)
+ name = getattr(self, "name", None) or self.target
+
+ bento_context = self.bld.bento_context
+ b_output = bento_context.build_node.make_node(output.bldpath())
+ bento_context.outputs_registry.register_outputs(
+ "gen_pymodule", name, [b_output], bento_context.build_node, "$sitedir")
+
+ tsk = self.create_task("write_module")
+ tsk.set_outputs(output)
+ return tsk
+
@hooks.startup
def startup(context):
context.register_context("configure", ConfigureWafContext)
@@ -60,6 +86,9 @@ def pre_configure(context):
conf.load("compiler_fc")
conf.load("f2py")
+ conf.check_fortran_verbose_flag()
+ conf.check_fortran_clib()
+
def remove_flag(name, flag):
while True:
if name in flag:
@@ -115,31 +144,29 @@ def post_configure(context):
conf.env.MACOSX_DEPLOYMENT_TARGET = "10.4"
-# FIXME: abstract those module gen tasks...
-class write_module(waflib.Task.Task):
- color = "CYAN"
- vars = ["CONTENT"]
- def run(self):
- # FIXME: put actual data here
- self.outputs[0].write(self.env.CONTENT)
+ conf.env.HAS_FBLAS = False
+ conf.env.HAS_CBLAS = False
+ conf.env.HAS_FLAPACK = False
+ conf.env.HAS_CLAPACK = False
-@waflib.TaskGen.feature("gen_pymodule")
-def process_write_config(self):
- if not hasattr(self, "content"):
- raise ValueError("task gen %r expects a 'content' argument" % self.name)
- else:
- self.env.CONTENT = self.content
- output = self.path.find_or_declare(self.target)
- name = getattr(self, "name", None) or self.target
+ if sys.platform == "darwin":
+ try:
+ conf.check(framework="Accelerate", msg="Checking for framework Accelerate", uselib_store="CBLAS")
+ conf.env.HAS_CBLAS = True
- bento_context = self.bld.bento_context
- b_output = bento_context.build_node.make_node(output.bldpath())
- bento_context.outputs_registry.register_outputs(
- "gen_pymodule", name, [b_output], bento_context.build_node, "$sitedir")
+ conf.check(framework="Accelerate", msg="Checking for framework Accelerate", uselib_store="FLAPACK")
+ conf.env.HAS_FLAPACK = True
- tsk = self.create_task("write_module")
- tsk.set_outputs(output)
- return tsk
+ conf.check(framework="Accelerate", msg="Checking for framework Accelerate", uselib_store="FBLAS")
+ conf.env.HAS_FBLAS = True
+
+ except waflib.Errors.ConfigurationError:
+ pass
+ # FIXME: bug in waf ?
+ conf.env.FRAMEWORK_ST = ["-framework"]
+
+ if not (conf.env.HAS_FBLAS and conf.env.HAS_FLAPACK):
+ raise waflib.Errors.ConfigurationError("You need blas and lapack")
@hooks.pre_build()
def pre_build(context):
View
20 scipy/linalg/bento.info
@@ -0,0 +1,20 @@
+Library:
+ Extension: fblas
+ Sources:
+ generic_fblas.pyf,
+ src/fblaswrap.f
+ Extension: cblas
+ Sources:
+ generic_cblas.pyf
+ Extension: flapack
+ Sources:
+ generic_flapack.pyf
+ Extension: clapack
+ Sources:
+ generic_clapack.pyf
+ Extension: _flinalg
+ Sources:
+ src/det.f, src/lu.f
+ Extension: calc_lwork
+ Sources:
+ src/calc_lwork.f
View
59 scipy/linalg/bscript
@@ -0,0 +1,59 @@
+import sys
+
+from bento.commands import hooks
+
+@hooks.pre_build()
+def pre_build(context):
+ bld = context.waf_context
+
+ def builder(extension):
+ source = extension.sources[:]
+ if sys.platform == "darwin":
+ source.pop(source.index("src/fblaswrap.f"))
+ source.append("src/fblaswrap_veclib_c.c")
+ bld(features="c pyext bento cshlib f2py",
+ source=source,
+ target=extension.name,
+ use="FBLAS")
+ context.register_builder("fblas", builder)
+
+ def builder(extension):
+ bld(features="c pyext bento cshlib f2py",
+ source=extension.sources,
+ target=extension.name,
+ use="CBLAS")
+ context.register_builder("cblas", builder)
+
+ def builder(extension):
+ bld(features="c pyext bento cshlib f2py f2py_interface_gen",
+ source=extension.sources,
+ target=extension.name,
+ use="FLAPACK")
+ context.register_builder("flapack", builder)
+
+ def builder(extension):
+ if bld.env.HAS_CLAPACK:
+ bld(features="c pyext bento cshlib f2py f2py_interface_gen",
+ source=extension.sources,
+ target=extension.name,
+ use="CLAPACK")
+ else:
+ bld(features="c pyext bento cshlib f2py f2py_fake_interface_gen",
+ source=extension.sources,
+ target=extension.name,
+ )
+ context.register_builder("clapack", builder)
+
+ def builder(extension):
+ bld(features="c pyext bento cshlib f2py",
+ source=extension.sources,
+ target=extension.name,
+ use="FLAPACK")
+ context.register_builder("_flinalg", builder)
+
+ def builder(extension):
+ bld(features="c pyext bento cshlib f2py",
+ source=extension.sources,
+ target=extension.name,
+ use="FBLAS CLIB")
+ context.register_builder("calc_lwork", builder)

0 comments on commit ab4effb

Please sign in to comment.
Something went wrong with that request. Please try again.