{"id":18408808,"url":"https://github.com/codeplaysoftware/portdnn","last_synced_at":"2025-04-07T09:33:26.215Z","repository":{"id":37767512,"uuid":"135149045","full_name":"codeplaysoftware/portDNN","owner":"codeplaysoftware","description":"portDNN is a library implementing neural network algorithms written using SYCL","archived":false,"fork":false,"pushed_at":"2024-05-21T14:10:47.000Z","size":57835,"stargazers_count":108,"open_issues_count":0,"forks_count":21,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-11-05T09:44:38.764Z","etag":null,"topics":["cplusplus","cpp","cpp11","gpgpu","machine-learning","neural-network","opencl","sycl"],"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/codeplaysoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-05-28T10:59:33.000Z","updated_at":"2024-10-31T01:06:33.000Z","dependencies_parsed_at":"2024-05-21T15:44:08.272Z","dependency_job_id":null,"html_url":"https://github.com/codeplaysoftware/portDNN","commit_stats":null,"previous_names":["codeplaysoftware/portdnn"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeplaysoftware%2FportDNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeplaysoftware%2FportDNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeplaysoftware%2FportDNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeplaysoftware%2FportDNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeplaysoftware","download_url":"https://codeload.github.com/codeplaysoftware/portDNN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223275896,"owners_count":17118250,"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":["cplusplus","cpp","cpp11","gpgpu","machine-learning","neural-network","opencl","sycl"],"created_at":"2024-11-06T03:21:32.501Z","updated_at":"2024-11-06T03:21:33.355Z","avatar_url":"https://github.com/codeplaysoftware.png","language":"C++","readme":"# The portDNN neural network acceleration library\n\n## Table of Contents\n\n  * [Supported Platforms](#supported-platforms)\n  * [Getting Started with portDNN](#getting-started-with-portDNN)\n  * [Support](#support)\n  * [Cross-compilation with ComputeCpp](#cross-compilation-with-computecpp)\n  * [Contributions](#contributions)\n  * [Citation](#citation)\n\nportDNN is a library implementing various neural network algorithms such as\npooling and convolution written using SYCL and C++.\n\nportDNN currently supports the following operations:\n\n* 2D convolutions\n* 2D depthwise convolutions\n* 2D max \u0026 average pooling\n* Relu and tanh activations\n\nThe convolution operations have several implementations, including tiled and\nWinograd kernels. The supported data format is NHWC.\n\nThe project is maintained by [Codeplay Software][codeplay developer].\n\n## Supported Platforms\n\nThe master branch of portDNN is regularly tested with the \"Supported\" hardware\nlisted on [the ComputeCpp Supported Platforms page][supported platforms].\nportDNN may also work on other hardware and platforms assuming they implement\nSPIR or SPIR-V support. portDNN is primarily tested on Ubuntu 16.04 LTS with\nthe corresponding default package versions. portDNN will generally match the\nmost recently released ComputeCpp, though it is likely to be compatible with\nother versions. We test against the most recent version.\n\n## Getting Started with portDNN\n\n### Pre-requisites\n\n* CMake (version 3.5.1 and above)\n* OpenCL 1.2-capable hardware and drivers with SPIR 1.2 or SPIR-V support\n* OpenCL ICD Loader\n* OpenCL headers\n* gcc (version 5.4 and above)\n* [ComputeCpp][codeplay developer]\n* Building documentation requires Doxygen and Graphviz/Dot. Tested\n  against versions 1.8.11 and 2.38.0 respectively.\n\n### Building portDNN\n\nportDNN uses CMake as its build system. There are provisions in the CMake\nfiles for downloading portDNN's dependencies automatically, for finding\nother dependencies and for selecting which bits of portDNN to build. All\nthese configuration options can be found in the main CMakeLists.txt for the\nproject and will show up in the CMake GUI if you use it. By default, the\ntests and library will be built, but not the benchmarks.\n\nIt is recommended to leave the option `SNN_DOWNLOAD_MISSING_DEPS` set to\non. This will automatically download the source libraries necessary for\nportDNN to build and run (such as Google Test, Google benchmark and\nthe Eigen linear algebra library). Even if you already have these on your\nmachine, downloading them as part of the portDNN means a more consistent\nconfiguration.\n\n#### Building with ComputeCpp\n\nYou will need to provide the location of the ComputeCpp install you are\nusing in the variable `ComputeCpp_DIR`. It should point to the folder\nwhere `bin/`, `lib/` etc. are. This should be the only argument that is\nmandatory, everything else should be optional. The default build type is\nRelease, though this can be overridden.\n\nComputeCpp with portDNN does not currently support USM. If you build with\nComputeCpp you must disable USM support.\n\nThe following command shows how to compile portDNN.\n\n```bash\n# Setup build environment\nmkdir build \u0026\u0026 cd build\ncmake .. -DComputeCpp_DIR=/path/to/computecpp -DSNN_ENABLE_USM=OFF\n# Compile portDNN\nmake -j$(nproc)\n```\n\n#### Building with DPC++\n\nYou will need to provide the location of the DPC++ compiler to CMake to\nbuild with DPC++.\n\nDPC++ does support USM. USM support will be automatically built unless you\ndisable it with `-DSNN_ENABLE_USM=OFF`.\n\n```bash\nmkdir build \u0026\u0026 cd build\ncmake .. -DCMAKE_CXX_COMPILER=/path/to/llvm/bin/clang++ -DSNN_BUILD_BENCHMARKS=OFF -DSNN_BENCH_SYCLBLAS=OFF \n# Compile portDNN\nmake -j$(nproc)\n```\n\n### Undefined reference linker errors\n\nportDNN exposes optional features (`double` and `half` data types, `NCHW` data format, USM support), \nthat can be enabled and disabled when building the library.\n\nAttempting to use those feature in an application that links to a build of portDNN that doesn't support them may \ncause `undefined reference` error at link time. Please ensure that your build of portDNN has the required features enabled.\n\nYou can refer to [OPTIONS.md](docs/OPTIONS.md) for a full list of the supported CMake options.\n\n\n\n### Sample Code\n\nThe \"samples\" directory contains sample code for the 2D convolution and pooling\noperations offered by portDNN. These binaries are compiled when building portDNN\nusing CMake.\n\n### Running the portDNN Tests\n\nThe portDNN tests are compiled when building portDNN using CMake.\nThe following command shows how to run the tests.\n\n```bash\n# Run the tests\nctest\n# If compiled with benchmark support, run just the benchmarks\nctest -C Benchmark -E test\n```\n\n## Support\n\n### Bug reports and Issues\n\nBug reports are vital to provide feedback to the developers about what is going\nwrong with the project, you can raise these using the [\"Issues\"][issues]\nfeature in GitHub.\n\nPlease make sure that your bug report contains the following information:\n\n* A clear and descriptive title.\n* The output of\n  `clinfo | grep -E \"Platform ID|Name|Vendor|[Vv]ersion|Profile|Extensions\"`.\n* The output of `computecpp_info`.\n* The exact steps and commands to run to reproduce the bug.\n* The exact error text shown (if applicable), otherwise the behaviour you\n  expected and what you encountered instead.\n* Should the problem arise outside the project's test suite then please provide\n  a minimal test to allow us to reproduce the problem.\n\n## Cross-compilation with ComputeCpp\n\nportDNN supports cross-compilation targeting a number of devices. However,\nbecause of the two-step compilation process used in ComputeCpp, standard\nCMake toolchain files won't provide enough information to portDNN's build\nscripts to work properly.\n\nTo that end, two toolchains are available. The first, gcc-generic.cmake,\nwill likely work with any prebuilt GCC toolchain (it is not compatible\nwith those installed through package managers). The second is designed to\nwork with the poky toolchain available as part of the Yocto Linux system.\n\nThe first step is to download ComputeCpp for both the host machine you are\nrunning on and for the platform you would like to target. You should make\nsure to match the ComputeCpp version for both downloads. Both are required\nso that the host can run the compiler binary, while the tools can link\nusing the target device library. Similarly, acquire a GCC toolchain for\nthe platform you are targeting. Lastly you should download the OpenCL\nheaders. They are standard across all platforms, but you cannot specify\nthe default package-managed location of `/usr/include` for them, as that\nwill cause conflicts with other system headers. An easy fix is to download\nthe headers [from GitHub][ocl headers].\n\nToolchain files cannot make use cache variables set by the user when\nrunning CMake, as the cache does not exist when the toolchain is executed.\nEnvironment variables are available to toolchain files, however, so they\nare used to pass information to the toolchain. The gcc-generic.cmake\ntoolchain relies on the following environment variables:\n\n```cmake\nSNN_TARGET_TRIPLE # the triple of the platform you are targeting\nSNN_TOOLCHAIN_DIR # The root directory of the GCC you downloaded\nSNN_SYSROOT_DIR   # The system root, probably (but not necessarily)\n                  # ${SNN_TOOLCHAIN_DIR}/${SNN_TARGET_TRIPLE}/libc\n```\n\nCMake can then be invoked in a build directory as follows:\n\n```bash\ncmake -DComputeCpp_DIR=/path/to/computecpp \\\n      -DComputeCpp_HOST_DIR=/path/to/host/computecpp \\\n      -DOpenCL_INCLUDE_DIR=/path/to/opencl/headers \\\n      `# For cross-compiling, check documentation for your platform` \\\n      -DCOMPUTECPP_BITCODE=[(spir[32|64]|spirv[32|64]|ptx64)] \\\n      -DSNN_BUILD_DOCUMENTATION=OFF \\\n      `# Next options let you install the tests to a zippable folder` \\\n      -DSNN_BUILD_TESTS=ON \\\n      -DSNN_BUILD_BENCHMARKS=ON \\\n      -DSNN_INSTALL_TESTS=ON \\\n      -DSNN_INSTALL_BENCHMARKS=ON \\\n      `# This is the most important part - tells CMake to crosscompile` \\\n      -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchains/(gcc-generic|arm-gcc-poky).cmake \\\n      -DCMAKE_INSTALL_PREFIX=packaged-binaries \\\n      -GNinja ../\n```\n\nThe process for the poky toolchain is similar, save that you only need to\nprovide the `SNN_SYSROOT_DIR` environment variable. It should be set to\npoint to the directory named `sysroots` in the poky toolchain. You will\nlikely want `COMPUTECPP_BITCODE=spir32`. Otherwise, these instructions\nshould still work.\n\n## Contributions\n\nPlease see the file [CONTRIBUTING.md](CONTRIBUTING.md) for further details if\nyou would like to contribute code, build systems, bug fixes or similar.\n\n## Citation\n\nIf you use portDNN in your research, please cite the library as follows:\n\n\u003e Rod Burns, John Lawson, Duncan McBain, and Daniel Soutar. 2019. *Accelerated\n\u003e Neural Networks on OpenCL Devices Using portDNN.* In Proceedings of the\n\u003e International Workshop on OpenCL (IWOCL'19). ACM, New York, NY, USA, Article\n\u003e 10, 4 pages. DOI: https://doi.org/10.1145/3318170.3318183\n\n```bibtex\n@inproceedings{Burns:2019:ANN:3318170.3318183,\n author = {Burns, Rod and Lawson, John and McBain, Duncan and Soutar, Daniel},\n title = {Accelerated Neural Networks on OpenCL Devices Using portDNN},\n booktitle = {Proceedings of the International Workshop on OpenCL},\n series = {IWOCL'19},\n year = {2019},\n isbn = {978-1-4503-6230-6},\n location = {Boston, MA, USA},\n pages = {10:1--10:4},\n articleno = {10},\n numpages = {4},\n url = {http://doi.acm.org/10.1145/3318170.3318183},\n doi = {10.1145/3318170.3318183},\n acmid = {3318183},\n publisher = {ACM},\n address = {New York, NY, USA},\n keywords = {GPGPU, OpenCL, SYCL, machine learning, neural networks},\n}\n```\n\n[supported platforms]: https://developer.codeplay.com/products/computecpp/ce/guides/platform-support\n[issues]: https://github.com/codeplaysoftware/portDNN/issues\n[ocl headers]: https://github.com/KhronosGroup/OpenCL-Headers\n[codeplay developer]: https://developer.codeplay.com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeplaysoftware%2Fportdnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeplaysoftware%2Fportdnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeplaysoftware%2Fportdnn/lists"}