diff --git a/HySoP/CMake/FindPythonModule.cmake b/HySoP/CMake/FindPythonModule.cmake index 20cbf0352aec0c310874a1046693508853fba606..660533df8669e4671e4562f767588263a3525fd5 100755 --- a/HySoP/CMake/FindPythonModule.cmake +++ b/HySoP/CMake/FindPythonModule.cmake @@ -1,6 +1,6 @@ -# Search for a particular python module. +# Search for a particular python module. # Sources : see http://www.cmake.org/pipermail/cmake/2011-January/041666.html -# +# # Usage : find_python_module(mpi4py REQUIRED) # function(find_python_module module) @@ -10,14 +10,14 @@ function(find_python_module module) endif() # A module's location is usually a directory, but for binary modules # it's a .so file. - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, ${module}; print re.compile('/__init__.py.*').sub('',${module}.__file__)" - RESULT_VARIABLE _${module}_status + RESULT_VARIABLE _${module}_status OUTPUT_VARIABLE _${module}_location ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - + if(NOT _${module}_status) - set(python_${module_upper} ${_${module}_location} CACHE STRING + set(python_${module_upper} ${_${module}_location} CACHE STRING "Location of Python module ${module}") endif(NOT _${module}_status) diff --git a/HySoP/CMake/ParmesInstallSetup.cmake b/HySoP/CMake/ParmesInstallSetup.cmake index 9874dec362993917e9479a54ef36149a505ccae0..f75b12fdcf4d2b3739ee067a052a3477cd4adb80 100644 --- a/HySoP/CMake/ParmesInstallSetup.cmake +++ b/HySoP/CMake/ParmesInstallSetup.cmake @@ -41,7 +41,6 @@ function(set_install_options) # CMAKE_INSTALL_PREFIX given in cmake options : if(NOT restart) if(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - message("---> CASE 1 ") set(restart 1 CACHE INTERNAL "True if this is not the first cmake run.") # if 'CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT' is false, it means # that -DCMAKE_INSTALL_PREFIX=something has been given to cmake. @@ -55,7 +54,6 @@ function(set_install_options) set(PYTHON_COMMAND_GET_INSTALL_DIR "import os, re, numpy; print os.path.join(os.path.join(\"${CMAKE_INSTALL_PREFIX}\",*re.compile('/numpy/__init__.py.*').sub('',numpy.__file__).split('/')[-3:]), \"${PROJECT_NAME}\")") else() - message("---> CASE 3 ") # Default case, check virtualenv set(restart 1 CACHE INTERNAL "True if this is not the first cmake run.") # First, we need to check if '--user' option works in the current environment. @@ -63,18 +61,14 @@ function(set_install_options) "import site; print site.ENABLE_USER_SITE" OUTPUT_VARIABLE ENABLE_USER) string(STRIP ${ENABLE_USER} ENABLE_USER) if(ENABLE_USER) - message("---> CASE 2 ") # Default prefix (as python --user) -> installation in site.USER_SITE - #set(restmp "--user") execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import site; print site.USER_BASE" OUTPUT_VARIABLE USER_BASE) - display(USER_BASE) set(install-opt "--prefix=${USER_BASE}" CACHE INTERNAL "") # Need to set the CMAKE_INSTALL_PREFIX to site.USER_SITE # Get python user site and install path = USER_SITE + project_name set(PYTHON_COMMAND_GET_INSTALL_DIR "import site, os, sys ; print os.path.join(site.USER_BASE, os.path.join(\"lib\", os.path.join(\"python\" + str(sys.version_info.major) + '.' + str(sys.version_info.minor), os.path.join(\"site-packages\", \"${PROJECT_NAME}\"))))") - display(PYTHON_COMMAND_GET_INSTALL_DIR) else() # user site not included in the path, # which probably means that python is run using virtualenv diff --git a/HySoP/hysop/mpi/bridge_inter.py b/HySoP/hysop/mpi/bridge_inter.py index ace541515c64e9985a192d06e2af7215c32263d0..7fa6aa8c9f04269d8a75756f00aa96caef352e70 100644 --- a/HySoP/hysop/mpi/bridge_inter.py +++ b/HySoP/hysop/mpi/bridge_inter.py @@ -42,10 +42,10 @@ class BridgeInter(object): current_task = self._domain.currentTask() # True if current process is in the 'from' group' - task_is_source = current_task == self.source_id + task_is_source = current_task() == self.source_id # True if current process is in the 'to' group - task_is_target = current_task == self.target_id + task_is_target = current_task() == self.target_id # Ensure that current process belongs to one and only one task. assert task_is_source or task_is_target diff --git a/HySoP/hysop/operator/redistribute_inter_new.py b/HySoP/hysop/operator/redistribute_inter_new.py index e13e97a669dc77767f95e912184e12a69a73e393..f713e54663a6cfab2ac61ecc6edc9f67c439238d 100644 --- a/HySoP/hysop/operator/redistribute_inter_new.py +++ b/HySoP/hysop/operator/redistribute_inter_new.py @@ -12,7 +12,6 @@ from parmepy.mpi.bridge_inter import BridgeInter from parmepy.operator.redistribute_new import Redistribute from parmepy.operator.computational import Computational from parmepy.mpi.topology import Cartesian -from parmepy.operator import apply_decoration class RedistributeInter(Redistribute): @@ -36,7 +35,6 @@ class RedistributeInter(Redistribute): ## parent communicator, that must contains all processes ## involved in source and target tasks. self.parent = parent - # set source and targets ids. # They must be known before setup. # Either they can be infered from source and target @@ -67,7 +65,8 @@ class RedistributeInter(Redistribute): nbprocs = len(self.domain.tasks_list()) msg = "Parent communicator size and number of procs " msg += "in domain differ." - assert parent.Get_size() == nbprocs, msg + + assert parent.Get_size() == len(nbprocs), msg # the local topology. May be either source or target # depending on the task of the current process. @@ -97,14 +96,13 @@ class RedistributeInter(Redistribute): vlist = (v for v in self.variables) - if self._source is None or self._target is None: + if self._source or self._target is None: assert len(self.variables) > 0 self.variables = [v for v in vlist] else: source_is_topo = isinstance(self._source, Cartesian) target_is_topo = isinstance(self._target, Cartesian) - # both source and target are topologies. Variables required. if source_is_topo and target_is_topo: msg = 'Redistribute, a list of variables is required at init.' @@ -167,7 +165,6 @@ class RedistributeInter(Redistribute): op.addRedistributeRequirement(self) self._is_uptodate = True - self._is_discretized = True def _set_topology(self, current): """ @@ -191,7 +188,6 @@ class RedistributeInter(Redistribute): for v in (v for v in self.variables if v is not vref): assert vcurrent[v] is self._topology - @apply_decoration def apply(self, simulation=None): """ Apply this operator to its variables. diff --git a/HySoP/hysop/operator/redistribute_new.py b/HySoP/hysop/operator/redistribute_new.py index 6a8eeab3f010a82109da27c5859bf357bd304058..c2b02c1340c8f911f8254eaec2f32d0b77e532d2 100644 --- a/HySoP/hysop/operator/redistribute_new.py +++ b/HySoP/hysop/operator/redistribute_new.py @@ -25,9 +25,6 @@ class Redistribute(Operator): # Base class initialisation super(Redistribute, self).__init__(**kwds) - self.input = self.variables - self.output = self.variables - # Object (may be an operator or a topology) which handles the # fields to be transfered self._source = source @@ -282,7 +279,6 @@ class RedistributeIntra(Redistribute): self._is_uptodate = True self._is_discretized = True - @apply_decoration def apply(self, simulation=None): # Try different way to send vars? # - Buffered : copy all data into a buffer and send/recv