<commit_before>/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
 * SscReaderNaive.cpp
 *
 *  Created on: Mar 7, 2022
 *      Author: <NAME>
 */

#include "SscReaderNaive.tcc"

namespace adios2
{
namespace core
{
namespace engine
{
namespace ssc
{

SscReaderNaive::SscReaderNaive(IO &io, const std::string &name, const Mode mode,
                               MPI_Comm comm)
: SscReaderBase(io, name, mode, comm)
{
}

StepStatus SscReaderNaive::BeginStep(const StepMode stepMode,
                                     const float timeoutSeconds,
                                     const bool readerLocked)
{

    m_Buffer.clear();
    m_BlockMap.clear();

    ++m_CurrentStep;

    size_t globalSize;

    if (m_ReaderRank == 0)
    {
        MPI_Recv(&globalSize, 1, MPI_UNSIGNED_LONG_LONG,
                 m_WriterMasterStreamRank, 0, m_StreamComm, MPI_STATUS_IGNORE);
        m_Buffer.resize(globalSize);
        MPI_Recv(m_Buffer.data(), globalSize, MPI_UNSIGNED_LONG_LONG,
                 m_WriterMasterStreamRank, 0, m_StreamComm, MPI_STATUS_IGNORE);
    }

    MPI_Bcast(&globalSize, 1, MPI_UNSIGNED_LONG_LONG, 0, m_ReaderComm);
    if (m_ReaderRank != 0)
    {
        m_Buffer.resize(globalSize);<commit_msg>fixed a bug in ssc which blocks MPI communications<commit_after>/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
 * SscReaderNaive.cpp
 *
 *  Created on: Mar 7, 2022
 *      Author: <NAME>
 */

#include "SscReaderNaive.tcc"

namespace adios2
{
namespace core
{
namespace engine
{
namespace ssc
{

SscReaderNaive::SscReaderNaive(IO &io, const std::string &name, const Mode mode,
                               MPI_Comm comm)
: SscReaderBase(io, name, mode, comm)
{
}

StepStatus SscReaderNaive::BeginStep(const StepMode stepMode,
                                     const float timeoutSeconds,
                                     const bool readerLocked)
{

    m_Buffer.clear();
    m_BlockMap.clear();

    ++m_CurrentStep;

    size_t globalSize;

    if (m_ReaderRank == 0)
    {
        MPI_Recv(&globalSize, 1, MPI_UNSIGNED_LONG_LONG,
                 m_WriterMasterStreamRank, 0, m_StreamComm, MPI_STATUS_IGNORE);
        m_Buffer.resize(globalSize);
        MPI_Recv(m_Buffer.data(), globalSize, MPI_CHAR,
                 m_WriterMasterStreamRank, 0, m_StreamComm, MPI_STATUS_IGNORE);
    }

    MPI_Bcast(&globalSize, 1, MPI_UNSIGNED_LONG_LONG, 0, m_ReaderComm);
    if (m_ReaderRank != 0)
    {
        m_Buffer.resize(globalSize);
{'fraction_non_alphanumeric': 0.09247229652273596, 'fraction_numerical': 0.01146350783339702, 'mean_word_length': 2.6110344827586207, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6071272', 'n_tokens_mistral': 893, 'n_tokens_neox': 837, 'n_words': 185}