~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/python/setup.py

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import os
2
 
from subprocess import Popen, PIPE
3
 
import sys
4
 
 
5
 
from distutils.core import setup
6
 
from distutils.extension import Extension
7
 
from distutils.spawn import find_executable
8
 
from distutils.sysconfig import get_config_vars
9
 
 
10
 
# numpy is required -- attempt import
11
 
try:
12
 
    import numpy
13
 
except ImportError:
14
 
    print "numpy is required"
15
 
    raise
16
 
 
17
 
# mpi4py is required -- attempt import
18
 
try:
19
 
    import mpi4py
20
 
except ImportError:
21
 
    print "mpi4py is required"
22
 
    raise
23
 
 
24
 
# cython is optional -- attempt import
25
 
use_cython = False
26
 
try:
27
 
    from Cython.Build import cythonize
28
 
    from Cython.Distutils import build_ext
29
 
    use_cython = True
30
 
except:
31
 
    pass
32
 
 
33
 
# need to find 'ga-config' to gather how GA was configured
34
 
ga_config = find_executable("ga-config", None)
35
 
if not ga_config:
36
 
    raise ValueError, "ga-config not found in path -- required"
37
 
p = Popen("%s --cc" % ga_config, shell=True, stdout=PIPE, stderr=PIPE,
38
 
        close_fds=True)
39
 
ga_cc,ignore = p.communicate()
40
 
p = Popen("%s --cppflags" % ga_config, shell=True, stdout=PIPE, stderr=PIPE,
41
 
        close_fds=True)
42
 
ga_cppflags,ignore = p.communicate()
43
 
p = Popen("%s --ldflags" % ga_config, shell=True, stdout=PIPE, stderr=PIPE,
44
 
        close_fds=True)
45
 
ga_ldflags,ignore = p.communicate()
46
 
p = Popen("%s --libs" % ga_config, shell=True, stdout=PIPE, stderr=PIPE,
47
 
        close_fds=True)
48
 
ga_clibs,ignore = p.communicate()
49
 
 
50
 
if 'CC' not in os.environ:
51
 
    os.environ['CC'] = ga_cc
52
 
if 'LDSHARED' not in os.environ:
53
 
    # take a lucky guess and reuse the same flags Python used
54
 
    flags = get_config_vars('LDSHARED')[0].strip().split()
55
 
    assert(flags)
56
 
    flags[0] = ga_cc
57
 
    os.environ['LDSHARED'] = ' '.join(flags)
58
 
if 'ARCHFLAGS' not in os.environ:
59
 
    os.environ['ARCHFLAGS'] = ''
60
 
 
61
 
# On osx, '-framework Accelerate' doesn't link the actual LAPACK and BLAS
62
 
# libraries. Locate them manually if GA was configured to use them.
63
 
linalg_include = []
64
 
linalg_library = []
65
 
linalg_lib = []
66
 
if 'Accelerate' in ga_clibs or 'vecLib' in ga_clibs:
67
 
    path = "/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/A"
68
 
    linalg_include = []
69
 
    if os.path.exists(path):
70
 
        linalg_library = [path]
71
 
        linalg_lib = ["LAPACK","BLAS"]
72
 
    # remove '-framework Accelerate' from flags
73
 
    ga_clibs = ga_clibs.replace("-framework","")
74
 
    ga_clibs = ga_clibs.replace("Accelerate","")
75
 
    ga_clibs = ga_clibs.replace("vecLib","")
76
 
 
77
 
include_dirs = [numpy.get_include(), mpi4py.get_include()]
78
 
library_dirs = []
79
 
libraries = []
80
 
 
81
 
# add the GA stuff
82
 
for dir in ga_cppflags.split():
83
 
    dir = dir.strip()
84
 
    include_dirs.append(dir.replace("-I",""))
85
 
for dir in ga_ldflags.split():
86
 
    dir = dir.strip()
87
 
    library_dirs.append(dir.replace("-L",""))
88
 
for part in ga_clibs.split():
89
 
    part = part.strip()
90
 
    if '-L' in part:
91
 
        library_dirs.append(part.replace("-L",""))
92
 
    elif '-l' in part:
93
 
        libraries.append(part.replace("-l",""))
94
 
 
95
 
include_dirs.extend(linalg_include)
96
 
library_dirs.extend(linalg_library)
97
 
libraries.extend(linalg_lib)
98
 
 
99
 
ga4py_ga_sources                  = ["ga4py/ga.c"]
100
 
ga4py_gain_core_sources           = ["ga4py/gain/core.c"]
101
 
ga4py_gain_misc_sources           = ["ga4py/gain/misc.c"]
102
 
ga4py_gain_notimplemented_sources = ["ga4py/gain/notimplemented.c"]
103
 
ga4py_gain_random_sources         = ["ga4py/gain/random.c"]
104
 
ga4py_gain_util_sources           = ["ga4py/gain/util.c"]
105
 
if use_cython:
106
 
    ga4py_ga_sources                  = ["ga4py/ga.pyx"]
107
 
    ga4py_gain_core_sources           = ["ga4py/gain/core.pyx"]
108
 
    ga4py_gain_misc_sources           = ["ga4py/gain/misc.pyx"]
109
 
    ga4py_gain_notimplemented_sources = ["ga4py/gain/notimplemented.pyx"]
110
 
    ga4py_gain_random_sources         = ["ga4py/gain/random.pyx"]
111
 
    ga4py_gain_util_sources           = ["ga4py/gain/util.pyx"]
112
 
 
113
 
include_dirs.append(".")
114
 
 
115
 
ext_modules = [
116
 
    Extension(
117
 
        name="ga4py.ga",
118
 
        sources=ga4py_ga_sources,
119
 
        include_dirs=include_dirs,
120
 
        library_dirs=library_dirs,
121
 
        libraries=libraries
122
 
    ),
123
 
    Extension(
124
 
        name="ga4py.gain.core",
125
 
        sources=ga4py_gain_core_sources,
126
 
        include_dirs=include_dirs,
127
 
        library_dirs=library_dirs,
128
 
        libraries=libraries
129
 
    ),
130
 
    Extension(
131
 
        name="ga4py.gain.misc",
132
 
        sources=ga4py_gain_misc_sources,
133
 
        include_dirs=include_dirs,
134
 
        library_dirs=library_dirs,
135
 
        libraries=libraries
136
 
    ),
137
 
    Extension(
138
 
        name="ga4py.gain.notimplemented",
139
 
        sources=ga4py_gain_notimplemented_sources,
140
 
        include_dirs=include_dirs,
141
 
        library_dirs=library_dirs,
142
 
        libraries=libraries
143
 
    ),
144
 
    Extension(
145
 
        name="ga4py.gain.random",
146
 
        sources=ga4py_gain_random_sources,
147
 
        include_dirs=include_dirs,
148
 
        library_dirs=library_dirs,
149
 
        libraries=libraries
150
 
    ),
151
 
    Extension(
152
 
        name="ga4py.gain.util",
153
 
        sources=ga4py_gain_util_sources,
154
 
        include_dirs=include_dirs,
155
 
        library_dirs=library_dirs,
156
 
        libraries=libraries
157
 
    ),
158
 
]
159
 
 
160
 
if use_cython:
161
 
    ext_modules = cythonize(ext_modules, include_path=include_dirs)
162
 
    cmdclass = {}
163
 
    #cmdclass = {'build_ext': build_ext}
164
 
else:
165
 
    cmdclass = {}
166
 
 
167
 
setup(
168
 
    name = "Global Arrays",
169
 
    packages = ["ga4py","ga4py.gain"],
170
 
    ext_modules = ext_modules,
171
 
    cmdclass = cmdclass
172
 
)