diff options
author | lanfer <lanfer@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-11-28 01:51:22 +0000 |
---|---|---|
committer | lanfer <lanfer@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-11-28 01:51:22 +0000 |
commit | 4cbde658050761ef2693c8fe99407b496a3f1163 (patch) | |
tree | ac6cf896702a8e813513595c2ade0efd13f59524 /src | |
parent | d2cc4643ecb9bb7cda9595dbf2d35eb84f6e8154 (diff) |
simple interfaces for local scalar/1d/2d/3d reductions
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1175 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r-- | src/comm/Reduction.c | 183 | ||||
-rw-r--r-- | src/include/cctk_Reduction.h | 21 |
2 files changed, 196 insertions, 8 deletions
diff --git a/src/comm/Reduction.c b/src/comm/Reduction.c index af5ca2a3..45c86e44 100644 --- a/src/comm/Reduction.c +++ b/src/comm/Reduction.c @@ -502,7 +502,7 @@ int CCTK_ReduceArray( cGH *GH, va_start(indices, type_in_arrays); - for (i = 0; i < num_dims; i++) + for (i = 0; i < num_dims; i++) dims [i] = va_arg (indices, int); for (i = 0; i < num_in_arrays; i++) in_arrays [i] = va_arg (indices, void *); @@ -623,6 +623,7 @@ void FMODIFIER FORTRAN_NAME(CCTK_ReduceArray)(int *fortran_return, @endvar @@*/ +/*** FIXME: OLD INTERFACE gerd ***/ int CCTK_ReduceLocalScalar (cGH *GH, int proc, int operation_handle, void *in_scalar, void *out_scalar, int data_type) { @@ -631,7 +632,7 @@ int CCTK_ReduceLocalScalar (cGH *GH, int proc, int operation_handle, 1, 1, data_type, 1, in_scalar)); } - +/*** FIXME: OLD INTERFACE gerd ***/ void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocalScalar)(int *fortran_return, cGH *GH, int *proc, @@ -645,13 +646,37 @@ void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocalScalar)(int *fortran_return, 1, 1, *data_type, 1, in_scalar); } + +int CCTK_ReduceLocScalar (cGH *GH, int proc, int operation_handle, + void *in_scalar, void *out_scalar, int data_type) +{ + return (CCTK_ReduceArray (GH, proc, operation_handle, + 1, data_type, out_scalar, + 1, 1, data_type, 1, in_scalar)); +} + +void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocScalar)(int *fortran_return, + cGH *GH, + int *proc, + int *operation_handle, + void *in_scalar, + void *out_scalar, + int *data_type) +{ + *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + 1, *data_type, out_scalar, + 1, 1, *data_type, 1, in_scalar); +} + + /*@@ - @routine CCTK_ReduceLocalArray1D + @routine CCTK_ReduceLocArrayToArray1D @date Thu Oct 14 12:10:01 1999 @author Gerd Lanfermann @desc Interface to the migthy CCTK_Reduce for - reduction of local 1D arrays. + reduction of local 1D arrays to local arrays + (element by element). @enddesc @calls @calledby @@ -661,18 +686,30 @@ void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocalScalar)(int *fortran_return, @@*/ - +/*** FIXME: OLD INTERFACE gerd ***/ int CCTK_ReduceLocalArray1D (cGH *GH, int proc, int operation_handle, - void *in_array1d, void *out_array1d, int num_in_array1d, - int data_type) + void *in_array1d, void *out_array1d, + int num_in_array1d, + int data_type) +{ + return (CCTK_ReduceArray (GH, proc, operation_handle, + num_in_array1d, data_type, out_array1d, + 1, 1, data_type, num_in_array1d, in_array1d)); +} + +int CCTK_ReduceLocArrayToArray1D(cGH *GH, int proc, int operation_handle, + void *in_array1d, void *out_array1d, + int num_in_array1d, + int data_type) { return (CCTK_ReduceArray (GH, proc, operation_handle, num_in_array1d, data_type, out_array1d, 1, 1, data_type, num_in_array1d, in_array1d)); } +/*** FIXME: OLD INTERFACE gerd ***/ void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocalArray1D)(int *fortran_return, - cGH *GH, + cGH *GH, int *proc, int *operation_handle, void *in_array1d, @@ -686,3 +723,133 @@ void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocalArray1D)(int *fortran_return, in_array1d); } + +/*@@ + @routine CCTK_ReduceLocArrayToArray1D + @date Sat Nov 27 22:52:10 1999 + @author Gerd Lanfermann + @desc + Interface for the reduction of local 1d arrays + to the mighty CCCTK_reduce interface. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ + + +void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocArrayToArray1D)(int *fortran_return, + cGH *GH, + int *proc, + int *operation_handle, + void *in_array1d, + void *out_array1d, + int *num_in_array1d, + int *data_type) +{ + *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + *num_in_array1d, *data_type, out_array1d, + 1, 1, *data_type, *num_in_array1d, + in_array1d); +} + +/*@@ + @routine CCTK_ReduceLocArrayToArray2D + @date Sat Nov 27 22:52:10 1999 + @author Gerd Lanfermann + @desc + Interface for the reduction of local 2d arrays + to the mighty CCCTK_reduce interface. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ + + + +int CCTK_ReduceLocArrayToArray2D(cGH *GH, int proc, int operation_handle, + void *in_array2d, void *out_array2d, + int xsize, int ysize, + int data_type) +{ + int lin_size= xsize*ysize; + return (CCTK_ReduceArray (GH, proc, operation_handle, + lin_size, + data_type, out_array2d, + 2, 1, data_type, + xsize,ysize, in_array2d)); +} + +void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocArrayToArray2D) + (int *fortran_return, cGH *GH, + int *proc, + int *operation_handle, + void *in_array2d, + void *out_array2d, + int *xsize, int *ysize, + int *data_type) +{ + int lin_size = (*xsize)*(*ysize); + *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + lin_size, + *data_type, out_array2d, + 2, 1, *data_type, + *xsize, *ysize, + in_array2d); +} + +/*@@ + @routine CCTK_ReduceLocArrayToArray1D + @date Sat Nov 27 22:52:10 1999 + @author Gerd Lanfermann + @desc + Interface for the reduction of local 3d arrays + to 3d arrays. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ + +int CCTK_ReduceLocArrayToArray3D(cGH *GH, int proc, int operation_handle, + void *in_array3d, void *out_array3d, + int xsize, int ysize, int zsize, + int data_type) +{ + + int lin_size = xsize*ysize*zsize; + return (CCTK_ReduceArray (GH, proc, operation_handle, + lin_size, + data_type, out_array3d, + 3, 1, data_type, + xsize,ysize,zsize, + in_array3d)); +} + +void FMODIFIER FORTRAN_NAME(CCTK_ReduceLocArrayToArray3D) + (int *fortran_return, cGH *GH, + int *proc, + int *operation_handle, + void *in_array3d, + void *out_array3d, + int *xsize, int *ysize, int *zsize, + int *data_type) +{ + int lin_size = (*xsize)*(*ysize)*(*zsize); + *fortran_return = CCTK_ReduceArray (GH, *proc, *operation_handle, + lin_size, + *data_type, out_array3d, + 3, 1, *data_type, + *xsize,*ysize,*zsize, + in_array3d); +} diff --git a/src/include/cctk_Reduction.h b/src/include/cctk_Reduction.h index 63716314..2fb17dbc 100644 --- a/src/include/cctk_Reduction.h +++ b/src/include/cctk_Reduction.h @@ -56,13 +56,34 @@ int CCTK_RegisterReductionArrayOperator( void (*function)(REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST), const char *name); +/* FIXME: old interface - should go */ int CCTK_ReduceLocalScalar (cGH *GH, int proc, int operation_handle, void *inScalar, void *outScalar, int dataType); + +/* FIXME: old interface - should go */ int CCTK_ReduceLocalArray1D (cGH *GH, int proc, int operation_handle, void *in_array1d, void *out_array1d, int num_in_array1d, int data_type); +int CCTK_ReduceLocScalar(cGH *GH, int proc, int operation_handle, + void *in_scalar, void *out_scalar, int data_type); + +int CCTK_ReduceLocArrayToArray1D(cGH *GH, int proc, int operation_handle, + void *in_array1d, void *out_array1d, + int num_in_array1d, + int data_type); + +int CCTK_ReduceLocArrayToArray2D(cGH *GH, int proc, int operation_handle, + void *in_array2d, void *out_array2d, + int xsize, int ysize, + int data_type); + +int CCTK_ReduceLocArrayToArray3D(cGH *GH, int proc, int operation_handle, + void *in_array3d, void *out_array3d, + int xsize, int ysize, int zsize, + int data_type); + int CCTK_ReduceArray(cGH *GH, int proc, |