<commit_before>#include <mctop_crawler.h>
#include <mctop_mem.h>
#include <mctop_profiler.h>
#include <mctop.h>

const int test_num_threads = 2;
const int test_num_smt_threads = 2;
size_t test_num_reps = 10000;
const size_t test_num_smt_reps = 1e7;
const size_t test_num_dvfs_reps = 5e6;
const double test_smt_ratio = 0.75;
const double test_dvfs_ratio = 0.95;
uint test_dvfs = 0;
volatile int dvfs_up_hwc_ready = -1; /* which hw context is ready by the dvfs up thread */

size_t test_num_warmup_reps = 10000 >> 4;
size_t test_max_stdev = 7;
size_t test_max_stdev_max = 14;
size_t test_num_cache_lines = 1024;
size_t test_cdf_cluster_offset = 25;
int test_num_clusters_hint = 0;
cache_line_t* test_cache_line = NULL;

typedef enum
  {
    NONE,
    C_STRUCT,
    LAT_TABLE,
  } test_format_t;
typedef enum
  {
    AR_1D,
    AR_2D,
  } array_format_t;
test_format_t test_format = NONE;
int test_verbose = 0;
int test_num_hw_ctx;
ticks* lat_table = NULL;
ticks** mem_lat_table = NULL;
volatile int high_stdev_retry = 0;

int test_num_sockets = -1;	/* num nodes / sockets */

typedef enum 
  {
    NO_MEM,			/* no mem. lat measurements */
    ON_TIME,			/* mem. lat measurements in // with comm. latencies */
    ON_TOPO,			/* mem. lat measurements based on topology */
  } mctop_mem_type_t;
mctop_mem_type_t test_do_mem = ON_TOPO;
int test_mem_on_demand = 0;
const size_t test_mem_reps = 1e6;
const size_t test_mem_size = 128 * 1024 * 1024LL;
volatile uint64_t** node_mem;

const uint test_mem_bw_num_streams = 2;
const size_t test_mem_bw_size = 1024 * 1024 * 1024LL;
const uint test_mem_bw_num_reps = 4;
volatile uint32_t mem_bw_barrier = 0;
volatile double* mem_bw_gbps;
double** mem_bw_table;


void ll_random_create(volatile uint64_t* mem, const size_t size);
ticks ll_random_traverse(volatile uint64_t* list, const size_t reps);

static cache_line_t* cache_lines_create(const size_t size_bytes, const int on_node);
void cache_lines_destroy(cache_line_t* cl, const size_t size, const uint use_numa);
int lat_table_get_hwc_with_lat(ticks** lat_table, const size_t n, ticks target_lat, int* hwcs);
void print_lat_table(void* lat_table, const size_t n, const test_format_t test_format, array_format_t format);
ticks** lat_table_normalized_create(ticks* lat_table, const size_t n, cdf_cluster_t* cc);


UNUSED static uint64_t
fai_prof(cache_line_t* cl, const size_t reps, mctop_prof_t* profiler)
{
  volatile uint64_t c = 0;
  MCTOP_PROF_START(profiler, ticks_start);
  c = IAF_U64(cl->word);
  MCTOP_PROF_STOP(profiler, ticks_start, reps);
  return c;
}

UNUSED static uint64_t
cas_prof(cache_line_t* cl, const size_t reps, mctop_prof_t* profiler)
{
  volatile uint64_t c = 0;<commit_msg>256 MB for mem test<commit_after>#include <mctop_crawler.h>
#include <mctop_mem.h>
#include <mctop_profiler.h>
#include <mctop.h>

const int test_num_threads = 2;
const int test_num_smt_threads = 2;
size_t test_num_reps = 10000;
const size_t test_num_smt_reps = 1e7;
const size_t test_num_dvfs_reps = 5e6;
const double test_smt_ratio = 0.75;
const double test_dvfs_ratio = 0.95;
uint test_dvfs = 0;
volatile int dvfs_up_hwc_ready = -1; /* which hw context is ready by the dvfs up thread */

size_t test_num_warmup_reps = 10000 >> 4;
size_t test_max_stdev = 7;
size_t test_max_stdev_max = 14;
size_t test_num_cache_lines = 1024;
size_t test_cdf_cluster_offset = 25;
int test_num_clusters_hint = 0;
cache_line_t* test_cache_line = NULL;

typedef enum
  {
    NONE,
    C_STRUCT,
    LAT_TABLE,
  } test_format_t;
typedef enum
  {
    AR_1D,
    AR_2D,
  } array_format_t;
test_format_t test_format = NONE;
int test_verbose = 0;
int test_num_hw_ctx;
ticks* lat_table = NULL;
ticks** mem_lat_table = NULL;
volatile int high_stdev_retry = 0;

int test_num_sockets = -1;	/* num nodes / sockets */

typedef enum 
  {
    NO_MEM,			/* no mem. lat measurements */
    ON_TIME,			/* mem. lat measurements in // with comm. latencies */
    ON_TOPO,			/* mem. lat measurements based on topology */
  } mctop_mem_type_t;
mctop_mem_type_t test_do_mem = ON_TOPO;
int test_mem_on_demand = 0;
const size_t test_mem_reps = 1e6;
const size_t test_mem_size = 128 * 1024 * 1024LL;
volatile uint64_t** node_mem;

const uint test_mem_bw_num_streams = 2;
const size_t test_mem_bw_size = 256 * 1024 * 1024LL;
const uint test_mem_bw_num_reps = 4;
volatile uint32_t mem_bw_barrier = 0;
volatile double* mem_bw_gbps;
double** mem_bw_table;


void ll_random_create(volatile uint64_t* mem, const size_t size);
ticks ll_random_traverse(volatile uint64_t* list, const size_t reps);

static cache_line_t* cache_lines_create(const size_t size_bytes, const int on_node);
void cache_lines_destroy(cache_line_t* cl, const size_t size, const uint use_numa);
int lat_table_get_hwc_with_lat(ticks** lat_table, const size_t n, ticks target_lat, int* hwcs);
void print_lat_table(void* lat_table, const size_t n, const test_format_t test_format, array_format_t format);
ticks** lat_table_normalized_create(ticks* lat_table, const size_t n, cdf_cluster_t* cc);


UNUSED static uint64_t
fai_prof(cache_line_t* cl, const size_t reps, mctop_prof_t* profiler)
{
  volatile uint64_t c = 0;
  MCTOP_PROF_START(profiler, ticks_start);
  c = IAF_U64(cl->word);
  MCTOP_PROF_STOP(profiler, ticks_start, reps);
  return c;
}

UNUSED static uint64_t
cas_prof(cache_line_t* cl, const size_t reps, mctop_prof_t* profiler)
{
  volatile uint64_t c = 0;
{'fraction_non_alphanumeric': 0.08437093477048875, 'fraction_numerical': 0.03345103140680171, 'mean_word_length': 5.221965317919075, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, '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': '1617022', 'n_tokens_mistral': 2344, 'n_tokens_neox': 2151, 'n_words': 545}