nifty_default_config.py 2.08 KB
Newer Older
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
# -*- coding: utf-8 -*-

import os

from nifty_dependency_injector import dependency_injector
from nifty_configuration import variable,\
                                configuration

global_dependency_injector = dependency_injector(
                                   ['h5py',
                                    ('mpi4py.MPI', 'MPI'),
                                    ('nifty.dummys.MPI_dummy', 'MPI_dummy'),
                                    'pyfftw',
                                    'gfft',
                                    ('nifty.dummys.gfft_dummy', 'gfft_dummy'),
                                    'healpy',
                                    'libsharp_wrapper_gl'])

variable_fft_module = variable('fft_module',
                               ['pyfftw', 'gfft', 'gfft_fallback'],
                               lambda z: z in global_dependency_injector)

variable_lm2gl = variable('lm2gl',
                          [True, False],
                          lambda z: z is True or z is False,
                          'boolean')

variable_verbosity = variable('verbosity',
                              [1],
                              lambda z: z == abs(int(z)),
                              'int')

variable_mpi_module = variable('mpi_module',
                               ['MPI', 'MPI_dummy'],
                               lambda z: z in global_dependency_injector)

variable_default_distribution_strategy = variable(
                            'default_distribution_strategy',
                            ['fftw', 'equal', 'not'],
                            lambda z: (('pyfftw' in global_dependency_injector)
                                       if (z == 'pyfftw') else True)
                                                  )

global_configuration = configuration(
                     [variable_fft_module,
                      variable_lm2gl,
                      variable_verbosity,
                      variable_mpi_module,
                      variable_default_distribution_strategy
                      ],
                     path=os.path.expanduser('~') + "/.nifty/global_config")