{"id":13678045,"url":"https://github.com/codee-com/open-catalog","last_synced_at":"2025-04-29T12:33:02.198Z","repository":{"id":219087343,"uuid":"748109007","full_name":"codee-com/open-catalog","owner":"codee-com","description":"This catalog is a collaborative effort to consolidate the collective wisdom of performance experts on the best practices for performance. It consists of a glossary and a list of checks for the C, C++ and Fortran programming languages.","archived":false,"fork":false,"pushed_at":"2024-05-28T15:16:06.000Z","size":562,"stargazers_count":62,"open_issues_count":5,"forks_count":4,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-05-29T01:39:59.507Z","etag":null,"topics":["c","cpu","fortran","gpu","performance"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codee-com.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-25T09:45:02.000Z","updated_at":"2024-05-30T09:59:17.629Z","dependencies_parsed_at":"2024-01-25T12:08:35.817Z","dependency_job_id":"800d15f7-2a88-4034-8946-53409d7e4f3d","html_url":"https://github.com/codee-com/open-catalog","commit_stats":null,"previous_names":["codee-com/open-catalog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codee-com%2Fopen-catalog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codee-com%2Fopen-catalog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codee-com%2Fopen-catalog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codee-com%2Fopen-catalog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codee-com","download_url":"https://codeload.github.com/codee-com/open-catalog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224173464,"owners_count":17268117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpu","fortran","gpu","performance"],"created_at":"2024-08-02T13:00:49.629Z","updated_at":"2025-04-29T12:33:02.160Z","avatar_url":"https://github.com/codee-com.png","language":"C","readme":"---\nsidebar_position: 1\nsidebar_label: Index\n---\n\n# Open Catalog of Code Guidelines for Correctness, Modernization, Security, Portability, and Optimization\n\n## About\n\nThis Open Catalog is a collaborative effort to consolidate expert knowledge on\ncode guidelines for the correctness, modernization, security, portability, and\noptimization of code written in C, C++, and Fortran programming languages. The\nCatalog consists of a comprehensive set of checks (rules) that describe specific\nissues in the source code and provide guidance on corrective actions, along with\nextensive documentation, example codes and references to additional reading\nresources.\n\n## Benchmarks\n\nThe Open Catalog includes\n[a suite of microbenchmarks](https://github.com/codee-com/open-catalog/tree/main/Benchmark/)\ndesigned to demonstrate:\n\n- No performance degradation when implementing the correctness, modernization,\n  and security recommendations.\n- Potential performance enhancements achievable through the optimization\n  recommendations.\n\n## Checks\n\n| ID                       | Title                                                                                                       | Category                                           | C | Fortran | C++ | AutoFix |\n|:------------------------:|:-----------------------------------------------------------------------------------------------------------:|:--------------------------------------------------:|:-:|:-------:|:---:|:-------:|\n| [PWR001](Checks/PWR001/) | Pass global variables as function arguments                                                                 | correctness, modernization, security               | ✓ | ✓       | ✓   |         |\n| [PWR002](Checks/PWR002/) | Declare scalar variables in the smallest possible scope                                                     | correctness, security                              | ✓ |         | ✓   |         |\n| [PWR003](Checks/PWR003/) | Explicitly declare pure functions                                                                           | modernization, security, optimization              | ✓ | ✓       | ✓   |         |\n| [PWR004](Checks/PWR004/) | Declare OpenMP scoping for all variables                                                                    | correctness                                        | ✓ | ✓       | ✓   |         |\n| [PWR005](Checks/PWR005/) | Disable default OpenMP scoping                                                                              | correctness                                        | ✓ | ✓       | ✓   |         |\n| [PWR006](Checks/PWR006/) | Avoid privatization of read-only variables                                                                  | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR007](Checks/PWR007/) | Disable the implicit declaration of variables and procedures                                                | correctness, modernization, security               |   | ✓       |     | ✓[^1]   |\n| [PWR008](Checks/PWR008/) | Declare the intent for each procedure argument                                                              | correctness, modernization, security               |   | ✓       |     | ✓[^1]   |\n| [PWR009](Checks/PWR009/) | Use OpenMP teams to offload work to GPU                                                                     | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR010](Checks/PWR010/) | Avoid column-major array access in C/C++                                                                    | optimization                                       | ✓ |         | ✓   |         |\n| [PWR012](Checks/PWR012/) | Pass only required fields from derived type as arguments                                                    | modernization, optimization                        | ✓ | ✓       | ✓   |         |\n| [PWR013](Checks/PWR013/) | Avoid copying unused variables to or from the GPU                                                           | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR014](Checks/PWR014/) | Out-of-dimension-bounds matrix access                                                                       | correctness, security                              | ✓ |         | ✓   |         |\n| [PWR015](Checks/PWR015/) | Avoid copying unnecessary array elements to or from the GPU                                                 | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR016](Checks/PWR016/) | Use separate arrays instead of an Array-of-Structs                                                          | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR017](Checks/PWR017/) | Using countable while loops instead of for loops may inhibit vectorization                                  | optimization                                       | ✓ |         | ✓   |         |\n| [PWR018](Checks/PWR018/) | Call to recursive function within a loop inhibits vectorization                                             | security, optimization                             | ✓ | ✓       | ✓   |         |\n| [PWR019](Checks/PWR019/) | Consider interchanging loops to favor vectorization by maximizing inner loop's trip count                   | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR020](Checks/PWR020/) | Consider loop fission to enable vectorization                                                               | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR021](Checks/PWR021/) | Consider loop fission with scalar to vector promotion to enable vectorization                               | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR022](Checks/PWR022/) | Move invariant conditional out of the loop to facilitate vectorization                                      | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR023](Checks/PWR023/) | Add 'restrict' for pointer function arguments to hint the compiler that vectorization is safe               | optimization                                       | ✓ |         | ✓   |         |\n| [PWR024](Checks/PWR024/) | Loop can be rewritten in OpenMP canonical form                                                              | optimization                                       | ✓ |         | ✓   |         |\n| [PWR025](Checks/PWR025/) | Consider annotating pure function with OpenMP 'declare simd'                                                | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR026](Checks/PWR026/) | Annotate function for OpenMP Offload                                                                        | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR027](Checks/PWR027/) | Annotate function for OpenACC Offload                                                                       | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR028](Checks/PWR028/) | Remove pointer increment preventing performance optimization                                                | security, optimization                             | ✓ |         | ✓   |         |\n| [PWR029](Checks/PWR029/) | Remove integer increment preventing performance optimization                                                | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR030](Checks/PWR030/) | Remove pointer assignment preventing performance optimization for perfectly nested loops                    | security, optimization                             | ✓ | ✓       | ✓   |         |\n| [PWR031](Checks/PWR031/) | Replace pow by multiplication, division and/or square root                                                  | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR032](Checks/PWR032/) | Avoid calls to mathematical functions with higher precision than required                                   | optimization                                       | ✓ |         | ✓   |         |\n| [PWR033](Checks/PWR033/) | Move invariant conditional out of the loop to avoid redundant computations                                  | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR034](Checks/PWR034/) | Avoid strided array access to improve performance                                                           | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR035](Checks/PWR035/) | Avoid non-consecutive array access to improve performance                                                   | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR036](Checks/PWR036/) | Avoid indirect array access to improve performance                                                          | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR037](Checks/PWR037/) | Potential precision loss in call to mathematical function                                                   | correctness, security                              | ✓ |         | ✓   |         |\n| [PWR039](Checks/PWR039/) | Consider loop interchange to improve the locality of reference and enable vectorization                     | optimization                                       | ✓ | ✓       | ✓   | ✓[^1]   |\n| [PWR040](Checks/PWR040/) | Consider loop tiling to improve the locality of reference                                                   | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR042](Checks/PWR042/) | Consider loop interchange by promoting the scalar reduction variable to an array                            | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR043](Checks/PWR043/) | Consider loop interchange by replacing the scalar reduction value                                           | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR044](Checks/PWR044/) | Avoid unnecessary floating-point data conversions involving constants                                       | optimization                                       | ✓ |         | ✓   |         |\n| [PWR045](Checks/PWR045/) | Replace division with a multiplication with a reciprocal                                                    | optimization                                       | ✓ |         | ✓   |         |\n| [PWR046](Checks/PWR046/) | Replace two divisions with a division and a multiplication                                                  | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR048](Checks/PWR048/) | Replace multiplication/addition combo with an explicit call to fused multiply-add                           | optimization                                       | ✓ |         | ✓   |         |\n| [PWR049](Checks/PWR049/) | Move iterator-dependent condition outside of the loop                                                       | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR050](Checks/PWR050/) | Consider applying multithreading parallelism to forall loop                                                 | optimization                                       | ✓ | ✓       | ✓   | ✓[^1]   |\n| [PWR051](Checks/PWR051/) | Consider applying multithreading parallelism to scalar reduction loop                                       | optimization                                       | ✓ | ✓       | ✓   | ✓[^1]   |\n| [PWR052](Checks/PWR052/) | Consider applying multithreading parallelism to sparse reduction loop                                       | optimization                                       | ✓ | ✓       | ✓   | ✓[^1]   |\n| [PWR053](Checks/PWR053/) | Consider applying vectorization to forall loop                                                              | optimization                                       | ✓ | ✓       | ✓   | ✓[^1]   |\n| [PWR054](Checks/PWR054/) | Consider applying vectorization to scalar reduction loop                                                    | optimization                                       | ✓ | ✓       | ✓   | ✓[^1]   |\n| [PWR055](Checks/PWR055/) | Consider applying offloading parallelism to forall loop                                                     | optimization                                       | ✓ | ✓       | ✓   | ✓[^1]   |\n| [PWR056](Checks/PWR056/) | Consider applying offloading parallelism to scalar reduction loop                                           | optimization                                       | ✓ | ✓       | ✓   | ✓[^1]   |\n| [PWR057](Checks/PWR057/) | Consider applying offloading parallelism to sparse reduction loop                                           | optimization                                       | ✓ | ✓       | ✓   | ✓[^1]   |\n| [PWR060](Checks/PWR060/) | Consider loop fission to separate gather memory access pattern                                              | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR062](Checks/PWR062/) | Consider loop interchange by removing accumulation on array value                                           | optimization                                       | ✓ | ✓       | ✓   |         |\n| [PWR063](Checks/PWR063/) | Avoid using legacy Fortran constructs                                                                       | correctness, modernization, security               |   | ✓       |     |         |\n| [PWR068](Checks/PWR068/) | Encapsulate procedures within modules to avoid the risks of calling implicit interfaces                     | correctness, modernization, security               |   | ✓       |     |         |\n| [PWR069](Checks/PWR069/) | Use the keyword only to explicitly state what to import from a module                                       | correctness, modernization, security               |   | ✓       |     | ✓[^1]   |\n| [PWR070](Checks/PWR070/) | Declare array dummy arguments as assumed-shape arrays                                                       | correctness, modernization, security, optimization |   | ✓       |     |         |\n| [PWR071](Checks/PWR071/) | Prefer real(kind=kind_value) for declaring consistent floating types                                        | modernization, portability, security               |   | ✓       |     |         |\n| [PWR072](Checks/PWR072/) | Explicitly declare the 'save' attribute or split the variable initialization to prevent unintended behavior | correctness, security                              |   | ✓       |     | ✓[^1]   |\n| [PWR073](Checks/PWR073/) | Transform common block into a module for better data encapsulation                                          | correctness, modernization, security               |   | ✓       |     |         |\n| [PWR075](Checks/PWR075/) | Avoid using GNU Fortran extensions                                                                          | modernization, portability, security               |   | ✓       |     |         |\n| [PWR079](Checks/PWR079/) | Avoid undefined behavior due to uninitialized variables                                                     | correctness, portability, security                 | ✓ | ✓       | ✓   |         |\n| [PWD002](Checks/PWD002/) | Unprotected multithreading reduction operation                                                              | correctness, security                              | ✓ | ✓       | ✓   |         |\n| [PWD003](Checks/PWD003/) | Missing array range in data copy to the GPU                                                                 | correctness, security                              | ✓ | ✓       | ✓   |         |\n| [PWD004](Checks/PWD004/) | Out-of-memory-bounds array access                                                                           | correctness, security                              | ✓ | ✓       | ✓   |         |\n| [PWD005](Checks/PWD005/) | Array range copied to or from the GPU does not cover the used range                                         | correctness, security                              | ✓ | ✓       | ✓   |         |\n| [PWD006](Checks/PWD006/) | Missing deep copy of non-contiguous data to the GPU                                                         | correctness, security                              | ✓ | ✓       | ✓   |         |\n| [PWD007](Checks/PWD007/) | Unprotected multithreading recurrence                                                                       | correctness, security                              | ✓ | ✓       | ✓   |         |\n| [PWD008](Checks/PWD008/) | Unprotected multithreading recurrence due to out-of-dimension-bounds array access                           | correctness, security                              | ✓ | ✓       | ✓   |         |\n| [PWD009](Checks/PWD009/) | Incorrect privatization in parallel region                                                                  | correctness                                        | ✓ | ✓       | ✓   |         |\n| [PWD010](Checks/PWD010/) | Incorrect sharing in parallel region                                                                        | correctness, security                              | ✓ | ✓       | ✓   |         |\n| [PWD011](Checks/PWD011/) | Missing OpenMP lastprivate clause                                                                           | correctness                                        | ✓ | ✓       | ✓   |         |\n| [RMK001](Checks/RMK001/) | Loop nesting that might benefit from hybrid parallelization using multithreading and SIMD                   | optimization                                       | ✓ | ✓       | ✓   |         |\n| [RMK002](Checks/RMK002/) | Loop nesting that might benefit from hybrid parallelization using offloading and SIMD                       | optimization                                       | ✓ | ✓       | ✓   |         |\n| [RMK003](Checks/RMK003/) | Potentially privatizable temporary variable                                                                 | optimization                                       | ✓ |         | ✓   |         |\n| [RMK007](Checks/RMK007/) | Vectorization opportunity within a multithreaded region                                                     | optimization                                       | ✓ | ✓       | ✓   |         |\n| [RMK008](Checks/RMK008/) | Vectorization opportunity within an offloaded region                                                        | optimization                                       | ✓ | ✓       | ✓   |         |\n| [RMK009](Checks/RMK009/) | Outline loop to increase compiler and tooling code coverage                                                 | optimization                                       | ✓ |         | ✓   |         |\n| [RMK010](Checks/RMK010/) | Strided memory accesses in the loop body may prevent vectorization                                          | optimization                                       | ✓ | ✓       | ✓   |         |\n| [RMK012](Checks/RMK012/) | Conditional execution in the loop body may prevent vectorization                                            | optimization                                       | ✓ | ✓       | ✓   |         |\n| [RMK013](Checks/RMK013/) | Low trip count unknown at compile time may prevent vectorization of the loop                                | optimization                                       | ✓ | ✓       | ✓   |         |\n| [RMK014](Checks/RMK014/) | Unpredictable memory accesses in the loop body may prevent vectorization                                    | optimization                                       | ✓ | ✓       | ✓   |         |\n| [RMK015](Checks/RMK015/) | Tune compiler optimization flags to increase the speed of the code                                          | optimization                                       | ✓ | ✓       | ✓   |         |\n| [RMK016](Checks/RMK016/) | Tune compiler optimization flags to avoid potential changes in floating point precision                     | correctness, security                              | ✓ | ✓       | ✓   |         |\n\n**AutoFix**: Denotes tools that support automatic correction of the\ncorresponding check. Readers are encouraged to report additional tools with\nautofix capabilities for these checks. The tools are tagged in the table as\nfollows:\n\n## Contributing\n\nWe welcome and encourage contributions to the Open Catalog! Here's how you can\nget involved:\n\n1. **Join the discussion:**\n\n    Got ideas, questions, or suggestions? Head over to our [GitHub\n    Discussions](https://github.com/codee-com/open-catalog/discussions). It's\n    the perfect place for open-ended conversations and brainstorming!\n\n2. **Report issues:**\n\n    Found inaccuracies, unclear explanations, or other problems? Please open an\n    [Issue](https://github.com/codee-com/open-catalog/issues). Detailed reports\n    help us quickly improve the quality of the project!\n\n3. **Submit pull requests:**\n\n    Interested in solving any issues? Feel free to fork the repository, make\n    your changes, and submit a [Pull\n    Request](https://github.com/codee-com/open-catalog/pulls). We'd love to see\n    your contributions!\n\n\n[^1]: [Codee](https://www.codee.com)\n","funding_links":[],"categories":["Programming languages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodee-com%2Fopen-catalog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodee-com%2Fopen-catalog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodee-com%2Fopen-catalog/lists"}