Publish
This commit is contained in:
commit
1b3e0d6d57
602 changed files with 4433 additions and 0 deletions
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
*.aux
|
||||||
|
*.fdb_latexmk
|
||||||
|
*.fls
|
||||||
|
*.log
|
||||||
|
*.out
|
||||||
|
*.toc
|
||||||
|
*.synctex.gz
|
||||||
|
*-blx.bib
|
||||||
|
*.bbl
|
||||||
|
*.bcf
|
||||||
|
*.blg
|
||||||
|
*.run.xml
|
||||||
|
*#
|
||||||
|
*.glg
|
||||||
|
*.glo
|
||||||
|
*.gls
|
||||||
|
*.ist
|
||||||
|
compile_commands.json
|
||||||
|
*.o
|
||||||
|
.clangd
|
||||||
|
_minted*
|
||||||
|
*(busy)
|
||||||
|
delta.pdf
|
674
LICENSE
Normal file
674
LICENSE
Normal file
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
27
README.md
Normal file
27
README.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# A Performance Analysis of High-Level Synthesis for FPGAs
|
||||||
|
|
||||||
|
This repository stores the code and latex of my bachelor's thesis. The full thesis PDF can be found in [hls_performance_thesis.pdf](hls_performance_thesis.pdf).
|
||||||
|
|
||||||
|
## Abstract
|
||||||
|
|
||||||
|
It is becoming increasingly popular to use Field-Programmable Gate Arrays (FPGAs)
|
||||||
|
as hardware accelerators in order to speed up certain parts of an algorithm. FPGAs
|
||||||
|
promise more energy efficiency and increased performance compared to CPUs. They are,
|
||||||
|
however, traditionally programmed with Hardware Description Languages (HDLs), which
|
||||||
|
are notoriously hard to use.
|
||||||
|
To accelerate their adoption in different contexts and domains, FPGAs can nowadays
|
||||||
|
also be programmed with high-level languages, such as C/C++ or OpenCL, in a process
|
||||||
|
called High-Level Synthesis (HLS). However, it can be a challenge to efficiently accelerate
|
||||||
|
algorithms using HLS.
|
||||||
|
In this thesis, we investigate the performance of HLS for a non-trivial case-study. To
|
||||||
|
this end, we devise a performance comparison between a sequential CPU algorithm and its
|
||||||
|
FPGA version, programmed with OpenCL for the Xilinx Vitis platform. Our case study is a
|
||||||
|
string-searching algorithm using the FM-index method, which is able to efficiently locate
|
||||||
|
substrings in arbitrarily long texts.
|
||||||
|
Our naive reference implementation is a simple port from CPU to OpenCL. In search
|
||||||
|
for more performance, on top of this naive OpenCL implementation, we also propose and
|
||||||
|
evaluate two FPGA-specific optimizations, suggested by literature.
|
||||||
|
Our empirical analysis shows that optimizations can greatly improve the performance of
|
||||||
|
algorithms programmed with HLS for FPGAs. However, the performance of our HLS-based
|
||||||
|
FPGA version for our case study could not match the performance of the CPU, despite
|
||||||
|
being more work efficient.
|
6
code/.gitignore
vendored
Normal file
6
code/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
program
|
||||||
|
repl
|
||||||
|
construct
|
||||||
|
experiment_data
|
||||||
|
generate_test_data
|
||||||
|
benchmark
|
31
code/Makefile
Normal file
31
code/Makefile
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
CC=gcc
|
||||||
|
CPPC=g++
|
||||||
|
CFLAGS=-I. -Wextra -Wall -g
|
||||||
|
DEPS = fmindex.h util.h
|
||||||
|
OBJ = fmindex.o util.o rapl.o
|
||||||
|
EXES = program repl construct generate_test_data benchmark
|
||||||
|
|
||||||
|
%.o: %.c $(DEPS)
|
||||||
|
$(CC) -c -o $@ $< $(CFLAGS)
|
||||||
|
|
||||||
|
all: $(EXES)
|
||||||
|
|
||||||
|
program: $(OBJ) program.o
|
||||||
|
$(CC) -o $@ $^ $(CFLAGS)
|
||||||
|
|
||||||
|
repl: $(OBJ) repl.o
|
||||||
|
$(CC) -o $@ $^ $(CFLAGS)
|
||||||
|
|
||||||
|
construct: $(OBJ) construct.o
|
||||||
|
$(CC) -o $@ $^ $(CFLAGS)
|
||||||
|
|
||||||
|
generate_test_data: $(OBJ) generate_test_data.o
|
||||||
|
$(CPPC) -o $@ $^ $(CFLAGS)
|
||||||
|
|
||||||
|
benchmark: $(OBJ) benchmark.o
|
||||||
|
$(CPPC) -o $@ $^ $(CFLAGS)
|
||||||
|
|
||||||
|
.PHONY: clean all
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o *~ core $(EXES)
|
79
code/benchmark.c
Normal file
79
code/benchmark.c
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
#include "fmindex.h"
|
||||||
|
#include "rapl.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
// Global variables which can be accessed in function reference.
|
||||||
|
unsigned pattern_count, pattern_sz, max_match_count;
|
||||||
|
char *patterns;
|
||||||
|
fm_index *fm;
|
||||||
|
float total_time;
|
||||||
|
unsigned long total_matches = 0;
|
||||||
|
unsigned long *match_indices;
|
||||||
|
|
||||||
|
static void benchmark(void) {
|
||||||
|
float time1 = 0., time2 = 0.;
|
||||||
|
float start_time, end_time;
|
||||||
|
for (unsigned i = 0; i < pattern_count; ++i) {
|
||||||
|
ranges_t start, end;
|
||||||
|
start_time = (float)clock() / CLOCKS_PER_SEC;
|
||||||
|
FMIndexFindMatchRange(fm, &patterns[i * pattern_sz], pattern_sz, &start,
|
||||||
|
&end);
|
||||||
|
end_time = (float)clock() / CLOCKS_PER_SEC;
|
||||||
|
time1 += end_time - start_time;
|
||||||
|
|
||||||
|
start_time = (float)clock() / CLOCKS_PER_SEC;
|
||||||
|
FMIndexFindRangeIndices(fm, start, end, &match_indices);
|
||||||
|
end_time = (float)clock() / CLOCKS_PER_SEC;
|
||||||
|
time2 += end_time - start_time;
|
||||||
|
|
||||||
|
total_matches += end - start;
|
||||||
|
}
|
||||||
|
|
||||||
|
total_time = time1 + time2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if (argc < 3) {
|
||||||
|
fprintf(stderr, "Usage: $ %s <FMFILE> <TESTFILE>\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fm = FMIndexReadFromFile(argv[1], 0);
|
||||||
|
if (!fm) {
|
||||||
|
fprintf(stderr, "Failed to read FM-index from file.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LoadTestData(argv[2], &patterns, &pattern_count, &pattern_sz,
|
||||||
|
&max_match_count, 0))) {
|
||||||
|
fprintf(stderr, "Could not read test data file.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
match_indices = calloc(max_match_count, sizeof(unsigned long));
|
||||||
|
if (!match_indices) {
|
||||||
|
fprintf(stderr, "Failed to allocate memory for match indices.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
double total_joules;
|
||||||
|
if (rapl_sysfs(benchmark, &total_joules) != 0) {
|
||||||
|
fprintf(stderr, "Failed to get energy consumption\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%a %a %lu\n", total_time, total_joules, total_matches);
|
||||||
|
|
||||||
|
free(match_indices);
|
||||||
|
free(patterns);
|
||||||
|
FMIndexFree(fm);
|
||||||
|
return 0;
|
||||||
|
}
|
64
code/benchmark_cpu.py
Normal file
64
code/benchmark_cpu.py
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
import argparse
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def main(repeats, count, maxmatches, lengths, dir, filenames):
|
||||||
|
for filename in filenames:
|
||||||
|
for length in lengths:
|
||||||
|
benchmark(repeats, count, maxmatches, length, dir, filename)
|
||||||
|
|
||||||
|
|
||||||
|
def benchmark(repeats, count, maxmatches, length, dir, filename):
|
||||||
|
testfilename = f"{dir}/{filename}.cpu{length}.test"
|
||||||
|
fmfilename = f"{dir}/{filename}.fm"
|
||||||
|
textfilename = f"{dir}/{filename}"
|
||||||
|
resultfilename = f"{dir}/{filename}.cpu{length}.result"
|
||||||
|
|
||||||
|
gentestargs = ["./generate_test_data", textfilename, fmfilename, testfilename, str(count), str(length), str(maxmatches)]
|
||||||
|
benchmarkargs = ["./benchmark", fmfilename, testfilename]
|
||||||
|
print(" ".join(gentestargs))
|
||||||
|
print(" ".join(benchmarkargs))
|
||||||
|
|
||||||
|
# Remove result file if it already exists.
|
||||||
|
try:
|
||||||
|
os.remove(resultfilename)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
for n in range(repeats):
|
||||||
|
print(f"{n+1}/{repeats}")
|
||||||
|
|
||||||
|
# Create test file.
|
||||||
|
gentestproc = subprocess.Popen(gentestargs, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
stdout, stderr = gentestproc.communicate()
|
||||||
|
if stderr:
|
||||||
|
print(f">{stderr.strip()}")
|
||||||
|
ret = gentestproc.poll()
|
||||||
|
if ret != 0:
|
||||||
|
print(f"Error creating test data: {stdout.strip()}")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
# Create result file.
|
||||||
|
with open(resultfilename, "a") as resultfile:
|
||||||
|
benchmarkproc = subprocess.Popen(benchmarkargs, stdout=resultfile, universal_newlines=True, stderr=subprocess.PIPE)
|
||||||
|
_, stderr = benchmarkproc.communicate()
|
||||||
|
if stderr:
|
||||||
|
print(f">{stderr.strip()}")
|
||||||
|
ret = benchmarkproc.poll()
|
||||||
|
if ret != 0:
|
||||||
|
print("Error benchmarking test data")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("-n", "--repeats", help="number of times to repeat each experiment", type=int, required=True)
|
||||||
|
parser.add_argument("-c", "--count", help="number of patterns", type=int, required=True)
|
||||||
|
parser.add_argument("-m", "--maxmatches", help="maximum number of matches per pattern", type=int, required=True)
|
||||||
|
parser.add_argument("-l", "--lengths", help="length of the patterns", type=int, nargs="+", default=[], required=True)
|
||||||
|
parser.add_argument("-d", "--dir", help="directory containing FM-indices and original texts (with the same name)", required=True)
|
||||||
|
parser.add_argument("-f", "--files", help="FM-index files to benchmark", nargs="+", default=[], required=True)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
main(args.repeats, args.count, args.maxmatches, args.lengths, args.dir, args.files)
|
30
code/construct.c
Normal file
30
code/construct.c
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#include "fmindex.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
if (argc < 3) {
|
||||||
|
printf("Usage: $ %s <INPUTFILE> <OUTPUTFILE>\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *s = ReadFile(argv[1]);
|
||||||
|
if (!s)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
fm_index *index = FMIndexConstruct(s);
|
||||||
|
if (!index) {
|
||||||
|
printf("Failed to construct index.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!FMIndexDumpToFile(index, argv[2])) {
|
||||||
|
printf("Failed to write FM-index to file.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FMIndexFree(index);
|
||||||
|
free(s);
|
||||||
|
return 0;
|
||||||
|
}
|
5
code/cpu_results/dblp.xml.10MB.cpu4.result
Normal file
5
code/cpu_results/dblp.xml.10MB.cpu4.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.6477fp-2 0x1.22abebp+25 171360982
|
||||||
|
0x1.5b44c8p-2 0x1.2b59f9p+25 174285929
|
||||||
|
0x1.66d8p-2 0x1.28d3dcp+25 172040584
|
||||||
|
0x1.59b5ep-2 0x1.29edabp+25 174000838
|
||||||
|
0x1.5f7ep-2 0x1.1f099cp+25 168176711
|
5
code/cpu_results/dblp.xml.10MB.cpu6.result
Normal file
5
code/cpu_results/dblp.xml.10MB.cpu6.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.dc032p-3 0x1.885c8ap+24 108982070
|
||||||
|
0x1.e32bp-3 0x1.8e6becp+24 110444451
|
||||||
|
0x1.e262ap-3 0x1.8d2bf8p+24 110958122
|
||||||
|
0x1.f334p-3 0x1.9b5deep+24 115123603
|
||||||
|
0x1.ce874p-3 0x1.81151p+24 113346544
|
5
code/cpu_results/dblp.xml.10MB.cpu8.result
Normal file
5
code/cpu_results/dblp.xml.10MB.cpu8.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.d3c5p-4 0x1.903b2ap+23 53234288
|
||||||
|
0x1.c491cp-4 0x1.86f7dcp+23 51182855
|
||||||
|
0x1.cfe28p-4 0x1.8f3564p+23 52348451
|
||||||
|
0x1.c04p-4 0x1.800afep+23 50877186
|
||||||
|
0x1.f90c8p-4 0x1.b10df8p+23 50214738
|
5
code/cpu_results/dblp.xml.15MB.cpu4.result
Normal file
5
code/cpu_results/dblp.xml.15MB.cpu4.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.fb7a8p-2 0x1.a2b59e8p+25 256535338
|
||||||
|
0x1.f103ap-2 0x1.9a685cp+25 250410896
|
||||||
|
0x1.f7b0fp-2 0x1.a13b028p+25 248846051
|
||||||
|
0x1.f6ec6p-2 0x1.a16cb88p+25 253974661
|
||||||
|
0x1.ff299p-2 0x1.a58ed2p+25 258322531
|
5
code/cpu_results/dblp.xml.15MB.cpu6.result
Normal file
5
code/cpu_results/dblp.xml.15MB.cpu6.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.4d16ap-2 0x1.1620e78p+25 165252248
|
||||||
|
0x1.53f52p-2 0x1.1b1bb98p+25 168443910
|
||||||
|
0x1.438b4p-2 0x1.0d4fcd8p+25 160215390
|
||||||
|
0x1.4b71ep-2 0x1.12ba34p+25 163605068
|
||||||
|
0x1.4fafcp-2 0x1.1698d4p+25 166128629
|
5
code/cpu_results/dblp.xml.15MB.cpu8.result
Normal file
5
code/cpu_results/dblp.xml.15MB.cpu8.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.41d8ap-3 0x1.11bfap+24 74552832
|
||||||
|
0x1.3eefep-3 0x1.0daaa3p+24 74737159
|
||||||
|
0x1.3c48ap-3 0x1.0aea5ap+24 74006790
|
||||||
|
0x1.4209ap-3 0x1.12066fp+24 75652221
|
||||||
|
0x1.3e1a2p-3 0x1.0f36e4p+24 74332277
|
5
code/cpu_results/dblp.xml.20MB.cpu4.result
Normal file
5
code/cpu_results/dblp.xml.20MB.cpu4.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.4045dp-1 0x1.09ff364p+26 319604955
|
||||||
|
0x1.45e9cp-1 0x1.0e48e38p+26 325973389
|
||||||
|
0x1.4ec6cp-1 0x1.167383cp+26 334037324
|
||||||
|
0x1.44e6cp-1 0x1.0b42dd4p+26 324111950
|
||||||
|
0x1.494b4p-1 0x1.0ec5e1p+26 329018290
|
5
code/cpu_results/dblp.xml.20MB.cpu6.result
Normal file
5
code/cpu_results/dblp.xml.20MB.cpu6.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.ba04ep-2 0x1.6f1d43p+25 215259281
|
||||||
|
0x1.b1094p-2 0x1.67563b8p+25 211398266
|
||||||
|
0x1.a9b66p-2 0x1.63b7078p+25 211580469
|
||||||
|
0x1.a923ap-2 0x1.62cc108p+25 211496190
|
||||||
|
0x1.a2bd4p-2 0x1.5db353p+25 209139670
|
5
code/cpu_results/dblp.xml.20MB.cpu8.result
Normal file
5
code/cpu_results/dblp.xml.20MB.cpu8.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.9d7fcp-3 0x1.5d2c61p+24 97664968
|
||||||
|
0x1.a1b28p-3 0x1.61a48cp+24 99282005
|
||||||
|
0x1.8a2ecp-3 0x1.4df333p+24 92818122
|
||||||
|
0x1.8d93p-3 0x1.4f55f7p+24 94123638
|
||||||
|
0x1.9f80cp-3 0x1.5ca19ep+24 99177125
|
5
code/cpu_results/dna.10MB.cpu4.result
Normal file
5
code/cpu_results/dna.10MB.cpu4.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.845828p-1 0x1.35f82dp+26 398786955
|
||||||
|
0x1.83880cp-1 0x1.3729878p+26 398482564
|
||||||
|
0x1.80a4aap-1 0x1.3b15634p+26 394461926
|
||||||
|
0x1.82cccep-1 0x1.3dccf9p+26 395082462
|
||||||
|
0x1.7d2d2p-1 0x1.3768a68p+26 389967743
|
5
code/cpu_results/dna.10MB.cpu6.result
Normal file
5
code/cpu_results/dna.10MB.cpu6.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.125d58p-4 0x1.e6b25cp+22 30743684
|
||||||
|
0x1.1521ecp-4 0x1.ea8d6cp+22 30733306
|
||||||
|
0x1.11be7p-4 0x1.e61bbp+22 30733306
|
||||||
|
0x1.13663p-4 0x1.eda22p+22 30733306
|
||||||
|
0x1.11cec8p-4 0x1.ee1d24p+22 30417546
|
5
code/cpu_results/dna.10MB.cpu8.result
Normal file
5
code/cpu_results/dna.10MB.cpu8.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.117a6p-6 0x1.3a3a3p+21 2970948
|
||||||
|
0x1.17e02p-6 0x1.3a5c88p+21 3124607
|
||||||
|
0x1.18c4cp-6 0x1.3b61ep+21 3124607
|
||||||
|
0x1.11e68p-6 0x1.344a18p+21 2892252
|
||||||
|
0x1.0cb7p-6 0x1.37acp+21 2892252
|
5
code/cpu_results/dna.15MB.cpu4.result
Normal file
5
code/cpu_results/dna.15MB.cpu4.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.220476p+0 0x1.dccf43cp+26 593315165
|
||||||
|
0x1.22aa62p+0 0x1.dcfa4c8p+26 592263458
|
||||||
|
0x1.22da9p+0 0x1.dd50e78p+26 593423513
|
||||||
|
0x1.1ff9cp+0 0x1.d815f2cp+26 590120821
|
||||||
|
0x1.23b0fcp+0 0x1.ddc499p+26 596923038
|
5
code/cpu_results/dna.15MB.cpu6.result
Normal file
5
code/cpu_results/dna.15MB.cpu6.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.8e7eep-4 0x1.5d36a2p+23 45834923
|
||||||
|
0x1.90183p-4 0x1.5d6cfep+23 46403238
|
||||||
|
0x1.8ed448p-4 0x1.5d5062p+23 46403238
|
||||||
|
0x1.8d61c8p-4 0x1.5b89p+23 46113391
|
||||||
|
0x1.8d3038p-4 0x1.5b6894p+23 46485028
|
5
code/cpu_results/dna.15MB.cpu8.result
Normal file
5
code/cpu_results/dna.15MB.cpu8.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.6c464p-6 0x1.82f5b8p+21 4495841
|
||||||
|
0x1.4d9eep-6 0x1.6b5b4p+21 4544987
|
||||||
|
0x1.4460ep-6 0x1.63f73p+21 4407471
|
||||||
|
0x1.4afa4p-6 0x1.69936p+21 4407471
|
||||||
|
0x1.4609ep-6 0x1.64212p+21 4295384
|
5
code/cpu_results/dna.20MB.cpu4.result
Normal file
5
code/cpu_results/dna.20MB.cpu4.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.6d8ecp+0 0x1.2f4f214p+27 746010747
|
||||||
|
0x1.71c79cp+0 0x1.2f301bp+27 749721648
|
||||||
|
0x1.6ec31cp+0 0x1.2f3a726p+27 747612561
|
||||||
|
0x1.70d87p+0 0x1.2edfc9ep+27 750618917
|
||||||
|
0x1.6ec052p+0 0x1.2f4e6a2p+27 748739834
|
5
code/cpu_results/dna.20MB.cpu6.result
Normal file
5
code/cpu_results/dna.20MB.cpu6.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.0299ep-3 0x1.be91e4p+23 61438240
|
||||||
|
0x1.00d65p-3 0x1.b9f4c6p+23 61287159
|
||||||
|
0x1.05935p-3 0x1.c33dccp+23 62472530
|
||||||
|
0x1.065c2p-3 0x1.bc9bc8p+23 62363451
|
||||||
|
0x1.045de8p-3 0x1.b96f42p+23 61764726
|
5
code/cpu_results/dna.20MB.cpu8.result
Normal file
5
code/cpu_results/dna.20MB.cpu8.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.7bfacp-6 0x1.8d7cdp+21 5743186
|
||||||
|
0x1.86b58p-6 0x1.928bd8p+21 6072658
|
||||||
|
0x1.9694p-6 0x1.9fdc58p+21 6469630
|
||||||
|
0x1.8e7ccp-6 0x1.998cdp+21 6232401
|
||||||
|
0x1.8481cp-6 0x1.94466p+21 5901980
|
5
code/cpu_results/proteins.10MB.cpu4.result
Normal file
5
code/cpu_results/proteins.10MB.cpu4.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.39b24p-6 0x1.5654cp+21 4815936
|
||||||
|
0x1.371e4p-6 0x1.556278p+21 4696974
|
||||||
|
0x1.3561p-6 0x1.50c5d8p+21 4712326
|
||||||
|
0x1.3b6ccp-6 0x1.5829e8p+21 4915309
|
||||||
|
0x1.3af18p-6 0x1.503c8p+21 4856245
|
5
code/cpu_results/proteins.10MB.cpu6.result
Normal file
5
code/cpu_results/proteins.10MB.cpu6.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.118a8p-6 0x1.38894p+21 2572993
|
||||||
|
0x1.15a98p-6 0x1.31103p+21 2748401
|
||||||
|
0x1.15968p-6 0x1.33adbp+21 2761448
|
||||||
|
0x1.18ca8p-6 0x1.364d08p+21 2771358
|
||||||
|
0x1.19dbcp-6 0x1.361f5p+21 2807302
|
5
code/cpu_results/proteins.10MB.cpu8.result
Normal file
5
code/cpu_results/proteins.10MB.cpu8.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.248ccp-6 0x1.309438p+21 2028498
|
||||||
|
0x1.1ba54p-6 0x1.3654bp+21 1966015
|
||||||
|
0x1.2766p-6 0x1.43da8p+21 2049837
|
||||||
|
0x1.238fcp-6 0x1.4395d8p+21 2008116
|
||||||
|
0x1.25804p-6 0x1.36f11p+21 2061600
|
5
code/cpu_results/proteins.15MB.cpu4.result
Normal file
5
code/cpu_results/proteins.15MB.cpu4.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.5bc68p-6 0x1.711bcp+21 5783326
|
||||||
|
0x1.6099p-6 0x1.7d223p+21 5898449
|
||||||
|
0x1.66854p-6 0x1.7739ap+21 6078789
|
||||||
|
0x1.6189cp-6 0x1.787828p+21 6050872
|
||||||
|
0x1.6b70cp-6 0x1.7dd76p+21 6253011
|
5
code/cpu_results/proteins.15MB.cpu6.result
Normal file
5
code/cpu_results/proteins.15MB.cpu6.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.263dp-6 0x1.490a08p+21 2963082
|
||||||
|
0x1.2396p-6 0x1.4304e8p+21 2984599
|
||||||
|
0x1.298f8p-6 0x1.4e9adp+21 3180703
|
||||||
|
0x1.27a28p-6 0x1.4a6158p+21 3016497
|
||||||
|
0x1.1fd18p-6 0x1.3c4108p+21 2913659
|
5
code/cpu_results/proteins.15MB.cpu8.result
Normal file
5
code/cpu_results/proteins.15MB.cpu8.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.36784p-6 0x1.635e9p+21 2393193
|
||||||
|
0x1.3a3a4p-6 0x1.51c57p+21 2397301
|
||||||
|
0x1.38688p-6 0x1.572878p+21 2449818
|
||||||
|
0x1.35684p-6 0x1.44aa68p+21 2267396
|
||||||
|
0x1.3395cp-6 0x1.53db88p+21 2294787
|
5
code/cpu_results/proteins.20MB.cpu4.result
Normal file
5
code/cpu_results/proteins.20MB.cpu4.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.6376p-6 0x1.79c41p+21 5720934
|
||||||
|
0x1.620cp-6 0x1.748edp+21 5745857
|
||||||
|
0x1.9e548p-6 0x1.a69888p+21 6040126
|
||||||
|
0x1.6031p-6 0x1.7a4d68p+21 5780235
|
||||||
|
0x1.6ee28p-6 0x1.888e2p+21 6174243
|
5
code/cpu_results/proteins.20MB.cpu6.result
Normal file
5
code/cpu_results/proteins.20MB.cpu6.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.1d6a8p-6 0x1.378d78p+21 2639463
|
||||||
|
0x1.16ddp-6 0x1.37a828p+21 2403897
|
||||||
|
0x1.1bec8p-6 0x1.379518p+21 2522317
|
||||||
|
0x1.1828p-6 0x1.37952p+21 2494930
|
||||||
|
0x1.1b8dp-6 0x1.3dbc9p+21 2490305
|
5
code/cpu_results/proteins.20MB.cpu8.result
Normal file
5
code/cpu_results/proteins.20MB.cpu8.result
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0x1.2e9d8p-6 0x1.4bb4dp+21 1915812
|
||||||
|
0x1.2c43p-6 0x1.442aap+21 1825102
|
||||||
|
0x1.2931p-6 0x1.440ffp+21 1824534
|
||||||
|
0x1.31928p-6 0x1.440ep+21 1962021
|
||||||
|
0x1.2cef8p-6 0x1.483648p+21 1863384
|
345
code/fmindex.c
Normal file
345
code/fmindex.c
Normal file
|
@ -0,0 +1,345 @@
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
#include "fmindex.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
inline static int string_index(char *s, char c) { return strchr(s, c) - s; }
|
||||||
|
|
||||||
|
static int CompareChar(const void *a, const void *b) {
|
||||||
|
char i = *(char *)a;
|
||||||
|
char j = *(char *)b;
|
||||||
|
|
||||||
|
// Dollar sign is always sorted first.
|
||||||
|
if (i == '$')
|
||||||
|
return -1;
|
||||||
|
if (j == '$')
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return i > j;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Converts the given string to a newly allocated string
|
||||||
|
* of all distinct characters, sorted in lexicographical order.
|
||||||
|
* The dollar sign is always sorted first.
|
||||||
|
* Return NULL on memory allocation error.
|
||||||
|
*/
|
||||||
|
char *TextToAlphabet(char *text, size_t sz) {
|
||||||
|
char *alphabet = calloc(2, sizeof(char));
|
||||||
|
if (!alphabet)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
alphabet[0] = '$';
|
||||||
|
alphabet[1] = '\0';
|
||||||
|
int len = 2;
|
||||||
|
for (size_t i = 0; i < sz; ++i) {
|
||||||
|
if (!strchr(alphabet, text[i])) {
|
||||||
|
len += 1;
|
||||||
|
alphabet = realloc(alphabet, len);
|
||||||
|
alphabet[len - 2] = text[i];
|
||||||
|
alphabet[len - 1] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qsort(alphabet, len - 1, sizeof(char), &CompareChar);
|
||||||
|
|
||||||
|
return alphabet;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int CompareSuffixArray(const void *a, const void *b, void *arg) {
|
||||||
|
sa_t i = *(sa_t *)a;
|
||||||
|
sa_t j = *(sa_t *)b;
|
||||||
|
char *s = arg;
|
||||||
|
|
||||||
|
while (s[i] != '\0' && s[j] != '\0' && s[i] == s[j]) {
|
||||||
|
++i;
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s[i] == '\0')
|
||||||
|
return -1;
|
||||||
|
if (s[j] == '\0')
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return s[i] > s[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Construct a newly allocated suffix array for the given string.
|
||||||
|
* The suffix array holds the index for each suffix in the given string.
|
||||||
|
* Then the indices are sorted by the lexicographical ordering of the suffices.
|
||||||
|
* Return NULL on memory allocation error.
|
||||||
|
*/
|
||||||
|
sa_t *ConstructSuffixArray(char *s, size_t sz) {
|
||||||
|
sa_t *suffix_array = calloc(sz + 1, sizeof(sa_t));
|
||||||
|
if (!suffix_array)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sz + 1; ++i)
|
||||||
|
suffix_array[i] = i;
|
||||||
|
|
||||||
|
qsort_r(suffix_array, sz + 1, sizeof(sa_t), &CompareSuffixArray, s);
|
||||||
|
|
||||||
|
return suffix_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Construct the Burrows-Wheeler transform of the given string,
|
||||||
|
* using the corresponding suffix array.
|
||||||
|
* Return NULL on memory allocation error.
|
||||||
|
*/
|
||||||
|
char *ConstructBWT(char *s, size_t sz, sa_t *suffix_array) {
|
||||||
|
char *bwt = calloc(sz + 2, sizeof(char));
|
||||||
|
if (!bwt)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sz + 1; ++i) {
|
||||||
|
sa_t n = suffix_array[i];
|
||||||
|
// Index 0 is always the dollar sign.
|
||||||
|
bwt[i] = (n) ? s[suffix_array[i] - 1] : '$';
|
||||||
|
}
|
||||||
|
bwt[sz + 1] = '\0';
|
||||||
|
|
||||||
|
return bwt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Construct the rank matrix for the given Burrows-Wheeler transformed string.
|
||||||
|
* The rank matrix is an (alphabet X bwt) sized array that holds the accumulated
|
||||||
|
* counts of encountered characters in the BWT.
|
||||||
|
* A newly allocated rank matrix is returned, or NULL on memory error.
|
||||||
|
*/
|
||||||
|
ranks_t *ConstructRankMatrix(char *bwt, size_t sz, char *alphabet) {
|
||||||
|
size_t alphabet_sz = strlen(alphabet);
|
||||||
|
|
||||||
|
ranks_t *rank_matrix = calloc(sz * alphabet_sz, sizeof(ranks_t));
|
||||||
|
if (!rank_matrix) {
|
||||||
|
printf("Failed to allocate %lu bytes.\n", sz * alphabet_sz);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ranks_t acc[alphabet_sz];
|
||||||
|
|
||||||
|
// Initialize counts with zero.
|
||||||
|
for (size_t i = 0; i < alphabet_sz; ++i)
|
||||||
|
acc[i] = 0;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sz; ++i) {
|
||||||
|
char c = bwt[i];
|
||||||
|
|
||||||
|
// Update accumulator.
|
||||||
|
for (unsigned j = 0; j < alphabet_sz; ++j)
|
||||||
|
if (c == alphabet[j]) {
|
||||||
|
++acc[j];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned j = 0; j < alphabet_sz; ++j)
|
||||||
|
rank_matrix[i * alphabet_sz + j] = acc[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
return rank_matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Calculate the ranges in the "F column" where each character
|
||||||
|
* in the alphabet appears.
|
||||||
|
* Return a (2 X alphabet) matrix where each row means the starting
|
||||||
|
* and ending range for a character.
|
||||||
|
* Return NULL on memory error.
|
||||||
|
*/
|
||||||
|
ranges_t *ConstructCharacterRanges(char *bwt, size_t sz, char *alphabet) {
|
||||||
|
size_t alphabet_sz = strlen(alphabet);
|
||||||
|
unsigned long counts[alphabet_sz];
|
||||||
|
|
||||||
|
// Set counts to zero.
|
||||||
|
for (size_t i = 0; i < alphabet_sz; ++i)
|
||||||
|
counts[i] = 0;
|
||||||
|
|
||||||
|
// Count total amounts of characters.
|
||||||
|
for (size_t i = 0; i < sz; ++i)
|
||||||
|
counts[string_index(alphabet, bwt[i])]++;
|
||||||
|
|
||||||
|
// Accumulate counts.
|
||||||
|
size_t acc = 0;
|
||||||
|
for (size_t i = 0; i < alphabet_sz; ++i) {
|
||||||
|
counts[i] += acc;
|
||||||
|
acc = counts[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate ranges.
|
||||||
|
ranges_t *ranges = calloc(2 * alphabet_sz, sizeof(ranges_t));
|
||||||
|
if (!ranges)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
unsigned long cur_idx = 0;
|
||||||
|
for (size_t i = 0; i < alphabet_sz; ++i) {
|
||||||
|
ranges[2 * i] = cur_idx;
|
||||||
|
ranges[2 * i + 1] = counts[i];
|
||||||
|
cur_idx = counts[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ranges;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the range of matches for the given pattern in the F column of the
|
||||||
|
* given FM-index.
|
||||||
|
*/
|
||||||
|
void FMIndexFindMatchRange(fm_index *fm, char *pattern, size_t pattern_sz,
|
||||||
|
ranges_t *start, ranges_t *end) {
|
||||||
|
int p_idx = pattern_sz - 1;
|
||||||
|
char c = pattern[p_idx];
|
||||||
|
// Initial range is all instances of the last character in pattern.
|
||||||
|
*start = fm->ranges[2 * string_index(fm->alphabet, c)];
|
||||||
|
*end = fm->ranges[2 * string_index(fm->alphabet, c) + 1];
|
||||||
|
|
||||||
|
p_idx -= 1;
|
||||||
|
while (p_idx >= 0 && *end > 1) {
|
||||||
|
c = pattern[p_idx];
|
||||||
|
ranges_t range_start = fm->ranges[2 * string_index(fm->alphabet, c)];
|
||||||
|
int alphabet_idx = string_index(fm->alphabet, c);
|
||||||
|
*start =
|
||||||
|
range_start + fm->ranks[fm->alphabet_sz * (*start - 1) + alphabet_idx];
|
||||||
|
*end = range_start + fm->ranks[fm->alphabet_sz * (*end - 1) + alphabet_idx];
|
||||||
|
p_idx -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the matching indices in the original text for the given
|
||||||
|
* range in the "F column" of the Burrows-Wheeler matrix.
|
||||||
|
*/
|
||||||
|
void FMIndexFindRangeIndices(fm_index *fm, ranges_t start, ranges_t end,
|
||||||
|
unsigned long **match_indices) {
|
||||||
|
for (unsigned long i = 0; i < end - start; ++i)
|
||||||
|
(*match_indices)[i] = fm->sa[start + i];
|
||||||
|
}
|
||||||
|
|
||||||
|
fm_index *FMIndexConstruct(char *s) {
|
||||||
|
fm_index *index = malloc(sizeof(fm_index));
|
||||||
|
if (!index)
|
||||||
|
return NULL;
|
||||||
|
memset(index, 0, sizeof(fm_index));
|
||||||
|
|
||||||
|
size_t sz = strlen(s);
|
||||||
|
if (!(index->alphabet = TextToAlphabet(s, sz)))
|
||||||
|
goto error;
|
||||||
|
index->alphabet_sz = strlen(index->alphabet);
|
||||||
|
if (!(index->sa = ConstructSuffixArray(s, sz)))
|
||||||
|
goto error;
|
||||||
|
if (!(index->bwt = ConstructBWT(s, sz, index->sa)))
|
||||||
|
goto error;
|
||||||
|
++sz; // Because of the added dollar sign.
|
||||||
|
index->bwt_sz = sz;
|
||||||
|
if (!(index->ranks = ConstructRankMatrix(index->bwt, sz, index->alphabet)))
|
||||||
|
goto error;
|
||||||
|
if (!(index->ranges =
|
||||||
|
ConstructCharacterRanges(index->bwt, sz, index->alphabet)))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
return index;
|
||||||
|
|
||||||
|
error:
|
||||||
|
if (index->alphabet)
|
||||||
|
free(index->alphabet);
|
||||||
|
if (index->sa)
|
||||||
|
free(index->sa);
|
||||||
|
if (index->bwt)
|
||||||
|
free(index->bwt);
|
||||||
|
if (index->ranks)
|
||||||
|
free(index->ranks);
|
||||||
|
if (index->ranges)
|
||||||
|
free(index->ranges);
|
||||||
|
|
||||||
|
free(index);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FMIndexFree(fm_index *index) {
|
||||||
|
free(index->alphabet);
|
||||||
|
free(index->sa);
|
||||||
|
free(index->bwt);
|
||||||
|
free(index->ranks);
|
||||||
|
free(index->ranges);
|
||||||
|
free(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FMIndexDumpToFile(fm_index *index, char *filename) {
|
||||||
|
FILE *f = fopen(filename, "w");
|
||||||
|
if (!f)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
fwrite(&index->bwt_sz, sizeof(index->bwt_sz), 1, f);
|
||||||
|
fwrite(index->bwt, sizeof(char), index->bwt_sz, f);
|
||||||
|
fwrite(&index->alphabet_sz, sizeof(index->alphabet_sz), 1, f);
|
||||||
|
fwrite(index->alphabet, sizeof(char), index->alphabet_sz, f);
|
||||||
|
fwrite(index->ranges, sizeof(ranges_t), 2 * index->alphabet_sz, f);
|
||||||
|
fwrite(index->ranks, sizeof(ranks_t), index->bwt_sz * index->alphabet_sz, f);
|
||||||
|
fwrite(index->sa, sizeof(sa_t), index->bwt_sz, f);
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fm_index *FMIndexReadFromFile(char *filename, int aligned) {
|
||||||
|
FILE *f = fopen(filename, "r");
|
||||||
|
if (!f)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
fm_index *index;
|
||||||
|
|
||||||
|
if (!(index = calloc(1, sizeof(fm_index))))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
fread(&index->bwt_sz, sizeof(index->bwt_sz), 1, f);
|
||||||
|
|
||||||
|
if (!MaybeMallocAligned((void **)&index->bwt,
|
||||||
|
(index->bwt_sz + 1) * sizeof(char), aligned))
|
||||||
|
goto error;
|
||||||
|
fread(index->bwt, sizeof(char), index->bwt_sz, f);
|
||||||
|
index->bwt[index->bwt_sz] = '\0';
|
||||||
|
|
||||||
|
fread(&index->alphabet_sz, sizeof(index->alphabet_sz), 1, f);
|
||||||
|
|
||||||
|
if (!MaybeMallocAligned((void **)&index->alphabet,
|
||||||
|
(index->alphabet_sz + 1) * sizeof(char), aligned))
|
||||||
|
goto error;
|
||||||
|
fread(index->alphabet, sizeof(char), index->alphabet_sz, f);
|
||||||
|
index->alphabet[index->alphabet_sz] = '\0';
|
||||||
|
|
||||||
|
if (!MaybeMallocAligned((void **)&index->ranges,
|
||||||
|
2 * index->alphabet_sz * sizeof(ranges_t), aligned))
|
||||||
|
goto error;
|
||||||
|
fread(index->ranges, sizeof(ranges_t), 2 * index->alphabet_sz, f);
|
||||||
|
|
||||||
|
if (!MaybeMallocAligned((void **)&index->ranks,
|
||||||
|
index->bwt_sz * index->alphabet_sz * sizeof(ranks_t),
|
||||||
|
aligned))
|
||||||
|
goto error;
|
||||||
|
fread(index->ranks, sizeof(ranks_t), index->bwt_sz * index->alphabet_sz, f);
|
||||||
|
|
||||||
|
if (!MaybeMallocAligned((void **)&index->sa, index->bwt_sz * sizeof(sa_t),
|
||||||
|
aligned))
|
||||||
|
goto error;
|
||||||
|
fread(index->sa, sizeof(sa_t), index->bwt_sz, f);
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return index;
|
||||||
|
|
||||||
|
error:
|
||||||
|
if (index) {
|
||||||
|
if (index->bwt)
|
||||||
|
free(index->bwt);
|
||||||
|
if (index->alphabet)
|
||||||
|
free(index->alphabet);
|
||||||
|
if (index->ranges)
|
||||||
|
free(index->ranges);
|
||||||
|
if (index->ranks)
|
||||||
|
free(index->ranks);
|
||||||
|
if (index->sa)
|
||||||
|
free(index->sa);
|
||||||
|
free(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return NULL;
|
||||||
|
}
|
35
code/fmindex.h
Normal file
35
code/fmindex.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef unsigned ranges_t;
|
||||||
|
typedef unsigned ranks_t;
|
||||||
|
typedef unsigned sa_t;
|
||||||
|
typedef struct fm_index {
|
||||||
|
char *bwt;
|
||||||
|
size_t bwt_sz;
|
||||||
|
char *alphabet;
|
||||||
|
size_t alphabet_sz;
|
||||||
|
ranks_t *ranks;
|
||||||
|
sa_t *sa;
|
||||||
|
ranges_t *ranges;
|
||||||
|
} fm_index;
|
||||||
|
|
||||||
|
fm_index *FMIndexConstruct(char *s);
|
||||||
|
void FMIndexFree(fm_index *index);
|
||||||
|
|
||||||
|
fm_index *FMIndexReadFromFile(char *filename, int aligned);
|
||||||
|
int FMIndexDumpToFile(fm_index *index, char *filename);
|
||||||
|
|
||||||
|
void FMIndexFindMatchRange(fm_index *fm, char *pattern, size_t pattern_sz,
|
||||||
|
ranges_t *start, ranges_t *end);
|
||||||
|
void FMIndexFindRangeIndices(fm_index *fm, ranges_t start, ranges_t end,
|
||||||
|
unsigned long **match_indices);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
13
code/fpga/.gitignore
vendored
Normal file
13
code/fpga/.gitignore
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
verify
|
||||||
|
sw_emu
|
||||||
|
hw_emu
|
||||||
|
hw
|
||||||
|
.Xil
|
||||||
|
.run
|
||||||
|
emconfig.json
|
||||||
|
vitis_env.sh
|
||||||
|
.ipcache
|
||||||
|
example_output
|
||||||
|
test.txt
|
||||||
|
*.jou
|
||||||
|
*.str
|
106
code/fpga/Makefile
Normal file
106
code/fpga/Makefile
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
ifndef PLATFORM
|
||||||
|
$(error PLATFORM is not set.)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef TARGET
|
||||||
|
$(info TARGET is not set; using sw_emu.)
|
||||||
|
endif
|
||||||
|
|
||||||
|
TARGET ?= sw_emu
|
||||||
|
|
||||||
|
TARGETS := sw_emu hw_emu hw
|
||||||
|
|
||||||
|
ifeq ($(filter $(TARGET),$(TARGETS)),)
|
||||||
|
$(error TARGET can only be one of: "$(TARGETS)")
|
||||||
|
endif
|
||||||
|
|
||||||
|
VXXFLAGS := -t ${TARGET} --log_dir $(TARGET) --report_dir $(TARGET) --temp_dir $(TARGET) -I/usr/include/x86_64-linux-gnu -Wno-unused-label
|
||||||
|
GXXFLAGS := -Wall -g -std=c++11 -I${XILINX_XRT}/include/ -L${XILINX_XRT}/lib/ -lOpenCL -lpthread -lrt -lstdc++ -I..
|
||||||
|
PROJ_HEADERS := ../fmindex.h ../util.h
|
||||||
|
PROJ_OBJS := ../fmindex.o ../util.o
|
||||||
|
|
||||||
|
ifeq ($(TARGET), hw)
|
||||||
|
EMULATION_FLAG :=
|
||||||
|
else
|
||||||
|
EMULATION_FLAG := XCL_EMULATION_MODE=$(TARGET)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: all run-verify clean cleanall unopt opt
|
||||||
|
|
||||||
|
all: $(TARGET) verify benchmark unopt opt
|
||||||
|
|
||||||
|
unopt: $(TARGET)/unopt.xclbin
|
||||||
|
|
||||||
|
ndrange: $(TARGET)/ndrange.xclbin
|
||||||
|
|
||||||
|
ndrange2: $(TARGET)/ndrange2.xclbin
|
||||||
|
|
||||||
|
memory: $(TARGET)/memory.xclbin
|
||||||
|
|
||||||
|
final: $(TARGET)/final.xclbin
|
||||||
|
|
||||||
|
run-verify: verify $(TARGET)/$(KERNEL).xclbin
|
||||||
|
@test -n "$(FMFILE)" || (echo "FMFILE undefined" ; exit 1)
|
||||||
|
@test -n "$(TESTFILE)" || (echo "TESTFILE undefined" ; exit 1)
|
||||||
|
@test -n "$(KERNEL)" || (echo "KERNEL undefined" ; exit 1)
|
||||||
|
@test -n "$(NDRANGE)" || (echo "NDRANGE undefined" ; exit 1)
|
||||||
|
@test -n "$(LOCALSIZE)" || (echo "LOCALSIZE undefined" ; exit 1)
|
||||||
|
cd $(TARGET) && $(EMULATION_FLAG) ../verify ../$(FMFILE) ../$(TARGET)/$(KERNEL).xclbin ../$(TESTFILE) $(NDRANGE) $(LOCALSIZE)
|
||||||
|
|
||||||
|
$(TARGET):
|
||||||
|
mkdir $(TARGET)
|
||||||
|
|
||||||
|
%.o: %.cpp $(PROJ_HEADERS)
|
||||||
|
g++ -c -o $@ $< $(GXXFLAGS)
|
||||||
|
|
||||||
|
verify: verify.o
|
||||||
|
g++ -o $@ $(PROJ_OBJS) $< $(GXXFLAGS)
|
||||||
|
|
||||||
|
benchmark: benchmark.o
|
||||||
|
g++ -o $@ $(PROJ_OBJS) $< $(GXXFLAGS)
|
||||||
|
|
||||||
|
$(TARGET)/unopt.xo: unopt.cl no_ndrange.cfg
|
||||||
|
v++ -c -k fmindex $< $(VXXFLAGS) --config no_ndrange.cfg -o $@
|
||||||
|
|
||||||
|
$(TARGET)/unopt.xclbin: $(TARGET)/unopt.xo emconfig.json
|
||||||
|
v++ -l $< $(VXXFLAGS) --config no_ndrange.cfg -o $@
|
||||||
|
mv -t $(TARGET) xrc.log xcd.log
|
||||||
|
|
||||||
|
$(TARGET)/memory.xo: memory.cl no_ndrange.cfg
|
||||||
|
v++ -c -k fmindex $< $(VXXFLAGS) --config no_ndrange.cfg -o $@
|
||||||
|
|
||||||
|
$(TARGET)/memory.xclbin: $(TARGET)/memory.xo emconfig.json
|
||||||
|
v++ -l $< $(VXXFLAGS) --config no_ndrange.cfg -o $@
|
||||||
|
mv -t $(TARGET) xrc.log xcd.log
|
||||||
|
|
||||||
|
$(TARGET)/ndrange.xo: ndrange.cl ndrange.cfg
|
||||||
|
v++ -c -k fmindex $< $(VXXFLAGS) --config ndrange.cfg -o $@
|
||||||
|
|
||||||
|
$(TARGET)/ndrange.xclbin: $(TARGET)/ndrange.xo emconfig.json
|
||||||
|
v++ -l $< $(VXXFLAGS) --config ndrange.cfg -o $@
|
||||||
|
mv -t $(TARGET) xrc.log xcd.log
|
||||||
|
|
||||||
|
$(TARGET)/ndrange2.xo: ndrange2.cl ndrange2.cfg
|
||||||
|
v++ -c -k fmindex $< $(VXXFLAGS) --config ndrange2.cfg -o $@
|
||||||
|
|
||||||
|
$(TARGET)/ndrange2.xclbin: $(TARGET)/ndrange2.xo emconfig.json
|
||||||
|
v++ -l $< $(VXXFLAGS) --config ndrange2.cfg -o $@
|
||||||
|
mv -t $(TARGET) xrc.log xcd.log
|
||||||
|
|
||||||
|
$(TARGET)/final.xo: final.cl ndrange.cfg
|
||||||
|
v++ -c -k fmindex $< $(VXXFLAGS) --config ndrange.cfg -o $@
|
||||||
|
|
||||||
|
$(TARGET)/final.xclbin: $(TARGET)/final.xo emconfig.json
|
||||||
|
v++ -l $< $(VXXFLAGS) --config ndrange.cfg -o $@
|
||||||
|
mv -t $(TARGET) xrc.log xcd.log
|
||||||
|
|
||||||
|
emconfig.json:
|
||||||
|
emconfigutil --platform $(PLATFORM) --nd 1
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf emconfig.json *.info *.link_summary *.compile_summary \
|
||||||
|
*.xclbin *.xo *.log _x $(TARGET) verify TempConfig *.csv *.run_summary \
|
||||||
|
*.o .Xil .run .ipcache
|
||||||
|
|
||||||
|
cleanall: clean
|
||||||
|
rm -rf $(TARGETS)
|
171
code/fpga/benchmark.cpp
Normal file
171
code/fpga/benchmark.cpp
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
#define CL_HPP_CL_1_2_DEFAULT_BUILD
|
||||||
|
#define CL_HPP_TARGET_OPENCL_VERSION 120
|
||||||
|
#define CL_HPP_MINIMUM_OPENCL_VERSION 120
|
||||||
|
#define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY 1
|
||||||
|
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
|
||||||
|
|
||||||
|
#include <CL/cl2.hpp>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "../fmindex.h"
|
||||||
|
#include "../util.h"
|
||||||
|
|
||||||
|
std::vector<cl::Device> get_xilinx_devices();
|
||||||
|
char *read_binary_file(const std::string &xclbin_file_name, unsigned &nb);
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if (argc < 6) {
|
||||||
|
fprintf(
|
||||||
|
stderr,
|
||||||
|
"Usage: %s <FMINDEXFILE> <XCLBIN> <TESTFILE> <NDRANGE> <LOCALSIZE>\n",
|
||||||
|
argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int use_ndrange = atoi(argv[4]);
|
||||||
|
int local_size = atoi(argv[5]);
|
||||||
|
|
||||||
|
// Load FM-index.
|
||||||
|
fm_index *index = FMIndexReadFromFile(argv[1], 1);
|
||||||
|
if (!index) {
|
||||||
|
fprintf(stderr, "Could not read FM-index from file.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load test file.
|
||||||
|
unsigned pattern_count, pattern_sz, max_match_count;
|
||||||
|
char *patterns;
|
||||||
|
|
||||||
|
if (!(LoadTestData(argv[3], &patterns, &pattern_count, &pattern_sz,
|
||||||
|
&max_match_count, 1))) {
|
||||||
|
fprintf(stderr, "Could not read test data file.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize OpenCL.
|
||||||
|
cl_int err;
|
||||||
|
unsigned fileBufSize;
|
||||||
|
std::vector<cl::Device> devices = get_xilinx_devices();
|
||||||
|
devices.resize(1);
|
||||||
|
cl::Device device = devices[0];
|
||||||
|
cl::Context context(device, NULL, NULL, NULL, &err);
|
||||||
|
char *fileBuf = read_binary_file(argv[2], fileBufSize);
|
||||||
|
cl::Program::Binaries bins{{fileBuf, fileBufSize}};
|
||||||
|
cl::Program program(context, devices, bins, NULL, &err);
|
||||||
|
cl::CommandQueue q(context, device, CL_QUEUE_PROFILING_ENABLE, &err);
|
||||||
|
cl::Kernel kernel(program, "fmindex", &err);
|
||||||
|
|
||||||
|
// Create OpenCL buffers for host data.
|
||||||
|
cl::Buffer bwt_buf(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
||||||
|
sizeof(char) * index->bwt_sz, index->bwt, &err);
|
||||||
|
cl::Buffer alphabet_buf(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
||||||
|
sizeof(char) * index->alphabet_sz, index->alphabet,
|
||||||
|
&err);
|
||||||
|
cl::Buffer ranks_buf(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
||||||
|
sizeof(ranks_t) * index->bwt_sz * index->alphabet_sz,
|
||||||
|
index->ranks, &err);
|
||||||
|
cl::Buffer sa_buf(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
||||||
|
sizeof(sa_t) * index->bwt_sz, index->sa, &err);
|
||||||
|
cl::Buffer ranges_buf(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
||||||
|
sizeof(ranges_t) * 2 * index->alphabet_sz,
|
||||||
|
index->ranges, &err);
|
||||||
|
cl::Buffer patterns_buf(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
||||||
|
sizeof(char) * pattern_count * pattern_sz, patterns,
|
||||||
|
&err);
|
||||||
|
cl::Buffer out_buf(context, CL_MEM_WRITE_ONLY,
|
||||||
|
sizeof(unsigned long) *
|
||||||
|
(pattern_count * (max_match_count + 1)),
|
||||||
|
NULL, &err);
|
||||||
|
|
||||||
|
// Map OpenCL buffers to kernel arguments.
|
||||||
|
kernel.setArg(0, bwt_buf);
|
||||||
|
kernel.setArg(1, alphabet_buf);
|
||||||
|
kernel.setArg(2, ranks_buf);
|
||||||
|
kernel.setArg(3, sa_buf);
|
||||||
|
kernel.setArg(4, ranges_buf);
|
||||||
|
kernel.setArg(5, patterns_buf);
|
||||||
|
kernel.setArg(6, out_buf);
|
||||||
|
|
||||||
|
// Map OpenCL buffers to kernel arguments including scalars.
|
||||||
|
kernel.setArg(0, bwt_buf);
|
||||||
|
kernel.setArg(1, alphabet_buf);
|
||||||
|
kernel.setArg(2, ranks_buf);
|
||||||
|
kernel.setArg(3, sa_buf);
|
||||||
|
kernel.setArg(4, ranges_buf);
|
||||||
|
kernel.setArg(5, patterns_buf);
|
||||||
|
kernel.setArg(6, out_buf);
|
||||||
|
kernel.setArg(7, index->bwt_sz);
|
||||||
|
kernel.setArg(8, index->alphabet_sz);
|
||||||
|
kernel.setArg(9, pattern_count);
|
||||||
|
kernel.setArg(10, pattern_sz);
|
||||||
|
kernel.setArg(11, max_match_count + 1);
|
||||||
|
|
||||||
|
// Schedule transfer of inputs and output.
|
||||||
|
q.enqueueMigrateMemObjects(
|
||||||
|
{bwt_buf, alphabet_buf, ranks_buf, sa_buf, ranges_buf, patterns_buf}, 0);
|
||||||
|
|
||||||
|
if (use_ndrange)
|
||||||
|
q.enqueueNDRangeKernel(kernel, 0, pattern_count, local_size);
|
||||||
|
else
|
||||||
|
q.enqueueTask(kernel);
|
||||||
|
|
||||||
|
q.enqueueMigrateMemObjects({out_buf}, CL_MIGRATE_MEM_OBJECT_HOST);
|
||||||
|
|
||||||
|
q.finish();
|
||||||
|
|
||||||
|
// Release resources.
|
||||||
|
delete[] fileBuf;
|
||||||
|
FMIndexFree(index);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------
|
||||||
|
// Utility functions
|
||||||
|
// ------------------------------------------------------------------------------------
|
||||||
|
std::vector<cl::Device> get_xilinx_devices() {
|
||||||
|
size_t i;
|
||||||
|
cl_int err;
|
||||||
|
std::vector<cl::Platform> platforms;
|
||||||
|
err = cl::Platform::get(&platforms);
|
||||||
|
cl::Platform platform;
|
||||||
|
for (i = 0; i < platforms.size(); i++) {
|
||||||
|
platform = platforms[i];
|
||||||
|
std::string platformName = platform.getInfo<CL_PLATFORM_NAME>(&err);
|
||||||
|
if (platformName == "Xilinx") {
|
||||||
|
std::cerr << "INFO: Found Xilinx Platform" << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == platforms.size()) {
|
||||||
|
std::cerr << "ERROR: Failed to find Xilinx platform" << std::endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getting ACCELERATOR Devices and selecting 1st such device
|
||||||
|
std::vector<cl::Device> devices;
|
||||||
|
err = platform.getDevices(CL_DEVICE_TYPE_ACCELERATOR, &devices);
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *read_binary_file(const std::string &xclbin_file_name, unsigned &nb) {
|
||||||
|
if (access(xclbin_file_name.c_str(), R_OK) != 0) {
|
||||||
|
printf("ERROR: %s xclbin not available please build\n",
|
||||||
|
xclbin_file_name.c_str());
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// Loading XCL Bin into char buffer
|
||||||
|
std::cerr << "INFO: Loading '" << xclbin_file_name << "'\n";
|
||||||
|
std::ifstream bin_file(xclbin_file_name.c_str(), std::ifstream::binary);
|
||||||
|
bin_file.seekg(0, bin_file.end);
|
||||||
|
nb = bin_file.tellg();
|
||||||
|
bin_file.seekg(0, bin_file.beg);
|
||||||
|
char *buf = new char[nb];
|
||||||
|
bin_file.read(buf, nb);
|
||||||
|
return buf;
|
||||||
|
}
|
232
code/fpga/benchmark_fpga.py
Normal file
232
code/fpga/benchmark_fpga.py
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
import argparse
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
# Thanks Tristan Laan for data extraction functions.
|
||||||
|
|
||||||
|
|
||||||
|
def _calculate_wattage(data: list) -> float:
|
||||||
|
return (int(data[1]) / 1000) * (int(data[2]) / 1000) \
|
||||||
|
+ (int(data[3]) / 1000) * (int(data[4]) / 1000)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_power_profile_data(directory: Path) -> list:
|
||||||
|
file = next(directory.glob('power_profile_*.csv'))
|
||||||
|
data = []
|
||||||
|
|
||||||
|
with file.open() as f:
|
||||||
|
for i, line in enumerate(f):
|
||||||
|
if i < 2:
|
||||||
|
continue
|
||||||
|
csv_data = line.split(',')
|
||||||
|
data.append({'timestamp': float(csv_data[0]),
|
||||||
|
'power': _calculate_wattage(csv_data)})
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def _get_timeline_data(directory: Path) -> dict:
|
||||||
|
file = next(directory.glob('timeline_trace.csv'))
|
||||||
|
data = {}
|
||||||
|
|
||||||
|
with file.open() as f:
|
||||||
|
for i, line in enumerate(f):
|
||||||
|
cells = line.split(',')
|
||||||
|
if i < 13:
|
||||||
|
continue
|
||||||
|
if cells[0] == 'Footer':
|
||||||
|
break
|
||||||
|
|
||||||
|
if cells[1].startswith("KERNEL") and cells[1].endswith("all") and cells[2] in ["START", "END"]:
|
||||||
|
data[cells[2]] = cells[0]
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def _is_mode(line: str):
|
||||||
|
if line == 'OpenCL API Calls':
|
||||||
|
return True
|
||||||
|
if line == 'Kernel Execution':
|
||||||
|
return True
|
||||||
|
if line == 'Compute Unit Utilization':
|
||||||
|
return True
|
||||||
|
if line == 'Data Transfer: Host to Global Memory':
|
||||||
|
return True
|
||||||
|
if line == 'Data Transfer: Kernels to Global Memory':
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def _get_profile_summary_data(file: Path) -> dict:
|
||||||
|
data = dict()
|
||||||
|
mode = None
|
||||||
|
skip_line = False
|
||||||
|
with file.open() as f:
|
||||||
|
for line in f:
|
||||||
|
line = line.strip()
|
||||||
|
if skip_line:
|
||||||
|
skip_line = False
|
||||||
|
continue
|
||||||
|
|
||||||
|
if _is_mode(line):
|
||||||
|
mode = line
|
||||||
|
data[mode] = []
|
||||||
|
skip_line = True
|
||||||
|
continue
|
||||||
|
|
||||||
|
if line == '':
|
||||||
|
mode = None
|
||||||
|
|
||||||
|
if not mode:
|
||||||
|
continue
|
||||||
|
|
||||||
|
csv_data = line.split(',')
|
||||||
|
|
||||||
|
if mode == 'OpenCL API Calls':
|
||||||
|
data[mode].append({
|
||||||
|
'name': csv_data[0],
|
||||||
|
'calls': int(csv_data[1]),
|
||||||
|
'time': float(csv_data[2])
|
||||||
|
})
|
||||||
|
|
||||||
|
if mode == 'Kernel Execution':
|
||||||
|
data[mode].append({
|
||||||
|
'kernel': csv_data[0],
|
||||||
|
'enqueues': int(csv_data[1]),
|
||||||
|
'time': float(csv_data[2])
|
||||||
|
})
|
||||||
|
|
||||||
|
if mode == 'Compute Unit Utilization':
|
||||||
|
data[mode].append({
|
||||||
|
'cu': csv_data[1],
|
||||||
|
'kernel': csv_data[2],
|
||||||
|
'time': float(csv_data[9])
|
||||||
|
})
|
||||||
|
|
||||||
|
if mode == 'Data Transfer: Host to Global Memory':
|
||||||
|
data[mode].append({
|
||||||
|
'type': csv_data[1],
|
||||||
|
'transfers': int(csv_data[2]),
|
||||||
|
'speed': float(csv_data[3]),
|
||||||
|
'utilization': float(csv_data[4]),
|
||||||
|
'size': float(csv_data[5]),
|
||||||
|
'time': float(csv_data[6])
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if mode == 'Data Transfer: Kernels to Global Memory':
|
||||||
|
data[mode].append({
|
||||||
|
'interface': csv_data[3],
|
||||||
|
'type': csv_data[4],
|
||||||
|
'transfers': int(csv_data[5]),
|
||||||
|
'speed': float(csv_data[6]),
|
||||||
|
'utilization': float(csv_data[7]),
|
||||||
|
'size': float(csv_data[8])
|
||||||
|
})
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def read_data(directory: Path) -> dict:
|
||||||
|
data = dict()
|
||||||
|
profile = directory / 'profile_summary.csv'
|
||||||
|
try:
|
||||||
|
data['power'] = _get_power_profile_data(directory)
|
||||||
|
data['timeline'] = _get_timeline_data(directory)
|
||||||
|
except StopIteration:
|
||||||
|
pass
|
||||||
|
if profile.exists():
|
||||||
|
data.update(_get_profile_summary_data(profile))
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def write_data(data: dict, file: Path):
|
||||||
|
with file.open('w') as f:
|
||||||
|
json.dump(data, f)
|
||||||
|
|
||||||
|
|
||||||
|
class cd:
|
||||||
|
"""Context manager for changing the current working directory"""
|
||||||
|
def __init__(self, newPath):
|
||||||
|
self.newPath = os.path.expanduser(newPath)
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
self.savedPath = os.getcwd()
|
||||||
|
os.chdir(self.newPath)
|
||||||
|
|
||||||
|
def __exit__(self, etype, value, traceback):
|
||||||
|
os.chdir(self.savedPath)
|
||||||
|
|
||||||
|
|
||||||
|
def main(repeats, count, maxmatches, lengths, dir, filenames, kernel, target, localsize, ndrange):
|
||||||
|
for filename in filenames:
|
||||||
|
for length in lengths:
|
||||||
|
benchmark(repeats, count, maxmatches, length, dir, filename, kernel, target, localsize, ndrange)
|
||||||
|
|
||||||
|
|
||||||
|
def benchmark(repeats, count, maxmatches, length, dir, filename, kernel, target, localsize, ndrange):
|
||||||
|
textfilename = f"../{dir}/{filename}"
|
||||||
|
fmfilename = f"{textfilename}.fm"
|
||||||
|
resultdir = f"../{kernel}_results/{filename}.len{length}"
|
||||||
|
testfilename = f"{resultdir}/test.txt"
|
||||||
|
|
||||||
|
if target != "hw":
|
||||||
|
env = dict(os.environ, XCL_EMULATION_MODE=target)
|
||||||
|
else:
|
||||||
|
env = os.environ
|
||||||
|
|
||||||
|
gentestargs = ["../../generate_test_data", textfilename, fmfilename, testfilename, str(count), str(length), str(maxmatches)]
|
||||||
|
benchmarkargs = ["../benchmark", fmfilename, f"{kernel}.xclbin", testfilename, str(ndrange), str(localsize)]
|
||||||
|
print(" ".join(gentestargs))
|
||||||
|
print(" ".join(benchmarkargs))
|
||||||
|
|
||||||
|
with cd(target):
|
||||||
|
shutil.rmtree(resultdir, ignore_errors=True)
|
||||||
|
Path(resultdir).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
for n in range(repeats):
|
||||||
|
print(f"{n+1}/{repeats}")
|
||||||
|
|
||||||
|
# Create test file.
|
||||||
|
gentestproc = subprocess.Popen(gentestargs, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
stdout, stderr = gentestproc.communicate()
|
||||||
|
if stderr:
|
||||||
|
print(f">{stderr.strip()}")
|
||||||
|
ret = gentestproc.poll()
|
||||||
|
if ret != 0:
|
||||||
|
print(f"Error creating test data: {stdout.strip()}")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
# Execute kernel
|
||||||
|
benchmarkproc = subprocess.Popen(benchmarkargs, stdout=subprocess.PIPE, universal_newlines=True, stderr=subprocess.PIPE, env=env)
|
||||||
|
_, stderr = benchmarkproc.communicate()
|
||||||
|
if stderr:
|
||||||
|
print(f">{stderr.strip()}")
|
||||||
|
ret = benchmarkproc.poll()
|
||||||
|
if ret != 0:
|
||||||
|
print("Error benchmarking test data")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
# Move data to result directory.
|
||||||
|
data = read_data(Path("."))
|
||||||
|
write_data(data, Path(resultdir) / f"run{n}.json")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("-n", "--repeats", help="number of times to repeat each experiment", type=int, required=True)
|
||||||
|
parser.add_argument("-c", "--count", help="number of patterns", type=int, required=True)
|
||||||
|
parser.add_argument("-m", "--maxmatches", help="maximum number of matches per pattern", type=int, required=True)
|
||||||
|
parser.add_argument("-l", "--lengths", help="length of the patterns", type=int, nargs="+", default=[], required=True)
|
||||||
|
parser.add_argument("-d", "--dir", help="directory containing FM-indices and original texts (with the same name)", required=True)
|
||||||
|
parser.add_argument("-f", "--files", help="FM-index files to benchmark", nargs="+", default=[], required=True)
|
||||||
|
parser.add_argument("-k", "--kernel", help="FPGA kernel", required=True)
|
||||||
|
parser.add_argument("-t", "--target", help="compilation target", default="sw_emu", required=False)
|
||||||
|
parser.add_argument("-s", "--localsize", help="NDRange local size", type=int, required=True)
|
||||||
|
parser.add_argument("-r", "--ndrange", help="use NDRange", type=int, required=True)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
main(args.repeats, args.count, args.maxmatches, args.lengths, args.dir, args.files, args.kernel, args.target, args.localsize, args.ndrange)
|
72
code/fpga/final.cl
Normal file
72
code/fpga/final.cl
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
#define LOCAL_SIZE 300
|
||||||
|
#define MAX_PATTERN_SZ 8
|
||||||
|
#define MAX_ALPHABET_SZ 97
|
||||||
|
#define MAX_RANGES_SZ (2 * MAX_ALPHABET_SZ)
|
||||||
|
#define PATTERNS_SZ (MAX_PATTERN_SZ * LOCAL_SIZE)
|
||||||
|
|
||||||
|
inline static int string_index(__private char *s, char c) {
|
||||||
|
int i = 0;
|
||||||
|
while (1) {
|
||||||
|
if (s[i] == c)
|
||||||
|
return i;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel
|
||||||
|
__attribute__((reqd_work_group_size(LOCAL_SIZE, 1, 1)))
|
||||||
|
__attribute__((xcl_zero_global_work_offset))
|
||||||
|
void fmindex(__global char *bwt,
|
||||||
|
__global char *alphabet,
|
||||||
|
__global unsigned *ranks,
|
||||||
|
__global unsigned *sa,
|
||||||
|
__global unsigned *ranges,
|
||||||
|
__global char *patterns,
|
||||||
|
__global unsigned long *out,
|
||||||
|
size_t bwt_sz, size_t alphabet_sz, unsigned pattern_count,
|
||||||
|
unsigned pattern_sz, unsigned out_sz) {
|
||||||
|
int group_id = get_group_id(0);
|
||||||
|
|
||||||
|
__local char _patterns[PATTERNS_SZ];
|
||||||
|
__attribute__((xcl_pipeline_loop(1)))
|
||||||
|
for (unsigned i = 0; i < PATTERNS_SZ; ++i)
|
||||||
|
_patterns[i] = patterns[group_id * LOCAL_SIZE * pattern_sz + i];
|
||||||
|
|
||||||
|
__attribute__((xcl_pipeline_workitems)) {
|
||||||
|
int work_id = get_global_id(0);
|
||||||
|
int local_id = get_local_id(0);
|
||||||
|
|
||||||
|
__private char _alphabet[MAX_ALPHABET_SZ];
|
||||||
|
__attribute__((xcl_pipeline_loop(1)))
|
||||||
|
for (unsigned i = 0; i < alphabet_sz; ++i)
|
||||||
|
_alphabet[i] = alphabet[i];
|
||||||
|
|
||||||
|
__private unsigned _ranges[MAX_RANGES_SZ];
|
||||||
|
__attribute__((xcl_pipeline_loop(1)))
|
||||||
|
for (unsigned i = 0; i < 2 * alphabet_sz; ++i)
|
||||||
|
_ranges[i] = ranges[i];
|
||||||
|
|
||||||
|
int p_idx = pattern_sz - 1;
|
||||||
|
char c = _patterns[local_id * pattern_sz + p_idx];
|
||||||
|
int alphabet_idx = string_index(_alphabet, c);
|
||||||
|
unsigned start = _ranges[2 * alphabet_idx];
|
||||||
|
unsigned end = _ranges[2 * alphabet_idx + 1];
|
||||||
|
|
||||||
|
p_idx -= 1;
|
||||||
|
while (p_idx >= 0 && end > 1) {
|
||||||
|
c = _patterns[local_id * pattern_sz + p_idx];
|
||||||
|
alphabet_idx = string_index(_alphabet, c);
|
||||||
|
unsigned range_start = _ranges[2 * alphabet_idx];
|
||||||
|
start = range_start + ranks[alphabet_sz * (start - 1) + alphabet_idx];
|
||||||
|
end = range_start + ranks[alphabet_sz * (end - 1) + alphabet_idx];
|
||||||
|
p_idx -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long match_count = end - start;
|
||||||
|
out[work_id * out_sz] = match_count;
|
||||||
|
|
||||||
|
__attribute__((xcl_pipeline_loop(1)))
|
||||||
|
for (unsigned i = 0; i < match_count; ++i)
|
||||||
|
out[work_id * out_sz + i + 1] = sa[start + i];
|
||||||
|
}
|
||||||
|
}
|
1
code/fpga/final_results/dblp.xml.10MB.len4/run0.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len4/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len4/run1.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len4/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len4/run2.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len4/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len4/run3.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len4/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len4/run4.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len4/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len6/run0.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len6/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len6/run1.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len6/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len6/run2.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len6/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len6/run3.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len6/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len6/run4.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len6/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len8/run0.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len8/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len8/run1.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len8/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len8/run2.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len8/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len8/run3.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len8/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.10MB.len8/run4.json
Normal file
1
code/fpga/final_results/dblp.xml.10MB.len8/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len4/run0.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len4/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len4/run1.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len4/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len4/run2.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len4/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len4/run3.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len4/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len4/run4.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len4/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len6/run0.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len6/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len6/run1.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len6/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len6/run2.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len6/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len6/run3.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len6/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len6/run4.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len6/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len8/run0.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len8/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len8/run1.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len8/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len8/run2.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len8/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len8/run3.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len8/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.15MB.len8/run4.json
Normal file
1
code/fpga/final_results/dblp.xml.15MB.len8/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len4/run0.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len4/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len4/run1.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len4/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len4/run2.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len4/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len4/run3.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len4/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len4/run4.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len4/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len6/run0.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len6/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len6/run1.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len6/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len6/run2.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len6/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len6/run3.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len6/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len6/run4.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len6/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len8/run0.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len8/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len8/run1.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len8/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len8/run2.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len8/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len8/run3.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len8/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dblp.xml.20MB.len8/run4.json
Normal file
1
code/fpga/final_results/dblp.xml.20MB.len8/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len4/run0.json
Normal file
1
code/fpga/final_results/dna.10MB.len4/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len4/run1.json
Normal file
1
code/fpga/final_results/dna.10MB.len4/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len4/run2.json
Normal file
1
code/fpga/final_results/dna.10MB.len4/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len4/run3.json
Normal file
1
code/fpga/final_results/dna.10MB.len4/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len4/run4.json
Normal file
1
code/fpga/final_results/dna.10MB.len4/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len6/run0.json
Normal file
1
code/fpga/final_results/dna.10MB.len6/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len6/run1.json
Normal file
1
code/fpga/final_results/dna.10MB.len6/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len6/run2.json
Normal file
1
code/fpga/final_results/dna.10MB.len6/run2.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len6/run3.json
Normal file
1
code/fpga/final_results/dna.10MB.len6/run3.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len6/run4.json
Normal file
1
code/fpga/final_results/dna.10MB.len6/run4.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len8/run0.json
Normal file
1
code/fpga/final_results/dna.10MB.len8/run0.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len8/run1.json
Normal file
1
code/fpga/final_results/dna.10MB.len8/run1.json
Normal file
File diff suppressed because one or more lines are too long
1
code/fpga/final_results/dna.10MB.len8/run2.json
Normal file
1
code/fpga/final_results/dna.10MB.len8/run2.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"power": [{"timestamp": 37.8581, "power": 35.3288}, {"timestamp": 58.5703, "power": 35.3288}, {"timestamp": 79.0738, "power": 35.3288}, {"timestamp": 99.609, "power": 35.3288}, {"timestamp": 120.151, "power": 35.3288}, {"timestamp": 140.789, "power": 35.3288}, {"timestamp": 161.382, "power": 35.3288}, {"timestamp": 181.94, "power": 35.3288}, {"timestamp": 202.498, "power": 35.3288}, {"timestamp": 223.0, "power": 35.3288}, {"timestamp": 243.546, "power": 35.3288}, {"timestamp": 264.094, "power": 35.3288}, {"timestamp": 284.638, "power": 35.3288}, {"timestamp": 305.188, "power": 35.3288}, {"timestamp": 325.74, "power": 35.3288}, {"timestamp": 346.294, "power": 35.3288}, {"timestamp": 366.809, "power": 35.3288}, {"timestamp": 387.352, "power": 35.3288}, {"timestamp": 407.899, "power": 35.3288}, {"timestamp": 428.445, "power": 35.3288}, {"timestamp": 449.024, "power": 35.3288}, {"timestamp": 469.623, "power": 35.3288}, {"timestamp": 490.116, "power": 35.3288}, {"timestamp": 510.633, "power": 35.3288}, {"timestamp": 531.131, "power": 35.3288}, {"timestamp": 551.647, "power": 35.3288}, {"timestamp": 572.344, "power": 35.3288}, {"timestamp": 592.961, "power": 35.3288}, {"timestamp": 613.414, "power": 35.3288}, {"timestamp": 633.856, "power": 35.3288}, {"timestamp": 654.298, "power": 35.3288}, {"timestamp": 674.764, "power": 35.3288}, {"timestamp": 695.258, "power": 35.3288}, {"timestamp": 715.801, "power": 35.3288}, {"timestamp": 736.339, "power": 35.3288}, {"timestamp": 756.873, "power": 35.3288}, {"timestamp": 777.787, "power": 35.3288}, {"timestamp": 798.354, "power": 35.3288}], "timeline": {"START": "470.05948", "END": "523.05116"}, "OpenCL API Calls": [{"name": "clSetKernelArg", "calls": 19, "time": 284.273}, {"name": "clFinish", "calls": 1, "time": 229.365}, {"name": "clReleaseKernel", "calls": 1, "time": 86.4594}, {"name": "clCreateProgramWithBinary", "calls": 1, "time": 63.9265}, {"name": "clReleaseContext", "calls": 1, "time": 51.3423}, {"name": "clCreateContext", "calls": 1, "time": 35.5788}, {"name": "clReleaseProgram", "calls": 1, "time": 11.7884}, {"name": "clEnqueueMigrateMemObjects", "calls": 2, "time": 0.367593}, {"name": "clCreateKernel", "calls": 1, "time": 0.34037}, {"name": "clEnqueueNDRangeKernel", "calls": 1, "time": 0.146976}, {"name": "clReleaseMemObject", "calls": 21, "time": 0.077769}, {"name": "clRetainMemObject", "calls": 14, "time": 0.037016}, {"name": "clGetExtensionFunctionAddress", "calls": 1, "time": 0.025618}, {"name": "clCreateBuffer", "calls": 7, "time": 0.024742}, {"name": "clReleaseDevice", "calls": 2, "time": 0.023307}, {"name": "clGetPlatformInfo", "calls": 4, "time": 0.010228}, {"name": "clGetExtensionFunctionAddressForPlatform", "calls": 1, "time": 0.009001}, {"name": "clReleaseCommandQueue", "calls": 1, "time": 0.0084}, {"name": "clCreateCommandQueue", "calls": 1, "time": 0.007222}, {"name": "clGetDeviceIDs", "calls": 2, "time": 0.006521}, {"name": "clRetainDevice", "calls": 2, "time": 0.004685}], "Kernel Execution": [{"kernel": "fmindex", "enqueues": 1, "time": 52.9917}], "Compute Unit Utilization": [{"cu": "fmindex_1", "kernel": "fmindex", "time": 47.4359}, {"cu": "fmindex_2", "kernel": "fmindex", "time": 49.6304}, {"cu": "fmindex_3", "kernel": "fmindex", "time": 48.7461}, {"cu": "fmindex_4", "kernel": "fmindex", "time": 52.5406}, {"cu": "fmindex_5", "kernel": "fmindex", "time": 52.4821}], "Data Transfer: Host to Global Memory": [{"type": "READ", "transfers": 1, "speed": 7632.600307, "utilization": 79.506253, "size": 969240.0, "time": 126.986867}, {"type": "WRITE", "transfers": 1, "speed": 7027.815445, "utilization": 73.206411, "size": 346090.0, "time": 49.245769}], "Data Transfer: Kernels to Global Memory": [{"interface": "DDR[1:3]", "type": "READ", "transfers": 564951, "speed": 102.623, "utilization": 0.890823, "size": 0.00812744}, {"interface": "DDR[1:3]", "type": "WRITE", "transfers": 35684, "speed": 371.67, "utilization": 3.2263, "size": 0.118922}, {"interface": "DDR[1:3]", "type": "READ", "transfers": 604431, "speed": 104.444, "utilization": 0.906631, "size": 0.00811912}, {"interface": "DDR[1:3]", "type": "WRITE", "transfers": 38166, "speed": 372.547, "utilization": 3.23391, "size": 0.119464}, {"interface": "DDR[1:3]", "type": "READ", "transfers": 587746, "speed": 103.73, "utilization": 0.900437, "size": 0.0081225}, {"interface": "DDR[1:3]", "type": "WRITE", "transfers": 37061, "speed": 372.351, "utilization": 3.23221, "size": 0.119424}, {"interface": "DDR[1:3]", "type": "READ", "transfers": 670506, "speed": 109.093, "utilization": 0.946991, "size": 0.00810738}, {"interface": "DDR[1:3]", "type": "WRITE", "transfers": 42277, "speed": 376.434, "utilization": 3.26766, "size": 0.12035}, {"interface": "DDR[1:3]", "type": "READ", "transfers": 669545, "speed": 108.988, "utilization": 0.946073, "size": 0.00810754}, {"interface": "DDR[1:3]", "type": "WRITE", "transfers": 42234, "speed": 376.111, "utilization": 3.26485, "size": 0.120291}]}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue