diff --git a/AUTHORS b/AUTHORS index 4ec04f53..a5428424 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,5 +1,4 @@ -Peter Boyle -Azusa Yamaguchi -Intel Parallel Computing Centre @ Higgs Centre for Theoretical Physics -University of Edinburgh -Scotland, UK +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle diff --git a/COPYING b/COPYING index 94a9ed02..458be2e8 100644 --- a/COPYING +++ b/COPYING @@ -1,622 +1,281 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 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 + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) 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. +this service 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. + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. 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. +gratis or for a fee, you must give the recipients all the rights that +you have. 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. + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. - 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. + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. - 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. + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. 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 + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to 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 + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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. +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. - 13. Use with the GNU Affero General Public License. +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. - 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. +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. - 14. Revised Versions of this License. +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest 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 + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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. +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this 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. + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. - 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. + NO WARRANTY - 15. Disclaimer of Warranty. + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. - 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. + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE 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. END OF TERMS AND CONDITIONS @@ -628,15 +287,15 @@ 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 +convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) - This program is free software: you can redistribute it and/or modify + 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 + the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -644,31 +303,38 @@ the "copyright" line and a pointer to where the full notice is found. 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 . + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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: +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Gnomovision version 69, Copyright (C) year name of author + Gnomovision 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". +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. - 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 -. +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This 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. - 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 -. diff --git a/LICENSE b/LICENSE index d6a93266..458be2e8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ -GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc., + Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - {description} - Copyright (C) {year} {fullname} + + Copyright (C) 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 @@ -329,7 +329,7 @@ necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. - {signature of Ty Coon}, 1 April 1989 + , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into diff --git a/TODO b/TODO index bdf9b20c..df8554cc 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,27 @@ TODO: --------------- + +* Forces; the UdSdU term in gauge force term is half of what I think it should + be. This is a consequence of taking ONLY the first term in: + + dSg/dt = dU/dt dSdU + dUdag/dt dSdUdag + + in the fermion force. + + Now, S_mom = - tr Pmu Pmu ; Pmu anti-herm + + . + d Smom/dt = - 2.0 tr Pmu Pmu = - dSg/dt = - tr Pmu [Umu dSdUmu + UmuDag dSdUmuDag] + + . + => Pmu = Umu dSdUmu + + Where the norm is half expected. + + This means we must double the force in the Test_xxx_force routines, and is the origin of the factor of two. + This 2x is applied by hand in the fermion routines and in the Test_rect_force routine. + + Policies: * Link smearing/boundary conds; Policy class based implementation ; framework more in place diff --git a/benchmarks/Benchmark_comms.cc b/benchmarks/Benchmark_comms.cc index 216172f9..21b0dd0f 100644 --- a/benchmarks/Benchmark_comms.cc +++ b/benchmarks/Benchmark_comms.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./benchmarks/Benchmark_comms.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/benchmarks/Benchmark_dwf.cc b/benchmarks/Benchmark_dwf.cc index 1c871e72..9bd20c7a 100644 --- a/benchmarks/Benchmark_dwf.cc +++ b/benchmarks/Benchmark_dwf.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./benchmarks/Benchmark_dwf.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; @@ -16,10 +44,16 @@ struct scal { Gamma::GammaT }; +bool overlapComms = false; + int main (int argc, char ** argv) { Grid_init(&argc,&argv); + if( GridCmdOptionExists(argv,argv+argc,"--asynch") ){ + overlapComms = true; + } + int threads = GridThread::GetThreads(); std::cout< +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/benchmarks/Benchmark_memory_bandwidth.cc b/benchmarks/Benchmark_memory_bandwidth.cc index cf6f642c..1fc5cbc4 100644 --- a/benchmarks/Benchmark_memory_bandwidth.cc +++ b/benchmarks/Benchmark_memory_bandwidth.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./benchmarks/Benchmark_memory_bandwidth.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/benchmarks/Benchmark_su3.cc b/benchmarks/Benchmark_su3.cc index d1accefd..a5f71299 100644 --- a/benchmarks/Benchmark_su3.cc +++ b/benchmarks/Benchmark_su3.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./benchmarks/Benchmark_su3.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/benchmarks/Benchmark_wilson.cc b/benchmarks/Benchmark_wilson.cc index eab0fdd2..10aa7009 100644 --- a/benchmarks/Benchmark_wilson.cc +++ b/benchmarks/Benchmark_wilson.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./benchmarks/Benchmark_wilson.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; @@ -16,10 +44,15 @@ struct scal { Gamma::GammaT }; +bool overlapComms = false; + int main (int argc, char ** argv) { Grid_init(&argc,&argv); + if( GridCmdOptionExists(argv,argv+argc,"--asynch") ){ + overlapComms = true; + } std::vector latt_size = GridDefaultLatt(); std::vector simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); @@ -57,11 +90,12 @@ int main (int argc, char ** argv) Complex cone(1.0,0.0); for(int nn=0;nn(Umu,U[nn],nn); + PokeIndex(Umu,U[nn],nn); } #endif @@ -87,7 +121,11 @@ int main (int argc, char ** argv) } ref = -0.5*ref; RealD mass=0.1; - WilsonFermionR Dw(Umu,Grid,RBGrid,mass); + + typename WilsonFermionR::ImplParams params; + params.overlapCommsCompute = overlapComms; + + WilsonFermionR Dw(Umu,Grid,RBGrid,mass,params); std::cout< + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/benchmarks/simple_su3_test.cc b/benchmarks/simple_su3_test.cc index 8a7f6246..e5cca98d 100644 --- a/benchmarks/simple_su3_test.cc +++ b/benchmarks/simple_su3_test.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./benchmarks/simple_su3_test.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/configure b/configure index f264dae4..8fca7966 100755 --- a/configure +++ b/configure @@ -749,6 +749,7 @@ enable_openmp enable_simd enable_precision enable_comms +enable_rng enable_chroma ' ac_precious_vars='build_alias @@ -1395,6 +1396,8 @@ Optional Features: --enable-precision=single|double Select default word size of Real --enable-comms=none|mpi Select communications + --enable-rng=ranlux48|mt19937 + Select Random Number Generator to be used --enable-chroma Expect chroma compiled under c++11 Some influential environment variables: @@ -6363,7 +6366,6 @@ echo echo Checking libraries echo ::::::::::::::::::::::::::::::::::::::::::: - for ac_func in gettimeofday do : ac_fn_cxx_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" @@ -6386,6 +6388,10 @@ done #Please install or provide the correct path to your installation #Info at: http://www.mpfr.org/)]) +# +# SIMD instructions selection +# + # Check whether --enable-simd was given. if test "${enable_simd+set}" = set; then : enableval=$enable_simd; \ @@ -6518,6 +6524,10 @@ $as_echo "#define GRID_DEFAULT_PRECISION_DOUBLE 1" >>confdefs.h ;; esac +# +# Comms selection +# + # Check whether --enable-comms was given. if test "${enable_comms+set}" = set; then : enableval=$enable_comms; ac_COMMS=${enable_comms} @@ -6561,6 +6571,35 @@ else fi +# +# RNG selection +# +# Check whether --enable-rng was given. +if test "${enable_rng+set}" = set; then : + enableval=$enable_rng; \ + ac_RNG=${enable_rng} +else + ac_RNG=ranlux48 +fi + +case ${ac_RNG} in + ranlux48) + +$as_echo "#define RNG_RANLUX 1" >>confdefs.h + + ;; + mt19937) + +$as_echo "#define RNG_MT19937 1" >>confdefs.h + + ;; + *) + as_fn_error $? "${ac_RNG} unsupported --enable-rng option" "$LINENO" 5; + ;; +esac +# +# Chroma regression tests +# # Check whether --enable-chroma was given. if test "${enable_chroma+set}" = set; then : enableval=$enable_chroma; ac_CHROMA=yes @@ -8111,8 +8150,10 @@ The following features are enabled: - graphs and diagrams : `if test "x$enable_dot" = xyes; then echo yes; else echo no; fi` - Supported SIMD flags : $SIMD_FLAGS ---------------------------------------------------------- -- enabled simd support : ${ac_SIMD} (supported: $supported ) +- enabled simd support : ${ac_SIMD} (config macro says supported: $supported ) - communications type : ${ac_COMMS} +- default precision : ${ac_PRECISION} +- RNG choice : ${ac_RNG} " diff --git a/configure.ac b/configure.ac index 1bff5519..9e6464c4 100644 --- a/configure.ac +++ b/configure.ac @@ -53,7 +53,6 @@ echo echo Checking libraries echo ::::::::::::::::::::::::::::::::::::::::::: - AC_CHECK_FUNCS([gettimeofday]) #AC_CHECK_LIB([gmp],[__gmpf_init],, @@ -66,6 +65,10 @@ AC_CHECK_FUNCS([gettimeofday]) #Please install or provide the correct path to your installation #Info at: http://www.mpfr.org/)]) +# +# SIMD instructions selection +# + AC_ARG_ENABLE([simd],[AC_HELP_STRING([--enable-simd=SSE4|AVX|AVXFMA4|AVX2|AVX512|IMCI],\ [Select instructions to be SSE4.0, AVX 1.0, AVX 2.0+FMA, AVX 512, IMCI])],\ [ac_SIMD=${enable_simd}],[ac_SIMD=AVX2]) @@ -160,6 +163,10 @@ case ${ac_PRECISION} in ;; esac +# +# Comms selection +# + AC_ARG_ENABLE([comms],[AC_HELP_STRING([--enable-comms=none|mpi],[Select communications])],[ac_COMMS=${enable_comms}],[ac_COMMS=none]) case ${ac_COMMS} in @@ -179,6 +186,26 @@ esac AM_CONDITIONAL(BUILD_COMMS_MPI,[ test "X${ac_COMMS}X" == "XmpiX" ]) AM_CONDITIONAL(BUILD_COMMS_NONE,[ test "X${ac_COMMS}X" == "XnoneX" ]) +# +# RNG selection +# +AC_ARG_ENABLE([rng],[AC_HELP_STRING([--enable-rng=ranlux48|mt19937],\ + [Select Random Number Generator to be used])],\ + [ac_RNG=${enable_rng}],[ac_RNG=ranlux48]) +case ${ac_RNG} in + ranlux48) + AC_DEFINE([RNG_RANLUX],[1],[RNG_RANLUX] ) + ;; + mt19937) + AC_DEFINE([RNG_MT19937],[1],[RNG_MT19937] ) + ;; + *) + AC_MSG_ERROR([${ac_RNG} unsupported --enable-rng option]); + ;; +esac +# +# Chroma regression tests +# AC_ARG_ENABLE([chroma],[AC_HELP_STRING([--enable-chroma],[Expect chroma compiled under c++11 ])],ac_CHROMA=yes,ac_CHROMA=no) case ${ac_CHROMA} in @@ -234,8 +261,10 @@ The following features are enabled: - graphs and diagrams : `if test "x$enable_dot" = xyes; then echo yes; else echo no; fi` - Supported SIMD flags : $SIMD_FLAGS ---------------------------------------------------------- -- enabled simd support : ${ac_SIMD} (supported: $supported ) +- enabled simd support : ${ac_SIMD} (config macro says supported: $supported ) - communications type : ${ac_COMMS} +- default precision : ${ac_PRECISION} +- RNG choice : ${ac_RNG} " diff --git a/gcc-bug-report/broken.cc b/gcc-bug-report/broken.cc index edf878c5..6f0f520e 100644 --- a/gcc-bug-report/broken.cc +++ b/gcc-bug-report/broken.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./gcc-bug-report/broken.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include #include diff --git a/lib/Algorithms.h b/lib/Algorithms.h index a77e50bc..0a3d34ce 100644 --- a/lib/Algorithms.h +++ b/lib/Algorithms.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Algorithms.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_ALGORITHMS_H #define GRID_ALGORITHMS_H diff --git a/lib/AlignedAllocator.h b/lib/AlignedAllocator.h index 620b2520..d7d54d58 100644 --- a/lib/AlignedAllocator.h +++ b/lib/AlignedAllocator.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/AlignedAllocator.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_ALIGNED_ALLOCATOR_H #define GRID_ALIGNED_ALLOCATOR_H diff --git a/lib/Cartesian.h b/lib/Cartesian.h index db384b53..aeffe331 100644 --- a/lib/Cartesian.h +++ b/lib/Cartesian.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Cartesian.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_CARTESIAN_H #define GRID_CARTESIAN_H diff --git a/lib/Communicator.h b/lib/Communicator.h index 6880adda..bc3ae166 100644 --- a/lib/Communicator.h +++ b/lib/Communicator.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Communicator.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_COMMUNICATOR_H #define GRID_COMMUNICATOR_H diff --git a/lib/Config.h.in b/lib/Config.h.in index 4704273d..de782626 100644 --- a/lib/Config.h.in +++ b/lib/Config.h.in @@ -143,6 +143,12 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* RNG_MT19937 */ +#undef RNG_MT19937 + +/* RNG_RANLUX */ +#undef RNG_RANLUX + /* SSE4 Intrinsics */ #undef SSE4 diff --git a/lib/Cshift.h b/lib/Cshift.h index 3caccbf9..dd81bf33 100644 --- a/lib/Cshift.h +++ b/lib/Cshift.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Cshift.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef _GRID_CSHIFT_H_ #define _GRID_CSHIFT_H_ diff --git a/lib/Grid.h b/lib/Grid.h index 72d2d463..eba54327 100644 --- a/lib/Grid.h +++ b/lib/Grid.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Grid.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: azusayamaguchi +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ // // Grid.h // simd @@ -44,11 +73,14 @@ #include #include #include -#include #include +#include #include - #include +#include +#include + + #endif diff --git a/lib/Init.cc b/lib/Init.cc index c453e904..741f8243 100644 --- a/lib/Init.cc +++ b/lib/Init.cc @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Init.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ /****************************************************************************/ /* pab: Signal magic. Processor state dump is x86-64 specific */ /****************************************************************************/ @@ -171,7 +201,7 @@ void Grid_init(int *argc,char ***argv) std::cout< +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_INIT_H #define GRID_INIT_H @@ -21,6 +49,8 @@ namespace Grid { std::string GridCmdOptionPayload(char ** begin, char ** end, const std::string & option); bool GridCmdOptionExists(char** begin, char** end, const std::string& option); std::string GridCmdVectorIntToString(const std::vector & vec); + void GridCmdOptionCSL(std::string str,std::vector & vec); + void GridCmdOptionIntVector(std::string &str,std::vector & vec); void GridParseLayout(char **argv,int argc, std::vector &latt, diff --git a/lib/Lattice.h b/lib/Lattice.h index 1f29a908..5171e999 100644 --- a/lib/Lattice.h +++ b/lib/Lattice.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Lattice.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_H #define GRID_LATTICE_H diff --git a/lib/Log.cc b/lib/Log.cc index 8aa0b809..911ab0d0 100644 --- a/lib/Log.cc +++ b/lib/Log.cc @@ -1,16 +1,56 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Log.cc + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { GridStopWatch Logger::StopWatch; std::ostream Logger::devnull(0); +std::string Logger::BLACK("\033[30m"); +std::string Logger::RED("\033[31m"); +std::string Logger::GREEN("\033[32m"); +std::string Logger::YELLOW("\033[33m"); +std::string Logger::BLUE("\033[34m"); +std::string Logger::PURPLE("\033[35m"); +std::string Logger::CYAN("\033[36m"); +std::string Logger::WHITE("\033[37m"); +std::string Logger::NORMAL("\033[0;39m"); -GridLogger GridLogError (1,"Error"); -GridLogger GridLogWarning (1,"Warning"); -GridLogger GridLogMessage (1,"Message"); -GridLogger GridLogDebug (1,"Debug"); -GridLogger GridLogPerformance(1,"Performance"); -GridLogger GridLogIterative (1,"Iterative"); + GridLogger GridLogError (1,"Error",Logger::RED); + GridLogger GridLogWarning (1,"Warning",Logger::YELLOW); + GridLogger GridLogMessage (1,"Message",Logger::BLACK); + GridLogger GridLogDebug (1,"Debug",Logger::PURPLE); + GridLogger GridLogPerformance(1,"Performance",Logger::GREEN); + GridLogger GridLogIterative (1,"Iterative",Logger::BLUE); + GridLogger GridLogIntegrator (1,"Integrator",Logger::BLUE); void GridLogConfigure(std::vector &logstreams) { @@ -20,6 +60,7 @@ void GridLogConfigure(std::vector &logstreams) GridLogIterative.Active(0); GridLogDebug.Active(0); GridLogPerformance.Active(0); + GridLogIntegrator.Active(0); for(int i=0;i &logstreams) if ( logstreams[i]== std::string("Iterative") ) GridLogIterative.Active(1); if ( logstreams[i]== std::string("Debug") ) GridLogDebug.Active(1); if ( logstreams[i]== std::string("Performance") ) GridLogPerformance.Active(1); + if ( logstreams[i]== std::string("Integrator" ) ) GridLogIntegrator.Active(1); } } @@ -52,11 +94,6 @@ void Grid_unquiesce_nodes(void) #endif } -std::ostream& operator<< (std::ostream& stream, const GridTime& time) -{ - stream << time.count()<<" ms"; - return stream; -} } diff --git a/lib/Log.h b/lib/Log.h index eaadfd81..9119cc4f 100644 --- a/lib/Log.h +++ b/lib/Log.h @@ -1,21 +1,59 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Log.h + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LOG_H #define GRID_LOG_H namespace Grid { // Dress the output; use std::chrono for time stamping via the StopWatch class -std::ostream& operator<< (std::ostream& stream, const GridTime& time); class Logger { protected: int active; - std::string name, topName; + std::string name, topName, COLOUR; public: static GridStopWatch StopWatch; static std::ostream devnull; + + static std::string BLACK; + static std::string RED ; + static std::string GREEN; + static std::string YELLOW; + static std::string BLUE ; + static std::string PURPLE; + static std::string CYAN ; + static std::string WHITE ; + static std::string NORMAL; - Logger(std::string topNm, int on, std::string nm) - : active(on), name(nm), topName(topNm) {}; + Logger(std::string topNm, int on, std::string nm,std::string col) + : active(on), name(nm), topName(topNm), COLOUR(col) {}; void Active(int on) {active = on;}; int isActive(void) {return active;}; @@ -25,9 +63,9 @@ public: StopWatch.Stop(); GridTime now = StopWatch.Elapsed(); StopWatch.Start(); - stream << std::setw(8) << std::left << log.topName << " : "; - stream << std::setw(12) << std::left << log.name << " : "; - stream << now << " : "; + stream << BLACK<< log.topName << BLACK<< " : "; + stream << log.COLOUR < &logstreams); @@ -49,6 +87,7 @@ extern GridLogger GridLogMessage; extern GridLogger GridLogDebug ; extern GridLogger GridLogPerformance; extern GridLogger GridLogIterative ; +extern GridLogger GridLogIntegrator ; } #endif diff --git a/lib/Make.inc b/lib/Make.inc index de647bcb..73d13eb5 100644 --- a/lib/Make.inc +++ b/lib/Make.inc @@ -1,4 +1,4 @@ -HFILES=./algorithms/approx/bigfloat.h ./algorithms/approx/bigfloat_double.h ./algorithms/approx/Chebyshev.h ./algorithms/approx/MultiShiftFunction.h ./algorithms/approx/Remez.h ./algorithms/approx/Zolotarev.h ./algorithms/CoarsenedMatrix.h ./algorithms/iterative/AdefGeneric.h ./algorithms/iterative/ConjugateGradient.h ./algorithms/iterative/ConjugateGradientMultiShift.h ./algorithms/iterative/ConjugateResidual.h ./algorithms/iterative/DenseMatrix.h ./algorithms/iterative/EigenSort.h ./algorithms/iterative/Francis.h ./algorithms/iterative/Householder.h ./algorithms/iterative/ImplicitlyRestartedLanczos.h ./algorithms/iterative/Matrix.h ./algorithms/iterative/MatrixUtils.h ./algorithms/iterative/NormalEquations.h ./algorithms/iterative/PrecConjugateResidual.h ./algorithms/iterative/PrecGeneralisedConjugateResidual.h ./algorithms/iterative/SchurRedBlack.h ./algorithms/LinearOperator.h ./algorithms/Preconditioner.h ./algorithms/SparseMatrix.h ./Algorithms.h ./AlignedAllocator.h ./cartesian/Cartesian_base.h ./cartesian/Cartesian_full.h ./cartesian/Cartesian_red_black.h ./Cartesian.h ./communicator/Communicator_base.h ./Communicator.h ./cshift/Cshift_common.h ./cshift/Cshift_mpi.h ./cshift/Cshift_none.h ./Cshift.h ./Grid.h ./Init.h ./lattice/Lattice_arith.h ./lattice/Lattice_base.h ./lattice/Lattice_comparison.h ./lattice/Lattice_comparison_utils.h ./lattice/Lattice_conformable.h ./lattice/Lattice_coordinate.h ./lattice/Lattice_ET.h ./lattice/Lattice_local.h ./lattice/Lattice_overload.h ./lattice/Lattice_peekpoke.h ./lattice/Lattice_reality.h ./lattice/Lattice_reduction.h ./lattice/Lattice_rng.h ./lattice/Lattice_trace.h ./lattice/Lattice_transfer.h ./lattice/Lattice_transpose.h ./lattice/Lattice_unary.h ./lattice/Lattice_where.h ./Lattice.h ./Log.h ./Old/Tensor_peek.h ./Old/Tensor_poke.h ./parallelIO/BinaryIO.h ./parallelIO/NerscIO.h ./PerfCount.h ./pugixml/pugixml.h ./qcd/action/ActionBase.h ./qcd/action/ActionParams.h ./qcd/action/Actions.h ./qcd/action/fermion/CayleyFermion5D.h ./qcd/action/fermion/ContinuedFractionFermion5D.h ./qcd/action/fermion/DomainWallFermion.h ./qcd/action/fermion/FermionOperator.h ./qcd/action/fermion/FermionOperatorImpl.h ./qcd/action/fermion/g5HermitianLinop.h ./qcd/action/fermion/MobiusFermion.h ./qcd/action/fermion/MobiusZolotarevFermion.h ./qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h ./qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h ./qcd/action/fermion/OverlapWilsonContfracTanhFermion.h ./qcd/action/fermion/OverlapWilsonContfracZolotarevFermion.h ./qcd/action/fermion/OverlapWilsonPartialFractionTanhFermion.h ./qcd/action/fermion/OverlapWilsonPartialFractionZolotarevFermion.h ./qcd/action/fermion/PartialFractionFermion5D.h ./qcd/action/fermion/ScaledShamirFermion.h ./qcd/action/fermion/ShamirZolotarevFermion.h ./qcd/action/fermion/WilsonCompressor.h ./qcd/action/fermion/WilsonFermion.h ./qcd/action/fermion/WilsonFermion5D.h ./qcd/action/fermion/WilsonKernels.h ./qcd/action/gauge/WilsonGaugeAction.h ./qcd/action/pseudofermion/EvenOddSchurDifferentiable.h ./qcd/action/pseudofermion/OneFlavourEvenOddRational.h ./qcd/action/pseudofermion/OneFlavourEvenOddRationalRatio.h ./qcd/action/pseudofermion/OneFlavourRational.h ./qcd/action/pseudofermion/OneFlavourRationalRatio.h ./qcd/action/pseudofermion/TwoFlavour.h ./qcd/action/pseudofermion/TwoFlavourEvenOdd.h ./qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h ./qcd/action/pseudofermion/TwoFlavourRatio.h ./qcd/hmc/HMC.h ./qcd/hmc/integrators/Integrator.h ./qcd/hmc/integrators/Integrator_algorithm.h ./qcd/QCD.h ./qcd/spin/Dirac.h ./qcd/spin/TwoSpinor.h ./qcd/utils/CovariantCshift.h ./qcd/utils/LinalgUtils.h ./qcd/utils/SpaceTimeGrid.h ./qcd/utils/SUn.h ./qcd/utils/WilsonLoops.h ./serialisation/BaseIO.h ./serialisation/BinaryIO.h ./serialisation/MacroMagic.h ./serialisation/Serialisation.h ./serialisation/TextIO.h ./serialisation/XmlIO.h ./simd/Avx512Asm.h ./simd/Grid_avx.h ./simd/Grid_avx512.h ./simd/Grid_empty.h ./simd/Grid_imci.h ./simd/Grid_neon.h ./simd/Grid_qpx.h ./simd/Grid_sse4.h ./simd/Grid_vector_types.h ./simd/Grid_vector_unops.h ./Simd.h ./stencil/Lebesgue.h ./Stencil.h ./tensors/Tensor_arith.h ./tensors/Tensor_arith_add.h ./tensors/Tensor_arith_mac.h ./tensors/Tensor_arith_mul.h ./tensors/Tensor_arith_scalar.h ./tensors/Tensor_arith_sub.h ./tensors/Tensor_class.h ./tensors/Tensor_determinant.h ./tensors/Tensor_exp.h ./tensors/Tensor_extract_merge.h ./tensors/Tensor_index.h ./tensors/Tensor_inner.h ./tensors/Tensor_logical.h ./tensors/Tensor_outer.h ./tensors/Tensor_reality.h ./tensors/Tensor_Ta.h ./tensors/Tensor_trace.h ./tensors/Tensor_traits.h ./tensors/Tensor_transpose.h ./tensors/Tensor_unary.h ./Tensors.h ./Threads.h ./Timer.h +HFILES=./algorithms/approx/bigfloat.h ./algorithms/approx/bigfloat_double.h ./algorithms/approx/Chebyshev.h ./algorithms/approx/MultiShiftFunction.h ./algorithms/approx/Remez.h ./algorithms/approx/Zolotarev.h ./algorithms/CoarsenedMatrix.h ./algorithms/iterative/AdefGeneric.h ./algorithms/iterative/ConjugateGradient.h ./algorithms/iterative/ConjugateGradientMultiShift.h ./algorithms/iterative/ConjugateResidual.h ./algorithms/iterative/DenseMatrix.h ./algorithms/iterative/EigenSort.h ./algorithms/iterative/Francis.h ./algorithms/iterative/Householder.h ./algorithms/iterative/ImplicitlyRestartedLanczos.h ./algorithms/iterative/Matrix.h ./algorithms/iterative/MatrixUtils.h ./algorithms/iterative/NormalEquations.h ./algorithms/iterative/PrecConjugateResidual.h ./algorithms/iterative/PrecGeneralisedConjugateResidual.h ./algorithms/iterative/SchurRedBlack.h ./algorithms/LinearOperator.h ./algorithms/Preconditioner.h ./algorithms/SparseMatrix.h ./Algorithms.h ./AlignedAllocator.h ./cartesian/Cartesian_base.h ./cartesian/Cartesian_full.h ./cartesian/Cartesian_red_black.h ./Cartesian.h ./communicator/Communicator_base.h ./Communicator.h ./cshift/Cshift_common.h ./cshift/Cshift_mpi.h ./cshift/Cshift_none.h ./Cshift.h ./Grid.h ./Init.h ./lattice/Lattice_arith.h ./lattice/Lattice_base.h ./lattice/Lattice_comparison.h ./lattice/Lattice_comparison_utils.h ./lattice/Lattice_conformable.h ./lattice/Lattice_coordinate.h ./lattice/Lattice_ET.h ./lattice/Lattice_local.h ./lattice/Lattice_overload.h ./lattice/Lattice_peekpoke.h ./lattice/Lattice_reality.h ./lattice/Lattice_reduction.h ./lattice/Lattice_rng.h ./lattice/Lattice_trace.h ./lattice/Lattice_transfer.h ./lattice/Lattice_transpose.h ./lattice/Lattice_unary.h ./lattice/Lattice_where.h ./Lattice.h ./Log.h ./Old/Tensor_peek.h ./Old/Tensor_poke.h ./parallelIO/BinaryIO.h ./parallelIO/NerscIO.h ./PerfCount.h ./pugixml/pugixml.h ./qcd/action/ActionBase.h ./qcd/action/ActionParams.h ./qcd/action/Actions.h ./qcd/action/fermion/CayleyFermion5D.h ./qcd/action/fermion/ContinuedFractionFermion5D.h ./qcd/action/fermion/DomainWallFermion.h ./qcd/action/fermion/FermionOperator.h ./qcd/action/fermion/FermionOperatorImpl.h ./qcd/action/fermion/g5HermitianLinop.h ./qcd/action/fermion/MobiusFermion.h ./qcd/action/fermion/MobiusZolotarevFermion.h ./qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h ./qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h ./qcd/action/fermion/OverlapWilsonContfracTanhFermion.h ./qcd/action/fermion/OverlapWilsonContfracZolotarevFermion.h ./qcd/action/fermion/OverlapWilsonPartialFractionTanhFermion.h ./qcd/action/fermion/OverlapWilsonPartialFractionZolotarevFermion.h ./qcd/action/fermion/PartialFractionFermion5D.h ./qcd/action/fermion/ScaledShamirFermion.h ./qcd/action/fermion/ShamirZolotarevFermion.h ./qcd/action/fermion/WilsonCompressor.h ./qcd/action/fermion/WilsonFermion.h ./qcd/action/fermion/WilsonFermion5D.h ./qcd/action/fermion/WilsonKernels.h ./qcd/action/fermion/WilsonTMFermion.h ./qcd/action/gauge/GaugeImpl.h ./qcd/action/gauge/PlaqPlusRectangleAction.h ./qcd/action/gauge/WilsonGaugeAction.h ./qcd/action/pseudofermion/EvenOddSchurDifferentiable.h ./qcd/action/pseudofermion/OneFlavourEvenOddRational.h ./qcd/action/pseudofermion/OneFlavourEvenOddRationalRatio.h ./qcd/action/pseudofermion/OneFlavourRational.h ./qcd/action/pseudofermion/OneFlavourRationalRatio.h ./qcd/action/pseudofermion/TwoFlavour.h ./qcd/action/pseudofermion/TwoFlavourEvenOdd.h ./qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h ./qcd/action/pseudofermion/TwoFlavourRatio.h ./qcd/hmc/HMC.h ./qcd/hmc/HmcRunner.h ./qcd/hmc/integrators/Integrator.h ./qcd/hmc/integrators/Integrator_algorithm.h ./qcd/hmc/NerscCheckpointer.h ./qcd/QCD.h ./qcd/spin/Dirac.h ./qcd/spin/TwoSpinor.h ./qcd/utils/CovariantCshift.h ./qcd/utils/LinalgUtils.h ./qcd/utils/SpaceTimeGrid.h ./qcd/utils/SUn.h ./qcd/utils/WilsonLoops.h ./serialisation/BaseIO.h ./serialisation/BinaryIO.h ./serialisation/MacroMagic.h ./serialisation/Serialisation.h ./serialisation/TextIO.h ./serialisation/XmlIO.h ./simd/Avx512Asm.h ./simd/Grid_avx.h ./simd/Grid_avx512.h ./simd/Grid_empty.h ./simd/Grid_imci.h ./simd/Grid_neon.h ./simd/Grid_qpx.h ./simd/Grid_sse4.h ./simd/Grid_vector_types.h ./simd/Grid_vector_unops.h ./Simd.h ./stencil/Lebesgue.h ./Stencil.h ./tensors/Tensor_arith.h ./tensors/Tensor_arith_add.h ./tensors/Tensor_arith_mac.h ./tensors/Tensor_arith_mul.h ./tensors/Tensor_arith_scalar.h ./tensors/Tensor_arith_sub.h ./tensors/Tensor_class.h ./tensors/Tensor_determinant.h ./tensors/Tensor_exp.h ./tensors/Tensor_extract_merge.h ./tensors/Tensor_index.h ./tensors/Tensor_inner.h ./tensors/Tensor_logical.h ./tensors/Tensor_outer.h ./tensors/Tensor_reality.h ./tensors/Tensor_Ta.h ./tensors/Tensor_trace.h ./tensors/Tensor_traits.h ./tensors/Tensor_transpose.h ./tensors/Tensor_unary.h ./Tensors.h ./Threads.h ./Timer.h -CCFILES=./algorithms/approx/MultiShiftFunction.cc ./algorithms/approx/Remez.cc ./algorithms/approx/Zolotarev.cc ./Init.cc ./Log.cc ./PerfCount.cc ./pugixml/pugixml.cc ./qcd/action/fermion/CayleyFermion5D.cc ./qcd/action/fermion/ContinuedFractionFermion5D.cc ./qcd/action/fermion/PartialFractionFermion5D.cc ./qcd/action/fermion/WilsonFermion.cc ./qcd/action/fermion/WilsonFermion5D.cc ./qcd/action/fermion/WilsonKernels.cc ./qcd/action/fermion/WilsonKernelsAsm.cc ./qcd/action/fermion/WilsonKernelsHand.cc ./qcd/hmc/HMC.cc ./qcd/spin/Dirac.cc ./qcd/utils/SpaceTimeGrid.cc ./serialisation/BinaryIO.cc ./serialisation/TextIO.cc ./serialisation/XmlIO.cc ./stencil/Lebesgue.cc ./stencil/Stencil_common.cc +CCFILES=./algorithms/approx/MultiShiftFunction.cc ./algorithms/approx/Remez.cc ./algorithms/approx/Zolotarev.cc ./Init.cc ./Log.cc ./PerfCount.cc ./pugixml/pugixml.cc ./qcd/action/fermion/CayleyFermion5D.cc ./qcd/action/fermion/ContinuedFractionFermion5D.cc ./qcd/action/fermion/PartialFractionFermion5D.cc ./qcd/action/fermion/WilsonFermion.cc ./qcd/action/fermion/WilsonFermion5D.cc ./qcd/action/fermion/WilsonKernels.cc ./qcd/action/fermion/WilsonKernelsAsm.cc ./qcd/action/fermion/WilsonKernelsHand.cc ./qcd/action/fermion/WilsonTMFermion.cc ./qcd/hmc/HMC.cc ./qcd/spin/Dirac.cc ./qcd/utils/SpaceTimeGrid.cc ./serialisation/BinaryIO.cc ./serialisation/TextIO.cc ./serialisation/XmlIO.cc ./stencil/Lebesgue.cc ./stencil/Stencil_common.cc diff --git a/lib/Old/Tensor_peek.h b/lib/Old/Tensor_peek.h index 9c037581..eecb3cd5 100644 --- a/lib/Old/Tensor_peek.h +++ b/lib/Old/Tensor_peek.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Old/Tensor_peek.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_PEEK_H #define GRID_MATH_PEEK_H namespace Grid { diff --git a/lib/Old/Tensor_poke.h b/lib/Old/Tensor_poke.h index 8a3fd69d..83d09cf1 100644 --- a/lib/Old/Tensor_poke.h +++ b/lib/Old/Tensor_poke.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Old/Tensor_poke.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_POKE_H #define GRID_MATH_POKE_H namespace Grid { diff --git a/lib/PerfCount.cc b/lib/PerfCount.cc index 2b2476fa..9a35634d 100644 --- a/lib/PerfCount.cc +++ b/lib/PerfCount.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/PerfCount.cc + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include diff --git a/lib/PerfCount.h b/lib/PerfCount.h index 3c220b12..db8e5945 100644 --- a/lib/PerfCount.h +++ b/lib/PerfCount.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/PerfCount.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_PERFCOUNT_H #define GRID_PERFCOUNT_H diff --git a/lib/Simd.h b/lib/Simd.h index 3aaefddd..ac3a5f88 100644 --- a/lib/Simd.h +++ b/lib/Simd.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Simd.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_SIMD_H #define GRID_SIMD_H diff --git a/lib/Stencil.h b/lib/Stencil.h index f7c90f6b..f48fc6f1 100644 --- a/lib/Stencil.h +++ b/lib/Stencil.h @@ -1,6 +1,37 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Stencil.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_STENCIL_H #define GRID_STENCIL_H +#include + #include // subdir aggregate ////////////////////////////////////////////////////////////////////////////////////////// @@ -60,7 +91,8 @@ namespace Grid { int _checkerboard; int _npoints; // Move to template param? GridBase * _grid; - + + // npoints of these std::vector _directions; std::vector _distances; @@ -163,18 +195,19 @@ namespace Grid { // So tables are the same whether comm_dim or splice_dim sshift[0] = _grid->CheckerBoardShiftForCB(_checkerboard,dimension,shift,Even); sshift[1] = _grid->CheckerBoardShiftForCB(_checkerboard,dimension,shift,Odd); + if ( sshift[0] == sshift[1] ) { - Comms(point,dimension,shift,0x3); // std::cout<<"Comms 0x3"< o"<<_entries[i][ss]._offset<<"; l"<< - // _entries[i][ss]._is_local<<"; p"<<_entries[i][ss]._permute< o"<<_entries[i][ss]._offset<<"; l"<< + // _entries[i][ss]._is_local<<"; p"<<_entries[i][ss]._permute<Nsimd(); int fd = _grid->_fdimensions[dimension]; int ld = _grid->_ldimensions[dimension]; @@ -241,8 +274,9 @@ namespace Grid { int shift = (shiftpm + fd) %fd; assert(shift>=0); assert(shift_slice_nblock[dimension]*_grid->_slice_block[dimension]; + + int buffer_size = _grid->_slice_nblock[dimension]*_grid->_slice_block[dimension]; // done in reduced dims, so SIMD factored + // std::cout << " dim " <PermuteType(dimension); + + int sx = (x+sshift)%rd; + + int offnode = 0; + if ( simd_layout > 1 ) { + + for(int i=0;i>(permute_type+1)); + int ic= (i&inner_bit)? 1:0; + int my_coor = rd*ic + x; + int nbr_coor = my_coor+sshift; + int nbr_proc = ((nbr_coor)/ld) % pd;// relative shift in processors + + if ( nbr_proc ) { + offnode =1; + } + } + + } else { + int comm_proc = ((x+sshift)/rd)%pd; + offnode = (comm_proc!= 0); + // std::cout << "Stencil x "<x) && (grid->_processor_coor[dimension]==0) ) { wraparound = 1; @@ -282,6 +345,7 @@ namespace Grid { int unified_buffer_offset = _unified_buffer_size; _unified_buffer_size += words; + // std::cout<< "Comms dim "< &source,std::vector > &u_comm_buf,compressor &compress) + void HaloExchange(const Lattice &source,std::vector > &u_comm_buf,compressor &compress) + { + std::thread thr = HaloExchangeBegin(source,u_comm_buf,compress); + thr.join(); + } + + std::thread HaloExchangeBegin(const Lattice &source,std::vector > & u_comm_buf,compressor &compress) { + return std::thread([&] { this->HaloExchangeBlocking(source,u_comm_buf,compress); }); + } + + void HaloExchangeBlocking(const Lattice &source,std::vector > &u_comm_buf,compressor &compress) { // conformable(source._grid,_grid); assert(source._grid==_grid); @@ -440,7 +514,7 @@ namespace Grid { nosplicetime+=usecond(); } } else { - std::cout << "dim "<>(permute_type+1)); int ic= (i&inner_bit)? 1:0; @@ -633,10 +706,11 @@ namespace Grid { } } - // Here we don't want to scatter, just place into a buffer. + // std::cout << " CommsSimd ["< +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_H #define GRID_MATH_H diff --git a/lib/Threads.h b/lib/Threads.h index 64dcf893..9d1295e5 100644 --- a/lib/Threads.h +++ b/lib/Threads.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Threads.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_THREADS_H #define GRID_THREADS_H diff --git a/lib/Timer.h b/lib/Timer.h index 43ace890..5b91beeb 100644 --- a/lib/Timer.h +++ b/lib/Timer.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/Timer.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_TIME_H #define GRID_TIME_H @@ -17,6 +45,11 @@ typedef std::chrono::system_clock GridClock; typedef std::chrono::time_point GridTimePoint; typedef std::chrono::milliseconds GridTime; +inline std::ostream& operator<< (std::ostream & stream, const std::chrono::milliseconds & time) +{ + stream << time.count()<<" ms"; + return stream; +} class GridStopWatch { private: diff --git a/lib/algorithms/CoarsenedMatrix.h b/lib/algorithms/CoarsenedMatrix.h index 0eac0e3e..1a3bbef6 100644 --- a/lib/algorithms/CoarsenedMatrix.h +++ b/lib/algorithms/CoarsenedMatrix.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/CoarsenedMatrix.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_ALGORITHM_COARSENED_MATRIX_H #define GRID_ALGORITHM_COARSENED_MATRIX_H diff --git a/lib/algorithms/LinearOperator.h b/lib/algorithms/LinearOperator.h index c49d7c7d..7411bc00 100644 --- a/lib/algorithms/LinearOperator.h +++ b/lib/algorithms/LinearOperator.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/LinearOperator.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_ALGORITHM_LINEAR_OP_H #define GRID_ALGORITHM_LINEAR_OP_H diff --git a/lib/algorithms/Preconditioner.h b/lib/algorithms/Preconditioner.h index e62c3ab7..a26016be 100644 --- a/lib/algorithms/Preconditioner.h +++ b/lib/algorithms/Preconditioner.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/Preconditioner.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_PRECONDITIONER_H #define GRID_PRECONDITIONER_H diff --git a/lib/algorithms/SparseMatrix.h b/lib/algorithms/SparseMatrix.h index eb807555..4fc1a3ad 100644 --- a/lib/algorithms/SparseMatrix.h +++ b/lib/algorithms/SparseMatrix.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/SparseMatrix.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_ALGORITHM_SPARSE_MATRIX_H #define GRID_ALGORITHM_SPARSE_MATRIX_H diff --git a/lib/algorithms/approx/Chebyshev.h b/lib/algorithms/approx/Chebyshev.h index 1952799e..d433e2f7 100644 --- a/lib/algorithms/approx/Chebyshev.h +++ b/lib/algorithms/approx/Chebyshev.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/approx/Chebyshev.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_CHEBYSHEV_H #define GRID_CHEBYSHEV_H @@ -30,13 +58,14 @@ namespace Grid { Field Mtmp(in._grid); AtoN = in; out = AtoN*Coeffs[0]; - // std::cout <<"Poly in " < + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { diff --git a/lib/algorithms/approx/MultiShiftFunction.h b/lib/algorithms/approx/MultiShiftFunction.h index 1bd6faae..56190573 100644 --- a/lib/algorithms/approx/MultiShiftFunction.h +++ b/lib/algorithms/approx/MultiShiftFunction.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/approx/MultiShiftFunction.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef MULTI_SHIFT_FUNCTION #define MULTI_SHIFT_FUNCTION diff --git a/lib/algorithms/approx/bigfloat_double.h b/lib/algorithms/approx/bigfloat_double.h index d928b4a2..4a7a02b8 100644 --- a/lib/algorithms/approx/bigfloat_double.h +++ b/lib/algorithms/approx/bigfloat_double.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/approx/bigfloat_double.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include typedef double mfloat; diff --git a/lib/algorithms/iterative/AdefGeneric.h b/lib/algorithms/iterative/AdefGeneric.h index 6b839d7a..2eff5871 100644 --- a/lib/algorithms/iterative/AdefGeneric.h +++ b/lib/algorithms/iterative/AdefGeneric.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/AdefGeneric.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_ALGORITHMS_ITERATIVE_GENERIC_PCG #define GRID_ALGORITHMS_ITERATIVE_GENERIC_PCG diff --git a/lib/algorithms/iterative/ConjugateGradient.h b/lib/algorithms/iterative/ConjugateGradient.h index 0a8d0d74..8624eac2 100644 --- a/lib/algorithms/iterative/ConjugateGradient.h +++ b/lib/algorithms/iterative/ConjugateGradient.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/ConjugateGradient.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_CONJUGATE_GRADIENT_H #define GRID_CONJUGATE_GRADIENT_H @@ -30,7 +59,8 @@ public: //Initial residual computation & set up RealD guess = norm2(psi); - + assert(std::isnan(guess)==0); + Linop.HermOpAndNorm(psi,mmp,d,b); r= src-mmp; @@ -55,14 +85,22 @@ public: } std::cout< +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_CONJUGATE_MULTI_SHIFT_GRADIENT_H #define GRID_CONJUGATE_MULTI_SHIFT_GRADIENT_H diff --git a/lib/algorithms/iterative/ConjugateResidual.h b/lib/algorithms/iterative/ConjugateResidual.h index 1c3c6a91..b6f99554 100644 --- a/lib/algorithms/iterative/ConjugateResidual.h +++ b/lib/algorithms/iterative/ConjugateResidual.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/ConjugateResidual.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_CONJUGATE_RESIDUAL_H #define GRID_CONJUGATE_RESIDUAL_H diff --git a/lib/algorithms/iterative/DenseMatrix.h b/lib/algorithms/iterative/DenseMatrix.h index e8d1f9ab..c34fc3bb 100644 --- a/lib/algorithms/iterative/DenseMatrix.h +++ b/lib/algorithms/iterative/DenseMatrix.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/DenseMatrix.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_DENSE_MATRIX_H #define GRID_DENSE_MATRIX_H diff --git a/lib/algorithms/iterative/EigenSort.h b/lib/algorithms/iterative/EigenSort.h index c036110b..034f70c2 100644 --- a/lib/algorithms/iterative/EigenSort.h +++ b/lib/algorithms/iterative/EigenSort.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/EigenSort.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_EIGENSORT_H #define GRID_EIGENSORT_H diff --git a/lib/algorithms/iterative/Francis.h b/lib/algorithms/iterative/Francis.h index 405193d2..08ecbd7b 100644 --- a/lib/algorithms/iterative/Francis.h +++ b/lib/algorithms/iterative/Francis.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/Francis.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef FRANCIS_H #define FRANCIS_H diff --git a/lib/algorithms/iterative/Householder.h b/lib/algorithms/iterative/Householder.h index 01cf3453..0c6b7d0b 100644 --- a/lib/algorithms/iterative/Householder.h +++ b/lib/algorithms/iterative/Householder.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/Householder.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef HOUSEHOLDER_H #define HOUSEHOLDER_H diff --git a/lib/algorithms/iterative/ImplicitlyRestartedLanczos.h b/lib/algorithms/iterative/ImplicitlyRestartedLanczos.h index a07f7f30..606e7a36 100644 --- a/lib/algorithms/iterative/ImplicitlyRestartedLanczos.h +++ b/lib/algorithms/iterative/ImplicitlyRestartedLanczos.h @@ -1,6 +1,36 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/ImplicitlyRestartedLanczos.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_IRL_H #define GRID_IRL_H +#include //memset +#include //memset #include #include @@ -21,6 +51,7 @@ public: int Niter; int converged; + int Nstop; // Number of evecs checked for convergence int Nk; // Number of converged sought int Np; // Np -- Number of spare vecs in kryloc space int Nm; // Nm -- total number of vectors @@ -29,6 +60,8 @@ public: SortEigen _sort; + GridCartesian &_fgrid; + LinearOperatorBase &_Linop; OperatorFunction &_poly; @@ -39,14 +72,17 @@ public: void init(void){}; void Abort(int ff, DenseVector &evals, DenseVector > &evecs); - ImplicitlyRestartedLanczos(LinearOperatorBase &Linop, // op + ImplicitlyRestartedLanczos(GridCartesian &fgrid, LinearOperatorBase &Linop, // op OperatorFunction & poly, // polynmial + int _Nstop, // sought vecs int _Nk, // sought vecs int _Nm, // spare vecs RealD _eresid, // resid in lmdue deficit int _Niter) : // Max iterations + _fgrid(fgrid), _Linop(Linop), _poly(poly), + Nstop(_Nstop), Nk(_Nk), Nm(_Nm), eresid(_eresid), @@ -114,10 +150,11 @@ public: RealD beta = normalise(w); // 6. βk+1 := ∥wk∥2. If βk+1 = 0 then Stop // 7. vk+1 := wk/βk+1 +// std::cout << "alpha = " << zalph << " beta "< &AH, vector &tevals, vector > &tevecs, double small) { + void diagonalize_lapack(DenseVector& lmd, + DenseVector& lme, + int Nm2, + int Nm, + DenseVector& Qt){ + const int size = Nm; +// tevals.resize(size); +// tevecs.resize(size); + int NN = Nm; + double evals_tmp[NN]; + double evec_tmp[NN][NN]; + memset(evec_tmp[0],0,sizeof(double)*NN*NN); + double AA[NN][NN]; + double DD[NN]; + double EE[NN]; + memset(AA, 0, sizeof(double)*NN*NN); + // memset(ZZ, 0, sizeof(double)*NN*NN); + for (int i = 0; i< NN; i++) + for (int j = i - 1; j <= i + 1; j++) + if ( j < NN && j >= 0 ) { +// AA[i][j] = AH(i,j); + if (i==j) DD[i] = lmd[i]; + if (i==j) evals_tmp[i] = lmd[i]; + if (j==(i-1)) EE[j] = lme[j]; + // if (i<20 && j<20) +// std:: cout << "AA["< (1+4*NN+NN*NN)? (18*NN):(1+4*NN+NN*NN)) ; + int liwork = 3+NN*10 ; + int iwork[liwork]; + double work[lwork]; + int isuppz[2*NN]; + char jobz = 'V'; // calculate evals & evecs + char range = 'I'; // calculate all evals + // char range = 'A'; // calculate all evals + char uplo = 'U'; // refer to upper half of original matrix + char compz = 'I'; // Compute eigenvectors of tridiagonal matrix + int ifail[NN]; + int info; +// int total = QMP_get_number_of_nodes(); +// int node = QMP_get_node_number(); + int total = _fgrid._Nprocessors; + int node = _fgrid._processor; + int interval = (NN/total)+1; + double vl = 0.0, vu = 0.0; + int il = interval*node+1 , iu = interval*(node+1); + if (iu > NN) iu=NN; + double tol = 0.0; + if (1) { + memset(evals_tmp,0,sizeof(double)*NN); + if ( il <= NN){ + printf("total=%d node=%d il=%d iu=%d\n",total,node,il,iu); + LAPACK_dstegr(&jobz, &range, &NN, + (double*)DD, (double*)EE, + &vl, &vu, &il, &iu, // these four are ignored if second parameteris 'A' + &tol, // tolerance + &evals_found, evals_tmp, (double*)evec_tmp, &NN, + isuppz, + work, &lwork, iwork, &liwork, + &info); + for (int i = iu-1; i>= il-1; i--){ + printf("node=%d evals_found=%d evals_tmp[%d] = %g\n",node,evals_found, i - (il-1),evals_tmp[i - (il-1)]); + evals_tmp[i] = evals_tmp[i - (il-1)]; + if (il>1) evals_tmp[i-(il-1)]=0.; + for (int j = 0; j< NN; j++){ + evec_tmp[i][j] = evec_tmp[i - (il-1)][j]; + if (il>1) evec_tmp[i-(il-1)][j]=0.; + } + } + } + { +// TIMER("QMP_sum_double_array"); +// QMP_sum_double_array(evals_tmp,NN); +// QMP_sum_double_array((double *)evec_tmp,NN*NN); + _fgrid.GlobalSumVector(evals_tmp,NN); + _fgrid.GlobalSumVector((double*)evec_tmp,NN*NN); + } + } + for(int i=0;i& lmd, DenseVector& lme, int Nm2, int Nm, DenseVector& Qt) { + +if(1) +{ + DenseVector lmd2(Nm); + DenseVector lme2(Nm); + for(int k=0; k=Nk ){ + if( Nconv>=Nstop ){ goto converged; } } // end of iter loop diff --git a/lib/algorithms/iterative/Matrix.h b/lib/algorithms/iterative/Matrix.h index a455e82e..afdda2d5 100644 --- a/lib/algorithms/iterative/Matrix.h +++ b/lib/algorithms/iterative/Matrix.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/Matrix.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef MATRIX_H #define MATRIX_H diff --git a/lib/algorithms/iterative/MatrixUtils.h b/lib/algorithms/iterative/MatrixUtils.h index 712c9217..39b5c043 100644 --- a/lib/algorithms/iterative/MatrixUtils.h +++ b/lib/algorithms/iterative/MatrixUtils.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/MatrixUtils.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATRIX_UTILS_H #define GRID_MATRIX_UTILS_H diff --git a/lib/algorithms/iterative/NormalEquations.h b/lib/algorithms/iterative/NormalEquations.h index 1d5e0504..55a84b4b 100644 --- a/lib/algorithms/iterative/NormalEquations.h +++ b/lib/algorithms/iterative/NormalEquations.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/NormalEquations.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_NORMAL_EQUATIONS_H #define GRID_NORMAL_EQUATIONS_H diff --git a/lib/algorithms/iterative/PrecConjugateResidual.h b/lib/algorithms/iterative/PrecConjugateResidual.h index 19f6e5f0..a149d093 100644 --- a/lib/algorithms/iterative/PrecConjugateResidual.h +++ b/lib/algorithms/iterative/PrecConjugateResidual.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/PrecConjugateResidual.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_PREC_CONJUGATE_RESIDUAL_H #define GRID_PREC_CONJUGATE_RESIDUAL_H diff --git a/lib/algorithms/iterative/PrecGeneralisedConjugateResidual.h b/lib/algorithms/iterative/PrecGeneralisedConjugateResidual.h index 3a9bb731..1f02b24b 100644 --- a/lib/algorithms/iterative/PrecGeneralisedConjugateResidual.h +++ b/lib/algorithms/iterative/PrecGeneralisedConjugateResidual.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/PrecGeneralisedConjugateResidual.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_PREC_GCR_H #define GRID_PREC_GCR_H diff --git a/lib/algorithms/iterative/SchurRedBlack.h b/lib/algorithms/iterative/SchurRedBlack.h index b023fb7b..214f466f 100644 --- a/lib/algorithms/iterative/SchurRedBlack.h +++ b/lib/algorithms/iterative/SchurRedBlack.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/algorithms/iterative/SchurRedBlack.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_SCHUR_RED_BLACK_H #define GRID_SCHUR_RED_BLACK_H diff --git a/lib/cartesian/Cartesian_base.h b/lib/cartesian/Cartesian_base.h index 3b9f6630..b541f1c1 100644 --- a/lib/cartesian/Cartesian_base.h +++ b/lib/cartesian/Cartesian_base.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/cartesian/Cartesian_base.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_CARTESIAN_BASE_H #define GRID_CARTESIAN_BASE_H diff --git a/lib/cartesian/Cartesian_full.h b/lib/cartesian/Cartesian_full.h index 2a9e0be8..1f8f7514 100644 --- a/lib/cartesian/Cartesian_full.h +++ b/lib/cartesian/Cartesian_full.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/cartesian/Cartesian_full.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_CARTESIAN_FULL_H #define GRID_CARTESIAN_FULL_H diff --git a/lib/cartesian/Cartesian_red_black.h b/lib/cartesian/Cartesian_red_black.h index 2d885d36..d7637f41 100644 --- a/lib/cartesian/Cartesian_red_black.h +++ b/lib/cartesian/Cartesian_red_black.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/cartesian/Cartesian_red_black.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_CARTESIAN_RED_BLACK_H #define GRID_CARTESIAN_RED_BLACK_H diff --git a/lib/communicator/Communicator_base.h b/lib/communicator/Communicator_base.h index 2ebee872..3e3eaf9c 100644 --- a/lib/communicator/Communicator_base.h +++ b/lib/communicator/Communicator_base.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/communicator/Communicator_base.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_COMMUNICATOR_BASE_H #define GRID_COMMUNICATOR_BASE_H diff --git a/lib/communicator/Communicator_mpi.cc b/lib/communicator/Communicator_mpi.cc index e691305a..2691fc98 100644 --- a/lib/communicator/Communicator_mpi.cc +++ b/lib/communicator/Communicator_mpi.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/communicator/Communicator_mpi.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include "Grid.h" #include diff --git a/lib/communicator/Communicator_none.cc b/lib/communicator/Communicator_none.cc index bf0e2dd6..43f3c444 100644 --- a/lib/communicator/Communicator_none.cc +++ b/lib/communicator/Communicator_none.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/communicator/Communicator_none.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include "Grid.h" namespace Grid { diff --git a/lib/cshift/Cshift_common.h b/lib/cshift/Cshift_common.h index 06f1b02b..8caf1a52 100644 --- a/lib/cshift/Cshift_common.h +++ b/lib/cshift/Cshift_common.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/cshift/Cshift_common.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef _GRID_CSHIFT_COMMON_H_ #define _GRID_CSHIFT_COMMON_H_ diff --git a/lib/cshift/Cshift_mpi.h b/lib/cshift/Cshift_mpi.h index 915b75ee..231a1be0 100644 --- a/lib/cshift/Cshift_mpi.h +++ b/lib/cshift/Cshift_mpi.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/cshift/Cshift_mpi.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef _GRID_CSHIFT_MPI_H_ #define _GRID_CSHIFT_MPI_H_ @@ -167,7 +195,7 @@ template void Cshift_comms_simd(Lattice &ret,const Lattice > recv_buf_extract(Nsimd,std::vector(buffer_size) ); int bytes = buffer_size*sizeof(scalar_object); - std::vector pointers(Nsimd); // + std::vector pointers(Nsimd); // std::vector rpointers(Nsimd); // received pointers /////////////////////////////////////////// diff --git a/lib/cshift/Cshift_none.h b/lib/cshift/Cshift_none.h index a8c6f6c0..cdc2563e 100644 --- a/lib/cshift/Cshift_none.h +++ b/lib/cshift/Cshift_none.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/cshift/Cshift_none.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef _GRID_CSHIFT_NONE_H_ #define _GRID_CSHIFT_NONE_H_ namespace Grid { diff --git a/lib/lattice/Lattice_ET.h b/lib/lattice/Lattice_ET.h index 36d3aa02..7644f9da 100644 --- a/lib/lattice/Lattice_ET.h +++ b/lib/lattice/Lattice_ET.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_ET.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_ET_H #define GRID_LATTICE_ET_H diff --git a/lib/lattice/Lattice_arith.h b/lib/lattice/Lattice_arith.h index dc5e57e8..6527c487 100644 --- a/lib/lattice/Lattice_arith.h +++ b/lib/lattice/Lattice_arith.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_arith.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_ARITH_H #define GRID_LATTICE_ARITH_H diff --git a/lib/lattice/Lattice_base.h b/lib/lattice/Lattice_base.h index 0faff6f4..8812a975 100644 --- a/lib/lattice/Lattice_base.h +++ b/lib/lattice/Lattice_base.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_base.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_BASE_H #define GRID_LATTICE_BASE_H @@ -73,7 +102,6 @@ public: typedef typename vobj::scalar_type scalar_type; typedef typename vobj::vector_type vector_type; typedef vobj vector_object; - //////////////////////////////////////////////////////////////////////////////// // Expression Template closure support @@ -213,8 +241,8 @@ PARALLEL_FOR_LOOP // what about a default grid? ////////////////////////////////////////////////////////////////// Lattice(GridBase *grid) : _grid(grid), _odata(_grid->oSites()) { - // _odata.reserve(_grid->oSites()); - // _odata.resize(_grid->oSites()); + // _odata.reserve(_grid->oSites()); + // _odata.resize(_grid->oSites()); // std::cout << "Constructing lattice object with Grid pointer "<<_grid< +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_COMPARISON_H #define GRID_LATTICE_COMPARISON_H diff --git a/lib/lattice/Lattice_comparison_utils.h b/lib/lattice/Lattice_comparison_utils.h index d25c49f2..14a19383 100644 --- a/lib/lattice/Lattice_comparison_utils.h +++ b/lib/lattice/Lattice_comparison_utils.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_comparison_utils.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_COMPARISON_H #define GRID_COMPARISON_H diff --git a/lib/lattice/Lattice_conformable.h b/lib/lattice/Lattice_conformable.h index a77e57af..398b3c90 100644 --- a/lib/lattice/Lattice_conformable.h +++ b/lib/lattice/Lattice_conformable.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_conformable.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_CONFORMABLE_H #define GRID_LATTICE_CONFORMABLE_H diff --git a/lib/lattice/Lattice_coordinate.h b/lib/lattice/Lattice_coordinate.h index a83dbe49..2e20ba17 100644 --- a/lib/lattice/Lattice_coordinate.h +++ b/lib/lattice/Lattice_coordinate.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_coordinate.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_COORDINATE_H #define GRID_LATTICE_COORDINATE_H diff --git a/lib/lattice/Lattice_local.h b/lib/lattice/Lattice_local.h index ad7a1ff5..65d1d929 100644 --- a/lib/lattice/Lattice_local.h +++ b/lib/lattice/Lattice_local.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_local.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_LOCALREDUCTION_H #define GRID_LATTICE_LOCALREDUCTION_H diff --git a/lib/lattice/Lattice_overload.h b/lib/lattice/Lattice_overload.h index 24bdd70a..2a5d16a1 100644 --- a/lib/lattice/Lattice_overload.h +++ b/lib/lattice/Lattice_overload.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_overload.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_OVERLOAD_H #define GRID_LATTICE_OVERLOAD_H diff --git a/lib/lattice/Lattice_peekpoke.h b/lib/lattice/Lattice_peekpoke.h index 8ac952ea..5edc223a 100644 --- a/lib/lattice/Lattice_peekpoke.h +++ b/lib/lattice/Lattice_peekpoke.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_peekpoke.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_PEEK_H #define GRID_LATTICE_PEEK_H diff --git a/lib/lattice/Lattice_reality.h b/lib/lattice/Lattice_reality.h index 29a7976a..10add8cd 100644 --- a/lib/lattice/Lattice_reality.h +++ b/lib/lattice/Lattice_reality.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_reality.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_REALITY_H #define GRID_LATTICE_REALITY_H diff --git a/lib/lattice/Lattice_reduction.h b/lib/lattice/Lattice_reduction.h index e6287b41..2c47eb70 100644 --- a/lib/lattice/Lattice_reduction.h +++ b/lib/lattice/Lattice_reduction.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_reduction.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_REDUCTION_H #define GRID_LATTICE_REDUCTION_H @@ -19,7 +48,6 @@ namespace Grid { { typedef typename vobj::scalar_type scalar_type; typedef typename vobj::vector_type vector_type; - vector_type vnrm; scalar_type nrm; GridBase *grid = left._grid; @@ -31,7 +59,6 @@ namespace Grid { PARALLEL_FOR_LOOP for(int thr=0;thrSumArraySize();thr++){ - int nwork, mywork, myoff; GridThread::GetWork(left._grid->oSites(),thr,mywork,myoff); diff --git a/lib/lattice/Lattice_rng.h b/lib/lattice/Lattice_rng.h index 895d49ad..42162b34 100644 --- a/lib/lattice/Lattice_rng.h +++ b/lib/lattice/Lattice_rng.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_rng.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_RNG_H #define GRID_LATTICE_RNG_H @@ -22,13 +50,16 @@ namespace Grid { assert(fine->_processors[d]==1); } - // local and global volumes subdivide cleanly after SIMDization int multiplicity=1; + for(int d=0;d_rdimensions[d]; + } + // local and global volumes subdivide cleanly after SIMDization for(int d=0;d_processors[d] == fine->_processors[fd]); assert(coarse->_simd_layout[d] == fine->_simd_layout[fd]); - assert((fine->_rdimensions[fd] / coarse->_rdimensions[d])* coarse->_rdimensions[d]==fine->_rdimensions[fd]); + assert(((fine->_rdimensions[fd] / coarse->_rdimensions[d])* coarse->_rdimensions[d])==fine->_rdimensions[fd]); multiplicity = multiplicity *fine->_rdimensions[fd] / coarse->_rdimensions[d]; } @@ -76,16 +107,40 @@ namespace Grid { public: - GridRNGbase() : _uniform{0,1}, _gaussian(0.0,1.0) {}; - int _seeded; // One generator per site. // Uniform and Gaussian distributions from these generators. - std::vector _generators; - std::uniform_real_distribution _uniform; - std::normal_distribution _gaussian; - +#ifdef RNG_RANLUX + typedef uint64_t RngStateType; + typedef std::ranlux48 RngEngine; + static const int RngStateCount = 15; +#else + typedef std::mt19937 RngEngine; + typedef uint32_t RngStateType; + static const int RngStateCount = std::mt19937::state_size; +#endif + std::vector _generators; + std::vector > _uniform; + std::vector > _gaussian; + void GetState(std::vector & saved,int gen) { + saved.resize(RngStateCount); + std::stringstream ss; + ss<<_generators[gen]; + ss.seekg(0,ss.beg); + for(int i=0;i>saved[i]; + } + } + void SetState(std::vector & saved,int gen){ + assert(saved.size()==RngStateCount); + std::stringstream ss; + for(int i=0;i>_generators[gen]; + } }; class GridSerialRNG : public GridRNGbase { @@ -98,18 +153,20 @@ namespace Grid { { typename source::result_type init = src(); CartesianCommunicator::BroadcastWorld(0,(void *)&init,sizeof(init)); - _generators[0] = std::ranlux48(init); + _generators[0] = RngEngine(init); _seeded=1; } GridSerialRNG() : GridRNGbase() { _generators.resize(1); + _uniform.resize(1,std::uniform_real_distribution{0,1}); + _gaussian.resize(1,std::normal_distribution(0.0,1.0) ); _seeded=0; } - template inline void fill(sobj &l,distribution &dist){ + template inline void fill(sobj &l,std::vector &dist){ typedef typename sobj::scalar_type scalar_type; @@ -117,56 +174,65 @@ namespace Grid { scalar_type *buf = (scalar_type *) & l; + dist[0].reset(); for(int idx=0;idx inline void fill(ComplexF &l,distribution &dist){ - fillScalar(l,dist,_generators[0]); + template inline void fill(ComplexF &l,std::vector &dist){ + dist[0].reset(); + fillScalar(l,dist[0],_generators[0]); CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l)); } - template inline void fill(ComplexD &l,distribution &dist){ - fillScalar(l,dist,_generators[0]); + template inline void fill(ComplexD &l,std::vector &dist){ + dist[0].reset(); + fillScalar(l,dist[0],_generators[0]); CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l)); } - template inline void fill(RealF &l,distribution &dist){ - fillScalar(l,dist,_generators[0]); + template inline void fill(RealF &l,std::vector &dist){ + dist[0].reset(); + fillScalar(l,dist[0],_generators[0]); CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l)); } - template inline void fill(RealD &l,distribution &dist){ - fillScalar(l,dist,_generators[0]); + template inline void fill(RealD &l,std::vector &dist){ + dist[0].reset(); + fillScalar(l,dist[0],_generators[0]); CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l)); } // vector fill - template inline void fill(vComplexF &l,distribution &dist){ + template inline void fill(vComplexF &l,std::vector &dist){ RealF *pointer=(RealF *)&l; + dist[0].reset(); for(int i=0;i<2*vComplexF::Nsimd();i++){ - fillScalar(pointer[i],dist,_generators[0]); + fillScalar(pointer[i],dist[0],_generators[0]); } CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l)); } - template inline void fill(vComplexD &l,distribution &dist){ + template inline void fill(vComplexD &l,std::vector &dist){ RealD *pointer=(RealD *)&l; + dist[0].reset(); for(int i=0;i<2*vComplexD::Nsimd();i++){ - fillScalar(pointer[i],dist,_generators[0]); + fillScalar(pointer[i],dist[0],_generators[0]); } CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l)); } - template inline void fill(vRealF &l,distribution &dist){ + template inline void fill(vRealF &l,std::vector &dist){ RealF *pointer=(RealF *)&l; + dist[0].reset(); for(int i=0;i inline void fill(vRealD &l,distribution &dist){ + template inline void fill(vRealD &l,std::vector &dist){ RealD *pointer=(RealD *)&l; + dist[0].reset(); for(int i=0;i _generators; - - // Uniform and Gaussian distributions from these generators. - std::uniform_real_distribution _uniform; - std::normal_distribution _gaussian; GridBase *_grid; int _vol; @@ -202,7 +262,10 @@ namespace Grid { GridParallelRNG(GridBase *grid) : GridRNGbase() { _grid=grid; _vol =_grid->iSites()*_grid->oSites(); + _generators.resize(_vol); + _uniform.resize(_vol,std::uniform_real_distribution{0,1}); + _gaussian.resize(_vol,std::normal_distribution(0.0,1.0) ); _seeded=0; } @@ -220,7 +283,7 @@ namespace Grid { int gsites = _grid->_gsites; typename source::result_type init = src(); - std::ranlux48 pseeder(init); + RngEngine pseeder(init); std::uniform_int_distribution ui; for(int gidx=0;gidxThisRank() ){ fixedSeed ssrc(site_seeds); typename source::result_type sinit = ssrc(); - _generators[l_idx] = std::ranlux48(sinit); + _generators[l_idx] = RngEngine(sinit); } } _seeded=1; @@ -251,7 +314,7 @@ namespace Grid { //void SaveState(const std::string &file); //void LoadState(const std::string &file); - template inline void fill(Lattice &l,distribution &dist){ + template inline void fill(Lattice &l,std::vector &dist){ typedef typename vobj::scalar_object scalar_object; typedef typename vobj::scalar_type scalar_type; @@ -275,8 +338,9 @@ PARALLEL_FOR_LOOP for(int si=0;si + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_TRACE_H #define GRID_LATTICE_TRACE_H diff --git a/lib/lattice/Lattice_transfer.h b/lib/lattice/Lattice_transfer.h index 8029747e..f4094753 100644 --- a/lib/lattice/Lattice_transfer.h +++ b/lib/lattice/Lattice_transfer.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_transfer.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_TRANSFER_H #define GRID_LATTICE_TRANSFER_H diff --git a/lib/lattice/Lattice_transpose.h b/lib/lattice/Lattice_transpose.h index a23ce48c..c8d349a6 100644 --- a/lib/lattice/Lattice_transpose.h +++ b/lib/lattice/Lattice_transpose.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_transpose.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_TRANSPOSE_H #define GRID_LATTICE_TRANSPOSE_H diff --git a/lib/lattice/Lattice_unary.h b/lib/lattice/Lattice_unary.h index c5698751..f3c54896 100644 --- a/lib/lattice/Lattice_unary.h +++ b/lib/lattice/Lattice_unary.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_unary.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_UNARY_H #define GRID_LATTICE_UNARY_H diff --git a/lib/lattice/Lattice_where.h b/lib/lattice/Lattice_where.h index 72bc936e..cff372a0 100644 --- a/lib/lattice/Lattice_where.h +++ b/lib/lattice/Lattice_where.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_where.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LATTICE_WHERE_H #define GRID_LATTICE_WHERE_H namespace Grid { diff --git a/lib/parallelIO/BinaryIO.h b/lib/parallelIO/BinaryIO.h index 853544e1..32b1874f 100644 --- a/lib/parallelIO/BinaryIO.h +++ b/lib/parallelIO/BinaryIO.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/parallelIO/BinaryIO.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_BINARY_IO_H #define GRID_BINARY_IO_H @@ -107,7 +135,7 @@ class BinaryIO { } } - template static inline void Uint32Checksum(Lattice lat,munger munge,uint32_t &csum) + template static inline void Uint32Checksum(Lattice &lat,munger munge,uint32_t &csum) { typedef typename vobj::scalar_object sobj; GridBase *grid = lat._grid ; @@ -232,6 +260,110 @@ class BinaryIO { return csum; } + static inline uint32_t writeRNGSerial(GridSerialRNG &serial,GridParallelRNG ¶llel,std::string file,int offset) + { + typedef typename GridSerialRNG::RngStateType RngStateType; + const int RngStateCount = GridSerialRNG::RngStateCount; + + GridBase *grid = parallel._grid; + int gsites = grid->_gsites; + + ////////////////////////////////////////////////// + // Serialise through node zero + ////////////////////////////////////////////////// + std::cout<< GridLogMessage<< "Serial RNG write I/O "<< file<IsBoss() ) { + fout.open(file,std::ios::binary|std::ios::out|std::ios::in); + fout.seekp(offset); + } + + uint32_t csum=0; + std::vector saved(RngStateCount); + int bytes = sizeof(RngStateType)*saved.size(); + std::vector gcoor; + + for(int gidx=0;gidxGlobalIndexToGlobalCoor(gidx,gcoor); + grid->GlobalCoorToRankIndex(rank,o_idx,i_idx,gcoor); + int l_idx=parallel.generator_idx(o_idx,i_idx); + + if( rank == grid->ThisRank() ){ + // std::cout << "rank" << rank<<" Getting state for index "<Broadcast(rank,(void *)&saved[0],bytes); + + if ( grid->IsBoss() ) { + Uint32Checksum((uint32_t *)&saved[0],bytes,csum); + fout.write((char *)&saved[0],bytes); + } + + } + + if ( grid->IsBoss() ) { + serial.GetState(saved,0); + Uint32Checksum((uint32_t *)&saved[0],bytes,csum); + fout.write((char *)&saved[0],bytes); + } + + return csum; + } + static inline uint32_t readRNGSerial(GridSerialRNG &serial,GridParallelRNG ¶llel,std::string file,int offset) + { + typedef typename GridSerialRNG::RngStateType RngStateType; + const int RngStateCount = GridSerialRNG::RngStateCount; + + GridBase *grid = parallel._grid; + int gsites = grid->_gsites; + + ////////////////////////////////////////////////// + // Serialise through node zero + ////////////////////////////////////////////////// + std::cout<< GridLogMessage<< "Serial RNG read I/O "<< file< saved(RngStateCount); + int bytes = sizeof(RngStateType)*saved.size(); + std::vector gcoor; + + for(int gidx=0;gidxGlobalIndexToGlobalCoor(gidx,gcoor); + grid->GlobalCoorToRankIndex(rank,o_idx,i_idx,gcoor); + int l_idx=parallel.generator_idx(o_idx,i_idx); + + if ( grid->IsBoss() ) { + fin.read((char *)&saved[0],bytes); + Uint32Checksum((uint32_t *)&saved[0],bytes,csum); + } + + grid->Broadcast(0,(void *)&saved[0],bytes); + + if( rank == grid->ThisRank() ){ + parallel.SetState(saved,l_idx); + } + + } + + if ( grid->IsBoss() ) { + fin.read((char *)&saved[0],bytes); + serial.SetState(saved,0); + Uint32Checksum((uint32_t *)&saved[0],bytes,csum); + } + + return csum; + } + + template static inline uint32_t readObjectParallel(Lattice &Umu,std::string file,munger munge,int offset,const std::string &format) { @@ -284,6 +416,7 @@ class BinaryIO { { uint32_t tmp = IOnode; grid->GlobalSum(tmp); + std::cout<< std::dec ; std::cout<< GridLogMessage<< "Parallel read I/O to "<< file << " with " <_ndimension;d++){ std::cout<< range[d]; diff --git a/lib/parallelIO/NerscIO.h b/lib/parallelIO/NerscIO.h index a442f20b..efe23e18 100644 --- a/lib/parallelIO/NerscIO.h +++ b/lib/parallelIO/NerscIO.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/parallelIO/NerscIO.h + + Copyright (C) 2015 + +Author: Matt Spraggs +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_NERSC_IO_H #define GRID_NERSC_IO_H @@ -51,7 +80,6 @@ class NerscField { std::string floating_point; }; - ////////////////////////////////////////////////////////////////////// // Bit and Physical Checksumming and QA of data ////////////////////////////////////////////////////////////////////// @@ -69,8 +97,9 @@ inline void NerscGrid(GridBase *grid,NerscField &header) template inline void NerscStatistics(GaugeField & data,NerscField &header) { - header.link_trace=Grid::QCD::WilsonLoops::linkTrace(data); - header.plaquette =Grid::QCD::WilsonLoops::avgPlaquette(data); + // How to convert data precision etc... + header.link_trace=Grid::QCD::WilsonLoops::linkTrace(data); + header.plaquette =Grid::QCD::WilsonLoops::avgPlaquette(data); } inline void NerscMachineCharacteristics(NerscField &header) @@ -181,9 +210,12 @@ inline void NerscMachineCharacteristics(NerscField &header) class NerscIO : public BinaryIO { public: + static inline void truncate(std::string file){ + std::ofstream fout(file,std::ios::out); + } static inline unsigned int writeHeader(NerscField &field,std::string file) { - std::ofstream fout(file,std::ios::out); + std::ofstream fout(file,std::ios::out|std::ios::in); fout.seekp(0,std::ios::beg); fout << "BEGIN_HEADER" << std::endl; @@ -201,8 +233,7 @@ class NerscIO : public BinaryIO { fout << "BOUNDARY_"< > &Umu std::cout << GridLogMessage << " TESTING PARALLEL WRITE offsets " << offset1 << " "<< offset << std::endl; - std::cout << GridLogMessage < > &Umu std::cout< + uint32_t csum=BinaryIO::readRNGSerial(serial,parallel,file,offset); + + assert(csum == header.checksum ); + + std::cout< +Author: Peter Boyle +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_H #define GRID_QCD_H namespace Grid{ @@ -425,7 +456,6 @@ namespace QCD { #include #include #include -#include #include #include #include diff --git a/lib/qcd/action/ActionBase.h b/lib/qcd/action/ActionBase.h index d0140101..8b91fb79 100644 --- a/lib/qcd/action/ActionBase.h +++ b/lib/qcd/action/ActionBase.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/ActionBase.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_ACTION_BASE #define QCD_ACTION_BASE namespace Grid { diff --git a/lib/qcd/action/ActionParams.h b/lib/qcd/action/ActionParams.h index 55481bc2..dcbdfce8 100644 --- a/lib/qcd/action/ActionParams.h +++ b/lib/qcd/action/ActionParams.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/ActionParams.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_ACTION_PARAMS_H #define GRID_QCD_ACTION_PARAMS_H @@ -6,10 +34,16 @@ namespace QCD { // These can move into a params header and be given MacroMagic serialisation struct GparityWilsonImplParams { + bool overlapCommsCompute; std::vector twists; + GparityWilsonImplParams () : twists(Nd,0), overlapCommsCompute(false) {}; + }; - struct WilsonImplParams { }; + struct WilsonImplParams { + bool overlapCommsCompute; + WilsonImplParams() : overlapCommsCompute(false) {}; + }; struct OneFlavourRationalParams { RealD lo; diff --git a/lib/qcd/action/Actions.h b/lib/qcd/action/Actions.h index 9cd72653..8d6f5d7a 100644 --- a/lib/qcd/action/Actions.h +++ b/lib/qcd/action/Actions.h @@ -1,11 +1,38 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/Actions.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: Peter Boyle +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_ACTIONS_H #define GRID_QCD_ACTIONS_H - -// Some reorganisation likely required as both Chroma and IroIro -// are separating the concept of the operator from that of action. -// -// The FermAction contains methods to create // * Linear operators (Hermitian and non-hermitian) .. my LinearOperator // * System solvers (Hermitian and non-hermitian) .. my OperatorFunction // * MultiShift System solvers (Hermitian and non-hermitian) .. my OperatorFunction @@ -19,6 +46,9 @@ //////////////////////////////////////////// // Utility functions //////////////////////////////////////////// +#include +#include + #include //used by all wilson type fermions #include #include @@ -28,11 +58,38 @@ // Gauge Actions //////////////////////////////////////////// #include +#include + namespace Grid { namespace QCD { -typedef WilsonGaugeAction WilsonGaugeActionR; -typedef WilsonGaugeAction WilsonGaugeActionF; -typedef WilsonGaugeAction WilsonGaugeActionD; + +typedef WilsonGaugeAction WilsonGaugeActionR; +typedef WilsonGaugeAction WilsonGaugeActionF; +typedef WilsonGaugeAction WilsonGaugeActionD; +typedef PlaqPlusRectangleAction PlaqPlusRectangleActionR; +typedef PlaqPlusRectangleAction PlaqPlusRectangleActionF; +typedef PlaqPlusRectangleAction PlaqPlusRectangleActionD; +typedef IwasakiGaugeAction IwasakiGaugeActionR; +typedef IwasakiGaugeAction IwasakiGaugeActionF; +typedef IwasakiGaugeAction IwasakiGaugeActionD; +typedef SymanzikGaugeAction SymanzikGaugeActionR; +typedef SymanzikGaugeAction SymanzikGaugeActionF; +typedef SymanzikGaugeAction SymanzikGaugeActionD; + + +typedef WilsonGaugeAction ConjugateWilsonGaugeActionR; +typedef WilsonGaugeAction ConjugateWilsonGaugeActionF; +typedef WilsonGaugeAction ConjugateWilsonGaugeActionD; +typedef PlaqPlusRectangleAction ConjugatePlaqPlusRectangleActionR; +typedef PlaqPlusRectangleAction ConjugatePlaqPlusRectangleActionF; +typedef PlaqPlusRectangleAction ConjugatePlaqPlusRectangleActionD; +typedef IwasakiGaugeAction ConjugateIwasakiGaugeActionR; +typedef IwasakiGaugeAction ConjugateIwasakiGaugeActionF; +typedef IwasakiGaugeAction ConjugateIwasakiGaugeActionD; +typedef SymanzikGaugeAction ConjugateSymanzikGaugeActionR; +typedef SymanzikGaugeAction ConjugateSymanzikGaugeActionF; +typedef SymanzikGaugeAction ConjugateSymanzikGaugeActionD; + }} //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -63,6 +120,7 @@ typedef WilsonGaugeAction WilsonGaugeActionD; //////////////////////////////////////////// #include // 4d wilson like +#include // 4d wilson like #include // 5d base used by all 5d overlap types //#include @@ -99,6 +157,10 @@ typedef WilsonFermion WilsonFermionR; typedef WilsonFermion WilsonFermionF; typedef WilsonFermion WilsonFermionD; +typedef WilsonTMFermion WilsonTMFermionR; +typedef WilsonTMFermion WilsonTMFermionF; +typedef WilsonTMFermion WilsonTMFermionD; + typedef DomainWallFermion DomainWallFermionR; typedef DomainWallFermion DomainWallFermionF; typedef DomainWallFermion DomainWallFermionD; @@ -167,11 +229,6 @@ typedef MobiusFermion GparityMobiusFermionD; #include #include -//IroIro inserted general "Nf" param; could also be done, -//but not clear why unless into large Nf BSM studies -//Even there, don't want the explicit (2) on power denominator -//if even number of flavours, so further generalised interface -//would be required but easy. #include #include #include diff --git a/lib/qcd/action/fermion/CayleyFermion5D.cc b/lib/qcd/action/fermion/CayleyFermion5D.cc index 1db6429e..0ebcfb82 100644 --- a/lib/qcd/action/fermion/CayleyFermion5D.cc +++ b/lib/qcd/action/fermion/CayleyFermion5D.cc @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/CayleyFermion5D.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { namespace QCD { diff --git a/lib/qcd/action/fermion/CayleyFermion5D.h b/lib/qcd/action/fermion/CayleyFermion5D.h index c7eb6e80..3847f64f 100644 --- a/lib/qcd/action/fermion/CayleyFermion5D.h +++ b/lib/qcd/action/fermion/CayleyFermion5D.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/CayleyFermion5D.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_CAYLEY_FERMION_H #define GRID_QCD_CAYLEY_FERMION_H diff --git a/lib/qcd/action/fermion/ContinuedFractionFermion5D.cc b/lib/qcd/action/fermion/ContinuedFractionFermion5D.cc index f562ff54..e58ab4da 100644 --- a/lib/qcd/action/fermion/ContinuedFractionFermion5D.cc +++ b/lib/qcd/action/fermion/ContinuedFractionFermion5D.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/ContinuedFractionFermion5D.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { diff --git a/lib/qcd/action/fermion/ContinuedFractionFermion5D.h b/lib/qcd/action/fermion/ContinuedFractionFermion5D.h index b3f25ac5..15d44945 100644 --- a/lib/qcd/action/fermion/ContinuedFractionFermion5D.h +++ b/lib/qcd/action/fermion/ContinuedFractionFermion5D.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/ContinuedFractionFermion5D.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_CONTINUED_FRACTION_H #define GRID_QCD_CONTINUED_FRACTION_H diff --git a/lib/qcd/action/fermion/DomainWallFermion.h b/lib/qcd/action/fermion/DomainWallFermion.h index 164101b0..b05733aa 100644 --- a/lib/qcd/action/fermion/DomainWallFermion.h +++ b/lib/qcd/action/fermion/DomainWallFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/DomainWallFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_DOMAIN_WALL_FERMION_H #define GRID_QCD_DOMAIN_WALL_FERMION_H diff --git a/lib/qcd/action/fermion/FermionOperator.h b/lib/qcd/action/fermion/FermionOperator.h index 7cdfc0d1..ea5583eb 100644 --- a/lib/qcd/action/fermion/FermionOperator.h +++ b/lib/qcd/action/fermion/FermionOperator.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/FermionOperator.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_FERMION_OPERATOR_H #define GRID_QCD_FERMION_OPERATOR_H diff --git a/lib/qcd/action/fermion/FermionOperatorImpl.h b/lib/qcd/action/fermion/FermionOperatorImpl.h index 21187870..05994a39 100644 --- a/lib/qcd/action/fermion/FermionOperatorImpl.h +++ b/lib/qcd/action/fermion/FermionOperatorImpl.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/FermionOperatorImpl.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_FERMION_OPERATOR_IMPL_H #define GRID_QCD_FERMION_OPERATOR_IMPL_H @@ -58,38 +88,6 @@ namespace Grid { // } ////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////// - // Implementation dependent gauge types - //////////////////////////////////////////////////////////////////////// - -#define INHERIT_IMPL_TYPES(Base) \ - INHERIT_GIMPL_TYPES(Base)\ - INHERIT_FIMPL_TYPES(Base) - -#define INHERIT_GIMPL_TYPES(GImpl) \ - typedef typename GImpl::Simd Simd;\ - typedef typename GImpl::GaugeLinkField GaugeLinkField;\ - typedef typename GImpl::GaugeField GaugeField; - - // Composition with smeared link, bc's etc.. probably need multiple inheritance - // Variable precision "S" and variable Nc - template - class ImplGauge { - public: - - typedef S Simd; - - template using iImplGaugeLink = iScalar > >; - template using iImplGaugeField = iVector >, Nd >; - - typedef iImplGaugeLink SiteGaugeLink; - typedef iImplGaugeField SiteGaugeField; - - typedef Lattice GaugeLinkField; // bit ugly naming; polarised gauge field, lorentz... all ugly - typedef Lattice GaugeField; - - }; //////////////////////////////////////////////////////////////////////// // Implementation dependent fermion types @@ -104,14 +102,18 @@ namespace Grid { typedef typename Impl::StencilImpl StencilImpl; \ typedef typename Impl::ImplParams ImplParams; +#define INHERIT_IMPL_TYPES(Base) \ + INHERIT_GIMPL_TYPES(Base)\ + INHERIT_FIMPL_TYPES(Base) + /////// // Single flavour four spinors with colour index /////// template - class WilsonImpl : public ImplGauge { + class WilsonImpl : public PeriodicGaugeImpl< GaugeImplTypes< S,Nrepresentation> > { public: - typedef ImplGauge Gimpl; + typedef PeriodicGaugeImpl< GaugeImplTypes< S,Nrepresentation> > Gimpl; INHERIT_GIMPL_TYPES(Gimpl); @@ -129,9 +131,13 @@ namespace Grid { typedef WilsonCompressor Compressor; typedef WilsonImplParams ImplParams; typedef CartesianStencil StencilImpl; + ImplParams Params; + WilsonImpl(const ImplParams &p= ImplParams()) : Params(p) {}; + bool overlapCommsCompute(void) { return Params.overlapCommsCompute; }; + inline void multLink(SiteHalfSpinor &phi,const SiteDoubledGaugeField &U,const SiteHalfSpinor &chi,int mu,StencilEntry *SE,StencilImpl &St){ mult(&phi(),&U(mu),&chi()); } @@ -180,10 +186,10 @@ PARALLEL_FOR_LOOP //////////////////////////////////////////////////////////////////////////////////////// template - class GparityWilsonImpl : public ImplGauge { + class GparityWilsonImpl : public ConjugateGaugeImpl< GaugeImplTypes >{ public: - typedef ImplGauge Gimpl; + typedef ConjugateGaugeImpl< GaugeImplTypes > Gimpl; INHERIT_GIMPL_TYPES(Gimpl); @@ -202,9 +208,12 @@ PARALLEL_FOR_LOOP typedef CartesianStencil StencilImpl; typedef GparityWilsonImplParams ImplParams; + ImplParams Params; + GparityWilsonImpl(const ImplParams &p= ImplParams()) : Params(p) {}; + bool overlapCommsCompute(void) { return Params.overlapCommsCompute; }; // provide the multiply by link that is differentiated between Gparity (with flavour index) and non-Gparity inline void multLink(SiteHalfSpinor &phi,const SiteDoubledGaugeField &U,const SiteHalfSpinor &chi,int mu,StencilEntry *SE,StencilImpl &St){ diff --git a/lib/qcd/action/fermion/MobiusFermion.h b/lib/qcd/action/fermion/MobiusFermion.h index b8147ce5..f08b5a74 100644 --- a/lib/qcd/action/fermion/MobiusFermion.h +++ b/lib/qcd/action/fermion/MobiusFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/MobiusFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_MOBIUS_FERMION_H #define GRID_QCD_MOBIUS_FERMION_H diff --git a/lib/qcd/action/fermion/MobiusZolotarevFermion.h b/lib/qcd/action/fermion/MobiusZolotarevFermion.h index 54428f56..cdf575f8 100644 --- a/lib/qcd/action/fermion/MobiusZolotarevFermion.h +++ b/lib/qcd/action/fermion/MobiusZolotarevFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/MobiusZolotarevFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_MOBIUS_ZOLOTAREV_FERMION_H #define GRID_QCD_MOBIUS_ZOLOTAREV_FERMION_H diff --git a/lib/qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h b/lib/qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h index 093475f3..8826df64 100644 --- a/lib/qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h +++ b/lib/qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef OVERLAP_WILSON_CAYLEY_TANH_FERMION_H #define OVERLAP_WILSON_CAYLEY_TANH_FERMION_H diff --git a/lib/qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h b/lib/qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h index 909dca02..08508e8f 100644 --- a/lib/qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h +++ b/lib/qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef OVERLAP_WILSON_CAYLEY_ZOLOTAREV_FERMION_H #define OVERLAP_WILSON_CAYLEY_ZOLOTAREV_FERMION_H diff --git a/lib/qcd/action/fermion/OverlapWilsonContfracTanhFermion.h b/lib/qcd/action/fermion/OverlapWilsonContfracTanhFermion.h index 652f193e..a17cbe7a 100644 --- a/lib/qcd/action/fermion/OverlapWilsonContfracTanhFermion.h +++ b/lib/qcd/action/fermion/OverlapWilsonContfracTanhFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/OverlapWilsonContfracTanhFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef OVERLAP_WILSON_CONTFRAC_TANH_FERMION_H #define OVERLAP_WILSON_CONTFRAC_TANH_FERMION_H diff --git a/lib/qcd/action/fermion/OverlapWilsonContfracZolotarevFermion.h b/lib/qcd/action/fermion/OverlapWilsonContfracZolotarevFermion.h index b1968cfe..7102adb0 100644 --- a/lib/qcd/action/fermion/OverlapWilsonContfracZolotarevFermion.h +++ b/lib/qcd/action/fermion/OverlapWilsonContfracZolotarevFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/OverlapWilsonContfracZolotarevFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef OVERLAP_WILSON_CONTFRAC_ZOLOTAREV_FERMION_H #define OVERLAP_WILSON_CONTFRAC_ZOLOTAREV_FERMION_H diff --git a/lib/qcd/action/fermion/OverlapWilsonPartialFractionTanhFermion.h b/lib/qcd/action/fermion/OverlapWilsonPartialFractionTanhFermion.h index b5d89b7a..b63676c5 100644 --- a/lib/qcd/action/fermion/OverlapWilsonPartialFractionTanhFermion.h +++ b/lib/qcd/action/fermion/OverlapWilsonPartialFractionTanhFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/OverlapWilsonPartialFractionTanhFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef OVERLAP_WILSON_PARTFRAC_TANH_FERMION_H #define OVERLAP_WILSON_PARTFRAC_TANH_FERMION_H diff --git a/lib/qcd/action/fermion/OverlapWilsonPartialFractionZolotarevFermion.h b/lib/qcd/action/fermion/OverlapWilsonPartialFractionZolotarevFermion.h index e6c9ef3b..341c193f 100644 --- a/lib/qcd/action/fermion/OverlapWilsonPartialFractionZolotarevFermion.h +++ b/lib/qcd/action/fermion/OverlapWilsonPartialFractionZolotarevFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/OverlapWilsonPartialFractionZolotarevFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef OVERLAP_WILSON_PARTFRAC_ZOLOTAREV_FERMION_H #define OVERLAP_WILSON_PARTFRAC_ZOLOTAREV_FERMION_H diff --git a/lib/qcd/action/fermion/PartialFractionFermion5D.cc b/lib/qcd/action/fermion/PartialFractionFermion5D.cc index a008dc78..4fcb8784 100644 --- a/lib/qcd/action/fermion/PartialFractionFermion5D.cc +++ b/lib/qcd/action/fermion/PartialFractionFermion5D.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/PartialFractionFermion5D.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { namespace QCD { diff --git a/lib/qcd/action/fermion/PartialFractionFermion5D.h b/lib/qcd/action/fermion/PartialFractionFermion5D.h index e1f0c7cd..126f3299 100644 --- a/lib/qcd/action/fermion/PartialFractionFermion5D.h +++ b/lib/qcd/action/fermion/PartialFractionFermion5D.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/PartialFractionFermion5D.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_PARTIAL_FRACTION_H #define GRID_QCD_PARTIAL_FRACTION_H diff --git a/lib/qcd/action/fermion/ScaledShamirFermion.h b/lib/qcd/action/fermion/ScaledShamirFermion.h index 2ac90a03..53acb694 100644 --- a/lib/qcd/action/fermion/ScaledShamirFermion.h +++ b/lib/qcd/action/fermion/ScaledShamirFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/ScaledShamirFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_SCALED_SHAMIR_FERMION_H #define GRID_QCD_SCALED_SHAMIR_FERMION_H diff --git a/lib/qcd/action/fermion/ShamirZolotarevFermion.h b/lib/qcd/action/fermion/ShamirZolotarevFermion.h index 64608d46..f15d83a8 100644 --- a/lib/qcd/action/fermion/ShamirZolotarevFermion.h +++ b/lib/qcd/action/fermion/ShamirZolotarevFermion.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/ShamirZolotarevFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_SHAMIR_ZOLOTAREV_FERMION_H #define GRID_QCD_SHAMIR_ZOLOTAREV_FERMION_H diff --git a/lib/qcd/action/fermion/WilsonCompressor.h b/lib/qcd/action/fermion/WilsonCompressor.h index 6c6d560b..c97f7d98 100644 --- a/lib/qcd/action/fermion/WilsonCompressor.h +++ b/lib/qcd/action/fermion/WilsonCompressor.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonCompressor.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_WILSON_COMPRESSOR_H #define GRID_QCD_WILSON_COMPRESSOR_H @@ -27,7 +56,7 @@ namespace QCD { { SiteHalfSpinor ret; int mudag=mu; - if (dag) { + if (!dag) { mudag=(mu+Nd)%(2*Nd); } switch(mudag) { diff --git a/lib/qcd/action/fermion/WilsonFermion.cc b/lib/qcd/action/fermion/WilsonFermion.cc index 61d13253..3c16b921 100644 --- a/lib/qcd/action/fermion/WilsonFermion.cc +++ b/lib/qcd/action/fermion/WilsonFermion.cc @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonFermion.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { @@ -253,10 +283,19 @@ PARALLEL_FOR_LOOP }; - template void WilsonFermion::DhopInternal(StencilImpl & st,DoubledGaugeField & U, - const FermionField &in, FermionField &out,int dag) { + const FermionField &in, FermionField &out,int dag) + { + if ( Impl::overlapCommsCompute () ) { + DhopInternalCommsOverlapCompute(st,U,in,out,dag); + } else { + DhopInternalCommsThenCompute(st,U,in,out,dag); + } + } + template + void WilsonFermion::DhopInternalCommsThenCompute(StencilImpl & st,DoubledGaugeField & U, + const FermionField &in, FermionField &out,int dag) { assert((dag==DaggerNo) ||(dag==DaggerYes)); @@ -289,10 +328,83 @@ PARALLEL_FOR_LOOP } } }; + + + template + void WilsonFermion::DhopInternalCommsOverlapCompute(StencilImpl & st,DoubledGaugeField & U, + const FermionField &in, FermionField &out,int dag) { + + assert((dag==DaggerNo) ||(dag==DaggerYes)); + + Compressor compressor(dag); + + std::thread comms_thread = st.HaloExchangeBegin(in,comm_buf,compressor); + comms_thread.join(); + + bool local = true; + bool nonlocal = false; + if ( dag == DaggerYes ) { + if( HandOptDslash ) { +PARALLEL_FOR_LOOP + for(int sss=0;sssoSites();sss++){ + Kernels::DiracOptHandDhopSiteDag(st,U,comm_buf,sss,sss,in,out,local,nonlocal); + } + } else { +PARALLEL_FOR_LOOP + for(int sss=0;sssoSites();sss++){ + Kernels::DiracOptDhopSiteDag(st,U,comm_buf,sss,sss,in,out,local,nonlocal); + } + } + } else { + if( HandOptDslash ) { +PARALLEL_FOR_LOOP + for(int sss=0;sssoSites();sss++){ + Kernels::DiracOptHandDhopSite(st,U,comm_buf,sss,sss,in,out,local,nonlocal); + } + } else { +PARALLEL_FOR_LOOP + for(int sss=0;sssoSites();sss++){ + Kernels::DiracOptDhopSite(st,U,comm_buf,sss,sss,in,out,local,nonlocal); + } + } + } + + + local = false; + nonlocal = true; + if ( dag == DaggerYes ) { + if( HandOptDslash ) { +PARALLEL_FOR_LOOP + for(int sss=0;sssoSites();sss++){ + Kernels::DiracOptHandDhopSiteDag(st,U,comm_buf,sss,sss,in,out,local,nonlocal); + } + } else { +PARALLEL_FOR_LOOP + for(int sss=0;sssoSites();sss++){ + Kernels::DiracOptDhopSiteDag(st,U,comm_buf,sss,sss,in,out,local,nonlocal); + } + } + } else { + if( HandOptDslash ) { +PARALLEL_FOR_LOOP + for(int sss=0;sssoSites();sss++){ + Kernels::DiracOptHandDhopSite(st,U,comm_buf,sss,sss,in,out,local,nonlocal); + } + } else { +PARALLEL_FOR_LOOP + for(int sss=0;sssoSites();sss++){ + Kernels::DiracOptDhopSite(st,U,comm_buf,sss,sss,in,out,local,nonlocal); + } + } + } + + }; + FermOpTemplateInstantiate(WilsonFermion); GparityFermOpTemplateInstantiate(WilsonFermion); + }} diff --git a/lib/qcd/action/fermion/WilsonFermion.h b/lib/qcd/action/fermion/WilsonFermion.h index 9a8c848a..5d835c41 100644 --- a/lib/qcd/action/fermion/WilsonFermion.h +++ b/lib/qcd/action/fermion/WilsonFermion.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonFermion.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_WILSON_FERMION_H #define GRID_QCD_WILSON_FERMION_H @@ -42,10 +71,12 @@ namespace Grid { ///////////////////////////////////////////////////////// void Meooe(const FermionField &in, FermionField &out) ; void MeooeDag(const FermionField &in, FermionField &out) ; - void Mooee(const FermionField &in, FermionField &out) ; - void MooeeDag(const FermionField &in, FermionField &out) ; - void MooeeInv(const FermionField &in, FermionField &out) ; - void MooeeInvDag(const FermionField &in, FermionField &out) ; + + // allow override for twisted mass and clover + virtual void Mooee(const FermionField &in, FermionField &out) ; + virtual void MooeeDag(const FermionField &in, FermionField &out) ; + virtual void MooeeInv(const FermionField &in, FermionField &out) ; + virtual void MooeeInvDag(const FermionField &in, FermionField &out) ; //////////////////////// // Derivative interface @@ -83,6 +114,11 @@ namespace Grid { void DhopInternal(StencilImpl & st,DoubledGaugeField & U, const FermionField &in, FermionField &out,int dag) ; + void DhopInternalCommsThenCompute(StencilImpl & st,DoubledGaugeField & U, + const FermionField &in, FermionField &out,int dag) ; + void DhopInternalCommsOverlapCompute(StencilImpl & st,DoubledGaugeField & U, + const FermionField &in, FermionField &out,int dag) ; + // Constructor WilsonFermion(GaugeField &_Umu, diff --git a/lib/qcd/action/fermion/WilsonFermion5D.cc b/lib/qcd/action/fermion/WilsonFermion5D.cc index aca0a99b..c6448d58 100644 --- a/lib/qcd/action/fermion/WilsonFermion5D.cc +++ b/lib/qcd/action/fermion/WilsonFermion5D.cc @@ -1,3 +1,34 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonFermion5D.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include @@ -71,6 +102,7 @@ WilsonFermion5D::WilsonFermion5D(GaugeField &_Umu, ImportGauge(_Umu); commtime=0; + jointime=0; dslashtime=0; } template @@ -206,6 +238,7 @@ void WilsonFermion5D::Report(void) std::cout< void WilsonFermion5D::DhopInternal(StencilImpl & st, LebesgueOrder &lo, DoubledGaugeField & U, const FermionField &in, FermionField &out,int dag) +{ + if ( Impl::overlapCommsCompute () ) { + DhopInternalCommsOverlapCompute(st,lo,U,in,out,dag); + } else { + DhopInternalCommsThenCompute(st,lo,U,in,out,dag); + } +} + +template +void WilsonFermion5D::DhopInternalCommsThenCompute(StencilImpl & st, LebesgueOrder &lo, + DoubledGaugeField & U, + const FermionField &in, FermionField &out,int dag) { // assert((dag==DaggerNo) ||(dag==DaggerYes)); @@ -254,8 +299,12 @@ void WilsonFermion5D::DhopInternal(StencilImpl & st, LebesgueOrder &lo, int nwork = U._grid->oSites(); commtime -=usecond(); - st.HaloExchange(in,comm_buf,compressor); + std::thread thr = st.HaloExchangeBegin(in,comm_buf,compressor); commtime +=usecond(); + + jointime -=usecond(); + thr.join(); + jointime +=usecond(); // Dhop takes the 4d grid from U, and makes a 5d index for fermion // Not loop ordering and data layout. @@ -365,6 +414,137 @@ PARALLEL_FOR_LOOP } dslashtime +=usecond(); } + +template +void WilsonFermion5D::DhopInternalCommsOverlapCompute(StencilImpl & st, LebesgueOrder &lo, + DoubledGaugeField & U, + const FermionField &in, FermionField &out,int dag) +{ + // assert((dag==DaggerNo) ||(dag==DaggerYes)); + + Compressor compressor(dag); + + // Assume balanced KMP_AFFINITY; this is forced in GridThread.h + + int threads = GridThread::GetThreads(); + int HT = GridThread::GetHyperThreads(); + int cores = GridThread::GetCores(); + int nwork = U._grid->oSites(); + + commtime -=usecond(); + std::thread thr = st.HaloExchangeBegin(in,comm_buf,compressor); + commtime +=usecond(); + + // Dhop takes the 4d grid from U, and makes a 5d index for fermion + // Not loop ordering and data layout. + // Designed to create + // - per thread reuse in L1 cache for U + // - 8 linear access unit stride streams per thread for Fermion for hw prefetchable. + bool local = true; + bool nonlocal = false; + dslashtime -=usecond(); + if ( dag == DaggerYes ) { + if( this->HandOptDslash ) { +PARALLEL_FOR_LOOP + for(int ss=0;ssoSites();ss++){ + int sU=ss; + for(int s=0;soSites();ss++){ + { + int sd; + for(sd=0;sdHandOptDslash ) { +PARALLEL_FOR_LOOP + for(int ss=0;ssoSites();ss++){ + int sU=ss; + for(int s=0;soSites();ss++){ + int sU=ss; + for(int s=0;sHandOptDslash ) { +PARALLEL_FOR_LOOP + for(int ss=0;ssoSites();ss++){ + int sU=ss; + for(int s=0;soSites();ss++){ + { + int sd; + for(sd=0;sdHandOptDslash ) { +PARALLEL_FOR_LOOP + for(int ss=0;ssoSites();ss++){ + int sU=ss; + for(int s=0;soSites();ss++){ + int sU=ss; + for(int s=0;s void WilsonFermion5D::DhopOE(const FermionField &in, FermionField &out,int dag) { diff --git a/lib/qcd/action/fermion/WilsonFermion5D.h b/lib/qcd/action/fermion/WilsonFermion5D.h index 9ee3c81d..efe0f043 100644 --- a/lib/qcd/action/fermion/WilsonFermion5D.h +++ b/lib/qcd/action/fermion/WilsonFermion5D.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonFermion5D.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_WILSON_FERMION_5D_H #define GRID_QCD_WILSON_FERMION_5D_H @@ -32,6 +61,7 @@ namespace Grid { public: INHERIT_IMPL_TYPES(Impl); typedef WilsonKernels Kernels; + double jointime; double commtime; double dslashtime; /////////////////////////////////////////////////////////////// @@ -88,6 +118,19 @@ namespace Grid { FermionField &out, int dag); + void DhopInternalCommsThenCompute(StencilImpl & st, + LebesgueOrder &lo, + DoubledGaugeField &U, + const FermionField &in, + FermionField &out, + int dag); + void DhopInternalCommsOverlapCompute(StencilImpl & st, + LebesgueOrder &lo, + DoubledGaugeField &U, + const FermionField &in, + FermionField &out, + int dag); + // Constructors WilsonFermion5D(GaugeField &_Umu, GridCartesian &FiveDimGrid, diff --git a/lib/qcd/action/fermion/WilsonKernels.cc b/lib/qcd/action/fermion/WilsonKernels.cc index 3d4a9364..37b8577f 100644 --- a/lib/qcd/action/fermion/WilsonKernels.cc +++ b/lib/qcd/action/fermion/WilsonKernels.cc @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonKernels.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { namespace QCD { @@ -5,10 +34,11 @@ namespace QCD { template WilsonKernels::WilsonKernels(const ImplParams &p): Base(p) {}; + // Need controls to do interior, exterior, or both template void WilsonKernels::DiracOptDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out) + int sF,int sU,const FermionField &in, FermionField &out,bool local, bool nonlocal) { SiteHalfSpinor tmp; SiteHalfSpinor chi; @@ -17,231 +47,425 @@ void WilsonKernels::DiracOptDhopSiteDag(StencilImpl &st,DoubledGaugeField StencilEntry *SE; int ptype; + int num = 0; + + result=zero; + + /////////////////////////// // Xp + /////////////////////////// SE=st.GetEntry(ptype,Xp,sF); - if ( SE->_is_local && SE->_permute ) { - spProjXp(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjXp(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; - } - Impl::multLink(Uchi,U._odata[sU],chi,Xp,SE,st); - spReconXp(result,Uchi); - - // Yp - SE=st.GetEntry(ptype,Yp,sF); - if ( SE->_is_local && SE->_permute ) { - spProjYp(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjYp(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; - } - Impl::multLink(Uchi,U._odata[sU],chi,Yp,SE,st); - accumReconYp(result,Uchi); - // Zp - SE=st.GetEntry(ptype,Zp,sF); - if ( SE->_is_local && SE->_permute ) { - spProjZp(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjZp(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjXp(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjXp(chi,in._odata[SE->_offset]); + } } - Impl::multLink(Uchi,U._odata[sU],chi,Zp,SE,st); - accumReconZp(result,Uchi); - // Tp - SE=st.GetEntry(ptype,Tp,sF); - if ( SE->_is_local && SE->_permute ) { - spProjTp(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjTp(chi,in._odata[SE->_offset]); - } else { + if ( nonlocal && (!SE->_is_local) ) { chi=buf[SE->_offset]; } - Impl::multLink(Uchi,U._odata[sU],chi,Tp,SE,st); - accumReconTp(result,Uchi); - - // Xm - SE=st.GetEntry(ptype,Xm,sF); - if ( SE->_is_local && SE->_permute ) { - spProjXm(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjXm(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; - } - Impl::multLink(Uchi,U._odata[sU],chi,Xm,SE,st); - accumReconXm(result,Uchi); - - // Ym - SE=st.GetEntry(ptype,Ym,sF); - if ( SE->_is_local && SE->_permute ) { - spProjYm(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjYm(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; - } - Impl::multLink(Uchi,U._odata[sU],chi,Ym,SE,st); - accumReconYm(result,Uchi); + if ( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Xp,SE,st); + accumReconXp(result,Uchi); + num++; + } + + /////////////////////////// + // Yp + /////////////////////////// + SE=st.GetEntry(ptype,Yp,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjYp(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjYp(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if ( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Yp,SE,st); + accumReconYp(result,Uchi); + num++; + } + + /////////////////////////// + // Zp + /////////////////////////// + SE=st.GetEntry(ptype,Zp,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjZp(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjZp(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if ( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Zp,SE,st); + accumReconZp(result,Uchi); + num++; + } + + /////////////////////////// + // Tp + /////////////////////////// + SE=st.GetEntry(ptype,Tp,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjTp(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjTp(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if ( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Tp,SE,st); + accumReconTp(result,Uchi); + num++; + } + + /////////////////////////// + // Xm + /////////////////////////// + SE=st.GetEntry(ptype,Xm,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjXm(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjXm(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Xm,SE,st); + accumReconXm(result,Uchi); + num++; + } + + /////////////////////////// + // Ym + /////////////////////////// + SE=st.GetEntry(ptype,Ym,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjYm(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjYm(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Ym,SE,st); + accumReconYm(result,Uchi); + num++; + } + + /////////////////////////// // Zm + /////////////////////////// SE=st.GetEntry(ptype,Zm,sF); - if ( SE->_is_local && SE->_permute ) { - spProjZm(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjZm(chi,in._odata[SE->_offset]); - } else { + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjZm(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjZm(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { chi=buf[SE->_offset]; } - Impl::multLink(Uchi,U._odata[sU],chi,Zm,SE,st); - accumReconZm(result,Uchi); + if( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Zm,SE,st); + accumReconZm(result,Uchi); + num++; + } + + /////////////////////////// // Tm + /////////////////////////// SE=st.GetEntry(ptype,Tm,sF); - if ( SE->_is_local && SE->_permute ) { - spProjTm(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjTm(chi,in._odata[SE->_offset]); - } else { + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjTm(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjTm(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { chi=buf[SE->_offset]; } - Impl::multLink(Uchi,U._odata[sU],chi,Tm,SE,st); - accumReconTm(result,Uchi); - vstream(out._odata[sF],result*(-0.5)); + if( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Tm,SE,st); + accumReconTm(result,Uchi); + num++; + } + + if ( local ) { + vstream(out._odata[sF],result*(-0.5)); + } else if ( num ) { + vstream(out._odata[sF],out._odata[sF]+result*(-0.5)); + } }; + + // Need controls to do interior, exterior, or both template void WilsonKernels::DiracOptDhopSite(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out) + std::vector > &buf, + int sF,int sU,const FermionField &in, FermionField &out,bool local, bool nonlocal) { SiteHalfSpinor tmp; SiteHalfSpinor chi; - SiteSpinor result; SiteHalfSpinor Uchi; + SiteSpinor result; StencilEntry *SE; int ptype; + int num = 0; + + result=zero; + + /////////////////////////// // Xp + /////////////////////////// SE=st.GetEntry(ptype,Xm,sF); - if ( SE->_is_local && SE->_permute ) { - spProjXp(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjXp(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; - } - Impl::multLink(Uchi,U._odata[sU],chi,Xm,SE,st); - spReconXp(result,Uchi); - // Yp - SE=st.GetEntry(ptype,Ym,sF); - if ( SE->_is_local && SE->_permute ) { - spProjYp(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjYp(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjXp(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjXp(chi,in._odata[SE->_offset]); + } } - Impl::multLink(Uchi,U._odata[sU],chi,Ym,SE,st); - accumReconYp(result,Uchi); - - // Zp - SE=st.GetEntry(ptype,Zm,sF); - if ( SE->_is_local && SE->_permute ) { - spProjZp(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjZp(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; - } - Impl::multLink(Uchi,U._odata[sU],chi,Zm,SE,st); - accumReconZp(result,Uchi); - - // Tp - SE=st.GetEntry(ptype,Tm,sF); - if ( SE->_is_local && SE->_permute ) { - spProjTp(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjTp(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; - } - Impl::multLink(Uchi,U._odata[sU],chi,Tm,SE,st); - accumReconTp(result,Uchi); - - // Xm - SE=st.GetEntry(ptype,Xp,sF); - if ( SE->_is_local && SE->_permute ) { - spProjXm(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjXm(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; - } - Impl::multLink(Uchi,U._odata[sU],chi,Xp,SE,st); - accumReconXm(result,Uchi); - // Ym - SE=st.GetEntry(ptype,Yp,sF); - if ( SE->_is_local && SE->_permute ) { - spProjYm(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjYm(chi,in._odata[SE->_offset]); - } else { + if ( nonlocal && (!SE->_is_local) ) { chi=buf[SE->_offset]; } - Impl::multLink(Uchi,U._odata[sU],chi,Yp,SE,st); - accumReconYm(result,Uchi); - - // Zm - SE=st.GetEntry(ptype,Zp,sF); - if ( SE->_is_local && SE->_permute ) { - spProjZm(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjZm(chi,in._odata[SE->_offset]); - } else { - chi=buf[SE->_offset]; + + if ( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Xm,SE,st); + accumReconXp(result,Uchi); + num++; } - Impl::multLink(Uchi,U._odata[sU],chi,Zp,SE,st); - accumReconZm(result,Uchi); - // Tm - SE=st.GetEntry(ptype,Tp,sF); - if ( SE->_is_local && SE->_permute ) { - spProjTm(tmp,in._odata[SE->_offset]); - permute(chi,tmp,ptype); - } else if ( SE->_is_local ) { - spProjTm(chi,in._odata[SE->_offset]); - } else { + /////////////////////////// + // Yp + /////////////////////////// + SE=st.GetEntry(ptype,Ym,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjYp(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjYp(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { chi=buf[SE->_offset]; } - Impl::multLink(Uchi,U._odata[sU],chi,Tp,SE,st); - accumReconTm(result,Uchi); + + if ( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Ym,SE,st); + accumReconYp(result,Uchi); + num++; + } + + /////////////////////////// + // Zp + /////////////////////////// + SE=st.GetEntry(ptype,Zm,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjZp(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjZp(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if ( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Zm,SE,st); + accumReconZp(result,Uchi); + num++; + } + + /////////////////////////// + // Tp + /////////////////////////// + SE=st.GetEntry(ptype,Tm,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjTp(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjTp(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if ( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Tm,SE,st); + accumReconTp(result,Uchi); + num++; + } + + /////////////////////////// + // Xm + /////////////////////////// + SE=st.GetEntry(ptype,Xp,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjXm(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjXm(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Xp,SE,st); + accumReconXm(result,Uchi); + num++; + } + + /////////////////////////// + // Ym + /////////////////////////// + SE=st.GetEntry(ptype,Yp,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjYm(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjYm(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Yp,SE,st); + accumReconYm(result,Uchi); + num++; + } - vstream(out._odata[sF],result*(-0.5)); -} + /////////////////////////// + // Zm + /////////////////////////// + SE=st.GetEntry(ptype,Zp,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjZm(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjZm(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Zp,SE,st); + accumReconZm(result,Uchi); + num++; + } + + /////////////////////////// + // Tm + /////////////////////////// + SE=st.GetEntry(ptype,Tp,sF); + + if (local && SE->_is_local ) { + if ( SE->_permute ) { + spProjTm(tmp,in._odata[SE->_offset]); + permute(chi,tmp,ptype); + } else { + spProjTm(chi,in._odata[SE->_offset]); + } + } + + if ( nonlocal && (!SE->_is_local) ) { + chi=buf[SE->_offset]; + } + + if( (local && SE->_is_local) || ( nonlocal && (!SE->_is_local)) ) { + Impl::multLink(Uchi,U._odata[sU],chi,Tp,SE,st); + accumReconTm(result,Uchi); + num++; + } + + if ( local ) { + vstream(out._odata[sF],result*(-0.5)); + } else if ( num ) { + vstream(out._odata[sF],out._odata[sF]+result*(-0.5)); + } +}; template void WilsonKernels::DiracOptDhopDir(StencilImpl &st,DoubledGaugeField &U, @@ -376,7 +600,7 @@ void WilsonKernels::DiracOptDhopDir(StencilImpl &st,DoubledGaugeField &U, template void WilsonKernels::DiracOptAsmDhopSite(StencilImpl &st,DoubledGaugeField &U, std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out,uint64_t *p) + int sF,int sU,const FermionField &in, FermionField &out,bool local, bool nonlocal) { DiracOptDhopSite(st,U,buf,sF,sU,in,out); // will template override for Wilson Nc=3 } diff --git a/lib/qcd/action/fermion/WilsonKernels.h b/lib/qcd/action/fermion/WilsonKernels.h index eccafda4..90725920 100644 --- a/lib/qcd/action/fermion/WilsonKernels.h +++ b/lib/qcd/action/fermion/WilsonKernels.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonKernels.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_DHOP_H #define GRID_QCD_DHOP_H @@ -19,11 +48,11 @@ namespace Grid { public: void DiracOptDhopSite(StencilImpl &st,DoubledGaugeField &U, std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out); + int sF,int sU,const FermionField &in, FermionField &out,bool local= true, bool nonlocal=true); void DiracOptDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, std::vector > &buf, - int sF,int sU,const FermionField &in,FermionField &out); + int sF,int sU,const FermionField &in,FermionField &out,bool local= true, bool nonlocal=true); void DiracOptDhopDir(StencilImpl &st,DoubledGaugeField &U, std::vector > &buf, @@ -31,7 +60,8 @@ namespace Grid { void DiracOptAsmDhopSite(StencilImpl &st,DoubledGaugeField &U, std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out,uint64_t *); + int sF,int sU,const FermionField &in, FermionField &out,bool local= true, bool nonlocal=true); +// int sF,int sU,const FermionField &in, FermionField &out,uint64_t *); #if 0 void DiracOptAsmDhopSite(StencilImpl &st,DoubledGaugeField &U, std::vector > &buf, @@ -44,11 +74,12 @@ namespace Grid { #if 1 void DiracOptHandDhopSite(StencilImpl &st,DoubledGaugeField &U, std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out); + int sF,int sU,const FermionField &in, FermionField &out,bool local= true, bool nonlocal=true); void DiracOptHandDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out); + int sF,int sU,const FermionField &in, FermionField &out,bool local= true, bool nonlocal=true); +// int sF,int sU,const FermionField &in, FermionField &out); #endif WilsonKernels(const ImplParams &p= ImplParams()); diff --git a/lib/qcd/action/fermion/WilsonKernelsAsm.cc b/lib/qcd/action/fermion/WilsonKernelsAsm.cc index 7e9f416e..3d191cd7 100644 --- a/lib/qcd/action/fermion/WilsonKernelsAsm.cc +++ b/lib/qcd/action/fermion/WilsonKernelsAsm.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonKernelsAsm.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #if defined(AVX512) || defined (IMCI) diff --git a/lib/qcd/action/fermion/WilsonKernelsHand.cc b/lib/qcd/action/fermion/WilsonKernelsHand.cc index 51a9f19a..613d332f 100644 --- a/lib/qcd/action/fermion/WilsonKernelsHand.cc +++ b/lib/qcd/action/fermion/WilsonKernelsHand.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonKernelsHand.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #define REGISTER @@ -283,8 +311,8 @@ namespace QCD { template void WilsonKernels::DiracOptHandDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out) + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out, bool Local, bool Nonlocal) { // std::cout << "Hand op Dhop "<::DiracOptHandDhopSiteDag(StencilImpl &st,DoubledGaugeF template void WilsonKernels::DiracOptHandDhopSite(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out) + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out, bool Local, bool Nonlocal) { typedef typename Simd::scalar_type S; typedef typename Simd::vector_type V; @@ -773,32 +801,32 @@ void WilsonKernels::DiracOptHandDhopSite(StencilImpl &st,DoubledGaugeFiel //////////////////////////////////////////////// template<> void WilsonKernels::DiracOptHandDhopSite(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out) + std::vector > &buf, + int sF,int sU,const FermionField &in, FermionField &out, bool Local, bool Nonlocal) { DiracOptDhopSite(st,U,buf,sF,sU,in,out); // will template override for Wilson Nc=3 } template<> void WilsonKernels::DiracOptHandDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out) + std::vector > &buf, + int sF,int sU,const FermionField &in, FermionField &out, bool Local, bool Nonlocal) { DiracOptDhopSiteDag(st,U,buf,sF,sU,in,out); // will template override for Wilson Nc=3 } template<> void WilsonKernels::DiracOptHandDhopSite(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out) + std::vector > &buf, + int sF,int sU,const FermionField &in, FermionField &out, bool Local, bool Nonlocal) { DiracOptDhopSite(st,U,buf,sF,sU,in,out); // will template override for Wilson Nc=3 } template<> void WilsonKernels::DiracOptHandDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int sF,int sU,const FermionField &in, FermionField &out) + std::vector > &buf, + int sF,int sU,const FermionField &in, FermionField &out, bool Local, bool Nonlocal) { DiracOptDhopSiteDag(st,U,buf,sF,sU,in,out); // will template override for Wilson Nc=3 } @@ -806,30 +834,30 @@ void WilsonKernels::DiracOptHandDhopSiteDag(StencilImpl &st, template void WilsonKernels::DiracOptHandDhopSite(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out); + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out,bool l,bool n); template void WilsonKernels::DiracOptHandDhopSite(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out); + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out, bool l, bool n); template void WilsonKernels::DiracOptHandDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out); + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out, bool l, bool n); template void WilsonKernels::DiracOptHandDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out); + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out, bool l, bool n); template void WilsonKernels::DiracOptHandDhopSite(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out); + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out, bool l, bool nl); template void WilsonKernels::DiracOptHandDhopSite(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out); + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out, bool l, bool nl); template void WilsonKernels::DiracOptHandDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out); + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out, bool l, bool nl); template void WilsonKernels::DiracOptHandDhopSiteDag(StencilImpl &st,DoubledGaugeField &U, - std::vector > &buf, - int ss,int sU,const FermionField &in, FermionField &out); + std::vector > &buf, + int ss,int sU,const FermionField &in, FermionField &out, bool l, bool nl); }} diff --git a/lib/qcd/action/fermion/WilsonTMFermion.cc b/lib/qcd/action/fermion/WilsonTMFermion.cc new file mode 100644 index 00000000..f74f9f00 --- /dev/null +++ b/lib/qcd/action/fermion/WilsonTMFermion.cc @@ -0,0 +1,98 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonTMFermion.cc + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include + +namespace Grid { +namespace QCD { + + /* + * BF sequence + * + void bfmbase::MooeeInv(Fermion_t psi, + Fermion_t chi, + int dag, int cb) + + double m = this->mass; + double tm = this->twistedmass; + double mtil = 4.0+this->mass; + + double sq = mtil*mtil + tm*tm; + + double a = mtil/sq; + double b = -tm /sq; + if(dag) b=-b; + axpibg5x(chi,psi,a,b); + + void bfmbase::Mooee(Fermion_t psi, + Fermion_t chi, + int dag,int cb) + double a = 4.0+this->mass; + double b = this->twistedmass; + if(dag) b=-b; + axpibg5x(chi,psi,a,b); + */ + + template + void WilsonTMFermion::Mooee(const FermionField &in, FermionField &out) { + RealD a = 4.0+this->mass; + RealD b = this->mu; + out.checkerboard = in.checkerboard; + axpibg5x(out,in,a,b); + } + template + void WilsonTMFermion::MooeeDag(const FermionField &in, FermionField &out) { + RealD a = 4.0+this->mass; + RealD b = -this->mu; + out.checkerboard = in.checkerboard; + axpibg5x(out,in,a,b); + } + template + void WilsonTMFermion::MooeeInv(const FermionField &in, FermionField &out) { + RealD m = this->mass; + RealD tm = this->mu; + RealD mtil = 4.0+this->mass; + RealD sq = mtil*mtil+tm*tm; + RealD a = mtil/sq; + RealD b = -tm /sq; + axpibg5x(out,in,a,b); + } + template + void WilsonTMFermion::MooeeInvDag(const FermionField &in, FermionField &out) { + RealD m = this->mass; + RealD tm = this->mu; + RealD mtil = 4.0+this->mass; + RealD sq = mtil*mtil+tm*tm; + RealD a = mtil/sq; + RealD b = tm /sq; + axpibg5x(out,in,a,b); + } + + FermOpTemplateInstantiate(WilsonTMFermion); + +} +} diff --git a/lib/qcd/action/fermion/WilsonTMFermion.h b/lib/qcd/action/fermion/WilsonTMFermion.h new file mode 100644 index 00000000..df00a269 --- /dev/null +++ b/lib/qcd/action/fermion/WilsonTMFermion.h @@ -0,0 +1,76 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/WilsonTMFermion.h + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#ifndef GRID_QCD_WILSON_TM_FERMION_H +#define GRID_QCD_WILSON_TM_FERMION_H + +#include + +namespace Grid { + + namespace QCD { + + template + class WilsonTMFermion : public WilsonFermion + { + public: + INHERIT_IMPL_TYPES(Impl); + public: + + virtual void Instantiatable(void) {}; + // Constructors + WilsonTMFermion(GaugeField &_Umu, + GridCartesian &Fgrid, + GridRedBlackCartesian &Hgrid, + RealD _mass, + RealD _mu, + const ImplParams &p= ImplParams() + ) : + WilsonFermion(_Umu, + Fgrid, + Hgrid, + _mass,p) + + { + mu = _mu; + } + + + // allow override for twisted mass and clover + virtual void Mooee(const FermionField &in, FermionField &out) ; + virtual void MooeeDag(const FermionField &in, FermionField &out) ; + virtual void MooeeInv(const FermionField &in, FermionField &out) ; + virtual void MooeeInvDag(const FermionField &in, FermionField &out) ; + + private: + RealD mu; // TwistedMass parameter + + }; + +}} + +#endif diff --git a/lib/qcd/action/fermion/g5HermitianLinop.h b/lib/qcd/action/fermion/g5HermitianLinop.h index 864af86d..af23c36f 100644 --- a/lib/qcd/action/fermion/g5HermitianLinop.h +++ b/lib/qcd/action/fermion/g5HermitianLinop.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/fermion/g5HermitianLinop.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef G5_HERMITIAN_LINOP #define G5_HERMITIAN_LINOP diff --git a/lib/qcd/action/gauge/GaugeImpl.h b/lib/qcd/action/gauge/GaugeImpl.h new file mode 100644 index 00000000..51a4675e --- /dev/null +++ b/lib/qcd/action/gauge/GaugeImpl.h @@ -0,0 +1,179 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/gauge/GaugeImpl.h + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#ifndef GRID_QCD_GAUGE_IMPL_H +#define GRID_QCD_GAUGE_IMPL_H + +namespace Grid { + + namespace QCD { + + + //////////////////////////////////////////////////////////////////////// + // Implementation dependent gauge types + //////////////////////////////////////////////////////////////////////// + +template class WilsonLoops; + +#define INHERIT_GIMPL_TYPES(GImpl) \ + typedef typename GImpl::Simd Simd;\ + typedef typename GImpl::GaugeLinkField GaugeLinkField;\ + typedef typename GImpl::GaugeField GaugeField; + + + // + template + class GaugeImplTypes { + public: + + typedef S Simd; + + template using iImplGaugeLink = iScalar > >; + template using iImplGaugeField = iVector >, Nd >; + + typedef iImplGaugeLink SiteGaugeLink; + typedef iImplGaugeField SiteGaugeField; + + typedef Lattice GaugeLinkField; // bit ugly naming; polarised gauge field, lorentz... all ugly + typedef Lattice GaugeField; + + }; + + // Composition with smeared link, bc's etc.. probably need multiple inheritance + // Variable precision "S" and variable Nc + template + class PeriodicGaugeImpl : public GimplTypes { + public: + + INHERIT_GIMPL_TYPES(GimplTypes); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Support needed for the assembly of loops including all boundary condition effects such as conjugate bcs + //////////////////////////////////////////////////////////////////////////////////////////////////////////// + + template static inline + Lattice CovShiftForward (const GaugeLinkField &Link, int mu, const Lattice &field) { + return PeriodicBC::CovShiftForward(Link,mu,field); + } + + template static inline + Lattice CovShiftBackward(const GaugeLinkField &Link, int mu,const Lattice &field) { + return PeriodicBC::CovShiftBackward(Link,mu,field); + } + static inline + GaugeLinkField CovShiftIdentityBackward(const GaugeLinkField &Link, int mu) { + return Cshift(adj(Link),mu,-1); + } + static inline + GaugeLinkField CovShiftIdentityForward(const GaugeLinkField &Link, int mu) { + return Link; + } + static inline + GaugeLinkField ShiftStaple(const GaugeLinkField &Link, int mu) { + return Cshift(Link,mu,1); + } + + static inline bool isPeriodicGaugeField(void) { + return true; + } + + }; + + + // Composition with smeared link, bc's etc.. probably need multiple inheritance + // Variable precision "S" and variable Nc + template + class ConjugateGaugeImpl : public GimplTypes { + public: + + INHERIT_GIMPL_TYPES(GimplTypes); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Support needed for the assembly of loops including all boundary condition effects such as Gparity. + //////////////////////////////////////////////////////////////////////////////////////////////////////////// + template static + Lattice CovShiftForward (const GaugeLinkField &Link, int mu, const Lattice &field) { + return ConjugateBC::CovShiftForward(Link,mu,field); + } + + template static + Lattice CovShiftBackward(const GaugeLinkField &Link, int mu,const Lattice &field) { + return ConjugateBC::CovShiftBackward(Link,mu,field); + } + + static inline + GaugeLinkField CovShiftIdentityBackward(const GaugeLinkField &Link, int mu) { + GridBase *grid = Link._grid; + int Lmu = grid->GlobalDimensions()[mu]-1; + + Lattice > coor(grid); LatticeCoordinate(coor,mu); + + GaugeLinkField tmp (grid); + tmp=adj(Link); + tmp = where(coor==Lmu,conjugate(tmp),tmp); + return Cshift(tmp,mu,-1);// moves towards positive mu + } + static inline + GaugeLinkField CovShiftIdentityForward(const GaugeLinkField &Link, int mu) { + return Link; + } + + static inline + GaugeLinkField ShiftStaple(const GaugeLinkField &Link, int mu) { + GridBase *grid = Link._grid; + int Lmu = grid->GlobalDimensions()[mu]-1; + + Lattice > coor(grid); LatticeCoordinate(coor,mu); + + GaugeLinkField tmp (grid); + tmp=Cshift(Link,mu,1); + tmp=where(coor==Lmu,conjugate(tmp),tmp); + return tmp; + } + + static inline bool isPeriodicGaugeField(void) { + return false; + } + + }; + + typedef GaugeImplTypes GimplTypesR; + typedef GaugeImplTypes GimplTypesF; + typedef GaugeImplTypes GimplTypesD; + + typedef PeriodicGaugeImpl PeriodicGimplR; // Real.. whichever prec + typedef PeriodicGaugeImpl PeriodicGimplF; // Float + typedef PeriodicGaugeImpl PeriodicGimplD; // Double + + typedef ConjugateGaugeImpl ConjugateGimplR; // Real.. whichever prec + typedef ConjugateGaugeImpl ConjugateGimplF; // Float + typedef ConjugateGaugeImpl ConjugateGimplD; // Double + + } +} + +#endif diff --git a/lib/qcd/action/gauge/PlaqPlusRectangleAction.h b/lib/qcd/action/gauge/PlaqPlusRectangleAction.h new file mode 100644 index 00000000..6193bedb --- /dev/null +++ b/lib/qcd/action/gauge/PlaqPlusRectangleAction.h @@ -0,0 +1,142 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/gauge/PlaqPlusRectangleAction.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#ifndef QCD_PLAQ_PLUS_RECTANGLE_ACTION_H +#define QCD_PLAQ_PLUS_RECTANGLE_ACTION_H + +namespace Grid{ + namespace QCD{ + + //////////////////////////////////////////////////////////////////////// + // PlaqPlusRectangleActoin + //////////////////////////////////////////////////////////////////////// + template + class PlaqPlusRectangleAction : public Action { + public: + + INHERIT_GIMPL_TYPES(Gimpl); + + private: + RealD c_plaq; + RealD c_rect; + + public: + PlaqPlusRectangleAction(RealD b,RealD c): c_plaq(b),c_rect(c){}; + + virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {}; // noop as no pseudoferms + + virtual RealD S(const GaugeField &U) { + RealD vol = U._grid->gSites(); + + RealD plaq = WilsonLoops::avgPlaquette(U); + RealD rect = WilsonLoops::avgRectangle(U); + + RealD action=c_plaq*(1.0 -plaq)*(Nd*(Nd-1.0))*vol*0.5 + +c_rect*(1.0 -rect)*(Nd*(Nd-1.0))*vol; + + return action; + }; + + virtual void deriv(const GaugeField &Umu,GaugeField & dSdU) { + //extend Ta to include Lorentz indexes + RealD factor_p = c_plaq/RealD(Nc)*0.5; + RealD factor_r = c_rect/RealD(Nc)*0.5; + + GridBase *grid = Umu._grid; + + std::vector U (Nd,grid); + std::vector U2(Nd,grid); + + for(int mu=0;mu(Umu,mu); + WilsonLoops::RectStapleDouble(U2[mu],U[mu],mu); + } + + GaugeLinkField dSdU_mu(grid); + GaugeLinkField staple(grid); + + for (int mu=0; mu < Nd; mu++){ + + // Staple in direction mu + + WilsonLoops::Staple(staple,Umu,mu); + + dSdU_mu = Ta(U[mu]*staple)*factor_p; + + WilsonLoops::RectStaple(Umu,staple,U2,U,mu); + + dSdU_mu = dSdU_mu + Ta(U[mu]*staple)*factor_r; + + PokeIndex(dSdU, dSdU_mu, mu); + } + + }; + + }; + + // Convenience for common physically defined cases. + // + // RBC c1 parameterisation is not really RBC but don't have good + // reference and we are happy to change name if prior use of this plaq coeff + // parameterisation is made known to us. + template + class RBCGaugeAction : public PlaqPlusRectangleAction { + public: + INHERIT_GIMPL_TYPES(Gimpl); + RBCGaugeAction(RealD beta,RealD c1) : PlaqPlusRectangleAction(beta*(1.0-8.0*c1), beta*c1) { + }; + }; + + template + class IwasakiGaugeAction : public RBCGaugeAction { + public: + INHERIT_GIMPL_TYPES(Gimpl); + IwasakiGaugeAction(RealD beta) : RBCGaugeAction(beta,-0.331) { + }; + }; + + template + class SymanzikGaugeAction : public RBCGaugeAction { + public: + INHERIT_GIMPL_TYPES(Gimpl); + SymanzikGaugeAction(RealD beta) : RBCGaugeAction(beta,-1.0/12.0) { + }; + }; + + template + class DBW2GaugeAction : public RBCGaugeAction { + public: + INHERIT_GIMPL_TYPES(Gimpl); + DBW2GaugeAction(RealD beta) : RBCGaugeAction(beta,-1.4067) { + }; + }; + + } +} + +#endif diff --git a/lib/qcd/action/gauge/WilsonGaugeAction.h b/lib/qcd/action/gauge/WilsonGaugeAction.h index e98e15d6..aff67c67 100644 --- a/lib/qcd/action/gauge/WilsonGaugeAction.h +++ b/lib/qcd/action/gauge/WilsonGaugeAction.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/gauge/WilsonGaugeAction.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_WILSON_GAUGE_ACTION_H #define QCD_WILSON_GAUGE_ACTION_H @@ -7,11 +37,13 @@ namespace Grid{ //////////////////////////////////////////////////////////////////////// // Wilson Gauge Action .. should I template the Nc etc.. //////////////////////////////////////////////////////////////////////// - template - class WilsonGaugeAction : public Action { + template + class WilsonGaugeAction : public Action { public: - typedef LorentzScalar GaugeLinkField; + INHERIT_GIMPL_TYPES(Gimpl); + + // typedef LorentzScalar GaugeLinkField; private: RealD beta; @@ -21,18 +53,19 @@ namespace Grid{ virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {}; // noop as no pseudoferms virtual RealD S(const GaugeField &U) { - RealD plaq = WilsonLoops::avgPlaquette(U); - std::cout<::avgPlaquette(U); RealD vol = U._grid->gSites(); RealD action=beta*(1.0 -plaq)*(Nd*(Nd-1.0))*vol*0.5; - std::cout << GridLogMessage << "WilsonGauge action "<(U,mu); // Staple in direction mu - WilsonLoops::Staple(dSdU_mu,U,mu); - dSdU_mu = Ta(Umu*adj(dSdU_mu))*factor; + WilsonLoops::Staple(dSdU_mu,U,mu); + dSdU_mu = Ta(Umu*dSdU_mu)*factor; PokeIndex(dSdU, dSdU_mu, mu); } }; diff --git a/lib/qcd/action/pseudofermion/EvenOddSchurDifferentiable.h b/lib/qcd/action/pseudofermion/EvenOddSchurDifferentiable.h index 065d1a3b..6837bb19 100644 --- a/lib/qcd/action/pseudofermion/EvenOddSchurDifferentiable.h +++ b/lib/qcd/action/pseudofermion/EvenOddSchurDifferentiable.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/EvenOddSchurDifferentiable.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_EVEN_ODD_SCHUR_DIFFERENTIABLE_H #define QCD_EVEN_ODD_SCHUR_DIFFERENTIABLE_H diff --git a/lib/qcd/action/pseudofermion/OneFlavourEvenOddRational.h b/lib/qcd/action/pseudofermion/OneFlavourEvenOddRational.h index d257bd9e..d7d08516 100644 --- a/lib/qcd/action/pseudofermion/OneFlavourEvenOddRational.h +++ b/lib/qcd/action/pseudofermion/OneFlavourEvenOddRational.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/OneFlavourEvenOddRational.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_PSEUDOFERMION_ONE_FLAVOUR_EVEN_ODD_RATIONAL_H #define QCD_PSEUDOFERMION_ONE_FLAVOUR_EVEN_ODD_RATIONAL_H diff --git a/lib/qcd/action/pseudofermion/OneFlavourEvenOddRationalRatio.h b/lib/qcd/action/pseudofermion/OneFlavourEvenOddRationalRatio.h index 15366944..8c8bd7a7 100644 --- a/lib/qcd/action/pseudofermion/OneFlavourEvenOddRationalRatio.h +++ b/lib/qcd/action/pseudofermion/OneFlavourEvenOddRationalRatio.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/OneFlavourEvenOddRationalRatio.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_PSEUDOFERMION_ONE_FLAVOUR_EVEN_ODD_RATIONAL_RATIO_H #define QCD_PSEUDOFERMION_ONE_FLAVOUR_EVEN_ODD_RATIONAL_RATIO_H diff --git a/lib/qcd/action/pseudofermion/OneFlavourRational.h b/lib/qcd/action/pseudofermion/OneFlavourRational.h index 0c6ee41a..cb3a96d7 100644 --- a/lib/qcd/action/pseudofermion/OneFlavourRational.h +++ b/lib/qcd/action/pseudofermion/OneFlavourRational.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/OneFlavourRational.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_PSEUDOFERMION_ONE_FLAVOUR_RATIONAL_H #define QCD_PSEUDOFERMION_ONE_FLAVOUR_RATIONAL_H diff --git a/lib/qcd/action/pseudofermion/OneFlavourRationalRatio.h b/lib/qcd/action/pseudofermion/OneFlavourRationalRatio.h index 9e65c773..e6533d15 100644 --- a/lib/qcd/action/pseudofermion/OneFlavourRationalRatio.h +++ b/lib/qcd/action/pseudofermion/OneFlavourRationalRatio.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/OneFlavourRationalRatio.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_PSEUDOFERMION_ONE_FLAVOUR_RATIONAL_RATIO_H #define QCD_PSEUDOFERMION_ONE_FLAVOUR_RATIONAL_RATIO_H diff --git a/lib/qcd/action/pseudofermion/TwoFlavour.h b/lib/qcd/action/pseudofermion/TwoFlavour.h index 9e26b25b..433cf294 100644 --- a/lib/qcd/action/pseudofermion/TwoFlavour.h +++ b/lib/qcd/action/pseudofermion/TwoFlavour.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/TwoFlavour.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_H #define QCD_PSEUDOFERMION_TWO_FLAVOUR_H diff --git a/lib/qcd/action/pseudofermion/TwoFlavourEvenOdd.h b/lib/qcd/action/pseudofermion/TwoFlavourEvenOdd.h index 3ed7fdb4..e3ac2b2e 100644 --- a/lib/qcd/action/pseudofermion/TwoFlavourEvenOdd.h +++ b/lib/qcd/action/pseudofermion/TwoFlavourEvenOdd.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/TwoFlavourEvenOdd.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_EVEN_ODD_H #define QCD_PSEUDOFERMION_TWO_FLAVOUR_EVEN_ODD_H diff --git a/lib/qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h b/lib/qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h index b9e8187a..b1d73a7c 100644 --- a/lib/qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h +++ b/lib/qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/TwoFlavourEvenOddRatio.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_EVEN_ODD_RATIO_H #define QCD_PSEUDOFERMION_TWO_FLAVOUR_EVEN_ODD_RATIO_H @@ -61,6 +89,7 @@ namespace Grid{ FermionField tmp (NumOp.FermionRedBlackGrid()); gaussian(pRNG,eta); + pickCheckerboard(Even,etaEven,eta); pickCheckerboard(Odd,etaOdd,eta); @@ -72,6 +101,7 @@ namespace Grid{ // Odd det factors Mpc.MpcDag(etaOdd,PhiOdd); + tmp=zero; ActionSolver(Vpc,PhiOdd,tmp); Vpc.Mpc(tmp,PhiOdd); @@ -98,8 +128,8 @@ namespace Grid{ FermionField X(NumOp.FermionRedBlackGrid()); FermionField Y(NumOp.FermionRedBlackGrid()); - X=zero; Vpc.MpcDag(PhiOdd,Y); // Y= Vdag phi + X=zero; ActionSolver(Mpc,Y,X); // X= (MdagM)^-1 Vdag phi Mpc.Mpc(X,Y); // Y= Mdag^-1 Vdag phi @@ -134,12 +164,11 @@ namespace Grid{ GaugeField force(NumOp.GaugeGrid()); - X=zero; - //Y=Vdag phi //X = (Mdag M)^-1 V^dag phi //Y = (Mdag)^-1 V^dag phi Vpc.MpcDag(PhiOdd,Y); // Y= Vdag phi + X=zero; DerivativeSolver(Mpc,Y,X); // X= (MdagM)^-1 Vdag phi Mpc.Mpc(X,Y); // Y= Mdag^-1 Vdag phi diff --git a/lib/qcd/action/pseudofermion/TwoFlavourRatio.h b/lib/qcd/action/pseudofermion/TwoFlavourRatio.h index b1e8eab8..8a28f3b0 100644 --- a/lib/qcd/action/pseudofermion/TwoFlavourRatio.h +++ b/lib/qcd/action/pseudofermion/TwoFlavourRatio.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/TwoFlavourRatio.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_RATIO_H #define QCD_PSEUDOFERMION_TWO_FLAVOUR_RATIO_H @@ -58,6 +87,7 @@ namespace Grid{ MdagMLinearOperator ,FermionField> MdagMOp(NumOp); DenOp.Mdag(eta,Phi); // Mdag eta + tmp = zero; ActionSolver(MdagMOp,Phi,tmp); // (VdagV)^-1 Mdag eta = V^-1 Vdag^-1 Mdag eta NumOp.M(tmp,Phi); // Vdag^-1 Mdag eta @@ -78,8 +108,8 @@ namespace Grid{ MdagMLinearOperator ,FermionField> MdagMOp(DenOp); - X=zero; NumOp.Mdag(Phi,Y); // Y= Vdag phi + X=zero; ActionSolver(MdagMOp,Y,X); // X= (MdagM)^-1 Vdag phi DenOp.M(X,Y); // Y= Mdag^-1 Vdag phi @@ -105,12 +135,12 @@ namespace Grid{ GaugeField force(NumOp.GaugeGrid()); - X=zero; //Y=Vdag phi //X = (Mdag M)^-1 V^dag phi //Y = (Mdag)^-1 V^dag phi NumOp.Mdag(Phi,Y); // Y= Vdag phi + X=zero; DerivativeSolver(MdagMOp,Y,X); // X= (MdagM)^-1 Vdag phi DenOp.M(X,Y); // Y= Mdag^-1 Vdag phi diff --git a/lib/qcd/hmc/HMC.cc b/lib/qcd/hmc/HMC.cc index fe667991..3cb39111 100644 --- a/lib/qcd/hmc/HMC.cc +++ b/lib/qcd/hmc/HMC.cc @@ -1,21 +1,36 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/hmc/HMC.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid{ namespace QCD{ - HMCparameters::HMCparameters(){ - // FIXME fill this constructor now just default values - - ////////////////////////////// Default values - Nsweeps = 200; - TotalSweeps = 240; - ThermalizationSteps = 40; - StartingConfig = 0; - SaveInterval = 1; - Filename_prefix = "Conf_"; - ///////////////////////////////// - - } - } } diff --git a/lib/qcd/hmc/HMC.h b/lib/qcd/hmc/HMC.h index 84b355fa..9e762832 100644 --- a/lib/qcd/hmc/HMC.h +++ b/lib/qcd/hmc/HMC.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/hmc/HMC.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //-------------------------------------------------------------------- /*! @file HMC.h * @brief Classes for Hybrid Monte Carlo update @@ -17,16 +47,55 @@ namespace Grid{ struct HMCparameters{ - Integer Nsweeps; /* @brief Number of sweeps in this run */ - Integer TotalSweeps; /* @brief If provided, the total number of sweeps */ - Integer ThermalizationSteps; - Integer StartingConfig; - Integer SaveInterval; //Setting to 0 does not save configurations - std::string Filename_prefix; // To save configurations and rng seed - - HMCparameters(); + + Integer StartTrajectory; + Integer Trajectories; /* @brief Number of sweeps in this run */ + bool MetropolisTest; + Integer NoMetropolisUntil; + + HMCparameters(){ + ////////////////////////////// Default values + MetropolisTest = true; + NoMetropolisUntil = 10; + StartTrajectory = 0; + Trajectories = 200; + ///////////////////////////////// + } }; - + + template + class HmcObservable { + public: + virtual void TrajectoryComplete (int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG )=0; + }; + + template + class PlaquetteLogger : public HmcObservable { + private: + std::string Stem; + public: + INHERIT_GIMPL_TYPES(Gimpl); + PlaquetteLogger(std::string cf) { + Stem = cf; + }; + + void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG ) + { + std::string file; { std::ostringstream os; os << Stem <<"."<< traj; file = os.str(); } + std::ofstream of(file); + + RealD peri_plaq = WilsonLoops::avgPlaquette(U); + RealD peri_rect = WilsonLoops::avgRectangle(U); + + RealD impl_plaq = WilsonLoops::avgPlaquette(U); + RealD impl_rect = WilsonLoops::avgRectangle(U); + + of << traj<<" "<< impl_plaq << " " << impl_rect << " "<< peri_plaq<<" "< template class HybridMonteCarlo { @@ -34,10 +103,12 @@ namespace Grid{ const HMCparameters Params; - GridSerialRNG &sRNG; // Fixme: need a RNG management strategy. + GridSerialRNG &sRNG; // Fixme: need a RNG management strategy. GridParallelRNG &pRNG; // Fixme: need a RNG management strategy. + GaugeField & Ucur; IntegratorType &TheIntegrator; + std::vector *> Observables; ///////////////////////////////////////////////////////// // Metropolis step @@ -89,38 +160,46 @@ namespace Grid{ ///////////////////////////////////////// // Constructor ///////////////////////////////////////// - HybridMonteCarlo(HMCparameters Pms, IntegratorType &_Int, GridSerialRNG &_sRNG, GridParallelRNG &_pRNG ) : + HybridMonteCarlo(HMCparameters Pms, IntegratorType &_Int, GridSerialRNG &_sRNG, GridParallelRNG &_pRNG, GaugeField &_U ) : Params(Pms), TheIntegrator(_Int), sRNG(_sRNG), - pRNG(_pRNG) + pRNG(_pRNG), + Ucur(_U) { } ~HybridMonteCarlo(){}; + void AddObservable(HmcObservable *obs) { + Observables.push_back(obs); + } - void evolve(GaugeField& Uin){ + void evolve(void){ Real DeltaH; - - // Thermalizations - for(int iter=1; iter <= Params.ThermalizationSteps; ++iter){ - std::cout< Params.NoMetropolisUntil) { + accept = metropolis_test(DeltaH); + } + + if ( accept ) { + Ucur = Ucopy; + } + + for(int obs = 0;obsTrajectoryComplete (traj+1,Ucur,sRNG,pRNG); + } } } diff --git a/lib/qcd/hmc/HmcRunner.h b/lib/qcd/hmc/HmcRunner.h new file mode 100644 index 00000000..4d8bb2dd --- /dev/null +++ b/lib/qcd/hmc/HmcRunner.h @@ -0,0 +1,156 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/hmc/HmcRunner.h + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#ifndef HMC_RUNNER +#define HMC_RUNNER + +namespace Grid{ + namespace QCD{ + + +template +class NerscHmcRunnerTemplate { +public: + + INHERIT_GIMPL_TYPES(Gimpl); + + enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart }; + + ActionSet TheAction; + + GridCartesian * UGrid ; + GridCartesian * FGrid ; + GridRedBlackCartesian * UrbGrid ; + GridRedBlackCartesian * FrbGrid ; + + virtual void BuildTheAction (int argc, char **argv) = 0; + + + void Run (int argc, char **argv){ + + StartType_t StartType = HotStart; + + std::string arg; + + if( GridCmdOptionExists(argv,argv+argc,"--StartType") ){ + arg = GridCmdOptionPayload(argv,argv+argc,"--StartType"); + if ( arg == "HotStart" ) { StartType = HotStart; } + else if ( arg == "ColdStart" ) { StartType = ColdStart; } + else if ( arg == "TepidStart" ) { StartType = TepidStart; } + else if ( arg == "CheckpointStart" ) { StartType = CheckpointStart; } + else assert(0); + } + + int StartTraj = 0; + if( GridCmdOptionExists(argv,argv+argc,"--StartTrajectory") ){ + arg= GridCmdOptionPayload(argv,argv+argc,"--StartTrajectory"); + std::vector ivec(0); + GridCmdOptionIntVector(arg,ivec); + StartTraj = ivec[0]; + } + + int NumTraj = 1; + if( GridCmdOptionExists(argv,argv+argc,"--Trajectories") ){ + arg= GridCmdOptionPayload(argv,argv+argc,"--Trajectories"); + std::vector ivec(0); + GridCmdOptionIntVector(arg,ivec); + NumTraj = ivec[0]; + } + + // Create integrator + typedef MinimumNorm2 IntegratorType;// change here to change the algorithm + IntegratorParameters MDpar(20); + IntegratorType MDynamics(UGrid,MDpar, TheAction); + + // Checkpoint strategy + NerscHmcCheckpointer Checkpoint(std::string("ckpoint_lat"),std::string("ckpoint_rng"),1); + PlaquetteLogger PlaqLog(std::string("plaq")); + + HMCparameters HMCpar; + HMCpar.StartTrajectory = StartTraj; + HMCpar.Trajectories = NumTraj; + + GridSerialRNG sRNG; + GridParallelRNG pRNG(UGrid); + LatticeGaugeField U(UGrid); + + std::vector SerSeed({1,2,3,4,5}); + std::vector ParSeed({6,7,8,9,10}); + + if ( StartType == HotStart ) { + // Hot start + HMCpar.NoMetropolisUntil =0; + HMCpar.MetropolisTest = true; + sRNG.SeedFixedIntegers(SerSeed); + pRNG.SeedFixedIntegers(ParSeed); + SU3::HotConfiguration(pRNG, U); + } else if ( StartType == ColdStart ) { + // Cold start + HMCpar.NoMetropolisUntil =0; + HMCpar.MetropolisTest = true; + sRNG.SeedFixedIntegers(SerSeed); + pRNG.SeedFixedIntegers(ParSeed); + SU3::ColdConfiguration(pRNG, U); + } else if ( StartType == TepidStart ) { + // Tepid start + HMCpar.NoMetropolisUntil =0; + HMCpar.MetropolisTest = true; + sRNG.SeedFixedIntegers(SerSeed); + pRNG.SeedFixedIntegers(ParSeed); + SU3::TepidConfiguration(pRNG, U); + } else if ( StartType == CheckpointStart ) { + HMCpar.NoMetropolisUntil =0; + HMCpar.MetropolisTest = true; + // CheckpointRestart + Checkpoint.CheckpointRestore(StartTraj, U, sRNG, pRNG); + } + + HybridMonteCarlo HMC(HMCpar, MDynamics,sRNG,pRNG,U); + HMC.AddObservable(&Checkpoint); + HMC.AddObservable(&PlaqLog); + + // Run it + HMC.evolve(); + + } + +}; + + typedef NerscHmcRunnerTemplate NerscHmcRunner; + typedef NerscHmcRunnerTemplate NerscHmcRunnerF; + typedef NerscHmcRunnerTemplate NerscHmcRunnerD; + + typedef NerscHmcRunnerTemplate PeriodicNerscHmcRunner; + typedef NerscHmcRunnerTemplate PeriodicNerscHmcRunnerF; + typedef NerscHmcRunnerTemplate PeriodicNerscHmcRunnerD; + + typedef NerscHmcRunnerTemplate ConjugateNerscHmcRunner; + typedef NerscHmcRunnerTemplate ConjugateNerscHmcRunnerF; + typedef NerscHmcRunnerTemplate ConjugateNerscHmcRunnerD; + +}} +#endif diff --git a/lib/qcd/hmc/NerscCheckpointer.h b/lib/qcd/hmc/NerscCheckpointer.h new file mode 100644 index 00000000..2e368b2a --- /dev/null +++ b/lib/qcd/hmc/NerscCheckpointer.h @@ -0,0 +1,80 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/hmc/NerscCheckpointer.h + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#ifndef NERSC_CHECKPOINTER +#define NERSC_CHECKPOINTER + +#include +#include +#include + + +namespace Grid{ + namespace QCD{ + + + template + class NerscHmcCheckpointer : public HmcObservable { + private: + std::string configStem; + std::string rngStem; + int SaveInterval; + public: + INHERIT_GIMPL_TYPES(Gimpl); + + NerscHmcCheckpointer(std::string cf, std::string rn,int savemodulo) { + configStem = cf; + rngStem = rn; + SaveInterval= savemodulo; + }; + + void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG ) + { + if ( (traj % SaveInterval)== 0 ) { + std::string rng; { std::ostringstream os; os << rngStem <<"."<< traj; rng = os.str(); } + std::string config;{ std::ostringstream os; os << configStem <<"."<< traj; config = os.str();} + + int precision32=1; + int tworow =0; + NerscIO::writeRNGState(sRNG,pRNG,rng); + NerscIO::writeConfiguration(U,config,tworow,precision32); + } + }; + + void CheckpointRestore(int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG ){ + + std::string rng; { std::ostringstream os; os << rngStem <<"."<< traj; rng = os.str(); } + std::string config;{ std::ostringstream os; os << configStem <<"."<< traj; config = os.str();} + + NerscField header; + NerscIO::readRNGState(sRNG,pRNG,header,rng); + NerscIO::readConfiguration(U,header,config); + }; + + }; +}} +#endif diff --git a/lib/qcd/hmc/integrators/Integrator.h b/lib/qcd/hmc/integrators/Integrator.h index 67d6b17e..e6f6c1cd 100644 --- a/lib/qcd/hmc/integrators/Integrator.h +++ b/lib/qcd/hmc/integrators/Integrator.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/hmc/integrators/Integrator.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //-------------------------------------------------------------------- /*! @file Integrator.h * @brief Classes for the Molecular Dynamics integrator @@ -77,9 +107,7 @@ namespace Grid{ t_P[level]+=ep; update_P(P,U,level,ep); - std::cout< +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //-------------------------------------------------------------------- /*! @file Integrator_algorithm.h * @brief Declaration of classes for the Molecular Dynamics algorithms diff --git a/lib/qcd/spin/Dirac.cc b/lib/qcd/spin/Dirac.cc index 9514a2a6..51c06348 100644 --- a/lib/qcd/spin/Dirac.cc +++ b/lib/qcd/spin/Dirac.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/spin/Dirac.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { diff --git a/lib/qcd/spin/Dirac.h b/lib/qcd/spin/Dirac.h index 8eb1bcf0..8654b5a8 100644 --- a/lib/qcd/spin/Dirac.h +++ b/lib/qcd/spin/Dirac.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/spin/Dirac.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_DIRAC_H #define GRID_QCD_DIRAC_H namespace Grid{ diff --git a/lib/qcd/spin/TwoSpinor.h b/lib/qcd/spin/TwoSpinor.h index 2637baba..76cdbcf8 100644 --- a/lib/qcd/spin/TwoSpinor.h +++ b/lib/qcd/spin/TwoSpinor.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/spin/TwoSpinor.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_TWOSPIN_H #define GRID_QCD_TWOSPIN_H namespace Grid{ diff --git a/lib/qcd/utils/CovariantCshift.h b/lib/qcd/utils/CovariantCshift.h index e090f497..2f7561f8 100644 --- a/lib/qcd/utils/CovariantCshift.h +++ b/lib/qcd/utils/CovariantCshift.h @@ -1,23 +1,130 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/utils/CovariantCshift.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_UTILS_COVARIANT_CSHIFT_H #define QCD_UTILS_COVARIANT_CSHIFT_H + namespace Grid { namespace QCD { //////////////////////////////////////////////////////////////////////// // Low performance implementation of CovariantCshift API //////////////////////////////////////////////////////////////////////// -template Lattice CovShiftForward(const Lattice &Link, +// Make these members of an Impl class for BC's. + +namespace PeriodicBC { + + template Lattice CovShiftForward(const Lattice &Link, int mu, const Lattice &field) -{ - return Link*Cshift(field,mu,1);// moves towards negative mu + { + return Link*Cshift(field,mu,1);// moves towards negative mu + } + template Lattice CovShiftBackward(const Lattice &Link, + int mu, + const Lattice &field) + { + Lattice tmp(field._grid); + tmp = adj(Link)*field; + return Cshift(tmp,mu,-1);// moves towards positive mu + } } -template Lattice CovShiftBackward(const Lattice &Link, - int mu, - const Lattice &field) -{ - Lattice tmp(field._grid); - tmp = adj(Link)*field; - return Cshift(tmp,mu,-1);// moves towards positive mu + + +namespace ConjugateBC { + + // Must give right answers across boundary + // <---- + // -- + // | | + // xxxxxxxxxxxxxxxxxxxx + // | | + // + // Stap= Cshift(GImpl::CovShiftForward(U[nu],nu, + // GImpl::CovShiftForward(U[nu],nu, + // GImpl::CovShiftBackward(U[mu],mu, + // GImpl::CovShiftBackward(U[nu],nu, + // GImpl::CovShiftIdentityBackward(U[nu],nu,-1))))) , mu, 1); + // + // U U^* U^* U^T U^adj = U (U U U^dag U^T )^* + // = U (U U U^dag)^* ( U^T )^* + // + // So covariant shift rule: conjugate inward shifted plane when crossing boundary applies. + // + // This conjugate should be applied to BOTH the link and the covariant field on backward shift + // boundary wrap. + // + // | | + // xxxxxxxxxxxxxxxxx + // | | <---- this link is conjugated, and the path leading into it. Segment crossing in and out is double conjugated. + // -- + // -------> + template Lattice CovShiftForward(const Lattice &Link, + int mu, + const Lattice &field) + { + GridBase * grid = Link._grid; + + int Lmu = grid->GlobalDimensions()[mu]-1; + + conformable(field,Link); + + Lattice > coor(grid); LatticeCoordinate(coor,mu); + + Lattice field_bc = Cshift(field,mu,1);// moves towards negative mu; + + field_bc = where(coor==Lmu,conjugate(field_bc),field_bc); + // std::cout<<"Gparity::CovCshiftForward mu="< Lattice CovShiftBackward(const Lattice &Link, + int mu, + const Lattice &field) + { + GridBase * grid = field._grid; + + int Lmu = grid->GlobalDimensions()[mu]-1; + + conformable(field,Link); + + Lattice > coor(grid); LatticeCoordinate(coor,mu); + + Lattice tmp(grid); + + tmp = adj(Link)*field; + tmp = where(coor==Lmu,conjugate(tmp),tmp); + // std::cout<<"Gparity::CovCshiftBackward mu="< +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_LINALG_UTILS_H #define GRID_QCD_LINALG_UTILS_H @@ -9,6 +38,25 @@ namespace QCD{ //These routines support five-D chiral fermions and contain s-subslice indexing //on the 5d (rb4d) checkerboarded lattices //////////////////////////////////////////////////////////////////////// + +template +void axpibg5x(Lattice &z,const Lattice &x,RealD a,RealD b) +{ + z.checkerboard = x.checkerboard; + conformable(x,z); + + GridBase *grid=x._grid; + + Gamma G5(Gamma::Gamma5); +PARALLEL_FOR_LOOP + for(int ss=0;ssoSites();ss++){ + vobj tmp; + tmp = a*x._odata[ss]; + tmp = tmp + G5*(b*timesI(x._odata[ss])); + vstream(z._odata[ss],tmp); + } +} + template void axpby_ssp(Lattice &z, RealD a,const Lattice &x,RealD b,const Lattice &y,int s,int sp) { diff --git a/lib/qcd/utils/SUn.h b/lib/qcd/utils/SUn.h index 4be60e75..1214d40a 100644 --- a/lib/qcd/utils/SUn.h +++ b/lib/qcd/utils/SUn.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/utils/SUn.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_UTIL_SUN_H #define QCD_UTIL_SUN_H diff --git a/lib/qcd/utils/SpaceTimeGrid.cc b/lib/qcd/utils/SpaceTimeGrid.cc index 284c5771..0b8c2a94 100644 --- a/lib/qcd/utils/SpaceTimeGrid.cc +++ b/lib/qcd/utils/SpaceTimeGrid.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/utils/SpaceTimeGrid.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { diff --git a/lib/qcd/utils/SpaceTimeGrid.h b/lib/qcd/utils/SpaceTimeGrid.h index 0b386a0e..94862ca2 100644 --- a/lib/qcd/utils/SpaceTimeGrid.h +++ b/lib/qcd/utils/SpaceTimeGrid.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/utils/SpaceTimeGrid.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_QCD_SPACE_TIME_GRID_H #define GRID_QCD_SPACE_TIME_GRID_H namespace Grid { diff --git a/lib/qcd/utils/WilsonLoops.h b/lib/qcd/utils/WilsonLoops.h index b166cdc8..bab6dec9 100644 --- a/lib/qcd/utils/WilsonLoops.h +++ b/lib/qcd/utils/WilsonLoops.h @@ -1,21 +1,60 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/utils/WilsonLoops.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef QCD_UTILS_WILSON_LOOPS_H #define QCD_UTILS_WILSON_LOOPS_H namespace Grid { namespace QCD { // Common wilson loop observables -template -class WilsonLoops { +template +class WilsonLoops : public Gimpl { public: + + INHERIT_GIMPL_TYPES(Gimpl); - typedef LorentzScalar GaugeMat; + typedef typename Gimpl::GaugeLinkField GaugeMat; + typedef typename Gimpl::GaugeField GaugeLorentz; ////////////////////////////////////////////////// // directed plaquette oriented in mu,nu plane ////////////////////////////////////////////////// static void dirPlaquette(GaugeMat &plaq,const std::vector &U, const int mu, const int nu) { - plaq=CovShiftForward(U[mu],mu,U[nu])*adj(CovShiftForward(U[nu],nu,U[mu])); + // Annoyingly, must use either scope resolution to find dependent base class, + // or this-> ; there is no "this" in a static method. This forces explicit Gimpl scope + // resolution throughout the usage in this file, and rather defeats the purpose of deriving + // from Gimpl. + plaq= Gimpl::CovShiftBackward(U[mu],mu, + Gimpl::CovShiftBackward(U[nu],nu, + Gimpl::CovShiftForward (U[mu],mu,U[nu]))); } ////////////////////////////////////////////////// // trace of directed plaquette oriented in mu,nu plane @@ -98,34 +137,36 @@ public: for(int d=0;d(Umu,d); } - staple = zero; GaugeMat tmp(grid); + for(int nu=0;nu nu - // __ __ - // | | - // __| = __| * + // __ + // | + // __| // - staple += CovShiftForward(U[nu],nu,U[mu])*Cshift(adj(U[nu]),mu,+1); + staple+=Gimpl::ShiftStaple( + Gimpl::CovShiftForward (U[nu],nu, + Gimpl::CovShiftBackward(U[mu],mu, + Gimpl::CovShiftIdentityBackward(U[nu],nu))),mu); - // - // __ __ - // | | - // |__ = | * __ + // __ + // | + // |__ // // - tmp = CovShiftForward (U[mu],mu,U[nu]); - staple+= CovShiftBackward(U[nu],nu,tmp); - + staple+=Gimpl::ShiftStaple( + Gimpl::CovShiftBackward(U[nu],nu, + Gimpl::CovShiftBackward(U[mu],mu,U[nu])),mu); } } } @@ -133,21 +174,241 @@ public: ////////////////////////////////////////////////////// // Similar to above for rectangle is required ////////////////////////////////////////////////////// - /* -void siteRectangle(GaugeMat &plaq,const std::vector &U, const int mu, const int nu){ -RealD avgRectangle(const std::vector &U){} -RealD avgRectangle(const std::vector &U, const int mu, const int nu){} -void traceRectangle(LatticeComplex &plaq,const std::vector &U, const int mu, const int nu){} -void siteRectangle(GaugeMat &plaq,const std::vector &U, const int mu, const int nu){} - */ + static void dirRectangle(GaugeMat &rect,const std::vector &U, const int mu, const int nu) + { + rect = Gimpl::CovShiftForward(U[mu],mu,Gimpl::CovShiftForward(U[mu],mu,U[nu]))* // ->->| + adj(Gimpl::CovShiftForward(U[nu],nu,Gimpl::CovShiftForward(U[mu],mu,U[mu]))) ; + rect = rect + + Gimpl::CovShiftForward(U[mu],mu,Gimpl::CovShiftForward(U[nu],nu,U[nu]))* // ->|| + adj(Gimpl::CovShiftForward(U[nu],nu,Gimpl::CovShiftForward(U[nu],nu,U[mu]))) ; + } + static void traceDirRectangle(LatticeComplex &rect, const std::vector &U, const int mu, const int nu) + { + GaugeMat sp(U[0]._grid); + dirRectangle(sp,U,mu,nu); + rect=trace(sp); + } + static void siteRectangle(LatticeComplex &Rect,const std::vector &U) + { + LatticeComplex siteRect(U[0]._grid); + Rect=zero; + for(int mu=1;mu U(4,Umu._grid); + + for(int mu=0;mu(Umu,mu); + } + + LatticeComplex Rect(Umu._grid); + + siteRectangle(Rect,U); + + TComplex Tp = sum(Rect); + Complex p = TensorRemove(Tp); + return p.real(); + } + ////////////////////////////////////////////////// + // average over all x,y,z,t and over all planes of plaquette + ////////////////////////////////////////////////// + static RealD avgRectangle(const GaugeLorentz &Umu){ + + RealD sumrect = sumRectangle(Umu); + + double vol = Umu._grid->gSites(); + + double faces = (1.0*Nd*(Nd-1)); // 2 distinct orientations summed + + return sumrect/vol/faces/Nc; // Nd , Nc dependent... FIXME + } + + ////////////////////////////////////////////////// + // the sum over all staples on each site + ////////////////////////////////////////////////// + static void RectStapleDouble(GaugeMat &U2,const GaugeMat & U,int mu){ + U2 = U * Cshift(U,mu,1); + } + + //////////////////////////////////////////////////////////////////////////// + // Hop by two optimisation strategy does not work nicely with Gparity. (could do, + // but need to track two deep where cross boundary and apply a conjugation). + // Must differentiate this in Gimpl, and use Gimpl::isPeriodicGaugeField to do so . + //////////////////////////////////////////////////////////////////////////// + static void RectStapleOptimised(GaugeMat &Stap,std::vector &U2,std::vector &U,int mu){ + + Stap = zero; + + GridBase *grid = U[0]._grid; + + GaugeMat Staple2x1 (grid); + GaugeMat tmp (grid); + + for(int nu=0;nu &U2, + std::vector &U, int mu) + { + if ( Gimpl::isPeriodicGaugeField() ){ + RectStapleOptimised(Stap,U2,U,mu); + } else { + RectStapleUnoptimised(Stap,Umu,mu); + } + } + + static void RectStapleUnoptimised(GaugeMat &Stap,const GaugeLorentz &Umu,int mu){ + GridBase *grid = Umu._grid; + + std::vector U(4,grid); + for(int d=0;d(Umu,d); + } + + Stap=zero; + + for(int nu=0;nu ColourWilsonLoops; - typedef WilsonLoops U1WilsonLoops; - typedef WilsonLoops SU2WilsonLoops; - typedef WilsonLoops SU3WilsonLoops; + typedef WilsonLoops ColourWilsonLoops; + typedef WilsonLoops U1WilsonLoops; + typedef WilsonLoops SU2WilsonLoops; + typedef WilsonLoops SU3WilsonLoops; }} diff --git a/lib/serialisation/BaseIO.h b/lib/serialisation/BaseIO.h index 60e3e3af..b89d27ad 100644 --- a/lib/serialisation/BaseIO.h +++ b/lib/serialisation/BaseIO.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/serialisation/BaseIO.h + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_SERIALISATION_ABSTRACT_READER_H #define GRID_SERIALISATION_ABSTRACT_READER_H diff --git a/lib/serialisation/BinaryIO.cc b/lib/serialisation/BinaryIO.cc index 250285e5..ae0b0744 100644 --- a/lib/serialisation/BinaryIO.cc +++ b/lib/serialisation/BinaryIO.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/serialisation/BinaryIO.cc + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace Grid; diff --git a/lib/serialisation/BinaryIO.h b/lib/serialisation/BinaryIO.h index f0cfb941..8f91804a 100644 --- a/lib/serialisation/BinaryIO.h +++ b/lib/serialisation/BinaryIO.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/serialisation/BinaryIO.h + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_SERIALISATION_BINARY_READER_H #define GRID_SERIALISATION_BINARY_READER_H diff --git a/lib/serialisation/Serialisation.h b/lib/serialisation/Serialisation.h index 31e71779..0972afb5 100644 --- a/lib/serialisation/Serialisation.h +++ b/lib/serialisation/Serialisation.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/serialisation/Serialisation.h + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_SERIALISATION_READER_H #define GRID_SERIALISATION_READER_H diff --git a/lib/serialisation/TextIO.cc b/lib/serialisation/TextIO.cc index a1caa8db..39b987d0 100644 --- a/lib/serialisation/TextIO.cc +++ b/lib/serialisation/TextIO.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/serialisation/TextIO.cc + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace Grid; diff --git a/lib/serialisation/TextIO.h b/lib/serialisation/TextIO.h index a60931d1..069d898b 100644 --- a/lib/serialisation/TextIO.h +++ b/lib/serialisation/TextIO.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/serialisation/TextIO.h + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_SERIALISATION_TEXT_READER_H #define GRID_SERIALISATION_TEXT_READER_H diff --git a/lib/serialisation/XmlIO.cc b/lib/serialisation/XmlIO.cc index 8dd93de7..f8bbd3cb 100644 --- a/lib/serialisation/XmlIO.cc +++ b/lib/serialisation/XmlIO.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/serialisation/XmlIO.cc + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace Grid; diff --git a/lib/serialisation/XmlIO.h b/lib/serialisation/XmlIO.h index 15bb0206..46c3bee8 100644 --- a/lib/serialisation/XmlIO.h +++ b/lib/serialisation/XmlIO.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/serialisation/XmlIO.h + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_SERIALISATION_XML_READER_H #define GRID_SERIALISATION_XML_READER_H diff --git a/lib/simd/Avx512Asm.h b/lib/simd/Avx512Asm.h index 479c0332..c0569c1f 100644 --- a/lib/simd/Avx512Asm.h +++ b/lib/simd/Avx512Asm.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Avx512Asm.h + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_ASM_AV512_H #define GRID_ASM_AV512_H diff --git a/lib/simd/Grid_avx.h b/lib/simd/Grid_avx.h index e264639e..b836e757 100644 --- a/lib/simd/Grid_avx.h +++ b/lib/simd/Grid_avx.h @@ -1,3 +1,34 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Grid_avx.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Guido Cossu +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //---------------------------------------------------------------------- /*! @file Grid_avx.h @brief Optimization libraries for AVX1/2 instructions set diff --git a/lib/simd/Grid_avx512.h b/lib/simd/Grid_avx512.h index 92bbb20f..12a168ef 100644 --- a/lib/simd/Grid_avx512.h +++ b/lib/simd/Grid_avx512.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Grid_avx512.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //---------------------------------------------------------------------- /*! @file Grid_knc.h @brief Optimization libraries for AVX512 instructions set for KNC diff --git a/lib/simd/Grid_empty.h b/lib/simd/Grid_empty.h index b7d3da68..881ed241 100644 --- a/lib/simd/Grid_empty.h +++ b/lib/simd/Grid_empty.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Grid_empty.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //---------------------------------------------------------------------- /*! @file Grid_sse4.h @brief Empty Optimization libraries for debugging diff --git a/lib/simd/Grid_imci.h b/lib/simd/Grid_imci.h index 5a70c8f1..044c5cb4 100644 --- a/lib/simd/Grid_imci.h +++ b/lib/simd/Grid_imci.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Grid_imci.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //---------------------------------------------------------------------- /*! @file Grid_knc.h @brief Optimization libraries for AVX512 instructions set for KNC diff --git a/lib/simd/Grid_neon.h b/lib/simd/Grid_neon.h index 0297671b..7c1ad443 100644 --- a/lib/simd/Grid_neon.h +++ b/lib/simd/Grid_neon.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Grid_neon.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //---------------------------------------------------------------------- /*! @file Grid_sse4.h @brief Optimization libraries for NEON (ARM) instructions set ARMv8 diff --git a/lib/simd/Grid_qpx.h b/lib/simd/Grid_qpx.h index 2bd5a20e..10ac3841 100644 --- a/lib/simd/Grid_qpx.h +++ b/lib/simd/Grid_qpx.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Grid_qpx.h + + Copyright (C) 2015 + +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //---------------------------------------------------------------------- /*! @file Grid_qpx.h @brief Optimization libraries for QPX instructions set for BG/Q diff --git a/lib/simd/Grid_sse4.h b/lib/simd/Grid_sse4.h index 7c709a18..daf7b6e2 100644 --- a/lib/simd/Grid_sse4.h +++ b/lib/simd/Grid_sse4.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Grid_sse4.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //---------------------------------------------------------------------- /*! @file Grid_sse4.h @brief Optimization libraries for SSE4 instructions set @@ -9,6 +38,7 @@ #include +namespace Grid { namespace Optimization { template @@ -173,11 +203,11 @@ namespace Optimization { struct Mult{ inline void mac(__m128 &a, __m128 b, __m128 c){ - a= _mm128_add_ps(_mm128_mul_ps(b,c),a); + a= _mm_add_ps(_mm_mul_ps(b,c),a); } inline void mac(__m128d &a, __m128d b, __m128d c){ - a= _mm128_add_pd(_mm128_mul_pd(b,c),a); + a= _mm_add_pd(_mm_mul_pd(b,c),a); } // Real float @@ -318,7 +348,6 @@ namespace Optimization { ////////////////////////////////////////////////////////////////////////////////////// // Here assign types -namespace Grid { typedef __m128 SIMD_Ftype; // Single precision type typedef __m128d SIMD_Dtype; // Double precision type diff --git a/lib/simd/Grid_vector_types.h b/lib/simd/Grid_vector_types.h index baf8b2c3..c247f15d 100644 --- a/lib/simd/Grid_vector_types.h +++ b/lib/simd/Grid_vector_types.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Grid_vector_types.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Guido Cossu +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ //--------------------------------------------------------------------------- /*! @file Grid_vector_types.h @brief Defines templated class Grid_simd to deal with inner vector types diff --git a/lib/simd/Grid_vector_unops.h b/lib/simd/Grid_vector_unops.h index 540a54f5..dd523817 100644 --- a/lib/simd/Grid_vector_unops.h +++ b/lib/simd/Grid_vector_unops.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/simd/Grid_vector_unops.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_VECTOR_UNOPS #define GRID_VECTOR_UNOPS diff --git a/lib/stencil/Lebesgue.cc b/lib/stencil/Lebesgue.cc index abc6ccb8..12da8ab2 100644 --- a/lib/stencil/Lebesgue.cc +++ b/lib/stencil/Lebesgue.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/stencil/Lebesgue.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include diff --git a/lib/stencil/Lebesgue.h b/lib/stencil/Lebesgue.h index f8905209..f69b089d 100644 --- a/lib/stencil/Lebesgue.h +++ b/lib/stencil/Lebesgue.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/stencil/Lebesgue.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_LEBESGUE_H #define GRID_LEBESGUE_H diff --git a/lib/stencil/Stencil_common.cc b/lib/stencil/Stencil_common.cc index c00d1a8f..af4e23fd 100644 --- a/lib/stencil/Stencil_common.cc +++ b/lib/stencil/Stencil_common.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/stencil/Stencil_common.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include "Grid.h" namespace Grid { diff --git a/lib/tensors/Tensor_Ta.h b/lib/tensors/Tensor_Ta.h index e71e54fd..45a2257f 100644 --- a/lib/tensors/Tensor_Ta.h +++ b/lib/tensors/Tensor_Ta.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_Ta.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_TA_H #define GRID_MATH_TA_H diff --git a/lib/tensors/Tensor_arith.h b/lib/tensors/Tensor_arith.h index 853a19a5..162589da 100644 --- a/lib/tensors/Tensor_arith.h +++ b/lib/tensors/Tensor_arith.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_arith.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_ARITH_H #define GRID_MATH_ARITH_H diff --git a/lib/tensors/Tensor_arith_add.h b/lib/tensors/Tensor_arith_add.h index 66d5879f..6e01fb19 100644 --- a/lib/tensors/Tensor_arith_add.h +++ b/lib/tensors/Tensor_arith_add.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_arith_add.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_ARITH_ADD_H #define GRID_MATH_ARITH_ADD_H diff --git a/lib/tensors/Tensor_arith_mac.h b/lib/tensors/Tensor_arith_mac.h index 06b1661d..c053224b 100644 --- a/lib/tensors/Tensor_arith_mac.h +++ b/lib/tensors/Tensor_arith_mac.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_arith_mac.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_ARITH_MAC_H #define GRID_MATH_ARITH_MAC_H diff --git a/lib/tensors/Tensor_arith_mul.h b/lib/tensors/Tensor_arith_mul.h index fcdd60ee..917f7373 100644 --- a/lib/tensors/Tensor_arith_mul.h +++ b/lib/tensors/Tensor_arith_mul.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_arith_mul.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_ARITH_MUL_H #define GRID_MATH_ARITH_MUL_H diff --git a/lib/tensors/Tensor_arith_scalar.h b/lib/tensors/Tensor_arith_scalar.h index 5999f935..d1087570 100644 --- a/lib/tensors/Tensor_arith_scalar.h +++ b/lib/tensors/Tensor_arith_scalar.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_arith_scalar.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_ARITH_SCALAR_H #define GRID_MATH_ARITH_SCALAR_H diff --git a/lib/tensors/Tensor_arith_sub.h b/lib/tensors/Tensor_arith_sub.h index b7a5a54d..8646bdfb 100644 --- a/lib/tensors/Tensor_arith_sub.h +++ b/lib/tensors/Tensor_arith_sub.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_arith_sub.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_ARITH_SUB_H #define GRID_MATH_ARITH_SUB_H diff --git a/lib/tensors/Tensor_class.h b/lib/tensors/Tensor_class.h index bed4b11b..3d9c4366 100644 --- a/lib/tensors/Tensor_class.h +++ b/lib/tensors/Tensor_class.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_class.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_TENSORS_H #define GRID_MATH_TENSORS_H diff --git a/lib/tensors/Tensor_determinant.h b/lib/tensors/Tensor_determinant.h index 7c8af9ed..a58a8074 100644 --- a/lib/tensors/Tensor_determinant.h +++ b/lib/tensors/Tensor_determinant.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_determinant.h + + Copyright (C) 2015 + +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_DET_H #define GRID_MATH_DET_H namespace Grid { diff --git a/lib/tensors/Tensor_exp.h b/lib/tensors/Tensor_exp.h index 6a514330..058e524d 100644 --- a/lib/tensors/Tensor_exp.h +++ b/lib/tensors/Tensor_exp.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_exp.h + + Copyright (C) 2015 + +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_EXP_H #define GRID_MATH_EXP_H diff --git a/lib/tensors/Tensor_extract_merge.h b/lib/tensors/Tensor_extract_merge.h index 530d56e4..e10c666c 100644 --- a/lib/tensors/Tensor_extract_merge.h +++ b/lib/tensors/Tensor_extract_merge.h @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_extract_merge.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_EXTRACT_H #define GRID_EXTRACT_H ///////////////////////////////////////////////////////////////// @@ -176,6 +206,8 @@ void merge(vobj &vec,std::vector &extracted,int scalar_type *pointer; scalar_type *vp = (scalar_type *)&vec; + // assert( (((uint64_t)vp)&(sizeof(scalar_type)-1)) == 0); + for(int w=0;w + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_TENSOR_INDEX_H #define GRID_TENSOR_INDEX_H diff --git a/lib/tensors/Tensor_inner.h b/lib/tensors/Tensor_inner.h index c77adff1..22284be4 100644 --- a/lib/tensors/Tensor_inner.h +++ b/lib/tensors/Tensor_inner.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_inner.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_INNER_H #define GRID_MATH_INNER_H namespace Grid { diff --git a/lib/tensors/Tensor_logical.h b/lib/tensors/Tensor_logical.h index 5ded9f9c..7ab3668b 100644 --- a/lib/tensors/Tensor_logical.h +++ b/lib/tensors/Tensor_logical.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_logical.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_TENSOR_LOGICAL_H #define GRID_TENSOR_LOGICAL_H diff --git a/lib/tensors/Tensor_outer.h b/lib/tensors/Tensor_outer.h index d0150709..896fb8ed 100644 --- a/lib/tensors/Tensor_outer.h +++ b/lib/tensors/Tensor_outer.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_outer.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_OUTER_H #define GRID_MATH_OUTER_H namespace Grid { diff --git a/lib/tensors/Tensor_reality.h b/lib/tensors/Tensor_reality.h index c35a8630..8a183b88 100644 --- a/lib/tensors/Tensor_reality.h +++ b/lib/tensors/Tensor_reality.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_reality.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_REALITY_H #define GRID_MATH_REALITY_H namespace Grid { diff --git a/lib/tensors/Tensor_trace.h b/lib/tensors/Tensor_trace.h index bd75bb91..1bab2a4e 100644 --- a/lib/tensors/Tensor_trace.h +++ b/lib/tensors/Tensor_trace.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_trace.h + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_TRACE_H #define GRID_MATH_TRACE_H namespace Grid { diff --git a/lib/tensors/Tensor_traits.h b/lib/tensors/Tensor_traits.h index a7d51b0e..d8855865 100644 --- a/lib/tensors/Tensor_traits.h +++ b/lib/tensors/Tensor_traits.h @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_traits.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_TRAITS_H #define GRID_MATH_TRAITS_H diff --git a/lib/tensors/Tensor_transpose.h b/lib/tensors/Tensor_transpose.h index 3798f4bf..c12d4f09 100644 --- a/lib/tensors/Tensor_transpose.h +++ b/lib/tensors/Tensor_transpose.h @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_transpose.h + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_MATH_TRANSPOSE_H #define GRID_MATH_TRANSPOSE_H namespace Grid { diff --git a/lib/tensors/Tensor_unary.h b/lib/tensors/Tensor_unary.h index d2c3fae4..1e1f09c0 100644 --- a/lib/tensors/Tensor_unary.h +++ b/lib/tensors/Tensor_unary.h @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/tensors/Tensor_unary.h + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #ifndef GRID_TENSOR_UNARY_H #define GRID_TENSOR_UNARY_H namespace Grid { diff --git a/scripts/copyright b/scripts/copyright new file mode 100755 index 00000000..76ed6603 --- /dev/null +++ b/scripts/copyright @@ -0,0 +1,49 @@ +#!/bin/bash + +while (( "$#" )); do + +echo $1 + +cat > message <> message + +cat >> message < tmp.fil +cat $1 >> tmp.fil +cp tmp.fil $1 + +shift + +done + + diff --git a/scripts/hmc.sh b/scripts/hmc.sh index 24c4b7f9..c2cd6593 100755 --- a/scripts/hmc.sh +++ b/scripts/hmc.sh @@ -24,7 +24,7 @@ echo "Acceptance $PACC % $ACC / $TRAJ " grep Plaq $LOG | awk '{ print $10 }' | uniq > plaq.dat grep dH $LOG | awk '{ print $10 }' > dH.dat -echo set yrange [-0.1:0.6] > plot.gnu +echo set yrange [-0.2:1.0] > plot.gnu echo set terminal 'pdf' >> plot.gnu echo "set output 'plaq.${LOG}.pdf'" >> plot.gnu echo "plot 'plaq.dat' w l, 'dH.dat' w l " >> plot.gnu diff --git a/scripts/substitute b/scripts/substitute index d5a29c60..2c895413 100755 --- a/scripts/substitute +++ b/scripts/substitute @@ -14,4 +14,4 @@ sed -e "s@${WAS}@${IS}@g" -i .bak $1 shift -done \ No newline at end of file +done diff --git a/tests/Make.inc b/tests/Make.inc index a302effb..f7c83671 100644 --- a/tests/Make.inc +++ b/tests/Make.inc @@ -1,11 +1,15 @@ -bin_PROGRAMS = Test_GaugeAction Test_cayley_cg Test_cayley_coarsen_support Test_cayley_even_odd Test_cayley_ldop_cr Test_cf_coarsen_support Test_cf_cr_unprec Test_cheby Test_contfrac_cg Test_contfrac_even_odd Test_contfrac_force Test_cshift Test_cshift_red_black Test_dwf_cg_prec Test_dwf_cg_schur Test_dwf_cg_unprec Test_dwf_cr_unprec Test_dwf_even_odd Test_dwf_force Test_dwf_fpgcr Test_dwf_gpforce Test_dwf_hdcr Test_dwf_lanczos Test_gamma Test_gparity Test_gpdwf_force Test_gpwilson_even_odd Test_hmc_EODWFRatio Test_hmc_EODWFRatio_Gparity Test_hmc_EOWilsonFermionGauge Test_hmc_EOWilsonRatio Test_hmc_WilsonFermionGauge Test_hmc_WilsonGauge Test_hmc_WilsonRatio Test_lie_generators Test_main Test_multishift_sqrt Test_nersc_io Test_partfrac_force Test_quenched_update Test_remez Test_rhmc_EOWilson1p1 Test_rhmc_EOWilsonRatio Test_rhmc_Wilson1p1 Test_rhmc_WilsonRatio Test_rng Test_rng_fixed Test_serialisation Test_simd Test_stencil Test_synthetic_lanczos Test_wilson_cg_prec Test_wilson_cg_schur Test_wilson_cg_unprec Test_wilson_cr_unprec Test_wilson_even_odd Test_wilson_force Test_wilson_force_phiMdagMphi Test_wilson_force_phiMphi +bin_PROGRAMS = Test_GaugeAction Test_RectPlaq Test_cayley_cg Test_cayley_coarsen_support Test_cayley_even_odd Test_cayley_ldop_cr Test_cf_coarsen_support Test_cf_cr_unprec Test_cheby Test_contfrac_cg Test_contfrac_even_odd Test_contfrac_force Test_cshift Test_cshift_red_black Test_dwf_cg_prec Test_dwf_cg_schur Test_dwf_cg_unprec Test_dwf_cr_unprec Test_dwf_even_odd Test_dwf_force Test_dwf_fpgcr Test_dwf_gpforce Test_dwf_hdcr Test_dwf_lanczos Test_gamma Test_gp_rect_force Test_gparity Test_gpdwf_force Test_gpwilson_even_odd Test_hmc_EODWFRatio Test_hmc_EODWFRatio_Gparity Test_hmc_EOWilsonFermionGauge Test_hmc_EOWilsonRatio Test_hmc_GparityIwasakiGauge Test_hmc_GparityWilsonGauge Test_hmc_IwasakiGauge Test_hmc_RectGauge Test_hmc_WilsonFermionGauge Test_hmc_WilsonGauge Test_hmc_WilsonRatio Test_lie_generators Test_main Test_multishift_sqrt Test_nersc_io Test_partfrac_force Test_quenched_update Test_rect_force Test_remez Test_rhmc_EOWilson1p1 Test_rhmc_EOWilsonRatio Test_rhmc_Wilson1p1 Test_rhmc_WilsonRatio Test_rng Test_rng_fixed Test_serialisation Test_simd Test_stencil Test_synthetic_lanczos Test_wilson_cg_prec Test_wilson_cg_schur Test_wilson_cg_unprec Test_wilson_cr_unprec Test_wilson_even_odd Test_wilson_force Test_wilson_force_phiMdagMphi Test_wilson_force_phiMphi Test_wilson_tm_even_odd Test_GaugeAction_SOURCES=Test_GaugeAction.cc Test_GaugeAction_LDADD=-lGrid +Test_RectPlaq_SOURCES=Test_RectPlaq.cc +Test_RectPlaq_LDADD=-lGrid + + Test_cayley_cg_SOURCES=Test_cayley_cg.cc Test_cayley_cg_LDADD=-lGrid @@ -98,6 +102,10 @@ Test_gamma_SOURCES=Test_gamma.cc Test_gamma_LDADD=-lGrid +Test_gp_rect_force_SOURCES=Test_gp_rect_force.cc +Test_gp_rect_force_LDADD=-lGrid + + Test_gparity_SOURCES=Test_gparity.cc Test_gparity_LDADD=-lGrid @@ -126,6 +134,22 @@ Test_hmc_EOWilsonRatio_SOURCES=Test_hmc_EOWilsonRatio.cc Test_hmc_EOWilsonRatio_LDADD=-lGrid +Test_hmc_GparityIwasakiGauge_SOURCES=Test_hmc_GparityIwasakiGauge.cc +Test_hmc_GparityIwasakiGauge_LDADD=-lGrid + + +Test_hmc_GparityWilsonGauge_SOURCES=Test_hmc_GparityWilsonGauge.cc +Test_hmc_GparityWilsonGauge_LDADD=-lGrid + + +Test_hmc_IwasakiGauge_SOURCES=Test_hmc_IwasakiGauge.cc +Test_hmc_IwasakiGauge_LDADD=-lGrid + + +Test_hmc_RectGauge_SOURCES=Test_hmc_RectGauge.cc +Test_hmc_RectGauge_LDADD=-lGrid + + Test_hmc_WilsonFermionGauge_SOURCES=Test_hmc_WilsonFermionGauge.cc Test_hmc_WilsonFermionGauge_LDADD=-lGrid @@ -162,6 +186,10 @@ Test_quenched_update_SOURCES=Test_quenched_update.cc Test_quenched_update_LDADD=-lGrid +Test_rect_force_SOURCES=Test_rect_force.cc +Test_rect_force_LDADD=-lGrid + + Test_remez_SOURCES=Test_remez.cc Test_remez_LDADD=-lGrid @@ -238,6 +266,10 @@ Test_wilson_force_phiMphi_SOURCES=Test_wilson_force_phiMphi.cc Test_wilson_force_phiMphi_LDADD=-lGrid +Test_wilson_tm_even_odd_SOURCES=Test_wilson_tm_even_odd.cc +Test_wilson_tm_even_odd_LDADD=-lGrid + + Test_zmm_SOURCES=Test_zmm.cc Test_zmm_LDADD=-lGrid diff --git a/tests/Test_GaugeAction.cc b/tests/Test_GaugeAction.cc index 4533ffe6..76605f92 100644 --- a/tests/Test_GaugeAction.cc +++ b/tests/Test_GaugeAction.cc @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_GaugeAction.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include @@ -87,7 +116,7 @@ int main (int argc, char ** argv) Plaq = zero; for(int mu=1;mu +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include + +#include +#include + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + + +/* For Metropolis */ +class Metropolis { +public: + GridSerialRNG & sRNG; + Metropolis(GridSerialRNG & _sRNG) : sRNG(_sRNG) {}; + bool AcceptReject(const RealD Delta) + { + RealD rand; + + if(Delta <=0.0) return true; + + random(sRNG,rand); + if(rand <= exp(-Delta)) + return true; + else + return false; + } +}; + +void RectPlaq(const std::vector &U, LatticeComplex &RectPlaqValue ) +{ + RectPlaqValue=zero; + // 12 * vol loops + for(int mu=1;mu->| + adj(PeriodicBC::CovShiftForward(U[nu],nu,PeriodicBC::CovShiftForward(U[mu],mu,U[mu]))) ); + RectPlaqValue = RectPlaqValue + trace( + PeriodicBC::CovShiftForward(U[mu],mu,PeriodicBC::CovShiftForward(U[nu],nu,U[nu]))* // ->|| + adj(PeriodicBC::CovShiftForward(U[nu],nu,PeriodicBC::CovShiftForward(U[nu],nu,U[mu]))) ); + } + } +} + +void RectPlaqDeriv(const std::vector &U, LatticeComplex &RectPlaqValue ) +{ + +} +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); + std::vector mpi_layout = GridDefaultMpi(); + std::vector latt_size ({16,16,16,32}); + std::vector clatt_size ({4,4,4,8}); + int orthodir=3; + int orthosz =latt_size[orthodir]; + + GridCartesian Fine(latt_size,simd_layout,mpi_layout); + GridCartesian Coarse(clatt_size,simd_layout,mpi_layout); + + LatticeGaugeField Umu(&Fine); + + std::vector U(4,&Fine); + + NerscField header; + + std::string file("./ckpoint_lat.4000"); + NerscIO::readConfiguration(Umu,header,file); + + for(int mu=0;mu(Umu,mu); + } + + // Painful ; fix syntactical niceness : to check reader + LatticeComplex LinkTrace(&Fine); + LinkTrace=zero; + for(int mu=0;munu) + // // + // // Expect scale factor to be + // // + for(int mu=0;mu ---> : U(x,mu)*U(x+mu, mu) +*/ + left_2= PeriodicBC::CovShiftForward(U[mu],mu,U[mu]); +/* + upper_l = <---- <--- + ^ + | =>tmp + (x+2mu) + Unu(x+2mu) Umudag(x+mu+nu) Umudag(x+nu) +*/ + + tmp=Cshift(U[nu],mu,2); + upper_l= PeriodicBC::CovShiftForward(tmp,nu,adj(left_2)); // i.e. upper_l +/* + upper_staple= <---- <--- ^ + | | + V (x) (x + 2mu) +*/ + // Unu(x+2mu) Umudag(x+mu+nu) Umudag(x+nu) Unudag(x) + upper_staple= upper_l*adj(U[nu]); +/* + down_staple= ^ + | | + (x) <----- <---- V x + 2mu +*/ + down_staple= adj(left_2*tmp)*U[nu]; +/* + ds_U+= <---- <--- ^ + | | + (x-mu) V-----> (x + mu) +*/ + tmp=upper_staple*U[mu]; + ds_U+= Cshift(tmp,mu,-1); +/* + ds_U+= (x-mu) ^----> (x + mu) + | | + <-----<--- V +*/ + tmp=PeriodicBC::CovShiftBackward(U[mu],nu,down_staple); + ds_U+=Cshift(tmp,mu,-1); +/* + ds_U+= <----<---- ^ + | | + (x) V -----> (x + 2mu) +*/ + tmp=Cshift(U[mu],mu,1); +/* + ds_U+= (x) ^ ----> (x + 2mu) + | | + <---- <----V +*/ + ds_U+=tmp*(upper_staple+down_staple); + +/*****Part 2********/ +/* + ^ + | + upper= ^ + | + (x) +*/ + LatticeColourMatrix up2= PeriodicBC::CovShiftForward(U[nu],nu,U[nu]); +/* + <----^ + | + upper_l= ^ + | + (x) +*/ + // Unu(x+mu)Unu(x+mu+nu) UmuDag(x+nu+nu) lives at X + upper_l= PeriodicBC::CovShiftForward(Cshift(up2,mu,1),nu,Cshift(adj(U[mu]),nu,1)); +/* + |<----^ + upper_staple = V | + | ^ + (x) V | +*/ + + ds_U+= upper_l*adj(up2); + +/* + | + V + downer_l= | + (x)<----V +*/ + upper_l= adj(PeriodicBC::CovShiftForward(U[mu],mu,up2)); //downer_l +/* + ^ | + down_staple = | V + ^ | + | V + (x)<---- + down_staple= upper*upper_l; +*/ + tmp= upper_l*up2; + ds_U+= Cshift(tmp,nu,-2); + + + //TRp = sum(RectPlaq_d); + //rp = TensorRemove(TRp); + //std::cout << GridLogMessage<< " Rect[" << " " << "] = "<< TensorRemove(TRp) < Plaq_T(orthosz); + sliceSum(Plaq,Plaq_T,Nd-1); + int Nt = Plaq_T.size(); + + + TComplex Plaq_T_sum; + Plaq_T_sum=zero; + for(int t=0;t +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_cayley_coarsen_support.cc b/tests/Test_cayley_coarsen_support.cc index 77e77307..9b371299 100644 --- a/tests/Test_cayley_coarsen_support.cc +++ b/tests/Test_cayley_coarsen_support.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_cayley_coarsen_support.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_cayley_even_odd.cc b/tests/Test_cayley_even_odd.cc index c36567cd..4a871ec2 100644 --- a/tests/Test_cayley_even_odd.cc +++ b/tests/Test_cayley_even_odd.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_cayley_even_odd.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_cayley_ldop_cr.cc b/tests/Test_cayley_ldop_cr.cc index 83ec1126..b9c5c91c 100644 --- a/tests/Test_cayley_ldop_cr.cc +++ b/tests/Test_cayley_ldop_cr.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_cayley_ldop_cr.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_cf_coarsen_support.cc b/tests/Test_cf_coarsen_support.cc index d5cb7dfc..0b02b6dc 100644 --- a/tests/Test_cf_coarsen_support.cc +++ b/tests/Test_cf_coarsen_support.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_cf_coarsen_support.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_cf_cr_unprec.cc b/tests/Test_cf_cr_unprec.cc index 7cb238ea..afcd5ae3 100644 --- a/tests/Test_cf_cr_unprec.cc +++ b/tests/Test_cf_cr_unprec.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_cf_cr_unprec.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_cheby.cc b/tests/Test_cheby.cc index 81b08816..f58cb012 100644 --- a/tests/Test_cheby.cc +++ b/tests/Test_cheby.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_cheby.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_contfrac_cg.cc b/tests/Test_contfrac_cg.cc index abf46754..eab58a96 100644 --- a/tests/Test_contfrac_cg.cc +++ b/tests/Test_contfrac_cg.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_contfrac_cg.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_contfrac_even_odd.cc b/tests/Test_contfrac_even_odd.cc index 7fcfc0f4..451b1037 100644 --- a/tests/Test_contfrac_even_odd.cc +++ b/tests/Test_contfrac_even_odd.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_contfrac_even_odd.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_contfrac_force.cc b/tests/Test_contfrac_force.cc index 58b42693..b8a26d4d 100644 --- a/tests/Test_contfrac_force.cc +++ b/tests/Test_contfrac_force.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_contfrac_force.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_cshift.cc b/tests/Test_cshift.cc index febf1837..a2902898 100644 --- a/tests/Test_cshift.cc +++ b/tests/Test_cshift.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_cshift.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace Grid; diff --git a/tests/Test_cshift_red_black.cc b/tests/Test_cshift_red_black.cc index ed19a36a..64b75d50 100644 --- a/tests/Test_cshift_red_black.cc +++ b/tests/Test_cshift_red_black.cc @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_cshift_red_black.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace Grid; diff --git a/tests/Test_dwf_cg_prec.cc b/tests/Test_dwf_cg_prec.cc index a39b6529..64e542e4 100644 --- a/tests/Test_dwf_cg_prec.cc +++ b/tests/Test_dwf_cg_prec.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_cg_prec.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_dwf_cg_schur.cc b/tests/Test_dwf_cg_schur.cc index e9db375e..dfa4afab 100644 --- a/tests/Test_dwf_cg_schur.cc +++ b/tests/Test_dwf_cg_schur.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_cg_schur.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_dwf_cg_unprec.cc b/tests/Test_dwf_cg_unprec.cc index 55d0c8d0..b99ff927 100644 --- a/tests/Test_dwf_cg_unprec.cc +++ b/tests/Test_dwf_cg_unprec.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_cg_unprec.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_dwf_cr_unprec.cc b/tests/Test_dwf_cr_unprec.cc index 2d791ce2..3897ef19 100644 --- a/tests/Test_dwf_cr_unprec.cc +++ b/tests/Test_dwf_cr_unprec.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_cr_unprec.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_dwf_even_odd.cc b/tests/Test_dwf_even_odd.cc index 687acf52..fdab95d8 100644 --- a/tests/Test_dwf_even_odd.cc +++ b/tests/Test_dwf_even_odd.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_even_odd.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_dwf_force.cc b/tests/Test_dwf_force.cc index ac6fd26a..389a7318 100644 --- a/tests/Test_dwf_force.cc +++ b/tests/Test_dwf_force.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_force.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_dwf_fpgcr.cc b/tests/Test_dwf_fpgcr.cc index 6c9645b9..0a98b9c6 100644 --- a/tests/Test_dwf_fpgcr.cc +++ b/tests/Test_dwf_fpgcr.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_fpgcr.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include using namespace std; diff --git a/tests/Test_dwf_gpforce.cc b/tests/Test_dwf_gpforce.cc index c72f40d5..4a8ceb5b 100644 --- a/tests/Test_dwf_gpforce.cc +++ b/tests/Test_dwf_gpforce.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_gpforce.cc + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_dwf_hdcr.cc b/tests/Test_dwf_hdcr.cc index 469e6cc4..15ba42fa 100644 --- a/tests/Test_dwf_hdcr.cc +++ b/tests/Test_dwf_hdcr.cc @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_hdcr.cc + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include //#include diff --git a/tests/Test_dwf_lanczos.cc b/tests/Test_dwf_lanczos.cc index b591d044..a6d43884 100644 --- a/tests/Test_dwf_lanczos.cc +++ b/tests/Test_dwf_lanczos.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_dwf_lanczos.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; @@ -35,22 +62,23 @@ int main (int argc, char ** argv) MdagMLinearOperator HermOp(Ddwf); - const int Nk = 30; - const int Np = 10; + const int Nstop = 30; + const int Nk = 40; + const int Np = 100; const int Nm = Nk+Np; const int MaxIt= 10000; RealD resid = 1.0e-8; - std::vector Coeffs(1,1.0); + std::vector Coeffs { 0.,1.}; Polynomial PolyX(Coeffs); - ImplicitlyRestartedLanczos IRL(HermOp,PolyX,Nk,Nm,resid,MaxIt); + ImplicitlyRestartedLanczos IRL(*FGrid,HermOp,PolyX,Nstop,Nk,Nm,resid,MaxIt); std::vector eval(Nm); std::vector evec(Nm,FGrid); - for(int i=0;i +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_gp_rect_force.cc b/tests/Test_gp_rect_force.cc new file mode 100644 index 00000000..51fcb7dd --- /dev/null +++ b/tests/Test_gp_rect_force.cc @@ -0,0 +1,125 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_gp_rect_force.cc + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + +#define parallel_for PARALLEL_FOR_LOOP for + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + std::vector latt_size = GridDefaultLatt(); + std::vector simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); + std::vector mpi_layout = GridDefaultMpi(); + + GridCartesian Grid(latt_size,simd_layout,mpi_layout); + GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout); + + int threads = GridThread::GetThreads(); + std::cout< seeds({1,2,3,4}); + + GridParallelRNG pRNG(&Grid); + pRNG.SeedRandomDevice(); + + LatticeGaugeField U(&Grid); + + SU3::HotConfiguration(pRNG,U); + + double beta = 1.0; + double c1 = 0.331; + + //GparityPlaqPlusRectangleActionR Action(beta,c1); + ConjugateWilsonGaugeActionR Action(beta); + //WilsonGaugeActionR Action(beta); + + ComplexD S = Action.S(U); + + // get the deriv of phidag MdagM phi with respect to "U" + LatticeGaugeField UdSdU(&Grid); + + Action.deriv(U,UdSdU); + + //////////////////////////////////// + // Modify the gauge field a little + //////////////////////////////////// + RealD dt = 0.0001; + + LatticeColourMatrix mommu(&Grid); + LatticeColourMatrix forcemu(&Grid); + LatticeGaugeField mom(&Grid); + LatticeGaugeField Uprime(&Grid); + + for(int mu=0;mu(mom,mommu,mu); + + // fourth order exponential approx + parallel_for(auto i=mom.begin();i(UdSdU,mu); + mommu = PeekIndex(mom,mu); + + // Update gauge action density + // U = exp(p dt) U + // dU/dt = p U + // so dSdt = trace( dUdt dSdU) = trace( p UdSdUmu ) + + dS = dS - trace(mommu*UdSdUmu)*dt*2.0; + + } + Complex dSpred = sum(dS); + + std::cout << GridLogMessage << " S "< +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_gpdwf_force.cc b/tests/Test_gpdwf_force.cc index d4a85d77..c600a2ff 100644 --- a/tests/Test_gpdwf_force.cc +++ b/tests/Test_gpdwf_force.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_gpdwf_force.cc + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_gpwilson_even_odd.cc b/tests/Test_gpwilson_even_odd.cc index 3f8fa661..5d7b97e4 100644 --- a/tests/Test_gpwilson_even_odd.cc +++ b/tests/Test_gpwilson_even_odd.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_gpwilson_even_odd.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_hmc_EODWFRatio.cc b/tests/Test_hmc_EODWFRatio.cc index 881f0a54..752ef6aa 100644 --- a/tests/Test_hmc_EODWFRatio.cc +++ b/tests/Test_hmc_EODWFRatio.cc @@ -1,61 +1,96 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_hmc_EODWFRatio.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef DomainWallFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + const int Ls = 8; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid); + FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid); + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + Real mass=0.04; + Real pv =1.0; + RealD M5=1.5; + FermionAction DenOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); + FermionAction NumOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,pv,M5); + + ConjugateGradient CG(1.0e-8,10000); + TwoFlavourEvenOddRatioPseudoFermionAction Nf2(NumOp, DenOp,CG,CG); + + //Collect actions + ActionLevel Level1; + Level1.push_back(&Nf2); + Level1.push_back(&Waction); + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - const int Ls = 8; + int threads = GridThread::GetThreads(); + std::cout< CG(1.0e-8,10000); - TwoFlavourEvenOddRatioPseudoFermionAction Nf2(NumOp, DenOp,CG,CG); - - //Collect actions - ActionLevel Level1; - Level1.push_back(&Nf2); - Level1.push_back(&Waction); - ActionSet FullSet; - FullSet.push_back(Level1); - - // Create integrator - typedef MinimumNorm2 IntegratorType;// change here to change the algorithm - IntegratorParameters MDpar(20); - IntegratorType MDynamics(UGrid,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics,sRNG,pRNG); - - // Run it - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } diff --git a/tests/Test_hmc_EODWFRatio_Gparity.cc b/tests/Test_hmc_EODWFRatio_Gparity.cc index 76343317..97eb1577 100644 --- a/tests/Test_hmc_EODWFRatio_Gparity.cc +++ b/tests/Test_hmc_EODWFRatio_Gparity.cc @@ -1,70 +1,102 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_hmc_EODWFRatio_Gparity.cc + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public ConjugateNerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef GparityWilsonImplR ImplPolicy; + typedef GparityDomainWallFermionR FermionAction; + + typedef typename FermionAction::FermionField FermionField; + + const int Ls = 8; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid); + FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid); + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + ConjugateWilsonGaugeActionR Waction(5.6); + + // Fermion action + const int nu = 3; + std::vector twists(Nd,0); + twists[nu] = 1; + FermionAction::ImplParams params; + params.twists = twists; + Real mass=0.04; + Real pv =1.0; + RealD M5=1.5; + FermionAction DenOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,params); + FermionAction NumOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,pv,M5,params); + + ConjugateGradient CG(1.0e-8,10000); + TwoFlavourEvenOddRatioPseudoFermionAction Nf2(NumOp, DenOp,CG,CG); + + //Collect actions + ActionLevel Level1; + Level1.push_back(&Nf2); + Level1.push_back(&Waction); + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - const int Ls = 8; + int threads = GridThread::GetThreads(); + std::cout< twists(Nd,0); - twists[nu] = 1; - GparityDomainWallFermionR::ImplParams params; - params.twists = twists; - - GparityDomainWallFermionR DenOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,params); - GparityDomainWallFermionR NumOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,pv,M5,params); + HmcRunner TheHMC; - ConjugateGradient CG(1.0e-8,10000); - - TwoFlavourEvenOddRatioPseudoFermionAction Nf2(NumOp, DenOp,CG,CG); - - //Collect actions - ActionLevel Level1; - Level1.push_back(&Nf2); - Level1.push_back(&Waction); - ActionSet FullSet; - FullSet.push_back(Level1); - - // Create integrator - typedef MinimumNorm2 IntegratorType;// change here to change the algorithm - IntegratorParameters MDpar(20); - IntegratorType MDynamics(UGrid,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics,sRNG,pRNG); - - // Run it - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } diff --git a/tests/Test_hmc_EOWilsonFermionGauge.cc b/tests/Test_hmc_EOWilsonFermionGauge.cc index 704e9d7d..c7f2d534 100644 --- a/tests/Test_hmc_EOWilsonFermionGauge.cc +++ b/tests/Test_hmc_EOWilsonFermionGauge.cc @@ -1,65 +1,101 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_hmc_EOWilsonFermionGauge.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + Real mass=-0.77; + FermionAction FermOp(U,*FGrid,*FrbGrid,mass); + + ConjugateGradient CG(1.0e-8,10000); + + TwoFlavourEvenOddPseudoFermionAction Nf2(FermOp,CG,CG); + + //Collect actions + ActionLevel Level1(1); + Level1.push_back(&Nf2); + + ActionLevel Level2(4); + Level2.push_back(&Waction); + + TheAction.push_back(Level1); + TheAction.push_back(Level2); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); + int threads = GridThread::GetThreads(); + std::cout< seeds({6,7,8,80}); - GridParallelRNG pRNG(&Fine); - pRNG.SeedFixedIntegers(seeds); - - std::vector seedsS({1,2,3,4}); - GridSerialRNG sRNG; - sRNG.SeedFixedIntegers(seedsS); - - LatticeLorentzColourMatrix U(&Fine); - - SU3::HotConfiguration(pRNG, U); - - // simplify template declaration? Strip the lorentz from the second template - WilsonGaugeActionR Waction(5.6); - - Real mass=-0.77; - WilsonFermionR FermOp(U,Fine,RBFine,mass); - - ConjugateGradient CG(1.0e-8,10000); - - TwoFlavourEvenOddPseudoFermionAction WilsonNf2(FermOp,CG,CG); - - //Collect actions - ActionLevel Level1(1); - ActionLevel Level2(4); - Level1.push_back(&WilsonNf2); - Level2.push_back(&Waction); - - ActionSet FullSet; - FullSet.push_back(Level1); - FullSet.push_back(Level2); - - // Create integrator - //typedef LeapFrog IntegratorAlgorithm;// change here to change the algorithm - //typedef MinimumNorm2 IntegratorAlgorithm;// change here to change the algorithm - typedef ForceGradient IntegratorAlgorithm;// change here to change the algorithm - - IntegratorParameters MDpar(16); - IntegratorAlgorithm MDynamics(&Fine,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics,sRNG,pRNG); - - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } + + + + diff --git a/tests/Test_hmc_EOWilsonRatio.cc b/tests/Test_hmc_EOWilsonRatio.cc index 2f492ea4..e8723d06 100644 --- a/tests/Test_hmc_EOWilsonRatio.cc +++ b/tests/Test_hmc_EOWilsonRatio.cc @@ -1,63 +1,94 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_hmc_EOWilsonRatio.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + RealD mass=-0.77; + RealD pv =0.0; + FermionAction DenOp(U,*FGrid,*FrbGrid,mass); + FermionAction NumOp(U,*FGrid,*FrbGrid,pv); + + ConjugateGradient CG(1.0e-8,10000); + TwoFlavourEvenOddRatioPseudoFermionAction Nf2(NumOp, DenOp,CG,CG); + + //Collect actions + ActionLevel Level1; + Level1.push_back(&Nf2); + Level1.push_back(&Waction); + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); + int threads = GridThread::GetThreads(); + std::cout< seeds({6,7,8,80}); - GridParallelRNG pRNG(&Fine); - pRNG.SeedFixedIntegers(seeds); - - std::vector seedsS({1,2,3,4}); - GridSerialRNG sRNG; - sRNG.SeedFixedIntegers(seedsS); - - LatticeLorentzColourMatrix U(&Fine); - - SU3::HotConfiguration(pRNG, U); - - // simplify template declaration? Strip the lorentz from the second template - WilsonGaugeActionR Waction(5.6); - - Real mass=-0.77; - Real pv =0.0; - WilsonFermionR DenOp(U,Fine,RBFine,mass); - WilsonFermionR NumOp(U,Fine,RBFine,pv); - - ConjugateGradient CG(1.0e-8,10000); - - TwoFlavourEvenOddRatioPseudoFermionAction WilsonNf2(NumOp, DenOp,CG,CG); - - //Collect actions - ActionLevel Level1; - Level1.push_back(&WilsonNf2); - Level1.push_back(&Waction); - ActionSet FullSet; - FullSet.push_back(Level1); - - - // Create integrator - typedef MinimumNorm2 IntegratorAlgorithm;// change here to change the algorithm - // typedef LeapFrog IntegratorAlgorithm;// change here to change the algorithm - IntegratorParameters MDpar(20); - IntegratorAlgorithm MDynamics(&Fine,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics,sRNG,pRNG); - - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } + diff --git a/tests/Test_hmc_GparityIwasakiGauge.cc b/tests/Test_hmc_GparityIwasakiGauge.cc new file mode 100644 index 00000000..9445a6d2 --- /dev/null +++ b/tests/Test_hmc_GparityIwasakiGauge.cc @@ -0,0 +1,80 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_hmc_GparityIwasakiGauge.cc + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + +namespace Grid { + namespace QCD { + + +class HmcRunner : public ConjugateNerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + ConjugateIwasakiGaugeActionR Gaction(2.6); + + //Collect actions + ActionLevel Level1(1); + Level1.push_back(&Gaction); + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + int threads = GridThread::GetThreads(); + std::cout< + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + +namespace Grid { + namespace QCD { + + +class HmcRunner : public ConjugateNerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + ConjugateWilsonGaugeActionR Waction(5.6); + + //Collect actions + ActionLevel Level1(1); + Level1.push_back(&Waction); + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + int threads = GridThread::GetThreads(); + std::cout< + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + IwasakiGaugeActionR Gaction(2.6); + + //Collect actions + ActionLevel Level1(1); + Level1.push_back(&Gaction); + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + int threads = GridThread::GetThreads(); + std::cout< + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + PlaqPlusRectangleActionR Gaction(2.0,0.331); + + //Collect actions + ActionLevel Level1(1); + Level1.push_back(&Gaction); + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + int threads = GridThread::GetThreads(); + std::cout< +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + Real mass=-0.77; + FermionAction FermOp(U,*FGrid,*FrbGrid,mass); + + ConjugateGradient CG(1.0e-8,10000); + + TwoFlavourPseudoFermionAction Nf2(FermOp,CG,CG); + + //Collect actions + ActionLevel Level1(1); + Level1.push_back(&Nf2); + + ActionLevel Level2(4); + Level2.push_back(&Waction); + + TheAction.push_back(Level1); + TheAction.push_back(Level2); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); + int threads = GridThread::GetThreads(); + std::cout< seeds({6,7,8,80}); - GridParallelRNG pRNG(&Fine); - pRNG.SeedFixedIntegers(seeds); - - std::vector seedsS({1,2,3,4}); - GridSerialRNG sRNG; - sRNG.SeedFixedIntegers(seedsS); - - LatticeLorentzColourMatrix U(&Fine); - - SU3::HotConfiguration(pRNG, U); - - // simplify template declaration? Strip the lorentz from the second template - WilsonGaugeActionR Waction(5.6); - - Real mass=-0.77; - WilsonFermionR FermOp(U,Fine,RBFine,mass); - - ConjugateGradient CG(1.0e-8,10000); - - TwoFlavourPseudoFermionAction WilsonNf2(FermOp,CG,CG); - - //Collect actions - ActionLevel Level1(1); - ActionLevel Level2(4); - Level1.push_back(&WilsonNf2); - Level1.push_back(&Waction); - // Level1.push_back(&Waction); - - ActionSet FullSet; - FullSet.push_back(Level1); - // FullSet.push_back(Level2); - - // Create integrator - typedef MinimumNorm2 IntegratorAlgorithm;// change here to change the algorithm - // typedef LeapFrog IntegratorAlgorithm;// change here to change the algorithm - IntegratorParameters MDpar(20); - IntegratorAlgorithm MDynamics(&Fine,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics,sRNG,pRNG); - - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } + + diff --git a/tests/Test_hmc_WilsonGauge.cc b/tests/Test_hmc_WilsonGauge.cc index 2e1a61e0..f47ace2a 100644 --- a/tests/Test_hmc_WilsonGauge.cc +++ b/tests/Test_hmc_WilsonGauge.cc @@ -1,59 +1,86 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_hmc_WilsonGauge.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + //Collect actions + ActionLevel Level1(1); + Level1.push_back(&Waction); + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); + int threads = GridThread::GetThreads(); + std::cout< seeds({6,7,8,80}); - GridParallelRNG pRNG(&Fine); - pRNG.SeedFixedIntegers(seeds); - - std::vector seedsS({1,2,3,4}); - GridSerialRNG sRNG; - sRNG.SeedFixedIntegers(seedsS); - - LatticeGaugeField U(&Fine); - - SU3::HotConfiguration(pRNG, U); - - // simplify template declaration? Strip the lorentz from the second template - WilsonGaugeActionR Waction(6.0); - - //Collect actions - ActionLevel Level1; - Level1.push_back(&Waction); - ActionSet FullSet; - FullSet.push_back(Level1); - - // Create integrator - typedef MinimumNorm2 IntegratorAlgorithm;// change here to modify the algorithm - IntegratorParameters MDpar(20); - IntegratorAlgorithm MDynamics(&Fine,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics, sRNG, pRNG); - - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } + diff --git a/tests/Test_hmc_WilsonRatio.cc b/tests/Test_hmc_WilsonRatio.cc index eabbd8ab..000a8913 100644 --- a/tests/Test_hmc_WilsonRatio.cc +++ b/tests/Test_hmc_WilsonRatio.cc @@ -1,63 +1,95 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_hmc_WilsonRatio.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + RealD mass=-0.77; + RealD pv =0.0; + FermionAction DenOp(U,*FGrid,*FrbGrid,mass); + FermionAction NumOp(U,*FGrid,*FrbGrid,pv); + + ConjugateGradient CG(1.0e-8,10000); + TwoFlavourRatioPseudoFermionAction Nf2(NumOp, DenOp,CG,CG); + + //Collect actions + ActionLevel Level1; + Level1.push_back(&Nf2); + Level1.push_back(&Waction); + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); + int threads = GridThread::GetThreads(); + std::cout< seeds({6,7,8,80}); - GridParallelRNG pRNG(&Fine); - pRNG.SeedFixedIntegers(seeds); - - std::vector seedsS({1,2,3,4}); - GridSerialRNG sRNG; - sRNG.SeedFixedIntegers(seedsS); - - LatticeLorentzColourMatrix U(&Fine); - - SU3::HotConfiguration(pRNG, U); - - // simplify template declaration? Strip the lorentz from the second template - WilsonGaugeActionR Waction(5.6); - - Real mass=-0.77; - Real pv =0.0; - WilsonFermionR FermOp(U,Fine,RBFine,mass); - WilsonFermionR NumOp(U,Fine,RBFine,pv); - - ConjugateGradient CG(1.0e-8,10000); - - TwoFlavourRatioPseudoFermionAction WilsonNf2(NumOp,FermOp,CG,CG); - - //Collect actions - ActionLevel Level1; - Level1.push_back(&WilsonNf2); - Level1.push_back(&Waction); - ActionSet FullSet; - FullSet.push_back(Level1); - - - // Create integrator - typedef MinimumNorm2 IntegratorAlgorithm;// change here to change the algorithm - // typedef LeapFrog IntegratorAlgorithm;// change here to change the algorithm - IntegratorParameters MDpar(20); - IntegratorAlgorithm MDynamics(&Fine,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics, sRNG, pRNG); - - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } + + diff --git a/tests/Test_lie_generators.cc b/tests/Test_lie_generators.cc index 25d11759..02620718 100644 --- a/tests/Test_lie_generators.cc +++ b/tests/Test_lie_generators.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_lie_generators.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include diff --git a/tests/Test_main.cc b/tests/Test_main.cc index 65d8d54f..b178d1a3 100644 --- a/tests/Test_main.cc +++ b/tests/Test_main.cc @@ -1,3 +1,33 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_main.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: neo +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include "Grid.h" @@ -35,7 +65,7 @@ int main (int argc, char ** argv) #ifdef AVX512 for(int omp=128;omp<236;omp+=16){ #else - for(int omp=1;omp<8;omp*=20){ + for(int omp=1;omp<2;omp*=20){ #endif #ifdef OMP @@ -43,6 +73,9 @@ int main (int argc, char ** argv) #endif for(int lat=8;lat<=16;lat+=40){ + + std::cout << "Lat "< saved; + SerialRNG.GetState(saved,0); + SerialRNG1.SetState(saved,0); + + RealD dd1,dd2; + + std::cout << "Testing RNG state save restore"< coor(4); @@ -315,6 +364,7 @@ int main (int argc, char ** argv) */ lex_sites(Foo); + Integer mm[4]; mm[0]=1; mm[1]=Fine._rdimensions[0]; @@ -330,8 +380,12 @@ int main (int argc, char ** argv) } - Bar = zero; - Bar = where(lex coor(4); diff --git a/tests/Test_multishift_sqrt.cc b/tests/Test_multishift_sqrt.cc index f252accc..2ec53691 100644 --- a/tests/Test_multishift_sqrt.cc +++ b/tests/Test_multishift_sqrt.cc @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_multishift_sqrt.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_nersc_io.cc b/tests/Test_nersc_io.cc index 36f17c76..43d29aa4 100644 --- a/tests/Test_nersc_io.cc +++ b/tests/Test_nersc_io.cc @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_nersc_io.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; @@ -20,6 +49,30 @@ int main (int argc, char ** argv) GridCartesian Fine(latt_size,simd_layout,mpi_layout); GridCartesian Coarse(clatt_size,simd_layout,mpi_layout); + GridParallelRNG pRNGa(&Fine); + GridParallelRNG pRNGb(&Fine); + GridSerialRNG sRNGa; + GridSerialRNG sRNGb; + + pRNGa.SeedRandomDevice(); + sRNGa.SeedRandomDevice(); + + std::string rfile("./ckpoint_rng.4000"); + NerscIO::writeRNGState(sRNGa,pRNGa,rfile); + NerscField rngheader; + NerscIO::readRNGState (sRNGb,pRNGb,rngheader,rfile); + + LatticeComplex tmpa(&Fine); random(pRNGa,tmpa); + LatticeComplex tmpb(&Fine); random(pRNGb,tmpb); + tmpa = tmpa - tmpb; + std::cout << " difference between restored randoms and orig "< + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_quenched_update.cc b/tests/Test_quenched_update.cc index 3836bed5..79c85dd2 100644 --- a/tests/Test_quenched_update.cc +++ b/tests/Test_quenched_update.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_quenched_update.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include @@ -61,7 +89,6 @@ int main (int argc, char ** argv) // Get Link and Staple term in action; must contain Beta and // any other coeffs ColourWilsonLoops::Staple(staple,Umu,mu); - staple = adj(staple); link = PeekIndex(Umu,mu); diff --git a/tests/Test_rect_force.cc b/tests/Test_rect_force.cc new file mode 100644 index 00000000..f437fa21 --- /dev/null +++ b/tests/Test_rect_force.cc @@ -0,0 +1,124 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_rect_force.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + +#define parallel_for PARALLEL_FOR_LOOP for + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + std::vector latt_size = GridDefaultLatt(); + std::vector simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); + std::vector mpi_layout = GridDefaultMpi(); + + GridCartesian Grid(latt_size,simd_layout,mpi_layout); + GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout); + + int threads = GridThread::GetThreads(); + std::cout< seeds({1,2,3,4}); + + GridParallelRNG pRNG(&Grid); + pRNG.SeedRandomDevice(); + + LatticeGaugeField U(&Grid); + + SU3::HotConfiguration(pRNG,U); + + double beta = 1.0; + double c1 = 0.331; + + PlaqPlusRectangleActionR Action(beta,c1); + // WilsonGaugeActionR Action(beta); + + ComplexD S = Action.S(U); + + // get the deriv of phidag MdagM phi with respect to "U" + LatticeGaugeField UdSdU(&Grid); + + Action.deriv(U,UdSdU); + + //////////////////////////////////// + // Modify the gauge field a little + //////////////////////////////////// + RealD dt = 0.0001; + + LatticeColourMatrix mommu(&Grid); + LatticeColourMatrix forcemu(&Grid); + LatticeGaugeField mom(&Grid); + LatticeGaugeField Uprime(&Grid); + + for(int mu=0;mu(mom,mommu,mu); + + // fourth order exponential approx + parallel_for(auto i=mom.begin();i(UdSdU,mu); + mommu = PeekIndex(mom,mu); + + // Update gauge action density + // U = exp(p dt) U + // dU/dt = p U + // so dSdt = trace( dUdt dSdU) = trace( p UdSdUmu ) + + dS = dS - trace(mommu*UdSdUmu)*dt*2.0; + + } + Complex dSpred = sum(dS); + + std::cout << GridLogMessage << " S "< +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_rhmc_EOWilson1p1.cc b/tests/Test_rhmc_EOWilson1p1.cc index 9ff86d65..90282ea1 100644 --- a/tests/Test_rhmc_EOWilson1p1.cc +++ b/tests/Test_rhmc_EOWilson1p1.cc @@ -1,63 +1,97 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_rhmc_EOWilson1p1.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + Real mass=-0.77; + FermionAction FermOp(U,*FGrid,*FrbGrid,mass); + + // 1+1 flavour + OneFlavourRationalParams Params(1.0e-4,64.0,1000,1.0e-6); + OneFlavourEvenOddRationalPseudoFermionAction WilsonNf1a(FermOp,Params); + OneFlavourEvenOddRationalPseudoFermionAction WilsonNf1b(FermOp,Params); + + //Collect actions + ActionLevel Level1; + Level1.push_back(&WilsonNf1a); + Level1.push_back(&WilsonNf1b); + Level1.push_back(&Waction); + + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); + int threads = GridThread::GetThreads(); + std::cout< seeds({6,7,8,80}); - GridParallelRNG pRNG(&Fine); - pRNG.SeedFixedIntegers(seeds); - - std::vector seedsS({1,2,3,4}); - GridSerialRNG sRNG; - sRNG.SeedFixedIntegers(seedsS); - - LatticeLorentzColourMatrix U(&Fine); - - SU3::HotConfiguration(pRNG, U); - - // simplify template declaration? Strip the lorentz from the second template - WilsonGaugeActionR Waction(5.6); - - Real mass=-0.77; - WilsonFermionR FermOp(U,Fine,RBFine,mass); - - // 1+1 flavour - OneFlavourRationalParams Params(1.0e-4,64.0,1000,1.0e-6); - OneFlavourEvenOddRationalPseudoFermionAction WilsonNf1a(FermOp,Params); - OneFlavourEvenOddRationalPseudoFermionAction WilsonNf1b(FermOp,Params); - - //Collect actions - ActionLevel Level1; - Level1.push_back(&WilsonNf1a); - Level1.push_back(&WilsonNf1b); - Level1.push_back(&Waction); - - ActionSet FullSet; - FullSet.push_back(Level1); - - // Create integrator - typedef MinimumNorm2 IntegratorAlgorithm;// change here to change the algorithm - - IntegratorParameters MDpar(20); - IntegratorAlgorithm MDynamics(&Fine,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics, sRNG, pRNG); - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } + + diff --git a/tests/Test_rhmc_EOWilsonRatio.cc b/tests/Test_rhmc_EOWilsonRatio.cc index 3c1a58a7..b5407d5a 100644 --- a/tests/Test_rhmc_EOWilsonRatio.cc +++ b/tests/Test_rhmc_EOWilsonRatio.cc @@ -1,66 +1,100 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_rhmc_EOWilsonRatio.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + RealD mass=-0.77; + RealD pv =0.0; + FermionAction DenOp(U,*FGrid,*FrbGrid,mass); + FermionAction NumOp(U,*FGrid,*FrbGrid,pv); + + + // erange,maxiter,resid,npoly + OneFlavourRationalParams Params(1.0e-2,64.0,1000,1.0e-6,6); + OneFlavourEvenOddRatioRationalPseudoFermionAction WilsonNf1a(NumOp,DenOp,Params); + OneFlavourEvenOddRatioRationalPseudoFermionAction WilsonNf1b(NumOp,DenOp,Params); + + //Collect actions + ActionLevel Level1; + Level1.push_back(&WilsonNf1a); + Level1.push_back(&WilsonNf1b); + Level1.push_back(&Waction); + + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); + int threads = GridThread::GetThreads(); + std::cout< seeds({6,7,8,80}); - GridParallelRNG pRNG(&Fine); - pRNG.SeedFixedIntegers(seeds); - - std::vector seedsS({1,2,3,4}); - GridSerialRNG sRNG; - sRNG.SeedFixedIntegers(seedsS); - - LatticeLorentzColourMatrix U(&Fine); - - SU3::HotConfiguration(pRNG, U); - - // simplify template declaration? Strip the lorentz from the second template - WilsonGaugeActionR Waction(5.6); - - Real mass=-0.77; - Real pv =0.0; - WilsonFermionR DenOp(U,Fine,RBFine,mass); - WilsonFermionR NumOp(U,Fine,RBFine,pv); - - // erange,maxiter,resid,npoly - OneFlavourRationalParams Params(1.0e-2,64.0,1000,1.0e-6,6); - OneFlavourEvenOddRatioRationalPseudoFermionAction WilsonNf1a(NumOp,DenOp,Params); - OneFlavourEvenOddRatioRationalPseudoFermionAction WilsonNf1b(NumOp,DenOp,Params); - - //Collect actions - ActionLevel Level1; - Level1.push_back(&WilsonNf1a); - Level1.push_back(&WilsonNf1b); - Level1.push_back(&Waction); - ActionSet FullSet; - FullSet.push_back(Level1); - - - // Create integrator - typedef MinimumNorm2 IntegratorAlgorithm;// change here to change the algorithm - // typedef LeapFrog IntegratorAlgorithm;// change here to change the algorithm - IntegratorParameters MDpar(20); - IntegratorAlgorithm MDynamics(&Fine,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics, sRNG, pRNG); - - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } + + diff --git a/tests/Test_rhmc_Wilson1p1.cc b/tests/Test_rhmc_Wilson1p1.cc index 891d3ae5..60306412 100644 --- a/tests/Test_rhmc_Wilson1p1.cc +++ b/tests/Test_rhmc_Wilson1p1.cc @@ -1,64 +1,96 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_rhmc_Wilson1p1.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + Real mass=-0.77; + FermionAction FermOp(U,*FGrid,*FrbGrid,mass); + + // 1+1 flavour + OneFlavourRationalParams Params(1.0e-4,64.0,1000,1.0e-6); + OneFlavourRationalPseudoFermionAction WilsonNf1a(FermOp,Params); + OneFlavourRationalPseudoFermionAction WilsonNf1b(FermOp,Params); + + //Collect actions + ActionLevel Level1; + Level1.push_back(&WilsonNf1a); + Level1.push_back(&WilsonNf1b); + Level1.push_back(&Waction); + + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); + int threads = GridThread::GetThreads(); + std::cout< seeds({6,7,8,80}); - GridParallelRNG pRNG(&Fine); - pRNG.SeedFixedIntegers(seeds); - - std::vector seedsS({1,2,3,4}); - GridSerialRNG sRNG; - sRNG.SeedFixedIntegers(seedsS); - - LatticeLorentzColourMatrix U(&Fine); - - SU3::HotConfiguration(pRNG, U); - - // simplify template declaration? Strip the lorentz from the second template - WilsonGaugeActionR Waction(5.6); - - Real mass=-0.77; - WilsonFermionR FermOp(U,Fine,RBFine,mass); - - // 1+1 flavour - OneFlavourRationalParams Params(1.0e-4,64.0,1000,1.0e-6); - OneFlavourRationalPseudoFermionAction WilsonNf1a(FermOp,Params); - OneFlavourRationalPseudoFermionAction WilsonNf1b(FermOp,Params); - - //Collect actions - ActionLevel Level1; - Level1.push_back(&WilsonNf1a); - Level1.push_back(&WilsonNf1b); - Level1.push_back(&Waction); - - ActionSet FullSet; - FullSet.push_back(Level1); - - // Create integrator - typedef MinimumNorm2 IntegratorAlgorithm;// change here to change the algorithm - - IntegratorParameters MDpar(20); - IntegratorAlgorithm MDynamics(&Fine,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics, sRNG, pRNG); - - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } + diff --git a/tests/Test_rhmc_WilsonRatio.cc b/tests/Test_rhmc_WilsonRatio.cc index 543557e3..0063c1bb 100644 --- a/tests/Test_rhmc_WilsonRatio.cc +++ b/tests/Test_rhmc_WilsonRatio.cc @@ -1,66 +1,99 @@ -#include "Grid.h" + /************************************************************************************* + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_rhmc_WilsonRatio.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include "Grid.h" using namespace std; using namespace Grid; using namespace Grid::QCD; +namespace Grid { + namespace QCD { + + +class HmcRunner : public NerscHmcRunner { +public: + + void BuildTheAction (int argc, char **argv) + + { + typedef WilsonImplR ImplPolicy; + typedef WilsonFermionR FermionAction; + typedef typename FermionAction::FermionField FermionField; + + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi()); + UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + FGrid = UGrid; + FrbGrid = UrbGrid; + + // temporarily need a gauge field + LatticeGaugeField U(UGrid); + + // Gauge action + WilsonGaugeActionR Waction(5.6); + + RealD mass=-0.77; + RealD pv =0.0; + FermionAction DenOp(U,*FGrid,*FrbGrid,mass); + FermionAction NumOp(U,*FGrid,*FrbGrid,pv); + + + // erange,maxiter,resid,npoly + OneFlavourRationalParams Params(1.0e-2,64.0,1000,1.0e-6,6); + OneFlavourRatioRationalPseudoFermionAction WilsonNf1a(NumOp,DenOp,Params); + OneFlavourRatioRationalPseudoFermionAction WilsonNf1b(NumOp,DenOp,Params); + + //Collect actions + ActionLevel Level1; + Level1.push_back(&WilsonNf1a); + Level1.push_back(&WilsonNf1b); + Level1.push_back(&Waction); + + TheAction.push_back(Level1); + + Run(argc,argv); + }; + +}; + +}} + int main (int argc, char ** argv) { Grid_init(&argc,&argv); - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); + int threads = GridThread::GetThreads(); + std::cout< seeds({6,7,8,80}); - GridParallelRNG pRNG(&Fine); - pRNG.SeedFixedIntegers(seeds); - - std::vector seedsS({1,2,3,4}); - GridSerialRNG sRNG; - sRNG.SeedFixedIntegers(seedsS); - - LatticeLorentzColourMatrix U(&Fine); - - SU3::HotConfiguration(pRNG, U); - - // simplify template declaration? Strip the lorentz from the second template - WilsonGaugeActionR Waction(5.6); - - Real mass=-0.77; - Real pv =0.0; - WilsonFermionR DenOp(U,Fine,RBFine,mass); - WilsonFermionR NumOp(U,Fine,RBFine,pv); - - // erange,maxiter,resid,npoly - OneFlavourRationalParams Params(1.0e-2,64.0,1000,1.0e-6,6); - OneFlavourRatioRationalPseudoFermionAction WilsonNf1a(NumOp,DenOp,Params); - OneFlavourRatioRationalPseudoFermionAction WilsonNf1b(NumOp,DenOp,Params); - - //Collect actions - ActionLevel Level1; - Level1.push_back(&WilsonNf1a); - Level1.push_back(&WilsonNf1b); - Level1.push_back(&Waction); - ActionSet FullSet; - FullSet.push_back(Level1); - - - // Create integrator - typedef MinimumNorm2 IntegratorAlgorithm;// change here to change the algorithm - // typedef LeapFrog IntegratorAlgorithm;// change here to change the algorithm - IntegratorParameters MDpar(20); - IntegratorAlgorithm MDynamics(&Fine,MDpar, FullSet); - - // Create HMC - HMCparameters HMCpar; - HybridMonteCarlo HMC(HMCpar, MDynamics, sRNG, pRNG); - - HMC.evolve(U); + TheHMC.BuildTheAction(argc,argv); } + diff --git a/tests/Test_rng.cc b/tests/Test_rng.cc index da8da734..0fe9e076 100644 --- a/tests/Test_rng.cc +++ b/tests/Test_rng.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_rng.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_rng_fixed.cc b/tests/Test_rng_fixed.cc index f2271ca1..53a97465 100644 --- a/tests/Test_rng_fixed.cc +++ b/tests/Test_rng_fixed.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_rng_fixed.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_serialisation.cc b/tests/Test_serialisation.cc index 5ab85181..22bb7025 100644 --- a/tests/Test_serialisation.cc +++ b/tests/Test_serialisation.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_serialisation.cc + + Copyright (C) 2015 + +Author: Antonin Portelli +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include namespace Grid { diff --git a/tests/Test_simd.cc b/tests/Test_simd.cc index d311f8f0..2d74ba9b 100644 --- a/tests/Test_simd.cc +++ b/tests/Test_simd.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_simd.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: neo + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_stencil.cc b/tests/Test_stencil.cc index 26e52a41..4031f3df 100644 --- a/tests/Test_stencil.cc +++ b/tests/Test_stencil.cc @@ -1,3 +1,32 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_stencil.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include "Grid.h" using namespace std; @@ -169,12 +198,13 @@ int main (int argc, char ** argv) ECheck.checkerboard = Odd; OCheck.checkerboard = Even; } + // Implement a stencil code that should agree with that darn cshift! for(int i=0;ioSites();i++){ int permute_type; StencilEntry *SE; SE = EStencil.GetEntry(permute_type,0,i); - std::cout << "Even source "<< i<<" -> " <_offset << " "<< SE->_is_local< " <_offset << " "<< SE->_is_local<_is_local && SE->_permute ) permute(OCheck._odata[i],EFoo._odata[SE->_offset],permute_type); @@ -187,7 +217,7 @@ int main (int argc, char ** argv) int permute_type; StencilEntry *SE; SE = OStencil.GetEntry(permute_type,0,i); - std::cout << "ODD source "<< i<<" -> " <_offset << " "<< SE->_is_local< " <_offset << " "<< SE->_is_local<_is_local && SE->_permute ) permute(ECheck._odata[i],OFoo._odata[SE->_offset],permute_type); diff --git a/tests/Test_synthetic_lanczos.cc b/tests/Test_synthetic_lanczos.cc index d8bbc9a4..5e5219cc 100644 --- a/tests/Test_synthetic_lanczos.cc +++ b/tests/Test_synthetic_lanczos.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_synthetic_lanczos.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include diff --git a/tests/Test_wilson_cg_prec.cc b/tests/Test_wilson_cg_prec.cc index 756f8b6f..df78ef05 100644 --- a/tests/Test_wilson_cg_prec.cc +++ b/tests/Test_wilson_cg_prec.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_cg_prec.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_wilson_cg_schur.cc b/tests/Test_wilson_cg_schur.cc index 2174d644..533afb5c 100644 --- a/tests/Test_wilson_cg_schur.cc +++ b/tests/Test_wilson_cg_schur.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_cg_schur.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_wilson_cg_unprec.cc b/tests/Test_wilson_cg_unprec.cc index 9269aeaa..a8ca42f9 100644 --- a/tests/Test_wilson_cg_unprec.cc +++ b/tests/Test_wilson_cg_unprec.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_cg_unprec.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_wilson_cr_unprec.cc b/tests/Test_wilson_cr_unprec.cc index c7e0bc33..143f82ff 100644 --- a/tests/Test_wilson_cr_unprec.cc +++ b/tests/Test_wilson_cr_unprec.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_cr_unprec.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_wilson_even_odd.cc b/tests/Test_wilson_even_odd.cc index 37ba40f1..7c557524 100644 --- a/tests/Test_wilson_even_odd.cc +++ b/tests/Test_wilson_even_odd.cc @@ -1,3 +1,31 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_even_odd.cc + + Copyright (C) 2015 + +Author: Peter Boyle +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; @@ -61,8 +89,8 @@ int main (int argc, char ** argv) } RealD mass=0.1; - - WilsonFermionR Dw(Umu,Grid,RBGrid,mass); + RealD mu = 0.1; + WilsonTMFermionR Dw(Umu,Grid,RBGrid,mass,mu); LatticeFermion src_e (&RBGrid); LatticeFermion src_o (&RBGrid); @@ -179,7 +207,7 @@ int main (int argc, char ** argv) pickCheckerboard(Odd ,phi_o,phi); RealD t1,t2; - SchurDiagMooeeOperator HermOpEO(Dw); + SchurDiagMooeeOperator HermOpEO(Dw); HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2); HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2); diff --git a/tests/Test_wilson_force.cc b/tests/Test_wilson_force.cc index 1b22c2e4..751c0896 100644 --- a/tests/Test_wilson_force.cc +++ b/tests/Test_wilson_force.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_force.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_wilson_force_phiMdagMphi.cc b/tests/Test_wilson_force_phiMdagMphi.cc index 88f3161f..c89f30e2 100644 --- a/tests/Test_wilson_force_phiMdagMphi.cc +++ b/tests/Test_wilson_force_phiMdagMphi.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_force_phiMdagMphi.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_wilson_force_phiMphi.cc b/tests/Test_wilson_force_phiMphi.cc index ff9e0fb3..a7d00a71 100644 --- a/tests/Test_wilson_force_phiMphi.cc +++ b/tests/Test_wilson_force_phiMphi.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_force_phiMphi.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include using namespace std; diff --git a/tests/Test_wilson_tm_even_odd.cc b/tests/Test_wilson_tm_even_odd.cc new file mode 100644 index 00000000..37116dd8 --- /dev/null +++ b/tests/Test_wilson_tm_even_odd.cc @@ -0,0 +1,228 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_tm_even_odd.cc + + Copyright (C) 2015 + +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + +template +struct scal { + d internal; +}; + + Gamma::GammaMatrix Gmu [] = { + Gamma::GammaX, + Gamma::GammaY, + Gamma::GammaZ, + Gamma::GammaT + }; + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + std::vector latt_size = GridDefaultLatt(); + std::vector simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); + std::vector mpi_layout = GridDefaultMpi(); + GridCartesian Grid(latt_size,simd_layout,mpi_layout); + GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout); + + int threads = GridThread::GetThreads(); + std::cout< seeds({1,2,3,4}); + + GridParallelRNG pRNG(&Grid); + // std::vector seeds({1,2,3,4}); + // pRNG.SeedFixedIntegers(seeds); + pRNG.SeedRandomDevice(); + + LatticeFermion src (&Grid); random(pRNG,src); + LatticeFermion phi (&Grid); random(pRNG,phi); + LatticeFermion chi (&Grid); random(pRNG,chi); + LatticeFermion result(&Grid); result=zero; + LatticeFermion ref(&Grid); ref=zero; + LatticeFermion tmp(&Grid); tmp=zero; + LatticeFermion err(&Grid); tmp=zero; + LatticeGaugeField Umu(&Grid); random(pRNG,Umu); + std::vector U(4,&Grid); + + double volume=1; + for(int mu=0;mu(Umu,U[nn],nn); + std::cout< * = < chi | Deo^dag| phi> "< HermOpEO(Dw); + HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2); + HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2); + + HermOpEO.MpcDagMpc(phi_e,dphi_e,t1,t2); + HermOpEO.MpcDagMpc(phi_o,dphi_o,t1,t2); + + pDce = innerProduct(phi_e,dchi_e); + pDco = innerProduct(phi_o,dchi_o); + cDpe = innerProduct(chi_e,dphi_e); + cDpo = innerProduct(chi_o,dphi_o); + + std::cout< + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include #include #include diff --git a/tests/qdpxx/Make.inc b/tests/qdpxx/Make.inc index ea2018e4..6bfc9c5d 100644 --- a/tests/qdpxx/Make.inc +++ b/tests/qdpxx/Make.inc @@ -1,5 +1,9 @@ -bin_PROGRAMS = Test_qdpxx_munprec +bin_PROGRAMS = Test_qdpxx_loops_staples Test_qdpxx_munprec + + +Test_qdpxx_loops_staples_SOURCES=Test_qdpxx_loops_staples.cc +Test_qdpxx_loops_staples_LDADD=-lGrid Test_qdpxx_munprec_SOURCES=Test_qdpxx_munprec.cc diff --git a/tests/qdpxx/Test_qdpxx_loops_staples.cc b/tests/qdpxx/Test_qdpxx_loops_staples.cc new file mode 100755 index 00000000..c5999065 --- /dev/null +++ b/tests/qdpxx/Test_qdpxx_loops_staples.cc @@ -0,0 +1,675 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/qdpxx/Test_qdpxx_loops_staples.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include + +double calc_grid_p (Grid::QCD::LatticeGaugeField & lat); +double calc_chroma_p (Grid::QCD::LatticeGaugeField & lat); +double calc_grid_r (Grid::QCD::LatticeGaugeField & lat); +double calc_grid_IW (Grid::QCD::LatticeGaugeField & lat); +double calc_grid_r_dir (Grid::QCD::LatticeGaugeField & lat); +double calc_chroma_r (Grid::QCD::LatticeGaugeField & lat); +double calc_chroma_IW (Grid::QCD::LatticeGaugeField & lat); +void check_grid_r_staple(Grid::QCD::LatticeGaugeField & Umu); +void check_grid_p_staple(Grid::QCD::LatticeGaugeField & Umu); + +const double beta=2.6; +const double c1=-0.331; +#include +#include +#include + + + +namespace Chroma { + +class ChromaWrapper { +public: + + + typedef multi1d U; + + static void ImportGauge(Grid::QCD::LatticeGaugeField & gr, + QDP::multi1d & ch) + { + Grid::QCD::LorentzColourMatrix LCM; + Grid::Complex cc; + QDP::ColorMatrix cm; + QDP::Complex c; + + std::vector x(4); + QDP::multi1d cx(4); + std::vector gd= gr._grid->GlobalDimensions(); + + for (x[0]=0;x[0] GetRBCAction ( U &u ) + { + Chroma::CreatePeriodicGaugeState CPGS; + Chroma::Handle< Chroma::CreateGaugeState > cgs (new Chroma::CreatePeriodicGaugeState); + Chroma::Handle< Chroma::LinearGaugeAction> action = new Chroma::RBCGaugeAct(cgs,beta,c1); + return action; + } + + static Chroma::Handle< Chroma::LinearGaugeAction > GetRectangle ( U &u ) + { + Chroma::CreatePeriodicGaugeState CPGS; + Chroma::Handle< Chroma::CreateGaugeState > cgs (new Chroma::CreatePeriodicGaugeState); + Chroma::Handle< Chroma::LinearGaugeAction> action = new Chroma::RectGaugeAct(cgs, Real(c1)); + return action; + } + + static Chroma::Handle< Chroma::LinearGaugeAction > GetPlaquette ( U &u ) + { + Chroma::CreatePeriodicGaugeState CPGS; + Chroma::Handle< Chroma::CreateGaugeState > cgs (new Chroma::CreatePeriodicGaugeState); + Chroma::Handle< Chroma::LinearGaugeAction> action = new Chroma::WilsonGaugeAct(cgs, Real(beta)); + return action; + } + +}; +} + +int main (int argc,char **argv ) +{ + /******************************************************** + * Setup QDP + *********************************************************/ + Chroma::initialize(&argc,&argv); + Chroma::WilsonTypeFermActs4DEnv::registerAll(); + + /******************************************************** + * Setup Grid + *********************************************************/ + Grid::Grid_init(&argc,&argv); + Grid::GridCartesian * UGrid = Grid::QCD::SpaceTimeGrid::makeFourDimGrid(Grid::GridDefaultLatt(), + Grid::GridDefaultSimd(Grid::QCD::Nd,Grid::vComplex::Nsimd()), + Grid::GridDefaultMpi()); + + std::vector gd = UGrid->GlobalDimensions(); + QDP::multi1d nrow(QDP::Nd); + for(int mu=0;mu<4;mu++) nrow[mu] = gd[mu]; + + QDP::Layout::setLattSize(nrow); + QDP::Layout::create(); + + Grid::QCD::LatticeGaugeField lat(UGrid); + + double s_grid = calc_grid_p (lat); + + double s_chroma = calc_chroma_p(lat); + // Match conventions + double vol = UGrid->gSites(); + s_chroma+= beta * QDP::Nd * (QDP::Nd-1)*vol *0.5; + + std::cout << " Chroma/Grid plaquette = " < U; + + QDP::multi1d u(4); + + Chroma::ChromaWrapper::ImportGauge(lat,u) ; + + for(int mu=0;mu<4;mu++){ + std::cout <<"Imported Gauge norm ["< > gs(action->getCreateState()(u)); + + Real act = action->S(gs); + + double s = toDouble(act); + + return s; +} +double calc_chroma_r(Grid::QCD::LatticeGaugeField & lat) +{ + typedef QDP::multi1d U; + + QDP::multi1d u(4); + + Chroma::ChromaWrapper::ImportGauge(lat,u) ; + + for(int mu=0;mu<4;mu++){ + std::cout <<"Imported Gauge norm ["< > gs(action->getCreateState()(u)); + + Real act = action->S(gs); + + double s = toDouble(act); + + return s; +} + +// Conventions matching: +// +// Chroma: +// +// w_plaq is defined in MesPlq as +// w_plaq =( 2/(V*Nd*(Nd-1)*Nc)) * Sum Re Tr Plaq +// +// S = -(coeff/(Nc) Sum Re Tr Plaq +// +// S = -coeff * (V*Nd*(Nd-1)/2) w_plaq +// = -coeff * (V*Nd*(Nd-1)/2)*(2/(V*Nd*(Nd-1)*Nc))* Sum Re Tr Plaq +// = -coeff * (1/(Nc)) * Sum Re Tr Plaq +// +// Grid: has 1-plaq as usual to define Fmunu +// +// action = beta*(1.0 -plaq)*(Nd*(Nd-1.0))*vol*0.5; +// action = beta * Nd*Nd-1*vol*0.5 - beta * Nd*Nd-1*vol*0.5*plaq +// +// plaq == sumplaq * 2/(V*Nd*(Nd-1)*Nc) +double calc_chroma_p(Grid::QCD::LatticeGaugeField & lat) +{ + typedef QDP::multi1d U; + + QDP::multi1d u(4); + + Chroma::ChromaWrapper::ImportGauge(lat,u) ; + + for(int mu=0;mu<4;mu++){ + std::cout <<"Imported Gauge norm ["< > gs(action->getCreateState()(u)); + + Real act = action->S(gs); + + double s = toDouble(act); + + return s; +} + + + +double calc_grid_p(Grid::QCD::LatticeGaugeField & Umu) +{ + std::vector seeds4({1,2,3,4}); + + Grid::GridCartesian * UGrid = (Grid::GridCartesian *) Umu._grid; + Grid::GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4); + + Grid::QCD::SU3::HotConfiguration(RNG4,Umu); + + Grid::QCD::LatticeColourMatrix tmp(UGrid); + tmp = Grid::zero; + + Grid::QCD::PokeIndex(Umu,tmp,2); + Grid::QCD::PokeIndex(Umu,tmp,3); + + Grid::QCD::WilsonGaugeActionR Wilson(beta); // Just take beta = 1.0 + + return Wilson.S(Umu); +} +double calc_grid_r(Grid::QCD::LatticeGaugeField & Umu) +{ + Grid::GridCartesian * UGrid = (Grid::GridCartesian *) Umu._grid; + + Grid::QCD::PlaqPlusRectangleActionR Wilson(0.0,c1); // Just take beta = 0.0 + + return Wilson.S(Umu); +} +double calc_grid_IW(Grid::QCD::LatticeGaugeField & Umu) +{ + Grid::GridCartesian * UGrid = (Grid::GridCartesian *) Umu._grid; + + Grid::QCD::IwasakiGaugeActionR Iwasaki(beta); + + return Iwasaki.S(Umu); +} +double calc_grid_r_dir(Grid::QCD::LatticeGaugeField & Umu) +{ + Grid::GridCartesian * UGrid = (Grid::GridCartesian *) Umu._grid; + + std::vector U(4,UGrid); + for(int mu=0;mu(Umu,mu); + } + + Grid::QCD::LatticeComplex rect(UGrid); + Grid::QCD::TComplex trect; + Grid::QCD::Complex crect; + Grid::RealD vol = UGrid->gSites(); + for(int mu=0;mu::traceDirRectangle(rect,U,mu,nu); + trect = Grid::sum(rect); + crect = Grid::TensorRemove(trect); + std::cout<< "mu/nu = "< seeds4({1,2,3,4}); + + Grid::GridCartesian * UGrid = (Grid::GridCartesian *) Umu._grid; + + Grid::QCD::PlaqPlusRectangleActionR Wilson(0.0,c1); // Just take beta = 0.0 + + Grid::QCD::LatticeColourMatrix staple(UGrid); + Grid::QCD::LatticeColourMatrix link(UGrid); + Grid::QCD::LatticeComplex Traced(UGrid); + Grid::Complex Rplaq(0.0); + + for(int mu=0;mugSites(); + + // for mu, nu!=mu => 12 + // 6 loops contribute to staple for each orientation. + // Nc=3. + // Vol as for each site + Grid::RealD RectScale(1.0/vol/12.0/6.0/3.0); + + Grid::QCD::WilsonLoops::RectStaple(staple,Umu,mu); + + link = Grid::QCD::PeekIndex(Umu,mu); + + Traced = Grid::trace( link*staple) * RectScale; + Grid::QCD::TComplex Tp = Grid::sum(Traced); + Grid::Complex p = Grid::TensorRemove(Tp); + + std::cout<< "Rect from RectStaple "< seeds4({1,2,3,4}); + + Grid::GridCartesian * UGrid = (Grid::GridCartesian *) Umu._grid; + + Grid::QCD::PlaqPlusRectangleActionR Wilson(1.0,0.0); // Just take c1 = 0.0 + + Grid::QCD::LatticeColourMatrix staple(UGrid); + Grid::QCD::LatticeColourMatrix link(UGrid); + Grid::QCD::LatticeComplex Traced(UGrid); + Grid::Complex plaq(0.0); + + for(int mu=0;mugSites(); + + // for mu, nu!=mu => 12 + // 2 loops contribute to staple for each orientation. + // Nc=3. + // Vol as for each site + Grid::RealD Scale(1.0/vol/12.0/2.0/3.0); + + Grid::QCD::WilsonLoops::Staple(staple,Umu,mu); + + link = Grid::QCD::PeekIndex(Umu,mu); + + Traced = Grid::trace( link*staple) * Scale; + Grid::QCD::TComplex Tp = Grid::sum(Traced); + Grid::Complex p = Grid::TensorRemove(Tp); + + std::cout<< "Plaq from PlaqStaple "< +Author: paboyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include int Ls=8; @@ -425,13 +453,6 @@ void calc_chroma(ChromaAction action,Grid::QCD::LatticeGaugeField & lat, Grid::Q // Chroma::HotSt(u); Chroma::ChromaWrapper::ImportGauge(lat,u) ; - int lx = QDP::Layout::subgridLattSize()[0]; - int ly = QDP::Layout::subgridLattSize()[1]; - int lz = QDP::Layout::subgridLattSize()[2]; - int lt = QDP::Layout::subgridLattSize()[3]; - - QDP::multi1d procs = QDP::Layout::logicalSize(); - QDP::multi1d check(Ls); QDP::multi1d result(Ls); QDP::multi1d psi(Ls); diff --git a/tests/test_Grid_jacobi.cc b/tests/test_Grid_jacobi.cc index 0cf15a6f..3a00a088 100644 --- a/tests/test_Grid_jacobi.cc +++ b/tests/test_Grid_jacobi.cc @@ -1,3 +1,30 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/test_Grid_jacobi.cc + + Copyright (C) 2015 + +Author: Peter Boyle + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ #include "Grid.h" using namespace std;