# General Usage

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

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

**Page:** 130

---

## [Is it safe to run Revise from multiple threads?](https://discourse.julialang.org/t/is-it-safe-to-run-revise-from-multiple-threads/119743)

<div class="topic-metadata">

**Author:** [@frankier](https://discourse.julialang.org/u/frankier)\
**Replies:** 2\
**Last updated:** [September 23, 2024, 5:26pm UTC](https://discourse.julialang.org/t/is-it-safe-to-run-revise-from-multiple-threads/119743 "2024-09-23T17:26:45Z")

</div>

Is it safe to run Revise from multiple threads? It seems that Revise in typical usage, e.g. a REPL session, will only run in the interactive thread, and then the updated code will end up run in existing threads, assuming…

---

## [\`end\` flagged as missing coverage but loop was covered](https://discourse.julialang.org/t/end-flagged-as-missing-coverage-but-loop-was-covered/119754)

<div class="topic-metadata">

**Author:** [@rafaelbailo](https://discourse.julialang.org/u/rafaelbailo)\
**Replies:** 0\
**Last updated:** [September 23, 2024, 3:54pm UTC](https://discourse.julialang.org/t/end-flagged-as-missing-coverage-but-loop-was-covered/119754 "2024-09-23T15:54:56Z")

</div>

I’m looking at the Codecov coverage of MultiPrecisionArrays.jl, and it seems there is and end statement marked as lacking coverage when the code inside the corresponding loop was executed. Is there something truly missin…

---

## [Struct with Abstract type and jl\_get\_function()](https://discourse.julialang.org/t/struct-with-abstract-type-and-jl-get-function/119751)

<div class="topic-metadata">

**Author:** [@PatriceLebrun](https://discourse.julialang.org/u/PatriceLebrun)\
**Replies:** 0\
**Last updated:** [September 23, 2024, 2:18pm UTC](https://discourse.julialang.org/t/struct-with-abstract-type-and-jl-get-function/119751 "2024-09-23T14:18:59Z")

</div>

Hi, I define struct CDChitsICEDUST{T \<: AbstractFloat} xstarts::Vector{T} ystarts::Vector{T} .... end so I get a wrong value if I do a jl\_get\_function((jl\_module\_t \*) mod, "CDChitsICEDUST{Cf…

---

## [New to packages - updating](https://discourse.julialang.org/t/new-to-packages-updating/119744)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 1\
**Last updated:** [September 23, 2024, 12:50pm UTC](https://discourse.julialang.org/t/new-to-packages-updating/119744 "2024-09-23T12:50:19Z")

</div>

I created a package with: Pkg\> generate MyPackage Pkg\> develope MyPackage using MyPackage Then added a new function to MyPackage, re-started the kernel and ran using MyPackage. This makes the function visible, but c…

---

## [Quaternion to Euler angles](https://discourse.julialang.org/t/quaternion-to-euler-angles/119740)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [September 23, 2024, 11:51am UTC](https://discourse.julialang.org/t/quaternion-to-euler-angles/119740 "2024-09-23T11:51:50Z")

</div>

How can I convert a quaternion into Euler angles? Not working: using Rotations q = Float32\[0.51791805, 0.48140272, -0.4814214, -0.5179244\] RotXYZ(q) This fails with a dimension mismatch error. See: Euler Angles · Rot…

---

## [How can I check the running progress or intermediate output of tasks submitted to the cluster?](https://discourse.julialang.org/t/how-can-i-check-the-running-progress-or-intermediate-output-of-tasks-submitted-to-the-cluster/119737)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 1\
**Last updated:** [September 23, 2024, 11:33am UTC](https://discourse.julialang.org/t/how-can-i-check-the-running-progress-or-intermediate-output-of-tasks-submitted-to-the-cluster/119737 "2024-09-23T11:33:12Z")

</div>

My script contains println or other codes to output some progress information to monitor the running progress of the script. After submitting it through SLURM, the script starts running. However, during the execution of …

---

## [Pushing elements into a view](https://discourse.julialang.org/t/pushing-elements-into-a-view/119733)

<div class="topic-metadata">

**Author:** [@fmor](https://discourse.julialang.org/u/fmor)\
**Replies:** 4\
**Last updated:** [September 23, 2024, 9:29am UTC](https://discourse.julialang.org/t/pushing-elements-into-a-view/119733 "2024-09-23T09:29:19Z")

</div>

I’m working on a clustering model, and to compute cluster weights I have to compare the cohesions of the current cluster k to the one of cluster k plus unit j (respectively old (o) and new (n) in the code). To do so I t…

---

## [Dates.jl - week last week of year/first week of year](https://discourse.julialang.org/t/dates-jl-week-last-week-of-year-first-week-of-year/119703)

<div class="topic-metadata">

**Author:** [@Longblackcoffee](https://discourse.julialang.org/u/Longblackcoffee)\
**Replies:** 5\
**Last updated:** [September 22, 2024, 9:19pm UTC](https://discourse.julialang.org/t/dates-jl-week-last-week-of-year-first-week-of-year/119703 "2024-09-22T21:19:58Z")

</div>

Hi everyone, I have daily level data spanning multiple years, and I want to aggregate it to the weekly level. week(DateTime(2020, 12, 31)) week(DateTime(2021, 01, 01)) I noticed that the week function considers both t…

---

## [Testing parallelization with MPI and Test](https://discourse.julialang.org/t/testing-parallelization-with-mpi-and-test/114040)

<div class="topic-metadata">

**Author:** [@mesonepigreco](https://discourse.julialang.org/u/mesonepigreco)\
**Replies:** 2\
**Last updated:** [September 23, 2024, 4:40am UTC](https://discourse.julialang.org/t/testing-parallelization-with-mpi-and-test/114040 "2024-09-23T04:40:06Z")

</div>

Hello everyone, I am developing a package that implements multiprocessing with MPI.jl for applications in HPC facilities. I have a full test suite for my package, which can be run with the usual “\]” test from the REPL …

---

## [Optimization program which previously worked is no longer working](https://discourse.julialang.org/t/optimization-program-which-previously-worked-is-no-longer-working/118900)

<div class="topic-metadata">

**Author:** [@tighem](https://discourse.julialang.org/u/tighem)\
**Replies:** 12\
**Last updated:** [September 22, 2024, 10:16pm UTC](https://discourse.julialang.org/t/optimization-program-which-previously-worked-is-no-longer-working/118900 "2024-09-22T22:16:41Z")

</div>

I am running julia version 1.10.5, about a month ago I had written and successfully run a piece of optimization code which uses LBFGS to optimize a system of 218 differential equations dependent on 12 parameters. Returni…

---

## [OrdinaryDiffEqDefault get stuck in loop while precompilation](https://discourse.julialang.org/t/ordinarydiffeqdefault-get-stuck-in-loop-while-precompilation/119684)

<div class="topic-metadata">

**Author:** [@kunal](https://discourse.julialang.org/u/kunal)\
**Replies:** 4\
**Last updated:** [September 22, 2024, 9:44pm UTC](https://discourse.julialang.org/t/ordinarydiffeqdefault-get-stuck-in-loop-while-precompilation/119684 "2024-09-22T21:44:59Z")

</div>

After installation of new package the precompilation get stuck with OrdinaryDiffEqDefault. Tried deleting OrdinaryDiffEqDefault dir from ./julia/packages and ./julia/compile Still keeps looping in.

---

## [Problem Installing CUDA\_Runtime](https://discourse.julialang.org/t/problem-installing-cuda-runtime/118966)

<div class="topic-metadata">

**Author:** [@leoherz](https://discourse.julialang.org/u/leoherz)\
**Replies:** 3\
**Last updated:** [September 22, 2024, 9:14pm UTC](https://discourse.julialang.org/t/problem-installing-cuda-runtime/118966 "2024-09-22T21:14:35Z")

</div>

Hey guys, my first time posting in this forum, see please forgive me in advance for any bad practices related to the way I will describe this problem. I am currently trying to install CUDA.jl in my computer, however, I …

---

## [What would be a nice way to call Julia from Python using a different process?](https://discourse.julialang.org/t/what-would-be-a-nice-way-to-call-julia-from-python-using-a-different-process/117183)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [September 22, 2024, 9:03pm UTC](https://discourse.julialang.org/t/what-would-be-a-nice-way-to-call-julia-from-python-using-a-different-process/117183 "2024-09-22T21:03:39Z")

</div>

I have a small number of Julia functions that I want to call from Python. We tried PythonCall which works for a toy example, but not when integrated in the full Python program, which might be due to library incompatibili…

---

## [Syntactic sugar for types](https://discourse.julialang.org/t/syntactic-sugar-for-types/119685)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 8\
**Last updated:** [September 22, 2024, 6:46pm UTC](https://discourse.julialang.org/t/syntactic-sugar-for-types/119685 "2024-09-22T18:46:30Z")

</div>

Is this the correct code to add syntactic sugar for types? Base.:(|)(X::Type, Y::Type) = Union{X,Y} Base.:(|)(X::TypeVar, Y::Type) = Union{X,Y} Base.:(|)(X::Type, Y::TypeVar) = Union{X,Y} Base.:(|)(X::TypeVar, Y::TypeVa…

---

## [Julian way to write this code](https://discourse.julialang.org/t/julian-way-to-write-this-code/119348)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 18\
**Last updated:** [September 22, 2024, 6:32pm UTC](https://discourse.julialang.org/t/julian-way-to-write-this-code/119348 "2024-09-22T18:32:22Z")

</div>

Is there a pretty way to write this and have good performance? g1 produces runtime dispatch, g2 produces an allocation and g3 doesn’t look very “Julian” and is also unsafe. function g1(x, y, w) sum(i -\> x\[i\] \* y\[i\] \* …

---

## [Why fft with MEASURE plan 10x slower than calling fft directly with CUDA.CUFFT?](https://discourse.julialang.org/t/why-fft-with-measure-plan-10x-slower-than-calling-fft-directly-with-cuda-cufft/119679)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 7\
**Last updated:** [September 22, 2024, 4:53am UTC](https://discourse.julialang.org/t/why-fft-with-measure-plan-10x-slower-than-calling-fft-directly-with-cuda-cufft/119679 "2024-09-22T04:53:10Z")

</div>

using CUDA using CUDA.CUFFT using BenchmarkTools: @benchmark import FFTW a\_gpu = CUDA.rand(Float32, 128, 128, 128) @benchmark CUDA.@sync fft($a\_gpu) which gives: BenchmarkTools.Trial: 1744 samples with 1 evaluation. …

---

## [Can Julia detect that it is running in headless machine?](https://discourse.julialang.org/t/can-julia-detect-that-it-is-running-in-headless-machine/119696)

<div class="topic-metadata">

**Author:** [@HMegh](https://discourse.julialang.org/u/HMegh)\
**Replies:** 4\
**Last updated:** [September 22, 2024, 4:53pm UTC](https://discourse.julialang.org/t/can-julia-detect-that-it-is-running-in-headless-machine/119696 "2024-09-22T16:53:00Z")

</div>

Hi, I have a small project that I am running on my computer, as well as on a remote server. On my laptop, I typically use Plots.jl or Makie.jl for visualization, but on the server I am typically interested in saving my …

---

## [Can you call a julia function in REPL shell mode?](https://discourse.julialang.org/t/can-you-call-a-julia-function-in-repl-shell-mode/119709)

<div class="topic-metadata">

**Author:** [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Replies:** 0\
**Last updated:** [September 22, 2024, 4:31pm UTC](https://discourse.julialang.org/t/can-you-call-a-julia-function-in-repl-shell-mode/119709 "2024-09-22T16:31:00Z")

</div>

Background: I use cygwin on win11 with its /bin in my julia PATH so I can use the cygwin stuff from the REPL shell mode. As I am in a mixed windows (julia and the host OS) and cygwin (the wonderful POSIX world) I’m t…

---

## [Drop in performance after saving data with jldsave](https://discourse.julialang.org/t/drop-in-performance-after-saving-data-with-jldsave/119595)

<div class="topic-metadata">

**Author:** [@J\_B\_R](https://discourse.julialang.org/u/J_B_R)\
**Replies:** 4\
**Last updated:** [September 22, 2024, 3:02pm UTC](https://discourse.julialang.org/t/drop-in-performance-after-saving-data-with-jldsave/119595 "2024-09-22T15:02:02Z")

</div>

Hi I run my Julia code on a cluster and save the output data frequently into a jld2 file by using jldsave. On the desktop computer, performance remains constant, but on the cluster, the performance drops significantly a…

---

## [Confusing Results When Comparing Arrays in Julia](https://discourse.julialang.org/t/confusing-results-when-comparing-arrays-in-julia/119689)

<div class="topic-metadata">

**Author:** [@Kaiyue](https://discourse.julialang.org/u/Kaiyue)\
**Replies:** 5\
**Last updated:** [September 22, 2024, 12:34pm UTC](https://discourse.julialang.org/t/confusing-results-when-comparing-arrays-in-julia/119689 "2024-09-22T12:34:41Z")

</div>

Hi, I’m using Julia version 1.10.5 (2024-08-27) on Ubuntu 22.04. I’ve been experimenting with comparing arrays, but I’m getting some confusing results. Here’s my code: u = \[1;2;3\] v = \[1 2 3\] A = \[1 2 3; 4 5 6\] print(A…

---

## [Changing the basic type of a Unitful quantity](https://discourse.julialang.org/t/changing-the-basic-type-of-a-unitful-quantity/119665)

<div class="topic-metadata">

**Author:** [@Maurizio\_Tomasi](https://discourse.julialang.org/u/Maurizio_Tomasi)\
**Replies:** 2\
**Last updated:** [September 22, 2024, 10:26am UTC](https://discourse.julialang.org/t/changing-the-basic-type-of-a-unitful-quantity/119665 "2024-09-22T10:26:34Z")

</div>

I’m developing some electromagnetic code and want to use Unitful.jl thoroughly to make sure that data structures and algorithms are physically consistent. One feature I would like to have is the ability to quickly set u…

---

## [Accessing the macOS Keychain from Julia](https://discourse.julialang.org/t/accessing-the-macos-keychain-from-julia/119693)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [September 22, 2024, 10:21am UTC](https://discourse.julialang.org/t/accessing-the-macos-keychain-from-julia/119693 "2024-09-22T10:21:08Z")

</div>

How can one access the macOS Keychain from Julia ? To store or retrieve passwords.

---

## [Coding different iterations over a dataset](https://discourse.julialang.org/t/coding-different-iterations-over-a-dataset/119675)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 3\
**Last updated:** [September 22, 2024, 6:26am UTC](https://discourse.julialang.org/t/coding-different-iterations-over-a-dataset/119675 "2024-09-22T06:26:32Z")

</div>

I have some code currently implemented via multiple dispatch that looks vaguely like: function process\_data(data,n) for i in 1:n # apply operation to entire data set, data end end function process\_data(data\_se…

---

## [MLJ for XGBoost - extracting feature gain](https://discourse.julialang.org/t/mlj-for-xgboost-extracting-feature-gain/93518)

<div class="topic-metadata">

**Author:** [@Ivan](https://discourse.julialang.org/u/Ivan)\
**Replies:** 4\
**Last updated:** [September 22, 2024, 5:13am UTC](https://discourse.julialang.org/t/mlj-for-xgboost-extracting-feature-gain/93518 "2024-09-22T05:13:23Z")

</div>

I have used MLJ for XGBoost in the past, and was able to explore the feature importances doing the following: using MLJ, DataFrames @load XGBoostRegressor pkg=XGBoost X = DataFrame(rand((0, 1), (200, 5)), :auto) y = ran…

---

## [Cholesky decomposition of low-rank positive-semidefinite matrix](https://discourse.julialang.org/t/cholesky-decomposition-of-low-rank-positive-semidefinite-matrix/70397)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 3\
**Last updated:** [October 26, 2021, 12:54pm UTC](https://discourse.julialang.org/t/cholesky-decomposition-of-low-rank-positive-semidefinite-matrix/70397 "2021-10-26T12:54:43Z")

</div>

Dear All, I have a rank r positive-semidefinite matrix M, which I am trying to decompose via lower-triangularlar Cholesky factorization M=LL^\\top, but I am particularly interested in computing an L that has r positive d…

---

## [Lux.jl vs Jax](https://discourse.julialang.org/t/lux-jl-vs-jax/119654)

<div class="topic-metadata">

**Author:** [@ijk](https://discourse.julialang.org/u/ijk)\
**Replies:** 6\
**Last updated:** [September 21, 2024, 6:12pm UTC](https://discourse.julialang.org/t/lux-jl-vs-jax/119654 "2024-09-21T18:12:02Z")

</div>

I’ve started using Julia this semester, and would like to reimplement some ML models from Jax to Lux.jl. I have three concerns: I noticed there aren’t constructs like vmap. My existing Jax code has quite a few vmap cal…

---

## [String optimisation in Julia](https://discourse.julialang.org/t/string-optimisation-in-julia/119301)

<div class="topic-metadata">

**Author:** [@sivakon](https://discourse.julialang.org/u/sivakon)\
**Replies:** 21\
**Last updated:** [September 21, 2024, 2:42pm UTC](https://discourse.julialang.org/t/string-optimisation-in-julia/119301 "2024-09-21T14:42:29Z")

</div>

Came across this benchmark that tries to create large string and save to file. The difference between Julia and Java is very high. (I’m assuming Java version the string is being saved and reused without allocating?). …

---

## [Spark.jl and Kafka](https://discourse.julialang.org/t/spark-jl-and-kafka/119677)

<div class="topic-metadata">

**Author:** [@Jose\_Ghislain\_Quenum](https://discourse.julialang.org/u/Jose_Ghislain_Quenum)\
**Replies:** 0\
**Last updated:** [September 21, 2024, 2:08pm UTC](https://discourse.julialang.org/t/spark-jl-and-kafka/119677 "2024-09-21T14:08:59Z")

</div>

How can I get spark.jl to read a stream from Kafka?

---

## [Why does the speed of Julia in AOT compilation differ from UX4?](https://discourse.julialang.org/t/why-does-the-speed-of-julia-in-aot-compilation-differ-from-ux4/119657)

<div class="topic-metadata">

**Author:** [@aaoo](https://discourse.julialang.org/u/aaoo)\
**Replies:** 12\
**Last updated:** [September 21, 2024, 3:14am UTC](https://discourse.julialang.org/t/why-does-the-speed-of-julia-in-aot-compilation-differ-from-ux4/119657 "2024-09-21T03:14:26Z")

</div>

As the following picture shows, there are two different Julia versions in the speed comparison. The AOT compiled version reaches speeds as fast as Fortran, etc. However, the other version is slower and closer to Python. …

---

## [Logical "and", &&, and mapreduce](https://discourse.julialang.org/t/logical-and-and-mapreduce/119659)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 8\
**Last updated:** [September 21, 2024, 8:23am UTC](https://discourse.julialang.org/t/logical-and-and-mapreduce/119659 "2024-09-21T08:23:07Z")

</div>

I wonder if a function like and(x::Bool, y::Bool) = x && y would be useful. You can currently do mapreduce(f, &, x, y), where f takes two arguments and returns Bool. But and always returns Bool (only has this one meth…

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

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