<commit_before>/*
 * pv.cpp
 *
 */

#include "checkpointing/CheckpointEntryWeightPvp.hpp"
#include "columns/HyPerCol.hpp"
#include "columns/PV_Init.hpp"
#include "connections/HyPerConn.hpp"
#include <cstdlib>
#include <memory>
#include <vector>

int main(int argc, char *argv[]) {
   std::string const checkpointDirectory("checkpoint");
   std::string const paramsFile("input/CheckpointWeightTest.params");
   std::string const connectionName("InputToOutput");

   // Delete checkpointDirectory, if present, to start fresh
   std::string rmrfcommand("rm -rf ");
   rmrfcommand.append(checkpointDirectory);
   system(rmrfcommand.c_str());

   // Create and run the column, and then retrieve the connection
   PV::PV_Init pv_initObj{&argc, &argv, false /*do not allow unrecognized arguments*/};
   PV::HyPerCol *hc = createHyPerCol(&pv_initObj);
   pvErrorIf(hc == nullptr, "Failed to create HyPerCol.\n");
   hc->run();
   PV::HyPerConn *conn = dynamic_cast<PV::HyPerConn *>(hc->getConnFromName(connectionName.c_str()));
   pvErrorIf(
         conn == nullptr, "No connection named % in %s\n", connectionName.c_str(), hc->getName());

   int const numArbors      = conn->numberOfAxonalArborLists();
   int const patchDataSize  = conn->getNumWeightPatches();
   int const weightDataSize = conn->getNumDataPatches();
   int const nxp            = conn->xPatchSize();
   int const nyp            = conn->yPatchSize();
   int const nfp            = conn->fPatchSize();

   // Create CheckpointEntryWeightPvp object.
   // We will copy the patch and weight data to external buffers, create the CheckpointEntry,
   // write the checkpoint, then overwrite the data, and finally read the checkpoint back
   // and compare with the original.
<commit_msg>Update to CheckpointWeightTest:<commit_after>/*
 * pv.cpp
 *
 */

#include "checkpointing/CheckpointEntryWeightPvp.hpp"
#include "columns/HyPerCol.hpp"
#include "columns/PV_Init.hpp"
#include "connections/HyPerConn.hpp"
#include <cstdlib>
#include <memory>
#include <vector>

int main(int argc, char *argv[]) {
   std::string const checkpointDirectory("checkpoint");
   std::string const paramsFile("input/CheckpointWeightTest.params");
   std::string const connectionName("InputToOutput");

   PV::PV_Init pv_initObj{&argc, &argv, false /*do not allow unrecognized arguments*/};

   // Delete checkpointDirectory, if present, to start fresh
   if (pv_initObj.getCommunicator()->commRank()==0) {
      std::string rmrfcommand("rm -rf ");
      rmrfcommand.append(checkpointDirectory);
      int status = system(rmrfcommand.c_str());
      pvErrorIf(status, "%s failed to delete %s\n", argv[0], checkpointDirectory.c_str());
   }

   // Create and run the column, and then retrieve the connection
   PV::HyPerCol *hc = createHyPerCol(&pv_initObj);
   pvErrorIf(hc == nullptr, "Failed to create HyPerCol.\n");
   hc->run();
   PV::HyPerConn *conn = dynamic_cast<PV::HyPerConn *>(hc->getConnFromName(connectionName.c_str()));
   pvErrorIf(
         conn == nullptr, "No connection named % in %s\n", connectionName.c_str(), hc->getName());

   int const numArbors      = conn->numberOfAxonalArborLists();
   int const patchDataSize  = conn->getNumWeightPatches();
   int const weightDataSize = conn->getNumDataPatches();
   int const nxp            = conn->xPatchSize();
   int const nyp            = conn->yPatchSize();
   int const nfp            = conn->fPatchSize();

   // Create CheckpointEntryWeightPvp object.
   // We will copy the patch and weight data to external buffers, create the CheckpointEntry,
   // write the checkpoint, then overwrite the data, and finally read the checkpoint back
   // and compare with the original.

{'fraction_non_alphanumeric': 0.1274802935580321, 'fraction_numerical': 0.0005436259853220984, 'mean_word_length': 4.068870523415978, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 30, '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': '6983793', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1089, 'n_words': 302}