-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.mkl.py
146 lines (119 loc) · 4.48 KB
/
setup.mkl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/env python
import glob
import os
import re
import unittest
from Cython.Build import cythonize
from setuptools import setup, Extension
from setuptools.command.test import test as TestCommand
import numpy as np
def get_version():
ver = 'unknown'
if os.path.isfile("toast_planck/_version.py"):
f = open("toast_planck/_version.py", "r")
for line in f.readlines():
mo = re.match("__version__ = '(.*)'", line)
if mo:
ver = mo.group(1)
f.close()
return ver
current_version = get_version()
# extensions to build
ext_signal_estimator = Extension(
'toast_planck.preproc_modules.signal_estimation',
sources=['toast_planck/preproc_modules/signal_estimation.pyx',
'toast_planck/preproc_modules/despike/medianmap.c'],
include_dirs=[np.get_include(),
'toast_planck/preproc_modules/despike/include'],
libraries=['m'],
)
ext_zodier = Extension(
'toast_planck.reproc_modules.zodi',
sources=['toast_planck/reproc_modules/zodi.pyx'],
include_dirs=[np.get_include()],
libraries=['m'],
)
ext_time_response_tools = Extension(
'toast_planck.preproc_modules.time_response_tools',
include_dirs=[np.get_include()],
sources=['toast_planck/preproc_modules/time_response_tools.pyx'],
)
ext_destripe_tools = Extension(
'toast_planck.reproc_modules.destripe_tools',
include_dirs=[np.get_include()],
sources=['toast_planck/reproc_modules/destripe_tools.pyx'],
)
ext_despyke = Extension(
'toast_planck.preproc_modules.despyke',
sources=['toast_planck/preproc_modules/despike/despyke.pyx',
'toast_planck/preproc_modules/despike/despike_func.cc',
'toast_planck/preproc_modules/despike/todprocess_planck.cc'],
include_dirs=[np.get_include(),
'toast_planck/preproc_modules/despike/include',
os.environ['PREFIX'] + '/include'],
# os.environ['MKLROOT'] + '/include',
# os.environ['MKLROOT'] + '/include/fftw'],
# ,'/usr/include/atlas'],
#libraries=['lapack','fftw3','fftw3_threads'],
#libraries=['fftw3','fftw3_threads'],
#libraries=['fftw3', 'fftw3_threads', 'mkl_rt', 'pthread', 'm', 'dl'],
libraries=['mkl_rt', 'pthread', 'm', 'dl'],
#libraries=['mkl_rt', 'mkl_avx512_mic', 'pthread', 'm', 'dl'],
library_dirs=[os.environ['PREFIX'] + '/lib'],
# '/global/common/cori/software/python/3.6-anaconda-4.4/lib'],
# os.environ['MKLROOT'] + '/lib/intel64'],
language='c++',
extra_compile_args=['-fopenmp'],
extra_link_args=['-fopenmp']
)
ext_shdet = Extension(
'toast_planck.shdet',
sources=['toast_planck/shdet/shdet.pyx',
'toast_planck/shdet/shdet_func.cpp',
'toast_planck/shdet/cshdet.cpp'],
include_dirs=[np.get_include(),
'toast_planck/shdet/include'],
language='c++',
)
extensions = cythonize([
ext_signal_estimator, ext_zodier, ext_time_response_tools, ext_despyke,
ext_destripe_tools, ext_shdet])
# scripts to install
scripts = glob.glob('pipelines/*.py')
# run unit tests
class PTestCommand(TestCommand):
def __init__(self, *args, **kwargs):
super(PTestCommand, self).__init__(*args, **kwargs)
def initialize_options(self):
TestCommand.initialize_options(self)
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_suite = True
def run(self):
loader = unittest.TestLoader()
runner = unittest.TextTestRunner(verbosity=2)
suite = loader.discover('tests', pattern='test_*.py', top_level_dir='.')
runner.run(suite)
# set it all up
setup(
name='toast_planck',
provides='toast_planck',
version=current_version,
description='Planck extensions to TOAST',
author='Brendan Crill, Sergi Hildebrandt, Reijo Keskitalo, Ted Kisner, '
'Guillaume Patanchon, Cyrille Rosset, Gael Roudier',
author_email='[email protected]',
url='https://github.com/tskisner/toast-planck',
packages=['toast_planck', 'toast_planck.preproc_modules',
'toast_planck.reproc_modules', 'toast_planck.beam_modules'],
package_data={
'toast_planck.preproc_modules': [
'ephemeris/*txt', 'lfi_adc_data/*pic', 'lfi_fsl_data/*csv'],
'toast_planck.reproc_modules': ['sky_model_data/*dat']
},
ext_modules=extensions,
scripts=scripts,
license='BSD',
requires=['Python (>3.4.0)', ],
cmdclass={'test': PTestCommand}
)