{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/comments/97644324","pull_request_review_id":18259683,"id":97644324,"diff_hunk":"@@ -0,0 +1,234 @@\n+---\n+layout: post\n+title:  GPU development in the Julia programming language\n+author: <a href=\"https://github.com/maleadt\">Tim Besard</a>\n+cudanative_tree: https://github.com/JuliaGPU/CUDAnative.jl/blob/6e6ec23ef4def367dec6ae0ba3e43f1d9daae7ec\n+---\n+\n+[Julia](http://julialang.org/) is a dynamic programming language for technical computing,\n+with syntax that is familiar to users of other technical computing environments. The\n+language has been created with performance in mind, and combines careful language design\n+with a sophisticated LLVM-based compiler.\n+\n+Julia is well regarded for programming multicore CPUs and large parallel computing systems,\n+but the tools for using Julia with GPUs are worth a look as well. In this blogpost, I will\n+list some of those packages but focus on the latest addition: native GPU programming with\n+CUDAnative.jl\n+\n+\n+\n+## Available tools\n+\n+The Julia package ecosystem contains quite a few GPU-related packages, targeting different\n+levels of abstraction. At the highest abstraction level, domain-specific packages like\n+[MXNet.jl](https://github.com/dmlc/MXNet.jl) or\n+[TensorFlow.jl](https://github.com/malmaud/TensorFlow.jl) can transparently use any\n+available GPUs. More generic development is possible with\n+[ArrayFire.jl](https://github.com/JuliaComputing/ArrayFire.jl), and if you need a\n+specialized implementation you can use wrappers for vendor-specific library packages\n+(cuBLAS, cuFFT, cuSPARSE, ...) available at the [JuliaGPU GitHub\n+organization](https://github.com/JuliaGPU/). Each of those packages is just a single\n+`Pkg.add(...)` away!\n+\n+What's missing from this list is the lowest abstraction level, where you can create kernels\n+and manage execution like you would in CUDA. This is where CUDAnative.jl comes in.\n+\n+\n+\n+## Native GPU programming with CUDAnative.jl\n+\n+[CUDAnative.jl](https://github.com/JuliaGPU/CUDAnative.jl) is a brand-new package adding\n+native GPU programming capabilities to the Julia programming language. Together with a\n+package like [CUDAdrv.jl](https://github.com/JuliaGPU/CUDAdrv.jl) or\n+[CUDArt.jl](https://github.com/JuliaGPU/CUDArt.jl) for interfacing with the CUDA libraries,\n+it is now possible to do CUDA development in Julia without the need for an external language\n+or compiler. As an introductory example, the following listing shows how to compute the sum\n+of two vectors:\n+\n+```julia\n+using CUDAdrv, CUDAnative\n+\n+function kernel_vadd(a, b, c)\n+    i = (blockIdx().x-1) * blockDim().x + threadIdx().x\n+    c[i] = a[i] + b[i]\n+\n+    return nothing\n+end\n+\n+dev = CuDevice(0)\n+ctx = CuContext(dev)\n+\n+# generate some data\n+len = 512\n+a = rand(Int, len)\n+b = rand(Int, len)\n+\n+# allocate & upload on the GPU\n+d_a = CuArray(a)\n+d_b = CuArray(b)\n+d_c = similar(d_a)\n+\n+# execute and fetch results\n+@cuda (1,len) kernel_vadd(d_a, d_b, d_c)\n+c = Array(d_c)\n+\n+destroy(ctx)\n+```\n+\n+The real workhorse of this example is the `@cuda` macro, which generates specialized code\n+for compiling the kernel function to GPU assembly, uploading it to the driver, and preparing\n+the execution environment. Together with Julia's JIT compiler, this results in a very\n+efficient kernel launch sequence, avoiding the runtime overhead typically associated with\n+dynamic languages.\n+\n+<!-- This seems a bit short. Maybe elaborate more? -->\n+\n+<!-- Mention libNVVM? -->\n+\n+Behind the scenes, CUDAnative.jl hooks into the Julia compiler to lower kernel functions to\n+LLVM IR, an intermediate form of code used by the LLVM compiler framework. We've created\n+[LLVM.jl](https://github.com/maleadt/LLVM.jl) to interface with the framework, and use it to\n+compile IR to PTX code, the virtual instruction set used to program CUDA GPUs. Finally, we","path":"blog/_posts/2017-01-24-cudanative-nvidia.md","position":91,"original_position":91,"commit_id":"298e1322bfe0cd50bfea481f836838b07a3b27c1","original_commit_id":"298e1322bfe0cd50bfea481f836838b07a3b27c1","user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"body":"Maybe worth showing the PTX for this kernel?","created_at":"2017-01-24T20:35:43Z","updated_at":"2017-01-24T20:46:35Z","html_url":"https://github.com/JuliaLang/julialang.github.com/pull/493#discussion_r97644324","pull_request_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/493","_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/comments/97644324"},"html":{"href":"https://github.com/JuliaLang/julialang.github.com/pull/493#discussion_r97644324"},"pull_request":{"href":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/493"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/493","id":102896265,"html_url":"https://github.com/JuliaLang/julialang.github.com/pull/493","diff_url":"https://github.com/JuliaLang/julialang.github.com/pull/493.diff","patch_url":"https://github.com/JuliaLang/julialang.github.com/pull/493.patch","issue_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues/493","number":493,"state":"open","locked":false,"title":"RFC: two blogposts on CUDAnative.jl","user":{"login":"maleadt","id":383068,"avatar_url":"https://avatars.githubusercontent.com/u/383068?v=3","gravatar_id":"","url":"https://api.github.com/users/maleadt","html_url":"https://github.com/maleadt","followers_url":"https://api.github.com/users/maleadt/followers","following_url":"https://api.github.com/users/maleadt/following{/other_user}","gists_url":"https://api.github.com/users/maleadt/gists{/gist_id}","starred_url":"https://api.github.com/users/maleadt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maleadt/subscriptions","organizations_url":"https://api.github.com/users/maleadt/orgs","repos_url":"https://api.github.com/users/maleadt/repos","events_url":"https://api.github.com/users/maleadt/events{/privacy}","received_events_url":"https://api.github.com/users/maleadt/received_events","type":"User","site_admin":false},"body":"Finally, some text on CUDAnative.jl! This PR adds 2 blogposts, one for julialang.github.com/blog, the other for NVIDIA's [Parallel Forall blog](https://devblogs.nvidia.com/parallelforall/). Since the NVIDIA blogpost will be detailing Julia's GPU support a bit more in general, I figured it couldn't hurt putting it up here for some feedback as well.\r\n\r\nAlthough both posts share some content, I tried to split the text based on the readers' background:\r\n* **Julia blog**: focus on usage (installation instructions, features & limitations), and how people can help\r\n* **NVIDIA blog**: broader focus on pitching Julia for GPU development, but including some more technical details (eg. comparison of generated assembly, NVIDIA/CUDA-specific technicalities)\r\n\r\ncc @vchuravy, @SimonDanisch, @ViralBShah","created_at":"2017-01-24T11:05:10Z","updated_at":"2017-01-24T20:46:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db0b5d22cb98541df2dee38f3907a2b8d4277a83","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/493/commits","review_comments_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/493/comments","review_comment_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues/493/comments","statuses_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/statuses/298e1322bfe0cd50bfea481f836838b07a3b27c1","head":{"label":"JuliaLang:tb/cudanative","ref":"tb/cudanative","sha":"298e1322bfe0cd50bfea481f836838b07a3b27c1","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":2885268,"name":"julialang.github.com","full_name":"JuliaLang/julialang.github.com","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julialang.github.com","description":"Julia Project web site.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julialang.github.com","forks_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/forks","keys_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/events","assignees_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/merges","archive_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/deployments","created_at":"2011-11-30T18:22:15Z","updated_at":"2017-01-24T11:29:26Z","pushed_at":"2017-01-24T20:42:08Z","git_url":"git://github.com/JuliaLang/julialang.github.com.git","ssh_url":"git@github.com:JuliaLang/julialang.github.com.git","clone_url":"https://github.com/JuliaLang/julialang.github.com.git","svn_url":"https://github.com/JuliaLang/julialang.github.com","homepage":"http://julialang.org/","size":9942,"stargazers_count":79,"watchers_count":79,"language":"TeX","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":168,"mirror_url":null,"open_issues_count":15,"forks":168,"open_issues":15,"watchers":79,"default_branch":"master"}},"base":{"label":"JuliaLang:master","ref":"master","sha":"0852ba295ef500b9948a566d45314cc51b090212","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":2885268,"name":"julialang.github.com","full_name":"JuliaLang/julialang.github.com","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julialang.github.com","description":"Julia Project web site.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julialang.github.com","forks_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/forks","keys_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/events","assignees_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/merges","archive_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaLang/julialang.github.com/deployments","created_at":"2011-11-30T18:22:15Z","updated_at":"2017-01-24T11:29:26Z","pushed_at":"2017-01-24T20:42:08Z","git_url":"git://github.com/JuliaLang/julialang.github.com.git","ssh_url":"git@github.com:JuliaLang/julialang.github.com.git","clone_url":"https://github.com/JuliaLang/julialang.github.com.git","svn_url":"https://github.com/JuliaLang/julialang.github.com","homepage":"http://julialang.org/","size":9942,"stargazers_count":79,"watchers_count":79,"language":"TeX","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":168,"mirror_url":null,"open_issues_count":15,"forks":168,"open_issues":15,"watchers":79,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/493"},"html":{"href":"https://github.com/JuliaLang/julialang.github.com/pull/493"},"issue":{"href":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues/493"},"comments":{"href":"https://api.github.com/repos/JuliaLang/julialang.github.com/issues/493/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/493/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaLang/julialang.github.com/pulls/493/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaLang/julialang.github.com/statuses/298e1322bfe0cd50bfea481f836838b07a3b27c1"}}}}
{"actor":{"display_login":"timholy"}}