# General Usage

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

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

**Page:** 95

---

## [Segfault calling into Julia from C/MPI](https://discourse.julialang.org/t/segfault-calling-into-julia-from-c-mpi/124800)

<div class="topic-metadata">

**Author:** [@liamh](https://discourse.julialang.org/u/liamh)\
**Replies:** 1\
**Last updated:** [January 16, 2025, 3:12pm UTC](https://discourse.julialang.org/t/segfault-calling-into-julia-from-c-mpi/124800 "2025-01-16T15:12:14Z")

</div>

I have written a Julia package and compiled a shared object library to call one @ccallable function. When I test it with a serial C program, it works fine. When I call it from a more complex program using MPI (even when …

---

## [Multivariate Taylor Series Problem](https://discourse.julialang.org/t/multivariate-taylor-series-problem/124807)

<div class="topic-metadata">

**Author:** [@usaer](https://discourse.julialang.org/u/usaer)\
**Replies:** 2\
**Last updated:** [January 16, 2025, 8:50am UTC](https://discourse.julialang.org/t/multivariate-taylor-series-problem/124807 "2025-01-16T08:50:02Z")

</div>

Hi, I was using the package TaylorSeries to find out taylor approximation of a simple multivariate function f(x,y)=x^2+y^2. For the simple approximation around point (0,0) this works fine. However, if i want to expand a…

---

## [Parallel Assembly of Matrices in FEM](https://discourse.julialang.org/t/parallel-assembly-of-matrices-in-fem/124561)

<div class="topic-metadata">

**Author:** [@priyanshuFSI](https://discourse.julialang.org/u/priyanshuFSI)\
**Replies:** 8\
**Last updated:** [January 16, 2025, 4:46am UTC](https://discourse.julialang.org/t/parallel-assembly-of-matrices-in-fem/124561 "2025-01-16T04:46:58Z")

</div>

Hi. I am writing a CFD solver using Finite Element Methods. I encounter issues in assembling the sparse matrices( specially in regards with the performance). I construct a sparse matrix in CSC form. This function works f…

---

## [Seeking clarification on Ptr vs Ref in ccall](https://discourse.julialang.org/t/seeking-clarification-on-ptr-vs-ref-in-ccall/96883)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 11\
**Last updated:** [January 16, 2025, 12:42am UTC](https://discourse.julialang.org/t/seeking-clarification-on-ptr-vs-ref-in-ccall/96883 "2025-01-16T00:42:39Z")

</div>

Suppose I have a C code int sum(int \*a, int n){ int s = 0; for(int i=0; i\<n; i++){ s += a\[i\]; } return s; } and I can call this from Julia as julia\> ccall((:sum, "./libsum.so"), Cint, (Ref{Cint},Cint), Cint\[1,2,…

---

## [Why must the second argument of \`hash\` come from another hash function?](https://discourse.julialang.org/t/why-must-the-second-argument-of-hash-come-from-another-hash-function/124783)

<div class="topic-metadata">

**Author:** [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Replies:** 5\
**Last updated:** [January 15, 2025, 9:34pm UTC](https://discourse.julialang.org/t/why-must-the-second-argument-of-hash-come-from-another-hash-function/124783 "2025-01-15T21:34:35Z")

</div>

The documentation for hash contains an example that has the following comment: # only use the output of another hash function as the second argument What happens if I just provide any UInt64 value as the second argumen…

---

## [Debugger - Treat specific functions as compiled in package](https://discourse.julialang.org/t/debugger-treat-specific-functions-as-compiled-in-package/124802)

<div class="topic-metadata">

**Author:** [@p\_f](https://discourse.julialang.org/u/p_f)\
**Replies:** 0\
**Last updated:** [January 15, 2025, 5:48pm UTC](https://discourse.julialang.org/t/debugger-treat-specific-functions-as-compiled-in-package/124802 "2025-01-15T17:48:02Z")

</div>

Motivated by Extremely slow debugging in VS Code, I have become invested in understanding the VSCode debugger. Is it possible to effectively treat particular functions in my package as compiled? For example, consider …

---

## [Julia hanging after producing only a few plots](https://discourse.julialang.org/t/julia-hanging-after-producing-only-a-few-plots/124808)

<div class="topic-metadata">

**Author:** [@gtk](https://discourse.julialang.org/u/gtk)\
**Replies:** 0\
**Last updated:** [January 15, 2025, 7:06pm UTC](https://discourse.julialang.org/t/julia-hanging-after-producing-only-a-few-plots/124808 "2025-01-15T19:06:16Z")

</div>

Hi! I am currently using VSCode to edit files in a repository through remote development on WSL2. Opening Julia and starting a new REPL is no problem, but after a while I get the following showing up in the REPL: I h…

---

## [Core dumped error when differentiating wrt NN parameters using Enzyme](https://discourse.julialang.org/t/core-dumped-error-when-differentiating-wrt-nn-parameters-using-enzyme/124471)

<div class="topic-metadata">

**Author:** [@dameka](https://discourse.julialang.org/u/dameka)\
**Replies:** 3\
**Last updated:** [January 15, 2025, 5:13pm UTC](https://discourse.julialang.org/t/core-dumped-error-when-differentiating-wrt-nn-parameters-using-enzyme/124471 "2025-01-15T17:13:02Z")

</div>

I’m differentiating a quantity with respect to the parameters of a neural network. I’m getting a “core dumped” error, which is away above my Julia pay grade. The neural network passes through several functions on the wa…

---

## [Error using Enzyme to autodiff wrt Flux neural net parameters](https://discourse.julialang.org/t/error-using-enzyme-to-autodiff-wrt-flux-neural-net-parameters/123934)

<div class="topic-metadata">

**Author:** [@dameka](https://discourse.julialang.org/u/dameka)\
**Replies:** 10\
**Last updated:** [January 15, 2025, 5:11pm UTC](https://discourse.julialang.org/t/error-using-enzyme-to-autodiff-wrt-flux-neural-net-parameters/123934 "2025-01-15T17:11:15Z")

</div>

I’m trying to use Enzyme to autodiff a function with respect to a neural network’s parameters. I’m running into this error: No augmented forward pass found for jl\_genericmemory\_slice at context: %93 = call nonnull "e…

---

## [Warning during tests](https://discourse.julialang.org/t/warning-during-tests/124796)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [January 15, 2025, 5:04pm UTC](https://discourse.julialang.org/t/warning-during-tests/124796 "2025-01-15T17:04:18Z")

</div>

When I run the tests of KiteModels.jl I get the warning: ┌ Warning: Using a \`Bool\` for keyword argument \`autodiff\` is deprecated. Please use an \`ADType\` specifier. │ caller = \_process\_AD\_choice(ad\_alg::Bool, chunksize…

---

## [\`prod\` over empty collection with known eltype gives "reducing over empty collection ..."](https://discourse.julialang.org/t/prod-over-empty-collection-with-known-eltype-gives-reducing-over-empty-collection/124790)

<div class="topic-metadata">

**Author:** [@jlbosse](https://discourse.julialang.org/u/jlbosse)\
**Replies:** 5\
**Last updated:** [January 15, 2025, 4:29pm UTC](https://discourse.julialang.org/t/prod-over-empty-collection-with-known-eltype-gives-reducing-over-empty-collection/124790 "2025-01-15T16:29:33Z")

</div>

I have the following code which I expected to return 1., but instead get “reducing over empty collection is not allowed error”: julia\> f(xs) = prod(a for (a, b) in xs) julia\> f(Tuple{Float64, Float64}\[\]) ERROR: Argumen…

---

## [How slow is runtime dispatch, anyway? Benchmark attempts](https://discourse.julialang.org/t/how-slow-is-runtime-dispatch-anyway-benchmark-attempts/124751)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 8\
**Last updated:** [January 15, 2025, 1:19am UTC](https://discourse.julialang.org/t/how-slow-is-runtime-dispatch-anyway-benchmark-attempts/124751 "2025-01-15T01:19:09Z")

</div>

It’s not actually easy to separate the timing of the runtime dispatches from the surrounding code, and I wasn’t much convinced by the few benchmarks people have tried, even if just counting the ones did control the numbe…

---

## [Help with reducing allocations when indexing into custom Array](https://discourse.julialang.org/t/help-with-reducing-allocations-when-indexing-into-custom-array/124732)

<div class="topic-metadata">

**Author:** [@thomasc791](https://discourse.julialang.org/u/thomasc791)\
**Replies:** 10\
**Last updated:** [January 14, 2025, 10:21pm UTC](https://discourse.julialang.org/t/help-with-reducing-allocations-when-indexing-into-custom-array/124732 "2025-01-14T22:21:09Z")

</div>

Hi everyone, I am quite new to the language, and was wondering if people could help me optimising my piece of code. The idea for this array type is to reduce the total Base.summarysize for a vector of vector as much as …

---

## [Base.Fix2 can be constructed using broadcasting syntax but does not retain broadcasting functionality](https://discourse.julialang.org/t/base-fix2-can-be-constructed-using-broadcasting-syntax-but-does-not-retain-broadcasting-functionality/124770)

<div class="topic-metadata">

**Author:** [@croberts](https://discourse.julialang.org/u/croberts)\
**Replies:** 7\
**Last updated:** [January 14, 2025, 6:03pm UTC](https://discourse.julialang.org/t/base-fix2-can-be-constructed-using-broadcasting-syntax-but-does-not-retain-broadcasting-functionality/124770 "2025-01-14T18:03:46Z")

</div>

Example: a = \[1,2,3\] (\>=(2)).(a) # works as intended .\>=(2) # can be constructed .\>=(2).f # fields do not retain information that function should be broadcasted (.\>=(2))(a) # breaks (x -\> x .\>= 2)(a) # intended beh…

---

## [Parsing corporate DateTime format with calendar week](https://discourse.julialang.org/t/parsing-corporate-datetime-format-with-calendar-week/124725)

<div class="topic-metadata">

**Author:** [@dobby](https://discourse.julialang.org/u/dobby)\
**Replies:** 5\
**Last updated:** [January 14, 2025, 5:45pm UTC](https://discourse.julialang.org/t/parsing-corporate-datetime-format-with-calendar-week/124725 "2025-01-14T17:45:40Z")

</div>

Hi all, I have date time data in the following format: 2434.5 14:20 Which is for: year 2024, 34th week of the year (August), 5th day of the week (Friday), 14:20 o’clock. I am struggeling to parse the calendar week an…

---

## [How can we save & extract Derivatives from the Solver in Julia?](https://discourse.julialang.org/t/how-can-we-save-extract-derivatives-from-the-solver-in-julia/124667)

<div class="topic-metadata">

**Author:** [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Replies:** 3\
**Last updated:** [January 14, 2025, 5:19pm UTC](https://discourse.julialang.org/t/how-can-we-save-extract-derivatives-from-the-solver-in-julia/124667 "2025-01-14T17:19:29Z")

</div>

Hello everybody and happy new year to all of you, I’m solving a PDE system using MethodeOfLines tool of Julia. The documentation guided me quite well. benefiting from ChrisRackauckas advise to speed up the non linearit…

---

## [Exploring Efficient not in Operations in Julia: Benchmarking Different Methods](https://discourse.julialang.org/t/exploring-efficient-not-in-operations-in-julia-benchmarking-different-methods/124729)

<div class="topic-metadata">

**Author:** [@0nyr](https://discourse.julialang.org/u/0nyr)\
**Replies:** 10\
**Last updated:** [January 14, 2025, 3:43pm UTC](https://discourse.julialang.org/t/exploring-efficient-not-in-operations-in-julia-benchmarking-different-methods/124729 "2025-01-14T15:43:04Z")

</div>

So, it turns out there are a number of ways to write code in Julia that checks if a scalar is or is not within a vector. See benchmark repo. Exploring Efficient not in Operations in Julia Introduction Julia provides mu…

---

## [Recursive closures/inner functions -- how to avoid boxing?](https://discourse.julialang.org/t/recursive-closures-inner-functions-how-to-avoid-boxing/124758)

<div class="topic-metadata">

**Author:** [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Replies:** 6\
**Last updated:** [January 14, 2025, 1:40pm UTC](https://discourse.julialang.org/t/recursive-closures-inner-functions-how-to-avoid-boxing/124758 "2025-01-14T13:40:28Z")

</div>

Consider code like julia\> function outer() function inner() false && inner() end inner end julia\> typeof(outer()).types svec(Core.Box) So this kind of code creates a box for the loca…

---

## [Trying to debug ReadOnlyMemoryError()](https://discourse.julialang.org/t/trying-to-debug-readonlymemoryerror/124763)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [January 14, 2025, 2:55pm UTC](https://discourse.julialang.org/t/trying-to-debug-readonlymemoryerror/124763 "2025-01-14T14:55:47Z")

</div>

When precompiling the main branch of KiteModels.jl I get: julia\> integrator = KiteModels.init\_sim!(kps4\_; delta=0.03, stiffness\_factor=0.05, prn=false) ERROR: ReadOnlyMemoryError() Stacktrace: \[1\] \_evaluate(t::Vector…

---

## [GLMakie 0.11.1 incompatible with DSP 0.8.0?](https://discourse.julialang.org/t/glmakie-0-11-1-incompatible-with-dsp-0-8-0/124761)

<div class="topic-metadata">

**Author:** [@tt1234567](https://discourse.julialang.org/u/tt1234567)\
**Replies:** 6\
**Last updated:** [January 14, 2025, 2:55pm UTC](https://discourse.julialang.org/t/glmakie-0-11-1-incompatible-with-dsp-0-8-0/124761 "2025-01-14T14:55:28Z")

</div>

The latest version of GLMakie (0.11.1) seems to cause DSP to downgrade from 0.8.0 to 0.7.10. I don’t know how to diagnose the precise cause. I’m using Julia 1.11.2 on Windows 11.

---

## [MOLFiniteDifference for 2D transient Heat equation with heat generation](https://discourse.julialang.org/t/molfinitedifference-for-2d-transient-heat-equation-with-heat-generation/124498)

<div class="topic-metadata">

**Author:** [@Reza\_AO](https://discourse.julialang.org/u/Reza_AO)\
**Replies:** 15\
**Last updated:** [January 14, 2025, 12:54pm UTC](https://discourse.julialang.org/t/molfinitedifference-for-2d-transient-heat-equation-with-heat-generation/124498 "2025-01-14T12:54:49Z")

</div>

Hi I am trying to solve the underlying system: eq = \[ρ\*Cₚ\*Dt(T(x,y,t)) ~ kₓ\*Dxx(T(x,y,t)) + ky\*Dyy(T(x,y,t)) + H\*W\*Re , Re ~ A\*exp(-E/(R\*T(x,y,t)))\*c(x,y,t)\] The Domain is : domains = \[x ∈ Interval(x\_min, 0.013…

---

## [Ask for advise : Multiple dispatch vs branching performance](https://discourse.julialang.org/t/ask-for-advise-multiple-dispatch-vs-branching-performance/124713)

<div class="topic-metadata">

**Author:** [@Maucejo](https://discourse.julialang.org/u/Maucejo)\
**Replies:** 7\
**Last updated:** [January 14, 2025, 6:26am UTC](https://discourse.julialang.org/t/ask-for-advise-multiple-dispatch-vs-branching-performance/124713 "2025-01-14T06:26:31Z")

</div>

Hi all, I am developing a package for generating structural vibration data, which I hope to release to the community once it is finished. In the course of development, I am faced with a dilemma between multiple dispatch…

---

## [Closure with let block: Simpler syntax for capturing variables?](https://discourse.julialang.org/t/closure-with-let-block-simpler-syntax-for-capturing-variables/124740)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 4\
**Last updated:** [January 14, 2025, 12:46am UTC](https://discourse.julialang.org/t/closure-with-let-block-simpler-syntax-for-capturing-variables/124740 "2025-01-14T00:46:40Z")

</div>

The example is taken from the post "A Tragedy of Julia’s Type System" - #30 by foobar\_lv2 function f() x = 0 if false x=1 end g = let x=x () -\> x end end This form is suggested in the manual, and inde…

---

## [Animation with Meshes.jl](https://discourse.julialang.org/t/animation-with-meshes-jl/124618)

<div class="topic-metadata">

**Author:** [@Mizu49](https://discourse.julialang.org/u/Mizu49)\
**Replies:** 7\
**Last updated:** [January 13, 2025, 8:44pm UTC](https://discourse.julialang.org/t/animation-with-meshes-jl/124618 "2025-01-13T20:44:52Z")

</div>

How can I animate the Box defined by Meshes.jl? I thought the following code might work. using GLMakie, Meshes, Rotations b = Meshes.Box((-1, -1, -1), (1, 1, 1)) obs\_b = Observable(b) fig = Figure(size = (800, 500…

---

## [Stop juliaup to notify new version of julia?](https://discourse.julialang.org/t/stop-juliaup-to-notify-new-version-of-julia/121079)

<div class="topic-metadata">

**Author:** [@Xing\_Shi\_Cai](https://discourse.julialang.org/u/Xing_Shi_Cai)\
**Replies:** 5\
**Last updated:** [January 13, 2025, 8:31pm UTC](https://discourse.julialang.org/t/stop-juliaup-to-notify-new-version-of-julia/121079 "2025-01-13T20:31:32Z")

</div>

I got this notification when I run julia today The latest version of Julia in the \`release\` channel is 1.11.0+0.x64.linux.gnu. You currently have \`1.10.5+0.x64.linux.gnu\` installed. Run: juliaup update in your termi…

---

## [Extremely high memory consumption on CPU](https://discourse.julialang.org/t/extremely-high-memory-consumption-on-cpu/124733)

<div class="topic-metadata">

**Author:** [@cirobr](https://discourse.julialang.org/u/cirobr)\
**Replies:** 2\
**Last updated:** [January 13, 2025, 6:20pm UTC](https://discourse.julialang.org/t/extremely-high-memory-consumption-on-cpu/124733 "2025-01-13T18:20:22Z")

</div>

Cheers. I have developed a model for semantic segmentation in Flux. It has around 7M parameters. Have checked its inference performance for segmenting two classes, when an array with size (512,512,3,1) is at the input. T…

---

## [ForwardDiff - MethodError: no method matching extract\_jacobian](https://discourse.julialang.org/t/forwarddiff-methoderror-no-method-matching-extract-jacobian/124724)

<div class="topic-metadata">

**Author:** [@Adrien\_Vet](https://discourse.julialang.org/u/Adrien_Vet)\
**Replies:** 3\
**Last updated:** [January 13, 2025, 6:18pm UTC](https://discourse.julialang.org/t/forwarddiff-methoderror-no-method-matching-extract-jacobian/124724 "2025-01-13T18:18:33Z")

</div>

Hello everyone, I’m struggling with the differentiation of some functions using the ForwardDiff package. Here is a reproducible example : using StaticArrays using ForwardDiff function f\_test(x) return exp(x\[1\])…

---

## [Passing a Julia struct to a already compiled cpp program](https://discourse.julialang.org/t/passing-a-julia-struct-to-a-already-compiled-cpp-program/124731)

<div class="topic-metadata">

**Author:** [@TheBreadFarmer](https://discourse.julialang.org/u/TheBreadFarmer)\
**Replies:** 1\
**Last updated:** [January 13, 2025, 6:01pm UTC](https://discourse.julialang.org/t/passing-a-julia-struct-to-a-already-compiled-cpp-program/124731 "2025-01-13T18:01:10Z")

</div>

I am writing a program in Julia that reads data from a file into memory. I’d like to take that data and somehow pass it to a c++ program which will make use of OpenGL to draw that data to the screen. I am making use of …

---

## [Different \[compat\] needs on windows vs mac/linux?](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384)

<div class="topic-metadata">

**Author:** [@Haro](https://discourse.julialang.org/u/Haro)\
**Replies:** 11\
**Last updated:** [January 13, 2025, 3:40pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384 "2025-01-13T15:40:42Z")

</div>

Hi all! Is there a way to specify different versions of the same package in \[compat\] based on the OS of the computer running the package? I’m working on a team to develop a package which has a custom plotting script in …

---

## [Why doesn’t Julia offer built-in privacy/encapsulation features?](https://discourse.julialang.org/t/why-doesn-t-julia-offer-built-in-privacy-encapsulation-features/124666)

<div class="topic-metadata">

**Author:** [@younes](https://discourse.julialang.org/u/younes)\
**Replies:** 12\
**Last updated:** [January 13, 2025, 3:15pm UTC](https://discourse.julialang.org/t/why-doesn-t-julia-offer-built-in-privacy-encapsulation-features/124666 "2025-01-13T15:15:00Z")

</div>

I would like to understand Julia’s rationale for not including a language-level privacy feature: a way to truly protect the internal state from outside access. I’m aware that we can use closures to emulate encapsulation…

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

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