{"id":23252962,"url":"https://github.com/fabryprog/java-gpu","last_synced_at":"2026-04-15T16:31:24.296Z","repository":{"id":91197418,"uuid":"152652943","full_name":"Fabryprog/java-gpu","owner":"Fabryprog","description":"Support for offloading parallel-for loops in Java to NVIDIA CUDA compatible cards.","archived":false,"fork":false,"pushed_at":"2018-10-11T20:54:17.000Z","size":134,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T08:57:53.250Z","etag":null,"topics":["cuda","gpu","java","nvidia","parallel-computing"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/Fabryprog.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":"2018-10-11T20:39:37.000Z","updated_at":"2025-03-21T16:07:48.000Z","dependencies_parsed_at":"2023-06-29T03:16:41.385Z","dependency_job_id":null,"html_url":"https://github.com/Fabryprog/java-gpu","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Fabryprog/java-gpu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fabryprog%2Fjava-gpu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fabryprog%2Fjava-gpu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fabryprog%2Fjava-gpu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fabryprog%2Fjava-gpu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fabryprog","download_url":"https://codeload.github.com/Fabryprog/java-gpu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fabryprog%2Fjava-gpu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31849690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","gpu","java","nvidia","parallel-computing"],"created_at":"2024-12-19T10:20:30.354Z","updated_at":"2026-04-15T16:31:24.275Z","avatar_url":"https://github.com/Fabryprog.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# java-gpu\nSupport for offloading parallel-for loops in Java to NVIDIA CUDA compatible cards.\n\nBy introducing a _@Parallel_ annotation, loops can be annotated as parallel. An extra compilation can then offload these to NVIDIA CUDA compatible graphics cards. Data transfers are handled automatically, and no CUDA C code has to be written explicitly.\n\nA full dissertation about this is available: * Peter Calvert: **Parallelisation of Java for Graphics Processors**. Part II Dissertation, Computer Science Tripos, University of Cambridge June 2010.\n\nAMD's [APARAPI](https://github.com/aparapi/aparapi) project attempts to achieve very similar goals to this project, and is still being maintained (so is more likely to work across a range of systems). The key difference is that they introduce **kernel** classes rather than operating on for loops, and have slightly different restrictions on the code that can be placed within GPU sections. It is possible that some of the techniques used here could be incorporated into APARAPI.\n\n## Compiling\n\nOnce you've downloaded a source package (or checked out code from this repo)\n\nYou can then perform a build using Maven by performing *mvn clean package* from the top level directory. \n\nThis places everything you should need in the *target* folder. \n\nIn order for the Java-GPU compiler to find your CUDA and JDK installations you should also have the **CUDA_HOME** and **JDK_HOME** environment variables set. For example export CUDA_HOME=/usr/local/cuda/ export JDK_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20/\n\nFor example \n\n * export CUDA_HOME=/usr/local/cuda/ \n * export JDK_HOME=/usr/lib/jvm/....\n \n ## Sample Usage\n \nTo compile the *Mandelbrot* set sample, you can simply perform:\n\n\u003e java -jar java-gpu-1.0.0.jar org.java.gpu.samples.Mandelbrot\n\nfrom within the target directory. This will produce two files (on Linux):\n\norg/java/gpu/samples/Mandelbrot.class libparallel.so\n\nYou should then by able to run the sample using:\n\njava -cp .:java-gpu-1.0.0.jar org.java.gpu.samples.Mandelbrot 2000 2000 out.png\n\nIf you have problems that are related to the compilation for your GPU, then the options passed to NVCC are specified in src/main/java/org/java/gpu/cuda/CUDAExporter.java.\n\n## Example Code\n\nJust as an example, the Java source code for the above *Mandelbrot* example is as follows. \n\nNote the *@Parallel* annotation that indicates the region for CUDA processing:\n\n```\n@Parallel(loops = {\"y\", \"x\"}) \npublic void compute() { \n  for(int y = 0; y \u003c height; y++) { \n    for(int x = 0; x \u003c width; x++) { \n       float Zr = 0.0f; \n       float Zi = 0.0f; \n       float Cr = (x * spacing - 1.5f); \n       float Ci = (y * spacing - 1.0f);\n\n       float ZrN = 0;\n       float ZiN = 0;\n       int i;\n\n       for(i = 0; (i \u003c iterations) \u0026\u0026 (ZiN + ZrN \u003c= LIMIT); i++) {\n         Zi = 2.0f * Zr * Zi + Ci;\n         Zr = ZrN - ZiN + Cr;\n         ZiN = Zi * Zi;\n         ZrN = Zr * Zr;\n       }\n\n       data[y][x] = (short)((i * 255) / iterations);\n    }\n  }\n} \n```\n\n-----------------------------------------------------------------------------------\nManual porting on github from https://code.google.com/archive/p/java-gpu/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabryprog%2Fjava-gpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabryprog%2Fjava-gpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabryprog%2Fjava-gpu/lists"}