# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=770

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 771

---

## [Run CUDA.jl on AMD devices](https://discourse.julialang.org/t/run-cuda-jl-on-amd-devices/36782)

<div class="topic-metadata">

**Author:** [@DeepQ](https://discourse.julialang.org/u/DeepQ)\
**Replies:** 1\
**Last updated:** [March 31, 2020, 9:23am UTC](https://discourse.julialang.org/t/run-cuda-jl-on-amd-devices/36782 "2020-03-31T09:23:19Z")

</div>

Is there a way to run CUDA scripts on AMD GPUs?

---

## [Comma in function call](https://discourse.julialang.org/t/comma-in-function-call/36746)

<div class="topic-metadata">

**Author:** [@Marques](https://discourse.julialang.org/u/Marques)\
**Replies:** 4\
**Last updated:** [March 31, 2020, 8:23am UTC](https://discourse.julialang.org/t/comma-in-function-call/36746 "2020-03-31T08:23:54Z")

</div>

Hi guys, can someone help me?. While I was studying functions I came across a situacion, example: function soma(n) soma(1,n, positive). What I didn’t understand is the use of the comma when the function is called. Coul…

---

## [Non-blocking asyncio calls with PyCall](https://discourse.julialang.org/t/non-blocking-asyncio-calls-with-pycall/36685)

<div class="topic-metadata">

**Author:** [@mkosch](https://discourse.julialang.org/u/mkosch)\
**Replies:** 5\
**Last updated:** [March 31, 2020, 12:38am UTC](https://discourse.julialang.org/t/non-blocking-asyncio-calls-with-pycall/36685 "2020-03-31T00:38:08Z")

</div>

Hello everyone, I am currently trying to integrate asyncronous Python functions that use asyncio into Julia’s coroutine framework. My problem is similar to the following example: using PyCall asyncio = pyimport("asynci…

---

## [Arpack\_jll artifacts unable to see OpenBLAS\_jll artifacts for linking](https://discourse.julialang.org/t/arpack-jll-artifacts-unable-to-see-openblas-jll-artifacts-for-linking/36711)

<div class="topic-metadata">

**Author:** [@pengwyn](https://discourse.julialang.org/u/pengwyn)\
**Replies:** 3\
**Last updated:** [March 30, 2020, 10:45pm UTC](https://discourse.julialang.org/t/arpack-jll-artifacts-unable-to-see-openblas-jll-artifacts-for-linking/36711 "2020-03-30T22:45:32Z")

</div>

I’m on Archlinux and I’m currently trying to import the Arpack module but getting an error with a missing library: ERROR: LoadError: InitError: could not load library "/home/pengwyn/.julia/artifacts/8a63e55e4ce37cc04c03…

---

## [Loading first few lines from data file](https://discourse.julialang.org/t/loading-first-few-lines-from-data-file/21412)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 19\
**Last updated:** [March 30, 2020, 10:24pm UTC](https://discourse.julialang.org/t/loading-first-few-lines-from-data-file/21412 "2020-03-30T22:24:47Z")

</div>

Hi, I have a data file with 100 rows of data of the form 1 2 3 4 5 6.1 … I want to load the first 10 lines as a 10X2 array. However, I do not see any option in readdlm() for doing that, although it should be an easy…

---

## [How to get a sub matrix of a large sparse matrix / array efficiently?](https://discourse.julialang.org/t/how-to-get-a-sub-matrix-of-a-large-sparse-matrix-array-efficiently/36741)

<div class="topic-metadata">

**Author:** [@mlanghinrichs](https://discourse.julialang.org/u/mlanghinrichs)\
**Replies:** 11\
**Last updated:** [March 30, 2020, 8:51pm UTC](https://discourse.julialang.org/t/how-to-get-a-sub-matrix-of-a-large-sparse-matrix-array-efficiently/36741 "2020-03-30T20:51:04Z")

</div>

Hi all, I have a large sparse matrix / 2-d-array, some random indices and want to obtain a sub matrix of the large sparse matrix for these random indices. I noticed that a view() is quite fast for doing this (order of ~…

---

## [Dispatch function based on values of a parametric structure](https://discourse.julialang.org/t/dispatch-function-based-on-values-of-a-parametric-structure/36681)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 11\
**Last updated:** [March 30, 2020, 8:08pm UTC](https://discourse.julialang.org/t/dispatch-function-based-on-values-of-a-parametric-structure/36681 "2020-03-30T20:08:44Z")

</div>

Hello everyone, I am using a parametric structure parameterized by an integer parameter p. Depending on the value of p, the function f will have different behaviors. What is the best solution: write an if elseif else …

---

## [Composing new and default Kwargs](https://discourse.julialang.org/t/composing-new-and-default-kwargs/36745)

<div class="topic-metadata">

**Author:** [@alejandrovpm](https://discourse.julialang.org/u/alejandrovpm)\
**Replies:** 4\
**Last updated:** [March 30, 2020, 4:54pm UTC](https://discourse.julialang.org/t/composing-new-and-default-kwargs/36745 "2020-03-30T16:54:56Z")

</div>

Hello, I upgraded Julia from version 0.63 to version 1.4. To compose new and default Kwargs in Julia v0.63 I used the following function: function foo(; kwargs...) defaults = (; x="default") merge!(defa…

---

## [What LLVM version to use, 10, 11 possible? And how to reduce startup time (for the Benchmark Game)?](https://discourse.julialang.org/t/what-llvm-version-to-use-10-11-possible-and-how-to-reduce-startup-time-for-the-benchmark-game/36743)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 3\
**Last updated:** [March 30, 2020, 4:03pm UTC](https://discourse.julialang.org/t/what-llvm-version-to-use-10-11-possible-and-how-to-reduce-startup-time-for-the-benchmark-game/36743 "2020-03-30T16:03:32Z")

</div>

A. I know I’m using LLVM 9.0.1, but is latest 10 (or 11) coming to master? I’m just curious if Julia will optimize better (it’s already good, better than C), no rush. It seems JuliaLang/julia uses LLVM, not LLVM from …

---

## [Is there a standard way to add missing-propagation](https://discourse.julialang.org/t/is-there-a-standard-way-to-add-missing-propagation/36727)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 2\
**Last updated:** [March 30, 2020, 2:48pm UTC](https://discourse.julialang.org/t/is-there-a-standard-way-to-add-missing-propagation/36727 "2020-03-30T14:48:02Z")

</div>

By “add missing-propagation,” I mean making a function return missing if any one of its arguments is missing. So far the few times I wanted to do that, I add a one-liner method for each argument as type Missing, like so: …

---

## [String representation of expression](https://discourse.julialang.org/t/string-representation-of-expression/36729)

<div class="topic-metadata">

**Author:** [@pfarndt](https://discourse.julialang.org/u/pfarndt)\
**Replies:** 3\
**Last updated:** [March 30, 2020, 1:40pm UTC](https://discourse.julialang.org/t/string-representation-of-expression/36729 "2020-03-30T13:40:08Z")

</div>

I once developed a macro which would take the enclosed code block and write it to a file which would then later be included in another julia process. In principle I just printed the expression into the file which would …

---

## [How to create Libc.FILE from a string](https://discourse.julialang.org/t/how-to-create-libc-file-from-a-string/36637)

<div class="topic-metadata">

**Author:** [@abulak](https://discourse.julialang.org/u/abulak)\
**Replies:** 4\
**Last updated:** [March 29, 2020, 7:18pm UTC](https://discourse.julialang.org/t/how-to-create-libc-file-from-a-string/36637 "2020-03-29T19:18:43Z")

</div>

I’m looking for a solution to the following problem: A function in c takes a FILE \*rfile argument. If i want to read file I can do open(filename, "r") do file\_hdlr c\_file\_hdlr = Libc.FILE(file\_hdlr) # ccall wit…

---

## [AOT compilation (not to create an executable)](https://discourse.julialang.org/t/aot-compilation-not-to-create-an-executable/36461)

<div class="topic-metadata">

**Author:** [@tencnivel](https://discourse.julialang.org/u/tencnivel)\
**Replies:** 3\
**Last updated:** [March 29, 2020, 6:48pm UTC](https://discourse.julialang.org/t/aot-compilation-not-to-create-an-executable/36461 "2020-03-29T18:48:33Z")

</div>

I try to improve the deployment of the new releases of my Julia web apps. As of now, the users encounter some lags (and sometimes timeouts) every time I deploy a new version because of the JIT compilation. This gets ev…

---

## [Which operators are parsed as chains?](https://discourse.julialang.org/t/which-operators-are-parsed-as-chains/36633)

<div class="topic-metadata">

**Author:** [@phg](https://discourse.julialang.org/u/phg)\
**Replies:** 4\
**Last updated:** [March 29, 2020, 4:50pm UTC](https://discourse.julialang.org/t/which-operators-are-parsed-as-chains/36633 "2020-03-29T16:50:31Z")

</div>

I asked this over at the metaprogramming Slack channel but got no replies, so another try: I thought all repeated binary operators are parsed as a chain, but apprearently that is not the case: julia\> Meta.show\_sexpr(:(…

---

## [Cannot Pkg.resolve the new REQUIRE of a package in development](https://discourse.julialang.org/t/cannot-pkg-resolve-the-new-require-of-a-package-in-development/12623)

<div class="topic-metadata">

**Author:** [@pochoi](https://discourse.julialang.org/u/pochoi)\
**Replies:** 7\
**Last updated:** [March 29, 2020, 10:30am UTC](https://discourse.julialang.org/t/cannot-pkg-resolve-the-new-require-of-a-package-in-development/12623 "2020-03-29T10:30:08Z")

</div>

I am developing a forked package, namely ExpmV. Recently I created a new branch and add Compat in the REQUIRE. When I try to load the package in new branch, I got the error julia\> using ExpmV ERROR: LoadError: ArgumentE…

---

## [Design patterns for generic code with reusable caches for intermediate values](https://discourse.julialang.org/t/design-patterns-for-generic-code-with-reusable-caches-for-intermediate-values/36627)

<div class="topic-metadata">

**Author:** [@jlperla](https://discourse.julialang.org/u/jlperla)\
**Replies:** 3\
**Last updated:** [March 29, 2020, 7:47am UTC](https://discourse.julialang.org/t/design-patterns-for-generic-code-with-reusable-caches-for-intermediate-values/36627 "2020-03-29T07:47:35Z")

</div>

We have an expensive algorithm with is run many, many times for different parameter values and want to design the interface for caching the memory preallocation. A few principles: We should have enough information to …

---

## [Throw control-c to @spawn task?](https://discourse.julialang.org/t/throw-control-c-to-spawn-task/36656)

<div class="topic-metadata">

**Author:** [@wherrera](https://discourse.julialang.org/u/wherrera)\
**Replies:** 6\
**Last updated:** [March 29, 2020, 7:22am UTC](https://discourse.julialang.org/t/throw-control-c-to-spawn-task/36656 "2020-03-29T07:22:38Z")

</div>

Is there a way to throw a control-c break to a task running as @spawn? The specific case is that, when running the SoX commandline music player, one sends control-c to tell the player to stop play, ie p = @spawn(run(\`pl…

---

## [add("IJulia") Question](https://discourse.julialang.org/t/add-ijulia-question/36663)

<div class="topic-metadata">

**Author:** [@mehalter](https://discourse.julialang.org/u/mehalter)\
**Replies:** 0\
**Last updated:** [March 29, 2020, 2:22am UTC](https://discourse.julialang.org/t/add-ijulia-question/36663 "2020-03-29T02:22:16Z")

</div>

Can I skip the automatic jupyter kernel installation step when running add(“IJulia”), or at least change the kernel name for the initial installation?

---

## [Overloading \`getproperty\` in a type-stable manner](https://discourse.julialang.org/t/overloading-getproperty-in-a-type-stable-manner/36638)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 4\
**Last updated:** [March 28, 2020, 6:30pm UTC](https://discourse.julialang.org/t/overloading-getproperty-in-a-type-stable-manner/36638 "2020-03-28T18:30:50Z")

</div>

Hi, I am trying to overload getproperty for a struct I have. I do: function Base.getproperty(m::ABM, s::Symbol) if s ∈ (:agents, :space, :scheduler, :properties) return Base.getfield(m, s) else …

---

## [Repeatedly multiplying a Float64 is fastest in chunks of \<51 terms](https://discourse.julialang.org/t/repeatedly-multiplying-a-float64-is-fastest-in-chunks-of-51-terms/36527)

<div class="topic-metadata">

**Author:** [@frank](https://discourse.julialang.org/u/frank)\
**Replies:** 11\
**Last updated:** [March 28, 2020, 3:26pm UTC](https://discourse.julialang.org/t/repeatedly-multiplying-a-float64-is-fastest-in-chunks-of-51-terms/36527 "2020-03-28T15:26:51Z")

</div>

I’ve written a fast Julia-only permutation (n P r) function intended for perms small enough to fit into a Float64 (at the expense of some precision). Thus, if a permutation doesn’t exceed 1.7976931348623157e308, one can …

---

## [Indexing SparseMatrixCSC using CartesianIndices](https://discourse.julialang.org/t/indexing-sparsematrixcsc-using-cartesianindices/36631)

<div class="topic-metadata">

**Author:** [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Replies:** 2\
**Last updated:** [March 28, 2020, 7:56am UTC](https://discourse.julialang.org/t/indexing-sparsematrixcsc-using-cartesianindices/36631 "2020-03-28T07:56:43Z")

</div>

I’m having trouble indexing into SparseArrays using CartesianIndices (plural). The following Julia-1.4 code using SparseArrays A = sparse(randn(4,4)) A\[CartesianIndices((1:2,1:2))\] gives ERROR: MethodError: no method …

---

## [macOS Catalina: Julia cannot access general files](https://discourse.julialang.org/t/macos-catalina-julia-cannot-access-general-files/36601)

<div class="topic-metadata">

**Author:** [@rsilva](https://discourse.julialang.org/u/rsilva)\
**Replies:** 10\
**Last updated:** [March 27, 2020, 11:30pm UTC](https://discourse.julialang.org/t/macos-catalina-julia-cannot-access-general-files/36601 "2020-03-27T23:30:14Z")

</div>

I’ve spent some considerable amount of time looking for a solution to this, which I suppose is not very common at all. But I have the most basic Catalina 10.15.4 setup in a brand new machine, and Julia simply doesn’t hav…

---

## [Array of structs can be seen in the outer loop only](https://discourse.julialang.org/t/array-of-structs-can-be-seen-in-the-outer-loop-only/36615)

<div class="topic-metadata">

**Author:** [@mayar](https://discourse.julialang.org/u/mayar)\
**Replies:** 9\
**Last updated:** [March 27, 2020, 11:22pm UTC](https://discourse.julialang.org/t/array-of-structs-can-be-seen-in-the-outer-loop-only/36615 "2020-03-27T23:22:55Z")

</div>

Hello guys, I have an array of structs and I had no problem with it until I made a double loop my array of structs is not defined inside the inner loop whereas in the outer loop, its is fine How can this be explained?…

---

## [A clever way to find the available memory the host currently has free/available?](https://discourse.julialang.org/t/a-clever-way-to-find-the-available-memory-the-host-currently-has-free-available/36611)

<div class="topic-metadata">

**Author:** [@met-j](https://discourse.julialang.org/u/met-j)\
**Replies:** 4\
**Last updated:** [March 27, 2020, 9:07pm UTC](https://discourse.julialang.org/t/a-clever-way-to-find-the-available-memory-the-host-currently-has-free-available/36611 "2020-03-27T21:07:11Z")

</div>

Writing a program which uses single files to large to fit in the memory of normal desktops or laptops, I thought it would be nice to dispatch on the available memory relative to some expected required memory. In case the…

---

## [From GR.colormap to Plots.cgrad](https://discourse.julialang.org/t/from-gr-colormap-to-plots-cgrad/34920)

<div class="topic-metadata">

**Author:** [@met-j](https://discourse.julialang.org/u/met-j)\
**Replies:** 6\
**Last updated:** [March 27, 2020, 4:14pm UTC](https://discourse.julialang.org/t/from-gr-colormap-to-plots-cgrad/34920 "2020-03-27T16:14:39Z")

</div>

I would like to use the bone color map. As the clibraries() does not have it, but GR has as it as a colormap, tried various permutations of: GR.setcolormap(15) # this works Plots.plot(xy, c=cgrad(GR.colormap()) # this …

---

## [Variation in computation time for execution of the exact same code](https://discourse.julialang.org/t/variation-in-computation-time-for-execution-of-the-exact-same-code/36333)

<div class="topic-metadata">

**Author:** [@jleman](https://discourse.julialang.org/u/jleman)\
**Replies:** 35\
**Last updated:** [March 27, 2020, 6:57pm UTC](https://discourse.julialang.org/t/variation-in-computation-time-for-execution-of-the-exact-same-code/36333 "2020-03-27T18:57:38Z")

</div>

I have a block of code (about 1000 lines) that performs electromagnetic computation. The code is executed multiple times with random variation of key input variables. Out of curiosity I set the input variables to be th…

---

## [Operating on many arrays of the same size: one loop, many loops, or broadcasting?](https://discourse.julialang.org/t/operating-on-many-arrays-of-the-same-size-one-loop-many-loops-or-broadcasting/36608)

<div class="topic-metadata">

**Author:** [@Dr.Merkwuedigliebe](https://discourse.julialang.org/u/Dr.Merkwuedigliebe)\
**Replies:** 3\
**Last updated:** [March 27, 2020, 6:22pm UTC](https://discourse.julialang.org/t/operating-on-many-arrays-of-the-same-size-one-loop-many-loops-or-broadcasting/36608 "2020-03-27T18:22:25Z")

</div>

I am working on a physical-process simulation, set on a large spatial grid. Each cell of the grid contains a set variables representing the status of the model. Let’s say the variables are a, b, c, d, and e, stored as ar…

---

## [Is there any smart way of doing pivot table?](https://discourse.julialang.org/t/is-there-any-smart-way-of-doing-pivot-table/15636)

<div class="topic-metadata">

**Author:** [@youngjae.woo](https://discourse.julialang.org/u/youngjae.woo)\
**Replies:** 2\
**Last updated:** [March 27, 2020, 5:58pm UTC](https://discourse.julialang.org/t/is-there-any-smart-way-of-doing-pivot-table/15636 "2020-03-27T17:58:47Z")

</div>

I often look at pivot table (one like R function’s table) a lot for single dim array. It’s not too difficult to do so and am sharing my usage so far. However, I’m sure there are better and more intuitive way of doing thi…

---

## [LoadError:PyCall.PyError](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665)

<div class="topic-metadata">

**Author:** [@OmkarGadgil](https://discourse.julialang.org/u/OmkarGadgil)\
**Replies:** 7\
**Last updated:** [March 27, 2020, 5:52pm UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665 "2020-03-27T17:52:57Z")

</div>

I am getting the following Error for PyCall and am on Julia v 1.2.0 Following is the Python setup and the Conda setup in build file ENV\["PYTHON"\] = " " Pkg.build("PyCall") using PyCall, Conda pyexec = pyimport("sys").…

---

## [Index starts at 1... why does the error refer to zero index](https://discourse.julialang.org/t/index-starts-at-1-why-does-the-error-refer-to-zero-index/36606)

<div class="topic-metadata">

**Author:** [@mayar](https://discourse.julialang.org/u/mayar)\
**Replies:** 4\
**Last updated:** [March 27, 2020, 5:24pm UTC](https://discourse.julialang.org/t/index-starts-at-1-why-does-the-error-refer-to-zero-index/36606 "2020-03-27T17:24:39Z")

</div>

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=769)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=771)
