# General Usage

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

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

**Page:** 467

---

## [When to parallelise, when not to?](https://discourse.julialang.org/t/when-to-parallelise-when-not-to/78722)

<div class="topic-metadata">

**Author:** [@ayushinav](https://discourse.julialang.org/u/ayushinav)\
**Replies:** 2\
**Last updated:** [March 30, 2022, 7:30am UTC](https://discourse.julialang.org/t/when-to-parallelise-when-not-to/78722 "2022-03-30T07:30:17Z")

</div>

Hey all, I’m stuck on understanding when to realize that the code will benefit from parallel processing, when not; when to take it on GPUs when not. I have a code that runs as fast as it can (that’s what I think, could…

---

## [Size-limited vector type](https://discourse.julialang.org/t/size-limited-vector-type/78697)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 3\
**Last updated:** [March 30, 2022, 5:39am UTC](https://discourse.julialang.org/t/size-limited-vector-type/78697 "2022-03-30T05:39:13Z")

</div>

I want to make a Dict whose keys are view(MVector{5,UInt8}, 1:m) for some m\<=5 and , such as julia\> let d = Dict{MVector{5,UInt8}, Int}() d\[@view((@MVector \[1,2,3,4,5\])\[1:2\])\] = 1 end ERROR: Dimens…

---

## [Get NamedTuple element with String key. Why is this slow?](https://discourse.julialang.org/t/get-namedtuple-element-with-string-key-why-is-this-slow/78704)

<div class="topic-metadata">

**Author:** [@jocklawrie](https://discourse.julialang.org/u/jocklawrie)\
**Replies:** 3\
**Last updated:** [March 30, 2022, 5:26am UTC](https://discourse.julialang.org/t/get-namedtuple-element-with-string-key-why-is-this-slow/78704 "2022-03-30T05:26:47Z")

</div>

Hi there, I’m attempting to get a value from a NamedTuple using a String key, ideally using x\[k\] syntax. In the example below, why is x\["a"\] so slow compared to x\[Symbol("a")\]? using BenchmarkTools import Base: getinde…

---

## [Named Jacobian](https://discourse.julialang.org/t/named-jacobian/73572)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 3\
**Last updated:** [March 30, 2022, 3:34am UTC](https://discourse.julialang.org/t/named-jacobian/73572 "2022-03-30T03:34:42Z")

</div>

For a function that maps a named tuple to another named tuple, is it possible to get a named Jacobian? Either as a named range or a DataFrame with 3 columns: Input\_Var, Output\_Var, Derivative I could take the …

---

## [Why I am not getting anything in REPL while trying to use Nsight Systems for profiling?](https://discourse.julialang.org/t/why-i-am-not-getting-anything-in-repl-while-trying-to-use-nsight-systems-for-profiling/50667)

<div class="topic-metadata">

**Author:** [@Manu\_Francis](https://discourse.julialang.org/u/Manu_Francis)\
**Replies:** 12\
**Last updated:** [March 30, 2022, 2:17am UTC](https://discourse.julialang.org/t/why-i-am-not-getting-anything-in-repl-while-trying-to-use-nsight-systems-for-profiling/50667 "2022-03-30T02:17:11Z")

</div>

Hi, I am trying to profile cuda program using Nsight systems. I tried the following command in command window to launch the julia REPL. nsys launch "C:\\Users\\manoos\\AppData\\Local\\Programs\\Julia 1.5.0\\bin\\julia.exe" RE…

---

## [@distributed retry](https://discourse.julialang.org/t/distributed-retry/78703)

<div class="topic-metadata">

**Author:** [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Replies:** 3\
**Last updated:** [March 29, 2022, 10:28pm UTC](https://discourse.julialang.org/t/distributed-retry/78703 "2022-03-29T22:28:25Z")

</div>

I have code that looks roughly like this: using Distributed @everywhere using MyModule @sync @distributed for x in xs my\_function!(x) end Which I launch using julia -p 4 --threads=auto myscript.jl. my\_function writ…

---

## [Question on jl\_alloc\_array\_2d seg fault](https://discourse.julialang.org/t/question-on-jl-alloc-array-2d-seg-fault/78698)

<div class="topic-metadata">

**Author:** [@sdeoras](https://discourse.julialang.org/u/sdeoras)\
**Replies:** 4\
**Last updated:** [March 29, 2022, 9:07pm UTC](https://discourse.julialang.org/t/question-on-jl-alloc-array-2d-seg-fault/78698 "2022-03-29T21:07:35Z")

</div>

Hi, I am interested in building a Go interface to Julia (for simple data passing and function evals) and having issues with jl\_alloc\_array\_2d. In particular, repeated use of this function seems to intermittently lead to …

---

## [Random123 reproducible independent and multithreaded](https://discourse.julialang.org/t/random123-reproducible-independent-and-multithreaded/78699)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 0\
**Last updated:** [March 29, 2022, 8:13pm UTC](https://discourse.julialang.org/t/random123-reproducible-independent-and-multithreaded/78699 "2022-03-29T20:13:57Z")

</div>

I wish to generate random numbers with multithreading that are independent, both within and across threads, and are reproducible in the sense that every time I run my code I get the same results. My intention is to use …

---

## [In-place map of vector functions across slices of multidimensional arrays](https://discourse.julialang.org/t/in-place-map-of-vector-functions-across-slices-of-multidimensional-arrays/78684)

<div class="topic-metadata">

**Author:** [@tianrluo](https://discourse.julialang.org/u/tianrluo)\
**Replies:** 8\
**Last updated:** [March 29, 2022, 5:59pm UTC](https://discourse.julialang.org/t/in-place-map-of-vector-functions-across-slices-of-multidimensional-arrays/78684 "2022-03-29T17:59:37Z")

</div>

Hi, I am trying to in-place map some vector functions across slices of multidimensional arrays For instance, given three matrices: A, B, C = rand(4, 3), rand(4, 3), rand(4, 3) I wish to efficiently compute the cross …

---

## [Macro, loops and variables](https://discourse.julialang.org/t/macro-loops-and-variables/78669)

<div class="topic-metadata">

**Author:** [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)\
**Replies:** 4\
**Last updated:** [March 29, 2022, 4:49pm UTC](https://discourse.julialang.org/t/macro-loops-and-variables/78669 "2022-03-29T16:49:17Z")

</div>

Hi everyone, I have a macro question. It’s probably something about variables hygene as mentioned in this other topic, but I can’t quite figure out, any help would be appreciated I’m trying to do a macro that wraps aro…

---

## [\`break\` with a threaded loop?](https://discourse.julialang.org/t/break-with-a-threaded-loop/78487)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 11\
**Last updated:** [March 29, 2022, 3:09pm UTC](https://discourse.julialang.org/t/break-with-a-threaded-loop/78487 "2022-03-29T15:09:00Z")

</div>

Is there any simple way to break from a threaded for loop (actually I want an infinite while loop, but that doesn’t work with @threads)? Or would I need to use something like channels for synchronization? Trivial examp…

---

## [Combining ODE and SDE](https://discourse.julialang.org/t/combining-ode-and-sde/78674)

<div class="topic-metadata">

**Author:** [@Pitaevskii](https://discourse.julialang.org/u/Pitaevskii)\
**Replies:** 4\
**Last updated:** [March 29, 2022, 3:06pm UTC](https://discourse.julialang.org/t/combining-ode-and-sde/78674 "2022-03-29T15:06:30Z")

</div>

Hi everyone, I’m working on a problem where I have a large set of differential equations. Noise is added to the system in two ways, by sampling the initial condition for many simulations and by explicitly adding noise i…

---

## [Column types in DataFrames vs. InMemoryDatasets](https://discourse.julialang.org/t/column-types-in-dataframes-vs-inmemorydatasets/78682)

<div class="topic-metadata">

**Author:** [@monopolynomial](https://discourse.julialang.org/u/monopolynomial)\
**Replies:** 6\
**Last updated:** [March 29, 2022, 2:55pm UTC](https://discourse.julialang.org/t/column-types-in-dataframes-vs-inmemorydatasets/78682 "2022-03-29T14:55:23Z")

</div>

it’s very interesting, because it seems the following point is more about DataFrames.jl after all. because using InMemoryDatasets using NamedArrays initial = NamedArray(\[5748.61\], \["AUT-A01"\]) df\_initial = Dataset(:…

---

## [Random numbers and threads](https://discourse.julialang.org/t/random-numbers-and-threads/77364)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 30\
**Last updated:** [March 29, 2022, 2:31pm UTC](https://discourse.julialang.org/t/random-numbers-and-threads/77364 "2022-03-29T14:31:53Z")

</div>

How to use random numbers in conjunction with threads? In the past I used the following pattern: using Random function simulation(rngs) Threads.@threads for i in 1:1000000 rng = rngs\[Threads.threadid()\] …

---

## [Construct Dict same as NamedTuple](https://discourse.julialang.org/t/construct-dict-same-as-namedtuple/78663)

<div class="topic-metadata">

**Author:** [@yuvalw](https://discourse.julialang.org/u/yuvalw)\
**Replies:** 1\
**Last updated:** [March 29, 2022, 9:56am UTC](https://discourse.julialang.org/t/construct-dict-same-as-namedtuple/78663 "2022-03-29T09:56:21Z")

</div>

Is there a reason that I’m currently not seeing against using this? mainly for the sake of laziness. julia\> Base.Dict(;kwargs...) = Dict(kwargs) julia\> Dict(a=1,b=2) Dict{Symbol, Int64} with 2 entries: :a =\> 1 :b =\>…

---

## [Solving 1+u''(x) = b(x) with DiffEqOperators](https://discourse.julialang.org/t/solving-1-u-x-b-x-with-diffeqoperators/78653)

<div class="topic-metadata">

**Author:** [@Ruvi\_Lecamwasam](https://discourse.julialang.org/u/Ruvi_Lecamwasam)\
**Replies:** 2\
**Last updated:** [March 29, 2022, 9:02am UTC](https://discourse.julialang.org/t/solving-1-u-x-b-x-with-diffeqoperators/78653 "2022-03-29T09:02:47Z")

</div>

Suppose b(x) is a function of a variable x, and let Dxx represent the second derivative d^2x/dx^2. Then the differential equation 1+Dxx u = b has solution u = (1+Dxx)\\b. I can’t figure out how to do this with DiffEqO…

---

## [Correctly splatting for String Tuples](https://discourse.julialang.org/t/correctly-splatting-for-string-tuples/78655)

<div class="topic-metadata">

**Author:** [@mwhisena](https://discourse.julialang.org/u/mwhisena)\
**Replies:** 3\
**Last updated:** [March 29, 2022, 8:27am UTC](https://discourse.julialang.org/t/correctly-splatting-for-string-tuples/78655 "2022-03-29T08:27:24Z")

</div>

I’m attempting to splat two string tuples (n and m dims) so that they create a n by m array with the combinations of every element together. So if I have data= ( ("1.20e3", "1.08e3", "0.96e3"), …

---

## [Simple implementation of reverse mode automatic differentiation](https://discourse.julialang.org/t/simple-implementation-of-reverse-mode-automatic-differentiation/78628)

<div class="topic-metadata">

**Author:** [@A\_C](https://discourse.julialang.org/u/A_C)\
**Replies:** 7\
**Last updated:** [March 29, 2022, 7:22am UTC](https://discourse.julialang.org/t/simple-implementation-of-reverse-mode-automatic-differentiation/78628 "2022-03-29T07:22:08Z")

</div>

I was looking for a simple implementation of reverse mode automatic differentiation. There are a lot of tutorials which show implementation of forward mode using dual numbers. But I could not find anything for reverse mo…

---

## [DataFrame: Cannot have duplicated names for indices](https://discourse.julialang.org/t/dataframe-cannot-have-duplicated-names-for-indices/78396)

<div class="topic-metadata">

**Author:** [@tlorans](https://discourse.julialang.org/u/tlorans)\
**Replies:** 6\
**Last updated:** [March 24, 2022, 3:13pm UTC](https://discourse.julialang.org/t/dataframe-cannot-have-duplicated-names-for-indices/78396 "2022-03-24T15:13:39Z")

</div>

Hello everyone, I’d just spent 5 hours on a simple issue with joining two dataframes. I’ve basically two dataframes, one with a column of sectors and value, the other with new sectors mapped to the previous one as well…

---

## [What is so different in each of these matrix operations?](https://discourse.julialang.org/t/what-is-so-different-in-each-of-these-matrix-operations/78637)

<div class="topic-metadata">

**Author:** [@csubhodeep](https://discourse.julialang.org/u/csubhodeep)\
**Replies:** 3\
**Last updated:** [March 29, 2022, 7:06am UTC](https://discourse.julialang.org/t/what-is-so-different-in-each-of-these-matrix-operations/78637 "2022-03-29T07:06:14Z")

</div>

Hello all, I am fairly new to Julia and have just started learning the basics of Matrix. I wanted to get a brief understanding of what is so different under the hood that is causing the huge time differences in each of …

---

## [Why same calculations on matrices yield different results?](https://discourse.julialang.org/t/why-same-calculations-on-matrices-yield-different-results/78573)

<div class="topic-metadata">

**Author:** [@csubhodeep](https://discourse.julialang.org/u/csubhodeep)\
**Replies:** 4\
**Last updated:** [March 28, 2022, 8:58pm UTC](https://discourse.julialang.org/t/why-same-calculations-on-matrices-yield-different-results/78573 "2022-03-28T20:58:22Z")

</div>

Hello all, I am fairly new to Julia but I come from the Python world. While I am still learning the basic machinery of the Matrix. I noticed a small difference in the way a “self-declared identity” matrix is being used …

---

## [Is it possible to broadcast the property of a structure?](https://discourse.julialang.org/t/is-it-possible-to-broadcast-the-property-of-a-structure/78615)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [March 28, 2022, 8:43pm UTC](https://discourse.julialang.org/t/is-it-possible-to-broadcast-the-property-of-a-structure/78615 "2022-03-28T20:43:36Z")

</div>

Often I need to “broadcast” the field of a given structure, e.g.: struct Foo id::Int64 end mylist = \[Foo(1),Foo(2),Foo(1)\] \[e.id for e in mylist\] There is no way to broadcast the dot indicating field ownership, e.g…

---

## [Is it possible to detect if Julia is ahead-of-time precompiling?](https://discourse.julialang.org/t/is-it-possible-to-detect-if-julia-is-ahead-of-time-precompiling/78631)

<div class="topic-metadata">

**Author:** [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Replies:** 2\
**Last updated:** [March 28, 2022, 6:32pm UTC](https://discourse.julialang.org/t/is-it-possible-to-detect-if-julia-is-ahead-of-time-precompiling/78631 "2022-03-28T18:32:15Z")

</div>

I’d like to be able to tell at run-time (in \_\_init\_\_() in a package) whether the package is being “ahead-of-time precompiled” or not, in the sense that Pkg.precompile() is running (or similarly if precompiling automatica…

---

## [Deprecate finalizers? As done in Java 18](https://discourse.julialang.org/t/deprecate-finalizers-as-done-in-java-18/78632)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 1\
**Last updated:** [March 28, 2022, 6:23pm UTC](https://discourse.julialang.org/t/deprecate-finalizers-as-done-in-java-18/78632 "2022-03-28T18:23:11Z")

</div>

I believe Julia has finalizers (never looked into very carefully). Otherwise just ignore, read as Java trivia. Java 1 introduced finalizers (and just released Java 18 deprecated them). Are they similiar enough in Julia …

---

## [In Nearest Neighbours are trees other than BruteTree worth it for sets with between n=2^3 and n=2^20ish for KNN in 2D cartesian space](https://discourse.julialang.org/t/in-nearest-neighbours-are-trees-other-than-brutetree-worth-it-for-sets-with-between-n-2-3-and-n-2-20ish-for-knn-in-2d-cartesian-space/78561)

<div class="topic-metadata">

**Author:** [@AlanAylmer](https://discourse.julialang.org/u/AlanAylmer)\
**Replies:** 2\
**Last updated:** [March 28, 2022, 6:15pm UTC](https://discourse.julialang.org/t/in-nearest-neighbours-are-trees-other-than-brutetree-worth-it-for-sets-with-between-n-2-3-and-n-2-20ish-for-knn-in-2d-cartesian-space/78561 "2022-03-28T18:15:41Z")

</div>

I know the colossal @kristoffer.carlsson has been busy recently but I wonder if anyone else knows the A to my Q… I am running a teaching group on grouping waveforms. The waveform side of it is okay but I want to unders…

---

## [Fighting latency and the future of FunctionWrappers](https://discourse.julialang.org/t/fighting-latency-and-the-future-of-functionwrappers/78597)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 5\
**Last updated:** [March 28, 2022, 3:33pm UTC](https://discourse.julialang.org/t/fighting-latency-and-the-future-of-functionwrappers/78597 "2022-03-28T15:33:52Z")

</div>

In our constant battle to reduce time-to-first-X, I’m finding it very, very valuable to use the precompile approach of my bottleneck functions (diagnosed with the amazing SnoopCompile frameworks, thanks a bunch for that!…

---

## [ERROR: GitError(Code:ERROR, Class:Index, Invalid data in index - incorrect header signature)](https://discourse.julialang.org/t/error-giterror-code-error-class-index-invalid-data-in-index-incorrect-header-signature/12756)

<div class="topic-metadata">

**Author:** [@Ian-B](https://discourse.julialang.org/u/Ian-B)\
**Replies:** 0\
**Last updated:** [July 30, 2018, 10:47pm UTC](https://discourse.julialang.org/t/error-giterror-code-error-class-index-invalid-data-in-index-incorrect-header-signature/12756 "2018-07-30T22:47:22Z")

</div>

Hi! I’ve been trying to use Julia but I keep getting the same error when i try to install a package. I get this: julia\> Pkg.update() INFO: Updating METADATA… ERROR: GitError(Code:ERROR, Class:Index, Invalid data in in…

---

## [Finding the new order of shuffled array](https://discourse.julialang.org/t/finding-the-new-order-of-shuffled-array/78611)

<div class="topic-metadata">

**Author:** [@Kali](https://discourse.julialang.org/u/Kali)\
**Replies:** 2\
**Last updated:** [March 28, 2022, 1:19pm UTC](https://discourse.julialang.org/t/finding-the-new-order-of-shuffled-array/78611 "2022-03-28T13:19:46Z")

</div>

Hello Julia users! I was having a problem while writing some code that I hope you can help with. So basically what I want to do is that I have an original array A of some length which contains some integers. This array h…

---

## [DataFrame transform with many output columns](https://discourse.julialang.org/t/dataframe-transform-with-many-output-columns/78593)

<div class="topic-metadata">

**Author:** [@Mastomaki](https://discourse.julialang.org/u/Mastomaki)\
**Replies:** 1\
**Last updated:** [March 28, 2022, 8:53am UTC](https://discourse.julialang.org/t/dataframe-transform-with-many-output-columns/78593 "2022-03-28T08:53:31Z")

</div>

Hello! I can split string columns in dataframe as follows: s = DataFrame(grid = "uuu\_mygrid", e = \[3,3,3\]) transform(s, :grid =\> (ByRow(x -\> split(x,"\_"))) =\> AsTable) But how can I specify the new column names?

---

## [CUDA kernel configuration](https://discourse.julialang.org/t/cuda-kernel-configuration/78417)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 3\
**Last updated:** [March 28, 2022, 7:54am UTC](https://discourse.julialang.org/t/cuda-kernel-configuration/78417 "2022-03-28T07:54:41Z")

</div>

Hey Julianners, I don’t know what do I do wrong, but I use a configurator that calculates the ideal kernel config that was used here: https://discourse.julialang.org/t/the-most-general-way-to-estimate-the-optimal-argume…

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

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