-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalg_random.cpp
82 lines (67 loc) · 2.76 KB
/
alg_random.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "explorer.h"
#include "common.h"
//********************************************************************
// N Random explorations of configuration space
//*******************************************************************
void Explorer::start_RAND(int n)
{
current_algo = "RAND";
vector<Configuration> random_space;
int valid = 0;
reset_sim_counter();
Exploration_stats stats;
int my_id = get_mpi_rank();
string header = "["+Options.benchmark+"_"+current_algo+"] ";
string filename = Options.benchmark+"_RAND_"+current_space;
string logfile = get_base_dir()+string(EE_LOG_PATH);
string message = header+"Building random space for " + to_string(n) + " simulations...";
write_to_log(my_id,logfile,message);
for(int i=0;i<n;i++)
{
processor.num_clusters.set_random();
processor.integer_units.set_random();
processor.float_units.set_random();
processor.branch_units.set_random();
processor.memory_units.set_random();
processor.gpr_static_size.set_random();
processor.fpr_static_size.set_random();
processor.pr_static_size.set_random();
processor.cr_static_size.set_random();
processor.btr_static_size.set_random();
mem_hierarchy.L1D.size.set_random();
mem_hierarchy.L1D.block_size.set_random();
mem_hierarchy.L1D.associativity.set_random();
mem_hierarchy.L1I.size.set_random();
mem_hierarchy.L1I.block_size.set_random();
mem_hierarchy.L1I.associativity.set_random();
mem_hierarchy.L2U.size.set_random();
mem_hierarchy.L2U.block_size.set_random();
mem_hierarchy.L2U.associativity.set_random();
compiler.tcc_region.set_random(); //db
compiler.max_unroll_allowed.set_random(); //db
compiler.regroup_only.set_random(); //db
compiler.do_classic_opti.set_random(); //db
compiler.do_prepass_scalar_scheduling.set_random(); //db
compiler.do_postpass_scalar_scheduling.set_random(); //db
compiler.do_modulo_scheduling.set_random(); //db
compiler.memvr_profiled.set_random(); //db
Configuration temp_conf = create_configuration(processor,mem_hierarchy,compiler);
if (temp_conf.is_feasible())
{
valid++;
random_space.push_back(temp_conf);
}
}
stats.space_size = get_space_size();
stats.start_time = time(NULL);
message = header+ "Valid configurations:" + to_string(valid) + " of "+to_string(n)+" requested";
write_to_log(my_id,logfile,message);
vector<Simulation> rand_sims = simulate_space(random_space);
vector<Simulation> pareto_set = get_pareto(rand_sims);
save_simulations(rand_sims,filename+".exp");
save_simulations(pareto_set,filename+".pareto.exp");
stats.end_time = time(NULL);
stats.n_sim = get_sim_counter();
save_stats(stats,filename+".stat");
write_to_log(my_id,logfile,"End of RANDOM simulation");
}