adfa5456 commited on
Commit
a42735d
·
verified ·
1 Parent(s): c7cee1d

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. include/eigen/bench/btl/CMakeLists.txt +107 -0
  2. include/eigen/bench/btl/COPYING +340 -0
  3. include/eigen/bench/btl/README +154 -0
  4. include/eigen/bench/btl/actions/action_aat_product.hh +145 -0
  5. include/eigen/bench/btl/actions/action_ata_product.hh +145 -0
  6. include/eigen/bench/btl/actions/action_atv_product.hh +134 -0
  7. include/eigen/bench/btl/actions/action_axpby.hh +127 -0
  8. include/eigen/bench/btl/actions/action_axpy.hh +139 -0
  9. include/eigen/bench/btl/actions/action_cholesky.hh +128 -0
  10. include/eigen/bench/btl/actions/action_ger.hh +128 -0
  11. include/eigen/bench/btl/actions/action_hessenberg.hh +233 -0
  12. include/eigen/bench/btl/actions/action_lu_decomp.hh +124 -0
  13. include/eigen/bench/btl/actions/action_lu_solve.hh +136 -0
  14. include/eigen/bench/btl/actions/action_matrix_matrix_product.hh +150 -0
  15. include/eigen/bench/btl/actions/action_matrix_matrix_product_bis.hh +152 -0
  16. include/eigen/bench/btl/actions/action_matrix_vector_product.hh +153 -0
  17. include/eigen/bench/btl/actions/action_partial_lu.hh +125 -0
  18. include/eigen/bench/btl/actions/action_rot.hh +116 -0
  19. include/eigen/bench/btl/actions/action_symv.hh +139 -0
  20. include/eigen/bench/btl/actions/action_syr2.hh +133 -0
  21. include/eigen/bench/btl/actions/action_trisolve.hh +137 -0
  22. include/eigen/bench/btl/actions/action_trisolve_matrix.hh +165 -0
  23. include/eigen/bench/btl/actions/action_trmm.hh +165 -0
  24. include/eigen/bench/btl/actions/basic_actions.hh +21 -0
  25. include/eigen/bench/btl/cmake/FindACML.cmake +51 -0
  26. include/eigen/bench/btl/cmake/FindATLAS.cmake +31 -0
  27. include/eigen/bench/btl/cmake/FindBLAZE.cmake +31 -0
  28. include/eigen/bench/btl/cmake/FindBlitz.cmake +40 -0
  29. include/eigen/bench/btl/cmake/FindCBLAS.cmake +35 -0
  30. include/eigen/bench/btl/cmake/FindGMM.cmake +17 -0
  31. include/eigen/bench/btl/cmake/FindMKL.cmake +65 -0
  32. include/eigen/bench/btl/cmake/FindMTL4.cmake +31 -0
  33. include/eigen/bench/btl/cmake/FindOPENBLAS.cmake +17 -0
  34. include/eigen/bench/btl/cmake/FindPackageHandleStandardArgs.cmake +60 -0
  35. include/eigen/bench/btl/cmake/FindTvmet.cmake +32 -0
  36. include/eigen/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake +31 -0
  37. include/eigen/bench/btl/data/CMakeLists.txt +32 -0
  38. include/eigen/bench/btl/data/action_settings.txt +19 -0
  39. include/eigen/bench/btl/data/gnuplot_common_settings.hh +87 -0
  40. include/eigen/bench/btl/data/go_mean +58 -0
  41. include/eigen/bench/btl/data/mean.cxx +182 -0
  42. include/eigen/bench/btl/data/mk_gnuplot_script.sh +68 -0
  43. include/eigen/bench/btl/data/mk_mean_script.sh +52 -0
  44. include/eigen/bench/btl/data/mk_new_gnuplot.sh +54 -0
  45. include/eigen/bench/btl/data/perlib_plot_settings.txt +16 -0
  46. include/eigen/bench/btl/data/regularize.cxx +131 -0
  47. include/eigen/bench/btl/data/smooth.cxx +198 -0
  48. include/eigen/bench/btl/data/smooth_all.sh +68 -0
  49. include/eigen/bench/btl/generic_bench/bench.hh +168 -0
  50. include/eigen/bench/btl/generic_bench/bench_parameter.hh +53 -0
include/eigen/bench/btl/CMakeLists.txt ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ project(BTL)
2
+
3
+ cmake_minimum_required(VERSION 2.6.2)
4
+
5
+ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${Eigen_SOURCE_DIR}/cmake)
6
+ include(MacroOptionalAddSubdirectory)
7
+
8
+ option(BTL_NOVEC "Disable SSE/Altivec optimizations when possible" OFF)
9
+
10
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
11
+
12
+ string(REGEX MATCH icpc IS_ICPC ${CMAKE_CXX_COMPILER})
13
+ if(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC)
14
+ set(CMAKE_CXX_FLAGS "-g0 -O3 -DNDEBUG ${CMAKE_CXX_FLAGS}")
15
+ set(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG ${CMAKE_Fortran_FLAGS}")
16
+ if(BTL_NOVEC)
17
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE")
18
+ endif(BTL_NOVEC)
19
+ endif(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC)
20
+
21
+ if(MSVC)
22
+ set(CMAKE_CXX_FLAGS " /O2 /Ot /GL /fp:fast -DNDEBUG")
23
+ # set(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG")
24
+ if(BTL_NOVEC)
25
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE")
26
+ endif(BTL_NOVEC)
27
+ endif(MSVC)
28
+
29
+ if(IS_ICPC)
30
+ set(CMAKE_CXX_FLAGS "-fast ${CMAKE_CXX_FLAGS}")
31
+ set(CMAKE_Fortran_FLAGS "-fast ${CMAKE_Fortran_FLAGS}")
32
+ endif()
33
+
34
+ include_directories(
35
+ ${PROJECT_SOURCE_DIR}/actions
36
+ ${PROJECT_SOURCE_DIR}/generic_bench
37
+ ${PROJECT_SOURCE_DIR}/generic_bench/utils
38
+ ${PROJECT_SOURCE_DIR}/libs/STL)
39
+
40
+ # find_package(MKL)
41
+ # if (MKL_FOUND)
42
+ # add_definitions(-DHAVE_MKL)
43
+ # set(DEFAULT_LIBRARIES ${MKL_LIBRARIES})
44
+ # endif ()
45
+
46
+ find_library(EIGEN_BTL_RT_LIBRARY rt)
47
+ # if we cannot find it easily, then we don't need it!
48
+ if(NOT EIGEN_BTL_RT_LIBRARY)
49
+ set(EIGEN_BTL_RT_LIBRARY "")
50
+ endif()
51
+
52
+ macro(BTL_ADD_BENCH targetname)
53
+
54
+ foreach(_current_var ${ARGN})
55
+ set(_last_var ${_current_var})
56
+ endforeach()
57
+
58
+ set(_sources ${ARGN})
59
+ list(LENGTH _sources _argn_length)
60
+
61
+ list(REMOVE_ITEM _sources ON OFF TRUE FALSE)
62
+
63
+ list(LENGTH _sources _src_length)
64
+
65
+ if (${_argn_length} EQUAL ${_src_length})
66
+ set(_last_var ON)
67
+ endif ()
68
+
69
+ option(BUILD_${targetname} "Build benchmark ${targetname}" ${_last_var})
70
+
71
+ if(BUILD_${targetname})
72
+ add_executable(${targetname} ${_sources})
73
+ add_test(${targetname} "${targetname}")
74
+ target_link_libraries(${targetname} ${DEFAULT_LIBRARIES} ${EIGEN_BTL_RT_LIBRARY})
75
+ endif(BUILD_${targetname})
76
+
77
+ endmacro(BTL_ADD_BENCH)
78
+
79
+ macro(btl_add_target_property target prop value)
80
+
81
+ if(BUILD_${target})
82
+ get_target_property(previous ${target} ${prop})
83
+ if(NOT previous)
84
+ set(previous "")
85
+ endif()
86
+ set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}")
87
+ endif()
88
+
89
+ endmacro()
90
+
91
+ enable_testing()
92
+
93
+ add_subdirectory(libs/eigen3)
94
+ add_subdirectory(libs/eigen2)
95
+ add_subdirectory(libs/tensors)
96
+ add_subdirectory(libs/BLAS)
97
+ add_subdirectory(libs/ublas)
98
+ add_subdirectory(libs/gmm)
99
+ add_subdirectory(libs/mtl4)
100
+ add_subdirectory(libs/blitz)
101
+ add_subdirectory(libs/tvmet)
102
+ add_subdirectory(libs/STL)
103
+ add_subdirectory(libs/blaze)
104
+
105
+ add_subdirectory(data)
106
+
107
+
include/eigen/bench/btl/COPYING ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Library General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License
307
+ along with this program; if not, write to the Free Software
308
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
309
+
310
+
311
+ Also add information on how to contact you by electronic and paper mail.
312
+
313
+ If the program is interactive, make it output a short notice like this
314
+ when it starts in an interactive mode:
315
+
316
+ Gnomovision version 69, Copyright (C) year name of author
317
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318
+ This is free software, and you are welcome to redistribute it
319
+ under certain conditions; type `show c' for details.
320
+
321
+ The hypothetical commands `show w' and `show c' should show the appropriate
322
+ parts of the General Public License. Of course, the commands you use may
323
+ be called something other than `show w' and `show c'; they could even be
324
+ mouse-clicks or menu items--whatever suits your program.
325
+
326
+ You should also get your employer (if you work as a programmer) or your
327
+ school, if any, to sign a "copyright disclaimer" for the program, if
328
+ necessary. Here is a sample; alter the names:
329
+
330
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
332
+
333
+ <signature of Ty Coon>, 1 April 1989
334
+ Ty Coon, President of Vice
335
+
336
+ This General Public License does not permit incorporating your program into
337
+ proprietary programs. If your program is a subroutine library, you may
338
+ consider it more useful to permit linking proprietary applications with the
339
+ library. If this is what you want to do, use the GNU Library General
340
+ Public License instead of this License.
include/eigen/bench/btl/README ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Bench Template Library
2
+
3
+ ****************************************
4
+ Introduction :
5
+
6
+ The aim of this project is to compare the performance
7
+ of available numerical libraries. The code is designed
8
+ as generic and modular as possible. Thus, adding new
9
+ numerical libraries or new numerical tests should
10
+ require minimal effort.
11
+
12
+
13
+ *****************************************
14
+
15
+ Installation :
16
+
17
+ BTL uses cmake / ctest:
18
+
19
+ 1 - create a build directory:
20
+
21
+ $ mkdir build
22
+ $ cd build
23
+
24
+ 2 - configure:
25
+
26
+ $ ccmake ..
27
+
28
+ 3 - run the bench using ctest:
29
+
30
+ $ ctest -V
31
+
32
+ You can run the benchmarks only on libraries matching a given regular expression:
33
+ ctest -V -R <regexp>
34
+ For instance:
35
+ ctest -V -R eigen2
36
+
37
+ You can also select a given set of actions defining the environment variable BTL_CONFIG this way:
38
+ BTL_CONFIG="-a action1{:action2}*" ctest -V
39
+ An example:
40
+ BTL_CONFIG="-a axpy:vector_matrix:trisolve:ata" ctest -V -R eigen2
41
+
42
+ Finally, if bench results already exist (the bench*.dat files) then they merges by keeping the best for each matrix size. If you want to overwrite the previous ones you can simply add the "--overwrite" option:
43
+ BTL_CONFIG="-a axpy:vector_matrix:trisolve:ata --overwrite" ctest -V -R eigen2
44
+
45
+ 4 : Analyze the result. different data files (.dat) are produced in each libs directories.
46
+ If gnuplot is available, choose a directory name in the data directory to store the results and type:
47
+ $ cd data
48
+ $ mkdir my_directory
49
+ $ cp ../libs/*/*.dat my_directory
50
+ Build the data utilities in this (data) directory
51
+ make
52
+ Then you can look the raw data,
53
+ go_mean my_directory
54
+ or smooth the data first :
55
+ smooth_all.sh my_directory
56
+ go_mean my_directory_smooth
57
+
58
+
59
+ *************************************************
60
+
61
+ Files and directories :
62
+
63
+ generic_bench : all the bench sources common to all libraries
64
+
65
+ actions : sources for different action wrappers (axpy, matrix-matrix product) to be tested.
66
+
67
+ libs/* : bench sources specific to each tested libraries.
68
+
69
+ machine_dep : directory used to store machine specific Makefile.in
70
+
71
+ data : directory used to store gnuplot scripts and data analysis utilities
72
+
73
+ **************************************************
74
+
75
+ Principles : the code modularity is achieved by defining two concepts :
76
+
77
+ ****** Action concept : This is a class defining which kind
78
+ of test must be performed (e.g. a matrix_vector_product).
79
+ An Action should define the following methods :
80
+
81
+ *** Ctor using the size of the problem (matrix or vector size) as an argument
82
+ Action action(size);
83
+ *** initialize : this method initialize the calculation (e.g. initialize the matrices and vectors arguments)
84
+ action.initialize();
85
+ *** calculate : this method actually launch the calculation to be benchmarked
86
+ action.calculate;
87
+ *** nb_op_base() : this method returns the complexity of the calculate method (allowing the mflops evaluation)
88
+ *** name() : this method returns the name of the action (std::string)
89
+
90
+ ****** Interface concept : This is a class or namespace defining how to use a given library and
91
+ its specific containers (matrix and vector). Up to now an interface should following types
92
+
93
+ *** real_type : kind of float to be used (float or double)
94
+ *** stl_vector : must correspond to std::vector<real_type>
95
+ *** stl_matrix : must correspond to std::vector<stl_vector>
96
+ *** gene_vector : the vector type for this interface --> e.g. (real_type *) for the C_interface
97
+ *** gene_matrix : the matrix type for this interface --> e.g. (gene_vector *) for the C_interface
98
+
99
+ + the following common methods
100
+
101
+ *** free_matrix(gene_matrix & A, int N) dealocation of a N sized gene_matrix A
102
+ *** free_vector(gene_vector & B) dealocation of a N sized gene_vector B
103
+ *** matrix_from_stl(gene_matrix & A, stl_matrix & A_stl) copy the content of an stl_matrix A_stl into a gene_matrix A.
104
+ The allocation of A is done in this function.
105
+ *** vector_to_stl(gene_vector & B, stl_vector & B_stl) copy the content of an stl_vector B_stl into a gene_vector B.
106
+ The allocation of B is done in this function.
107
+ *** matrix_to_stl(gene_matrix & A, stl_matrix & A_stl) copy the content of an gene_matrix A into an stl_matrix A_stl.
108
+ The size of A_STL must corresponds to the size of A.
109
+ *** vector_to_stl(gene_vector & A, stl_vector & A_stl) copy the content of an gene_vector A into an stl_vector A_stl.
110
+ The size of B_STL must corresponds to the size of B.
111
+ *** copy_matrix(gene_matrix & source, gene_matrix & cible, int N) : copy the content of source in cible. Both source
112
+ and cible must be sized NxN.
113
+ *** copy_vector(gene_vector & source, gene_vector & cible, int N) : copy the content of source in cible. Both source
114
+ and cible must be sized N.
115
+
116
+ and the following method corresponding to the action one wants to be benchmarked :
117
+
118
+ *** matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N)
119
+ *** matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N)
120
+ *** ata_product(const gene_matrix & A, gene_matrix & X, int N)
121
+ *** aat_product(const gene_matrix & A, gene_matrix & X, int N)
122
+ *** axpy(real coef, const gene_vector & X, gene_vector & Y, int N)
123
+
124
+ The bench algorithm (generic_bench/bench.hh) is templated with an action itself templated with
125
+ an interface. A typical main.cpp source stored in a given library directory libs/A_LIB
126
+ looks like :
127
+
128
+ bench< AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ;
129
+
130
+ this function will produce XY data file containing measured mflops as a function of the size for 50
131
+ sizes between 10 and 10000.
132
+
133
+ This algorithm can be adapted by providing a given Perf_Analyzer object which determines how the time
134
+ measurements must be done. For example, the X86_Perf_Analyzer use the asm rdtsc function and provides
135
+ a very fast and accurate (but less portable) timing method. The default is the Portable_Perf_Analyzer
136
+ so
137
+
138
+ bench< AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ;
139
+
140
+ is equivalent to
141
+
142
+ bench< Portable_Perf_Analyzer,AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ;
143
+
144
+ If your system supports it we suggest to use a mixed implementation (X86_perf_Analyzer+Portable_Perf_Analyzer).
145
+ replace
146
+ bench<Portable_Perf_Analyzer,Action>(size_min,size_max,nb_point);
147
+ with
148
+ bench<Mixed_Perf_Analyzer,Action>(size_min,size_max,nb_point);
149
+ in generic/bench.hh
150
+
151
+ .
152
+
153
+
154
+
include/eigen/bench/btl/actions/action_aat_product.hh ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_aat_product.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_AAT_PRODUCT
21
+ #define ACTION_AAT_PRODUCT
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_aat_product {
33
+
34
+ public :
35
+
36
+ // Ctor
37
+
38
+ Action_aat_product( int size ):_size(size)
39
+ {
40
+ MESSAGE("Action_aat_product Ctor");
41
+
42
+ // STL matrix and vector initialization
43
+
44
+ init_matrix<pseudo_random>(A_stl,_size);
45
+ init_matrix<null_function>(X_stl,_size);
46
+ init_matrix<null_function>(resu_stl,_size);
47
+
48
+ // generic matrix and vector initialization
49
+
50
+ Interface::matrix_from_stl(A_ref,A_stl);
51
+ Interface::matrix_from_stl(X_ref,X_stl);
52
+
53
+ Interface::matrix_from_stl(A,A_stl);
54
+ Interface::matrix_from_stl(X,X_stl);
55
+
56
+ }
57
+
58
+ // invalidate copy ctor
59
+
60
+ Action_aat_product( const Action_aat_product & )
61
+ {
62
+ INFOS("illegal call to Action_aat_product Copy Ctor");
63
+ exit(0);
64
+ }
65
+
66
+ // Dtor
67
+
68
+ ~Action_aat_product( void ){
69
+
70
+ MESSAGE("Action_aat_product Dtor");
71
+
72
+ // deallocation
73
+
74
+ Interface::free_matrix(A,_size);
75
+ Interface::free_matrix(X,_size);
76
+
77
+ Interface::free_matrix(A_ref,_size);
78
+ Interface::free_matrix(X_ref,_size);
79
+
80
+ }
81
+
82
+ // action name
83
+
84
+ static inline std::string name( void )
85
+ {
86
+ return "aat_"+Interface::name();
87
+ }
88
+
89
+ double nb_op_base( void ){
90
+ return double(_size)*double(_size)*double(_size);
91
+ }
92
+
93
+ inline void initialize( void ){
94
+
95
+ Interface::copy_matrix(A_ref,A,_size);
96
+ Interface::copy_matrix(X_ref,X,_size);
97
+
98
+ }
99
+
100
+ inline void calculate( void ) {
101
+
102
+ Interface::aat_product(A,X,_size);
103
+
104
+ }
105
+
106
+ void check_result( void ){
107
+ if (_size>128) return;
108
+ // calculation check
109
+
110
+ Interface::matrix_to_stl(X,resu_stl);
111
+
112
+ STL_interface<typename Interface::real_type>::aat_product(A_stl,X_stl,_size);
113
+
114
+ typename Interface::real_type error=
115
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
116
+
117
+ if (error>1.e-6){
118
+ INFOS("WRONG CALCULATION...residual=" << error);
119
+ exit(1);
120
+ }
121
+
122
+ }
123
+
124
+ private :
125
+
126
+ typename Interface::stl_matrix A_stl;
127
+ typename Interface::stl_matrix X_stl;
128
+ typename Interface::stl_matrix resu_stl;
129
+
130
+ typename Interface::gene_matrix A_ref;
131
+ typename Interface::gene_matrix X_ref;
132
+
133
+ typename Interface::gene_matrix A;
134
+ typename Interface::gene_matrix X;
135
+
136
+
137
+ int _size;
138
+
139
+ };
140
+
141
+
142
+ #endif
143
+
144
+
145
+
include/eigen/bench/btl/actions/action_ata_product.hh ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_ata_product.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_ATA_PRODUCT
21
+ #define ACTION_ATA_PRODUCT
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_ata_product {
33
+
34
+ public :
35
+
36
+ // Ctor
37
+
38
+ Action_ata_product( int size ):_size(size)
39
+ {
40
+ MESSAGE("Action_ata_product Ctor");
41
+
42
+ // STL matrix and vector initialization
43
+
44
+ init_matrix<pseudo_random>(A_stl,_size);
45
+ init_matrix<null_function>(X_stl,_size);
46
+ init_matrix<null_function>(resu_stl,_size);
47
+
48
+ // generic matrix and vector initialization
49
+
50
+ Interface::matrix_from_stl(A_ref,A_stl);
51
+ Interface::matrix_from_stl(X_ref,X_stl);
52
+
53
+ Interface::matrix_from_stl(A,A_stl);
54
+ Interface::matrix_from_stl(X,X_stl);
55
+
56
+ }
57
+
58
+ // invalidate copy ctor
59
+
60
+ Action_ata_product( const Action_ata_product & )
61
+ {
62
+ INFOS("illegal call to Action_ata_product Copy Ctor");
63
+ exit(0);
64
+ }
65
+
66
+ // Dtor
67
+
68
+ ~Action_ata_product( void ){
69
+
70
+ MESSAGE("Action_ata_product Dtor");
71
+
72
+ // deallocation
73
+
74
+ Interface::free_matrix(A,_size);
75
+ Interface::free_matrix(X,_size);
76
+
77
+ Interface::free_matrix(A_ref,_size);
78
+ Interface::free_matrix(X_ref,_size);
79
+
80
+ }
81
+
82
+ // action name
83
+
84
+ static inline std::string name( void )
85
+ {
86
+ return "ata_"+Interface::name();
87
+ }
88
+
89
+ double nb_op_base( void ){
90
+ return 2.0*_size*_size*_size;
91
+ }
92
+
93
+ inline void initialize( void ){
94
+
95
+ Interface::copy_matrix(A_ref,A,_size);
96
+ Interface::copy_matrix(X_ref,X,_size);
97
+
98
+ }
99
+
100
+ inline void calculate( void ) {
101
+
102
+ Interface::ata_product(A,X,_size);
103
+
104
+ }
105
+
106
+ void check_result( void ){
107
+ if (_size>128) return;
108
+ // calculation check
109
+
110
+ Interface::matrix_to_stl(X,resu_stl);
111
+
112
+ STL_interface<typename Interface::real_type>::ata_product(A_stl,X_stl,_size);
113
+
114
+ typename Interface::real_type error=
115
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
116
+
117
+ if (error>1.e-6){
118
+ INFOS("WRONG CALCULATION...residual=" << error);
119
+ exit(1);
120
+ }
121
+
122
+ }
123
+
124
+ private :
125
+
126
+ typename Interface::stl_matrix A_stl;
127
+ typename Interface::stl_matrix X_stl;
128
+ typename Interface::stl_matrix resu_stl;
129
+
130
+ typename Interface::gene_matrix A_ref;
131
+ typename Interface::gene_matrix X_ref;
132
+
133
+ typename Interface::gene_matrix A;
134
+ typename Interface::gene_matrix X;
135
+
136
+
137
+ int _size;
138
+
139
+ };
140
+
141
+
142
+ #endif
143
+
144
+
145
+
include/eigen/bench/btl/actions/action_atv_product.hh ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_atv_product.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_ATV_PRODUCT
21
+ #define ACTION_ATV_PRODUCT
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_atv_product {
33
+
34
+ public :
35
+
36
+ Action_atv_product( int size ) : _size(size)
37
+ {
38
+ MESSAGE("Action_atv_product Ctor");
39
+
40
+ // STL matrix and vector initialization
41
+
42
+ init_matrix<pseudo_random>(A_stl,_size);
43
+ init_vector<pseudo_random>(B_stl,_size);
44
+ init_vector<null_function>(X_stl,_size);
45
+ init_vector<null_function>(resu_stl,_size);
46
+
47
+ // generic matrix and vector initialization
48
+
49
+ Interface::matrix_from_stl(A_ref,A_stl);
50
+ Interface::vector_from_stl(B_ref,B_stl);
51
+ Interface::vector_from_stl(X_ref,X_stl);
52
+
53
+ Interface::matrix_from_stl(A,A_stl);
54
+ Interface::vector_from_stl(B,B_stl);
55
+ Interface::vector_from_stl(X,X_stl);
56
+ }
57
+
58
+ // invalidate copy ctor
59
+ Action_atv_product( const Action_atv_product & )
60
+ {
61
+ INFOS("illegal call to Action_atv_product Copy Ctor");
62
+ exit(1);
63
+ }
64
+
65
+ ~Action_atv_product( void )
66
+ {
67
+ MESSAGE("Action_atv_product Dtor");
68
+
69
+ Interface::free_matrix(A,_size);
70
+ Interface::free_vector(B);
71
+ Interface::free_vector(X);
72
+
73
+ Interface::free_matrix(A_ref,_size);
74
+ Interface::free_vector(B_ref);
75
+ Interface::free_vector(X_ref);
76
+ }
77
+
78
+ static inline std::string name() { return "atv_" + Interface::name(); }
79
+
80
+ double nb_op_base( void ) { return 2.0*_size*_size; }
81
+
82
+ inline void initialize( void ){
83
+ Interface::copy_matrix(A_ref,A,_size);
84
+ Interface::copy_vector(B_ref,B,_size);
85
+ Interface::copy_vector(X_ref,X,_size);
86
+ }
87
+
88
+ BTL_DONT_INLINE void calculate( void ) {
89
+ BTL_ASM_COMMENT("begin atv");
90
+ Interface::atv_product(A,B,X,_size);
91
+ BTL_ASM_COMMENT("end atv");
92
+ }
93
+
94
+ void check_result( void )
95
+ {
96
+ if (_size>128) return;
97
+ Interface::vector_to_stl(X,resu_stl);
98
+
99
+ STL_interface<typename Interface::real_type>::atv_product(A_stl,B_stl,X_stl,_size);
100
+
101
+ typename Interface::real_type error=
102
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
103
+
104
+ if (error>1.e-6){
105
+ INFOS("WRONG CALCULATION...residual=" << error);
106
+ exit(1);
107
+ }
108
+ }
109
+
110
+ private :
111
+
112
+ typename Interface::stl_matrix A_stl;
113
+ typename Interface::stl_vector B_stl;
114
+ typename Interface::stl_vector X_stl;
115
+ typename Interface::stl_vector resu_stl;
116
+
117
+ typename Interface::gene_matrix A_ref;
118
+ typename Interface::gene_vector B_ref;
119
+ typename Interface::gene_vector X_ref;
120
+
121
+ typename Interface::gene_matrix A;
122
+ typename Interface::gene_vector B;
123
+ typename Interface::gene_vector X;
124
+
125
+
126
+ int _size;
127
+
128
+ };
129
+
130
+
131
+ #endif
132
+
133
+
134
+
include/eigen/bench/btl/actions/action_axpby.hh ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_axpby.hh
3
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
4
+ //=====================================================
5
+ //
6
+ // This program is free software; you can redistribute it and/or
7
+ // modify it under the terms of the GNU General Public License
8
+ // as published by the Free Software Foundation; either version 2
9
+ // of the License, or (at your option) any later version.
10
+ //
11
+ // This program is distributed in the hope that it will be useful,
12
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU General Public License for more details.
15
+ // You should have received a copy of the GNU General Public License
16
+ // along with this program; if not, write to the Free Software
17
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+ //
19
+ #ifndef ACTION_AXPBY
20
+ #define ACTION_AXPBY
21
+ #include "utilities.h"
22
+ #include "STL_interface.hh"
23
+ #include <string>
24
+ #include "init/init_function.hh"
25
+ #include "init/init_vector.hh"
26
+ #include "init/init_matrix.hh"
27
+
28
+ using namespace std;
29
+
30
+ template<class Interface>
31
+ class Action_axpby {
32
+
33
+ public :
34
+
35
+ // Ctor
36
+ Action_axpby( int size ):_alpha(0.5),_beta(0.95),_size(size)
37
+ {
38
+ MESSAGE("Action_axpby Ctor");
39
+
40
+ // STL vector initialization
41
+ init_vector<pseudo_random>(X_stl,_size);
42
+ init_vector<pseudo_random>(Y_stl,_size);
43
+ init_vector<null_function>(resu_stl,_size);
44
+
45
+ // generic matrix and vector initialization
46
+ Interface::vector_from_stl(X_ref,X_stl);
47
+ Interface::vector_from_stl(Y_ref,Y_stl);
48
+
49
+ Interface::vector_from_stl(X,X_stl);
50
+ Interface::vector_from_stl(Y,Y_stl);
51
+ }
52
+
53
+ // invalidate copy ctor
54
+ Action_axpby( const Action_axpby & )
55
+ {
56
+ INFOS("illegal call to Action_axpby Copy Ctor");
57
+ exit(1);
58
+ }
59
+
60
+ // Dtor
61
+ ~Action_axpby( void ){
62
+ MESSAGE("Action_axpby Dtor");
63
+
64
+ // deallocation
65
+ Interface::free_vector(X_ref);
66
+ Interface::free_vector(Y_ref);
67
+
68
+ Interface::free_vector(X);
69
+ Interface::free_vector(Y);
70
+ }
71
+
72
+ // action name
73
+ static inline std::string name( void )
74
+ {
75
+ return "axpby_"+Interface::name();
76
+ }
77
+
78
+ double nb_op_base( void ){
79
+ return 3.0*_size;
80
+ }
81
+
82
+ inline void initialize( void ){
83
+ Interface::copy_vector(X_ref,X,_size);
84
+ Interface::copy_vector(Y_ref,Y,_size);
85
+ }
86
+
87
+ inline void calculate( void ) {
88
+ BTL_ASM_COMMENT("mybegin axpby");
89
+ Interface::axpby(_alpha,X,_beta,Y,_size);
90
+ BTL_ASM_COMMENT("myend axpby");
91
+ }
92
+
93
+ void check_result( void ){
94
+ if (_size>128) return;
95
+ // calculation check
96
+ Interface::vector_to_stl(Y,resu_stl);
97
+
98
+ STL_interface<typename Interface::real_type>::axpby(_alpha,X_stl,_beta,Y_stl,_size);
99
+
100
+ typename Interface::real_type error=
101
+ STL_interface<typename Interface::real_type>::norm_diff(Y_stl,resu_stl);
102
+
103
+ if (error>1.e-6){
104
+ INFOS("WRONG CALCULATION...residual=" << error);
105
+ exit(2);
106
+ }
107
+ }
108
+
109
+ private :
110
+
111
+ typename Interface::stl_vector X_stl;
112
+ typename Interface::stl_vector Y_stl;
113
+ typename Interface::stl_vector resu_stl;
114
+
115
+ typename Interface::gene_vector X_ref;
116
+ typename Interface::gene_vector Y_ref;
117
+
118
+ typename Interface::gene_vector X;
119
+ typename Interface::gene_vector Y;
120
+
121
+ typename Interface::real_type _alpha;
122
+ typename Interface::real_type _beta;
123
+
124
+ int _size;
125
+ };
126
+
127
+ #endif
include/eigen/bench/btl/actions/action_axpy.hh ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_axpy.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_AXPY
21
+ #define ACTION_AXPY
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_axpy {
33
+
34
+ public :
35
+
36
+ // Ctor
37
+
38
+ Action_axpy( int size ):_coef(1.0),_size(size)
39
+ {
40
+ MESSAGE("Action_axpy Ctor");
41
+
42
+ // STL vector initialization
43
+
44
+ init_vector<pseudo_random>(X_stl,_size);
45
+ init_vector<pseudo_random>(Y_stl,_size);
46
+ init_vector<null_function>(resu_stl,_size);
47
+
48
+ // generic matrix and vector initialization
49
+
50
+ Interface::vector_from_stl(X_ref,X_stl);
51
+ Interface::vector_from_stl(Y_ref,Y_stl);
52
+
53
+ Interface::vector_from_stl(X,X_stl);
54
+ Interface::vector_from_stl(Y,Y_stl);
55
+
56
+
57
+ }
58
+
59
+ // invalidate copy ctor
60
+
61
+ Action_axpy( const Action_axpy & )
62
+ {
63
+ INFOS("illegal call to Action_axpy Copy Ctor");
64
+ exit(1);
65
+ }
66
+
67
+ // Dtor
68
+
69
+ ~Action_axpy( void ){
70
+
71
+ MESSAGE("Action_axpy Dtor");
72
+
73
+ // deallocation
74
+
75
+ Interface::free_vector(X_ref);
76
+ Interface::free_vector(Y_ref);
77
+
78
+ Interface::free_vector(X);
79
+ Interface::free_vector(Y);
80
+ }
81
+
82
+ // action name
83
+
84
+ static inline std::string name( void )
85
+ {
86
+ return "axpy_"+Interface::name();
87
+ }
88
+
89
+ double nb_op_base( void ){
90
+ return 2.0*_size;
91
+ }
92
+
93
+ inline void initialize( void ){
94
+ Interface::copy_vector(X_ref,X,_size);
95
+ Interface::copy_vector(Y_ref,Y,_size);
96
+ }
97
+
98
+ inline void calculate( void ) {
99
+ BTL_ASM_COMMENT("mybegin axpy");
100
+ Interface::axpy(_coef,X,Y,_size);
101
+ BTL_ASM_COMMENT("myend axpy");
102
+ }
103
+
104
+ void check_result( void ){
105
+ if (_size>128) return;
106
+ // calculation check
107
+
108
+ Interface::vector_to_stl(Y,resu_stl);
109
+
110
+ STL_interface<typename Interface::real_type>::axpy(_coef,X_stl,Y_stl,_size);
111
+
112
+ typename Interface::real_type error=
113
+ STL_interface<typename Interface::real_type>::norm_diff(Y_stl,resu_stl);
114
+
115
+ if (error>1.e-6){
116
+ INFOS("WRONG CALCULATION...residual=" << error);
117
+ exit(0);
118
+ }
119
+
120
+ }
121
+
122
+ private :
123
+
124
+ typename Interface::stl_vector X_stl;
125
+ typename Interface::stl_vector Y_stl;
126
+ typename Interface::stl_vector resu_stl;
127
+
128
+ typename Interface::gene_vector X_ref;
129
+ typename Interface::gene_vector Y_ref;
130
+
131
+ typename Interface::gene_vector X;
132
+ typename Interface::gene_vector Y;
133
+
134
+ typename Interface::real_type _coef;
135
+
136
+ int _size;
137
+ };
138
+
139
+ #endif
include/eigen/bench/btl/actions/action_cholesky.hh ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_cholesky.hh
3
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
4
+ //=====================================================
5
+ //
6
+ // This program is free software; you can redistribute it and/or
7
+ // modify it under the terms of the GNU General Public License
8
+ // as published by the Free Software Foundation; either version 2
9
+ // of the License, or (at your option) any later version.
10
+ //
11
+ // This program is distributed in the hope that it will be useful,
12
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU General Public License for more details.
15
+ // You should have received a copy of the GNU General Public License
16
+ // along with this program; if not, write to the Free Software
17
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+ //
19
+ #ifndef ACTION_CHOLESKY
20
+ #define ACTION_CHOLESKY
21
+ #include "utilities.h"
22
+ #include "STL_interface.hh"
23
+ #include <string>
24
+ #include "init/init_function.hh"
25
+ #include "init/init_vector.hh"
26
+ #include "init/init_matrix.hh"
27
+
28
+ using namespace std;
29
+
30
+ template<class Interface>
31
+ class Action_cholesky {
32
+
33
+ public :
34
+
35
+ // Ctor
36
+
37
+ Action_cholesky( int size ):_size(size)
38
+ {
39
+ MESSAGE("Action_cholesky Ctor");
40
+
41
+ // STL mat/vec initialization
42
+ init_matrix_symm<pseudo_random>(X_stl,_size);
43
+ init_matrix<null_function>(C_stl,_size);
44
+
45
+ // make sure X is invertible
46
+ for (int i=0; i<_size; ++i)
47
+ X_stl[i][i] = std::abs(X_stl[i][i]) * 1e2 + 100;
48
+
49
+ // generic matrix and vector initialization
50
+ Interface::matrix_from_stl(X_ref,X_stl);
51
+ Interface::matrix_from_stl(X,X_stl);
52
+ Interface::matrix_from_stl(C,C_stl);
53
+
54
+ _cost = 0;
55
+ for (int j=0; j<_size; ++j)
56
+ {
57
+ double r = std::max(_size - j -1,0);
58
+ _cost += 2*(r*j+r+j);
59
+ }
60
+ }
61
+
62
+ // invalidate copy ctor
63
+
64
+ Action_cholesky( const Action_cholesky & )
65
+ {
66
+ INFOS("illegal call to Action_cholesky Copy Ctor");
67
+ exit(1);
68
+ }
69
+
70
+ // Dtor
71
+
72
+ ~Action_cholesky( void ){
73
+
74
+ MESSAGE("Action_cholesky Dtor");
75
+
76
+ // deallocation
77
+ Interface::free_matrix(X_ref,_size);
78
+ Interface::free_matrix(X,_size);
79
+ Interface::free_matrix(C,_size);
80
+ }
81
+
82
+ // action name
83
+
84
+ static inline std::string name( void )
85
+ {
86
+ return "cholesky_"+Interface::name();
87
+ }
88
+
89
+ double nb_op_base( void ){
90
+ return _cost;
91
+ }
92
+
93
+ inline void initialize( void ){
94
+ Interface::copy_matrix(X_ref,X,_size);
95
+ }
96
+
97
+ inline void calculate( void ) {
98
+ Interface::cholesky(X,C,_size);
99
+ }
100
+
101
+ void check_result( void ){
102
+ // calculation check
103
+ // STL_interface<typename Interface::real_type>::cholesky(X_stl,C_stl,_size);
104
+ //
105
+ // typename Interface::real_type error=
106
+ // STL_interface<typename Interface::real_type>::norm_diff(C_stl,resu_stl);
107
+ //
108
+ // if (error>1.e-6){
109
+ // INFOS("WRONG CALCULATION...residual=" << error);
110
+ // exit(0);
111
+ // }
112
+
113
+ }
114
+
115
+ private :
116
+
117
+ typename Interface::stl_matrix X_stl;
118
+ typename Interface::stl_matrix C_stl;
119
+
120
+ typename Interface::gene_matrix X_ref;
121
+ typename Interface::gene_matrix X;
122
+ typename Interface::gene_matrix C;
123
+
124
+ int _size;
125
+ double _cost;
126
+ };
127
+
128
+ #endif
include/eigen/bench/btl/actions/action_ger.hh ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ // This program is free software; you can redistribute it and/or
3
+ // modify it under the terms of the GNU General Public License
4
+ // as published by the Free Software Foundation; either version 2
5
+ // of the License, or (at your option) any later version.
6
+ //
7
+ // This program is distributed in the hope that it will be useful,
8
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
+ // GNU General Public License for more details.
11
+ // You should have received a copy of the GNU General Public License
12
+ // along with this program; if not, write to the Free Software
13
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14
+ //
15
+ #ifndef ACTION_GER
16
+ #define ACTION_GER
17
+ #include "utilities.h"
18
+ #include "STL_interface.hh"
19
+ #include <string>
20
+ #include "init/init_function.hh"
21
+ #include "init/init_vector.hh"
22
+ #include "init/init_matrix.hh"
23
+
24
+ using namespace std;
25
+
26
+ template<class Interface>
27
+ class Action_ger {
28
+
29
+ public :
30
+
31
+ // Ctor
32
+ BTL_DONT_INLINE Action_ger( int size ):_size(size)
33
+ {
34
+ MESSAGE("Action_ger Ctor");
35
+
36
+ // STL matrix and vector initialization
37
+ typename Interface::stl_matrix tmp;
38
+ init_matrix<pseudo_random>(A_stl,_size);
39
+ init_vector<pseudo_random>(B_stl,_size);
40
+ init_vector<pseudo_random>(X_stl,_size);
41
+ init_vector<null_function>(resu_stl,_size);
42
+
43
+ // generic matrix and vector initialization
44
+ Interface::matrix_from_stl(A_ref,A_stl);
45
+ Interface::matrix_from_stl(A,A_stl);
46
+ Interface::vector_from_stl(B_ref,B_stl);
47
+ Interface::vector_from_stl(B,B_stl);
48
+ Interface::vector_from_stl(X_ref,X_stl);
49
+ Interface::vector_from_stl(X,X_stl);
50
+ }
51
+
52
+ // invalidate copy ctor
53
+ Action_ger( const Action_ger & )
54
+ {
55
+ INFOS("illegal call to Action_ger Copy Ctor");
56
+ exit(1);
57
+ }
58
+
59
+ // Dtor
60
+ BTL_DONT_INLINE ~Action_ger( void ){
61
+ MESSAGE("Action_ger Dtor");
62
+ Interface::free_matrix(A,_size);
63
+ Interface::free_vector(B);
64
+ Interface::free_vector(X);
65
+ Interface::free_matrix(A_ref,_size);
66
+ Interface::free_vector(B_ref);
67
+ Interface::free_vector(X_ref);
68
+
69
+ }
70
+
71
+ // action name
72
+ static inline std::string name( void )
73
+ {
74
+ return "ger_" + Interface::name();
75
+ }
76
+
77
+ double nb_op_base( void ){
78
+ return 2.0*_size*_size;
79
+ }
80
+
81
+ BTL_DONT_INLINE void initialize( void ){
82
+ Interface::copy_matrix(A_ref,A,_size);
83
+ Interface::copy_vector(B_ref,B,_size);
84
+ Interface::copy_vector(X_ref,X,_size);
85
+ }
86
+
87
+ BTL_DONT_INLINE void calculate( void ) {
88
+ BTL_ASM_COMMENT("#begin ger");
89
+ Interface::ger(A,B,X,_size);
90
+ BTL_ASM_COMMENT("end ger");
91
+ }
92
+
93
+ BTL_DONT_INLINE void check_result( void ){
94
+ // calculation check
95
+ Interface::vector_to_stl(X,resu_stl);
96
+
97
+ STL_interface<typename Interface::real_type>::ger(A_stl,B_stl,X_stl,_size);
98
+
99
+ typename Interface::real_type error=
100
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
101
+
102
+ if (error>1.e-3){
103
+ INFOS("WRONG CALCULATION...residual=" << error);
104
+ // exit(0);
105
+ }
106
+
107
+ }
108
+
109
+ private :
110
+
111
+ typename Interface::stl_matrix A_stl;
112
+ typename Interface::stl_vector B_stl;
113
+ typename Interface::stl_vector X_stl;
114
+ typename Interface::stl_vector resu_stl;
115
+
116
+ typename Interface::gene_matrix A_ref;
117
+ typename Interface::gene_vector B_ref;
118
+ typename Interface::gene_vector X_ref;
119
+
120
+ typename Interface::gene_matrix A;
121
+ typename Interface::gene_vector B;
122
+ typename Interface::gene_vector X;
123
+
124
+ int _size;
125
+ };
126
+
127
+
128
+ #endif
include/eigen/bench/btl/actions/action_hessenberg.hh ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_hessenberg.hh
3
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
4
+ //=====================================================
5
+ //
6
+ // This program is free software; you can redistribute it and/or
7
+ // modify it under the terms of the GNU General Public License
8
+ // as published by the Free Software Foundation; either version 2
9
+ // of the License, or (at your option) any later version.
10
+ //
11
+ // This program is distributed in the hope that it will be useful,
12
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU General Public License for more details.
15
+ // You should have received a copy of the GNU General Public License
16
+ // along with this program; if not, write to the Free Software
17
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+ //
19
+ #ifndef ACTION_HESSENBERG
20
+ #define ACTION_HESSENBERG
21
+ #include "utilities.h"
22
+ #include "STL_interface.hh"
23
+ #include <string>
24
+ #include "init/init_function.hh"
25
+ #include "init/init_vector.hh"
26
+ #include "init/init_matrix.hh"
27
+
28
+ using namespace std;
29
+
30
+ template<class Interface>
31
+ class Action_hessenberg {
32
+
33
+ public :
34
+
35
+ // Ctor
36
+
37
+ Action_hessenberg( int size ):_size(size)
38
+ {
39
+ MESSAGE("Action_hessenberg Ctor");
40
+
41
+ // STL vector initialization
42
+ init_matrix<pseudo_random>(X_stl,_size);
43
+
44
+ init_matrix<null_function>(C_stl,_size);
45
+ init_matrix<null_function>(resu_stl,_size);
46
+
47
+ // generic matrix and vector initialization
48
+ Interface::matrix_from_stl(X_ref,X_stl);
49
+ Interface::matrix_from_stl(X,X_stl);
50
+ Interface::matrix_from_stl(C,C_stl);
51
+
52
+ _cost = 0;
53
+ for (int j=0; j<_size-2; ++j)
54
+ {
55
+ double r = std::max(0,_size-j-1);
56
+ double b = std::max(0,_size-j-2);
57
+ _cost += 6 + 3*b + r*r*4 + r*_size*4;
58
+ }
59
+ }
60
+
61
+ // invalidate copy ctor
62
+
63
+ Action_hessenberg( const Action_hessenberg & )
64
+ {
65
+ INFOS("illegal call to Action_hessenberg Copy Ctor");
66
+ exit(1);
67
+ }
68
+
69
+ // Dtor
70
+
71
+ ~Action_hessenberg( void ){
72
+
73
+ MESSAGE("Action_hessenberg Dtor");
74
+
75
+ // deallocation
76
+ Interface::free_matrix(X_ref,_size);
77
+ Interface::free_matrix(X,_size);
78
+ Interface::free_matrix(C,_size);
79
+ }
80
+
81
+ // action name
82
+
83
+ static inline std::string name( void )
84
+ {
85
+ return "hessenberg_"+Interface::name();
86
+ }
87
+
88
+ double nb_op_base( void ){
89
+ return _cost;
90
+ }
91
+
92
+ inline void initialize( void ){
93
+ Interface::copy_matrix(X_ref,X,_size);
94
+ }
95
+
96
+ inline void calculate( void ) {
97
+ Interface::hessenberg(X,C,_size);
98
+ }
99
+
100
+ void check_result( void ){
101
+ // calculation check
102
+ Interface::matrix_to_stl(C,resu_stl);
103
+
104
+ // STL_interface<typename Interface::real_type>::hessenberg(X_stl,C_stl,_size);
105
+ //
106
+ // typename Interface::real_type error=
107
+ // STL_interface<typename Interface::real_type>::norm_diff(C_stl,resu_stl);
108
+ //
109
+ // if (error>1.e-6){
110
+ // INFOS("WRONG CALCULATION...residual=" << error);
111
+ // exit(0);
112
+ // }
113
+
114
+ }
115
+
116
+ private :
117
+
118
+ typename Interface::stl_matrix X_stl;
119
+ typename Interface::stl_matrix C_stl;
120
+ typename Interface::stl_matrix resu_stl;
121
+
122
+ typename Interface::gene_matrix X_ref;
123
+ typename Interface::gene_matrix X;
124
+ typename Interface::gene_matrix C;
125
+
126
+ int _size;
127
+ double _cost;
128
+ };
129
+
130
+ template<class Interface>
131
+ class Action_tridiagonalization {
132
+
133
+ public :
134
+
135
+ // Ctor
136
+
137
+ Action_tridiagonalization( int size ):_size(size)
138
+ {
139
+ MESSAGE("Action_tridiagonalization Ctor");
140
+
141
+ // STL vector initialization
142
+ init_matrix<pseudo_random>(X_stl,_size);
143
+
144
+ for(int i=0; i<_size; ++i)
145
+ {
146
+ for(int j=0; j<i; ++j)
147
+ X_stl[i][j] = X_stl[j][i];
148
+ }
149
+
150
+ init_matrix<null_function>(C_stl,_size);
151
+ init_matrix<null_function>(resu_stl,_size);
152
+
153
+ // generic matrix and vector initialization
154
+ Interface::matrix_from_stl(X_ref,X_stl);
155
+ Interface::matrix_from_stl(X,X_stl);
156
+ Interface::matrix_from_stl(C,C_stl);
157
+
158
+ _cost = 0;
159
+ for (int j=0; j<_size-2; ++j)
160
+ {
161
+ double r = std::max(0,_size-j-1);
162
+ double b = std::max(0,_size-j-2);
163
+ _cost += 6. + 3.*b + r*r*8.;
164
+ }
165
+ }
166
+
167
+ // invalidate copy ctor
168
+
169
+ Action_tridiagonalization( const Action_tridiagonalization & )
170
+ {
171
+ INFOS("illegal call to Action_tridiagonalization Copy Ctor");
172
+ exit(1);
173
+ }
174
+
175
+ // Dtor
176
+
177
+ ~Action_tridiagonalization( void ){
178
+
179
+ MESSAGE("Action_tridiagonalization Dtor");
180
+
181
+ // deallocation
182
+ Interface::free_matrix(X_ref,_size);
183
+ Interface::free_matrix(X,_size);
184
+ Interface::free_matrix(C,_size);
185
+ }
186
+
187
+ // action name
188
+
189
+ static inline std::string name( void ) { return "tridiagonalization_"+Interface::name(); }
190
+
191
+ double nb_op_base( void ){
192
+ return _cost;
193
+ }
194
+
195
+ inline void initialize( void ){
196
+ Interface::copy_matrix(X_ref,X,_size);
197
+ }
198
+
199
+ inline void calculate( void ) {
200
+ Interface::tridiagonalization(X,C,_size);
201
+ }
202
+
203
+ void check_result( void ){
204
+ // calculation check
205
+ Interface::matrix_to_stl(C,resu_stl);
206
+
207
+ // STL_interface<typename Interface::real_type>::tridiagonalization(X_stl,C_stl,_size);
208
+ //
209
+ // typename Interface::real_type error=
210
+ // STL_interface<typename Interface::real_type>::norm_diff(C_stl,resu_stl);
211
+ //
212
+ // if (error>1.e-6){
213
+ // INFOS("WRONG CALCULATION...residual=" << error);
214
+ // exit(0);
215
+ // }
216
+
217
+ }
218
+
219
+ private :
220
+
221
+ typename Interface::stl_matrix X_stl;
222
+ typename Interface::stl_matrix C_stl;
223
+ typename Interface::stl_matrix resu_stl;
224
+
225
+ typename Interface::gene_matrix X_ref;
226
+ typename Interface::gene_matrix X;
227
+ typename Interface::gene_matrix C;
228
+
229
+ int _size;
230
+ double _cost;
231
+ };
232
+
233
+ #endif
include/eigen/bench/btl/actions/action_lu_decomp.hh ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_lu_decomp.hh
3
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
4
+ //=====================================================
5
+ //
6
+ // This program is free software; you can redistribute it and/or
7
+ // modify it under the terms of the GNU General Public License
8
+ // as published by the Free Software Foundation; either version 2
9
+ // of the License, or (at your option) any later version.
10
+ //
11
+ // This program is distributed in the hope that it will be useful,
12
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU General Public License for more details.
15
+ // You should have received a copy of the GNU General Public License
16
+ // along with this program; if not, write to the Free Software
17
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+ //
19
+ #ifndef ACTION_LU_DECOMP
20
+ #define ACTION_LU_DECOMP
21
+ #include "utilities.h"
22
+ #include "STL_interface.hh"
23
+ #include <string>
24
+ #include "init/init_function.hh"
25
+ #include "init/init_vector.hh"
26
+ #include "init/init_matrix.hh"
27
+
28
+ using namespace std;
29
+
30
+ template<class Interface>
31
+ class Action_lu_decomp {
32
+
33
+ public :
34
+
35
+ // Ctor
36
+
37
+ Action_lu_decomp( int size ):_size(size)
38
+ {
39
+ MESSAGE("Action_lu_decomp Ctor");
40
+
41
+ // STL vector initialization
42
+ init_matrix<pseudo_random>(X_stl,_size);
43
+
44
+ init_matrix<null_function>(C_stl,_size);
45
+ init_matrix<null_function>(resu_stl,_size);
46
+
47
+ // generic matrix and vector initialization
48
+ Interface::matrix_from_stl(X_ref,X_stl);
49
+ Interface::matrix_from_stl(X,X_stl);
50
+ Interface::matrix_from_stl(C,C_stl);
51
+
52
+ _cost = 2.0*size*size*size/3.0 + size*size;
53
+ }
54
+
55
+ // invalidate copy ctor
56
+
57
+ Action_lu_decomp( const Action_lu_decomp & )
58
+ {
59
+ INFOS("illegal call to Action_lu_decomp Copy Ctor");
60
+ exit(1);
61
+ }
62
+
63
+ // Dtor
64
+
65
+ ~Action_lu_decomp( void ){
66
+
67
+ MESSAGE("Action_lu_decomp Dtor");
68
+
69
+ // deallocation
70
+ Interface::free_matrix(X_ref,_size);
71
+ Interface::free_matrix(X,_size);
72
+ Interface::free_matrix(C,_size);
73
+ }
74
+
75
+ // action name
76
+
77
+ static inline std::string name( void )
78
+ {
79
+ return "complete_lu_decomp_"+Interface::name();
80
+ }
81
+
82
+ double nb_op_base( void ){
83
+ return _cost;
84
+ }
85
+
86
+ inline void initialize( void ){
87
+ Interface::copy_matrix(X_ref,X,_size);
88
+ }
89
+
90
+ inline void calculate( void ) {
91
+ Interface::lu_decomp(X,C,_size);
92
+ }
93
+
94
+ void check_result( void ){
95
+ // calculation check
96
+ Interface::matrix_to_stl(C,resu_stl);
97
+
98
+ // STL_interface<typename Interface::real_type>::lu_decomp(X_stl,C_stl,_size);
99
+ //
100
+ // typename Interface::real_type error=
101
+ // STL_interface<typename Interface::real_type>::norm_diff(C_stl,resu_stl);
102
+ //
103
+ // if (error>1.e-6){
104
+ // INFOS("WRONG CALCULATION...residual=" << error);
105
+ // exit(0);
106
+ // }
107
+
108
+ }
109
+
110
+ private :
111
+
112
+ typename Interface::stl_matrix X_stl;
113
+ typename Interface::stl_matrix C_stl;
114
+ typename Interface::stl_matrix resu_stl;
115
+
116
+ typename Interface::gene_matrix X_ref;
117
+ typename Interface::gene_matrix X;
118
+ typename Interface::gene_matrix C;
119
+
120
+ int _size;
121
+ double _cost;
122
+ };
123
+
124
+ #endif
include/eigen/bench/btl/actions/action_lu_solve.hh ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_lu_solve.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_LU_SOLVE
21
+ #define ACTION_LU_SOLVE
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_lu_solve
33
+ {
34
+
35
+ public :
36
+
37
+ static inline std::string name( void )
38
+ {
39
+ return "lu_solve_"+Interface::name();
40
+ }
41
+
42
+ static double nb_op_base(int size){
43
+ return 2.0*size*size*size/3.0; // questionable but not really important
44
+ }
45
+
46
+
47
+ static double calculate( int nb_calc, int size ) {
48
+
49
+ // STL matrix and vector initialization
50
+
51
+ typename Interface::stl_matrix A_stl;
52
+ typename Interface::stl_vector B_stl;
53
+ typename Interface::stl_vector X_stl;
54
+
55
+ init_matrix<pseudo_random>(A_stl,size);
56
+ init_vector<pseudo_random>(B_stl,size);
57
+ init_vector<null_function>(X_stl,size);
58
+
59
+ // generic matrix and vector initialization
60
+
61
+ typename Interface::gene_matrix A;
62
+ typename Interface::gene_vector B;
63
+ typename Interface::gene_vector X;
64
+
65
+ typename Interface::gene_matrix LU;
66
+
67
+ Interface::matrix_from_stl(A,A_stl);
68
+ Interface::vector_from_stl(B,B_stl);
69
+ Interface::vector_from_stl(X,X_stl);
70
+ Interface::matrix_from_stl(LU,A_stl);
71
+
72
+ // local variable :
73
+
74
+ typename Interface::Pivot_Vector pivot; // pivot vector
75
+ Interface::new_Pivot_Vector(pivot,size);
76
+
77
+ // timer utilities
78
+
79
+ Portable_Timer chronos;
80
+
81
+ // time measurement
82
+
83
+ chronos.start();
84
+
85
+ for (int ii=0;ii<nb_calc;ii++){
86
+
87
+ // LU factorization
88
+ Interface::copy_matrix(A,LU,size);
89
+ Interface::LU_factor(LU,pivot,size);
90
+
91
+ // LU solve
92
+
93
+ Interface::LU_solve(LU,pivot,B,X,size);
94
+
95
+ }
96
+
97
+ // Time stop
98
+
99
+ chronos.stop();
100
+
101
+ double time=chronos.user_time();
102
+
103
+ // check result :
104
+
105
+ typename Interface::stl_vector B_new_stl(size);
106
+ Interface::vector_to_stl(X,X_stl);
107
+
108
+ STL_interface<typename Interface::real_type>::matrix_vector_product(A_stl,X_stl,B_new_stl,size);
109
+
110
+ typename Interface::real_type error=
111
+ STL_interface<typename Interface::real_type>::norm_diff(B_stl,B_new_stl);
112
+
113
+ if (error>1.e-5){
114
+ INFOS("WRONG CALCULATION...residual=" << error);
115
+ STL_interface<typename Interface::real_type>::display_vector(B_stl);
116
+ STL_interface<typename Interface::real_type>::display_vector(B_new_stl);
117
+ exit(0);
118
+ }
119
+
120
+ // deallocation and return time
121
+
122
+ Interface::free_matrix(A,size);
123
+ Interface::free_vector(B);
124
+ Interface::free_vector(X);
125
+ Interface::free_Pivot_Vector(pivot);
126
+
127
+ return time;
128
+ }
129
+
130
+ };
131
+
132
+
133
+ #endif
134
+
135
+
136
+
include/eigen/bench/btl/actions/action_matrix_matrix_product.hh ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_matrix_matrix_product.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_MATRIX_MATRIX_PRODUCT
21
+ #define ACTION_MATRIX_MATRIX_PRODUCT
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_matrix_matrix_product {
33
+
34
+ public :
35
+
36
+ // Ctor
37
+
38
+ Action_matrix_matrix_product( int size ):_size(size)
39
+ {
40
+ MESSAGE("Action_matrix_matrix_product Ctor");
41
+
42
+ // STL matrix and vector initialization
43
+
44
+ init_matrix<pseudo_random>(A_stl,_size);
45
+ init_matrix<pseudo_random>(B_stl,_size);
46
+ init_matrix<null_function>(X_stl,_size);
47
+ init_matrix<null_function>(resu_stl,_size);
48
+
49
+ // generic matrix and vector initialization
50
+
51
+ Interface::matrix_from_stl(A_ref,A_stl);
52
+ Interface::matrix_from_stl(B_ref,B_stl);
53
+ Interface::matrix_from_stl(X_ref,X_stl);
54
+
55
+ Interface::matrix_from_stl(A,A_stl);
56
+ Interface::matrix_from_stl(B,B_stl);
57
+ Interface::matrix_from_stl(X,X_stl);
58
+
59
+ }
60
+
61
+ // invalidate copy ctor
62
+
63
+ Action_matrix_matrix_product( const Action_matrix_matrix_product & )
64
+ {
65
+ INFOS("illegal call to Action_matrix_matrix_product Copy Ctor");
66
+ exit(0);
67
+ }
68
+
69
+ // Dtor
70
+
71
+ ~Action_matrix_matrix_product( void ){
72
+
73
+ MESSAGE("Action_matrix_matrix_product Dtor");
74
+
75
+ // deallocation
76
+
77
+ Interface::free_matrix(A,_size);
78
+ Interface::free_matrix(B,_size);
79
+ Interface::free_matrix(X,_size);
80
+
81
+ Interface::free_matrix(A_ref,_size);
82
+ Interface::free_matrix(B_ref,_size);
83
+ Interface::free_matrix(X_ref,_size);
84
+
85
+ }
86
+
87
+ // action name
88
+
89
+ static inline std::string name( void )
90
+ {
91
+ return "matrix_matrix_"+Interface::name();
92
+ }
93
+
94
+ double nb_op_base( void ){
95
+ return 2.0*_size*_size*_size;
96
+ }
97
+
98
+ inline void initialize( void ){
99
+
100
+ Interface::copy_matrix(A_ref,A,_size);
101
+ Interface::copy_matrix(B_ref,B,_size);
102
+ Interface::copy_matrix(X_ref,X,_size);
103
+
104
+ }
105
+
106
+ inline void calculate( void ) {
107
+ Interface::matrix_matrix_product(A,B,X,_size);
108
+ }
109
+
110
+ void check_result( void ){
111
+
112
+ // calculation check
113
+ if (_size<200)
114
+ {
115
+ Interface::matrix_to_stl(X,resu_stl);
116
+ STL_interface<typename Interface::real_type>::matrix_matrix_product(A_stl,B_stl,X_stl,_size);
117
+ typename Interface::real_type error=
118
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
119
+ if (error>1.e-6){
120
+ INFOS("WRONG CALCULATION...residual=" << error);
121
+ exit(1);
122
+ }
123
+ }
124
+ }
125
+
126
+ private :
127
+
128
+ typename Interface::stl_matrix A_stl;
129
+ typename Interface::stl_matrix B_stl;
130
+ typename Interface::stl_matrix X_stl;
131
+ typename Interface::stl_matrix resu_stl;
132
+
133
+ typename Interface::gene_matrix A_ref;
134
+ typename Interface::gene_matrix B_ref;
135
+ typename Interface::gene_matrix X_ref;
136
+
137
+ typename Interface::gene_matrix A;
138
+ typename Interface::gene_matrix B;
139
+ typename Interface::gene_matrix X;
140
+
141
+
142
+ int _size;
143
+
144
+ };
145
+
146
+
147
+ #endif
148
+
149
+
150
+
include/eigen/bench/btl/actions/action_matrix_matrix_product_bis.hh ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_matrix_matrix_product_bis.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_MATRIX_MATRIX_PRODUCT_BIS
21
+ #define ACTION_MATRIX_MATRIX_PRODUCT_BIS
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include "STL_timer.hh"
25
+ #include <string>
26
+ #include "init_function.hh"
27
+ #include "init_vector.hh"
28
+ #include "init_matrix.hh"
29
+
30
+ using namespace std;
31
+
32
+ template<class Interface>
33
+ class Action_matrix_matrix_product_bis {
34
+
35
+ public :
36
+
37
+ static inline std::string name( void )
38
+ {
39
+ return "matrix_matrix_"+Interface::name();
40
+ }
41
+
42
+ static double nb_op_base(int size){
43
+ return 2.0*size*size*size;
44
+ }
45
+
46
+ static double calculate( int nb_calc, int size ) {
47
+
48
+ // STL matrix and vector initialization
49
+
50
+ typename Interface::stl_matrix A_stl;
51
+ typename Interface::stl_matrix B_stl;
52
+ typename Interface::stl_matrix X_stl;
53
+
54
+ init_matrix<pseudo_random>(A_stl,size);
55
+ init_matrix<pseudo_random>(B_stl,size);
56
+ init_matrix<null_function>(X_stl,size);
57
+
58
+ // generic matrix and vector initialization
59
+
60
+ typename Interface::gene_matrix A_ref;
61
+ typename Interface::gene_matrix B_ref;
62
+ typename Interface::gene_matrix X_ref;
63
+
64
+ typename Interface::gene_matrix A;
65
+ typename Interface::gene_matrix B;
66
+ typename Interface::gene_matrix X;
67
+
68
+
69
+ Interface::matrix_from_stl(A_ref,A_stl);
70
+ Interface::matrix_from_stl(B_ref,B_stl);
71
+ Interface::matrix_from_stl(X_ref,X_stl);
72
+
73
+ Interface::matrix_from_stl(A,A_stl);
74
+ Interface::matrix_from_stl(B,B_stl);
75
+ Interface::matrix_from_stl(X,X_stl);
76
+
77
+
78
+ // STL_timer utilities
79
+
80
+ STL_timer chronos;
81
+
82
+ // Baseline evaluation
83
+
84
+ chronos.start_baseline(nb_calc);
85
+
86
+ do {
87
+
88
+ Interface::copy_matrix(A_ref,A,size);
89
+ Interface::copy_matrix(B_ref,B,size);
90
+ Interface::copy_matrix(X_ref,X,size);
91
+
92
+
93
+ // Interface::matrix_matrix_product(A,B,X,size); This line must be commented !!!!
94
+ }
95
+ while(chronos.check());
96
+
97
+ chronos.report(true);
98
+
99
+ // Time measurement
100
+
101
+ chronos.start(nb_calc);
102
+
103
+ do {
104
+
105
+ Interface::copy_matrix(A_ref,A,size);
106
+ Interface::copy_matrix(B_ref,B,size);
107
+ Interface::copy_matrix(X_ref,X,size);
108
+
109
+ Interface::matrix_matrix_product(A,B,X,size); // here it is not commented !!!!
110
+ }
111
+ while(chronos.check());
112
+
113
+ chronos.report(true);
114
+
115
+ double time=chronos.calculated_time/2000.0;
116
+
117
+ // calculation check
118
+
119
+ typename Interface::stl_matrix resu_stl(size);
120
+
121
+ Interface::matrix_to_stl(X,resu_stl);
122
+
123
+ STL_interface<typename Interface::real_type>::matrix_matrix_product(A_stl,B_stl,X_stl,size);
124
+
125
+ typename Interface::real_type error=
126
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
127
+
128
+ if (error>1.e-6){
129
+ INFOS("WRONG CALCULATION...residual=" << error);
130
+ exit(1);
131
+ }
132
+
133
+ // deallocation and return time
134
+
135
+ Interface::free_matrix(A,size);
136
+ Interface::free_matrix(B,size);
137
+ Interface::free_matrix(X,size);
138
+
139
+ Interface::free_matrix(A_ref,size);
140
+ Interface::free_matrix(B_ref,size);
141
+ Interface::free_matrix(X_ref,size);
142
+
143
+ return time;
144
+ }
145
+
146
+ };
147
+
148
+
149
+ #endif
150
+
151
+
152
+
include/eigen/bench/btl/actions/action_matrix_vector_product.hh ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_matrix_vector_product.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_MATRIX_VECTOR_PRODUCT
21
+ #define ACTION_MATRIX_VECTOR_PRODUCT
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_matrix_vector_product {
33
+
34
+ public :
35
+
36
+ // Ctor
37
+
38
+ BTL_DONT_INLINE Action_matrix_vector_product( int size ):_size(size)
39
+ {
40
+ MESSAGE("Action_matrix_vector_product Ctor");
41
+
42
+ // STL matrix and vector initialization
43
+
44
+ init_matrix<pseudo_random>(A_stl,_size);
45
+ init_vector<pseudo_random>(B_stl,_size);
46
+ init_vector<null_function>(X_stl,_size);
47
+ init_vector<null_function>(resu_stl,_size);
48
+
49
+ // generic matrix and vector initialization
50
+
51
+ Interface::matrix_from_stl(A_ref,A_stl);
52
+ Interface::matrix_from_stl(A,A_stl);
53
+ Interface::vector_from_stl(B_ref,B_stl);
54
+ Interface::vector_from_stl(B,B_stl);
55
+ Interface::vector_from_stl(X_ref,X_stl);
56
+ Interface::vector_from_stl(X,X_stl);
57
+
58
+ }
59
+
60
+ // invalidate copy ctor
61
+
62
+ Action_matrix_vector_product( const Action_matrix_vector_product & )
63
+ {
64
+ INFOS("illegal call to Action_matrix_vector_product Copy Ctor");
65
+ exit(1);
66
+ }
67
+
68
+ // Dtor
69
+
70
+ BTL_DONT_INLINE ~Action_matrix_vector_product( void ){
71
+
72
+ MESSAGE("Action_matrix_vector_product Dtor");
73
+
74
+ // deallocation
75
+
76
+ Interface::free_matrix(A,_size);
77
+ Interface::free_vector(B);
78
+ Interface::free_vector(X);
79
+
80
+ Interface::free_matrix(A_ref,_size);
81
+ Interface::free_vector(B_ref);
82
+ Interface::free_vector(X_ref);
83
+
84
+ }
85
+
86
+ // action name
87
+
88
+ static inline std::string name( void )
89
+ {
90
+ return "matrix_vector_" + Interface::name();
91
+ }
92
+
93
+ double nb_op_base( void ){
94
+ return 2.0*_size*_size;
95
+ }
96
+
97
+ BTL_DONT_INLINE void initialize( void ){
98
+
99
+ Interface::copy_matrix(A_ref,A,_size);
100
+ Interface::copy_vector(B_ref,B,_size);
101
+ Interface::copy_vector(X_ref,X,_size);
102
+
103
+ }
104
+
105
+ BTL_DONT_INLINE void calculate( void ) {
106
+ BTL_ASM_COMMENT("#begin matrix_vector_product");
107
+ Interface::matrix_vector_product(A,B,X,_size);
108
+ BTL_ASM_COMMENT("end matrix_vector_product");
109
+ }
110
+
111
+ BTL_DONT_INLINE void check_result( void ){
112
+
113
+ // calculation check
114
+
115
+ Interface::vector_to_stl(X,resu_stl);
116
+
117
+ STL_interface<typename Interface::real_type>::matrix_vector_product(A_stl,B_stl,X_stl,_size);
118
+
119
+ typename Interface::real_type error=
120
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
121
+
122
+ if (error>1.e-5){
123
+ INFOS("WRONG CALCULATION...residual=" << error);
124
+ exit(0);
125
+ }
126
+
127
+ }
128
+
129
+ private :
130
+
131
+ typename Interface::stl_matrix A_stl;
132
+ typename Interface::stl_vector B_stl;
133
+ typename Interface::stl_vector X_stl;
134
+ typename Interface::stl_vector resu_stl;
135
+
136
+ typename Interface::gene_matrix A_ref;
137
+ typename Interface::gene_vector B_ref;
138
+ typename Interface::gene_vector X_ref;
139
+
140
+ typename Interface::gene_matrix A;
141
+ typename Interface::gene_vector B;
142
+ typename Interface::gene_vector X;
143
+
144
+
145
+ int _size;
146
+
147
+ };
148
+
149
+
150
+ #endif
151
+
152
+
153
+
include/eigen/bench/btl/actions/action_partial_lu.hh ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_lu_decomp.hh
3
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
4
+ //=====================================================
5
+ //
6
+ // This program is free software; you can redistribute it and/or
7
+ // modify it under the terms of the GNU General Public License
8
+ // as published by the Free Software Foundation; either version 2
9
+ // of the License, or (at your option) any later version.
10
+ //
11
+ // This program is distributed in the hope that it will be useful,
12
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU General Public License for more details.
15
+ // You should have received a copy of the GNU General Public License
16
+ // along with this program; if not, write to the Free Software
17
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+ //
19
+ #ifndef ACTION_PARTIAL_LU
20
+ #define ACTION_PARTIAL_LU
21
+ #include "utilities.h"
22
+ #include "STL_interface.hh"
23
+ #include <string>
24
+ #include "init/init_function.hh"
25
+ #include "init/init_vector.hh"
26
+ #include "init/init_matrix.hh"
27
+
28
+ using namespace std;
29
+
30
+ template<class Interface>
31
+ class Action_partial_lu {
32
+
33
+ public :
34
+
35
+ // Ctor
36
+
37
+ Action_partial_lu( int size ):_size(size)
38
+ {
39
+ MESSAGE("Action_partial_lu Ctor");
40
+
41
+ // STL vector initialization
42
+ init_matrix<pseudo_random>(X_stl,_size);
43
+ init_matrix<null_function>(C_stl,_size);
44
+
45
+ // make sure X is invertible
46
+ for (int i=0; i<_size; ++i)
47
+ X_stl[i][i] = X_stl[i][i] * 1e2 + 1;
48
+
49
+ // generic matrix and vector initialization
50
+ Interface::matrix_from_stl(X_ref,X_stl);
51
+ Interface::matrix_from_stl(X,X_stl);
52
+ Interface::matrix_from_stl(C,C_stl);
53
+
54
+ _cost = 2.0*size*size*size/3.0 + size*size;
55
+ }
56
+
57
+ // invalidate copy ctor
58
+
59
+ Action_partial_lu( const Action_partial_lu & )
60
+ {
61
+ INFOS("illegal call to Action_partial_lu Copy Ctor");
62
+ exit(1);
63
+ }
64
+
65
+ // Dtor
66
+
67
+ ~Action_partial_lu( void ){
68
+
69
+ MESSAGE("Action_partial_lu Dtor");
70
+
71
+ // deallocation
72
+ Interface::free_matrix(X_ref,_size);
73
+ Interface::free_matrix(X,_size);
74
+ Interface::free_matrix(C,_size);
75
+ }
76
+
77
+ // action name
78
+
79
+ static inline std::string name( void )
80
+ {
81
+ return "partial_lu_decomp_"+Interface::name();
82
+ }
83
+
84
+ double nb_op_base( void ){
85
+ return _cost;
86
+ }
87
+
88
+ inline void initialize( void ){
89
+ Interface::copy_matrix(X_ref,X,_size);
90
+ }
91
+
92
+ inline void calculate( void ) {
93
+ Interface::partial_lu_decomp(X,C,_size);
94
+ }
95
+
96
+ void check_result( void ){
97
+ // calculation check
98
+ // Interface::matrix_to_stl(C,resu_stl);
99
+
100
+ // STL_interface<typename Interface::real_type>::lu_decomp(X_stl,C_stl,_size);
101
+ //
102
+ // typename Interface::real_type error=
103
+ // STL_interface<typename Interface::real_type>::norm_diff(C_stl,resu_stl);
104
+ //
105
+ // if (error>1.e-6){
106
+ // INFOS("WRONG CALCULATION...residual=" << error);
107
+ // exit(0);
108
+ // }
109
+
110
+ }
111
+
112
+ private :
113
+
114
+ typename Interface::stl_matrix X_stl;
115
+ typename Interface::stl_matrix C_stl;
116
+
117
+ typename Interface::gene_matrix X_ref;
118
+ typename Interface::gene_matrix X;
119
+ typename Interface::gene_matrix C;
120
+
121
+ int _size;
122
+ double _cost;
123
+ };
124
+
125
+ #endif
include/eigen/bench/btl/actions/action_rot.hh ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ // This program is free software; you can redistribute it and/or
3
+ // modify it under the terms of the GNU General Public License
4
+ // as published by the Free Software Foundation; either version 2
5
+ // of the License, or (at your option) any later version.
6
+ //
7
+ // This program is distributed in the hope that it will be useful,
8
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
+ // GNU General Public License for more details.
11
+ // You should have received a copy of the GNU General Public License
12
+ // along with this program; if not, write to the Free Software
13
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14
+ //
15
+ #ifndef ACTION_ROT
16
+ #define ACTION_ROT
17
+ #include "utilities.h"
18
+ #include "STL_interface.hh"
19
+ #include <string>
20
+ #include "init/init_function.hh"
21
+ #include "init/init_vector.hh"
22
+ #include "init/init_matrix.hh"
23
+
24
+ using namespace std;
25
+
26
+ template<class Interface>
27
+ class Action_rot {
28
+
29
+ public :
30
+
31
+ // Ctor
32
+ BTL_DONT_INLINE Action_rot( int size ):_size(size)
33
+ {
34
+ MESSAGE("Action_rot Ctor");
35
+
36
+ // STL matrix and vector initialization
37
+ typename Interface::stl_matrix tmp;
38
+ init_vector<pseudo_random>(A_stl,_size);
39
+ init_vector<pseudo_random>(B_stl,_size);
40
+
41
+ // generic matrix and vector initialization
42
+ Interface::vector_from_stl(A_ref,A_stl);
43
+ Interface::vector_from_stl(A,A_stl);
44
+ Interface::vector_from_stl(B_ref,B_stl);
45
+ Interface::vector_from_stl(B,B_stl);
46
+ }
47
+
48
+ // invalidate copy ctor
49
+ Action_rot( const Action_rot & )
50
+ {
51
+ INFOS("illegal call to Action_rot Copy Ctor");
52
+ exit(1);
53
+ }
54
+
55
+ // Dtor
56
+ BTL_DONT_INLINE ~Action_rot( void ){
57
+ MESSAGE("Action_rot Dtor");
58
+ Interface::free_vector(A);
59
+ Interface::free_vector(B);
60
+ Interface::free_vector(A_ref);
61
+ Interface::free_vector(B_ref);
62
+ }
63
+
64
+ // action name
65
+ static inline std::string name( void )
66
+ {
67
+ return "rot_" + Interface::name();
68
+ }
69
+
70
+ double nb_op_base( void ){
71
+ return 6.0*_size;
72
+ }
73
+
74
+ BTL_DONT_INLINE void initialize( void ){
75
+ Interface::copy_vector(A_ref,A,_size);
76
+ Interface::copy_vector(B_ref,B,_size);
77
+ }
78
+
79
+ BTL_DONT_INLINE void calculate( void ) {
80
+ BTL_ASM_COMMENT("#begin rot");
81
+ Interface::rot(A,B,0.5,0.6,_size);
82
+ BTL_ASM_COMMENT("end rot");
83
+ }
84
+
85
+ BTL_DONT_INLINE void check_result( void ){
86
+ // calculation check
87
+ // Interface::vector_to_stl(X,resu_stl);
88
+
89
+ // STL_interface<typename Interface::real_type>::rot(A_stl,B_stl,X_stl,_size);
90
+
91
+ // typename Interface::real_type error=
92
+ // STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
93
+
94
+ // if (error>1.e-3){
95
+ // INFOS("WRONG CALCULATION...residual=" << error);
96
+ // exit(0);
97
+ // }
98
+
99
+ }
100
+
101
+ private :
102
+
103
+ typename Interface::stl_vector A_stl;
104
+ typename Interface::stl_vector B_stl;
105
+
106
+ typename Interface::gene_vector A_ref;
107
+ typename Interface::gene_vector B_ref;
108
+
109
+ typename Interface::gene_vector A;
110
+ typename Interface::gene_vector B;
111
+
112
+ int _size;
113
+ };
114
+
115
+
116
+ #endif
include/eigen/bench/btl/actions/action_symv.hh ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_symv.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_SYMV
21
+ #define ACTION_SYMV
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_symv {
33
+
34
+ public :
35
+
36
+ // Ctor
37
+
38
+ BTL_DONT_INLINE Action_symv( int size ):_size(size)
39
+ {
40
+ MESSAGE("Action_symv Ctor");
41
+
42
+ // STL matrix and vector initialization
43
+ init_matrix_symm<pseudo_random>(A_stl,_size);
44
+ init_vector<pseudo_random>(B_stl,_size);
45
+ init_vector<null_function>(X_stl,_size);
46
+ init_vector<null_function>(resu_stl,_size);
47
+
48
+ // generic matrix and vector initialization
49
+ Interface::matrix_from_stl(A_ref,A_stl);
50
+ Interface::matrix_from_stl(A,A_stl);
51
+ Interface::vector_from_stl(B_ref,B_stl);
52
+ Interface::vector_from_stl(B,B_stl);
53
+ Interface::vector_from_stl(X_ref,X_stl);
54
+ Interface::vector_from_stl(X,X_stl);
55
+
56
+ }
57
+
58
+ // invalidate copy ctor
59
+
60
+ Action_symv( const Action_symv & )
61
+ {
62
+ INFOS("illegal call to Action_symv Copy Ctor");
63
+ exit(1);
64
+ }
65
+
66
+ // Dtor
67
+ BTL_DONT_INLINE ~Action_symv( void ){
68
+ Interface::free_matrix(A,_size);
69
+ Interface::free_vector(B);
70
+ Interface::free_vector(X);
71
+ Interface::free_matrix(A_ref,_size);
72
+ Interface::free_vector(B_ref);
73
+ Interface::free_vector(X_ref);
74
+ }
75
+
76
+ // action name
77
+
78
+ static inline std::string name( void )
79
+ {
80
+ return "symv_" + Interface::name();
81
+ }
82
+
83
+ double nb_op_base( void ){
84
+ return 2.0*_size*_size;
85
+ }
86
+
87
+ BTL_DONT_INLINE void initialize( void ){
88
+
89
+ Interface::copy_matrix(A_ref,A,_size);
90
+ Interface::copy_vector(B_ref,B,_size);
91
+ Interface::copy_vector(X_ref,X,_size);
92
+
93
+ }
94
+
95
+ BTL_DONT_INLINE void calculate( void ) {
96
+ BTL_ASM_COMMENT("#begin symv");
97
+ Interface::symv(A,B,X,_size);
98
+ BTL_ASM_COMMENT("end symv");
99
+ }
100
+
101
+ BTL_DONT_INLINE void check_result( void ){
102
+ if (_size>128) return;
103
+ // calculation check
104
+ Interface::vector_to_stl(X,resu_stl);
105
+
106
+ STL_interface<typename Interface::real_type>::symv(A_stl,B_stl,X_stl,_size);
107
+
108
+ typename Interface::real_type error=
109
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
110
+
111
+ if (error>1.e-5){
112
+ INFOS("WRONG CALCULATION...residual=" << error);
113
+ exit(0);
114
+ }
115
+
116
+ }
117
+
118
+ private :
119
+
120
+ typename Interface::stl_matrix A_stl;
121
+ typename Interface::stl_vector B_stl;
122
+ typename Interface::stl_vector X_stl;
123
+ typename Interface::stl_vector resu_stl;
124
+
125
+ typename Interface::gene_matrix A_ref;
126
+ typename Interface::gene_vector B_ref;
127
+ typename Interface::gene_vector X_ref;
128
+
129
+ typename Interface::gene_matrix A;
130
+ typename Interface::gene_vector B;
131
+ typename Interface::gene_vector X;
132
+
133
+
134
+ int _size;
135
+
136
+ };
137
+
138
+
139
+ #endif
include/eigen/bench/btl/actions/action_syr2.hh ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_syr2.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_SYR2
21
+ #define ACTION_SYR2
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_syr2 {
33
+
34
+ public :
35
+
36
+ // Ctor
37
+
38
+ BTL_DONT_INLINE Action_syr2( int size ):_size(size)
39
+ {
40
+ // STL matrix and vector initialization
41
+ typename Interface::stl_matrix tmp;
42
+ init_matrix<pseudo_random>(A_stl,_size);
43
+ init_vector<pseudo_random>(B_stl,_size);
44
+ init_vector<pseudo_random>(X_stl,_size);
45
+ init_vector<null_function>(resu_stl,_size);
46
+
47
+ // generic matrix and vector initialization
48
+ Interface::matrix_from_stl(A_ref,A_stl);
49
+ Interface::matrix_from_stl(A,A_stl);
50
+ Interface::vector_from_stl(B_ref,B_stl);
51
+ Interface::vector_from_stl(B,B_stl);
52
+ Interface::vector_from_stl(X_ref,X_stl);
53
+ Interface::vector_from_stl(X,X_stl);
54
+ }
55
+
56
+ // invalidate copy ctor
57
+ Action_syr2( const Action_syr2 & )
58
+ {
59
+ INFOS("illegal call to Action_syr2 Copy Ctor");
60
+ exit(1);
61
+ }
62
+
63
+ // Dtor
64
+ BTL_DONT_INLINE ~Action_syr2( void ){
65
+ Interface::free_matrix(A,_size);
66
+ Interface::free_vector(B);
67
+ Interface::free_vector(X);
68
+ Interface::free_matrix(A_ref,_size);
69
+ Interface::free_vector(B_ref);
70
+ Interface::free_vector(X_ref);
71
+ }
72
+
73
+ // action name
74
+
75
+ static inline std::string name( void )
76
+ {
77
+ return "syr2_" + Interface::name();
78
+ }
79
+
80
+ double nb_op_base( void ){
81
+ return 2.0*_size*_size;
82
+ }
83
+
84
+ BTL_DONT_INLINE void initialize( void ){
85
+ Interface::copy_matrix(A_ref,A,_size);
86
+ Interface::copy_vector(B_ref,B,_size);
87
+ Interface::copy_vector(X_ref,X,_size);
88
+ }
89
+
90
+ BTL_DONT_INLINE void calculate( void ) {
91
+ BTL_ASM_COMMENT("#begin syr2");
92
+ Interface::syr2(A,B,X,_size);
93
+ BTL_ASM_COMMENT("end syr2");
94
+ }
95
+
96
+ BTL_DONT_INLINE void check_result( void ){
97
+ // calculation check
98
+ Interface::vector_to_stl(X,resu_stl);
99
+
100
+ STL_interface<typename Interface::real_type>::syr2(A_stl,B_stl,X_stl,_size);
101
+
102
+ typename Interface::real_type error=
103
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
104
+
105
+ if (error>1.e-3){
106
+ INFOS("WRONG CALCULATION...residual=" << error);
107
+ // exit(0);
108
+ }
109
+
110
+ }
111
+
112
+ private :
113
+
114
+ typename Interface::stl_matrix A_stl;
115
+ typename Interface::stl_vector B_stl;
116
+ typename Interface::stl_vector X_stl;
117
+ typename Interface::stl_vector resu_stl;
118
+
119
+ typename Interface::gene_matrix A_ref;
120
+ typename Interface::gene_vector B_ref;
121
+ typename Interface::gene_vector X_ref;
122
+
123
+ typename Interface::gene_matrix A;
124
+ typename Interface::gene_vector B;
125
+ typename Interface::gene_vector X;
126
+
127
+
128
+ int _size;
129
+
130
+ };
131
+
132
+
133
+ #endif
include/eigen/bench/btl/actions/action_trisolve.hh ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_trisolve.hh
3
+ // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
4
+ //=====================================================
5
+ //
6
+ // This program is free software; you can redistribute it and/or
7
+ // modify it under the terms of the GNU General Public License
8
+ // as published by the Free Software Foundation; either version 2
9
+ // of the License, or (at your option) any later version.
10
+ //
11
+ // This program is distributed in the hope that it will be useful,
12
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU General Public License for more details.
15
+ // You should have received a copy of the GNU General Public License
16
+ // along with this program; if not, write to the Free Software
17
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+ //
19
+ #ifndef ACTION_TRISOLVE
20
+ #define ACTION_TRISOLVE
21
+ #include "utilities.h"
22
+ #include "STL_interface.hh"
23
+ #include <string>
24
+ #include "init/init_function.hh"
25
+ #include "init/init_vector.hh"
26
+ #include "init/init_matrix.hh"
27
+
28
+ using namespace std;
29
+
30
+ template<class Interface>
31
+ class Action_trisolve {
32
+
33
+ public :
34
+
35
+ // Ctor
36
+
37
+ Action_trisolve( int size ):_size(size)
38
+ {
39
+ MESSAGE("Action_trisolve Ctor");
40
+
41
+ // STL vector initialization
42
+ init_matrix<pseudo_random>(L_stl,_size);
43
+ init_vector<pseudo_random>(B_stl,_size);
44
+ init_vector<null_function>(X_stl,_size);
45
+ for (int j=0; j<_size; ++j)
46
+ {
47
+ for (int i=0; i<j; ++i)
48
+ L_stl[j][i] = 0;
49
+ L_stl[j][j] += 3;
50
+ }
51
+
52
+ init_vector<null_function>(resu_stl,_size);
53
+
54
+ // generic matrix and vector initialization
55
+ Interface::matrix_from_stl(L,L_stl);
56
+ Interface::vector_from_stl(X,X_stl);
57
+ Interface::vector_from_stl(B,B_stl);
58
+
59
+ _cost = 0;
60
+ for (int j=0; j<_size; ++j)
61
+ {
62
+ _cost += 2*j + 1;
63
+ }
64
+ }
65
+
66
+ // invalidate copy ctor
67
+
68
+ Action_trisolve( const Action_trisolve & )
69
+ {
70
+ INFOS("illegal call to Action_trisolve Copy Ctor");
71
+ exit(1);
72
+ }
73
+
74
+ // Dtor
75
+
76
+ ~Action_trisolve( void ){
77
+
78
+ MESSAGE("Action_trisolve Dtor");
79
+
80
+ // deallocation
81
+ Interface::free_matrix(L,_size);
82
+ Interface::free_vector(B);
83
+ Interface::free_vector(X);
84
+ }
85
+
86
+ // action name
87
+
88
+ static inline std::string name( void )
89
+ {
90
+ return "trisolve_vector_"+Interface::name();
91
+ }
92
+
93
+ double nb_op_base( void ){
94
+ return _cost;
95
+ }
96
+
97
+ inline void initialize( void ){
98
+ //Interface::copy_vector(X_ref,X,_size);
99
+ }
100
+
101
+ inline void calculate( void ) {
102
+ Interface::trisolve_lower(L,B,X,_size);
103
+ }
104
+
105
+ void check_result(){
106
+ if (_size>128) return;
107
+ // calculation check
108
+ Interface::vector_to_stl(X,resu_stl);
109
+
110
+ STL_interface<typename Interface::real_type>::trisolve_lower(L_stl,B_stl,X_stl,_size);
111
+
112
+ typename Interface::real_type error=
113
+ STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
114
+
115
+ if (error>1.e-4){
116
+ INFOS("WRONG CALCULATION...residual=" << error);
117
+ exit(2);
118
+ } //else INFOS("CALCULATION OK...residual=" << error);
119
+
120
+ }
121
+
122
+ private :
123
+
124
+ typename Interface::stl_matrix L_stl;
125
+ typename Interface::stl_vector X_stl;
126
+ typename Interface::stl_vector B_stl;
127
+ typename Interface::stl_vector resu_stl;
128
+
129
+ typename Interface::gene_matrix L;
130
+ typename Interface::gene_vector X;
131
+ typename Interface::gene_vector B;
132
+
133
+ int _size;
134
+ double _cost;
135
+ };
136
+
137
+ #endif
include/eigen/bench/btl/actions/action_trisolve_matrix.hh ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_matrix_matrix_product.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_TRISOLVE_MATRIX_PRODUCT
21
+ #define ACTION_TRISOLVE_MATRIX_PRODUCT
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_trisolve_matrix {
33
+
34
+ public :
35
+
36
+ // Ctor
37
+
38
+ Action_trisolve_matrix( int size ):_size(size)
39
+ {
40
+ MESSAGE("Action_trisolve_matrix Ctor");
41
+
42
+ // STL matrix and vector initialization
43
+
44
+ init_matrix<pseudo_random>(A_stl,_size);
45
+ init_matrix<pseudo_random>(B_stl,_size);
46
+ init_matrix<null_function>(X_stl,_size);
47
+ init_matrix<null_function>(resu_stl,_size);
48
+
49
+ for (int j=0; j<_size; ++j)
50
+ {
51
+ for (int i=0; i<j; ++i)
52
+ A_stl[j][i] = 0;
53
+ A_stl[j][j] += 3;
54
+ }
55
+
56
+ // generic matrix and vector initialization
57
+
58
+ Interface::matrix_from_stl(A_ref,A_stl);
59
+ Interface::matrix_from_stl(B_ref,B_stl);
60
+ Interface::matrix_from_stl(X_ref,X_stl);
61
+
62
+ Interface::matrix_from_stl(A,A_stl);
63
+ Interface::matrix_from_stl(B,B_stl);
64
+ Interface::matrix_from_stl(X,X_stl);
65
+
66
+ _cost = 0;
67
+ for (int j=0; j<_size; ++j)
68
+ {
69
+ _cost += 2*j + 1;
70
+ }
71
+ _cost *= _size;
72
+ }
73
+
74
+ // invalidate copy ctor
75
+
76
+ Action_trisolve_matrix( const Action_trisolve_matrix & )
77
+ {
78
+ INFOS("illegal call to Action_trisolve_matrix Copy Ctor");
79
+ exit(0);
80
+ }
81
+
82
+ // Dtor
83
+
84
+ ~Action_trisolve_matrix( void ){
85
+
86
+ MESSAGE("Action_trisolve_matrix Dtor");
87
+
88
+ // deallocation
89
+
90
+ Interface::free_matrix(A,_size);
91
+ Interface::free_matrix(B,_size);
92
+ Interface::free_matrix(X,_size);
93
+
94
+ Interface::free_matrix(A_ref,_size);
95
+ Interface::free_matrix(B_ref,_size);
96
+ Interface::free_matrix(X_ref,_size);
97
+
98
+ }
99
+
100
+ // action name
101
+
102
+ static inline std::string name( void )
103
+ {
104
+ return "trisolve_matrix_"+Interface::name();
105
+ }
106
+
107
+ double nb_op_base( void ){
108
+ return _cost;
109
+ }
110
+
111
+ inline void initialize( void ){
112
+
113
+ Interface::copy_matrix(A_ref,A,_size);
114
+ Interface::copy_matrix(B_ref,B,_size);
115
+ Interface::copy_matrix(X_ref,X,_size);
116
+
117
+ }
118
+
119
+ inline void calculate( void ) {
120
+ Interface::trisolve_lower_matrix(A,B,X,_size);
121
+ }
122
+
123
+ void check_result( void ){
124
+
125
+ // calculation check
126
+
127
+ // Interface::matrix_to_stl(X,resu_stl);
128
+ //
129
+ // STL_interface<typename Interface::real_type>::matrix_matrix_product(A_stl,B_stl,X_stl,_size);
130
+ //
131
+ // typename Interface::real_type error=
132
+ // STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
133
+ //
134
+ // if (error>1.e-6){
135
+ // INFOS("WRONG CALCULATION...residual=" << error);
136
+ // // exit(1);
137
+ // }
138
+
139
+ }
140
+
141
+ private :
142
+
143
+ typename Interface::stl_matrix A_stl;
144
+ typename Interface::stl_matrix B_stl;
145
+ typename Interface::stl_matrix X_stl;
146
+ typename Interface::stl_matrix resu_stl;
147
+
148
+ typename Interface::gene_matrix A_ref;
149
+ typename Interface::gene_matrix B_ref;
150
+ typename Interface::gene_matrix X_ref;
151
+
152
+ typename Interface::gene_matrix A;
153
+ typename Interface::gene_matrix B;
154
+ typename Interface::gene_matrix X;
155
+
156
+ int _size;
157
+ double _cost;
158
+
159
+ };
160
+
161
+
162
+ #endif
163
+
164
+
165
+
include/eigen/bench/btl/actions/action_trmm.hh ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : action_matrix_matrix_product.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef ACTION_TRMM
21
+ #define ACTION_TRMM
22
+ #include "utilities.h"
23
+ #include "STL_interface.hh"
24
+ #include <string>
25
+ #include "init/init_function.hh"
26
+ #include "init/init_vector.hh"
27
+ #include "init/init_matrix.hh"
28
+
29
+ using namespace std;
30
+
31
+ template<class Interface>
32
+ class Action_trmm {
33
+
34
+ public :
35
+
36
+ // Ctor
37
+
38
+ Action_trmm( int size ):_size(size)
39
+ {
40
+ MESSAGE("Action_trmm Ctor");
41
+
42
+ // STL matrix and vector initialization
43
+
44
+ init_matrix<pseudo_random>(A_stl,_size);
45
+ init_matrix<pseudo_random>(B_stl,_size);
46
+ init_matrix<null_function>(X_stl,_size);
47
+ init_matrix<null_function>(resu_stl,_size);
48
+
49
+ for (int j=0; j<_size; ++j)
50
+ {
51
+ for (int i=0; i<j; ++i)
52
+ A_stl[j][i] = 0;
53
+ A_stl[j][j] += 3;
54
+ }
55
+
56
+ // generic matrix and vector initialization
57
+
58
+ Interface::matrix_from_stl(A_ref,A_stl);
59
+ Interface::matrix_from_stl(B_ref,B_stl);
60
+ Interface::matrix_from_stl(X_ref,X_stl);
61
+
62
+ Interface::matrix_from_stl(A,A_stl);
63
+ Interface::matrix_from_stl(B,B_stl);
64
+ Interface::matrix_from_stl(X,X_stl);
65
+
66
+ _cost = 0;
67
+ for (int j=0; j<_size; ++j)
68
+ {
69
+ _cost += 2*j + 1;
70
+ }
71
+ _cost *= _size;
72
+ }
73
+
74
+ // invalidate copy ctor
75
+
76
+ Action_trmm( const Action_trmm & )
77
+ {
78
+ INFOS("illegal call to Action_trmm Copy Ctor");
79
+ exit(0);
80
+ }
81
+
82
+ // Dtor
83
+
84
+ ~Action_trmm( void ){
85
+
86
+ MESSAGE("Action_trmm Dtor");
87
+
88
+ // deallocation
89
+
90
+ Interface::free_matrix(A,_size);
91
+ Interface::free_matrix(B,_size);
92
+ Interface::free_matrix(X,_size);
93
+
94
+ Interface::free_matrix(A_ref,_size);
95
+ Interface::free_matrix(B_ref,_size);
96
+ Interface::free_matrix(X_ref,_size);
97
+
98
+ }
99
+
100
+ // action name
101
+
102
+ static inline std::string name( void )
103
+ {
104
+ return "trmm_"+Interface::name();
105
+ }
106
+
107
+ double nb_op_base( void ){
108
+ return _cost;
109
+ }
110
+
111
+ inline void initialize( void ){
112
+
113
+ Interface::copy_matrix(A_ref,A,_size);
114
+ Interface::copy_matrix(B_ref,B,_size);
115
+ Interface::copy_matrix(X_ref,X,_size);
116
+
117
+ }
118
+
119
+ inline void calculate( void ) {
120
+ Interface::trmm(A,B,X,_size);
121
+ }
122
+
123
+ void check_result( void ){
124
+
125
+ // calculation check
126
+
127
+ // Interface::matrix_to_stl(X,resu_stl);
128
+ //
129
+ // STL_interface<typename Interface::real_type>::matrix_matrix_product(A_stl,B_stl,X_stl,_size);
130
+ //
131
+ // typename Interface::real_type error=
132
+ // STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
133
+ //
134
+ // if (error>1.e-6){
135
+ // INFOS("WRONG CALCULATION...residual=" << error);
136
+ // // exit(1);
137
+ // }
138
+
139
+ }
140
+
141
+ private :
142
+
143
+ typename Interface::stl_matrix A_stl;
144
+ typename Interface::stl_matrix B_stl;
145
+ typename Interface::stl_matrix X_stl;
146
+ typename Interface::stl_matrix resu_stl;
147
+
148
+ typename Interface::gene_matrix A_ref;
149
+ typename Interface::gene_matrix B_ref;
150
+ typename Interface::gene_matrix X_ref;
151
+
152
+ typename Interface::gene_matrix A;
153
+ typename Interface::gene_matrix B;
154
+ typename Interface::gene_matrix X;
155
+
156
+ int _size;
157
+ double _cost;
158
+
159
+ };
160
+
161
+
162
+ #endif
163
+
164
+
165
+
include/eigen/bench/btl/actions/basic_actions.hh ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #include "action_axpy.hh"
3
+ #include "action_axpby.hh"
4
+
5
+ #include "action_matrix_vector_product.hh"
6
+ #include "action_atv_product.hh"
7
+
8
+ #include "action_matrix_matrix_product.hh"
9
+ #include "action_ata_product.hh"
10
+ #include "action_aat_product.hh"
11
+
12
+ #include "action_trisolve.hh"
13
+ #include "action_trmm.hh"
14
+ #include "action_symv.hh"
15
+ // #include "action_symm.hh"
16
+ #include "action_syr2.hh"
17
+ #include "action_ger.hh"
18
+ #include "action_rot.hh"
19
+
20
+ // #include "action_lu_solve.hh"
21
+
include/eigen/bench/btl/cmake/FindACML.cmake ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ if (ACML_LIBRARIES)
3
+ set(ACML_FIND_QUIETLY TRUE)
4
+ endif ()
5
+
6
+ find_library(ACML_LIBRARIES
7
+ NAMES
8
+ acml_mp acml_mv
9
+ PATHS
10
+ $ENV{ACMLDIR}/lib
11
+ $ENV{ACML_DIR}/lib
12
+ ${LIB_INSTALL_DIR}
13
+ )
14
+
15
+ find_file(ACML_LIBRARIES
16
+ NAMES
17
+ libacml_mp.so
18
+ PATHS
19
+ /usr/lib
20
+ /usr/lib64
21
+ $ENV{ACMLDIR}/lib
22
+ ${LIB_INSTALL_DIR}
23
+ )
24
+
25
+ if(NOT ACML_LIBRARIES)
26
+ message(STATUS "Multi-threaded library not found, looking for single-threaded")
27
+ find_library(ACML_LIBRARIES
28
+ NAMES
29
+ acml acml_mv
30
+ PATHS
31
+ $ENV{ACMLDIR}/lib
32
+ $ENV{ACML_DIR}/lib
33
+ ${LIB_INSTALL_DIR}
34
+ )
35
+ find_file(ACML_LIBRARIES
36
+ libacml.so libacml_mv.so
37
+ PATHS
38
+ /usr/lib
39
+ /usr/lib64
40
+ $ENV{ACMLDIR}/lib
41
+ ${LIB_INSTALL_DIR}
42
+ )
43
+ endif()
44
+
45
+
46
+
47
+
48
+ include(FindPackageHandleStandardArgs)
49
+ find_package_handle_standard_args(ACML DEFAULT_MSG ACML_LIBRARIES)
50
+
51
+ mark_as_advanced(ACML_LIBRARIES)
include/eigen/bench/btl/cmake/FindATLAS.cmake ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ if (ATLAS_LIBRARIES)
3
+ set(ATLAS_FIND_QUIETLY TRUE)
4
+ endif ()
5
+
6
+ find_file(ATLAS_LIB libatlas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
7
+ find_library(ATLAS_LIB satlas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
8
+
9
+ find_file(ATLAS_LAPACK NAMES liblapack_atlas.so.3 liblapack.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
10
+ find_library(ATLAS_LAPACK NAMES lapack_atlas lapack PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
11
+
12
+ find_file(ATLAS_F77BLAS libf77blas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
13
+ find_library(ATLAS_F77BLAS f77blas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
14
+
15
+ if(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS)
16
+
17
+ set(ATLAS_LIBRARIES ${ATLAS_LAPACK} ${ATLAS_LIB})
18
+
19
+ # search the default lapack lib link to it
20
+ find_file(ATLAS_REFERENCE_LAPACK liblapack.so.3 PATHS /usr/lib /usr/lib64)
21
+ find_library(ATLAS_REFERENCE_LAPACK NAMES lapack)
22
+ # if(ATLAS_REFERENCE_LAPACK)
23
+ # set(ATLAS_LIBRARIES ${ATLAS_LIBRARIES} ${ATLAS_REFERENCE_LAPACK})
24
+ # endif()
25
+
26
+ endif()
27
+
28
+ include(FindPackageHandleStandardArgs)
29
+ find_package_handle_standard_args(ATLAS DEFAULT_MSG ATLAS_LIBRARIES)
30
+
31
+ mark_as_advanced(ATLAS_LIBRARIES)
include/eigen/bench/btl/cmake/FindBLAZE.cmake ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # - Try to find eigen2 headers
2
+ # Once done this will define
3
+ #
4
+ # BLAZE_FOUND - system has blaze lib
5
+ # BLAZE_INCLUDE_DIR - the blaze include directory
6
+ #
7
+ # Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
8
+ # Adapted from FindEigen.cmake:
9
+ # Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
10
+ # Redistribution and use is allowed according to the terms of the BSD license.
11
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12
+
13
+ if (BLAZE_INCLUDE_DIR)
14
+
15
+ # in cache already
16
+ set(BLAZE_FOUND TRUE)
17
+
18
+ else ()
19
+
20
+ find_path(BLAZE_INCLUDE_DIR NAMES blaze/Blaze.h
21
+ PATHS
22
+ ${INCLUDE_INSTALL_DIR}
23
+ )
24
+
25
+ include(FindPackageHandleStandardArgs)
26
+ find_package_handle_standard_args(BLAZE DEFAULT_MSG BLAZE_INCLUDE_DIR)
27
+
28
+ mark_as_advanced(BLAZE_INCLUDE_DIR)
29
+
30
+ endif()
31
+
include/eigen/bench/btl/cmake/FindBlitz.cmake ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # - Try to find blitz lib
2
+ # Once done this will define
3
+ #
4
+ # BLITZ_FOUND - system has blitz lib
5
+ # BLITZ_INCLUDES - the blitz include directory
6
+ # BLITZ_LIBRARIES - The libraries needed to use blitz
7
+
8
+ # Copyright (c) 2006, Montel Laurent, <montel@kde.org>
9
+ # Copyright (c) 2007, Allen Winter, <winter@kde.org>
10
+ # Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
11
+ # Redistribution and use is allowed according to the terms of the BSD license.
12
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
13
+
14
+ # include(FindLibraryWithDebug)
15
+
16
+ if (BLITZ_INCLUDES AND BLITZ_LIBRARIES)
17
+ set(Blitz_FIND_QUIETLY TRUE)
18
+ endif ()
19
+
20
+ find_path(BLITZ_INCLUDES
21
+ NAMES
22
+ blitz/array.h
23
+ PATH_SUFFIXES blitz*
24
+ PATHS
25
+ $ENV{BLITZDIR}/include
26
+ ${INCLUDE_INSTALL_DIR}
27
+ )
28
+
29
+ find_library(BLITZ_LIBRARIES
30
+ blitz
31
+ PATHS
32
+ $ENV{BLITZDIR}/lib
33
+ ${LIB_INSTALL_DIR}
34
+ )
35
+
36
+ include(FindPackageHandleStandardArgs)
37
+ find_package_handle_standard_args(Blitz DEFAULT_MSG
38
+ BLITZ_INCLUDES BLITZ_LIBRARIES)
39
+
40
+ mark_as_advanced(BLITZ_INCLUDES BLITZ_LIBRARIES)
include/eigen/bench/btl/cmake/FindCBLAS.cmake ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # include(FindLibraryWithDebug)
2
+
3
+ if (CBLAS_INCLUDES AND CBLAS_LIBRARIES)
4
+ set(CBLAS_FIND_QUIETLY TRUE)
5
+ endif ()
6
+
7
+ find_path(CBLAS_INCLUDES
8
+ NAMES
9
+ cblas.h
10
+ PATHS
11
+ $ENV{CBLASDIR}/include
12
+ ${INCLUDE_INSTALL_DIR}
13
+ )
14
+
15
+ find_library(CBLAS_LIBRARIES
16
+ cblas
17
+ PATHS
18
+ $ENV{CBLASDIR}/lib
19
+ ${LIB_INSTALL_DIR}
20
+ )
21
+
22
+ find_file(CBLAS_LIBRARIES
23
+ libcblas.so.3
24
+ PATHS
25
+ /usr/lib
26
+ /usr/lib64
27
+ $ENV{CBLASDIR}/lib
28
+ ${LIB_INSTALL_DIR}
29
+ )
30
+
31
+ include(FindPackageHandleStandardArgs)
32
+ find_package_handle_standard_args(CBLAS DEFAULT_MSG
33
+ CBLAS_INCLUDES CBLAS_LIBRARIES)
34
+
35
+ mark_as_advanced(CBLAS_INCLUDES CBLAS_LIBRARIES)
include/eigen/bench/btl/cmake/FindGMM.cmake ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ if (GMM_INCLUDE_DIR)
2
+ # in cache already
3
+ set(GMM_FOUND TRUE)
4
+ else ()
5
+
6
+ find_path(GMM_INCLUDE_DIR NAMES gmm/gmm.h
7
+ PATHS
8
+ ${INCLUDE_INSTALL_DIR}
9
+ ${GMM_INCLUDE_PATH}
10
+ )
11
+
12
+ include(FindPackageHandleStandardArgs)
13
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMM DEFAULT_MSG GMM_INCLUDE_DIR )
14
+
15
+ mark_as_advanced(GMM_INCLUDE_DIR)
16
+
17
+ endif()
include/eigen/bench/btl/cmake/FindMKL.cmake ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ if (MKL_LIBRARIES)
3
+ set(MKL_FIND_QUIETLY TRUE)
4
+ endif ()
5
+
6
+ if(CMAKE_MINOR_VERSION GREATER 4)
7
+
8
+ if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
9
+
10
+ find_library(MKL_LIBRARIES
11
+ mkl_core
12
+ PATHS
13
+ $ENV{MKLLIB}
14
+ /opt/intel/mkl/*/lib/em64t
15
+ /opt/intel/Compiler/*/*/mkl/lib/em64t
16
+ ${LIB_INSTALL_DIR}
17
+ )
18
+
19
+ find_library(MKL_GUIDE
20
+ guide
21
+ PATHS
22
+ $ENV{MKLLIB}
23
+ /opt/intel/mkl/*/lib/em64t
24
+ /opt/intel/Compiler/*/*/mkl/lib/em64t
25
+ /opt/intel/Compiler/*/*/lib/intel64
26
+ ${LIB_INSTALL_DIR}
27
+ )
28
+
29
+ if(MKL_LIBRARIES AND MKL_GUIDE)
30
+ set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel_lp64 mkl_sequential ${MKL_GUIDE} pthread)
31
+ endif()
32
+
33
+ else()
34
+
35
+ find_library(MKL_LIBRARIES
36
+ mkl_core
37
+ PATHS
38
+ $ENV{MKLLIB}
39
+ /opt/intel/mkl/*/lib/32
40
+ /opt/intel/Compiler/*/*/mkl/lib/32
41
+ ${LIB_INSTALL_DIR}
42
+ )
43
+
44
+ find_library(MKL_GUIDE
45
+ guide
46
+ PATHS
47
+ $ENV{MKLLIB}
48
+ /opt/intel/mkl/*/lib/32
49
+ /opt/intel/Compiler/*/*/mkl/lib/32
50
+ /opt/intel/Compiler/*/*/lib/intel32
51
+ ${LIB_INSTALL_DIR}
52
+ )
53
+
54
+ if(MKL_LIBRARIES AND MKL_GUIDE)
55
+ set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel mkl_sequential ${MKL_GUIDE} pthread)
56
+ endif()
57
+
58
+ endif()
59
+
60
+ endif()
61
+
62
+ include(FindPackageHandleStandardArgs)
63
+ find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARIES)
64
+
65
+ mark_as_advanced(MKL_LIBRARIES)
include/eigen/bench/btl/cmake/FindMTL4.cmake ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # - Try to find eigen2 headers
2
+ # Once done this will define
3
+ #
4
+ # MTL4_FOUND - system has eigen2 lib
5
+ # MTL4_INCLUDE_DIR - the eigen2 include directory
6
+ #
7
+ # Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
8
+ # Adapted from FindEigen.cmake:
9
+ # Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
10
+ # Redistribution and use is allowed according to the terms of the BSD license.
11
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12
+
13
+ if (MTL4_INCLUDE_DIR)
14
+
15
+ # in cache already
16
+ set(MTL4_FOUND TRUE)
17
+
18
+ else ()
19
+
20
+ find_path(MTL4_INCLUDE_DIR NAMES boost/numeric/mtl/mtl.hpp
21
+ PATHS
22
+ ${INCLUDE_INSTALL_DIR}
23
+ )
24
+
25
+ include(FindPackageHandleStandardArgs)
26
+ find_package_handle_standard_args(MTL4 DEFAULT_MSG MTL4_INCLUDE_DIR)
27
+
28
+ mark_as_advanced(MTL4_INCLUDE_DIR)
29
+
30
+ endif()
31
+
include/eigen/bench/btl/cmake/FindOPENBLAS.cmake ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ if (OPENBLAS_LIBRARIES)
3
+ set(OPENBLAS_FIND_QUIETLY TRUE)
4
+ endif ()
5
+
6
+ find_file(OPENBLAS_LIBRARIES NAMES libopenblas.so libopenblas.so.0 PATHS /usr/lib /usr/lib64 $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR})
7
+ find_library(OPENBLAS_LIBRARIES openblas PATHS $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR})
8
+
9
+ if(OPENBLAS_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX)
10
+ set(OPENBLAS_LIBRARIES ${OPENBLAS_LIBRARIES} "-lpthread -lgfortran")
11
+ endif()
12
+
13
+ include(FindPackageHandleStandardArgs)
14
+ find_package_handle_standard_args(OPENBLAS DEFAULT_MSG
15
+ OPENBLAS_LIBRARIES)
16
+
17
+ mark_as_advanced(OPENBLAS_LIBRARIES)
include/eigen/bench/btl/cmake/FindPackageHandleStandardArgs.cmake ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
2
+ #
3
+ # This macro is intended to be used in FindXXX.cmake modules files.
4
+ # It handles the REQUIRED and QUIET argument to find_package() and
5
+ # it also sets the <UPPERCASED_NAME>_FOUND variable.
6
+ # The package is found if all variables listed are TRUE.
7
+ # Example:
8
+ #
9
+ # FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
10
+ #
11
+ # LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and
12
+ # LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
13
+ # If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
14
+ # independent whether QUIET was used or not.
15
+ #
16
+ # If it is found, the location is reported using the VAR1 argument, so
17
+ # here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
18
+ # If the second argument is DEFAULT_MSG, the message in the failure case will
19
+ # be "Could NOT find LibXml2", if you don't like this message you can specify
20
+ # your own custom failure message there.
21
+
22
+ macro(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
23
+
24
+ if("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
25
+ if (${_NAME}_FIND_REQUIRED)
26
+ set(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}")
27
+ else (${_NAME}_FIND_REQUIRED)
28
+ set(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}")
29
+ endif (${_NAME}_FIND_REQUIRED)
30
+ else("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
31
+ set(_FAIL_MESSAGE "${_FAIL_MSG}")
32
+ endif("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
33
+
34
+ string(TOUPPER ${_NAME} _NAME_UPPER)
35
+
36
+ set(${_NAME_UPPER}_FOUND TRUE)
37
+ if(NOT ${_VAR1})
38
+ set(${_NAME_UPPER}_FOUND FALSE)
39
+ endif(NOT ${_VAR1})
40
+
41
+ foreach(_CURRENT_VAR ${ARGN})
42
+ if(NOT ${_CURRENT_VAR})
43
+ set(${_NAME_UPPER}_FOUND FALSE)
44
+ endif(NOT ${_CURRENT_VAR})
45
+ endforeach(_CURRENT_VAR)
46
+
47
+ if (${_NAME_UPPER}_FOUND)
48
+ if (NOT ${_NAME}_FIND_QUIETLY)
49
+ message(STATUS "Found ${_NAME}: ${${_VAR1}}")
50
+ endif (NOT ${_NAME}_FIND_QUIETLY)
51
+ else (${_NAME_UPPER}_FOUND)
52
+ if (${_NAME}_FIND_REQUIRED)
53
+ message(FATAL_ERROR "${_FAIL_MESSAGE}")
54
+ else (${_NAME}_FIND_REQUIRED)
55
+ if (NOT ${_NAME}_FIND_QUIETLY)
56
+ message(STATUS "${_FAIL_MESSAGE}")
57
+ endif (NOT ${_NAME}_FIND_QUIETLY)
58
+ endif (${_NAME}_FIND_REQUIRED)
59
+ endif (${_NAME_UPPER}_FOUND)
60
+ endmacro(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
include/eigen/bench/btl/cmake/FindTvmet.cmake ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # - Try to find tvmet headers
2
+ # Once done this will define
3
+ #
4
+ # TVMET_FOUND - system has tvmet lib
5
+ # TVMET_INCLUDE_DIR - the tvmet include directory
6
+ #
7
+ # Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
8
+ # Adapted from FindEigen.cmake:
9
+ # Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
10
+ # Redistribution and use is allowed according to the terms of the BSD license.
11
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12
+
13
+ if (TVMET_INCLUDE_DIR)
14
+
15
+ # in cache already
16
+ set(TVMET_FOUND TRUE)
17
+
18
+ else ()
19
+
20
+ find_path(TVMET_INCLUDE_DIR NAMES tvmet/tvmet.h
21
+ PATHS
22
+ ${TVMETDIR}/
23
+ ${INCLUDE_INSTALL_DIR}
24
+ )
25
+
26
+ include(FindPackageHandleStandardArgs)
27
+ find_package_handle_standard_args(Tvmet DEFAULT_MSG TVMET_INCLUDE_DIR)
28
+
29
+ mark_as_advanced(TVMET_INCLUDE_DIR)
30
+
31
+ endif()
32
+
include/eigen/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines add_subdirectory() with an option()
2
+ # MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )
3
+ # If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of add_subdirectory(),
4
+ # this will have two effects
5
+ # 1 - CMake will not complain if the directory doesn't exist
6
+ # This makes sense if you want to distribute just one of the subdirs
7
+ # in a source package, e.g. just one of the subdirs in kdeextragear.
8
+ # 2 - If the directory exists, it will offer an option to skip the
9
+ # subdirectory.
10
+ # This is useful if you want to compile only a subset of all
11
+ # directories.
12
+
13
+ # Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
14
+ #
15
+ # Redistribution and use is allowed according to the terms of the BSD license.
16
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
17
+
18
+
19
+ macro (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )
20
+ get_filename_component(_fullPath ${_dir} ABSOLUTE)
21
+ if(EXISTS ${_fullPath})
22
+ if(${ARGC} EQUAL 2)
23
+ option(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1})
24
+ else(${ARGC} EQUAL 2)
25
+ option(BUILD_${_dir} "Build directory ${_dir}" TRUE)
26
+ endif(${ARGC} EQUAL 2)
27
+ if(BUILD_${_dir})
28
+ add_subdirectory(${_dir})
29
+ endif(BUILD_${_dir})
30
+ endif(EXISTS ${_fullPath})
31
+ endmacro (MACRO_OPTIONAL_ADD_SUBDIRECTORY)
include/eigen/bench/btl/data/CMakeLists.txt ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ add_custom_target(copy_scripts)
3
+
4
+ set(script_files go_mean mk_mean_script.sh mk_new_gnuplot.sh
5
+ perlib_plot_settings.txt action_settings.txt gnuplot_common_settings.hh )
6
+
7
+ foreach(script_file ${script_files})
8
+ add_custom_command(
9
+ TARGET copy_scripts
10
+ POST_BUILD
11
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${script_file} ${CMAKE_CURRENT_BINARY_DIR}/
12
+ ARGS
13
+ )
14
+ endforeach(script_file)
15
+
16
+ add_custom_command(
17
+ TARGET copy_scripts
18
+ POST_BUILD
19
+ COMMAND ${CMAKE_CXX_COMPILER} --version | head -n 1 > ${CMAKE_CURRENT_BINARY_DIR}/compiler_version.txt
20
+ ARGS
21
+ )
22
+ add_custom_command(
23
+ TARGET copy_scripts
24
+ POST_BUILD
25
+ COMMAND echo "${Eigen_SOURCE_DIR}" > ${CMAKE_CURRENT_BINARY_DIR}/eigen_root_dir.txt
26
+ ARGS
27
+ )
28
+
29
+ add_executable(smooth smooth.cxx)
30
+ add_executable(regularize regularize.cxx)
31
+ add_executable(main mean.cxx)
32
+ add_dependencies(main copy_scripts)
include/eigen/bench/btl/data/action_settings.txt ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aat ; "{/*1.5 A x A^T}" ; "matrix size" ; 4:5000
2
+ ata ; "{/*1.5 A^T x A}" ; "matrix size" ; 4:5000
3
+ atv ; "{/*1.5 matrix^T x vector}" ; "matrix size" ; 4:5000
4
+ axpby ; "{/*1.5 Y = alpha X + beta Y}" ; "vector size" ; 5:1000000
5
+ axpy ; "{/*1.5 Y += alpha X}" ; "vector size" ; 5:1000000
6
+ matrix_matrix ; "{/*1.5 matrix matrix product}" ; "matrix size" ; 4:5000
7
+ matrix_vector ; "{/*1.5 matrix vector product}" ; "matrix size" ; 4:5000
8
+ trmm ; "{/*1.5 triangular matrix matrix product}" ; "matrix size" ; 4:5000
9
+ trisolve_vector ; "{/*1.5 triangular solver - vector (X = inv(L) X)}" ; "size" ; 4:5000
10
+ trisolve_matrix ; "{/*1.5 triangular solver - matrix (M = inv(L) M)}" ; "size" ; 4:5000
11
+ cholesky ; "{/*1.5 Cholesky decomposition}" ; "matrix size" ; 4:5000
12
+ complete_lu_decomp ; "{/*1.5 Complete LU decomposition}" ; "matrix size" ; 4:5000
13
+ partial_lu_decomp ; "{/*1.5 Partial LU decomposition}" ; "matrix size" ; 4:5000
14
+ tridiagonalization ; "{/*1.5 Tridiagonalization}" ; "matrix size" ; 4:5000
15
+ hessenberg ; "{/*1.5 Hessenberg decomposition}" ; "matrix size" ; 4:5000
16
+ symv ; "{/*1.5 symmetric matrix vector product}" ; "matrix size" ; 4:5000
17
+ syr2 ; "{/*1.5 symmretric rank-2 update (A += u^T v + u v^T)}" ; "matrix size" ; 4:5000
18
+ ger ; "{/*1.5 general rank-1 update (A += u v^T)}" ; "matrix size" ; 4:5000
19
+ rot ; "{/*1.5 apply rotation in the plane}" ; "vector size" ; 4:1000000
include/eigen/bench/btl/data/gnuplot_common_settings.hh ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ set noclip points
2
+ set clip one
3
+ set noclip two
4
+ set bar 1.000000
5
+ set border 31 lt -1 lw 1.000
6
+ set xdata
7
+ set ydata
8
+ set zdata
9
+ set x2data
10
+ set y2data
11
+ set boxwidth
12
+ set dummy x,y
13
+ set format x "%g"
14
+ set format y "%g"
15
+ set format x2 "%g"
16
+ set format y2 "%g"
17
+ set format z "%g"
18
+ set angles radians
19
+ set nogrid
20
+ set key title ""
21
+ set key left top Right noreverse box linetype -2 linewidth 1.000 samplen 4 spacing 1 width 0
22
+ set nolabel
23
+ set noarrow
24
+ # set nolinestyle # deprecated
25
+ set nologscale
26
+ set logscale x 10
27
+ set offsets 0, 0, 0, 0
28
+ set pointsize 1
29
+ set encoding default
30
+ set nopolar
31
+ set noparametric
32
+ set view 60, 30, 1, 1
33
+ set samples 100, 100
34
+ set isosamples 10, 10
35
+ set surface
36
+ set nocontour
37
+ set clabel '%8.3g'
38
+ set mapping cartesian
39
+ set nohidden3d
40
+ set cntrparam order 4
41
+ set cntrparam linear
42
+ set cntrparam levels auto 5
43
+ set cntrparam points 5
44
+ set size ratio 0 1,1
45
+ set origin 0,0
46
+ # set data style lines
47
+ # set function style lines
48
+ set xzeroaxis lt -2 lw 1.000
49
+ set x2zeroaxis lt -2 lw 1.000
50
+ set yzeroaxis lt -2 lw 1.000
51
+ set y2zeroaxis lt -2 lw 1.000
52
+ set tics in
53
+ set ticslevel 0.5
54
+ set tics scale 1, 0.5
55
+ set mxtics default
56
+ set mytics default
57
+ set mx2tics default
58
+ set my2tics default
59
+ set xtics border mirror norotate autofreq
60
+ set ytics border mirror norotate autofreq
61
+ set ztics border nomirror norotate autofreq
62
+ set nox2tics
63
+ set noy2tics
64
+ set timestamp "" bottom norotate offset 0,0
65
+ set rrange [ * : * ] noreverse nowriteback # (currently [-0:10] )
66
+ set trange [ * : * ] noreverse nowriteback # (currently [-5:5] )
67
+ set urange [ * : * ] noreverse nowriteback # (currently [-5:5] )
68
+ set vrange [ * : * ] noreverse nowriteback # (currently [-5:5] )
69
+ set xlabel "matrix size" offset 0,0
70
+ set x2label "" offset 0,0
71
+ set timefmt "%d/%m/%y\n%H:%M"
72
+ set xrange [ 10 : 1000 ] noreverse nowriteback
73
+ set x2range [ * : * ] noreverse nowriteback # (currently [-10:10] )
74
+ set ylabel "MFLOPS" offset 0,0
75
+ set y2label "" offset 0,0
76
+ set yrange [ * : * ] noreverse nowriteback # (currently [-10:10] )
77
+ set y2range [ * : * ] noreverse nowriteback # (currently [-10:10] )
78
+ set zlabel "" offset 0,0
79
+ set zrange [ * : * ] noreverse nowriteback # (currently [-10:10] )
80
+ set zero 1e-08
81
+ set lmargin -1
82
+ set bmargin -1
83
+ set rmargin -1
84
+ set tmargin -1
85
+ set locale "C"
86
+ set xrange [4:1024]
87
+
include/eigen/bench/btl/data/go_mean ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ if [ $# < 1 ]; then
4
+ echo "Usage: $0 working_directory [tiny|large [prefix]]"
5
+ else
6
+
7
+ mkdir -p $1
8
+ ##cp ../libs/*/*.dat $1
9
+
10
+ mode=large
11
+ if [ $# > 2 ]; then
12
+ mode=$2
13
+ fi
14
+ if [ $# > 3 ]; then
15
+ prefix=$3
16
+ fi
17
+
18
+ EIGENDIR=`cat eigen_root_dir.txt`
19
+
20
+ webpagefilename=$1/index.html
21
+ meanstatsfilename=$1/mean.html
22
+
23
+ echo '' > $meanstatsfilename
24
+ echo '' > $webpagefilename
25
+ echo '<p><strong>Configuration</strong>' >> $webpagefilename
26
+ echo '<ul>'\
27
+ '<li>' `cat /proc/cpuinfo | grep "model name" | head -n 1`\
28
+ ' (' `uname -m` ')</li>'\
29
+ '<li> compiler: ' `cat compiler_version.txt` '</li>'\
30
+ '<li> eigen3: ' `git ls-remote --refs -q $EIGENDIR HEAD | cut -f 1` '</li>'\
31
+ '</ul>' \
32
+ '</p>' >> $webpagefilename
33
+
34
+ source mk_mean_script.sh axpy $1 11 2500 100000 250000 $mode $prefix
35
+ source mk_mean_script.sh axpby $1 11 2500 100000 250000 $mode $prefix
36
+ source mk_mean_script.sh matrix_vector $1 11 50 300 1000 $mode $prefix
37
+ source mk_mean_script.sh atv $1 11 50 300 1000 $mode $prefix
38
+ source mk_mean_script.sh matrix_matrix $1 11 100 300 1000 $mode $prefix
39
+ source mk_mean_script.sh aat $1 11 100 300 1000 $mode $prefix
40
+ # source mk_mean_script.sh ata $1 11 100 300 1000 $mode $prefix
41
+ source mk_mean_script.sh trmm $1 11 100 300 1000 $mode $prefix
42
+ source mk_mean_script.sh trisolve_vector $1 11 100 300 1000 $mode $prefix
43
+ source mk_mean_script.sh trisolve_matrix $1 11 100 300 1000 $mode $prefix
44
+ source mk_mean_script.sh cholesky $1 11 100 300 1000 $mode $prefix
45
+ source mk_mean_script.sh partial_lu_decomp $1 11 100 300 1000 $mode $prefix
46
+ source mk_mean_script.sh tridiagonalization $1 11 100 300 1000 $mode $prefix
47
+ source mk_mean_script.sh hessenberg $1 11 100 300 1000 $mode $prefix
48
+ source mk_mean_script.sh symv $1 11 50 300 1000 $mode $prefix
49
+ source mk_mean_script.sh syr2 $1 11 50 300 1000 $mode $prefix
50
+ source mk_mean_script.sh ger $1 11 50 300 1000 $mode $prefix
51
+ source mk_mean_script.sh rot $1 11 2500 100000 250000 $mode $prefix
52
+ source mk_mean_script.sh complete_lu_decomp $1 11 100 300 1000 $mode $prefix
53
+
54
+ fi
55
+
56
+ ## compile the web page ##
57
+
58
+ #echo `cat footer.html` >> $webpagefilename
include/eigen/bench/btl/data/mean.cxx ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : mean.cxx
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:15 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #include "utilities.h"
21
+ #include <vector>
22
+ #include <string>
23
+ #include <iostream>
24
+ #include <fstream>
25
+ #include "bench_parameter.hh"
26
+ #include "utils/xy_file.hh"
27
+ #include <set>
28
+
29
+ using namespace std;
30
+
31
+ double mean_calc(const vector<int> & tab_sizes, const vector<double> & tab_mflops, const int size_min, const int size_max);
32
+
33
+ class Lib_Mean{
34
+
35
+ public:
36
+ Lib_Mean( void ):_lib_name(),_mean_in_cache(),_mean_out_of_cache(){
37
+ MESSAGE("Lib_mean Default Ctor");
38
+ MESSAGE("!!! should not be used");
39
+ exit(0);
40
+ }
41
+ Lib_Mean(const string & name, const double & mic, const double & moc):_lib_name(name),_mean_in_cache(mic),_mean_out_of_cache(moc){
42
+ MESSAGE("Lib_mean Ctor");
43
+ }
44
+ Lib_Mean(const Lib_Mean & lm):_lib_name(lm._lib_name),_mean_in_cache(lm._mean_in_cache),_mean_out_of_cache(lm._mean_out_of_cache){
45
+ MESSAGE("Lib_mean Copy Ctor");
46
+ }
47
+ ~Lib_Mean( void ){
48
+ MESSAGE("Lib_mean Dtor");
49
+ }
50
+
51
+ double _mean_in_cache;
52
+ double _mean_out_of_cache;
53
+ string _lib_name;
54
+
55
+ bool operator < ( const Lib_Mean &right) const
56
+ {
57
+ //return ( this->_mean_out_of_cache > right._mean_out_of_cache) ;
58
+ return ( this->_mean_in_cache > right._mean_in_cache) ;
59
+ }
60
+
61
+ };
62
+
63
+
64
+ int main( int argc , char *argv[] )
65
+ {
66
+
67
+ if (argc<6){
68
+ INFOS("!!! Error ... usage : main what mic Mic moc Moc filename1 finename2...");
69
+ exit(0);
70
+ }
71
+ INFOS(argc);
72
+
73
+ int min_in_cache=atoi(argv[2]);
74
+ int max_in_cache=atoi(argv[3]);
75
+ int min_out_of_cache=atoi(argv[4]);
76
+ int max_out_of_cache=atoi(argv[5]);
77
+
78
+
79
+ multiset<Lib_Mean> s_lib_mean ;
80
+
81
+ for (int i=6;i<argc;i++){
82
+
83
+ string filename=argv[i];
84
+
85
+ INFOS(filename);
86
+
87
+ double mic=0;
88
+ double moc=0;
89
+
90
+ {
91
+
92
+ vector<int> tab_sizes;
93
+ vector<double> tab_mflops;
94
+
95
+ read_xy_file(filename,tab_sizes,tab_mflops);
96
+
97
+ mic=mean_calc(tab_sizes,tab_mflops,min_in_cache,max_in_cache);
98
+ moc=mean_calc(tab_sizes,tab_mflops,min_out_of_cache,max_out_of_cache);
99
+
100
+ Lib_Mean cur_lib_mean(filename,mic,moc);
101
+
102
+ s_lib_mean.insert(cur_lib_mean);
103
+
104
+ }
105
+
106
+ }
107
+
108
+
109
+ cout << "<TABLE BORDER CELLPADDING=2>" << endl ;
110
+ cout << " <TR>" << endl ;
111
+ cout << " <TH ALIGN=CENTER> " << argv[1] << " </TH>" << endl ;
112
+ cout << " <TH ALIGN=CENTER> <a href=""#mean_marker""> in cache <BR> mean perf <BR> Mflops </a></TH>" << endl ;
113
+ cout << " <TH ALIGN=CENTER> in cache <BR> % best </TH>" << endl ;
114
+ cout << " <TH ALIGN=CENTER> <a href=""#mean_marker""> out of cache <BR> mean perf <BR> Mflops </a></TH>" << endl ;
115
+ cout << " <TH ALIGN=CENTER> out of cache <BR> % best </TH>" << endl ;
116
+ cout << " <TH ALIGN=CENTER> details </TH>" << endl ;
117
+ cout << " <TH ALIGN=CENTER> comments </TH>" << endl ;
118
+ cout << " </TR>" << endl ;
119
+
120
+ multiset<Lib_Mean>::iterator is = s_lib_mean.begin();
121
+ Lib_Mean best(*is);
122
+
123
+
124
+ for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){
125
+
126
+ cout << " <TR>" << endl ;
127
+ cout << " <TD> " << is->_lib_name << " </TD>" << endl ;
128
+ cout << " <TD> " << is->_mean_in_cache << " </TD>" << endl ;
129
+ cout << " <TD> " << 100*(is->_mean_in_cache/best._mean_in_cache) << " </TD>" << endl ;
130
+ cout << " <TD> " << is->_mean_out_of_cache << " </TD>" << endl ;
131
+ cout << " <TD> " << 100*(is->_mean_out_of_cache/best._mean_out_of_cache) << " </TD>" << endl ;
132
+ cout << " <TD> " <<
133
+ "<a href=\"#"<<is->_lib_name<<"_"<<argv[1]<<"\">snippet</a>/"
134
+ "<a href=\"#"<<is->_lib_name<<"_flags\">flags</a> </TD>" << endl ;
135
+ cout << " <TD> " <<
136
+ "<a href=\"#"<<is->_lib_name<<"_comments\">click here</a> </TD>" << endl ;
137
+ cout << " </TR>" << endl ;
138
+
139
+ }
140
+
141
+ cout << "</TABLE>" << endl ;
142
+
143
+ ofstream output_file ("../order_lib",ios::out) ;
144
+
145
+ for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){
146
+ output_file << is->_lib_name << endl ;
147
+ }
148
+
149
+ output_file.close();
150
+
151
+ }
152
+
153
+ double mean_calc(const vector<int> & tab_sizes, const vector<double> & tab_mflops, const int size_min, const int size_max){
154
+
155
+ int size=tab_sizes.size();
156
+ int nb_sample=0;
157
+ double mean=0.0;
158
+
159
+ for (int i=0;i<size;i++){
160
+
161
+
162
+ if ((tab_sizes[i]>=size_min)&&(tab_sizes[i]<=size_max)){
163
+
164
+ nb_sample++;
165
+ mean+=tab_mflops[i];
166
+
167
+ }
168
+
169
+
170
+ }
171
+
172
+ if (nb_sample==0){
173
+ INFOS("no data for mean calculation");
174
+ return 0.0;
175
+ }
176
+
177
+ return mean/nb_sample;
178
+ }
179
+
180
+
181
+
182
+
include/eigen/bench/btl/data/mk_gnuplot_script.sh ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/bash
2
+ WHAT=$1
3
+ DIR=$2
4
+ echo $WHAT script generation
5
+ cat $WHAT.hh > $WHAT.gnuplot
6
+
7
+ DATA_FILE=`find $DIR -name "*.dat" | grep $WHAT`
8
+
9
+ echo plot \\ >> $WHAT.gnuplot
10
+
11
+ for FILE in $DATA_FILE
12
+ do
13
+ LAST=$FILE
14
+ done
15
+
16
+ echo LAST=$LAST
17
+
18
+ for FILE in $DATA_FILE
19
+ do
20
+ if [ $FILE != $LAST ]
21
+ then
22
+ BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
23
+ echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot
24
+ fi
25
+ done
26
+ BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
27
+ echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot
28
+
29
+ #echo set term postscript color >> $WHAT.gnuplot
30
+ #echo set output "'"$WHAT.ps"'" >> $WHAT.gnuplot
31
+ echo set term pbm small color >> $WHAT.gnuplot
32
+ echo set output "'"$WHAT.ppm"'" >> $WHAT.gnuplot
33
+ echo plot \\ >> $WHAT.gnuplot
34
+
35
+ for FILE in $DATA_FILE
36
+ do
37
+ if [ $FILE != $LAST ]
38
+ then
39
+ BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
40
+ echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot
41
+ fi
42
+ done
43
+ BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
44
+ echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot
45
+
46
+ echo set term jpeg large >> $WHAT.gnuplot
47
+ echo set output "'"$WHAT.jpg"'" >> $WHAT.gnuplot
48
+ echo plot \\ >> $WHAT.gnuplot
49
+
50
+ for FILE in $DATA_FILE
51
+ do
52
+ if [ $FILE != $LAST ]
53
+ then
54
+ BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
55
+ echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot
56
+ fi
57
+ done
58
+ BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
59
+ echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot
60
+
61
+
62
+ gnuplot -persist < $WHAT.gnuplot
63
+
64
+ rm $WHAT.gnuplot
65
+
66
+
67
+
68
+
include/eigen/bench/btl/data/mk_mean_script.sh ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/bash
2
+ WHAT=$1
3
+ DIR=$2
4
+ MINIC=$3
5
+ MAXIC=$4
6
+ MINOC=$5
7
+ MAXOC=$6
8
+ prefix=$8
9
+
10
+ meanstatsfilename=$2/mean.html
11
+
12
+ WORK_DIR=tmp
13
+ mkdir $WORK_DIR
14
+
15
+ DATA_FILE=`find $DIR -name "*.dat" | grep _${WHAT}`
16
+
17
+ if [ -n "$DATA_FILE" ]; then
18
+
19
+ echo ""
20
+ echo "$1..."
21
+ for FILE in $DATA_FILE
22
+ do
23
+ ##echo hello world
24
+ ##echo "mk_mean_script1" ${FILE}
25
+ BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
26
+
27
+ ##echo "mk_mean_script1" ${TITLE}
28
+ cp $FILE ${WORK_DIR}/${TITLE}
29
+
30
+ done
31
+
32
+ cd $WORK_DIR
33
+ ../main $1 $3 $4 $5 $6 * >> ../$meanstatsfilename
34
+ ../mk_new_gnuplot.sh $1 $2 $7
35
+ rm -f *.gnuplot
36
+ cd ..
37
+
38
+ echo '<br/>' >> $meanstatsfilename
39
+
40
+ webpagefilename=$2/index.html
41
+ # echo '<h3>'${WHAT}'</h3>' >> $webpagefilename
42
+ echo '<hr/><a href="'$prefix$1'.pdf"><img src="'$prefix$1'.png" alt="'${WHAT}'" /></a><br/>' >> $webpagefilename
43
+
44
+ fi
45
+
46
+ rm -R $WORK_DIR
47
+
48
+
49
+
50
+
51
+
52
+
include/eigen/bench/btl/data/mk_new_gnuplot.sh ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ WHAT=$1
3
+ DIR=$2
4
+
5
+ cat ../gnuplot_common_settings.hh > ${WHAT}.gnuplot
6
+
7
+ echo "set title " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 2` >> $WHAT.gnuplot
8
+ echo "set xlabel " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 3` " offset 0,0" >> $WHAT.gnuplot
9
+ echo "set xrange [" `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 4` "]" >> $WHAT.gnuplot
10
+
11
+ if [ $# > 3 ]; then
12
+ if [ "$3" == "tiny" ]; then
13
+ echo "set xrange [2:16]" >> $WHAT.gnuplot
14
+ echo "set nologscale" >> $WHAT.gnuplot
15
+ fi
16
+ fi
17
+
18
+
19
+
20
+ DATA_FILE=`cat ../order_lib`
21
+ echo set term postscript color rounded enhanced >> $WHAT.gnuplot
22
+ echo set output "'"../${DIR}/$WHAT.ps"'" >> $WHAT.gnuplot
23
+
24
+ # echo set term svg color rounded enhanced >> $WHAT.gnuplot
25
+ # echo "set terminal svg enhanced size 1000 1000 fname \"Times\" fsize 36" >> $WHAT.gnuplot
26
+ # echo set output "'"../${DIR}/$WHAT.svg"'" >> $WHAT.gnuplot
27
+
28
+ echo plot \\ >> $WHAT.gnuplot
29
+
30
+ for FILE in $DATA_FILE
31
+ do
32
+ LAST=$FILE
33
+ done
34
+
35
+ for FILE in $DATA_FILE
36
+ do
37
+ BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
38
+
39
+ echo "'"$FILE"'" `grep $TITLE ../perlib_plot_settings.txt | head -n 1 | cut -d ";" -f 2` "\\" >> $WHAT.gnuplot
40
+ if [ $FILE != $LAST ]
41
+ then
42
+ echo ", \\" >> $WHAT.gnuplot
43
+ fi
44
+ done
45
+ echo " " >> $WHAT.gnuplot
46
+
47
+ gnuplot -persist < $WHAT.gnuplot
48
+
49
+ rm $WHAT.gnuplot
50
+
51
+ ps2pdf ../${DIR}/$WHAT.ps ../${DIR}/$WHAT.pdf
52
+ convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 ../${DIR}/$WHAT.ps -background white -flatten ../${DIR}/$WHAT.png
53
+
54
+ # pstoedit -rotate -90 -xscale 0.8 -yscale 0.8 -centered -yshift -50 -xshift -100 -f plot-svg aat.ps aat2.svg
include/eigen/bench/btl/data/perlib_plot_settings.txt ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ eigen3 ; with lines lw 4 lt 1 lc rgbcolor "black"
2
+ eigen2 ; with lines lw 3 lt 1 lc rgbcolor "#999999"
3
+ EigenBLAS ; with lines lw 3 lt 3 lc rgbcolor "#999999"
4
+ eigen3_novec ; with lines lw 2 lt 1 lc rgbcolor "#999999"
5
+ eigen3_nogccvec ; with lines lw 2 lt 2 lc rgbcolor "#991010"
6
+ INTEL_MKL ; with lines lw 3 lt 1 lc rgbcolor "#ff0000"
7
+ ATLAS ; with lines lw 3 lt 1 lc rgbcolor "#008000"
8
+ gmm ; with lines lw 3 lt 1 lc rgbcolor "#0000ff"
9
+ ublas ; with lines lw 3 lt 1 lc rgbcolor "#00b7ff"
10
+ mtl4 ; with lines lw 3 lt 1 lc rgbcolor "#d18847"
11
+ blitz ; with lines lw 3 lt 1 lc rgbcolor "#ff00ff"
12
+ F77 ; with lines lw 3 lt 3 lc rgbcolor "#e6e64c"
13
+ OPENBLAS ; with lines lw 3 lt 1 lc rgbcolor "#C05600"
14
+ C ; with lines lw 3 lt 3 lc rgbcolor "#e6bd96"
15
+ ACML ; with lines lw 2 lt 3 lc rgbcolor "#e6e64c"
16
+ blaze ; with lines lw 3 lt 1 lc rgbcolor "#ff00ff"
include/eigen/bench/btl/data/regularize.cxx ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : regularize.cxx
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:15 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #include "utilities.h"
21
+ #include <vector>
22
+ #include <string>
23
+ #include <iostream>
24
+ #include <fstream>
25
+ #include "bench_parameter.hh"
26
+ #include <set>
27
+
28
+ using namespace std;
29
+
30
+ void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops);
31
+ void regularize_curve(const string & filename,
32
+ const vector<double> & tab_mflops,
33
+ const vector<int> & tab_sizes,
34
+ int start_cut_size, int stop_cut_size);
35
+ /////////////////////////////////////////////////////////////////////////////////////////////////
36
+
37
+ int main( int argc , char *argv[] )
38
+ {
39
+
40
+ // input data
41
+
42
+ if (argc<4){
43
+ INFOS("!!! Error ... usage : main filename start_cut_size stop_cut_size regularize_filename");
44
+ exit(0);
45
+ }
46
+ INFOS(argc);
47
+
48
+ int start_cut_size=atoi(argv[2]);
49
+ int stop_cut_size=atoi(argv[3]);
50
+
51
+ string filename=argv[1];
52
+ string regularize_filename=argv[4];
53
+
54
+ INFOS(filename);
55
+ INFOS("start_cut_size="<<start_cut_size);
56
+
57
+ vector<int> tab_sizes;
58
+ vector<double> tab_mflops;
59
+
60
+ read_xy_file(filename,tab_sizes,tab_mflops);
61
+
62
+ // regularizeing
63
+
64
+ regularize_curve(regularize_filename,tab_mflops,tab_sizes,start_cut_size,stop_cut_size);
65
+
66
+
67
+ }
68
+
69
+ //////////////////////////////////////////////////////////////////////////////////////
70
+
71
+ void regularize_curve(const string & filename,
72
+ const vector<double> & tab_mflops,
73
+ const vector<int> & tab_sizes,
74
+ int start_cut_size, int stop_cut_size)
75
+ {
76
+ int size=tab_mflops.size();
77
+ ofstream output_file (filename.c_str(),ios::out) ;
78
+
79
+ int i=0;
80
+
81
+ while(tab_sizes[i]<start_cut_size){
82
+
83
+ output_file << tab_sizes[i] << " " << tab_mflops[i] << endl ;
84
+ i++;
85
+
86
+ }
87
+
88
+ output_file << endl ;
89
+
90
+ while(tab_sizes[i]<stop_cut_size){
91
+
92
+ i++;
93
+
94
+ }
95
+
96
+ while(i<size){
97
+
98
+ output_file << tab_sizes[i] << " " << tab_mflops[i] << endl ;
99
+ i++;
100
+
101
+ }
102
+
103
+ output_file.close();
104
+
105
+ }
106
+
107
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
108
+
109
+ void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops){
110
+
111
+ ifstream input_file (filename.c_str(),ios::in) ;
112
+
113
+ if (!input_file){
114
+ INFOS("!!! Error opening "<<filename);
115
+ exit(0);
116
+ }
117
+
118
+ int nb_point=0;
119
+ int size=0;
120
+ double mflops=0;
121
+
122
+ while (input_file >> size >> mflops ){
123
+ nb_point++;
124
+ tab_sizes.push_back(size);
125
+ tab_mflops.push_back(mflops);
126
+ }
127
+ SCRUTE(nb_point);
128
+
129
+ input_file.close();
130
+ }
131
+
include/eigen/bench/btl/data/smooth.cxx ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : smooth.cxx
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:15 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #include "utilities.h"
21
+ #include <vector>
22
+ #include <deque>
23
+ #include <string>
24
+ #include <iostream>
25
+ #include <fstream>
26
+ #include "bench_parameter.hh"
27
+ #include <set>
28
+
29
+ using namespace std;
30
+
31
+ void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops);
32
+ void write_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops);
33
+ void smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width);
34
+ void centered_smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width);
35
+
36
+ /////////////////////////////////////////////////////////////////////////////////////////////////
37
+
38
+ int main( int argc , char *argv[] )
39
+ {
40
+
41
+ // input data
42
+
43
+ if (argc<3){
44
+ INFOS("!!! Error ... usage : main filename window_half_width smooth_filename");
45
+ exit(0);
46
+ }
47
+ INFOS(argc);
48
+
49
+ int window_half_width=atoi(argv[2]);
50
+
51
+ string filename=argv[1];
52
+ string smooth_filename=argv[3];
53
+
54
+ INFOS(filename);
55
+ INFOS("window_half_width="<<window_half_width);
56
+
57
+ vector<int> tab_sizes;
58
+ vector<double> tab_mflops;
59
+
60
+ read_xy_file(filename,tab_sizes,tab_mflops);
61
+
62
+ // smoothing
63
+
64
+ vector<double> smooth_tab_mflops;
65
+
66
+ //smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width);
67
+ centered_smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width);
68
+
69
+ // output result
70
+
71
+ write_xy_file(smooth_filename,tab_sizes,smooth_tab_mflops);
72
+
73
+
74
+ }
75
+
76
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
77
+
78
+ template<class VECTOR>
79
+ double weighted_mean(const VECTOR & data)
80
+ {
81
+
82
+ double mean=0.0;
83
+
84
+ for (int i=0 ; i<data.size() ; i++){
85
+
86
+ mean+=data[i];
87
+
88
+ }
89
+
90
+ return mean/double(data.size()) ;
91
+
92
+ }
93
+
94
+
95
+
96
+
97
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
98
+
99
+
100
+ void smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width){
101
+
102
+ int window_width=2*window_half_width+1;
103
+
104
+ int size=tab_mflops.size();
105
+
106
+ vector<double> sample(window_width);
107
+
108
+ for (int i=0 ; i < size ; i++){
109
+
110
+ for ( int j=0 ; j < window_width ; j++ ){
111
+
112
+ int shifted_index=i+j-window_half_width;
113
+ if (shifted_index<0) shifted_index=0;
114
+ if (shifted_index>size-1) shifted_index=size-1;
115
+ sample[j]=tab_mflops[shifted_index];
116
+
117
+ }
118
+
119
+ smooth_tab_mflops.push_back(weighted_mean(sample));
120
+
121
+ }
122
+
123
+ }
124
+
125
+ void centered_smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width){
126
+
127
+ int max_window_width=2*window_half_width+1;
128
+
129
+ int size=tab_mflops.size();
130
+
131
+
132
+ for (int i=0 ; i < size ; i++){
133
+
134
+ deque<double> sample;
135
+
136
+
137
+ sample.push_back(tab_mflops[i]);
138
+
139
+ for ( int j=1 ; j <= window_half_width ; j++ ){
140
+
141
+ int before=i-j;
142
+ int after=i+j;
143
+
144
+ if ((before>=0)&&(after<size)) // inside of the vector
145
+ {
146
+ sample.push_front(tab_mflops[before]);
147
+ sample.push_back(tab_mflops[after]);
148
+ }
149
+ }
150
+
151
+ smooth_tab_mflops.push_back(weighted_mean(sample));
152
+
153
+ }
154
+
155
+ }
156
+
157
+
158
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
159
+
160
+ void write_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops){
161
+
162
+ ofstream output_file (filename.c_str(),ios::out) ;
163
+
164
+ for (int i=0 ; i < tab_sizes.size() ; i++)
165
+ {
166
+ output_file << tab_sizes[i] << " " << tab_mflops[i] << endl ;
167
+ }
168
+
169
+ output_file.close();
170
+
171
+ }
172
+
173
+
174
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
175
+
176
+ void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops){
177
+
178
+ ifstream input_file (filename.c_str(),ios::in) ;
179
+
180
+ if (!input_file){
181
+ INFOS("!!! Error opening "<<filename);
182
+ exit(0);
183
+ }
184
+
185
+ int nb_point=0;
186
+ int size=0;
187
+ double mflops=0;
188
+
189
+ while (input_file >> size >> mflops ){
190
+ nb_point++;
191
+ tab_sizes.push_back(size);
192
+ tab_mflops.push_back(mflops);
193
+ }
194
+ SCRUTE(nb_point);
195
+
196
+ input_file.close();
197
+ }
198
+
include/eigen/bench/btl/data/smooth_all.sh ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/bash
2
+ ORIG_DIR=$1
3
+ SMOOTH_DIR=${ORIG_DIR}_smooth
4
+ mkdir ${SMOOTH_DIR}
5
+
6
+ AXPY_FILE=`find ${ORIG_DIR} -name "*.dat" | grep axpy`
7
+ for FILE in ${AXPY_FILE}
8
+ do
9
+ echo $FILE
10
+ BASE=${FILE##*/}
11
+ ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp
12
+ ./regularize ${SMOOTH_DIR}/${BASE}_tmp 2500 15000 ${SMOOTH_DIR}/${BASE}
13
+ rm -f ${SMOOTH_DIR}/${BASE}_tmp
14
+ done
15
+
16
+
17
+ MATRIX_VECTOR_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_vector`
18
+ for FILE in ${MATRIX_VECTOR_FILE}
19
+ do
20
+ echo $FILE
21
+ BASE=${FILE##*/}
22
+ ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp
23
+ ./regularize ${SMOOTH_DIR}/${BASE}_tmp 50 180 ${SMOOTH_DIR}/${BASE}
24
+ rm -f ${SMOOTH_DIR}/${BASE}_tmp
25
+ done
26
+
27
+ MATRIX_MATRIX_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_matrix`
28
+ for FILE in ${MATRIX_MATRIX_FILE}
29
+ do
30
+ echo $FILE
31
+ BASE=${FILE##*/}
32
+ ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}
33
+ done
34
+
35
+ AAT_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _aat`
36
+ for FILE in ${AAT_FILE}
37
+ do
38
+ echo $FILE
39
+ BASE=${FILE##*/}
40
+ ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}
41
+ done
42
+
43
+
44
+ ATA_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _ata`
45
+ for FILE in ${ATA_FILE}
46
+ do
47
+ echo $FILE
48
+ BASE=${FILE##*/}
49
+ ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}
50
+ done
51
+
52
+ ### no smoothing for tinyvector and matrices libs
53
+
54
+ TINY_BLITZ_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tiny_blitz`
55
+ for FILE in ${TINY_BLITZ_FILE}
56
+ do
57
+ echo $FILE
58
+ BASE=${FILE##*/}
59
+ cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE}
60
+ done
61
+
62
+ TVMET_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tvmet`
63
+ for FILE in ${TVMET_FILE}
64
+ do
65
+ echo $FILE
66
+ BASE=${FILE##*/}
67
+ cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE}
68
+ done
include/eigen/bench/btl/generic_bench/bench.hh ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : bench.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef BENCH_HH
21
+ #define BENCH_HH
22
+
23
+ #include "btl.hh"
24
+ #include "bench_parameter.hh"
25
+ #include <iostream>
26
+ #include "utilities.h"
27
+ #include "size_lin_log.hh"
28
+ #include "xy_file.hh"
29
+ #include <vector>
30
+ #include <string>
31
+ #include "timers/portable_perf_analyzer.hh"
32
+ // #include "timers/mixed_perf_analyzer.hh"
33
+ // #include "timers/x86_perf_analyzer.hh"
34
+ // #include "timers/STL_perf_analyzer.hh"
35
+ #ifdef HAVE_MKL
36
+ extern "C" void cblas_saxpy(const int, const float, const float*, const int, float *, const int);
37
+ #endif
38
+ using namespace std;
39
+
40
+ template <template<class> class Perf_Analyzer, class Action>
41
+ BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point )
42
+ {
43
+ if (BtlConfig::skipAction(Action::name()))
44
+ return;
45
+
46
+ string filename="bench_"+Action::name()+".dat";
47
+
48
+ INFOS("starting " <<filename);
49
+
50
+ // utilities
51
+
52
+ std::vector<double> tab_mflops(nb_point);
53
+ std::vector<int> tab_sizes(nb_point);
54
+
55
+ // matrices and vector size calculations
56
+ size_lin_log(nb_point,size_min,size_max,tab_sizes);
57
+
58
+ std::vector<int> oldSizes;
59
+ std::vector<double> oldFlops;
60
+ bool hasOldResults = read_xy_file(filename, oldSizes, oldFlops, true);
61
+ int oldi = oldSizes.size() - 1;
62
+
63
+ // loop on matrix size
64
+ Perf_Analyzer<Action> perf_action;
65
+ for (int i=nb_point-1;i>=0;i--)
66
+ {
67
+ //INFOS("size=" <<tab_sizes[i]<<" ("<<nb_point-i<<"/"<<nb_point<<")");
68
+ std::cout << " " << "size = " << tab_sizes[i] << " " << std::flush;
69
+
70
+ BTL_DISABLE_SSE_EXCEPTIONS();
71
+ #ifdef HAVE_MKL
72
+ {
73
+ float dummy;
74
+ cblas_saxpy(1,0,&dummy,1,&dummy,1);
75
+ }
76
+ #endif
77
+
78
+ tab_mflops[i] = perf_action.eval_mflops(tab_sizes[i]);
79
+ std::cout << tab_mflops[i];
80
+
81
+ if (hasOldResults)
82
+ {
83
+ while (oldi>=0 && oldSizes[oldi]>tab_sizes[i])
84
+ --oldi;
85
+ if (oldi>=0 && oldSizes[oldi]==tab_sizes[i])
86
+ {
87
+ if (oldFlops[oldi]<tab_mflops[i])
88
+ std::cout << "\t > ";
89
+ else
90
+ std::cout << "\t < ";
91
+ std::cout << oldFlops[oldi];
92
+ }
93
+ --oldi;
94
+ }
95
+ std::cout << " MFlops (" << nb_point-i << "/" << nb_point << ")" << std::endl;
96
+ }
97
+
98
+ if (!BtlConfig::Instance.overwriteResults)
99
+ {
100
+ if (hasOldResults)
101
+ {
102
+ // merge the two data
103
+ std::vector<int> newSizes;
104
+ std::vector<double> newFlops;
105
+ unsigned int i=0;
106
+ unsigned int j=0;
107
+ while (i<tab_sizes.size() && j<oldSizes.size())
108
+ {
109
+ if (tab_sizes[i] == oldSizes[j])
110
+ {
111
+ newSizes.push_back(tab_sizes[i]);
112
+ newFlops.push_back(std::max(tab_mflops[i], oldFlops[j]));
113
+ ++i;
114
+ ++j;
115
+ }
116
+ else if (tab_sizes[i] < oldSizes[j])
117
+ {
118
+ newSizes.push_back(tab_sizes[i]);
119
+ newFlops.push_back(tab_mflops[i]);
120
+ ++i;
121
+ }
122
+ else
123
+ {
124
+ newSizes.push_back(oldSizes[j]);
125
+ newFlops.push_back(oldFlops[j]);
126
+ ++j;
127
+ }
128
+ }
129
+ while (i<tab_sizes.size())
130
+ {
131
+ newSizes.push_back(tab_sizes[i]);
132
+ newFlops.push_back(tab_mflops[i]);
133
+ ++i;
134
+ }
135
+ while (j<oldSizes.size())
136
+ {
137
+ newSizes.push_back(oldSizes[j]);
138
+ newFlops.push_back(oldFlops[j]);
139
+ ++j;
140
+ }
141
+ tab_mflops = newFlops;
142
+ tab_sizes = newSizes;
143
+ }
144
+ }
145
+
146
+ // dump the result in a file :
147
+ dump_xy_file(tab_sizes,tab_mflops,filename);
148
+
149
+ }
150
+
151
+ // default Perf Analyzer
152
+
153
+ template <class Action>
154
+ BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point ){
155
+
156
+ // if the rdtsc is not available :
157
+ bench<Portable_Perf_Analyzer,Action>(size_min,size_max,nb_point);
158
+ // if the rdtsc is available :
159
+ // bench<Mixed_Perf_Analyzer,Action>(size_min,size_max,nb_point);
160
+
161
+
162
+ // Only for small problem size. Otherwise it will be too long
163
+ // bench<X86_Perf_Analyzer,Action>(size_min,size_max,nb_point);
164
+ // bench<STL_Perf_Analyzer,Action>(size_min,size_max,nb_point);
165
+
166
+ }
167
+
168
+ #endif
include/eigen/bench/btl/generic_bench/bench_parameter.hh ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //=====================================================
2
+ // File : bench_parameter.hh
3
+ // Author : L. Plagne <laurent.plagne@edf.fr)>
4
+ // Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002
5
+ //=====================================================
6
+ //
7
+ // This program is free software; you can redistribute it and/or
8
+ // modify it under the terms of the GNU General Public License
9
+ // as published by the Free Software Foundation; either version 2
10
+ // of the License, or (at your option) any later version.
11
+ //
12
+ // This program is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ // You should have received a copy of the GNU General Public License
17
+ // along with this program; if not, write to the Free Software
18
+ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
+ //
20
+ #ifndef BENCH_PARAMETER_HH
21
+ #define BENCH_PARAMETER_HH
22
+
23
+ // minimal time for each measurement
24
+ #define REAL_TYPE float
25
+ // minimal time for each measurement
26
+ #define MIN_TIME 0.2
27
+ // nb of point on bench curves
28
+ #define NB_POINT 100
29
+ // min vector size for axpy bench
30
+ #define MIN_AXPY 5
31
+ // max vector size for axpy bench
32
+ #define MAX_AXPY 3000000
33
+ // min matrix size for matrix vector product bench
34
+ #define MIN_MV 5
35
+ // max matrix size for matrix vector product bench
36
+ #define MAX_MV 5000
37
+ // min matrix size for matrix matrix product bench
38
+ #define MIN_MM 5
39
+ // max matrix size for matrix matrix product bench
40
+ #define MAX_MM MAX_MV
41
+ // min matrix size for LU bench
42
+ #define MIN_LU 5
43
+ // max matrix size for LU bench
44
+ #define MAX_LU 3000
45
+ // max size for tiny vector and matrix
46
+ #define TINY_MV_MAX_SIZE 16
47
+ // default nb_sample for x86 timer
48
+ #define DEFAULT_NB_SAMPLE 1000
49
+
50
+ // how many times we run a single bench (keep the best perf)
51
+ #define DEFAULT_NB_TRIES 3
52
+
53
+ #endif