# General Usage

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

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

**Page:** 151

---

## [Project-specific startup.jl file](https://discourse.julialang.org/t/project-specific-startup-jl-file/116933)

<div class="topic-metadata">

**Author:** [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Replies:** 10\
**Last updated:** [July 12, 2024, 9:56am UTC](https://discourse.julialang.org/t/project-specific-startup-jl-file/116933 "2024-07-12T09:56:34Z")

</div>

I have many script-style small projects that I frequently need to switch between. Currently, I’m using the following two-step process to “launch” a project: \> julia --project=path/to/project julia\> includet("path/to/pro…

---

## [Question about environment](https://discourse.julialang.org/t/question-about-environment/116129)

<div class="topic-metadata">

**Author:** [@lionisxn](https://discourse.julialang.org/u/lionisxn)\
**Replies:** 17\
**Last updated:** [July 12, 2024, 8:31am UTC](https://discourse.julialang.org/t/question-about-environment/116129 "2024-07-12T08:31:12Z")

</div>

Recently，I am subject to a problem like this: I have a package “MyPackage” depending on the “CBLS.jl” which in turn depends on JuMP@v0.21.5, but I also need “MyPackage” to depend on JuMP@v1.22.2. When I upgraded all the…

---

## [How to skip precompilation on \`using\`/\`import\` (for any given package)?](https://discourse.julialang.org/t/how-to-skip-precompilation-on-using-import-for-any-given-package/116917)

<div class="topic-metadata">

**Author:** [@Abhro](https://discourse.julialang.org/u/Abhro)\
**Replies:** 1\
**Last updated:** [July 12, 2024, 7:11am UTC](https://discourse.julialang.org/t/how-to-skip-precompilation-on-using-import-for-any-given-package/116917 "2024-07-12T07:11:39Z")

</div>

I have a startup.jl file with using Revise using OhMyREPL redirect\_stderr(devnull) do @eval using AbbreviatedStackTraces end Since AbbreviatedStackTraces.jl doesn’t support precompilation, I silenced the warnings w…

---

## [Missing coverage files for src files](https://discourse.julialang.org/t/missing-coverage-files-for-src-files/116934)

<div class="topic-metadata">

**Author:** [@Louis2099](https://discourse.julialang.org/u/Louis2099)\
**Replies:** 0\
**Last updated:** [July 12, 2024, 3:10am UTC](https://discourse.julialang.org/t/missing-coverage-files-for-src-files/116934 "2024-07-12T03:10:25Z")

</div>

I’m trying to do code coverage analysis for my new package, and I run the runtests.jl in following ways: julia --code-coverage test/runtests.jl this only generated .cov files for the code in test/ but no coverage data …

---

## [Passing a format string as a function argument](https://discourse.julialang.org/t/passing-a-format-string-as-a-function-argument/116929)

<div class="topic-metadata">

**Author:** [@brombo](https://discourse.julialang.org/u/brombo)\
**Replies:** 2\
**Last updated:** [July 11, 2024, 11:44pm UTC](https://discourse.julialang.org/t/passing-a-format-string-as-a-function-argument/116929 "2024-07-11T23:44:41Z")

</div>

I am trying to pass a format string as a function argument in the following code - using Printf fmt = "%.0e" function latex\_exp\_note(flt,fmt) s = @sprintf(fmt,flt) b,e = split(s,"e") e = replace(e,"+"=\>"")…

---

## [How to convert a Dict to a Struct](https://discourse.julialang.org/t/how-to-convert-a-dict-to-a-struct/116916)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [July 11, 2024, 9:21pm UTC](https://discourse.julialang.org/t/how-to-convert-a-dict-to-a-struct/116916 "2024-07-11T21:21:09Z")

</div>

How can I convert a dict to a struct? I have the following code: set\_dict=Dict{String, Any}("log\_level" =\> 1.0, "area" =\> 20.0, "solver" =\> "IDA") mutable struct Settings log\_level::Int64 area::Float64 sol…

---

## [Is it possilbe to call a .dll compiled via julia itself?](https://discourse.julialang.org/t/is-it-possilbe-to-call-a-dll-compiled-via-julia-itself/116710)

<div class="topic-metadata">

**Author:** [@lionisxn](https://discourse.julialang.org/u/lionisxn)\
**Replies:** 8\
**Last updated:** [July 11, 2024, 8:32pm UTC](https://discourse.julialang.org/t/is-it-possilbe-to-call-a-dll-compiled-via-julia-itself/116710 "2024-07-11T20:32:14Z")

</div>

For instance, some code files need to be communicated with cooperators, but with critical information concealed. All the files could be compiled as .dll (in windows), so the question is whether it is possible to call a .…

---

## [Plots and LaTeXStrings not recognizing some LaTeX commands](https://discourse.julialang.org/t/plots-and-latexstrings-not-recognizing-some-latex-commands/116922)

<div class="topic-metadata">

**Author:** [@brombo](https://discourse.julialang.org/u/brombo)\
**Replies:** 4\
**Last updated:** [July 11, 2024, 8:19pm UTC](https://discourse.julialang.org/t/plots-and-latexstrings-not-recognizing-some-latex-commands/116922 "2024-07-11T20:19:24Z")

</div>

I am using Julia with Plots and LaTeXStrings to plot data. Here is an example The problem is that when I label the y-axis it works if the label string is - $| H |$ dB which is shown in the plot but if I use the st…

---

## [Passing a dict from Python to Julia](https://discourse.julialang.org/t/passing-a-dict-from-python-to-julia/116914)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [July 11, 2024, 5:38pm UTC](https://discourse.julialang.org/t/passing-a-dict-from-python-to-julia/116914 "2024-07-11T17:38:01Z")

</div>

How can I pass a Python dict to Julia using PythonCall? This is not working: from juliacall import Main as jl, convert as jlconvert setdict = { "log\_level": 1, "area": 20.0, "solver": "IDA" } jlstore = jl.seval…

---

## [Does float16 run natively on a compatible CPU?](https://discourse.julialang.org/t/does-float16-run-natively-on-a-compatible-cpu/116832)

<div class="topic-metadata">

**Author:** [@pxshen](https://discourse.julialang.org/u/pxshen)\
**Replies:** 14\
**Last updated:** [July 11, 2024, 5:35pm UTC](https://discourse.julialang.org/t/does-float16-run-natively-on-a-compatible-cpu/116832 "2024-07-11T17:35:28Z")

</div>

Julia docs says f16 is implemented in software (presumably since most CPUs don’t support it). What about newer Xeons (IS AVX512) that accept f16?

---

## [Increased allocations when using threads](https://discourse.julialang.org/t/increased-allocations-when-using-threads/116902)

<div class="topic-metadata">

**Author:** [@throwaway](https://discourse.julialang.org/u/throwaway)\
**Replies:** 20\
**Last updated:** [July 11, 2024, 4:59pm UTC](https://discourse.julialang.org/t/increased-allocations-when-using-threads/116902 "2024-07-11T16:59:50Z")

</div>

Hello everyone, While playing with Base multithreading I noticed the following odd behaviour (MRE follows): # Single-threaded code always results in exactly one allocation julia\> a = 0.0; @allocations a+=π 1 # Reproduc…

---

## [Help reducing compilation and inference time](https://discourse.julialang.org/t/help-reducing-compilation-and-inference-time/116630)

<div class="topic-metadata">

**Author:** [@osimonn](https://discourse.julialang.org/u/osimonn)\
**Replies:** 71\
**Last updated:** [July 11, 2024, 1:53pm UTC](https://discourse.julialang.org/t/help-reducing-compilation-and-inference-time/116630 "2024-07-11T13:53:27Z")

</div>

We have a simulator in our company that’s fully written in Julia. The codebase is quite large. We have been suffering from very high latency for some time now. I took the initiative of trying to solve the latency issue b…

---

## [Threaded double loop](https://discourse.julialang.org/t/threaded-double-loop/116144)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 10\
**Last updated:** [July 11, 2024, 1:15pm UTC](https://discourse.julialang.org/t/threaded-double-loop/116144 "2024-07-11T13:15:14Z")

</div>

I am trying to write threaded code for the following calculation: given an opaque object x, and indices i, calculate y\_i = g(x, i), given each y\_i and indices j, calculate {z\_i}\_j = h(x, y\_i, j), reduce all the z…

---

## [Yggdrasil build has a bug on Windows](https://discourse.julialang.org/t/yggdrasil-build-has-a-bug-on-windows/116907)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 0\
**Last updated:** [July 11, 2024, 12:43pm UTC](https://discourse.julialang.org/t/yggdrasil-build-has-a-bug-on-windows/116907 "2024-07-11T12:43:42Z")

</div>

Hi, Maybe not the best place to ask/report this but don’t know a better one. In Yggdrasil the compilation of GMT on Windows is bugged. The simple function returns false when it should true true, and this only happen…

---

## [How to redirect stdout to an open terminal window?](https://discourse.julialang.org/t/how-to-redirect-stdout-to-an-open-terminal-window/15465)

<div class="topic-metadata">

**Author:** [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Replies:** 1\
**Last updated:** [July 11, 2024, 12:54pm UTC](https://discourse.julialang.org/t/how-to-redirect-stdout-to-an-open-terminal-window/15465 "2024-07-11T12:54:18Z")

</div>

I am having trouble with the function redirect\_stdout. I would like to do the following on my mac Open up a terminal window with julia Open up a second terminal and run tty to get a file name I can pipe results to Use …

---

## [SharedArray using DataFrames()](https://discourse.julialang.org/t/sharedarray-using-dataframes/116908)

<div class="topic-metadata">

**Author:** [@Gast](https://discourse.julialang.org/u/Gast)\
**Replies:** 0\
**Last updated:** [July 11, 2024, 12:54pm UTC](https://discourse.julialang.org/t/sharedarray-using-dataframes/116908 "2024-07-11T12:54:07Z")

</div>

Hi all I use the DataFrame.jl package to define and manipulate arrays across several nested functions. I plan to parallelize some of the tasks (e.g., for loops with data allocations) by using the Distributed.jl package…

---

## [(Re-)exporting from extension](https://discourse.julialang.org/t/re-exporting-from-extension/104139)

<div class="topic-metadata">

**Author:** [@manuelbb-upb](https://discourse.julialang.org/u/manuelbb-upb)\
**Replies:** 3\
**Last updated:** [July 11, 2024, 11:24am UTC](https://discourse.julialang.org/t/re-exporting-from-extension/104139 "2024-07-11T11:24:13Z")

</div>

Hi everyone, is it possible to re-export names defined in a package extension from within the main package itself? For example, the hypothetical main package “Optimizer” defines an optimization structure allowing for g…

---

## [Julia development on Qualcomm Snapdragon for Windows](https://discourse.julialang.org/t/julia-development-on-qualcomm-snapdragon-for-windows/116852)

<div class="topic-metadata">

**Author:** [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Replies:** 2\
**Last updated:** [July 11, 2024, 3:59am UTC](https://discourse.julialang.org/t/julia-development-on-qualcomm-snapdragon-for-windows/116852 "2024-07-11T03:59:05Z")

</div>

As many of you may know, Microsoft recently started selling Surface Pro 11 and Surface Laptop 7 with Qualcomm’s Snapdragon chips as well as other companies such as Dell, etc. Currently, the Julia system is supported for …

---

## [Enzyme "Attempting to call an indirect active function whose runtime value is inactive" in Forward Over Reverse Mode](https://discourse.julialang.org/t/enzyme-attempting-to-call-an-indirect-active-function-whose-runtime-value-is-inactive-in-forward-over-reverse-mode/116841)

<div class="topic-metadata">

**Author:** [@dleather](https://discourse.julialang.org/u/dleather)\
**Replies:** 7\
**Last updated:** [July 10, 2024, 9:34pm UTC](https://discourse.julialang.org/t/enzyme-attempting-to-call-an-indirect-active-function-whose-runtime-value-is-inactive-in-forward-over-reverse-mode/116841 "2024-07-10T21:34:36Z")

</div>

I’m attempting to apply forward over reverse mode following the Enzyme.jl tutorial. The function, f:\\mathbb{R}^N \\rightarrow \\mathbb{R^{++}}, is complicated but doesn’t involve any terms more difficult than hyperbolic fu…

---

## [Indexing array with a matrix and scalar](https://discourse.julialang.org/t/indexing-array-with-a-matrix-and-scalar/116848)

<div class="topic-metadata">

**Author:** [@baptnz](https://discourse.julialang.org/u/baptnz)\
**Replies:** 9\
**Last updated:** [July 10, 2024, 7:33pm UTC](https://discourse.julialang.org/t/indexing-array-with-a-matrix-and-scalar/116848 "2024-07-10T19:33:45Z")

</div>

A bit rusty after a while away from julia… How would I fill a 3D array with N values at positions given as follows: 1st index given as a scalar (from a for loop) the other two indices are provided as vectors I’m u…

---

## [Repeated compilation for same function with extreme type instability](https://discourse.julialang.org/t/repeated-compilation-for-same-function-with-extreme-type-instability/114244)

<div class="topic-metadata">

**Author:** [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)\
**Replies:** 11\
**Last updated:** [July 10, 2024, 6:34pm UTC](https://discourse.julialang.org/t/repeated-compilation-for-same-function-with-extreme-type-instability/114244 "2024-07-10T18:34:03Z")

</div>

Here is a minimal reproducible example: Repeated compilation for same function with extreme type instability - #5 by guoyongzhi My function consistently experiences prolonged compilation times with each execution. Howe…

---

## [Creating an Alias for a Struct Field](https://discourse.julialang.org/t/creating-an-alias-for-a-struct-field/116873)

<div class="topic-metadata">

**Author:** [@Maddy](https://discourse.julialang.org/u/Maddy)\
**Replies:** 8\
**Last updated:** [July 10, 2024, 6:05pm UTC](https://discourse.julialang.org/t/creating-an-alias-for-a-struct-field/116873 "2024-07-10T18:05:03Z")

</div>

I am trying to create a Particle Struct. I was wondering if there is a way to have particle.pos reference particle.position as an alias Is there any way to have such a behaviour? I might set pos as another field but th…

---

## [Scalar Indexing Error in PINN Implementation on GPU](https://discourse.julialang.org/t/scalar-indexing-error-in-pinn-implementation-on-gpu/116715)

<div class="topic-metadata">

**Author:** [@Maysam\_Gholampour](https://discourse.julialang.org/u/Maysam_Gholampour)\
**Replies:** 3\
**Last updated:** [July 10, 2024, 12:50am UTC](https://discourse.julialang.org/t/scalar-indexing-error-in-pinn-implementation-on-gpu/116715 "2024-07-10T00:50:32Z")

</div>

Dear All, I am attempting to run the following Physics-Informed Neural Network (PINN) problem on a GPU. However, I encounter an error related to scalar indexing. Despite my efforts to debug this issue and explore potent…

---

## [When and how to close Github issues?](https://discourse.julialang.org/t/when-and-how-to-close-github-issues/116766)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 36\
**Last updated:** [July 9, 2024, 9:18pm UTC](https://discourse.julialang.org/t/when-and-how-to-close-github-issues/116766 "2024-07-09T21:18:46Z")

</div>

What is the best practice when closing Github issues? From my point of view, after a fix is merged the original reporter of the issue should confirm (re-test) that the issue is fixed before closing the issue. But de-fa…

---

## [Defining types of Structs attributes can sometimes be negatively impacting performance?](https://discourse.julialang.org/t/defining-types-of-structs-attributes-can-sometimes-be-negatively-impacting-performance/116823)

<div class="topic-metadata">

**Author:** [@Maddy](https://discourse.julialang.org/u/Maddy)\
**Replies:** 8\
**Last updated:** [July 9, 2024, 4:54pm UTC](https://discourse.julialang.org/t/defining-types-of-structs-attributes-can-sometimes-be-negatively-impacting-performance/116823 "2024-07-09T16:54:31Z")

</div>

mutable struct Type4 c a b function Type4(x=1,y=1,z=1) new(x,y,z) end end mutable struct Type5 a b c function Type5(x::Int64=1, y::Int64=1, z::Int64=1) new(x,y,z) …

---

## [Problem with Multiple shooting](https://discourse.julialang.org/t/problem-with-multiple-shooting/116829)

<div class="topic-metadata">

**Author:** [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Replies:** 1\
**Last updated:** [July 9, 2024, 3:46pm UTC](https://discourse.julialang.org/t/problem-with-multiple-shooting/116829 "2024-07-09T15:46:34Z")

</div>

I am trying to estimate the parameters of a ODE model using a frequentist approach. While the simple L2Loss approach it works after when I run a more complicated one it does not. It gives me the following error: ERROR:…

---

## [Problem with creating view of vectors in vector of vectors (it keeps allocating)](https://discourse.julialang.org/t/problem-with-creating-view-of-vectors-in-vector-of-vectors-it-keeps-allocating/116825)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 2\
**Last updated:** [July 9, 2024, 3:20pm UTC](https://discourse.julialang.org/t/problem-with-creating-view-of-vectors-in-vector-of-vectors-it-keeps-allocating/116825 "2024-07-09T15:20:58Z")

</div>

I have a problem where Julai keeps allocating, causing something I think should be fast to be slow. Simple example: vec\_vec = \[1:100 for i in 1:100\] @time vals = \[vec for vec in vec\_vec\] # Fast, few allocations @time va…

---

## [Help understanding JET.jl output](https://discourse.julialang.org/t/help-understanding-jet-jl-output/116788)

<div class="topic-metadata">

**Author:** [@james3](https://discourse.julialang.org/u/james3)\
**Replies:** 1\
**Last updated:** [July 9, 2024, 2:47pm UTC](https://discourse.julialang.org/t/help-understanding-jet-jl-output/116788 "2024-07-09T14:47:57Z")

</div>

I’m using JET.jl with my code. It is giving me an error with a function, but I don’t really understand why. For a vector x (e.g. x = -.3 .+ rand(10)), I have a simple one-liner, vmapreduce(abs, max, x), which calculates …

---

## [Inconsistent pool and invpool PooledArrays](https://discourse.julialang.org/t/inconsistent-pool-and-invpool-pooledarrays/116828)

<div class="topic-metadata">

**Author:** [@SamTheGeneticCoder](https://discourse.julialang.org/u/SamTheGeneticCoder)\
**Replies:** 0\
**Last updated:** [July 9, 2024, 1:58pm UTC](https://discourse.julialang.org/t/inconsistent-pool-and-invpool-pooledarrays/116828 "2024-07-09T13:58:16Z")

</div>

Hi there! Could someone help me understand the “inconsistent pool and invpool” error in PooledArrays.jl? Thanks in advance!

---

## [Using a Custom Length Vector type to define function Parameters](https://discourse.julialang.org/t/using-a-custom-length-vector-type-to-define-function-parameters/116809)

<div class="topic-metadata">

**Author:** [@Maddy](https://discourse.julialang.org/u/Maddy)\
**Replies:** 20\
**Last updated:** [July 9, 2024, 1:57pm UTC](https://discourse.julialang.org/t/using-a-custom-length-vector-type-to-define-function-parameters/116809 "2024-07-09T13:57:55Z")

</div>

I want to dispatch 2 different functions for f(vect::VectorLength2) and f(vect::VectorLength3) Basically, is there any way to have a type that has this behaviour: typeof(\[1,2\]) \<: VectorLength2 \> true typeof(\[1,2,3\]…

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

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