[petsc-dev] ensuring consistency with f2py, fortran/petsc4py interoperability

Aron Ahmadia aron.ahmadia at kaust.edu.sa
Sun May 15 08:18:57 CDT 2011


Here's a Python example that allows me to ensure that I'm passing the
same flags to PETSc that numpy/f2py use on Python builds.  This also
ensures a consistent PyClaw build when it relies on the PETSc FC
settings to build object code for modules:

import numpy.distutils.fcompiler
fc_name = numpy.distutils.fcompiler.get_default_fcompiler()
ignore1, fc_class, ignore2 = numpy.distutils.fcompiler.fcompiler_class[fc_name]
fc_instance = fc_class()
fc_instance.customize()
fc = fc_instance.compiler_f90[0]
fc_flags = fc_instance.compiler_f90[1:]

configure_options = [
  '--PETSC_ARCH=pyclaw',
  '--with-cc=gcc',
  '--with-fc=' + fc,
  '--with-fflags=' + ' '.join(fc_flags),
  '--with-cxx=g++',
  '--download-petsc4py=1',
  '--download-mpich=1',
  '--with-shared-libraries=1'
  ]

A



More information about the petsc-dev mailing list