# General Usage

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

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

**Page:** 131

---

## [Superscripts in Plots.jl with units](https://discourse.julialang.org/t/superscripts-in-plots-jl-with-units/119652)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 1\
**Last updated:** [September 20, 2024, 7:16pm UTC](https://discourse.julialang.org/t/superscripts-in-plots-jl-with-units/119652 "2024-09-20T19:16:10Z")

</div>

Doing: julia\> using Plots, Unitful julia\> plot(\[1,2,3\]u"s", \[1,2,3\]u"m/s") produces this y-label: Shouldn´t it produce m s^{-1} with a proper superscript?

---

## [Acquiring locks in finalizers](https://discourse.julialang.org/t/acquiring-locks-in-finalizers/119628)

<div class="topic-metadata">

**Author:** [@remysucre](https://discourse.julialang.org/u/remysucre)\
**Replies:** 3\
**Last updated:** [September 20, 2024, 5:05pm UTC](https://discourse.julialang.org/t/acquiring-locks-in-finalizers/119628 "2024-09-20T17:05:56Z")

</div>

The manual has an example with a finalizer that acquires a lock (without blocking). However, in the Locks section it also says: The following are definitely leaf locks (level 1), and must not try to acquire any other l…

---

## [Why is the product of Real and Float64 arrays of eltype Any?](https://discourse.julialang.org/t/why-is-the-product-of-real-and-float64-arrays-of-eltype-any/119219)

<div class="topic-metadata">

**Author:** [@mhauru](https://discourse.julialang.org/u/mhauru)\
**Replies:** 4\
**Last updated:** [September 20, 2024, 3:48pm UTC](https://discourse.julialang.org/t/why-is-the-product-of-real-and-float64-arrays-of-eltype-any/119219 "2024-09-20T15:48:46Z")

</div>

I just discovered that for instance julia\> eltype(LinearAlgebra.Diagonal(Real\[1.0\]) \* \[1.0;;\]) Any and julia\> Real\[1.0;;\] \* \[1.0;;\] 1×1 Matrix{Any}: 1.0 Why is the eltype here Any, rather than Real? Element-wise pr…

---

## [Distributed computing over SLURM array](https://discourse.julialang.org/t/distributed-computing-over-slurm-array/119574)

<div class="topic-metadata">

**Author:** [@tb877](https://discourse.julialang.org/u/tb877)\
**Replies:** 11\
**Last updated:** [September 20, 2024, 3:04pm UTC](https://discourse.julialang.org/t/distributed-computing-over-slurm-array/119574 "2024-09-20T15:04:14Z")

</div>

Hi, New to Julia, and also new to SLURM. I’m thinking about the following workflow for my project and would like to see if it seems a sensible strategy, especially considering the specificities of the Julia language. I…

---

## [Allocatable Multidimensional Arrays in Fortran](https://discourse.julialang.org/t/allocatable-multidimensional-arrays-in-fortran/119535)

<div class="topic-metadata">

**Author:** [@Jason\_Meziere](https://discourse.julialang.org/u/Jason_Meziere)\
**Replies:** 9\
**Last updated:** [September 20, 2024, 2:43pm UTC](https://discourse.julialang.org/t/allocatable-multidimensional-arrays-in-fortran/119535 "2024-09-20T14:43:06Z")

</div>

I am attempting to wrap a fortran package in Julia. In many of the functions, there are 2D arrays that are specified as ALLOCATABLE. Does Julia have a way to handle this? And what is the proper way to pass these values i…

---

## [Questions about dependencies between packages](https://discourse.julialang.org/t/questions-about-dependencies-between-packages/119633)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 8\
**Last updated:** [September 20, 2024, 9:15am UTC](https://discourse.julialang.org/t/questions-about-dependencies-between-packages/119633 "2024-09-20T09:15:55Z")

</div>

Suppose we have installed the latest version of a package named PkgB v0.1.0 in our project environment. It has PkgA v0.1.0 as one of its dependencies. Now we find that PkgA v0.1.0 has a new commit on GitHub without rel…

---

## [GLMakie and nixOS](https://discourse.julialang.org/t/glmakie-and-nixos/111897)

<div class="topic-metadata">

**Author:** [@Pablo\_Marchant](https://discourse.julialang.org/u/Pablo_Marchant)\
**Replies:** 4\
**Last updated:** [September 20, 2024, 6:08am UTC](https://discourse.julialang.org/t/glmakie-and-nixos/111897 "2024-09-20T06:08:16Z")

</div>

Just a quick question here, sorry if this is not the right place for it. Has anyone managed to use GLMakie in nixos? Wanted to try out this distro but it seems julia has some issues with it, seems they explicitly say som…

---

## [How to add a tolerance to isapprox](https://discourse.julialang.org/t/how-to-add-a-tolerance-to-isapprox/118711)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 6\
**Last updated:** [August 28, 2024, 1:18pm UTC](https://discourse.julialang.org/t/how-to-add-a-tolerance-to-isapprox/118711 "2024-08-28T13:18:18Z")

</div>

I have the following line of code: @test all(forces\[i,:\] .≈ kps4.forces\[i\]) I would like to increase the relative tolerance, in other words add the parameter rtol=1e-4 . How can I do that?

---

## [How to define a custom Makie xscale function which needs an extra argument?](https://discourse.julialang.org/t/how-to-define-a-custom-makie-xscale-function-which-needs-an-extra-argument/119580)

<div class="topic-metadata">

**Author:** [@AUK1939](https://discourse.julialang.org/u/AUK1939)\
**Replies:** 3\
**Last updated:** [September 19, 2024, 4:05pm UTC](https://discourse.julialang.org/t/how-to-define-a-custom-makie-xscale-function-which-needs-an-extra-argument/119580 "2024-09-19T16:05:03Z")

</div>

Hi To apply a custom scaling function in Makie as per the docs we need to overload some functions. The example below is taken from here import Makie function my\_log(x) return log10(x) end function my\_inverse\_log(…

---

## [How to dynamically import packages and run their functions from a setting file](https://discourse.julialang.org/t/how-to-dynamically-import-packages-and-run-their-functions-from-a-setting-file/119548)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [September 19, 2024, 2:55pm UTC](https://discourse.julialang.org/t/how-to-dynamically-import-packages-and-run-their-functions-from-a-setting-file/119548 "2024-09-19T14:55:33Z")

</div>

I am trying to create a set of packages where I have a main package that know nothing of subpackages but it call a certain function of them, and where the subpackages to use are defined in a configuration file. So, I ha…

---

## [Massive memory leak in Julia due to tiny memory leak in C](https://discourse.julialang.org/t/massive-memory-leak-in-julia-due-to-tiny-memory-leak-in-c/119526)

<div class="topic-metadata">

**Author:** [@Yixiao-Zhang](https://discourse.julialang.org/u/Yixiao-Zhang)\
**Replies:** 3\
**Last updated:** [September 19, 2024, 1:30pm UTC](https://discourse.julialang.org/t/massive-memory-leak-in-julia-due-to-tiny-memory-leak-in-c/119526 "2024-09-19T13:30:14Z")

</div>

The latest version (v4.9.2) of netCDF-C (a C library for outputting data in the network Common Data Form.) is known to have memory leak. The leaked memory is not more than several MBs (see this link). However, when I use…

---

## [Parallelization issues](https://discourse.julialang.org/t/parallelization-issues/119467)

<div class="topic-metadata">

**Author:** [@ditfurth](https://discourse.julialang.org/u/ditfurth)\
**Replies:** 4\
**Last updated:** [September 19, 2024, 12:56pm UTC](https://discourse.julialang.org/t/parallelization-issues/119467 "2024-09-19T12:56:29Z")

</div>

Hi all, I am having parallelization issues. I am trying to utilize multiple computers in an mpi call and have tried a lot of things. So because it is mpi, the memory will not be shared. I can divide my dataset with an i…

---

## [Generate a graph of subtypes](https://discourse.julialang.org/t/generate-a-graph-of-subtypes/119598)

<div class="topic-metadata">

**Author:** [@cmarcotte](https://discourse.julialang.org/u/cmarcotte)\
**Replies:** 3\
**Last updated:** [September 19, 2024, 1:15pm UTC](https://discourse.julialang.org/t/generate-a-graph-of-subtypes/119598 "2024-09-19T13:15:54Z")

</div>

Hello, I find myself manually making (abstract) type diagrams to efficiently explain the hierarchy to collaborators. Supplying a type to a function which prints a nice textual network of types would be very useful. Thi…

---

## [Subdividing a matrix into smaller submatrices for multithreading](https://discourse.julialang.org/t/subdividing-a-matrix-into-smaller-submatrices-for-multithreading/119597)

<div class="topic-metadata">

**Author:** [@BBReactionHooper](https://discourse.julialang.org/u/BBReactionHooper)\
**Replies:** 1\
**Last updated:** [September 19, 2024, 12:02pm UTC](https://discourse.julialang.org/t/subdividing-a-matrix-into-smaller-submatrices-for-multithreading/119597 "2024-09-19T12:02:00Z")

</div>

I would like to perform a multi-threaded operation on a matrix. It makes most sense to subdivide this matrix into smaller submatrices, one for each thread. How do I divide a rectangular matrix into a possible arbitrary n…

---

## [Confirm \`Ctrl-D\` to exit with \`y/n\` prompt like iPython?](https://discourse.julialang.org/t/confirm-ctrl-d-to-exit-with-y-n-prompt-like-ipython/105487)

<div class="topic-metadata">

**Author:** [@bert](https://discourse.julialang.org/u/bert)\
**Replies:** 16\
**Last updated:** [September 19, 2024, 9:28am UTC](https://discourse.julialang.org/t/confirm-ctrl-d-to-exit-with-y-n-prompt-like-ipython/105487 "2024-09-19T09:28:27Z")

</div>

When using the REPL, is there a way to have an ipython-style confirmation when pressing Ctrl-D to exit? Currently Julia does this: julia\> Type ^D again to exit. julia\> I’m not a fan of this because I think it’ll just…

---

## [Optimizing Sparse Matrix Exponential Computation in Julia](https://discourse.julialang.org/t/optimizing-sparse-matrix-exponential-computation-in-julia/119584)

<div class="topic-metadata">

**Author:** [@ZACK\_Z](https://discourse.julialang.org/u/ZACK_Z)\
**Replies:** 2\
**Last updated:** [September 19, 2024, 7:35am UTC](https://discourse.julialang.org/t/optimizing-sparse-matrix-exponential-computation-in-julia/119584 "2024-09-19T07:35:08Z")

</div>

I’m trying to compute the sparse matrix exponential of large matrices (at least 10,000 x 10,000) using Julia packages like Expokit, FastExp, and ExpmV. However, I’m finding that the computation time is significantly long…

---

## [How would I use Supposition.jl on computer arithmetic corner cases?](https://discourse.julialang.org/t/how-would-i-use-supposition-jl-on-computer-arithmetic-corner-cases/119418)

<div class="topic-metadata">

**Author:** [@kapple](https://discourse.julialang.org/u/kapple)\
**Replies:** 18\
**Last updated:** [September 19, 2024, 5:23am UTC](https://discourse.julialang.org/t/how-would-i-use-supposition-jl-on-computer-arithmetic-corner-cases/119418 "2024-09-19T05:23:13Z")

</div>

How would one implement a Supposition.jl test for something like the following MWE? @check function phased(x = Data.Floats()) cosd(x) == sind(x + 90) end which fails due to floating point stuff x = 1.801439850948189…

---

## [How does RuntimeGeneratedFunction ensure correct dependencies are loaded?](https://discourse.julialang.org/t/how-does-runtimegeneratedfunction-ensure-correct-dependencies-are-loaded/119569)

<div class="topic-metadata">

**Author:** [@brianguenter](https://discourse.julialang.org/u/brianguenter)\
**Replies:** 3\
**Last updated:** [September 19, 2024, 4:27am UTC](https://discourse.julialang.org/t/how-does-runtimegeneratedfunction-ensure-correct-dependencies-are-loaded/119569 "2024-09-19T04:27:22Z")

</div>

How does RuntimeGeneratedFunction ensure that the correct dependency libraries are available? This example compiles an expression which includes the constant twoπ which is defined in IrrationalConstants.jl and used in D…

---

## [Adding package to new environment takes long time?](https://discourse.julialang.org/t/adding-package-to-new-environment-takes-long-time/119518)

<div class="topic-metadata">

**Author:** [@p\_f](https://discourse.julialang.org/u/p_f)\
**Replies:** 8\
**Last updated:** [September 18, 2024, 10:55pm UTC](https://discourse.julialang.org/t/adding-package-to-new-environment-takes-long-time/119518 "2024-09-18T22:55:17Z")

</div>

I have already installed DifferentialEquations.jl in many different environments. I just created a new environment and did \]add DifferentialEquations This took \> 5 mins, and then precompilation happened for another may…

---

## [REPL hangs at compile](https://discourse.julialang.org/t/repl-hangs-at-compile/119562)

<div class="topic-metadata">

**Author:** [@AUK1939](https://discourse.julialang.org/u/AUK1939)\
**Replies:** 6\
**Last updated:** [September 18, 2024, 10:33pm UTC](https://discourse.julialang.org/t/repl-hangs-at-compile/119562 "2024-09-18T22:33:35Z")

</div>

Hi, Can anyone else reproduce the below? The following function just hangs the julia REPL. I’m using 1.11.0-rc3 on Windows 11. import Hypatia import SCS import COSMO using JuMP function getjumpmodel(optimizer\_name::S…

---

## [How to do plotting on WSL (Windows Subsystem Linux)](https://discourse.julialang.org/t/how-to-do-plotting-on-wsl-windows-subsystem-linux/32812)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 8\
**Last updated:** [September 18, 2024, 9:52pm UTC](https://discourse.julialang.org/t/how-to-do-plotting-on-wsl-windows-subsystem-linux/32812 "2024-09-18T21:52:44Z")

</div>

I am using WSL with Julia which makes it more reproducible, but I can’t get plotting to work on WSL. Does anyone have any tips? I can start the Jupyter notebook, but I am referring to plotting in REPL. Plotting by conn…

---

## [How does one set up a centralized Julia installation?](https://discourse.julialang.org/t/how-does-one-set-up-a-centralized-julia-installation/13922)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 44\
**Last updated:** [September 18, 2024, 3:08pm UTC](https://discourse.julialang.org/t/how-does-one-set-up-a-centralized-julia-installation/13922 "2024-09-18T15:08:53Z")

</div>

I would like to start a thread about best practice for how to set up a centralized Julia installation in a cluster environment or local institution network. Hopefully, this will lead to a tutorial like write-up in the en…

---

## [Core dumped when defining a Channel as constant](https://discourse.julialang.org/t/core-dumped-when-defining-a-channel-as-constant/119551)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 6\
**Last updated:** [September 18, 2024, 2:04pm UTC](https://discourse.julialang.org/t/core-dumped-when-defining-a-channel-as-constant/119551 "2024-09-18T14:04:58Z")

</div>

module M const C = Channel(ch -\> put!(ch, nothing), ctype=Nothing) end Precompiling this module leads to core dumped… \[16831\] signal (6.-6): Aborted in expression starting at REPL\[1\]:1 unknown function (ip: 0xffffb1270…

---

## [Public interface to get all type parameters?](https://discourse.julialang.org/t/public-interface-to-get-all-type-parameters/119514)

<div class="topic-metadata">

**Author:** [@lmtzx9h4qqnt](https://discourse.julialang.org/u/lmtzx9h4qqnt)\
**Replies:** 6\
**Last updated:** [September 18, 2024, 12:56pm UTC](https://discourse.julialang.org/t/public-interface-to-get-all-type-parameters/119514 "2024-09-18T12:56:14Z")

</div>

Is it possible to implement the following function: get\_parameters(::Type{T}) where {T} = T.parameters without relying on the internal field parameters? As far as I can tell, the answer seems to be no, since this appro…

---

## [\`\\boldsymbol\` in \`Latexify\`](https://discourse.julialang.org/t/boldsymbol-in-latexify/119489)

<div class="topic-metadata">

**Author:** [@PatrickHaecker](https://discourse.julialang.org/u/PatrickHaecker)\
**Replies:** 3\
**Last updated:** [September 18, 2024, 10:17am UTC](https://discourse.julialang.org/t/boldsymbol-in-latexify/119489 "2024-09-18T10:17:27Z")

</div>

I am probably missing something simple, but typing a lot of LaTeX in markdown strings seems to be harder than it needs to be when Latexify exists. Therefore, is there a simpler way to output using Markdown md""" \`\` \\bo…

---

## [Cannot start Julia](https://discourse.julialang.org/t/cannot-start-julia/119540)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [September 18, 2024, 9:43am UTC](https://discourse.julialang.org/t/cannot-start-julia/119540 "2024-09-18T09:43:56Z")

</div>

When I try to start Julia I get the message: Juliaup configuration is locked by another process, waiting for it to unlock. and than it hangs, nothing else happens. In the past I also saw this message, but it disappear…

---

## [Tidiest way to reuse variables inside a function to reduce gc time](https://discourse.julialang.org/t/tidiest-way-to-reuse-variables-inside-a-function-to-reduce-gc-time/119509)

<div class="topic-metadata">

**Author:** [@fmor](https://discourse.julialang.org/u/fmor)\
**Replies:** 8\
**Last updated:** [September 18, 2024, 9:09am UTC](https://discourse.julialang.org/t/tidiest-way-to-reuse-variables-inside-a-function-to-reduce-gc-time/119509 "2024-09-18T09:09:22Z")

</div>

I’m writing a function to fit a spatio-temporal model for clustering. At each iteration it has to compute spatial cohesions on subsets of units, and I saw that this takes a lot of the execution time, which is spent in ga…

---

## [Can \`parse\` be computed at compile time?](https://discourse.julialang.org/t/can-parse-be-computed-at-compile-time/119507)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 4\
**Last updated:** [September 17, 2024, 9:21pm UTC](https://discourse.julialang.org/t/can-parse-be-computed-at-compile-time/119507 "2024-09-17T21:21:13Z")

</div>

The function f() = parse(Int, "10") produces native code, according to @code\_native, which involves runtime parsing rather than directly returning the integer 10. Why can’t Julia optimize this away at compile time? Is…

---

## [Quarto: A code (using ModelingToolkit) that runs in REPL fails in Quarto](https://discourse.julialang.org/t/quarto-a-code-using-modelingtoolkit-that-runs-in-repl-fails-in-quarto/119527)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 0\
**Last updated:** [September 17, 2024, 8:51pm UTC](https://discourse.julialang.org/t/quarto-a-code-using-modelingtoolkit-that-runs-in-repl-fails-in-quarto/119527 "2024-09-17T20:51:50Z")

</div>

The following Julia code (that uses ModelingToolkit) runs with no troubles in REPL, but errors when run within a code cell in a Quarto qmd file (for convenience it is also listed below together with the error message): u…

---

## [Different times with @elapsed, @time and @benchmark](https://discourse.julialang.org/t/different-times-with-elapsed-time-and-benchmark/119381)

<div class="topic-metadata">

**Author:** [@odddot](https://discourse.julialang.org/u/odddot)\
**Replies:** 3\
**Last updated:** [September 17, 2024, 8:51pm UTC](https://discourse.julialang.org/t/different-times-with-elapsed-time-and-benchmark/119381 "2024-09-17T20:51:01Z")

</div>

Hi, I am a little confused by some results that I obtain comparing @time, @elapsed and @benchmark. I am aware of some differences between this macros, but I suppose that I am not really understanding what is happening h…

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

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