1% :-include("../data/data_sbrinz1.txt"). 2% :-include("../data/data_nos4.txt"). 3 4:-include("globalthreadalloc.pl"). 5 6 7%% asq: If we know the data store size, what should we do? 8%% Two options: 9%% 1.: Create NUMANode-sized partitions and place multiple partitions 10%% on same nodes 11%% 2.: Ignore and just return the same number of partitions as there are NUMA nodes 12 13 14partitions_get_optimal_number_of_partitions(_, _, NrPartitions, Partitions) :- 15 task_register_function(987654321, 987654321, 0), 16 task_config(987654321, 987654321, 0, 0, running), 17 haupt(Plan), 18 !, 19 allocation_output(Plan, AllocatedCores), 20 member(task(taskname(987654321,987654321), CoreList), AllocatedCores), 21 ( foreach(Core, CoreList), 22 foreach(partition(RL, RH, MaxSize, Core), Partitions) 23 do 24 cpu_affinity(Core, _, AffinityDomain), 25 findall(L, memory_affinity(L, _, AffinityDomain), AfL), 26 findall(H, (memory_affinity(L1, S, AffinityDomain), H is L1 + S), AfH), 27 findall(Sz, memory_affinity(_, Sz, AffinityDomain), Sizes), 28 eclipse_language:min(AfL, RL), 29 eclipse_language:max(AfH, RH), 30 sum(Sizes, MaxSize) 31 ), 32 length(Partitions, NrPartitions). 33 34 35 36partitions_get_optimal_resource_allocation(NrPartitions, PartitionSize, independent, Partitions):- 37 task_register_function(987654321, 987654321, 0), 38 task_config(987654321, 987654321, 0, 0, running), 39 task_set_max_parallel(987654321, 987654321, NrPartitions), 40 task_set_working_set_size(987654321, 987654321, PartitionSize), 41 haupt(Plan), 42 !, 43 allocation_output(Plan, AllocatedCores), 44 member(task(taskname(987654321,987654321), CoreList), AllocatedCores), 45 ( foreach(Core, CoreList), 46 foreach(partition(RL, RH, MaxSize, Core), Partitions) 47 do 48 cpu_affinity(Core, _, AffinityDomain), 49 findall(L, memory_affinity(L, _, AffinityDomain), AfL), 50 findall(H, (memory_affinity(L1, S, AffinityDomain), H is L1 + S), AfH), 51 findall(Sz, memory_affinity(_, Sz, AffinityDomain), Sizes), 52 eclipse_language:min(AfL, RL), 53 eclipse_language:max(AfH, RH), 54 sum(Sizes, MaxSize) 55 ). 56 57 58partitions_cleanup :- 59 task_remove_client(987654321). 60 61 62 63multisplice([[]|_],[]). 64multisplice([H|T],L) :- 65 [H2|T2] = H, 66 append(T, [T2], TN), 67 multisplice(TN,M), 68 append([H2],M,L). 69 70 71 72