{"id":18416777,"url":"https://github.com/fynv/thrustrtc","last_synced_at":"2025-04-07T12:32:08.070Z","repository":{"id":45487616,"uuid":"176212363","full_name":"fynv/ThrustRTC","owner":"fynv","description":"CUDA tool set for non-C++ languages that provides similar functionality like Thrust, with NVRTC at its core.","archived":false,"fork":false,"pushed_at":"2022-08-13T05:18:56.000Z","size":1201,"stargazers_count":59,"open_issues_count":4,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-22T18:41:11.396Z","etag":null,"topics":["cuda","nvrtc","thrust"],"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/fynv.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}},"created_at":"2019-03-18T05:46:05.000Z","updated_at":"2024-05-03T04:19:40.000Z","dependencies_parsed_at":"2022-07-18T23:18:08.865Z","dependency_job_id":null,"html_url":"https://github.com/fynv/ThrustRTC","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fynv%2FThrustRTC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fynv%2FThrustRTC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fynv%2FThrustRTC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fynv%2FThrustRTC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fynv","download_url":"https://codeload.github.com/fynv/ThrustRTC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247653159,"owners_count":20973775,"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":["cuda","nvrtc","thrust"],"created_at":"2024-11-06T04:07:14.418Z","updated_at":"2025-04-07T12:32:03.046Z","avatar_url":"https://github.com/fynv.png","language":"C++","readme":"# ThrustRTC\n\nThe aim of the project is to provide a library of general GPU algorithms, functionally similar to [Thrust](https://github.com/thrust/thrust/), that can be used in non-C++ programming launguages that has an interface with C/C++ (Python, C#, JAVA etc).\n\nThis projects uses a new CUDA programming paradigm: NVRTC + dynamic-instantiation, as an alternative to the well\nestablish \"CUDA runtime + static compilation + templates\" paradigm.\n\nClick [here](https://fynv.github.io/ProgrammingGPUAcrossTheLaunguageBoundaries.html) to learn more about the new paradigm.\n\n## Using ThrustRTC in different languages\n\nThe usage of this library is quite simlar to using Thrust, except that you can use it Python, C# and JAVA, and CUDA SDK is not required.\n\nThrust, C++:\n\n```cpp\n#include \u003cvector\u003e\n#include \u003cthrust/replace.h\u003e\n#include \u003cthrust/device_vector.h\u003e\n\nstd::vector\u003cint\u003e hdata({ 1, 2, 3, 1, 2  });\nthrust::device_vector\u003cint\u003e A(hdata);\nthrust::replace(A.begin(), A.end(), 1, 99);\n\n// A contains { 99, 2, 3, 99, 2}\n```\n\nThrustRTC, in C++:\n```cpp\n#include \"TRTCContext.h\"\n#include \"DVVector.h\"\n#include \"replace.h\"\n\nint hdata[5] = { 1,2,3,1,2 };\nDVVector A(\"int32_t\", 5, hdata);\nTRTC_Replace(A, DVInt32(1), DVInt32(99));\n\n// A contains { 99, 2, 3, 99, 2}\n```\n\nThrustRTC, in Python:\n\n```python\nimport ThrustRTC as trtc\n\nA = trtc.device_vector_from_list([1, 2, 3, 1, 2], 'int32_t')\ntrtc.Replace(A, trtc.DVInt32(1), trtc.DVInt32(99))\n\n# A contains [99, 2, 3, 99, 2]\n```\n\nThrustRTC, in C#:\n```cs\nusing ThrustRTCSharp;\n\nDVVector A = new DVVector(new int[] { 1, 2, 3, 1, 2 });\nTRTC.Replace(A, new DVInt32(1), new DVInt32(99));\n\n// A contains { 99, 2, 3, 99, 2}\n```\n\nThrustRTC, in JAVA:\n```java\nimport JThrustRTC.*;\n\nDVVector vec = new DVVector(new int[] { 1, 2, 3, 1, 2 });\nTRTC.Replace(vec, new DVInt32(1), new DVInt32(99));\n\n// A contains { 99, 2, 3, 99, 2}\n```\n\nA significant difference between ThrustRTC and Thrust is that ThrustRTC does not include the iterators. \nAll operations explicitly work on vectors types. There are adaptive objects that can be used to map to \na sub-range of a vector instead of using the whole vector.\n\n## Quick Start Guide\n\n[Quick Start Guide - for Python users](https://fynv.github.io/ThrustRTC/QuickStartGuide.html)\n\n[Quick Start Guide - for C# users](https://fynv.github.io/ThrustRTC/QuickStartGuide_cs.html)\n\n[Quick Start Guide - for JAVA users](https://fynv.github.io/ThrustRTC/QuickStartGuide_java.html)\n\n\n## Demos\n\nUsing ThrustRTC for histogram calculation and k-means clustering.\n\n[https://fynv.github.io/ThrustRTC/Demo.html](https://fynv.github.io/ThrustRTC/Demo.html)\n\n## License \n\nI've decided to license this project under ['\"Anti 996\" License'](https://github.com/996icu/996.ICU/blob/master/LICENSE)\n\nBasically, you can use the code any way you like unless you are working for a 996 company.\n\n[![996.icu](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu)\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffynv%2Fthrustrtc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffynv%2Fthrustrtc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffynv%2Fthrustrtc/lists"}