Index: Reduction.c =================================================================== RCS file: /cactusdevcvs/Cactus/src/comm/Reduction.c,v retrieving revision 1.53 diff -d -r1.53 Reduction.c 35a36,113 > /********************************************************/ > /* LocalReduceLocalArrays Fortran wrappers */ > /********************************************************/ > void CCTK_FCALL CCTK_FNAME(CCTK_LocalReduceLocalArrays) > (int *fortran_return, > int *local_reduce_handle, > int *param_table_handle, > int *repeat_count, > int *N_input_arrays, > int *input_rank, > const CCTK_INT input_array_dims[], > const CCTK_INT input_array_type_codes[], > const CCTK_POINTER_TO_CONST input_arrays[], > int *M_output_arrays, > int *output_rank, > const CCTK_INT output_array_dims[], > const CCTK_INT output_array_type_codes[], > const CCTK_POINTER output_arrays[]); > > void CCTK_FCALL CCTK_FNAME(CCTK_LocalReduceLocalArraysHandle) > (int *handle, > ONE_FORTSTRING_ARG); > > void CCTK_FCALL CCTK_FNAME(CCTK_LocalReduceLocalArraysOperatorImplementation) > (ONE_FORTSTRING_ARG, int *handle); > > void CCTK_FCALL CCTK_FNAME(CCTK_LocalReduceLocalArraysOperator) > (ONE_FORTSTRING_ARG, int *handle); > > void CCTK_FCALL CCTK_FNAME(CCTK_NumLocalReduceLocalArraysOperators)(int *num); > > /********************************************************/ > /* ReduceLocalArrays Fortran wrappers */ > /********************************************************/ > void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArrays) > (int *fortran_return, > const cGH *cctkGH, > int *dest_proc, > int *local_reduce_handle, > int *param_table_handle, > int *repeat_count, > int *N_input_arrays, > int *input_rank, > const CCTK_INT input_array_dims[], > const CCTK_INT input_array_type_codes[], > const CCTK_POINTER_TO_CONST input_arrays[], > int *M_output_arrays, > int *output_rank, > const CCTK_INT output_array_dims[], > const CCTK_INT output_array_type_codes[], > const CCTK_POINTER output_arrays[]); > > void CCTK_FCALL CCTK_FNAME(CCTK_NumReduceLocalArraysOperators)(int *num); > > /********************************************************/ > /* ReduceGridArrays Fortran wrappers */ > /********************************************************/ > void CCTK_FCALL CCTK_FNAME(CCTK_ReduceGridArrays) > (int *fortran_return, > const cGH *cctkGH, > int *dest_proc, > int *local_reduce_handle, > int *param_table_handle, > int *repeat_count, > int *N_input_arrays, > const CCTK_INT input_array_variable_indices[], > int *M_output_arrays, > int *output_rank, > const CCTK_INT output_array_dims[], > const CCTK_INT output_array_type_codes[], > const CCTK_POINTER output_arrays[]); > > void CCTK_FCALL CCTK_FNAME(CCTK_NumReduceGridArraysOperators(int *num)); > > /********************************************************/ > /* Old interface Fortran wrappers */ > /********************************************************/ > 62,105d139 < < /* new local array reduction API */ < void CCTK_FCALL CCTK_FNAME(CCTK_LocalArrayReductionHandle) < (int *handle, ONE_FORTSTRING_ARG); < void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArrays) < (int *fortran_return, < int *N_dims, int *operation_handle, < int *param_table_handle, int *N_input_arrays, < const CCTK_INT input_array_dims[], < const CCTK_INT input_array_type_codes[], < const void *const input_arrays[], < int *M_output_values, < const CCTK_INT output_number_type_codes[], < void *const output_values[]); < < /* new gridarray reduction API */ < void CCTK_FCALL CCTK_FNAME(CCTK_ReduceGridArrays) < (int *fortranreturn, < const cGH **GH, < int *dest_proc, < int *local_reduce_handle, < int *param_table_handle, < int *N_input_arrays, < const CCTK_INT input_array_variable_indices[], < int *M_output_values, < const CCTK_INT output_value_type_codes[], < void* const output_values[]); < < /* new reduce arrays globally API */ < void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArraysGlobally) < (int *fortranreturn, < const cGH **GH, < int *dest_proc, < int *local_reduce_handle, < int *param_table_handle, < int *N_input_arrays, < const void * const input_arrays[], < int *input_dims, < const CCTK_INT input_array_dims[], < const CCTK_INT input_array_type_codes[], < int *M_output_values, < const CCTK_INT output_value_type_codes[], < void* const output_values[]); < 162,175d195 < /* structure holding the routines for a registered reduction operator */ < typedef struct < { < const char *implementation; < const char *name; < cReduceOperator reduce_operator; < } t_reduce_operator; < < /* structure holding a function pointer to an array reduction operator */ < typedef struct < { < int (*function) (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); < } t_reduction_array_op; < 181,182c201,202 < cLocalArrayReduceOperator reduce_operator; < } t_local_array_reduce_operator; --- > cLocalReduceLocalArraysOperator * reduce_operator; > } t_local_arrays_local_reduce_operator; 184c204 < /* structure holding a function pointer to an array reduction operator */ --- > /* structure holding the routines for a registered global array reduction operator */ 187,188c207,209 < int (*function) (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST); < } t_reduction_local_array_op; --- > const char *implementation; > cReduceLocalArraysOperator * reduce_operator; > } t_reduce_local_arrays_operator; 194,195c215,216 < cGridArrayReduceOperator reduce_operator; < } t_grid_array_reduce_operator; --- > cReduceGridArraysOperator * reduce_operator; > } t_reduce_grid_arrays_operator; 197,201d217 < /* structure holding a function pointer to a GA reduction operator */ < typedef struct < { < int (*function) (REDUCTION_GRID_ARRAY_OPERATOR_REGISTER_ARGLIST); < } t_reduction_grid_array_op; 203c219,220 < /* structure holding the routines for a registered global array reduction operator */ --- > /* old interface */ > /* structure holding the routines for a registered reduction operator */ 208,209c225,226 < cReduceArraysGloballyOperator reduce_operator; < } t_reduce_arrays_globally_operator; --- > cReduceOperator reduce_operator; > } t_reduce_operator; 211c228 < /* structure holding a function pointer to a global array reduction operator */ --- > /* structure holding a function pointer to an array reduction operator */ 214,215c231,232 < int (*function) (REDUCTION_ARRAYS_GLOBALLY_OPERATOR_REGISTER_ARGLIST); < } t_reduction_arrays_globally_op; --- > int (*function) (REDUCTION_ARRAY_OPERATOR_REGISTER_ARGLIST); > } t_reduction_array_op; 219a237,251 > > /* Local Reduce Local Arrays static variables */ > static cHandledData * LocalReduceLocalArraysOperators = NULL; > static int num_local_reduce_local_arrays_operators = 0; > > /* Reduce Local Arrays static variables */ > static t_reduce_local_arrays_operator LocalArrayReduce; > static int num_reduce_local_arrays_operators = 0; > > /* Reduce Grid Arrays static variables */ > static t_reduce_grid_arrays_operator GridArrayReduce; > static int num_reduce_grid_arrays_operators = 0; > > > /* old interface static variables */ 225,226c257,259 < static cHandledData *LocalArrayReductionOperators = NULL; < static int num_local_array_reductions = 0; --- > /******************************************************************** > ******************** New Reduction API ************************* > ********************************************************************/ 228,229c261,263 < static cHandledData *GridArrayReductionOperators = NULL; < static int num_GA_reductions = 0; --- > /********************************************************/ > /* LocalReduceLocalArrays definitions */ > /********************************************************/ 231,232c265,288 < static cGridArrayReduceOperator GA_reduc = NULL; < static char global[] ="c"; --- > /*@@ > @routine CCTKi_RegisterLocalReduceLocalArraysOperator > @date > @author Yaakoub El Khamra > @desc > Registers "function" as a reduction operator called "name" > @enddesc > @var function > @vdesc Routine containing reduction operator > @vtype (void (*)) > @vio > @endvar > @var name > @vdesc String containing name of reduction operator > @vtype const char * > @vio in > @endvar > @@*/ > int CCTKi_RegisterLocalReduceLocalArraysOperator(const char *thorn, > cLocalReduceLocalArraysOperator operator, > const char *name) > { > int handle; > t_local_arrays_local_reduce_operator *reduce_operator; 234,235c290,301 < static cHandledData *ReductionArraysGloballyOperators = NULL; < static int num_reductions_arrays_globally = 0; --- > /* Check that the method hasn't already been registered */ > handle = Util_GetHandle(LocalReduceLocalArraysOperators, name, > (void **) &reduce_operator); > if(handle < 0) > { > reduce_operator = malloc (sizeof (t_local_arrays_local_reduce_operator)); > if (reduce_operator) > { > reduce_operator->implementation = CCTK_ThornImplementation(thorn); > reduce_operator->name = name; > reduce_operator->reduce_operator = operator; > handle = Util_NewHandle(&LocalReduceLocalArraysOperators, name, reduce_operator); 237,238c303,1175 < static cReduceArraysGloballyOperator ArraysGlobally_reduc = NULL; < static char reduction_arrays_globally_global[] ="Y"; --- > /* Remember how many reduction operators there are */ > num_local_reduce_local_arrays_operators++; > } > } > else > { > /* Reduction operator with this name already exists. */ > CCTK_Warn(1,__LINE__,__FILE__,"Cactus", > "CCTKi_RegisterLocalReduceLocalArraysOperator: Reduction operator " > "with this name already exists"); > handle = -1; > } > > return handle; > } > > > /*@@ > @routine CCTK_LocalReduceLocalArraysHandle > @date > @author Yaakoub El Khamra > @desc > Returns the handle of a given local array reduction operator > @enddesc > @var reduction > @vdesc String containing name of reduction operator > @vtype const char * > @vio in > @endvar > @@*/ > int CCTK_LocalReduceLocalArraysHandle(const char *reduction) > { > int handle; > > handle = Util_GetHandle(LocalReduceLocalArraysOperators, reduction, NULL); > if (handle < 0) > { > CCTK_VWarn(1,__LINE__,__FILE__,"Cactus", > "CCTK_LocalArrayReductionHandle: No handle: '%d' found for reduction operator " > "'%s'", handle, reduction); > } > > return handle; > } > > void CCTK_FCALL CCTK_FNAME(CCTK_LocalReduceLocalArraysHandle)(int *handle, ONE_FORTSTRING_ARG) > { > ONE_FORTSTRING_CREATE(reduction) > *handle = CCTK_LocalReduceLocalArraysHandle(reduction); > free(reduction); > } > > > /*@@ > @routine CCTK_LocalReduceLocalArrays > @date > @author Yaakoub El Khamra > @desc > Generic routine for doing a reduction operation on a set of > Cactus variables. > @enddesc > @endvar > @var local_reduce_handle > @vdesc handle that identifies the reduction operator > @vtype int > @vio in > @endvar > @var param_table_handle > @vdesc handle for a table containing additional parameters > @vtype int > @vio in > @endvar > @var N_input_arrays > @vdesc number of input arrays > @vtype int > @vio in > @endvar > @var repeat_count > @vdesc repeat count > @vtype int > @vio in > @endvar > @var input_rank > @vdesc Rank (number of "dimensions") of the input arrays > @vtype int > @vio in > @var input_array_sizes > @vdesc sizes of the input arrays > @vtype const CCTK_INT [] > @vio in > @endvar > @var input_array_type_codes > @vdesc types of the input arrays > @vtype const CCTK_INT [] > @vio in > @endvar > @var input_arrays > @vdesc input arrays > @vtype const CCTK_POINTER_TO_CONST [] > @vio in > @endvar > @var M_output_values > @vdesc number of output values > @vtype int > @vio in > @endvar > @var output_rank > @vdesc Rank (number of "dimensions") of the output arrays > @vtype int > @vio in > @var output_value_type_codes > @vdesc types of the output values > @vtype const CCTK_INT [] > @vio in > @endvar > @var output_values > @vdesc pointers to the output values > @vtype const CCTK_POINTER [] > @vio out > @endvar > @returntype int > @returndesc > negative for errors > @endreturndesc > @@*/ > int CCTK_LocalReduceLocalArrays(int local_reduce_handle, > int param_table_handle, > int repeat_count, > int N_input_arrays, > int input_rank, > const CCTK_INT input_array_dims[], > const CCTK_INT input_array_type_codes[], > const CCTK_POINTER_TO_CONST input_arrays[], > int M_output_values, > int output_rank, > const CCTK_INT output_array_dims[], > const CCTK_INT output_array_type_codes[], > const CCTK_POINTER output_arrays[]) > { > int retval; > t_local_arrays_local_reduce_operator *operator; > > /* Get the pointer to the reduction operator */ > if (local_reduce_handle < 0) > { > CCTK_Warn(1,__LINE__,__FILE__,"Cactus", > "CCTK_LocalReduceLocalArrays: Invalid handle passed to CCTK_LocalReduceLocalArrays"); > retval = -1; > } > else > { > operator = Util_GetHandledData(LocalReduceLocalArraysOperators, > local_reduce_handle); > > if (!operator) > { > CCTK_Warn(1,__LINE__,__FILE__,"Cactus", > "CCTK_LocalReduceLocalArrays: Reduction operation is not registered" > "and cannot be called"); > retval = -1; > } > else > { > retval = operator->reduce_operator (local_reduce_handle, > param_table_handle, > repeat_count, > N_input_arrays, > input_rank, > input_array_dims, > input_array_type_codes, > input_arrays, > M_output_values, > output_rank, > output_array_dims, > output_array_type_codes, > output_arrays); > } > } > return retval; > } > > void CCTK_FCALL CCTK_FNAME(CCTK_LocalReduceLocalArrays) > (int *fortranreturn, > int *local_reduce_handle, > int *param_table_handle, > int *repeat_count, > int *N_input_arrays, > int *input_rank, > const CCTK_INT input_array_dims[], > const CCTK_INT input_array_type_codes[], > const CCTK_POINTER_TO_CONST input_arrays[], > int *M_output_values, > int *output_rank, > const CCTK_INT output_array_dims[], > const CCTK_INT output_array_type_codes[], > const CCTK_POINTER output_arrays[]) > { > int retval; > t_local_arrays_local_reduce_operator *operator; > > /* initialize return code to indicate an error */ > *fortranreturn = -1; > > if (*local_reduce_handle < 0) > { > CCTK_Warn(3,__LINE__,__FILE__,"Cactus", > "CCTK_LocalReduceLocalArrays: Invalid handle passed to CCTK_LocalReduceLocalArrays"); > retval = -1; > } > else > { > /* Get the pointer to the reduction operator */ > operator = Util_GetHandledData(LocalReduceLocalArraysOperators,*local_reduce_handle); > > if (!operator) > { > CCTK_Warn(3,__LINE__,__FILE__,"Cactus", > "CCTK_LocalReduceLocalArrays: Reduction operation is not registered" > " and cannot be called"); > retval = -1; > } > else > { > retval = operator->reduce_operator (*local_reduce_handle, > *param_table_handle, > *repeat_count, > *N_input_arrays, > *input_rank, > input_array_dims, > input_array_type_codes, > *input_arrays, > *M_output_values, > *output_rank, > output_array_dims, > output_array_type_codes, > output_arrays); > } > } > *fortranreturn = retval; > } > > /*@@ > @routine CCTK_NumLocalReduceLocalArraysOperators > @date > @author Yaakoub El Khamra > @desc > The number of reduction operators registered > @enddesc > @returntype int > @returndesc > number of reduction operators > @endreturndesc > @@*/ > > int CCTK_NumLocalReduceLocalArraysOperators(void) > { > return num_local_reduce_local_arrays_operators; > } > > void CCTK_FCALL CCTK_FNAME(CCTK_NumLocalReduceLocalArraysOperators)(int *fortranreturn) > { > *fortranreturn = CCTK_NumLocalReduceLocalArraysOperators(); > } > > /*@@ > @routine CCTK_LocalReduceLocalArraysOperatorImplementation > @date > @author Yaakoub El Khamra > @desc > Provide the implementation which provides an local array reduction operator > @enddesc > @returntype int > @returndesc > Implementation which supplied the reduction operator > @endreturndesc > @@*/ > const char *CCTK_LocalReduceLocalArraysOperatorImplementation(int handle) > { > t_local_arrays_local_reduce_operator *operator; > > > operator = Util_GetHandledData (LocalReduceLocalArraysOperators, handle); > > return (operator ? operator->implementation : NULL); > } > > /*@@ > @routine CCTK_LocalReduceLocalArraysOperator > @date > @author Yaakoub El Khamra > @desc > Returns the name of a reduction operator > @enddesc > @var handle > @vdesc Handle for reduction operator > @vtype int > @vio in > @endvar > > @returntype const char * > @returndesc > The name of the reduction operator, or NULL if the handle > is invalid > @endreturndesc > @@*/ > const char *CCTK_LocalReduceLocalArraysOperator (int handle) > { > const char *name=NULL; > t_local_arrays_local_reduce_operator *operator; > > if (handle < 0) > { > CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", > "CCTK_LocalReduceLocalArraysOperator: Handle %d invalid", handle); > } > else > { > operator = Util_GetHandledData (LocalReduceLocalArraysOperators, handle); > if (operator) > { > name = operator->name; > } > else > { > CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", > "CCTK_LocalReduceLocalArraysOperator: Handle %d invalid", handle); > } > } > > return name; > } > > /********************************************************/ > /* ReduceLocalArrays definitions */ > /********************************************************/ > > /*@@ > @routine CCTKi_RegisterReduceLocalArraysOperator > @date > @author Yaakoub El Khamra > @desc > Registers "function" as a reduction operator called "name" > @enddesc > @var function > @vdesc Routine containing reduction operator > @vtype (void (*)) > @vio > @endvar > @var name > @vdesc String containing name of reduction operator > @vtype const char * > @vio in > @endvar > @@*/ > int CCTKi_RegisterReduceLocalArraysOperator(const char *thorn, > cReduceLocalArraysOperator operator) > { > int handle; > > /* Check that there is no other registered GA reduction */ > if(num_reduce_local_arrays_operators == 0) > { > LocalArrayReduce.implementation = CCTK_ThornImplementation(thorn); > LocalArrayReduce.reduce_operator = operator; > /* Remember how many reduction operators there are */ > num_reduce_local_arrays_operators++; > } > else > { > /* Reduction operator with this name already exists. */ > CCTK_Warn(1,__LINE__,__FILE__,"Cactus", > "CCTKi_RegisterReduceLocalArraysOperator: Reduction operator " > "already exists"); > handle = -1; > } > return handle; > } > > /*@@ > @routine CCTK_ReduceLocalArrays > @date > @author Yaakoub El Khamra > @desc > Generic routine for doing a reduction operation on a set of > arrays in a global manner > @enddesc > @var GH > @vdesc pointer to the grid hierarchy > @vtype cGH * > @vio in > @endvar > @var dest_proc > @vdesc the number of the processor to which we want to reduce (-1) for all-reduce > @vtype int > @vio in > @endvar > @var local_reduce_handle > @vdesc the handle specifying the reduction operator > @vtype int > @vio in > @endvar > @var param_table_handle > @vdesc the parameter table handle > @vtype int > @vio in > @var repeat_count > @vdesc number of repititions to perform > @vtype int > @vio in > @endvar > @var N_input_arrays > @vdesc number of elements in the reduction input > @vtype int > @vio in > @endvar > @var input_rank > @vdesc rank of the input array > @vtype int > @vio in > @endvar > @var input_dims > @vdesc number of dimensions > @vtype int > @vio in > @endvar > @var input_array_type_codes > @vdesc types of the input arrays > @vtype const CCTK_INT [] > @vio in > @endvar > @var input_arrays > @vdesc input arrays > @vtype const CCTK_POINTER_TO_CONST [] > @vio in > @endvar > @var M_output_values > @vdesc number of output values > @vtype int > @vio in > @endvar > @var output_rank > @vdesc rank of output arrays > @vtype int > @vio in > @endvar > @var output_array_type_dims > @vdesc array containing output array dimensions > @vtype const CCTK_IN [] > @vio in > @endvar > @var output_array_type_codes > @vdesc array containing output array type codes > @vtype const CCTK_IN [] > @vio in > @endvar > @var output_values > @vdesc array of output values > @vtype const CCTK_POINTER_TO_CONST [] > @vio in > @endvar > @returntype int > @returndesc > negative for errors > @endreturndesc > @@*/ > > int CCTK_ReduceLocalArrays(const cGH *GH, > int dest_proc, > int local_reduce_handle, > int param_table_handle, > int repeat_count, > int N_input_arrays, > int input_rank, > const CCTK_INT input_array_dims[], > const CCTK_INT input_array_type_codes[], > const CCTK_POINTER_TO_CONST input_arrays[], > int M_output_values, > int output_rank, > const CCTK_INT output_array_dims[], > const CCTK_INT output_array_type_codes[], > const CCTK_POINTER output_arrays[]) > { > int retval; > > /* Get the pointer to the reduction operator */ > if (num_reduce_local_arrays_operators == 0) > { > CCTK_Warn(3,__LINE__,__FILE__,"Cactus", > "CCTK_ReduceLocalArrays: no local array reduction registered"); > retval = -1; > } > else > { > retval = LocalArrayReduce.reduce_operator(GH, > dest_proc, > local_reduce_handle, > param_table_handle, > repeat_count, > N_input_arrays, > input_rank, > input_array_dims, > input_array_type_codes, > input_arrays, > M_output_values, > output_rank, > output_array_dims, > output_array_type_codes, > output_arrays); > } > return retval; > } > > void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArrays) > (int *fortran_return, > const cGH *cctkGH, > int *dest_proc, > int *local_reduce_handle, > int *param_table_handle, > int *repeat_count, > int *N_input_arrays, > int *input_rank, > const CCTK_INT input_array_dims[], > const CCTK_INT input_array_type_codes[], > const CCTK_POINTER_TO_CONST input_arrays[], > int *M_output_arrays, > int *output_rank, > const CCTK_INT output_array_dims[], > const CCTK_INT output_array_type_codes[], > const CCTK_POINTER output_arrays[]) > { > int retval; > > /* Get the pointer to the reduction operator */ > if (num_reduce_local_arrays_operators == 0) > { > CCTK_Warn(3,__LINE__,__FILE__,"Cactus", > "CCTK_ReduceLocalArrays: no grid array reduction registered"); > retval = -1; > } > else > { > retval = LocalArrayReduce.reduce_operator(cctkGH, > *dest_proc, > *local_reduce_handle, > *param_table_handle, > *repeat_count, > *N_input_arrays, > *input_rank, > input_array_dims, > input_array_type_codes, > input_arrays, > *M_output_arrays, > *output_rank, > output_array_dims, > output_array_type_codes, > output_arrays); > } > *fortran_return = retval; > } > > /*@@ > @routine CCTK_NumReduceLocalArraysOperators > @date > @author Yaakoub El Khamra > @desc > The number of pointwie reduction operators registered > @enddesc > @returntype int > @returndesc > number of reduction operators > @endreturndesc > @@*/ > > int CCTK_NumReduceLocalArraysOperators(void) > { > return num_reduce_local_arrays_operators; > } > > /*@@ > @routine CCTK_ReduceLocalArraysOperatorImplementation > @date > @author Yaakoub El Khamra > @desc > Returns the name of the reduction operator > @enddesc > @var handle > @vdesc Handle for reduction operator > @vtype int > @vio in > @endvar > > @returntype const char * > @returndesc > The name of the reduction operator, or NULL if the handle > is invalid > @endreturndesc > @@*/ > > const char *CCTK_ReduceLocalArraysOperatorImplementation (void) > { > const char *thorn=NULL; > > if (num_reduce_local_arrays_operators == 0) > { > CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", > "CCTK_ReductionArraysGloballyOperator: no reduction of arrays globally operator"); > } > else > { > thorn = LocalArrayReduce.implementation; > } > > return thorn; > } > > /********************************************************/ > /* ReduceGridArrays definitions */ > /********************************************************/ > > /*@@ > @routine CCTKi_RegisterReduceGridArraysOperator > @date > @author Yaakoub El Khamra > @desc > Registers "function" as a reduction operator called "name" > @enddesc > @var function > @vdesc Routine containing reduction operator > @vtype (void (*)) > @vio > @endvar > @var name > @vdesc String containing name of reduction operator > @vtype const char * > @vio in > @endvar > @@*/ > int CCTKi_RegisterReduceGridArraysOperator(const char *thorn, > cReduceGridArraysOperator operator) > { > int handle; > > /* Check that there is no other registered GA reduction */ > if(num_reduce_grid_arrays_operators == 0) > { > GridArrayReduce.implementation = CCTK_ThornImplementation(thorn); > GridArrayReduce.reduce_operator = operator; > /* Remember how many reduction operators there are */ > num_reduce_grid_arrays_operators++; > } > else > { > /* Reduction operator with this name already exists. */ > CCTK_Warn(1,__LINE__,__FILE__,"Cactus", > "CCTKi_RegisterReduceGridArraysOperator: Reduction operator " > "already exists"); > handle = -1; > } > return handle; > } > > /*@@ > @routine CCTK_ReduceGridArrays > @date Mon Aug 30 11:27:43 2004 > @author Yaakoub El Khamra > @desc > Generic routine for doing a reduction operation on a set of > Cactus variables. > @enddesc > @var GH > @vdesc pointer to the grid hierarchy > @vtype cGH * > @vio in > @endvar > @var dest_proc > @vdesc the number of the processor to which we want to reduce (-1) for all-reduce > @vtype int > @vio in > @endvar > @var local_reduce_handle > @vdesc handle that identifies the reduction operator > @vtype int > @vio in > @endvar > @var param_table_handle > @vdesc handle for a table containing additional parameters > @vtype int > @vio in > @endvar > @var repeat_count > @vdesc repeat count > @vtype int > @vio in > @endvar > @var N_input_arrays > @vdesc number of input arrays > @vtype int > @vio in > @endvar > @var input_array_variable_indices[] > @vdesc indices ont he input arrays > @vtype const CCTK_INT [] > @vio in > @endvar > @var M_output_values > @vdesc number of output values > @vtype int > @vio in > @endvar > @var output_rank > @vdesc Rank (number of "dimensions") of the output arrays > @vtype int > @vio in > @var output_value_dims[] > @vdesc dimensions of the output arrays > @vtype const CCTK_INT [] > @vio in > @endvar > @var output_value_type_codes > @vdesc types of the output values > @vtype const CCTK_INT [] > @vio in > @endvar > @var output_values > @vdesc pointers to the output values > @vtype const CCTK_POINTER [] > @vio out > @endvar > @returntype int > @returndesc > negative for errors > @endreturndesc > @@*/ > int CCTK_ReduceGridArrays(const cGH *GH, > int dest_proc, > int local_reduce_handle, > int param_table_handle, > int repeat_count, > int N_input_arrays, > const CCTK_INT input_array_variable_indices[], > int M_output_arrays, > int output_rank, > const CCTK_INT output_array_dims[], > const CCTK_INT output_value_type_codes[], > const CCTK_POINTER output_values[]) > { > int retval; > > /* Get the pointer to the reduction operator */ > if (num_reduce_grid_arrays_operators == 0) > { > CCTK_Warn(3,__LINE__,__FILE__,"Cactus", > "CCTK_ReduceGridArrays: no grid array reduction registered"); > retval = -1; > } > else > { > retval = GridArrayReduce.reduce_operator (GH, > dest_proc, > local_reduce_handle, > param_table_handle, > repeat_count, > N_input_arrays, > input_array_variable_indices, > M_output_arrays, > output_rank, > output_array_dims, > output_value_type_codes, > output_values); > } > return retval; > } > > void CCTK_FCALL CCTK_FNAME(CCTK_ReduceGridArrays) > (int *fortranreturn, > const cGH *GH, > int *dest_proc, > int *local_reduce_handle, > int *param_table_handle, > int *repeat_count, > int *N_input_arrays, > const CCTK_INT input_array_variable_indices[], > int *M_output_arrays, > int *output_rank, > const CCTK_INT output_array_dims[], > const CCTK_INT output_value_type_codes[], > const CCTK_POINTER output_values[]) > { > int retval; > > /* Get the pointer to the reduction operator */ > if (num_reduce_grid_arrays_operators == 0) > { > CCTK_Warn(3,__LINE__,__FILE__,"Cactus", > "CCTK_ReduceGridArrays: no grid array reduction registered"); > retval = -1; > } > else > { > retval = GridArrayReduce.reduce_operator (GH, > *dest_proc, > *local_reduce_handle, > *param_table_handle, > *repeat_count, > *N_input_arrays, > input_array_variable_indices, > *M_output_arrays, > *output_rank, > output_array_dims, > output_value_type_codes, > output_values); > } > *fortranreturn = retval; > } > > /*@@ > @routine CCTK_NumGridArrayReductionOperators > @date Mon Aug 30 11:27:43 2004 > @author Gabrielle Allen, Yaakoub El Khamra > @desc > The number of reduction operators registered > @enddesc > @returntype int > @returndesc > number of reduction operators > @endreturndesc > @@*/ > > int CCTK_NumGridArrayReductionOperators(void) > { > return num_reduce_grid_arrays_operators; > } > > /*@@ > @routine CCTK_ReduceGridArraysOperatorImplementation > @date > @author Yaakoub El Khamra > @desc > Returns the name of the reduction operator > @enddesc > @var handle > @vdesc Handle for reduction operator > @vtype int > @vio in > @endvar > > @returntype const char * > @returndesc > The name of the reduction operator, or NULL if the handle > is invalid > @endreturndesc > @@*/ > const char *CCTK_ReduceGridArraysOperatorImplementation (void) > { > const char *thorn=NULL; > > if (num_reduce_grid_arrays_operators == 0) > { > CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", > "CCTK_ReduceGridArraysOperatorImplementation: no Reduce Grid Arrays operator registered"); > } > else > { > thorn = GridArrayReduce.implementation; > } > > return thorn; > } > > > /******************************************************************** > ******************** Old Reduction API ************************* > ********************************************************************/ 1042,1292d1978 < /* new local arrays api routines */ < /*@@ < @routine CCTKi_RegisterLocalArrayReductionOperator < @date < @author Gabrielle Allen, Yaakoub El Khamra < @desc < Registers "function" as a reduction operator called "name" < @enddesc < @var function < @vdesc Routine containing reduction operator < @vtype (void (*)) < @vio < @endvar < @var name < @vdesc String containing name of reduction operator < @vtype const char * < @vio in < @endvar < @@*/ < int CCTKi_RegisterLocalArrayReductionOperator(const char *thorn, < cLocalArrayReduceOperator operator, < const char *name) < { < int handle; < t_local_array_reduce_operator *reduce_operator; < < < /* Check that the method hasn't already been registered */ < handle = Util_GetHandle(LocalArrayReductionOperators, name, < (void **) &reduce_operator); < if(handle < 0) < { < reduce_operator = malloc (sizeof (t_reduce_operator)); < if (reduce_operator) < { < reduce_operator->implementation = CCTK_ThornImplementation(thorn); < reduce_operator->name = name; < reduce_operator->reduce_operator = operator; < handle = Util_NewHandle(&LocalArrayReductionOperators, name, reduce_operator); < < /* Remember how many reduction operators there are */ < num_local_array_reductions++; < } < } < else < { < /* Reduction operator with this name already exists. */ < CCTK_Warn(1,__LINE__,__FILE__,"Cactus", < "CCTK_RegisterLocalArrayReductionOperator: Reduction operator " < "with this name already exists"); < handle = -1; < } < < return handle; < } < < < /*@@ < @routine CCTK_LocalArrayReductionHandle < @date < @author Gabrielle Allen Yaakoub El Khamra < @desc < Returns the handle of a given local array reduction operator < @enddesc < @var reduction < @vdesc String containing name of reduction operator < @vtype const char * < @vio in < @endvar < @@*/ < int CCTK_LocalArrayReductionHandle(const char *reduction) < { < int handle; < < < handle = Util_GetHandle(LocalArrayReductionOperators, reduction, NULL); < if (handle < 0) < { < CCTK_VWarn(1,__LINE__,__FILE__,"Cactus", < "CCTK_LocalArrayReductionHandle: No handle: '%d' found for reduction operator " < "'%s'", handle, reduction); < } < < return handle; < } < < void CCTK_FCALL CCTK_FNAME(CCTK_LocalArrayReductionHandle)(int *handle, ONE_FORTSTRING_ARG) < { < ONE_FORTSTRING_CREATE(reduction) < *handle = CCTK_LocalArrayReductionHandle(reduction); < free(reduction); < } < < < /*@@ < @routine CCTK_ReduceLocalArrays < @date < @author Gabrielle Allen, Yaakoub El Khamra < @desc < Generic routine for doing a reduction operation on a set of < Cactus variables. < @enddesc < @var output_values < @vdesc array of output values < @vtype void * const [] < @vio in < @endvar < @var N_dims < @vdesc dimension of the input arrays < @vtype int < @vio in < @endvar < @var local_reduce_handle < @vdesc handle that identifies the reduction operator < @vtype int < @vio in < @endvar < @var param_table_handle < @vdesc handle for a table containing additional parameters < @vtype int < @vio in < @endvar < @var N_input_arrays < @vdesc number of input arrays < @vtype int < @vio in < @endvar < @var input_array_sizes < @vdesc sizes of the input arrays < @vtype const CCTK_INT [] < @vio in < @endvar < @var input_array_type_codes < @vdesc types of the input arrays < @vtype const CCTK_INT [] < @vio in < @endvar < @var input_arrays < @vdesc input arrays < @vtype const void *const [] < @vio in < @endvar < @var M_output_values < @vdesc number of output values < @vtype int < @vio in < @endvar < @var output_value_type_codes < @vdesc types of the output values < @vtype const CCTK_INT [] < @vio in < @endvar < @var output_values < @vdesc pointers to the output values < @vtype void *const [] < @vio out < @endvar < @returntype int < @returndesc < negative for errors < @endreturndesc < @@*/ < int CCTK_ReduceLocalArrays(int N_dims, < int local_reduce_handle, < int param_table_handle, < int N_input_arrays, < const CCTK_INT input_array_sizes[], < const CCTK_INT input_array_type_codes[], < const void *const input_arrays[], < int M_output_values, < const CCTK_INT output_value_type_codes[], < void *const output_values[]) < { < int retval; < t_local_array_reduce_operator *operator; < < /* Get the pointer to the reduction operator */ < if (local_reduce_handle < 0) < { < CCTK_Warn(1,__LINE__,__FILE__,"Cactus", < "CCTK_LocalArraysReduce: Invalid handle passed to CCTK_ReduceLocalArrays"); < retval = -1; < } < else < { < operator = Util_GetHandledData(LocalArrayReductionOperators, < local_reduce_handle); < < if (!operator) < { < CCTK_Warn(1,__LINE__,__FILE__,"Cactus", < "CCTK_ReduceLocalArrays: Reduction operation is not registered" < "and cannot be called"); < retval = -1; < } < else < { < retval = operator->reduce_operator (N_dims, local_reduce_handle, < param_table_handle, N_input_arrays, < input_array_sizes, input_array_type_codes, < input_arrays, M_output_values, < output_value_type_codes, output_values); < } < } < return retval; < } < < void CCTK_FCALL CCTK_FNAME(CCTK_ReduceLocalArrays) < (int *fortranreturn,int * N_dims, int *operation_handle, < int *param_table_handle, int * N_input_arrays, < const CCTK_INT input_array_dims[], < const CCTK_INT input_array_type_codes[], < const void *const input_arrays[], < int * M_output_numbers, const CCTK_INT output_number_type_codes[], < void *const output_numbers[]) < { < int retval; < t_local_array_reduce_operator *operator; < < /* initialize return code to indicate an error */ < *fortranreturn = -1; < < if (*operation_handle < 0) < { < CCTK_Warn(3,__LINE__,__FILE__,"Cactus", < "CCTK_ReduceLocalArrays: Invalid handle passed to CCTK_ReduceLocalArrays"); < retval = -1; < } < else < { < /* Get the pointer to the reduction operator */ < operator = Util_GetHandledData(LocalArrayReductionOperators,*operation_handle); < < if (!operator) < { < CCTK_Warn(3,__LINE__,__FILE__,"Cactus", < "CCTK_ReduceLocalArrays: Reduction operation is not registered" < " and cannot be called"); < retval = -1; < } < else < { < retval = operator->reduce_operator (*N_dims, *operation_handle, < *param_table_handle, *N_input_arrays, < input_array_dims, input_array_type_codes, < input_arrays, *M_output_numbers, < output_number_type_codes, output_numbers); < } < } < *fortranreturn = retval; < } 1312,1334d1997 < /*@@ < @routine CCTK_NumReduceOperators < @date < @author Gabrielle Allen, Yaakoub El Khamra < @desc < The number of reduction operators registered < @enddesc < @returntype int < @returndesc < number of reduction operators < @endreturndesc < @@*/ < < int CCTK_NumLocalArrayReduceOperators(void) < { < return num_local_array_reductions; < } < < void CCTK_FCALL CCTK_FNAME(CCTK_NumLocalArrayReduceOperators)(int *fortranreturn); < void CCTK_FCALL CCTK_FNAME(CCTK_NumLocalArrayReduceOperators)(int *fortranreturn) < { < *fortranreturn = CCTK_NumLocalArrayReduceOperators(); < } 1358,1372d2020 < /*@@ < @routine CCTK_LocalArrayReduceOperatorImplementation < @date < @author Gabrielle Allen, Yaakoub El Khamra < @desc < Provide the implementation which provides an local array reduction operator < @enddesc < @returntype int < @returndesc < Implementation which supplied the reduction operator < @endreturndesc < @@*/ < const char *CCTK_LocalArrayReduceOperatorImplementation(int handle) < { < t_local_array_reduce_operator *operator; 1375,1379d2022 < operator = Util_GetHandledData (LocalArrayReductionOperators, handle); < < return (operator ? operator->implementation : NULL); < } < 1427,1958d2069 < /*@@ < @routine CCTK_LocalArrayReduceOperator < @date < @author Gabrielle Allen, Yaakoub El Khamra < @desc < Returns the name of a reduction operator < @enddesc < @var handle < @vdesc Handle for reduction operator < @vtype int < @vio in < @endvar < < @returntype const char * < @returndesc < The name of the reduction operator, or NULL if the handle < is invalid < @endreturndesc < @@*/ < const char *CCTK_LocalArrayReduceOperator (int handle) < { < const char *name=NULL; < t_local_array_reduce_operator *operator; < < if (handle < 0) < { < CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", < "CCTK_LocalArrayReduceOperator: Handle %d invalid", handle); < } < else < { < operator = Util_GetHandledData (LocalArrayReductionOperators, handle); < if (operator) < { < name = operator->name; < } < else < { < CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", < "CCTK_LocalArrayReduceOperator: Handle %d invalid", handle); < } < } < < return name; < } < < /*@@ < @routine CCTKi_RegisterGridArrayReductionOperator < @date Mon Aug 30 11:27:43 2004 < @author Gabrielle Allen, Yaakoub El Khamra < @desc < Registers "function" as a reduction operator called "name" < @enddesc < @var function < @vdesc Routine containing reduction operator < @vtype (void (*)) < @vio < @endvar < @var name < @vdesc String containing name of reduction operator < @vtype const char * < @vio in < @endvar < @@*/ < int CCTKi_RegisterGridArrayReductionOperator(const char *thorn, < cGridArrayReduceOperator operator) < { < int handle; < t_grid_array_reduce_operator *reduce_operator; < < /* Check that there is no other registered GA reduction */ < if(num_GA_reductions == 0) < { < reduce_operator = (t_grid_array_reduce_operator *)malloc (sizeof (t_grid_array_reduce_operator)); < reduce_operator->implementation = CCTK_ThornImplementation(thorn); < reduce_operator->reduce_operator = operator; < GA_reduc = operator; < handle = Util_NewHandle(&GridArrayReductionOperators, global, reduce_operator); < /* Remember how many reduction operators there are */ < num_GA_reductions++; < } < else < { < /* Reduction operator with this name already exists. */ < CCTK_Warn(1,__LINE__,__FILE__,"Cactus", < "CCTK_RegisterGridArrayReductionOperator: Reduction operator " < "already exists"); < handle = -1; < } < return handle; < } < < /*@@ < @routine CCTK_ReduceGridArrays < @date Mon Aug 30 11:27:43 2004 < @author Gabrielle Allen, Yaakoub El Khamra < @desc < Generic routine for doing a reduction operation on a set of < Cactus variables. < @enddesc < @var GH < @vdesc pointer to the grid hierarchy < @vtype cGH * < @vio in < @endvar < @var dest_proc < @vdesc the number of the processor to which we want to reduce (-1) for all-reduce < @vtype int < @vio in < @endvar < @var local_reduce_handle < @vdesc the handle specifying the reduction operator < @vtype int < @vio in < @endvar < @var param_table_handle < @vdesc the parameter table handle < @vtype int < @vio in < @endvar < @var N_input_arrays < @vdesc number of elements in the reduction input < @vtype int < @vio in < @endvar < @var input_array_variable_indices < @vdesc input arrays < @vtype const CCTK_INT [] < @vio in < @endvar < @var M_output_values < @vdesc number of output values < @vtype int < @vio in < @endvar < @var output_value_type_codes < @vdesc array containing output value type codes < @vtype const CCTK_IN [] < @vio in < @endvar < @var output_values < @vdesc array of output values < @vtype void * const [] < @vio in < @endvar < @returntype int < @returndesc < negative for errors < @endreturndesc < @@*/ < int CCTK_ReduceGridArrays(const cGH *GH, < int dest_proc, < int local_reduce_handle, < int param_table_handle, < int N_input_arrays, < const CCTK_INT input_array_variable_indices[], < int M_output_values, < const CCTK_INT output_value_type_codes[], < void* const output_values[]) < { < int retval; < < /* Get the pointer to the reduction operator */ < if (num_GA_reductions == 0) < { < CCTK_Warn(3,__LINE__,__FILE__,"Cactus", < "CCTK_ReduceGridArrays: no grid array reduction registered"); < retval = -1; < } < else < { < retval = GA_reduc (GH, < dest_proc, < local_reduce_handle, param_table_handle, < N_input_arrays, input_array_variable_indices, < M_output_values, output_value_type_codes, < output_values); < } < return retval; < } < < void CCTK_FCALL CCTK_FNAME(CCTK_ReduceGridArrays) < (int *fortranreturn, < const cGH **GH, < int *dest_proc, < int *local_reduce_handle, < int *param_table_handle, < int *N_input_arrays, < const CCTK_INT input_array_variable_indices[], < int *M_output_values, < const CCTK_INT output_value_type_codes[], < void* const output_values[]) < { < int retval; < < /* Get the pointer to the reduction operator */ < if (num_GA_reductions == 0) < { < CCTK_Warn(3,__LINE__,__FILE__,"Cactus", < "CCTK_ReduceGridArrays: no grid array reduction registered"); < retval = -1; < } < else < { < retval = GA_reduc (*GH, < *dest_proc, < *local_reduce_handle, *param_table_handle, < *N_input_arrays, input_array_variable_indices, < *M_output_values, output_value_type_codes, < output_values); < } < *fortranreturn = retval; < } < < /*@@ < @routine CCTK_NumGridArrayReductionOperators < @date Mon Aug 30 11:27:43 2004 < @author Gabrielle Allen, Yaakoub El Khamra < @desc < The number of reduction operators registered < @enddesc < @returntype int < @returndesc < number of reduction operators < @endreturndesc < @@*/ < < int CCTK_NumGridArrayReductionOperators(void) < { < return num_GA_reductions; < } < < /*@@ < @routine CCTK_GAReductionOperator < @date Mon Aug 30 11:27:43 2004 < @author Gabrielle Allen, Yaakoub El Khamra < @desc < Returns the name of the reduction operator < @enddesc < @var handle < @vdesc Handle for reduction operator < @vtype int < @vio in < @endvar < < @returntype const char * < @returndesc < The name of the reduction operator, or NULL if the handle < is invalid < @endreturndesc < @@*/ < const char *CCTK_GridArrayReductionOperator (void) < { < const char *thorn=NULL; < t_grid_array_reduce_operator *operator; < < if (num_GA_reductions == 0) < { < CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", < "CCTK_GAReductionOperator: no GA reduction operator"); < } < else < { < Util_GetHandle (GridArrayReductionOperators, global, (void **)&operator); < if (operator) < { < thorn = operator->implementation; < } < else < { < CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", < "CCTK_GAReductionOperator: no GA reduction operator"); < } < } < < return thorn; < } < < /*@@ < @routine CCTKi_RegisterReduceArraysGloballyOperator < @date Mon Aug 30 11:27:43 2004 < @author Gabrielle Allen, Yaakoub El Khamra < @desc < Registers "function" as a reduction operator called "name" < @enddesc < @var function < @vdesc Routine containing reduction operator < @vtype (void (*)) < @vio < @endvar < @var name < @vdesc String containing name of reduction operator < @vtype const char * < @vio in < @endvar < @@*/ < int CCTKi_RegisterReduceArraysGloballyOperator(const char *thorn, < cReduceArraysGloballyOperator operator) < { < int handle; < t_reduce_arrays_globally_operator *reduce_operator; < < /* Check that there is no other registered GA reduction */ < if(num_reductions_arrays_globally == 0) < { < reduce_operator = (t_reduce_arrays_globally_operator *)malloc (sizeof (t_reduce_arrays_globally_operator)); < reduce_operator->implementation = CCTK_ThornImplementation(thorn); < reduce_operator->reduce_operator = operator; < ArraysGlobally_reduc = operator; < handle = Util_NewHandle(&ReductionArraysGloballyOperators, reduction_arrays_globally_global, reduce_operator); < /* Remember how many reduction operators there are */ < num_reductions_arrays_globally++; < } < else < { < /* Reduction operator with this name already exists. */ < CCTK_Warn(1,__LINE__,__FILE__,"Cactus", < "CCTKi_RegisterReduceArraysGloballyOperator: Reduction operator " < "already exists"); < handle = -1; < } < return handle; < } < < /*@@ < @routine CCTK_ReduceArraysGlobally < @date < @author Yaakoub El Khamra < @desc < Generic routine for doing a reduction operation on a set of < arrays in a global manner < @enddesc < @var GH < @vdesc pointer to the grid hierarchy < @vtype cGH * < @vio in < @endvar < @var dest_proc < @vdesc the number of the processor to which we want to reduce (-1) for all-reduce < @vtype int < @vio in < @endvar < @var local_reduce_handle < @vdesc the handle specifying the reduction operator < @vtype int < @vio in < @endvar < @var param_table_handle < @vdesc the parameter table handle < @vtype int < @vio in < @endvar < @var N_input_arrays < @vdesc number of elements in the reduction input < @vtype int < @vio in < @endvar < @var input_arrays < @vdesc input arrays < @vtype const void *const [] < @vio in < @endvar < @var input_dims < @vdesc number of dimensions < @vtype int < @vio in < @endvar < @var input_array_sizes < @vdesc sizes of the input arrays < @vtype const CCTK_INT [] < @vio in < @endvar < @var input_array_type_codes < @vdesc types of the input arrays < @vtype const CCTK_INT [] < @vio in < @endvar < @var M_output_values < @vdesc number of output values < @vtype int < @vio in < @endvar < @var output_value_type_codes < @vdesc array containing output value type codes < @vtype const CCTK_IN [] < @vio in < @endvar < @var output_values < @vdesc array of output values < @vtype void * const [] < @vio in < @endvar < @returntype int < @returndesc < negative for errors < @endreturndesc < @@*/ < int CCTK_ReduceArraysGlobally(const cGH *GH, < int dest_proc, < int local_reduce_handle, < int param_table_handle, < int N_input_arrays, < const void * const input_arrays[], < int input_dims, < const CCTK_INT input_array_dims[], < const CCTK_INT input_array_type_codes[], < int M_output_values, < const CCTK_INT output_value_type_codes[], < void* const output_values[]) < { < int retval; < < /* Get the pointer to the reduction operator */ < if (num_reductions_arrays_globally == 0) < { < CCTK_Warn(3,__LINE__,__FILE__,"Cactus", < "CCTK_ReduceArraysGlobally: no grid array reduction registered"); < retval = -1; < } < else < { < retval = ArraysGlobally_reduc (GH, < dest_proc, < local_reduce_handle, param_table_handle, < N_input_arrays, input_arrays, input_dims, < input_array_dims, input_array_type_codes, < M_output_values, output_value_type_codes, < output_values); < } < return retval; < } < < void CCTK_FCALL CCTK_FNAME(CCTK_ReduceArraysGlobally) < (int *fortranreturn, < const cGH **GH, < int *dest_proc, < int *local_reduce_handle, < int *param_table_handle, < int *N_input_arrays, < const void * const input_arrays[], < int *input_dims, < const CCTK_INT input_array_dims[], < const CCTK_INT input_array_type_codes[], < int *M_output_values, < const CCTK_INT output_value_type_codes[], < void* const output_values[]) < { < int retval; < < /* Get the pointer to the reduction operator */ < if (num_reductions_arrays_globally == 0) < { < CCTK_Warn(3,__LINE__,__FILE__,"Cactus", < "CCTK_ReduceArraysGlobally: no grid array reduction registered"); < retval = -1; < } < else < { < retval = ArraysGlobally_reduc (*GH, < *dest_proc, < *local_reduce_handle, *param_table_handle, < *N_input_arrays, input_arrays, *input_dims, < input_array_dims, input_array_type_codes, < *M_output_values, output_value_type_codes, < output_values); < } < *fortranreturn = retval; < } < < /*@@ < @routine CCTK_NumReductionArraysGloballyOperators < @date < @author Yaakoub El Khamra < @desc < The number of pointwie reduction operators registered < @enddesc < @returntype int < @returndesc < number of reduction operators < @endreturndesc < @@*/ < < int CCTK_NumReductionArraysGloballyOperators(void) < { < return num_reductions_arrays_globally; < } < < /*@@ < @routine CCTK_ReductionArraysGloballyOperator < @date < @author Yaakoub El Khamra < @desc < Returns the name of the reduction operator < @enddesc < @var handle < @vdesc Handle for reduction operator < @vtype int < @vio in < @endvar < < @returntype const char * < @returndesc < The name of the reduction operator, or NULL if the handle < is invalid < @endreturndesc < @@*/ < const char *CCTK_ReductionArraysGloballyOperator (void) < { < const char *thorn=NULL; < t_reduce_arrays_globally_operator *operator; < < if (num_reductions_arrays_globally == 0) < { < CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", < "CCTK_ReductionArraysGloballyOperator: no reduction of arrays globally operator"); < } < else < { < Util_GetHandle (ReductionArraysGloballyOperators, global, (void **)&operator); < if (operator) < { < thorn = operator->implementation; < } < else < { < CCTK_VWarn (6, __LINE__, __FILE__, "Cactus", < "CCTK_ReductionArraysGloballyOperator: no reduction of arrays globally operator"); < } < } < < return thorn; < } \ No newline at end of file