From 97c436604ea58d0ecc445f8d5046b192ed66f685 Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 12 May 2003 15:02:24 +0000 Subject: If an error condition occurs only locally on any processor, all processors will return with a global error code now. This fixes deadlock situations for the multiprocessor case. The local interpolation status on each processor will be set as a table option entry "local_interpolator_status". git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHInterp/trunk@58 1c20744c-e24a-42ec-9533-f5004cb800e5 --- src/InterpGridArrays.c | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/src/InterpGridArrays.c b/src/InterpGridArrays.c index 66f6ebb..23e851c 100644 --- a/src/InterpGridArrays.c +++ b/src/InterpGridArrays.c @@ -653,19 +653,14 @@ int PUGHInterp_InterpGridArrays (const cGH *GH, free (bbox_interp_coords); free (range_min); + /* flag an error condition on this processor's error code in the + N_points_from[] array which then gets communicated to all processors */ if (retval) { - if (myGH->whichproc) + for (proc = 0; proc < pughGH->nprocs; proc++) { - free (myGH->whichproc); - myGH->whichproc = NULL; + myGH->N_points_from[proc] = retval; } - free (origin_local); - free (input_arrays); - free (input_array_dims); - free (type_desc); - - return (retval); } /* Now we want to resolve the N_points_from[]. Currently this is @@ -693,6 +688,38 @@ int PUGHInterp_InterpGridArrays (const cGH *GH, } #endif + /* check if there was an error condition on a remote processor + different processors may flag different error codes - the first one wins */ + for (proc = 0; proc < pughGH->nprocs; proc++) + { + if (myGH->N_points_to[proc] < 0) + { + retval = myGH->N_points_to[proc]; + break; + } + } + /* collectively return in case of an error */ + if (retval) + { + if (myGH->whichproc) + { + free (myGH->whichproc); + myGH->whichproc = NULL; + } + free (origin_local); + free (input_arrays); + free (input_array_dims); + free (type_desc); + + /* store this processor's interpolator status in the parameter table */ + if (param_table_handle >= 0) + { + Util_TableSetInt (param_table_handle, myGH->N_points_to[pughGH->myproc], + "local_interpolator_status"); + } + return (retval); + } + /* Great. Now we know how many to expect from each processor, and how many to send to each processor. So first we have to send the locations to the processors which hold our data. -- cgit v1.2.3