From 19fb6e136222204ab678d6ee35d20866a800f8d2 Mon Sep 17 00:00:00 2001 From: yye00 Date: Tue, 3 Jan 2006 18:34:31 +0000 Subject: With this commit all cactus thorns now use the new reduction API. There ARE memory leaks that appear as assert failures when destroying the parameter table in ReduceArraysGlobally when using AHFinder on lemieux (ALPHA), I am yet to identify the reason why this is so. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinder/trunk@389 89daf98e-ef62-4674-b946-b8ff9de2216c --- src/AHFinder_int.F | 182 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 141 insertions(+), 41 deletions(-) diff --git a/src/AHFinder_int.F b/src/AHFinder_int.F index 71a9deb..70196d3 100644 --- a/src/AHFinder_int.F +++ b/src/AHFinder_int.F @@ -70,6 +70,11 @@ CCTK_REAL, allocatable, dimension(:,:) :: txx,tyy,tzz,txy,txz,tyz CCTK_REAL, allocatable, dimension(:,:) :: intmask +! Reduction variables + CCTK_POINTER_TO_CONST, dimension(1) :: input_array + CCTK_POINTER, dimension(1) :: reduction_value + CCTK_INT, dimension(1) ::input_array_type + ! Variables to be saved for next call. save dtheta,dphi,dtp,idtheta,idphi,phistart @@ -171,7 +176,7 @@ ! *** GET REDUCTION HANDLE FOR SUM *** ! **************************************** - call CCTK_ReductionArrayHandle(reduction_handle,"sum") + call CCTK_LocalArrayReductionHandle(reduction_handle,"sum") if (reduction_handle.lt.0) then call CCTK_WARN(1,"Cannot get handle for sum reduction ! Forgot to activate an implementation providing reduction operators ??") @@ -576,15 +581,26 @@ ! *** REDUCE ERRORS ACROSS PROCESSORS *** ! ******************************************* - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,reduction_handle, - . interror1,red_tmp,CCTK_VARIABLE_INT) + input_array_type(1) = CCTK_VARIABLE_INT + reduction_value(1)= CCTK_PointerTo(red_tmp) + input_array(1) = CCTK_PointerTo(interror1) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,0, 0, input_array_type, 1, + . input_array_type, reduction_value) + if (ierror.ne.0) then call CCTK_WARN(1,"Reduction of norm failed!") end if interror1 = red_tmp - - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,reduction_handle, - . interror2,red_tmp,CCTK_VARIABLE_INT) + + + input_array_type(1) = CCTK_VARIABLE_INT + reduction_value(1)= CCTK_PointerTo(red_tmp) + input_array(1) = CCTK_PointerTo(interror2) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,0, 0, input_array_type, 1, + . input_array_type, reduction_value) + if (ierror.ne.0) then call CCTK_WARN(1,"Reduction of norm failed!") end if @@ -748,8 +764,13 @@ end do end if - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,reduction_handle, - . interror3,red_tmp,CCTK_VARIABLE_INT) + input_array_type(1) = CCTK_VARIABLE_INT + reduction_value(1)= CCTK_PointerTo(red_tmp) + input_array(1) = CCTK_PointerTo(interror3) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,0, 0, input_array_type, 1, + . input_array_type, reduction_value) + interror3 = red_tmp if (interror3.ne.0) then @@ -953,28 +974,60 @@ ! Reduce integrals. - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,reduction_handle, - . intarea,aux,CCTK_VARIABLE_REAL) - intarea=aux - - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,reduction_handle, - . intexp,aux,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(aux) + input_array(1) = CCTK_PointerTo(intarea) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,0, 0, input_array_type, 1, + . input_array_type, reduction_value) + + intarea=aux + + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(aux) + input_array(1) = CCTK_PointerTo(intexp) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,0, 0, input_array_type, 1, + . input_array_type, reduction_value) + intexp=aux - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,reduction_handle, - . intexp2,aux,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(aux) + input_array(1) = CCTK_PointerTo(intexp2) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,0, 0, input_array_type, 1, + . input_array_type, reduction_value) + intexp2=aux + + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(aux) + input_array(1) = CCTK_PointerTo(intexpdel2) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,0, 0, input_array_type, 1, + . input_array_type, reduction_value) - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,reduction_handle, - . intexpdel2,aux,CCTK_VARIABLE_REAL) intexpdel2=aux - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,reduction_handle, - . inside_min_neg_count,red_tmp,CCTK_VARIABLE_INT) - inside_min_neg_count=red_tmp + - call CCTK_ReduceLocalScalar(ierror,cctkGH,-1,reduction_handle, - . inside_min_count,red_tmp,CCTK_VARIABLE_INT) + input_array_type(1) = CCTK_VARIABLE_INT + reduction_value(1)= CCTK_PointerTo(red_tmp) + input_array(1) = CCTK_PointerTo(inside_min_neg_count) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,0, 0, input_array_type, 1, + . input_array_type, reduction_value) + + inside_min_neg_count=red_tmp + + input_array_type(1) = CCTK_VARIABLE_INT + reduction_value(1)= CCTK_PointerTo(red_tmp) + input_array(1) = CCTK_PointerTo(inside_min_count) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,0, 0, input_array_type, 1, + . input_array_type, reduction_value) + inside_min_count=red_tmp end if @@ -1140,21 +1193,38 @@ auxi = lmax+1 if (hw.ne.zero) then - call CCTK_ReduceLocalArray1D(ierror,cctkGH,-1,reduction_handle, - . hflow0,tempv,auxi,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(tempv) + input_array(1) = CCTK_PointerTo(hflow0) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,1, auxi, input_array_type, 1, + . input_array_type, reduction_value) + hflow0 = tempv + end if if (cw.ne.zero) then - call CCTK_ReduceLocalArray1D(ierror,cctkGH,-1,reduction_handle, - . cflow0,tempv,auxi,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(tempv) + input_array(1) = CCTK_PointerTo(cflow0) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,1, auxi, input_array_type, 1, + . input_array_type, reduction_value) + cflow0 = tempv + end if if (nw.ne.zero) then - call CCTK_ReduceLocalArray1D(ierror,cctkGH,-1,reduction_handle, - . nflow0,tempv,auxi,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(tempv) + input_array(1) = CCTK_PointerTo(nflow0) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,1, auxi, input_array_type, 1, + . input_array_type, reduction_value) nflow0 = tempv + end if ! Non-axisymmetric components. @@ -1164,40 +1234,70 @@ auxi = lmax*lmax if (hw.ne.zero) then - call CCTK_ReduceLocalArray1D(ierror,cctkGH,-1, - . reduction_handle,hflowc,tempm,auxi,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(tempm) + input_array(1) = CCTK_PointerTo(hflowc) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,1, auxi, input_array_type, 1, + . input_array_type, reduction_value) + hflowc = tempm end if if (cw.ne.zero) then - call CCTK_ReduceLocalArray1D(ierror,cctkGH,-1, - . reduction_handle,cflowc,tempm,auxi,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(tempm) + input_array(1) = CCTK_PointerTo(cflowc) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,1, auxi, input_array_type, 1, + . input_array_type, reduction_value) + cflowc = tempm end if if (nw.ne.zero) then - call CCTK_ReduceLocalArray1D(ierror,cctkGH,-1, - . reduction_handle,nflowc,tempm,auxi,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(tempm) + input_array(1) = CCTK_PointerTo(nflowc) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,1, auxi, input_array_type, 1, + . input_array_type, reduction_value) + nflowc = tempm end if if (.not.refy) then if (hw.ne.zero) then - call CCTK_ReduceLocalArray1D(ierror,cctkGH,-1, - . reduction_handle,hflows,tempm,auxi,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(tempm) + input_array(1) = CCTK_PointerTo(hflows) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,1, auxi, input_array_type, 1, + . input_array_type, reduction_value) + hflows = tempm end if if (cw.ne.zero) then - call CCTK_ReduceLocalArray1D(ierror,cctkGH,-1, - . reduction_handle,cflows,tempm,auxi,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(tempm) + input_array(1) = CCTK_PointerTo(cflows) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,1, auxi, input_array_type, 1, + . input_array_type, reduction_value) + cflows = tempm end if if (nw.ne.zero) then - call CCTK_ReduceLocalArray1D(ierror,cctkGH,-1, - . reduction_handle,nflows,tempm,auxi,CCTK_VARIABLE_REAL) + input_array_type(1) = CCTK_VARIABLE_REAL + reduction_value(1)= CCTK_PointerTo(tempm) + input_array(1) = CCTK_PointerTo(nflows) + call CCTK_ReduceArraysGlobally(ierror, cctkGH, -1,reduction_handle, -1, + . 1, input_array,1, auxi, input_array_type, 1, + . input_array_type, reduction_value) + nflows = tempm end if -- cgit v1.2.3