Example #1
0
File: setup.py Project: petsc/petsc
def config(prefix, dry_run=False):
    log.info('PETSc: configure')
    options = [
        '--prefix=' + prefix,
        'PETSC_ARCH='+os.environ['PETSC_ARCH'],
        '--with-shared-libraries=1',
        '--with-debugging=0',
        '--with-c2html=0', # not needed
        ]
    if '--with-fc=0' in CONFIGURE_OPTIONS:
        options.append('--with-sowing=0')
    if '--with-mpi=0' not in CONFIGURE_OPTIONS:
        try:
            import mpi4py
            conf = mpi4py.get_config()
            mpicc  = conf.get('mpicc')
            mpicxx = conf.get('mpicxx')
            mpif90 = conf.get('mpif90')
        except (ImportError, AttributeError):
            mpicc  = os.environ.get('MPICC')  or find_executable('mpicc')
            mpicxx = os.environ.get('MPICXX') or find_executable('mpicxx')
            mpif90 = os.environ.get('MPIF90') or find_executable('mpif90')
        if mpicc:
            options.append('--with-cc='+mpicc)
            if '--with-cxx=0' not in CONFIGURE_OPTIONS:
                if mpicxx:
                    options.append('--with-cxx='+mpicxx)
                else:
                    options.append('--with-cxx=0')
            if '--with-fc=0' not in CONFIGURE_OPTIONS:
                if mpif90:
                    options.append('--with-fc='+mpif90)
                else:
                    options.append('--with-fc=0')
                    options.append('--with-sowing=0')
        else:
            options.append('--with-mpi=0')
    options.extend(CONFIGURE_OPTIONS)
    #
    log.info('configure options:')
    for opt in options:
        log.info(' '*4 + opt)
    # Run PETSc configure
    if dry_run: return
    use_config_py = False
    if use_config_py:
        import configure
        configure.petsc_configure(options)
        import logger
        logger.Logger.defaultLog = None
    else:
        python = find_executable('python2') or find_executable('python')
        command = [python, './configure'] + options
        status = os.system(" ".join(command))
        if status != 0: raise RuntimeError(status)
Example #2
0
def config(dry_run=False):
    log.info('PETSc: configure')
    options = [
        'PETSC_ARCH='+os.environ['PETSC_ARCH'],
        '--with-shared-libraries=1',
        '--with-debugging=0',
        '--with-c2html=0', # not needed
        ]
    # MPI
    try:
        import mpi4py
        conf = mpi4py.get_config()
        mpicc  = conf.get('mpicc')
        mpicxx = conf.get('mpicxx')
        mpif90 = conf.get('mpif90')
    except (ImportError, AttributeError):
        mpicc  = os.environ.get('MPICC')  or find_executable('mpicc')
        mpicxx = os.environ.get('MPICXX') or find_executable('mpicxx')
        mpif90 = os.environ.get('MPIF90') or find_executable('mpif90')
    if mpicc:
        options.append('--with-cc='+mpicc)
        if mpicxx:
            options.append('--with-cxx='+mpicxx)
        else:
            options.append('--with-cxx=0')
        if mpif90:
            options.append('--with-fc='+mpif90)
        else:
            options.append('--with-fc=0')
            options.append('--with-sowing=0')
    else:
        options.append('--with-mpi=0')
    # Extra configure options
    config_opts = os.environ.get('PETSC_CONFIGURE_OPTIONS', '')
    config_opts = split_quoted(config_opts)
    options.extend(config_opts)
    log.info('configure options:')
    for opt in options:
        log.info(' '*4 + opt)
    # Run PETSc configure
    if dry_run: return
    import configure
    configure.petsc_configure(options)
    import logger
    logger.Logger.defaultLog = None
Example #3
0
def main():
  import os
  import sys

  # check if script invoked in PETSC_DIR
  if not os.path.exists(os.path.join('include','petscversion.h')):
    print 'Error! ' +  sys.argv[0] + ' not invoked in PETSC_DIR.'
    sys.exit(3)
  # look for user specified --with-config option
  confmodule = getoption('with-config')
  if confmodule == None:
    print 'Error! config not specified. use for eg: --with-config=linux-gnu'
    sys.exit(3)
  # now load the specified config file
  sys.path.insert(0,'config')
  try:
    conftest = __import__(confmodule)
  except:
    print 'Error! module ' + confmodule + ' not found!'
    sys.exit(3)

  #### need code ####
  # if conftest.configure_options or test_options do not exist flag error

  # Now construct a bunch of configure tests and run them
  # Using a simple algorithm now.
  # - run with configure_options
  # - for each test_options & common_test_options - keep adding to the current set and run
  # - construct a different PETSC_ARCH for each test

  import configure
  test_no = 1
  for opt in [''] + conftest.test_options + common_test_options:
    if opt != '' : conftest.configure_options.append(opt)
    conftest.configure_options.append('-PETSC_ARCH=' + confmodule + '-test-' + `test_no`)
    print 'Configuring with: ', conftest.configure_options
    configure.petsc_configure(conftest.configure_options)
    conftest.configure_options.pop()
    test_no += 1
Example #4
0
if __name__ == '__main__':
  import sys
  import os
  sys.path.insert(0, os.path.abspath('config'))
  import configure
  configure_options = [
    'COPTFLAGS=-g -O',
    'FOPTFLAGS=-g -O',
    'CXXOPTFLAGS=-g -O',
    '--download-suitesparse',
    '--download-mumps',
    '--download-scalapack',
    '--download-chaco',
    '--download-ctetgen',
    '--download-exodusii',
    '--download-cmake',   # for exodus as it breaks with cmake version 2.8.12.2
    '--download-pnetcdf',
    '--download-generator',
    '--download-hdf5',
    '--download-zlib=1',
    '--download-metis',
    '--download-ml',
    '--download-netcdf',
    '--download-parmetis',
    '--download-triangle',
    '--download-p4est',
    '--with-cuda',
    '--with-shared-libraries',
  ]
  configure.petsc_configure(configure_options)
Example #5
0
  '--known-sdot-returns-double=0',
  '--known-64-bit-blas-indices=0',

# iOS doesn't support fortran or mpi
  '--with-fc=0',
  '--with-mpi=0',

# Blas Lapack Libraries
  '--download-f2cblaslapack=1',
  # when allready available use this
  #'--with-lapack-lib=ENTER THE PATH HERE/libf2clapack.a',
  #'--with-blas-lib=ENTER THE PATH HERE/libf2cblas.a',
  # with PETSc 3.4 and newer this is possible for iOS, to run just import Accelerate Framework within Xcode:
  #'--known-blaslapack-mangling=underscore',

# this is for ios. you can change the sdk if needed to a newer/older version. Change arch, if you want to build for other architecture. ((A4,A5)-armv7,A6-armv7s,(A7,A8,A9,A10)-arm64,for simulator just ignore this line and add parameter for Simulator. For inspiration also see Onelab, http://onelab.info/ open-source ios-app.
  '--CC=/usr/bin/llvm-gcc -arch arm64 -miphoneos-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk',


# Run with zero, for debugging with 1
  '--with-debugging=0',
# Provides Installation directory
  '--PETSC_ARCH=arch-arm64-opt',

]
if __name__ == '__main__':
  sys.path.insert(0, os.path.abspath('config'))
  import configure
  print(configure_options)
  print(configure.petsc_configure(configure_options))
#!/usr/bin/python

# This test is done on cg.mcs.anl.gov. It uses IPL64 MKL/BLAS packaged
# with MATLAB.

# Note: regular BLAS [with 32bit integers] conflict wtih
# MATLAB BLAS - hence requring -known-64-bit-blas-indices=1

# Note: MATLAB build requires petsc shared libraries

# export LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/4.6/libgfortran.so

if __name__ == '__main__':
    import sys
    import os
    sys.path.insert(0, os.path.abspath('config'))
    import configure
    configure_options = [
        '--with-blas-lapack-dir=/soft/com/packages/MATLAB/R2013a',
        '--with-matlab-engine=1',
        '--with-matlab=1',
        '--with-mpi=0',
        '--with-shared-libraries=1',
        '-known-64-bit-blas-indices=1',
    ]
    configure.petsc_configure(configure_options)