source: trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_sort.c @ 140

Last change on this file since 140 was 140, checked in by kane, 13 years ago

yAjout du multi_cache : plusieurs processeur peuvent ce partager le même cache L1.
2 remarques, (1) deux nouveaux paramètres : nb_cpu, nb_cache. Pour avoir un cache dont le comportement est identique à la version d'avant, mettre ces paramètres à 1.
(2) le port d'interruption est maintenant un tableau dépendant du nombre de processeur.
Voir le fichier "platforms/caba-ring-ccxcachev4_memcachev4-mips32el/top.cpp" pour plus de détails.

--Cette ligne, et les suivantes ci-dessous, seront ignorées--

M platforms/tsarv4_dspin_generic_32/tsarv4_dspin_generic_32_top.cpp
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/segmentation.h
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/top.cpp
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/configuration/default.cfg
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/configuration/gen_config.sh
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/dhrystone/dhry21a.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/define.h
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/matrix_multiplication/matrix_multiplication.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/common/common.c
A platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/self_code_modifying
A platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/self_code_modifying/self_code_modifying.c
A platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/self_code_modifying/self_code_modifying.h
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.h
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_sort.c
A platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_self_code_modifying.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_matrix_multiplication.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/Makefile
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/Makefile
M platforms/tsarv4_vgmn_generic_32/tsarv4_vgmn_generic_32_top.cpp
M modules/vci_cc_xcache_wrapper_v4/caba/source/include/vci_cc_xcache_wrapper_v4.h
M modules/vci_cc_xcache_wrapper_v4/caba/source/src/vci_cc_xcache_wrapper_v4.cpp
M modules/vci_mem_cache_v4/caba/source/include/vci_mem_cache_v4.h
M modules/vci_mem_cache_v4/caba/source/include/mem_cache_directory_v4.h
M modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp

File size: 2.5 KB
Line 
1#include "benchmark.h"
2#include "system.h"
3#include "stdlib.h"
4#include "stdio.h"
5#include "stdint.h"
6#include "../sort/sort.h"
7#include "../common/common.h"
8
9static uint32_t sort_lock;
10
11int _benchmark_sort (sort_t sort_type,
12                     unsigned int size)
13{
14  printf(" * Size : %d\n",size);
15
16  unsigned int* SortArray;
17 
18  int cycle_begin;
19
20  int num_cpu=procnum();
21 
22  printf(" * Algo : %s\n",sort_str(sort_type));
23 
24  printf("   * Init...\n");
25 
26  lock_lock(&sort_lock);
27  SortArray = (unsigned int*) malloc(size*sizeof(unsigned int));
28  lock_unlock(&sort_lock);
29 
30  unsigned int seed = num_cpu;
31  int i;
32  for (i=0; i<size; ++i)
33    {
34      seed = seed * 1103515245 + 12345;
35      SortArray[i] = seed&0xff;
36    }
37  printf("   * Sort... \n");
38 
39  cycle_begin = cpu_cycles();
40  sort((unsigned int *) (SortArray), (unsigned int) size, sort_type);
41  int cycle_exec = cpu_cycles()-cycle_begin;
42 
43  printf("   * Executed in %d cycles\n",cycle_exec);
44 
45  int result = cycle_exec;
46 
47#if VERIFICATION_SORT     
48  printf("   * Verification... ");
49 
50  for (i = 1; i < size; i++)
51    {
52      /* printf("%d ",SortArray[i-1]); */
53     
54      if (SortArray[i] < SortArray[i-1])
55        {
56          printf("KO !!!\n");
57          EXIT(1);
58        }
59    }
60  printf("OK\n");
61#endif
62 
63  free (SortArray);
64
65  return result;
66}
67
68int _benchmark_sort_all (unsigned int size)
69{
70  printf("\n");
71  printf("================================\n");
72  printf("Benchmark Sort (ALL)\n");
73  printf("================================\n");
74  printf("\n");
75
76  int result = 0;
77  int num_cpu=procnum();
78  sort_t _sort_type;
79  const sort_t nb_sort_type = 4;
80 
81  for (_sort_type=0; _sort_type < nb_sort_type; _sort_type++)
82    result += _benchmark_sort((_sort_type+num_cpu)%nb_sort_type,size);
83 
84  return result;
85}
86
87int _benchmark_sort_one (sort_t sort_type,
88                         unsigned int size)
89{
90  printf("\n");
91  printf("================================\n");
92  printf("Benchmark Sort\n");
93  printf("================================\n");
94  printf("\n");
95
96  return _benchmark_sort(sort_type,size);
97}
98
99int benchmark_sort_all       (void) { return _benchmark_sort_all(SORT_ALL_SIZE); }
100int benchmark_sort_bubble    (void) { return _benchmark_sort_one(SORT_BUBBLE   ,SORT_BUBBLE_SIZE   ); }
101int benchmark_sort_insertion (void) { return _benchmark_sort_one(SORT_INSERTION,SORT_INSERTION_SIZE); }
102int benchmark_sort_selection (void) { return _benchmark_sort_one(SORT_SELECTION,SORT_SELECTION_SIZE); }
103int benchmark_sort_shell     (void) { return _benchmark_sort_one(SORT_SHELL    ,SORT_SHELL_SIZE    ); }
Note: See TracBrowser for help on using the repository browser.