<commit_before>/* See LICENSE in top directory.
 * 
 * Author(s):
 *
 * <NAME> 
 * Leadership Computing Facility 
 * Argonne National Laboratory
 * <EMAIL>
 */

#ifndef INCLUDE_VERBOSE_ABORT_H
#define INCLUDE_VERBOSE_ABORT_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <mpi.h>

#ifdef CHECK_MPI_RETURN_CODES
/* this is only valid if MPI_ERRORS_RETURN */
static void MPIX_Verbose_abort(int errorcode)
{
    /* We do not check error codes here
     * because if MPI is in a really sorry state,
     * all of them might fail. */

    int rank;
    MPI_Comm_rank(MPI_COMM_RANK, &rank);

    int errorclass;
    int resultlen;
    char errorstring[MPI_MAX_ERROR_STRING];

    memset(errorstring, 0, MPI_MAX_ERROR_STRING); /* optional */

    MPI_Error_class(errorcode, &errorclass);
    fprintf(stderr, "%d: MPI failed (%d: %s) \n", rank, errorclass, errorstring);

    MPI_Error_string(errorcode, char *string, int *resultlen)
    fprintf(stderr, "%d: MPI failed (%d: %s) \n", rank, errorclass, errorstring);

    fflush(stderr); /* almost certainly redundant with the following... */
    MPI_Abort(MPI_COMM_WORLD, errorclass);
    
    return;
}
#define MPI_ASSERT(rc)  \
        ((void) ((rc==MPI_SUCCESS) ? 0 : MPIX_Verbose_abort(rc) ))
#else
/* Assume MPI_ERRORS_ARE_FATAL, which is the default behavior. */
/* Define MPI_ASSERT to (void)0 in case someone foolishly tries
 * to check its return value. */
#define MPI_ASSERT(rc) (rc)
#endif

#endif // INCLUDE_VERBOSE_ABORT_H<commit_msg>cleanup in mpi assert code that is not used anyways<commit_after>/* See LICENSE in top directory.
 * 
 * Author(s):
 *
 * <NAME> 
 * Leadership Computing Facility 
 * Argonne National Laboratory
 * <EMAIL>
 */

#ifndef INCLUDE_VERBOSE_ABORT_H
#define INCLUDE_VERBOSE_ABORT_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <mpi.h>

#ifdef CHECK_MPI_RETURN_CODES
/* this is only valid if MPI_ERRORS_RETURN */
static void MPIX_Verbose_abort(int errorcode)
{
    /* We do not check error codes here
     * because if MPI is in a really sorry state,
     * all of them might fail. */

    int rank;
    MPI_Comm_rank(MPI_COMM_RANK, &rank);

    char errorstring[MPI_MAX_ERROR_STRING];
    memset(errorstring, 0, MPI_MAX_ERROR_STRING); /* optional */

    int errorclass;
    MPI_Error_class(errorcode, &errorclass);

    int resultlen;
    MPI_Error_string(errorcode, errorstring, &resultlen);

    fprintf(stderr, "%d: MPI failed (%d: %s) \n", rank, errorclass, errorstring);
    fflush(stderr); /* almost certainly redundant with the following... */

    MPI_Abort(MPI_COMM_WORLD, errorclass);
    
    return;
}
#define MPI_ASSERT(rc)  \
        ((void) ((rc==MPI_SUCCESS) ? 0 : MPIX_Verbose_abort(rc) ))
#else
/* Assume MPI_ERRORS_ARE_FATAL, which is the default behavior. */
/* Define MPI_ASSERT to (void)0 in case someone foolishly tries
 * to check its return value. */
#define MPI_ASSERT(rc) (rc)
#endif

#endif // INCLUDE_VERBOSE_ABORT_H
{'fraction_non_alphanumeric': 0.11458333333333333, 'fraction_numerical': 0.0020161290322580645, 'mean_word_length': 3.904448105436573, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5299883', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1030, 'n_words': 286}