<commit_before>/*
 * Copyright 2013 University of Chicago and Argonne National Laboratory
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */


/*
 * messaging.h
 *
 *  Created on: Jun 7, 2012
 *      Author: wozniak
 *
 *  XLB messaging conventions
 */

#ifndef MESSAGING_H
#define MESSAGING_H

#include "adlb.h"
#include "checks.h"
#include "debug.h"
#include "workqueue.h"

/*
 * Pragma to disable padding in structures:
 * a) to reduce message sizes
 * b) to avoid confusing tools like valgrind that detect uninitialized bytes
 *    being sent.
 */
#pragma pack(push, 1)

/**
   Initialize the messaging functionality
 */
void xlb_msg_init(void);

/**
   Finalize the messaging functionality
 */
void xlb_msg_finalize(void);

#ifndef NDEBUG

/**
   Set a string name for debugging MPI message tags
 */
void xlb_add_tag_name(int tag, char* name);

/**
   Lookup string name for debugging MPI message tags
 */
char* xlb_get_tag_name(int tag);

#else
#define xlb_add_tag_name(tag,name) // noop
#define xlb_get_tag_name(tag)      // noop
#endif

/*
   All of these client/handler functions (adlb.c,handlers.c,etc.)
   use messaging the same way:
   - They use communicator adlb_comm
   - They use the stack-allocated status or request object
   - They check the return code rc with MPI_CHECK() to return errors.
   Thus, we use these macros to ease reading the message protocols<commit_msg>Keep tags around in opt mode for performance counters<commit_after>/*
 * Copyright 2013 University of Chicago and Argonne National Laboratory
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */


/*
 * messaging.h
 *
 *  Created on: Jun 7, 2012
 *      Author: wozniak
 *
 *  XLB messaging conventions
 */

#ifndef MESSAGING_H
#define MESSAGING_H

#include "adlb.h"
#include "checks.h"
#include "debug.h"
#include "workqueue.h"

/*
 * Pragma to disable padding in structures:
 * a) to reduce message sizes
 * b) to avoid confusing tools like valgrind that detect uninitialized bytes
 *    being sent.
 */
#pragma pack(push, 1)

/**
   Initialize the messaging functionality
 */
void xlb_msg_init(void);

/**
   Finalize the messaging functionality
 */
void xlb_msg_finalize(void);

/**
   Set a string name for debugging MPI message tags
 */
void xlb_add_tag_name(int tag, char* name);

/**
   Lookup string name for debugging MPI message tags
 */
char* xlb_get_tag_name(int tag);

/*
   All of these client/handler functions (adlb.c,handlers.c,etc.)
   use messaging the same way:
   - They use communicator adlb_comm
   - They use the stack-allocated status or request object
   - They check the return code rc with MPI_CHECK() to return errors.
   Thus, we use these macros to ease reading the message protocols
{'fraction_non_alphanumeric': 0.08167651800107469, 'fraction_numerical': 0.007522837184309511, 'mean_word_length': 3.65375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3996132', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1066, 'n_words': 457}