Commit fb74b6a3 authored by Ultima's avatar Ultima
Browse files

Added a check for the MPI_dummy.py running in a MPI n>1 setting.

parent 8bc3a2d0
......@@ -14,7 +14,7 @@
build
operators/*
!operators/__init__py
!operators/__init__.py
!operators/nifty_explicit.py
!operators/nifty_operators.py
!operators/nifty_probing.py
......
......@@ -36,8 +36,8 @@ from __future__ import division
import matplotlib as mpl
mpl.use('Agg')
import imp
nifty = imp.load_module('nifty', None,
'/home/steininger/Downloads/nifty', ('','',5))
#nifty = imp.load_module('nifty', None,
# '/home/steininger/Downloads/nifty', ('','',5))
from nifty import * # version 0.8.0
about.warnings.off()
......
......@@ -22,6 +22,9 @@ class Comm(object):
class Intracomm(Comm):
def __init__(self, name):
if not running_single_threadedQ():
raise RuntimeError("ERROR: MPI_dummy module is running in a " +
"mpirun with n>1.")
self.name = name
self.rank = 0
self.size = 1
......@@ -100,6 +103,19 @@ class _datatype():
def __init__(self, name):
self.name = str(name)
def running_single_threadedQ():
try:
from mpi4py import MPI
except ImportError:
return True
else:
if MPI.COMM_WORLD.size != 1:
return False
else:
return True
BYTE = _datatype('MPI_BYTE')
SHORT = _datatype('MPI_SHORT')
UNSIGNED_SHORT = _datatype("MPI_UNSIGNED_SHORT")
......
......@@ -2433,6 +2433,7 @@ class _slicing_distributor(distributor):
def get_iter(self, d2o):
return d2o_slicing_iter(d2o)
def _equal_slicer(comm, global_shape):
rank = comm.rank
size = comm.size
......
## NIFTY (Numerical Information Field Theory) has been developed at the
## Max-Planck-Institute for Astrophysics.
##
## Copyright (C) 2015 Max-Planck-Society
##
## Author: Marco Selig
## Project homepage: <http://www.mpa-garching.mpg.de/ift/nifty/>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import division
from nifty_operators import operator,\
diagonal_operator,\
power_operator,\
projection_operator,\
vecvec_operator,\
response_operator,\
invertible_operator,\
propagator_operator
from nifty_probing import prober,\
trace_prober,\
inverse_trace_prober,\
diagonal_prober,\
inverse_diagonal_prober
from nifty_minimization import conjugate_gradient,\
steepest_descent
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment