commit/enzo-dev: 2 new changesets

2 views
Skip to first unread message

commits...@bitbucket.org

unread,
Jan 16, 2019, 12:24:54 PM1/16/19
to enzo...@googlegroups.com
2 new commits in enzo-dev:

https://bitbucket.org/enzo/enzo-dev/commits/98e0d76385c2/
Changeset: 98e0d76385c2
Branch: week-of-code
User: jwise77
Date: 2018-12-18 20:13:56+00:00
Summary: Updating the MPI error handler to MPI-2+ standards. Compatible with OpenMPI 4+ now
Affected #: 5 files

diff -r e932eeb11b87 -r 98e0d76385c2 src/enzo/CommunicationInitialize.C
--- a/src/enzo/CommunicationInitialize.C
+++ b/src/enzo/CommunicationInitialize.C
@@ -34,6 +34,11 @@
/* function prototypes */
void my_exit(int exit_status);

+#ifdef USE_MPI
+void CommunicationErrorHandlerFn(MPI_Comm *comm, MPI_Arg *err, ...);
+#endif
+
+
int CommunicationInitialize(Eint32 *argc, char **argv[])
{

@@ -43,10 +48,13 @@

MPI_Arg mpi_rank;
MPI_Arg mpi_size;
+ MPI_Comm comm = MPI_COMM_WORLD;

MPI_Init(argc, argv);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_create_errhandler(CommunicationErrorHandlerFn, &CommunicationErrorHandler);
+ MPI_Comm_set_errhandler(comm, CommunicationErrorHandler);

MyProcessorNumber = mpi_rank;
NumberOfProcessors = mpi_size;
@@ -75,6 +83,7 @@
{

#ifdef USE_MPI
+ MPI_Errhandler_free(&CommunicationErrorHandler);
MPI_Finalize();
#endif /* USE_MPI */


diff -r e932eeb11b87 -r 98e0d76385c2 src/enzo/CommunicationNonblockingRoutines.C
--- a/src/enzo/CommunicationNonblockingRoutines.C
+++ b/src/enzo/CommunicationNonblockingRoutines.C
@@ -33,8 +33,6 @@
int Tag, MPI_Comm CommWorld, int BufferSize);
int CommunicationFindOpenRequest(MPI_Request *requests, Eint32 last_free,
Eint32 nrequests, Eint32 index, Eint32 &max_index);
-void CommunicationCheckForErrors(int NumberOfStatuses, MPI_Status *statuses,
- char *msg=NULL);
int KeepTransportingSend(int keep_transporting);
int KeepTransportingCheck(char* &kt_global, int &keep_transporting);
int InitializePhotonMessages(void);
@@ -178,26 +176,16 @@

/* Wait until all of the requests are cancelled */

- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
-
#ifdef NONBLOCKING_RT
MPI_Waitall(PhotonMessageMaxIndex, PhotonMessageRequest,
PH_ListOfStatuses);
- CommunicationCheckForErrors(PhotonMessageMaxIndex, PH_ListOfStatuses,
- "Waitall photon message cancels");
MPI_Waitall(KeepTransMessageMaxIndex, KeepTransMessageRequest,
PH_ListOfStatuses);
- CommunicationCheckForErrors(KeepTransMessageMaxIndex, PH_ListOfStatuses,
- "Waitall KT message cancels");
#endif /* NONBLOCKING_RT */

MPI_Waitall(PH_CommunicationReceiveMaxIndex,
PH_CommunicationReceiveMPI_Request,
PH_ListOfStatuses);
- CommunicationCheckForErrors(PH_CommunicationReceiveMaxIndex, PH_ListOfStatuses,
- "Waitall KT message cancels");
-
- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);

/* Cancel all buffered header sends */

@@ -331,7 +319,6 @@
/* Receive MPI messages that contain how many messages with the
actual photon data that we'll be receiving from each process. */

- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
if (local_transport)
MPI_Testsome(PhotonMessageMaxIndex, PhotonMessageRequest, &NumberOfReceives,
PH_ListOfIndices, PH_ListOfStatuses);
@@ -340,10 +327,6 @@
PH_ListOfStatuses);
NumberOfReceives = PhotonMessageMaxIndex;
}
- if (NumberOfReceives > 0)
- CommunicationCheckForErrors(PhotonMessageMaxIndex, PH_ListOfStatuses,
- "Testsome InitializePhotonReceive");
- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);

if (DEBUG && NumberOfReceives > 0)
printf("P%"ISYM": Received %"ISYM" header messages, Index/MaxIndex = %"ISYM"/%"ISYM".\n",
@@ -384,8 +367,6 @@
MPI_STATUS_IGNORE);

if (MessageReceived) {
-// CommunicationCheckForErrors(1, &status,
-// "InitializePhotonReceive immediate");
PostPhotonReceives(PhotonMessageIndex, RecvProc, max_size, MPI_PhotonType);
}

@@ -432,13 +413,8 @@
// printf("P%"ISYM": keep_transporting(before) = %"ISYM", KTMaxIndex = %"ISYM"\n",
// MyProcessorNumber, keep_transporting, KeepTransMessageMaxIndex);

- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
MPI_Testsome(KeepTransMessageMaxIndex, KeepTransMessageRequest,
&NumberOfReceives, PH_ListOfIndices, PH_ListOfStatuses);
- if (NumberOfReceives > 0)
- CommunicationCheckForErrors(KeepTransMessageMaxIndex, PH_ListOfStatuses,
- "KTCheck Testsome");
- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);

if (DEBUG && NumberOfReceives > 0)
printf("P%"ISYM": Received %"ISYM" KT messages, Index/MaxIndex = %"ISYM"/%"ISYM".\n",
@@ -490,8 +466,6 @@
MPI_Test(KeepTransMessageRequest + KeepTransMessageIndex,
&MessageReceived, MPI_STATUS_IGNORE);
if (MessageReceived) {
-// CommunicationCheckForErrors(1, &status,
-// "KT immediate");
if (PingRequired) {
AcceptMessage =
(KeepTransMessageBuffer[KeepTransMessageIndex] == RECV_DATA);
@@ -563,29 +537,18 @@
/**********************************************************************/

#ifdef USE_MPI
-void CommunicationCheckForErrors(int NumberOfStatuses, MPI_Status *statuses,
- char *msg)
+void CommunicationErrorHandlerFn(MPI_Comm *comm, MPI_Arg *err, ...)
{
- int i;
char error_string[1024];
- MPI_Arg length, error_class, datasize;
- for (i = 0; i < NumberOfStatuses; i++)
- if (statuses[i].MPI_ERROR != 0) {
- MPI_Get_count(statuses+i, MPI_BYTE, &datasize);
- fprintf(stderr, "MPI Error %"ISYM" processor %"ISYM"\n",
- statuses[i].MPI_ERROR, MyProcessorNumber);
- fprintf(stderr, "\t MPI_TAG = %"ISYM", MPI_SOURCE = %"ISYM", datasize = %"ISYM" bytes\n",
- statuses[i].MPI_TAG, statuses[i].MPI_SOURCE, datasize);
- if (msg != NULL)
- fprintf(stderr, "P%"ISYM": error occurred at %s\n", MyProcessorNumber, msg);
- MPI_Error_class(statuses[i].MPI_ERROR, &error_class);
+ MPI_Arg length, error_class;
+ if (*err != MPI_ERR_OTHER) {
+ MPI_Error_class(*err, &error_class);
MPI_Error_string(error_class, error_string, &length);
fprintf(stderr, "P%"ISYM": %s\n", MyProcessorNumber, error_string);
- MPI_Error_string(statuses[i].MPI_ERROR, error_string, &length);
+ MPI_Error_string(*err, error_string, &length);
fprintf(stderr, "P%"ISYM": %s\n", MyProcessorNumber, error_string);
- ENZO_FAIL("MPI communication error!");
-
- } // ENDIF MPI_ERROR
+ ENZO_FAIL("MPI communication error.");
+ } // ENDIF MPI_ERROR
return;
}
#endif /* USE_MPI */

diff -r e932eeb11b87 -r 98e0d76385c2 src/enzo/CommunicationReceiverPhotons.C
--- a/src/enzo/CommunicationReceiverPhotons.C
+++ b/src/enzo/CommunicationReceiverPhotons.C
@@ -33,8 +33,6 @@
#ifdef USE_MPI
static Eint32 PH_ListOfIndices[MAX_PH_RECEIVE_BUFFERS];
static MPI_Status PH_ListOfStatuses[MAX_PH_RECEIVE_BUFFERS];
-void CommunicationCheckForErrors(int NumberOfStatuses, MPI_Status *statuses,
- char *msg=NULL);
int CommunicationFindOpenRequest(MPI_Request *requests, Eint32 last_free,
Eint32 nrequests, Eint32 index,
Eint32 &max_index);
@@ -93,7 +91,6 @@
#endif

NumberOfCompletedRequests = 0;
- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);

/* Wait for >1 receives */

@@ -114,11 +111,6 @@
fflush(stdout);
#endif

- if (NumberOfCompletedRequests > 0)
- CommunicationCheckForErrors(TotalReceives, PH_ListOfStatuses,
- "CommunicationReceiverPhotons");
- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);
-
/* Get grid lists */

#ifdef NONBLOCKING_RT

diff -r e932eeb11b87 -r 98e0d76385c2 src/enzo/CommunicationTranspose.C
--- a/src/enzo/CommunicationTranspose.C
+++ b/src/enzo/CommunicationTranspose.C
@@ -803,10 +803,6 @@
MPI_Arg RecvCount;
MPI_Arg Source;
MPI_Arg Dest;
- MPI_Arg error_code;
- char error_string[1024];
- MPI_Arg length_of_error_string, error_class;
- MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);

#ifdef DEBUG_NONBLOCKCT
fprintf(stderr, "CT(%"ISYM"): start From=%"ISYM" To=%"ISYM"\n",
@@ -1045,25 +1041,6 @@
CompletedRequests, NumberOfRequests);
#endif

- /* Check for any errors */
-
-#ifdef UNUSED
- for (i = 0; i < NumberOfRequests; i++) {
- index = ListOfIndices[i];
- if (ListOfStatuses[index].MPI_ERROR != 0) {
- fprintf(stderr, "CommunicationTranspose: MPI Error on request %d, "
- "n = %d, error = %d\n", i, n, ListOfStatuses[i].MPI_ERROR);
- MPI_Error_class(ListOfStatuses[index].MPI_ERROR, &error_class);
- MPI_Error_string(error_class, error_string, &length_of_error_string);
- fprintf(stderr, "P%d: %s\n", MyProcessorNumber, error_string);
- MPI_Error_string(ListOfStatuses[index].MPI_ERROR, error_string,
- &length_of_error_string);
- fprintf(stderr, "P%d: %s\n", MyProcessorNumber, error_string);
- ENZO_FAIL("MPI Error in CommunicationTranspose!\n");
- }
- }
-#endif
-
} // ENDIF n > 0

for (request = 0; request < NumberOfRequests; request++) {

diff -r e932eeb11b87 -r 98e0d76385c2 src/enzo/communication.h
--- a/src/enzo/communication.h
+++ b/src/enzo/communication.h
@@ -98,5 +98,6 @@
EXTERN int CommunicationReceiveDependsOn[MAX_RECEIVE_BUFFERS];
EXTERN FLOAT CommunicationReceiveArgument[MAX_DIMENSION][MAX_RECEIVE_BUFFERS];
EXTERN int CommunicationReceiveArgumentInt[MAX_DIMENSION][MAX_RECEIVE_BUFFERS];
+EXTERN MPI_Errhandler CommunicationErrorHandler;

#endif /* USE_MPI */


https://bitbucket.org/enzo/enzo-dev/commits/603a8a701fe4/
Changeset: 603a8a701fe4
Branch: week-of-code
User: jwise77
Date: 2019-01-02 20:39:07+00:00
Summary: Moving new MPI error handler function into CommunicationInitialize
Affected #: 2 files

diff -r 98e0d76385c2 -r 603a8a701fe4 src/enzo/CommunicationInitialize.C
--- a/src/enzo/CommunicationInitialize.C
+++ b/src/enzo/CommunicationInitialize.C
@@ -76,8 +76,22 @@
return SUCCESS;
}

-
-
+#ifdef USE_MPI
+void CommunicationErrorHandlerFn(MPI_Comm *comm, MPI_Arg *err, ...)
+{
+ char error_string[1024];
+ MPI_Arg length, error_class;
+ if (*err != MPI_ERR_OTHER) {
+ MPI_Error_class(*err, &error_class);
+ MPI_Error_string(error_class, error_string, &length);
+ fprintf(stderr, "P%"ISYM": %s\n", MyProcessorNumber, error_string);
+ MPI_Error_string(*err, error_string, &length);
+ fprintf(stderr, "P%"ISYM": %s\n", MyProcessorNumber, error_string);
+ ENZO_FAIL("MPI communication error.");
+ } // ENDIF MPI_ERROR
+ return;
+}
+#endif /* USE_MPI */

int CommunicationFinalize()
{

diff -r 98e0d76385c2 -r 603a8a701fe4 src/enzo/CommunicationNonblockingRoutines.C
--- a/src/enzo/CommunicationNonblockingRoutines.C
+++ b/src/enzo/CommunicationNonblockingRoutines.C
@@ -533,22 +533,3 @@
#endif /* USE_MPI */
return SUCCESS;
}
-
-/**********************************************************************/
-
-#ifdef USE_MPI
-void CommunicationErrorHandlerFn(MPI_Comm *comm, MPI_Arg *err, ...)
-{
- char error_string[1024];
- MPI_Arg length, error_class;
- if (*err != MPI_ERR_OTHER) {
- MPI_Error_class(*err, &error_class);
- MPI_Error_string(error_class, error_string, &length);
- fprintf(stderr, "P%"ISYM": %s\n", MyProcessorNumber, error_string);
- MPI_Error_string(*err, error_string, &length);
- fprintf(stderr, "P%"ISYM": %s\n", MyProcessorNumber, error_string);
- ENZO_FAIL("MPI communication error.");
- } // ENDIF MPI_ERROR
- return;
-}
-#endif /* USE_MPI */

Repository URL: https://bitbucket.org/enzo/enzo-dev/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
Reply all
Reply to author
Forward
0 new messages