# PSA: CUDA.jl replacing CuArrays.jl/CUDAnative.jl/CUDAdrv.jl/CUDAapi.jl -- call for testing!

**URL:** <https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205>\
**Category:** Package Announcements\
**Tags:** gpu, cuda\
**Created:** [May 26, 2020, 4:09pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205 "2020-05-26T16:09:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [May 26, 2020, 4:09pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/1 "2020-05-26T16:09:57Z")

</div>

Hi all,

I just [registered and tagged](https://github.com/JuliaRegistries/General/pull/15404) v0.1 of [CUDA.jl](https://github.com/JuliaGPU/CUDA.jl), a package that now contains the [documentation](https://juliagpu.gitlab.io/CUDA.jl/) and functionality from the several packages that make up the Julia/CUDA stack. I merged them because there was too much coupling between the individual packages, and it wasn’t particularly user-friendly to split functionality that’s often used together across several packages.

Apart from some major test suite changes, the functionality should be a 1:1 copy of what used to be in CuArrays/CUDAnative/etc, so I’d quickly like to tag a v1.0 release. Before that, I’d like to make sure there aren’t any obvious issues with application code, so please try your CUDA applications with CUDA.jl and let me know!

The upgrade procedure should be straightforward: remove CuArrays/CUDAnative/CUDAdrv/CUDAapi, add CUDA.jl, and replace module imports/references.

---

<div class="post-metadata">

**Author:** ![hannahilea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hannahilea/32/11987_2.png) [@hannahilea](https://discourse.julialang.org/u/hannahilea)\
**Post date:** [May 26, 2020, 4:46pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/2 "2020-05-26T16:46:47Z")

</div>

Nice! A couple questions:

1. Does this mean that all of those other packages are going to be deprecated?
2. Are issues from those packages going to be migrated to CUDA.jl?

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [May 26, 2020, 4:56pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/3 "2020-05-26T16:56:43Z")

</div>

1. I would like to do that, yes.
2. Yes, I will do that this week. Only PRs will remain on the original repo.

---

<div class="post-metadata">

**Author:** ![darsnack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darsnack/32/10144_2.png) [@darsnack](https://discourse.julialang.org/u/darsnack)\
**Post date:** [May 26, 2020, 5:15pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/4 "2020-05-26T17:15:33Z")

</div>

FYI the package README has quick install instructions for CUDAnative instead of CUDA.jl.

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [May 26, 2020, 5:22pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/5 "2020-05-26T17:22:09Z")

</div>

Thanks, fixed.

---

<div class="post-metadata">

**Author:** ![PolarizedPoutine](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/polarizedpoutine/32/6067_2.png) [@PolarizedPoutine](https://discourse.julialang.org/u/PolarizedPoutine)\
**Post date:** [May 26, 2020, 8:43pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/6 "2020-05-26T20:43:58Z")

</div>

This is awesome, thanks for working on CUDA.jl @maleadt!

Tried adding CUDA.jl but ran into a dependency issue that I was able to replicate in an empty repository with Julia 1.3:

```julia
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.3.0 (2019-11-26)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

(TmpRepo) pkg> st
Project TmpRepo v0.1.0
    Status `~/TmpRepo/Project.toml`
  (empty environment)

(TmpRepo) pkg> add CUDA
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package GPUCompiler [61eb1bfa]:
 GPUCompiler [61eb1bfa] log:
 ├─possible versions are: [0.1.0, 0.2.0, 0.3.0] or uninstalled
 ├─restricted by compatibility requirements with CUDA [052768ef] to versions: 0.3.0
 │ └─CUDA [052768ef] log:
 │ ├─possible versions are: 0.1.0 or uninstalled
 │ └─restricted to versions * by an explicit requirement, leaving only versions 0.1.0
 └─restricted by julia compatibility requirements to versions: [0.1.0, 0.2.0] or uninstalled — no versions left

```

Couldn’t figure out the issue as the CUDA.jl `Project.toml` looks fine to me but wondering if anyone else is getting this.

---

<div class="post-metadata">

**Author:** ![avik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/avik/32/17_2.png) [@avik](https://discourse.julialang.org/u/avik)\
**Post date:** [May 26, 2020, 9:46pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/7 "2020-05-26T21:46:54Z")

</div>

So `GPUCompiler` `v0.3.0` has a lower bound on Julia `v1.4.0`. Which means presumably `CUDA.jl` cannot be installed in Julia v1.3.

---

<div class="post-metadata">

**Author:** ![PolarizedPoutine](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/polarizedpoutine/32/6067_2.png) [@PolarizedPoutine](https://discourse.julialang.org/u/PolarizedPoutine)\
**Post date:** [May 26, 2020, 10:17pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/8 "2020-05-26T22:17:25Z")

</div>

That makes sense so maybe the CUDA.jl README needs updating as it says “The package is tested against, and being developed for, Julia 1.3 and above.”

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [May 27, 2020, 5:28am UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/9 "2020-05-27T05:28:27Z")

</div>

Yes that’s correct. I’ll add it to the README.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [May 27, 2020, 8:24pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/10 "2020-05-27T20:24:46Z")

</div>

The new CUDA.jl looks great. Last time I tried CuArrays, it did not support an older version of the Nvidia driver on a server I was using (which I could not update because I was not admin). But now it seems to run fine!

Just to confirm, have there been any changes enabling support for older driver versions?

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [May 28, 2020, 6:19am UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/11 "2020-05-28T06:19:57Z")

</div>

> [@e3c6](#):
>
> Just to confirm, have there been any changes enabling support for older driver versions?

Not specifically, but with the artifact changes you might now have a matching CUDA toolkit.

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [May 28, 2020, 9:09am UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/12 "2020-05-28T09:09:47Z")

</div>

Damn case sensitivity… add cuda.jl …no… add Cuda.jl … no … CUDA.jl …yes…

One small plea… this has irritated me when installing other packages.  
I guess there is not much to be done about it - having cuda and Cuda point toward CUDA as some sort of alias probably would lead to confusion.

Reporting back - installs OK on Windows 10/Julia 1.4.1 but I have no Nvidia card.  
If I find time later I will test on Jetson Nano

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [May 28, 2020, 11:17am UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/13 "2020-05-28T11:17:45Z")

</div>

On Jetson Nano / Julia 1.4.1 CUDA.jl installs but during test codegen fails

codegen (2) | failed at 2020-05-28T12:10:16.847

Looks like my userid does not have the privileges to profile CUDA code. I will get that fixed and report back

---

<div class="post-metadata">

**Author:** ![tamasgal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamasgal/32/27946_2.png) [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Post date:** [May 28, 2020, 11:20am UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/14 "2020-05-28T11:20:53Z")

</div>

I have the same issue with `codegen`. I added the privileges but still get the same error 😕

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [May 28, 2020, 1:14pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/15 "2020-05-28T13:14:18Z")

</div>

Not good news

> **[nvprof: Warning: The user does not have permission to profile on the target...](https://forums.developer.nvidia.com/t/nvprof-warning-the-user-does-not-have-permission-to-profile-on-the-target-device/72374/15)**
>
> I have the exact same problem. My system has: Ubuntu: 16.04 Driver Version: 418.87.00 CUDA Version: 10.1 I followed all the steps but none of them worked. Is there a solution for this? Thanks!

Nvidia Visual Profiler and nvprof don’t support profiling on Tegra devices (like Jetson TX2) for non-root users. The only workaround is to start the profiling session as a root user.

---

<div class="post-metadata">

**Author:** ![kevinczimmerman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevinczimmerman/32/13040_2.png) [@kevinczimmerman](https://discourse.julialang.org/u/kevinczimmerman)\
**Post date:** [May 28, 2020, 2:32pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/16 "2020-05-28T14:32:20Z")

</div>

> [@johnh](#):
>
> Damn case sensitivity… add cuda.jl …no… add Cuda.jl … no … CUDA.jl …yes…

There is an [issue talking about displaying similarly named packages](https://github.com/JuliaLang/Pkg.jl/issues/616) when trying to add a package not in the registries. I started a [PR for a search feature](https://github.com/JuliaLang/Pkg.jl/pull/1834) that hopefully can also be used for add.

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [May 28, 2020, 6:33pm UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/17 "2020-05-28T18:33:02Z")

</div>

Fantastic work, @maleadt! I think this is a good idea. For what it’s worth, I ran the test suite on the current tagged release, Julia 1.4.1 using a RTX 2060 on CUDA driver 10.2.0 and toolkit 10.2.0.

After disabling my startup.jl file ([Testsuite calls startup.jl · Issue #182 · JuliaGPU/CUDA.jl · GitHub](https://github.com/JuliaGPU/CUDA.jl/issues/182)) I was able to run the testsuite and everything passed.

---

<div class="post-metadata">

**Author:** ![samo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samo/32/35398_2.png) [@samo](https://discourse.julialang.org/u/samo)\
**Post date:** [June 2, 2020, 8:51am UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/18 "2020-06-02T08:51:32Z")

</div>

Thanks @maleadt; this looks like a great improvement in terms of user-friendlyness! I believe it is nice to have just one package 🙂

I have a little question on how the packages were merged. Are there symbol names which appear in more than one of the packages CuArrrays/CUDAnative/CUDAdrv, but are not identical? If so, how did you merge them? E.g. is the method `CUDAnative.synchronize` identical to the method of `CUDAdrv.synchronize` without arguments? If not, what did go into `CUDA.sychronize()`?

# `CUDAnative/CUDAdrv`

```julia-auto
help?> CUDAnative.synchronize
  synchronize()

  Wait for the device to finish. This is the device side version, and should not be called from the host.

  synchronize acts as a synchronization point for child grids in the context of dynamic parallelism.

help?> CUDAdrv.synchronize
  synchronize()

  Block for the current context's tasks to complete.

  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  synchronize(s::CuStream)

  Wait until a stream's tasks are completed.

  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  synchronize(e::CuEvent)

  Waits for an event to complete.

```

# `CUDA`

```julia-auto
help?> CUDA.synchronize
  synchronize()

  Block for the current context's tasks to complete.

  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  synchronize(s::CuStream)

  Wait until a stream's tasks are completed.

  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  synchronize(e::CuEvent)

  Waits for an event to complete.

```

Thanks!

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [June 3, 2020, 8:36am UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/19 "2020-06-03T08:36:19Z")

</div>

I renamed device-side synchronization to `device_synchronize`. It’s a tough call, though. I considered adding a submodule to contain all device functionality so that we could retain the name, e.g. `Device.synchronize`, but that would be too breaking. In all other cases, I kept the previous name, even though that now mixes host and device functionality in a single package (making it easy to, e.g., crash Julia by inadvertently calling GPU code from the CPU). I hope that we’ll soon be able to use contextual dispatch to have those methods error when called from the wrong context.

---

<div class="post-metadata">

**Author:** ![samo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samo/32/35398_2.png) [@samo](https://discourse.julialang.org/u/samo)\
**Post date:** [June 3, 2020, 9:12am UTC](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205/20 "2020-06-03T09:12:52Z")

</div>

Thanks @maleadt for this information.

> [@maleadt](#):
>
> I hope that we’ll soon be able to use contextual dispatch to have those methods error when called from the wrong context.

I believe that would be fantastic and a big step forward in the right direction!

[Next page](https://discourse.julialang.org/t/psa-cuda-jl-replacing-cuarrays-jl-cudanative-jl-cudadrv-jl-cudaapi-jl-call-for-testing/40205.md?page=2)
