{"id":13314643,"url":"https://github.com/kokkos/kokkos-kernels","last_synced_at":"2025-12-12T15:09:56.154Z","repository":{"id":37451608,"uuid":"78572774","full_name":"kokkos/kokkos-kernels","owner":"kokkos","description":"Kokkos C++ Performance Portability Programming Ecosystem: Math Kernels - Provides BLAS, Sparse BLAS and Graph Kernels","archived":false,"fork":false,"pushed_at":"2025-05-13T23:21:15.000Z","size":31428,"stargazers_count":337,"open_issues_count":252,"forks_count":107,"subscribers_count":30,"default_branch":"develop","last_synced_at":"2025-05-14T01:13:18.051Z","etag":null,"topics":["blas","hpsf","kokkos","linear-algebra","performance-portability","sparse-matrix"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kokkos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-01-10T20:49:21.000Z","updated_at":"2025-05-13T23:21:19.000Z","dependencies_parsed_at":"2023-10-11T22:44:14.069Z","dependency_job_id":"6f49acf7-f305-4a64-870d-e609bcd33dc9","html_url":"https://github.com/kokkos/kokkos-kernels","commit_stats":{"total_commits":3468,"total_committers":86,"mean_commits":"40.325581395348834","dds":0.8734140715109573,"last_synced_commit":"b9c1bab7a8ae7c9413ad09f612f9011ff04a819e"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kokkos%2Fkokkos-kernels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kokkos%2Fkokkos-kernels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kokkos%2Fkokkos-kernels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kokkos%2Fkokkos-kernels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kokkos","download_url":"https://codeload.github.com/kokkos/kokkos-kernels/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337612,"owners_count":22054253,"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":["blas","hpsf","kokkos","linear-algebra","performance-portability","sparse-matrix"],"created_at":"2024-07-29T18:11:50.534Z","updated_at":"2025-12-12T15:09:56.139Z","avatar_url":"https://github.com/kokkos.png","language":"C++","funding_links":[],"categories":["Parallelism \u0026 HPC"],"sub_categories":[],"readme":"[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/kokkos/kokkos-kernels/badge)](https://securityscorecards.dev/viewer/?uri=github.com/kokkos/kokkos-kernels)\n[![kokkos-kernels/docs](https://github.com/kokkos/kokkos-kernels/actions/workflows/docs.yml/badge.svg)](https://kokkos.org/kokkos-kernels/docs)\n\n![KokkosKernels](https://avatars2.githubusercontent.com/u/10199860?s=200\u0026v=4)\n\n# Kokkos Kernels\n\nKokkos C++ Performance Portability Programming EcoSystem: Math Kernels -\nProvides BLAS, Sparse BLAS and Graph Kernels \n\nKokkosKernels implements local computational kernels for linear\nalgebra and graph operations, using the Kokkos shared-memory parallel\nprogramming model.  \"Local\" means not using MPI, or running within a\nsingle MPI process without knowing about MPI.  \"Computational kernels\"\nare coarse-grained operations; they take a lot of work and make sense\nto parallelize inside using Kokkos.  KokkosKernels can be the building\nblock of a parallel linear algebra library like Tpetra that uses MPI\nand threads for parallelism, or it can be used stand-alone in your\napplication.\n\nComputational kernels in this subpackage include the following:\n\n* (Multi)vector dot products, norms, and updates (AXPY-like\n    operations that add vectors together entry-wise)\n* Sparse matrix-vector multiply and other sparse matrix / dense\n    vector kernels\n* Sparse matrix-matrix multiply\n* Graph coloring\n* Gauss-Seidel with coloring (generalization of red-black)\n* Other linear algebra and graph operations\n\nWe organize this directory as follows:\n\n1. Public interfaces to computational kernels live in the src/\n     subdirectory (kokkos-kernels/src):\n\n*    Kokkos_Blas1_MV.hpp: (Multi)vector operations that\n       Tpetra::MultiVector uses\n*    Kokkos_Sparse_CrsMatrix.hpp: Declaration and definition of\n       KokkosSparse::CrsMatrix, the sparse matrix data structure used\n       for the computational kernels below\n*    KokkosSparse_spmv.hpp: Sparse matrix-vector multiply with a\n       single vector, stored in a 1-D View + Sparse matrix-vector multiply with\n       multiple vectors at a time (multivectors), stored in a 2-D View\n\n2. Implementations of computational kernels live in the src/impl/\n     subdirectory (kokkos-kernels/src/impl)\n\n3. Correctness tests live in the unit_test/ subdirectory, and\n     performance tests live in the perf_test/ subdirectory\n\n4. Simple example scripts to build Kokkoskernels are in\n     example/buildlib/\n\n\nDo NOT use or rely on anything in the `KokkosBlas::Impl` namespace, or\non anything in the impl/ subdirectory.\n\nThis separation of interface and implementation lets the interface\nassign the users' Views to View types with the desired attributes\n(e.g., read-only, RandomRead).  This also makes it easier to provide\nfull specializations of the implementation.  \"Full specializations\"\nmean that all the template parameters are fixed, so that the compiler\ncan actually compile the code.  This technique keeps your library's or\napplication's build times down, since kernels are already precompiled\nfor certain template parameter combinations.  It also improves\nperformance, since compilers have an easier time optimizing code in\nshorter .cpp files.\n\n## Building Kokkoskernels\n\n### CMake\nFollowing Kokkos style, all CMake options are of the form\n````\nKokkosKernels_ENABLE_OPTION\n````\nwith options capitalized at the end. Almost all Kokkos Kernels options determine\nwhether ETI is used with a particular datatype, e.g.\n````\n-DKokkosKernels_INST_DOUBLE=On \n````\nwhich does explicit instantation of all kernels for double type.\nKokkos Kernels derives most of its CXXFLAGS, C++ standard, architecture flags,\nand other options from an installed (or in-tree) Kokkos package.\nTuning for a particular device or architecture is generally done through *Kokkos*\nwhile tuning which kernels get instantiated is done through *Kokkos Kernels*.\n\nKokkos Kernels does supply flags for *asserting* properies of the linked Kokkos,\nfor example:\n````\n-DKokkosKernels_REQUIRE_DEVICES=CUDA\n-DKokkosKernels_REQUIRE_OPTIONS=cuda_relocatable_device_code\n````\nThis does *NOT* enable CUDA directly, but rather verifies that the underlying Kokkos supports\nthe desired option. If the underlying Kokkos was not built properly, CMake will crash\nand tell you to re-build Kokkos. The values (unlike the option names) are not case-sensitive.\nMore details can be found in the [build instructions](BUILD.md) or [developer instructions](DEVELOPER.md).\n\n\n### Spack\n\nAn alternative to manually building with the CMake is to use the Spack package manager.\nTo do so, download the `kokkos-spack` git repo and add to the package list:\n````\nspack repo add $path-to-kokkos-spack\n````\nA basic installation would be done as:\n````\nspack install kokkos-kernels\n````\nSpack allows options and and compilers to be tuned in the install command.\n````\nspack install kokkos-kernels@3.0 +double %gcc@7.3.0 +openmp\n````\nThis example illustrates the three most common parameters to Spack:\n* Variants: specified with, e.g. `+openmp`, this activates (or deactivates with, e.g. `~openmp`) certain options.\n* Version:  immediately following `kokkos-kernels` the `@version` can specify a particular Kokkos Kernels to build\n* Compiler: a default compiler will be chosen if not specified, but an exact compiler version can be given with the `%`option.\n\nFor a complete list of Kokkos Kernels options, run:\n````\nspack info kokkos-kernels\n````\n\n#### Tuning Kokkos Options\nAs discussed above in the CMake section, Kokkos Kernels inherits much of its configuration from the installed Kokkos.\nSpack gives a mechanism for directly specifying Kokkos dependency options:\n````\nspack install kokkos-kernels ^kokkos@3.0+cuda+cuda_uvm\n````\nThe carat `^` sepcifies an exact dependency configuration, which in this case activates CUDA and CUDA_UVM.\nFor a complete list of tunable Kokkos options, run\n````\nspack info kokkos\n````\n\n#### Setting up a development environment with Spack\nSpack is generally most useful for installng packages to use.\nIf you want to install all *dependencies* of Kokkos Kernels first so that you can actively develop a given Kokkos Kernels source this can still be done. Go to the Kokkos Kernels source code folder and run:\n````\nspack diy -u cmake kokkos-kernels@{version} ...\n````\nspecifying the exact version you want to develop and giving any spec options in `...`.\nThis creates a folder `spack-build` where you can `make`.\n\n### Trilinos\nFor Trilinos builds with the Cuda backend and complex double enabled with ETI,\nthe cmake option below may need to be set to avoid Error 127 errors:\n`CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL=ON`\n\nIf the option above is not set, a warning will be issued during configuration:\n\n\"The CMake option CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS is either\nundefined or OFF.  Please set\nCMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL=ON when building with CUDA and\ncomplex double enabled.\"\n\n\n## Using Kokkoskernels Test Drivers \n\nIn `perf_test` there are test drivers.\n\n* `KokkosGraph_triangle.exe` : Triangle counting driver. \n* `KokkosSparse_spgemm.exe` : Sparse Matrix Sparse Matrix Multiply: \n* *****NOTE: KKMEM is outdated. Use default algorithm: KKSPGEMM = KKDEFAULT = DEFAULT****\n* Or within the code:\n*     kh.create_spgemm_handle(KokkosSparse::SPGEMM_KK);\n* `KokkosSparse_spmv.exe` : Sparse matvec.\n* `KokkosSparse_pcg.exe`  : CG method with Gauss Seidel as preconditioner.\n* `KokkosGraph_color.exe` : Distance-1 Graph coloring \n* `KokkosKernels_MatrixConverter.exe` : given a matrix market format, converts it \".bin\"\n   binary format for fast input output readings, which can be read by other test drivers.\n   \nPlease report bugs or performance issues to: https://github.com/kokkos/kokkos-kernels/issues\n\n##### [LICENSE](https://github.com/kokkos/kokkos-kernels/blob/devel/LICENSE)\n[![License](https://img.shields.io/badge/License-Apache--2.0_WITH_LLVM--exception-blue)](https://spdx.org/licenses/LLVM-exception.html)\n\nUnder the terms of Contract DE-NA0003525 with NTESS,\nthe U.S. Government retains certain rights in this software.\n\nThe full license statement used in all headers is available [here](https://kokkos.org/kokkos-core-wiki/license.html) or\n[here](https://github.com/kokkos/kokkos-kernels/blob/develop/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkokkos%2Fkokkos-kernels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkokkos%2Fkokkos-kernels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkokkos%2Fkokkos-kernels/lists"}