apps.c 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180
  1. #include "apps.h"
  2. #include "scc_signals.h"
  3. #include "libfunctions.h"
  4. #include "my_rtrm.h"
  5. #define SWAP(a,b) {float tmp; tmp=a; a=b; b=tmp;}
  6. #define FFT_MAX 136192
  7. #define PAGE_SIZE 4096
  8. /*
  9. static float input_vector[25][10] = {
  10. {-0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119},
  11. {-0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467},
  12. {-0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565},
  13. {-0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533},
  14. {-0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941},
  15. {-1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784},
  16. {0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575},
  17. {0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371},
  18. {1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241},
  19. {1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752},
  20. {-0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115},
  21. {-0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876},
  22. {-0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559},
  23. {-0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523},
  24. {1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364},
  25. {-0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320},
  26. {3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579},
  27. {-0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210},
  28. {1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734},
  29. {-0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990},
  30. {-0.632187, -0.629597, -0.560808, -0.439143, -0.550906, -3.344673, -1.389866, 0.268649, 0.664319, 1.150327},
  31. {-0.205756, -0.210472, -0.151426, -0.121347, 0.196067, -3.136218, -2.621049, -0.026517, 0.358534, 0.714117},
  32. {-0.418011, -0.424854, -0.461205, -0.428858, -0.801747, 1.933860, -0.129047, -0.674498, -0.880092, -0.752953},
  33. {-0.625461, -0.633598, -0.651167, -0.621632, -0.312866, -3.908468, -2.380095, -0.118114, 0.233478, 0.722539},
  34. {-0.525633, -0.521436, -0.552314, -0.527505, -0.233392, -3.763046, -2.487090, -0.133160, 0.156544, 0.642195},
  35. };
  36. */
  37. /*
  38. static float input_vector[2][D_sv] = {
  39. {-0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  40. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  41. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  42. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  43. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  44. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  45. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  46. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  47. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  48. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752},
  49. {-0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  50. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  51. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  52. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  53. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  54. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  55. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  56. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  57. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  58. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990},
  59. };
  60. */
  61. /*
  62. static float input_vector[1][D_sv] = {
  63. {-0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  64. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  65. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  66. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  67. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  68. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  69. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  70. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  71. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  72. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  73. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  74. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  75. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  76. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  77. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  78. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  79. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  80. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  81. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  82. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  83. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  84. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  85. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  86. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  87. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  88. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  89. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  90. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  91. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  92. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  93. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  94. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  95. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  96. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  97. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  98. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  99. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  100. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  101. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  102. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  103. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  104. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  105. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  106. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  107. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  108. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  109. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  110. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  111. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  112. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  113. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  114. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  115. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  116. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  117. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  118. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  119. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  120. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  121. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  122. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  123. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  124. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  125. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  126. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  127. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  128. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  129. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  130. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  131. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  132. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  133. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  134. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  135. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  136. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  137. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  138. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  139. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  140. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  141. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  142. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  143. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  144. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  145. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  146. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  147. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  148. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  149. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  150. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  151. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  152. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  153. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  154. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  155. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  156. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  157. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  158. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  159. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  160. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  161. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  162. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990
  163. },
  164. };
  165. */
  166. /*
  167. static float input_vector[1][2100] = {
  168. {-0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  169. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  170. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  171. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  172. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  173. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  174. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  175. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  176. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  177. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  178. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  179. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  180. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  181. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  182. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  183. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  184. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  185. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  186. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  187. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  188. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  189. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  190. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  191. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  192. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  193. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  194. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  195. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  196. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  197. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  198. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  199. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  200. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  201. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  202. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  203. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  204. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  205. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  206. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  207. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  208. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  209. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  210. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  211. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  212. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  213. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  214. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  215. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  216. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  217. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  218. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  219. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  220. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  221. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  222. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  223. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  224. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  225. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  226. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  227. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  228. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  229. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  230. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  231. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  232. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  233. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  234. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  235. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  236. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  237. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  238. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  239. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  240. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  241. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  242. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  243. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  244. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  245. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  246. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  247. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  248. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  249. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  250. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  251. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  252. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  253. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  254. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  255. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  256. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  257. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  258. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  259. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  260. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  261. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  262. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  263. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  264. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  265. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  266. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  267. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  268. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  269. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  270. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  271. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  272. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  273. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  274. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  275. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  276. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  277. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  278. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  279. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  280. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  281. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  282. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  283. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  284. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  285. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  286. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  287. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  288. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  289. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  290. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  291. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  292. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  293. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  294. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  295. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  296. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  297. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  298. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  299. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  300. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  301. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  302. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  303. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  304. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  305. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  306. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  307. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  308. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  309. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  310. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  311. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  312. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  313. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  314. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  315. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  316. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  317. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  318. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  319. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  320. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  321. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  322. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  323. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  324. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  325. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  326. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  327. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  328. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  329. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  330. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  331. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  332. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  333. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  334. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  335. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  336. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  337. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  338. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  339. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  340. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  341. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  342. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  343. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  344. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  345. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  346. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  347. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  348. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  349. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  350. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  351. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  352. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  353. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  354. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  355. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  356. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  357. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752,
  358. -0.664593, -0.687087, -0.075215, 0.583554, 0.927597, 3.671647, 3.835722, 0.694133, -2.007198, -2.345115,
  359. -0.343777, -0.344074, -0.221304, -0.153775, -0.494637, 1.743759, -0.590775, -0.413656, -0.389204, -0.221876,
  360. -0.159571, -0.163080, -0.513428, -0.775665, -0.891170, -3.118664, -1.247074, 0.913688, 1.009656, 1.170559,
  361. -0.761538, -0.755972, -0.773967, -0.674253, -0.978258, 1.514730, -0.145977, -0.620700, -0.857082, -0.765523,
  362. 1.344641, 1.329151, 1.633256, 2.020196, 1.777348, -1.744907, -5.928727, -4.032057, -0.585966, 1.072364,
  363. -0.468882, -0.486856, 0.935241, 2.032263, 2.219547, -0.225632, -3.438104, -4.412505, -0.550391, 2.234320,
  364. 3.177341, 3.204259, 2.749250, 1.741244, 1.197538, -2.985864, -6.084715, -1.447878, 0.904210, 1.495579,
  365. -0.998953, -1.005918, -0.988911, -0.863153, -1.003750, 1.256336, -0.471785, -0.860056, -0.872804, -0.629210,
  366. 1.957319, 1.966453, 1.840960, 1.405216, 1.313205, -0.956540, -3.535391, -2.280320, -1.179478, -0.458734,
  367. -0.326054, -0.331524, -0.134208, -0.218622, -0.158037, 3.128528, 4.020623, -1.129257, -1.524952, -1.377990,
  368. -0.390695, -0.381094, -0.341754, -0.272043, -0.588159, 2.297114, -0.116822, -0.507031, -0.563574, -0.534119,
  369. -0.250457, -0.240673, -0.210423, -0.217804, -0.453731, 1.784484, -0.142005, -0.230148, -0.339593, -0.298467,
  370. -0.177671, -0.183887, -0.191644, -0.205313, -0.441613, 1.599526, 0.023297, -0.322458, -0.539978, -0.457565,
  371. -0.149024, -0.140364, -0.142723, -0.066651, -0.344126, 1.830863, 0.154307, -0.171898, -0.343950, -0.379533,
  372. -0.155498, -0.154145, -0.181875, -0.189322, -0.122244, -3.037579, -1.476675, -0.089878, 0.004249, 0.169941,
  373. -1.786535, -1.809749, -1.445913, -1.050310, -0.095173, 2.964720, 4.706277, -0.649227, -1.362017, -1.447784,
  374. 0.034026, 0.038159, -0.018497, -0.067303, 0.059710, -2.908602, -1.484229, 0.108804, 0.292757, 0.566575,
  375. 0.527511, 0.518252, 0.762342, 1.148066, 0.772846, -2.113671, -2.704303, -0.664257, 0.460104, 1.295371,
  376. 1.370790, 1.383803, 1.340450, 0.634441, -0.596868, -2.427651, -2.352223, 0.454767, 1.405430, 1.838241,
  377. 1.455314, 1.464866, 2.487861, 2.464788, 1.963237, 0.324097, -1.869693, -2.554004, -2.022594, 1.114752
  378. },
  379. };
  380. */
  381. static float **svm_vectors, *svm_coef;
  382. static int *vector, **matrix;
  383. static float input_vector[D_sv];
  384. //static float matr_speedup[NUM_OF_MATRICES][MAX_WORKERS_COUNT];
  385. //static int matr_times[NUM_OF_MATRICES][MAX_WORKERS_COUNT];
  386. static float Exec_Speedup[MAX_WORKERS_COUNT];
  387. static int Exec_Latencies[MAX_WORKERS_COUNT];
  388. //static float **vectors, *coef;
  389. //2*(N+rootN*pad_length)*sizeof(float)+PAGE_SIZE);
  390. static int P = 1; /* DEFAULT_P = 1 */
  391. static int M = 16; /* DEFAULT_M = 10 */
  392. static int N = 65536; /* N = 2^M */
  393. static int rootN = 256; /* rootN = sqrt(N) */
  394. static int num_cache_lines = 65536;
  395. #define PADLENGTH 2
  396. static float *x_local; /* x is the original time-domain data */
  397. static float *trans; /* trans is used as scratch space */
  398. static float *umain; /* umain is roots of unity for 1D FFTs */
  399. static float *umain2; /* umain2 is entire roots of unity matrix*/
  400. static float *upriv;
  401. void execute_workload_svm (int lower_bound, int upper_bound);
  402. void execute_workload_matrix (int lower_bound, int upper_bound);
  403. void matrix_transpose(int n1, float *src, float *dest, int node_id, int myFirst, int myLast, int pad_length);
  404. void FFT1D(int direction, int M, int N, float *x, float *scratch, float *upriv, float *umain2, int node_id, int myFirst, int myLast, int pad_length, int P);
  405. void copyColumn(int n1, float *src, float *dest);
  406. void single_FFT1D(int direction, int M, int N, float *u, float *x);
  407. void twiddle_Col(int direction, int n1, int N, int j, float *u, float *x, int pad_length);
  408. void reverse(int N, int M, float *x);
  409. int reverse_bit(int M, int k);
  410. void execute_workload_svm (int lower_bound, int upper_bound) {
  411. int i = 0, j = 0;
  412. float diff = 0, norma = 0, local_sum[N_sv];
  413. /* int vector_id = 0; Removed 16.02. Only one test vector */
  414. if (base_offset == -1) {
  415. base_offset = cur_agent.my_agent * N_sv;
  416. //fprintf(log_file, "My agent is %d. Calculated base_offset is %d\n",cur_agent.my_agent,base_offset);
  417. }
  418. for (i = lower_bound; i <= upper_bound; i++) {
  419. local_sum[i] = 0;
  420. scc_signals_check();
  421. for (j = 0; j < D_sv; j++){
  422. diff = svm_vectors[i][j] - input_vector[j];
  423. norma += diff*diff;
  424. }
  425. local_sum[i] += (float) (exp((double) (-gamma*norma))*svm_coef[i]);
  426. norma = 0;
  427. }
  428. for (i=lower_bound; i<=upper_bound; i++)
  429. manager_result_out[base_offset+i] = (int) local_sum[i];
  430. }
  431. void execute_workload_matrix (int lower_bound, int upper_bound) {
  432. int i, j, local_sum[MAX_ARRAY_SIZE];
  433. if (base_offset == -1) {
  434. //matrix_out = (int*) shmat (cur_agent.segment_id, NULL, 0);
  435. base_offset = cur_agent.my_agent * MAX_ARRAY_SIZE;
  436. }
  437. for (i=lower_bound; i<=upper_bound; i++) {
  438. local_sum[i] = 0;
  439. scc_signals_check();
  440. //signals_enable();
  441. for (j=0; j<cur_agent.array_size; j++)
  442. local_sum[i] += matrix[i][j] * vector[j];
  443. //signals_disable();
  444. }
  445. for (i=lower_bound; i<=upper_bound; i++)
  446. manager_result_out[base_offset+i] = local_sum[i];
  447. }
  448. void execute_workload_fft (int lower_bound, int upper_bound) {
  449. int work_id = 0, pad_length = PADLENGTH;
  450. if ((lower_bound == 0) && (upper_bound == FFT_MAX)) {
  451. P = 1;
  452. } else {
  453. P = 2;
  454. }
  455. /* FIXME works only because fft is restricted to two workers */
  456. if (lower_bound > 0) {
  457. work_id = 1;
  458. }
  459. FFT1D(1, M, N, x_local, trans, upriv, umain2, work_id, lower_bound, upper_bound, pad_length, P); //HACK node_id - 1 important!!
  460. }
  461. void execute_workload (int lower_bound, int upper_bound) {
  462. if (executed_app == MATRIX_MUL) {
  463. execute_workload_matrix (lower_bound, upper_bound);
  464. } else if (executed_app == SVM) {
  465. execute_workload_svm (lower_bound, upper_bound);
  466. } else if (executed_app == FFT) {
  467. execute_workload_fft (lower_bound, upper_bound);
  468. }
  469. }
  470. void init_speedup_structs (void) {
  471. if (executed_app == MATRIX_MUL) {
  472. if (MATRIX_ARRAY_SIZE == 1024) {
  473. #ifdef PLAT_SCC
  474. Exec_Speedup[0] = 1.0;
  475. Exec_Speedup[1] = 1.188;
  476. Exec_Speedup[2] = 2.264;
  477. Exec_Speedup[3] = 3.0;
  478. Exec_Speedup[4] = 3.429;
  479. Exec_Speedup[5] = 4.0;
  480. Exec_Speedup[6] = 8.0;
  481. Exec_Speedup[7] = 0.0;
  482. Exec_Latencies[0] = 120;//29352;
  483. Exec_Latencies[1] = 101;//15112;
  484. Exec_Latencies[2] = 53;//11194;
  485. Exec_Latencies[3] = 40;//10313;
  486. Exec_Latencies[4] = 35;//8645;
  487. Exec_Latencies[5] = 30;//7871;
  488. Exec_Latencies[6] = 15;//6715;
  489. #else
  490. Exec_Speedup[0] = 1.0;
  491. Exec_Speedup[1] = 1.065;
  492. Exec_Speedup[2] = 1.270;
  493. Exec_Speedup[3] = 0.0;
  494. Exec_Speedup[4] = 0.0;
  495. Exec_Speedup[5] = 0.0;
  496. Exec_Speedup[6] = 0.0;
  497. Exec_Speedup[7] = 0.0;
  498. Exec_Latencies[0] = 100000000;//29352;
  499. Exec_Latencies[1] = 31;//15112;
  500. Exec_Latencies[2] = 29;//11194;
  501. Exec_Latencies[3] = 24;//10313;
  502. Exec_Latencies[4] = 0;//8645;
  503. Exec_Latencies[5] = 0;//7871;
  504. Exec_Latencies[6] = 0;//6715;
  505. Exec_Latencies[7] = 0;//7014;
  506. #endif
  507. } else if (MATRIX_ARRAY_SIZE == 2048) {
  508. #ifdef PLAT_SCC
  509. Exec_Speedup[0] = 1.0;
  510. Exec_Speedup[1] = 1.091;
  511. Exec_Speedup[2] = 1.2;
  512. Exec_Speedup[3] = 1.491;
  513. Exec_Speedup[4] = 1.791;
  514. Exec_Speedup[5] = 2.824;
  515. Exec_Speedup[6] = 3.0;
  516. Exec_Latencies[0] = 240;//112276;
  517. Exec_Latencies[1] = 220;//58880;
  518. Exec_Latencies[2] = 200;//40305;
  519. Exec_Latencies[3] = 161;//31705;
  520. Exec_Latencies[4] = 134;//28309;
  521. Exec_Latencies[5] = 85;//24512;
  522. Exec_Latencies[6] = 80;//22239;
  523. //matr_times[1][7] = 23;//20332;
  524. #else
  525. Exec_Speedup[0] = 1.0;
  526. Exec_Speedup[1] = 1.331;
  527. Exec_Speedup[2] = 2.009;
  528. Exec_Speedup[3] = 2.315;
  529. Exec_Speedup[4] = 2.572;
  530. Exec_Speedup[5] = 0.0;
  531. Exec_Speedup[6] = 0.0;
  532. Exec_Speedup[7] = 0.0;//5.522;
  533. Exec_Latencies[0] = 100000000;//112276;
  534. Exec_Latencies[1] = 116;//58880;
  535. Exec_Latencies[2] = 87;//40305;
  536. Exec_Latencies[3] = 58;//31705;
  537. Exec_Latencies[4] = 50;//28309;
  538. Exec_Latencies[5] = 45;//24512;
  539. Exec_Latencies[6] = 0;//22239;
  540. Exec_Latencies[7] = 0;//20332;
  541. #endif
  542. } else if (MATRIX_ARRAY_SIZE == 4096) {
  543. #ifdef PLAT_SCC
  544. Exec_Speedup[0] = 1.0;
  545. Exec_Speedup[1] = 2.001;
  546. Exec_Speedup[2] = 2.976;
  547. Exec_Speedup[3] = 4.032;
  548. Exec_Speedup[4] = 5.034;
  549. Exec_Speedup[5] = 6.25;
  550. Exec_Speedup[6] = 6.678;
  551. Exec_Speedup[7] = 6.819;
  552. Exec_Latencies[0] = 750;//384005;
  553. Exec_Latencies[1] = 374;//231583;
  554. Exec_Latencies[2] = 252;//157966;
  555. Exec_Latencies[3] = 186;//121222;
  556. Exec_Latencies[4] = 149;//101208;
  557. Exec_Latencies[5] = 120;//87852;
  558. Exec_Latencies[6] = 110;//78093;
  559. #else
  560. Exec_Speedup[0] = 1.0;
  561. Exec_Speedup[1] = 1.517;
  562. Exec_Speedup[2] = 1.958;
  563. Exec_Speedup[3] = 2.112;
  564. Exec_Speedup[4] = 2.878;
  565. Exec_Speedup[5] = 3.338;
  566. Exec_Speedup[6] = 4.241;
  567. Exec_Speedup[7] = 0.0;//5.073;
  568. Exec_Latencies[0] = 100000000;//384005;
  569. Exec_Latencies[1] = 431;//231583;
  570. Exec_Latencies[2] = 284;//157966;
  571. Exec_Latencies[3] = 220;//121222;
  572. Exec_Latencies[4] = 204;//101208;
  573. Exec_Latencies[5] = 150;//87852;
  574. Exec_Latencies[6] = 129;//78093;
  575. Exec_Latencies[7] = 102;//75690;
  576. #endif
  577. } else {
  578. printf("Unknown array size\n");
  579. exit(0);
  580. }
  581. } else if (executed_app == SVM) {
  582. /* N_sv 4096 D_sv 4096 */
  583. Exec_Speedup[0] = 1.0; /* 1 worker */
  584. Exec_Speedup[1] = 1.959;
  585. Exec_Speedup[2] = 2.919;
  586. Exec_Speedup[3] = 3.853;
  587. Exec_Speedup[4] = 4.777;
  588. Exec_Speedup[5] = 5.723;
  589. Exec_Speedup[6] = 6.644;
  590. Exec_Speedup[7] = 0.0;
  591. Exec_Latencies[0] = 578;
  592. Exec_Latencies[1] = 295;
  593. Exec_Latencies[2] = 198;
  594. Exec_Latencies[3] = 150;
  595. Exec_Latencies[4] = 121;
  596. Exec_Latencies[5] = 101;
  597. Exec_Latencies[6] = 87;
  598. Exec_Latencies[7] = 6; /* Irrelevant */
  599. } else if (executed_app == FFT) {
  600. Exec_Speedup[0] = 1.0; /* 1 worker */
  601. Exec_Speedup[1] = 1.55;
  602. Exec_Speedup[2] = 0;
  603. Exec_Speedup[3] = 0;
  604. Exec_Speedup[4] = 0;
  605. Exec_Speedup[5] = 0;
  606. Exec_Speedup[6] = 0;
  607. Exec_Speedup[7] = 0;
  608. Exec_Latencies[0] = 772;
  609. Exec_Latencies[1] = 498;
  610. Exec_Latencies[2] = 0;
  611. Exec_Latencies[3] = 0;
  612. Exec_Latencies[4] = 0;
  613. Exec_Latencies[5] = 0;
  614. Exec_Latencies[6] = 0;
  615. Exec_Latencies[7] = 0;
  616. }
  617. }
  618. void app_init (char scen_directory[SCEN_DIR_SIZE], char scen_num[SCEN_NUM_SIZE]) {
  619. int i, j, pad_length = PADLENGTH;
  620. char buf[MAX_STR_NAME_SIZE], *buffer;
  621. FILE *matrix_input, *support_vectors_file, *coef_file, *test_vector_file, *umain_file, *umain2_file, *x_local_file;
  622. size_t bufsize = 32;
  623. if (executed_app == MATRIX_MUL) {
  624. cur_agent.array_size = MATRIX_ARRAY_SIZE;
  625. matrix = (int **) malloc(cur_agent.array_size * sizeof(int *));
  626. #ifdef PLAT_SCC
  627. strcpy(buf, "/shared/herc/");
  628. #else
  629. strcpy(buf, "../");
  630. #endif
  631. strcat(buf, scen_directory);
  632. strcat(buf, "/MATRIX-inputs/");
  633. strcat(buf, itoa(cur_agent.array_size));
  634. fprintf(log_file,"matrix file path = %s\n",buf);
  635. if ((matrix_input = fopen(buf, "r")) == NULL){
  636. printf("Cannot open input file with file path = %s ",buf);
  637. perror("open matrix_input");
  638. }
  639. for (i=0; i<cur_agent.array_size; i++) {
  640. matrix[i] = (int *) malloc(cur_agent.array_size * sizeof(int));
  641. for (j=0; j<cur_agent.array_size; j++)
  642. fscanf(matrix_input,"%d",&matrix[i][j]);
  643. }
  644. vector = (int *) malloc(cur_agent.array_size * sizeof(int));
  645. for (j=0; j<cur_agent.array_size; j++)
  646. fscanf(matrix_input,"%d",&vector[j]);
  647. fclose(matrix_input);
  648. } else if (executed_app == SVM) {
  649. #ifdef PLAT_SCC
  650. strcpy(buf, "/shared/herc/");
  651. #else
  652. strcpy(buf, "../");
  653. #endif
  654. strcat(buf,scen_directory);
  655. //strcat(buf,"/");
  656. //strcat(buf,scen_num);
  657. strcat(buf,"/SVM-inputs/support_vectors_N_sv_");
  658. strcat(buf,itoa(N_sv));
  659. strcat(buf,"_D_sv_");
  660. strcat(buf,itoa(D_sv));
  661. strcat(buf,".dat");
  662. fprintf(log_file,"svm file path = %s\n",buf);
  663. if ((support_vectors_file = fopen(buf,"r")) == NULL){
  664. printf("Cannot open input file with file path = %s ",buf);
  665. perror("open svm_input");
  666. }
  667. #ifdef PLAT_SCC
  668. strcpy(buf, "/shared/herc/");
  669. #else
  670. strcpy(buf, "../");
  671. #endif
  672. strcat(buf,scen_directory);
  673. //strcat(buf,"/");
  674. //strcat(buf,scen_num);
  675. strcat(buf,"/SVM-inputs/sv_coef_N_sv_");
  676. strcat(buf,itoa(N_sv));
  677. strcat(buf,"_D_sv_");
  678. strcat(buf,itoa(D_sv));
  679. strcat(buf,".dat");
  680. fprintf(log_file,"svm_coef file path = %s\n",buf);
  681. if ((coef_file = fopen(buf,"r")) == NULL){
  682. printf("Cannot open input file with file path = %s ",buf);
  683. perror("open svm_input");
  684. }
  685. #ifdef PLAT_SCC
  686. strcpy(buf, "/shared/herc/");
  687. #else
  688. strcpy(buf, "../");
  689. #endif
  690. strcat(buf,scen_directory);
  691. //strcat(buf,"/");
  692. //strcat(buf,scen_num);
  693. strcat(buf,"/SVM-inputs/test_vector_D_sv_");
  694. strcat(buf,itoa(D_sv));
  695. strcat(buf,".dat");
  696. fprintf(log_file,"test_vector file path = %s\n",buf);
  697. if ((test_vector_file = fopen(buf,"r")) == NULL){
  698. printf("Cannot open input file with file path = %s ",buf);
  699. perror("open svm_input");
  700. }
  701. svm_vectors = (float **)malloc(N_sv*sizeof(float *));
  702. if (svm_vectors == NULL){
  703. printf("--%d-- svm_vectors malloc fail!!\n", node_id);
  704. perror("malloc error");
  705. }
  706. svm_coef = (float *)malloc(N_sv*sizeof(float));
  707. if (svm_coef == NULL){
  708. printf("--%d-- svm_coef malloc fail!!\n", node_id);
  709. perror("malloc error");
  710. }
  711. buffer = (char *)malloc(bufsize * sizeof(char));
  712. for (i = 0; i < N_sv; i++) {
  713. svm_vectors[i] = (float *)malloc(D_sv*sizeof(float));
  714. if (svm_vectors[i] == NULL) {
  715. printf("--%d-- svm_vectors[%d] malloc fail!!\n", node_id, i);
  716. perror("malloc error");
  717. } else {
  718. for (j = 0; j < D_sv; j++) {
  719. /* Read support svm_vectors */
  720. if (j < D_sv){
  721. fscanf(support_vectors_file,"%f",&svm_vectors[i][j]);
  722. fgetc(support_vectors_file);
  723. }else{
  724. getline(&buffer,&bufsize,support_vectors_file);
  725. }
  726. }
  727. }
  728. }
  729. for (j = 0; j < N_sv; j++) {
  730. /* Read coefficients */
  731. fscanf(coef_file,"%f",&svm_coef[j]);
  732. fgetc(coef_file);
  733. }
  734. for (j = 0; j < D_sv; j++) {
  735. /* Read coefficients */
  736. fscanf(test_vector_file,"%f",&input_vector[j]);
  737. }
  738. cur_agent.array_size = -1;
  739. fclose(support_vectors_file);
  740. fclose(coef_file);
  741. fclose(test_vector_file);
  742. free(buffer);
  743. } else if (executed_app == FFT) {
  744. fprintf(log_file,"Initializing FFT application\n");
  745. x_local = (float *)malloc(2*(N+rootN*pad_length)*sizeof(float)+PAGE_SIZE);
  746. if (x_local == NULL){
  747. printf("Malloc error for x_local\n");
  748. perror("malloc error");
  749. exit(-1);
  750. }
  751. trans = (float *)malloc(2*(N+rootN*pad_length)*sizeof(float)+PAGE_SIZE);
  752. if (trans == NULL){
  753. printf("Malloc error for trans\n");
  754. perror("malloc error");
  755. exit(-1);
  756. }
  757. umain = (float *)malloc(2*rootN*sizeof(float));
  758. if (umain == NULL){
  759. printf("Malloc error for umain\n");
  760. perror("malloc error");
  761. exit(-1);
  762. }
  763. umain2 = (float *)malloc(2*(N+rootN*pad_length)*sizeof(float)+PAGE_SIZE);
  764. if (umain2 == NULL){
  765. printf("Malloc error for umain2\n");
  766. perror("malloc error");
  767. exit(-1);
  768. }
  769. upriv = (float *)malloc(2*(rootN-1)*sizeof(float));
  770. if (upriv == NULL){
  771. printf("--%d-- Malloc error for upriv\n", node_id);
  772. perror("malloc error");
  773. exit(-1);
  774. }
  775. #ifdef PLAT_SCC
  776. strcpy(buf, "/shared/herc/");
  777. #else
  778. strcpy(buf, "../");
  779. #endif
  780. strcat(buf,scen_directory);
  781. //strcat(buf,"/");
  782. //strcat(buf,scen_num);
  783. strcat(buf,"/FFT-inputs/umain_file");
  784. fprintf(log_file,"umain_file file path = %s\n",buf);
  785. if ((umain_file = fopen(buf,"r")) == NULL){
  786. printf("Cannot open input file with file path = %s ",buf);
  787. perror("open fft_input");
  788. }
  789. for (i=0; i<2*rootN; i++) {
  790. fscanf(umain_file,"%f",&umain[i]);
  791. }
  792. fclose(umain_file);
  793. #ifdef PLAT_SCC
  794. strcpy(buf, "/shared/herc/");
  795. #else
  796. strcpy(buf, "../");
  797. #endif
  798. strcat(buf,scen_directory);
  799. //strcat(buf,"/");
  800. //strcat(buf,scen_num);
  801. strcat(buf,"/FFT-inputs/umain2_file");
  802. fprintf(log_file,"umain2_file file path = %s\n",buf);
  803. if ((umain2_file = fopen(buf,"r")) == NULL){
  804. printf("Cannot open input file with file path = %s ",buf);
  805. perror("open umain_file");
  806. }
  807. //for (i=0; i<2*(N+rootN*pad_length)+PAGE_SIZE; i++) {
  808. for (i=0; i<2*(N+rootN*pad_length); i++) {
  809. fscanf(umain2_file,"%f",&umain2[i]);
  810. }
  811. fclose(umain2_file);
  812. #ifdef PLAT_SCC
  813. strcpy(buf, "/shared/herc/");
  814. #else
  815. strcpy(buf, "../");
  816. #endif
  817. strcat(buf,scen_directory);
  818. //strcat(buf,"/");
  819. //strcat(buf,scen_num);
  820. strcat(buf,"/FFT-inputs/x_local_file");
  821. fprintf(log_file,"x_local_file file path = %s\n",buf);
  822. if ((x_local_file = fopen(buf,"r")) == NULL){
  823. printf("Cannot open input file with file path = %s ",buf);
  824. perror("open x_local_file");
  825. }
  826. //for (i=0;i<2*(N+rootN*pad_length)+PAGE_SIZE;i++) {
  827. for (i=0; i<2*(N+rootN*pad_length); i++) {
  828. fscanf(x_local_file,"%f",&x_local[i]);
  829. }
  830. fclose(x_local_file);
  831. for (i = 0; i < 2*(rootN-1); i++){
  832. upriv[i] = umain[i];
  833. }
  834. }
  835. }
  836. int get_max_cores_count(app cur_app){
  837. /*if (cur_app.var < 1.0)
  838. return (int) ceilf(2.0*cur_app.A - 1);
  839. else
  840. return (int) ceilf(cur_app.A + cur_app.A*cur_app.var - cur_app.var);*/
  841. #ifdef SINGLE_WORKER
  842. return 2;
  843. #else
  844. if (executed_app == FFT) {
  845. return 3;
  846. } else {
  847. return MAX_WORKERS_COUNT;
  848. }
  849. #endif
  850. }
  851. float Speedup(app cur_app, int num_of_cores) {
  852. /*
  853. int type;
  854. if (cur_app.array_size == 1024) type = 0;
  855. else if (cur_app.array_size == 2048) type = 1;
  856. else if (cur_app.array_size == 4096) type = 2;
  857. else {
  858. fprintf(log_file, "Unknown array size = %d\n",cur_app.array_size);
  859. fflush(log_file);
  860. return 0.0;
  861. }
  862. return matr_speedup[type][num_of_cores-1];
  863. */
  864. if ((num_of_cores < 2) || (num_of_cores > get_max_cores_count(cur_app))) {
  865. return 0;
  866. } else {
  867. return Exec_Speedup[num_of_cores-2];
  868. }
  869. }
  870. int get_times(app cur_app, int num_of_cores) {
  871. /*
  872. int type;
  873. if (cur_app.array_size == 1024) type = 0;
  874. else if (cur_app.array_size == 2048) type = 1;
  875. else if (cur_app.array_size == 4096) type = 2;
  876. else {
  877. fprintf(log_file, "Unknown array size = %d\n",cur_app.array_size);
  878. fflush(log_file);
  879. return 0.0;
  880. }
  881. return (cur_app.workld * matr_times[type][num_of_cores-2]);
  882. */
  883. return (cur_app.workld * Exec_Latencies[num_of_cores-2]);
  884. }
  885. void matrix_transpose(int n1, float *src, float *dest, int node_id, int myFirst, int myLast, int pad_length){
  886. int i;
  887. int j;
  888. int k;
  889. int l;
  890. int m;
  891. int blksize;
  892. int numblks;
  893. int firstfirst;
  894. int h_off;
  895. int v_off;
  896. int v;
  897. int h;
  898. int n1p;
  899. int row_count;
  900. //fprintf(log_file,"I am inside matrix_transpose-0 node_id is %d n1 %d\n",node_id,n1);
  901. blksize = myLast-myFirst;
  902. numblks = (2*blksize)/num_cache_lines;
  903. if (numblks * num_cache_lines != 2 * blksize) {
  904. numblks ++;
  905. }
  906. blksize = blksize / numblks;
  907. firstfirst = myFirst;
  908. row_count = n1/P;
  909. n1p = n1+pad_length;
  910. for (l=node_id+1;l<P;l++) {
  911. v_off = l*row_count;
  912. for (k=0; k<numblks; k++) {
  913. h_off = firstfirst;
  914. for (m=0; m<numblks; m++) {
  915. for (i=0; i<blksize; i++) {
  916. v = v_off + i;
  917. for (j=0; j<blksize; j++) {
  918. h = h_off + j;
  919. //fprintf(log_file,"Index dest is %d\n",2*(h*n1p+v));
  920. //fprintf(log_file,"Index src is %d\n",2*(v*n1p+h));
  921. //fprintf(log_file,"src = %f\n",src[2*(v*n1p+h)]);
  922. //fprintf(log_file,"src + 1 = %f\n",src[2*(v*n1p+h)+1]);
  923. //fprintf(log_file,"dest = %f\n",dest[2*(h*n1p+v)]);
  924. //fprintf(log_file,"dest + 1 = %f\n",dest[2*(h*n1p+v)+1]);
  925. //fflush(log_file);
  926. dest[2*(h*n1p+v)] = src[2*(v*n1p+h)];
  927. dest[2*(h*n1p+v)+1] = src[2*(v*n1p+h)+1];
  928. //fprintf(log_file,"yolo\n");
  929. }
  930. }
  931. h_off += blksize;
  932. }
  933. v_off+=blksize;
  934. }
  935. }
  936. //fprintf(log_file,"I am inside matrix_transpose-A\n");
  937. for (l=0;l<node_id;l++) {
  938. v_off = l*row_count;
  939. for (k=0; k<numblks; k++) {
  940. h_off = firstfirst;
  941. for (m=0; m<numblks; m++) {
  942. for (i=0; i<blksize; i++) {
  943. v = v_off + i;
  944. for (j=0; j<blksize; j++) {
  945. h = h_off + j;
  946. dest[2*(h*n1p+v)] = src[2*(v*n1p+h)];
  947. dest[2*(h*n1p+v)+1] = src[2*(v*n1p+h)+1];
  948. }
  949. }
  950. h_off += blksize;
  951. }
  952. v_off+=blksize;
  953. }
  954. }
  955. //fprintf(log_file,"I am inside matrix_transpose-B\n");
  956. v_off = node_id*row_count;
  957. for (k=0; k<numblks; k++) {
  958. h_off = firstfirst;
  959. for (m=0; m<numblks; m++) {
  960. for (i=0; i<blksize; i++) {
  961. v = v_off + i;
  962. for (j=0; j<blksize; j++) {
  963. h = h_off + j;
  964. dest[2*(h*n1p+v)] = src[2*(v*n1p+h)];
  965. dest[2*(h*n1p+v)+1] = src[2*(v*n1p+h)+1];
  966. }
  967. }
  968. h_off += blksize;
  969. }
  970. v_off+=blksize;
  971. }
  972. //fprintf(log_file,"I am inside matrix_transpose-C\n");
  973. }
  974. //FFT1D(1, M, N, x_local, trans, upriv, umain2, work_id, lower_bound, upper_bound, pad_length, P);
  975. void FFT1D(int direction, int M, int N, float *x, float *scratch, float *upriv, float *umain2, int node_id, int myFirst, int myLast, int pad_length, int P){
  976. int j, m1, n1;
  977. //printf("I am %d and I am inside FFT1D\n",node_id);
  978. //fprintf(log_file,"I am inside FFT1D-A myFirst=%d myLast=%d\n",myFirst,myLast);
  979. m1 = M/2;
  980. n1 = 1 << m1;
  981. matrix_transpose(n1, x, scratch, node_id, myFirst, myLast, pad_length);
  982. //fprintf(log_file,"I am inside FFT1D-B\n");
  983. /* do n1 1D FFTs on columns */
  984. for (j = myFirst; j < myLast; j++){
  985. single_FFT1D(direction, m1, n1, upriv, &scratch[2*j*(n1+pad_length)]);
  986. twiddle_Col(direction, n1, N, j, umain2, &scratch[2*j*(n1+pad_length)],pad_length);
  987. }
  988. //fprintf(log_file,"I am inside FFT1D-C\n");
  989. matrix_transpose(n1, scratch, x, node_id, myFirst, myLast, pad_length);
  990. //fprintf(log_file,"I am inside FFT1D-D\n");
  991. /* do n1 1D FFTs on columns again */
  992. for (j = myFirst; j < myLast; j++) {
  993. single_FFT1D(direction, m1, n1, upriv, &x[2*j*(n1+pad_length)]);
  994. }
  995. //fprintf(log_file,"I am inside FFT1D-E\n");
  996. matrix_transpose(n1, x, scratch, node_id, myFirst, myLast, pad_length);
  997. //fprintf(log_file,"I am inside FFT1D-F\n");
  998. /*for (j = myFirst; j < myLast; j++){
  999. copyColumn(n1, &scratch[2*j*(n1+pad_length)], &x_shared[2*j*(n1+pad_length)]);
  1000. }*/
  1001. return;
  1002. }
  1003. void copyColumn(int n1, float *src, float *dest){
  1004. int i;
  1005. for (i = 0; i < n1; i++) {
  1006. dest[2*i] = src[2*i];
  1007. dest[2*i+1] = src[2*i+1];
  1008. }
  1009. }
  1010. void single_FFT1D(int direction, int M, int N, float *u, float *x){
  1011. int j, k, q, L, r, Lstar;
  1012. float *u1, *x1, *x2;
  1013. float omega_r, omega_c, tau_r, tau_c, x_r, x_c;
  1014. reverse(N, M, x);
  1015. for (q=1; q<=M; q++) {
  1016. L = 1<<q; r = N/L; Lstar = L/2;
  1017. u1 = &u[2*(Lstar-1)];
  1018. for (k=0; k<r; k++) {
  1019. x1 = &x[2*(k*L)];
  1020. x2 = &x[2*(k*L+Lstar)];
  1021. for (j=0; j<Lstar; j++) {
  1022. omega_r = u1[2*j];
  1023. omega_c = direction*u1[2*j+1];
  1024. x_r = x2[2*j];
  1025. x_c = x2[2*j+1];
  1026. tau_r = omega_r*x_r - omega_c*x_c;
  1027. tau_c = omega_r*x_c + omega_c*x_r;
  1028. x_r = x1[2*j];
  1029. x_c = x1[2*j+1];
  1030. x2[2*j] = x_r - tau_r;
  1031. x2[2*j+1] = x_c - tau_c;
  1032. x1[2*j] = x_r + tau_r;
  1033. x1[2*j+1] = x_c + tau_c;
  1034. }
  1035. }
  1036. }
  1037. return;
  1038. }
  1039. void twiddle_Col(int direction, int n1, int N, int j, float *u, float *x, int pad_length){
  1040. int i;
  1041. float omega_c, omega_r, x_r, x_c;
  1042. for (i = 0; i < n1; i++) {
  1043. omega_r = u[2*(j*(n1+pad_length)+i)];
  1044. omega_c = direction*u[2*(j*(n1+pad_length)+i)+1];
  1045. x_r = x[2*i];
  1046. x_c = x[2*i+1];
  1047. x[2*i] = omega_r*x_r - omega_c*x_c;
  1048. x[2*i+1] = omega_r*x_c + omega_c*x_r;
  1049. }
  1050. return;
  1051. }
  1052. void reverse(int N, int M, float *x){
  1053. int j, k;
  1054. for (k = 0; k < N; k++){
  1055. j = reverse_bit(M, k);
  1056. if (j > k){
  1057. SWAP(x[2*j], x[2*k]);
  1058. SWAP(x[2*j+1], x[2*k+1]);
  1059. }
  1060. }
  1061. return;
  1062. }
  1063. int reverse_bit(int M, int k){
  1064. int i, j = 0, tmp = k;
  1065. for (i = 0; i < M; i++){
  1066. j = 2*j + (tmp&0x1);
  1067. tmp = tmp >> 1;
  1068. }
  1069. return j;
  1070. }