# How to allowscalar(false) in Pluto envrionment?

**URL:** <https://discourse.julialang.org/t/how-to-allowscalar-false-in-pluto-envrionment/61422>\
**Category:** General Usage\
**Tags:** cuda\
**Created:** [May 19, 2021, 8:26am UTC](https://discourse.julialang.org/t/how-to-allowscalar-false-in-pluto-envrionment/61422 "2021-05-19T08:26:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChunXi\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chunxi_zhang/32/22556_2.png) [@ChunXi\_Zhang](https://discourse.julialang.org/u/ChunXi_Zhang)\
**Post date:** [May 19, 2021, 8:26am UTC](https://discourse.julialang.org/t/how-to-allowscalar-false-in-pluto-envrionment/61422/1 "2021-05-19T08:26:43Z")

</div>

I’m writing a package and using it in a pluto notebook, even though I write allowscalar(false) in my package and in my pluto notebook, it seems not effecting.  
It still shows

```julia
┌ Warning: Performing scalar operations on GPU arrays: This is very slow, consider disallowing these operations with `allowscalar(false)`
└ @ GPUArrays C:\Users\zhang\.julia\packages\GPUArrays\Z5nPF\src\host\indexing.jl:64

```

Which makes me don’t know where I used scaler indexing.

Can this warning show where scaler indexing happen? Or how can I do `allowscalar(false)` properly in pluto notebook?

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [May 19, 2021, 9:30am UTC](https://discourse.julialang.org/t/how-to-allowscalar-false-in-pluto-envrionment/61422/2 "2021-05-19T09:30:09Z")

</div>

In order to be able to do GPU computing in Pluto, you have to switch off that notebooks are started as separate Julia processes:

```julia
Pluto.run(workspace_use_distributed=false)

```

But I am not sure if this is still required.

```julia
allowscalar(false)

```

should then be in the same cell as `using CUDA` (or whatever GPU library you are using).

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [May 19, 2021, 9:46am UTC](https://discourse.julialang.org/t/how-to-allowscalar-false-in-pluto-envrionment/61422/3 "2021-05-19T09:46:01Z")

</div>

Maybe I’m out of touch, but Pluto and gpu computing seem like tools for opposite goals?

---

<div class="post-metadata">

**Author:** ![ChunXi\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chunxi_zhang/32/22556_2.png) [@ChunXi\_Zhang](https://discourse.julialang.org/u/ChunXi_Zhang)\
**Post date:** [May 20, 2021, 3:43am UTC](https://discourse.julialang.org/t/how-to-allowscalar-false-in-pluto-envrionment/61422/4 "2021-05-20T03:43:15Z")

</div>

I’m running pluto with `workspace_use_distributed=false` and put the `allowscalar(false)` in the same cell as `using CUDA`, but it doesn’t affect cell further.

---

<div class="post-metadata">

**Author:** ![ChunXi\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chunxi_zhang/32/22556_2.png) [@ChunXi\_Zhang](https://discourse.julialang.org/u/ChunXi_Zhang)\
**Post date:** [May 20, 2021, 4:04am UTC](https://discourse.julialang.org/t/how-to-allowscalar-false-in-pluto-envrionment/61422/5 "2021-05-20T04:04:59Z")

</div>

If your computing is less then a few minutes with GPU, and you’re exploring some experimental thing, why not? You can display your computing result interactively and showing graphs, quite handy.

---

<div class="post-metadata">

**Author:** ![ChunXi\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chunxi_zhang/32/22556_2.png) [@ChunXi\_Zhang](https://discourse.julialang.org/u/ChunXi_Zhang)\
**Post date:** [May 20, 2021, 4:36am UTC](https://discourse.julialang.org/t/how-to-allowscalar-false-in-pluto-envrionment/61422/6 "2021-05-20T04:36:04Z")

</div>

I just figured it out myself:  
There is a ENV variable for that, just put it in startup.jl

```julia
ENV["JULIA_GPU_ALLOWSCALAR"] = false

```
