Select Git revision
disk_io.cpp
disk_io.cpp 5.14 KiB
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <cstring>
#include <cell.hpp>
#include <cell_group.hpp>
#include <common_types.hpp>
#include <fvm_cell.hpp>
#include <communication/communicator.hpp>
#include <communication/global_policy.hpp>
#include <communication/export_manager.hpp>
using namespace nest::mc;
using global_policy = communication::global_policy;
using lowered_cell = nest::mc::fvm::fvm_cell<double, cell_local_size_type>;
using cell_group_type = cell_group<lowered_cell>;
using time_type = typename cell_group_type::time_type;
using spike_type = communication::exporter_spike_file<time_type,
global_policy>::spike_type;
int main(int argc, char** argv)
{
//Setup the possible mpi environment
nest::mc::communication::global_policy_guard global_guard(argc, argv);
// very simple command line parsing
if (argc < 3) {
std::cout << "disk_io <int nrspikes> <int nr_repeats> <file_per_rank (true|false)> [simple_output (false|true)]"
<< " Simple performance test runner for the exporter manager"
<< " It exports nrspikes nr_repeats using the export_manager and will produce"
<< " the total, mean and std of the time needed to perform the output to disk"
<< " <file_per_rank> true will produce a single file per mpi rank"
<< " <simple_output> true will produce a simplyfied comma seperated output for automatic parsing"
<< " The application can be started with mpi support and will produce output on a single rank";
std::cout << " if nrspikes is not a multiple of the nr of mpi rank, floor is take" << std::endl;
exit(1);
}
int nr_spikes = atoi(argv[1]);
if (nr_spikes == 0) {
std::cout << "disk_io <nrspikes>" << std::endl;
std::cout << " nrspikes should be a valid integer higher then zero" << std::endl;
exit(1);
}
int nr_repeats = atoi(argv[2]);
if (nr_repeats == 0) {
std::cout << "disk_io <nrspikes>" << std::endl;
std::cout << " nr_repeats should be a valid integer higher then zero" << std::endl;
exit(1);
}
bool file_per_rank = false;
std::string single(argv[3]);
if (single == std::string("true")) {
file_per_rank = true;
}
bool simple_stats = false;
if (argc == 5) {
std::string simple(argv[4]);
if (simple == std::string("true"))
{