From c4a3d4ee1c4128763a104036b196120557cdb42b Mon Sep 17 00:00:00 2001 From: yye00 Date: Wed, 7 Dec 2005 22:18:11 +0000 Subject: changes to AHFinder to use the new reduction API. Some problems appeared when converting AHFinder_int.F, irregularities with behavior, MPI stalls etc... This is currently being investigated. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinder/trunk@383 89daf98e-ef62-4674-b946-b8ff9de2216c --- src/AHFinder_gau.F | 44 ++++++++++++++++++++++++++++++++++++-------- src/AHFinder_mask.F | 16 +++++++++++++--- 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/AHFinder_gau.F b/src/AHFinder_gau.F index 98be8f6..ed74d51 100644 --- a/src/AHFinder_gau.F +++ b/src/AHFinder_gau.F @@ -85,6 +85,13 @@ c CCTK_REAL i2dx,i2dy,i2dz,idxx,idyy,idzz,idxy,idxz,idyz character(len=200) :: gaussf +! Reduction variables + CCTK_INT , dimension(1) :: input_array_dim + CCTK_POINTER_TO_CONST, dimension(1) :: input_array + CCTK_POINTER, dimension(1) :: reduction_value + CCTK_POINTER, dimension(3) :: reduction_value3 + CCTK_INT, dimension(3) ::input_array_type + ! Declarations for macros. c#include "CactusEinstein/ADMMacros/src/macro/ADM_Spacing_declare.h" @@ -224,7 +231,7 @@ c#include "CactusEinstein/ADMMacros/src/macro/ADM_Spacing_declare.h" ! *** Get the reduction handle for sum operation *** ! ****************************************************** - call CCTK_ReductionArrayHandle(sum_handle,"sum") + call CCTK_LocalArrayReductionHandle(sum_handle,"sum") if (sum_handle.lt.0) then call CCTK_WARN(1,"Cannot get handle for sum reduction ! Forgot to activate an implementation providing reduction operators ??") @@ -648,24 +655,45 @@ c#include "CactusEinstein/ADMMacros/src/macro/ADM_Spacing_declare.h" ! know about this since all will participate on the interpolation ! below). - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,sum_handle, - . error1,rerror,CCTK_VARIABLE_INT) - + input_array_dim(1) = zero + reduction_value(1)= CCTK_PointerTo(rerror) + input_array(1) = CCTK_PointerTo(error1) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,sum_handle, -1, + . 1, input_array,0, input_array_dim, CCTK_VARIABLE_INT, 1, + . CCTK_VARIABLE_INT, reduction_value) + if (ierror.ne.0) then call CCTK_WARN(1,"Reduction failed!") end if error1 = rerror - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,sum_handle, - . error2,rerror,CCTK_VARIABLE_INT) + input_array(1) = CCTK_PointerTo(error1) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,sum_handle, -1, + . 1, input_array,0, input_array_dim, CCTK_VARIABLE_INT, 1, + . CCTK_VARIABLE_INT, reduction_value) if (ierror.ne.0) then call CCTK_WARN(1,"Reduction failed!") end if error2 = rerror - call CCTK_ReduceLocArrayToArray1D(ierror,cctkGH,-1,sum_handle, - . ahf_centroid,rahf_centroid,3,CCTK_VARIABLE_REAL) + input_array_dim = 0 + + input_array(1) = CCTK_PointerTo(ahf_centroid(1)) + input_array(2) = CCTK_PointerTo(ahf_centroid(2)) + input_array(3) = CCTK_PointerTo(ahf_centroid(3)) + + reduction_value3(1) = CCTK_PointerTo(rahf_centroid(1)) + reduction_value3(2) = CCTK_PointerTo(rahf_centroid(2)) + reduction_value3(3) = CCTK_PointerTo(rahf_centroid(3)) + + input_array_type(1) = CCTK_VARIABLE_REAL + input_array_type(2) = CCTK_VARIABLE_REAL + input_array_type(3) = CCTK_VARIABLE_REAL + + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,sum_handle, -1, + . 3, input_array,0, input_array_dim, input_array_type, 3, + . input_array_type, reduction_value) if (ierror.ne.0) then call CCTK_WARN(1,"Reduction failed!") diff --git a/src/AHFinder_mask.F b/src/AHFinder_mask.F index 4153a27..a781ca5 100644 --- a/src/AHFinder_mask.F +++ b/src/AHFinder_mask.F @@ -38,6 +38,11 @@ CCTK_REAL buffer,dd,aux CCTK_REAL xa,ya,za +! Reduction variables + CCTK_INT, dimension(1) :: input_array_dim + CCTK_POINTER_TO_CONST, dimension(1) :: input_array + CCTK_POINTER, dimension(1) :: reduction_value + ! ******************* ! *** NUMBERS *** @@ -115,13 +120,18 @@ ! Now find the minimum of rhor across processors. reduce_handle = -1 - call CCTK_ReductionArrayHandle(reduce_handle,"minimum") + call CCTK_LocalArrayReductionHandle(reduce_handle,"minimum") if (reduce_handle.lt.0) then call CCTK_WARN(1,"Cannot get handle for minimum reduction ! Forgot to activate an implementation providing reduction operators ??") end if - call CCTK_ReduceLocalScalar(ierr ,cctkGH,-1,reduce_handle, - . rhor,rhortemp,CCTK_VARIABLE_REAL) + input_array_dim(1) = zero + input_array(1) = CCTK_PointerTo(rhor) + reduction_value(1) = CCTK_PointerTo(rhortemp) + call CCTK_ReduceArraysGlobally(ierr, cctkGH, -1,reduce_handle, -1, + . 1, input_array,0, input_array_dim, CCTK_VARIABLE_INT, 1, + . CCTK_VARIABLE_INT, reduction_value) + rhor = rhortemp if (ierr.ne.0) then -- cgit v1.2.3