# General Usage

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

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

**Page:** 286

---

## [Does Flux not support Float16 convolution operation (Flux.NNlib.conv) with CuArray?](https://discourse.julialang.org/t/does-flux-not-support-float16-convolution-operation-flux-nnlib-conv-with-cuarray/99640)

<div class="topic-metadata">

**Author:** [@guixien](https://discourse.julialang.org/u/guixien)\
**Replies:** 1\
**Last updated:** [May 31, 2023, 3:48am UTC](https://discourse.julialang.org/t/does-flux-not-support-float16-convolution-operation-flux-nnlib-conv-with-cuarray/99640 "2023-05-31T03:48:24Z")

</div>

using Flux, CUDA struct filters{T \<: Real} f::AbstractArray{T,3} function filters{T}(f) where T \<: Real new(f) end end Flux.@functor filters And this works: T = Float32 q = filters{T}(cu(rand(50, 1…

---

## [How to print ODEs after create ODEProblem](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 6\
**Last updated:** [May 31, 2023, 12:22am UTC](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627 "2023-05-31T00:22:20Z")

</div>

Hi everyone, I would like to ask how to print the equations of the system after creating a problem by function ODEProblem() following: sys = ODESystem(eqs) prob = ODEProblem(sys,u0,tspan) I tried to use the equatio…

---

## [Improvements for solving an ODE "piecewise"](https://discourse.julialang.org/t/improvements-for-solving-an-ode-piecewise/99626)

<div class="topic-metadata">

**Author:** [@dnldlg](https://discourse.julialang.org/u/dnldlg)\
**Replies:** 1\
**Last updated:** [May 30, 2023, 7:55pm UTC](https://discourse.julialang.org/t/improvements-for-solving-an-ode-piecewise/99626 "2023-05-30T19:55:19Z")

</div>

Consider the following problem: I have a linear ODE x' = M(t) x, but at some times t\_i during the integration interval I need to apply some operation on the current state, i.e x\_\\text{new}(t\_i) = A \\cdot x(t). A little …

---

## [Delete one non-empty directory](https://discourse.julialang.org/t/delete-one-non-empty-directory/99623)

<div class="topic-metadata">

**Author:** [@jianqixi](https://discourse.julialang.org/u/jianqixi)\
**Replies:** 2\
**Last updated:** [May 30, 2023, 6:31pm UTC](https://discourse.julialang.org/t/delete-one-non-empty-directory/99623 "2023-05-30T18:31:15Z")

</div>

How could we delete one non-empty directory using Julia. I have tried to use rm(“path”, force=true), but it doesn’t work. Any better way to do it. Thanks

---

## [Error saving ScikitLearn.jl pipeline](https://discourse.julialang.org/t/error-saving-scikitlearn-jl-pipeline/99614)

<div class="topic-metadata">

**Author:** [@klaus.68](https://discourse.julialang.org/u/klaus.68)\
**Replies:** 0\
**Last updated:** [May 30, 2023, 4:09pm UTC](https://discourse.julialang.org/t/error-saving-scikitlearn-jl-pipeline/99614 "2023-05-30T16:09:52Z")

</div>

Hi, I’m trying to save a ScikitLearn pipeline but JLD is encountering a fatal error. A MWE is below. My versions are ScikitLearn@v0.7.0, JLD@v0.10.0, PyCallJLD@v0.2.1. Pkg.status(outdated=true) returns that PyCallJLD is…

---

## [Could not import OrdinaryDiffEq.SavedValues into ControlSystems](https://discourse.julialang.org/t/could-not-import-ordinarydiffeq-savedvalues-into-controlsystems/99545)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 3\
**Last updated:** [May 30, 2023, 3:57pm UTC](https://discourse.julialang.org/t/could-not-import-ordinarydiffeq-savedvalues-into-controlsystems/99545 "2023-05-30T15:57:14Z")

</div>

What does this alert mean and how to resolve it? julia\> using ControlSystems \[ Info: Precompiling ControlSystems \[a6e380b2-a6ca-5380-bf3e-84a91bcd477e\] WARNING: could not import OrdinaryDiffEq.SavedValues into ControlSy…

---

## [Is there a reason for the LCHF approach to syntactic sugar?](https://discourse.julialang.org/t/is-there-a-reason-for-the-lchf-approach-to-syntactic-sugar/99607)

<div class="topic-metadata">

**Author:** [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Replies:** 2\
**Last updated:** [May 30, 2023, 2:20pm UTC](https://discourse.julialang.org/t/is-there-a-reason-for-the-lchf-approach-to-syntactic-sugar/99607 "2023-05-30T14:20:40Z")

</div>

Preamble/Disclaimer: This topic is about syntactic sugar that I find missing. I know that these tasks are not hard to accomplish in other ways. I often find that my assumptions about what functions extend to what types…

---

## [Static Analysis with Semgrep](https://discourse.julialang.org/t/static-analysis-with-semgrep/99251)

<div class="topic-metadata">

**Author:** [@avik](https://discourse.julialang.org/u/avik)\
**Replies:** 1\
**Last updated:** [May 30, 2023, 1:22pm UTC](https://discourse.julialang.org/t/static-analysis-with-semgrep/99251 "2023-05-30T13:22:18Z")

</div>

Hi, I’m very pleased announce that the Semgrep static analysis toolkit can now be used to analyse Julia code. Semgrep is a fast, open source, static analysis engine for finding bugs, detecting dependency vulnerabilities…

---

## [Overwriting previous terminal output with built-in functions](https://discourse.julialang.org/t/overwriting-previous-terminal-output-with-built-in-functions/99593)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 3\
**Last updated:** [May 30, 2023, 1:20pm UTC](https://discourse.julialang.org/t/overwriting-previous-terminal-output-with-built-in-functions/99593 "2023-05-30T13:20:22Z")

</div>

This is heavily related to How clear the printed content in terminal and print to the same line?, which provides some good answers. The linked thread has examples that I used to create the showcase function below: juli…

---

## [Flux: \`nothing\` gradients with custom layer](https://discourse.julialang.org/t/flux-nothing-gradients-with-custom-layer/99565)

<div class="topic-metadata">

**Author:** [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)\
**Replies:** 6\
**Last updated:** [May 30, 2023, 1:03pm UTC](https://discourse.julialang.org/t/flux-nothing-gradients-with-custom-layer/99565 "2023-05-30T13:03:02Z")

</div>

Hi all, I’m trying to define a custom Layer for Flux: struct CANCell topology::Symbol n::NTuple{D,Int} where {D} # number of neurons in each dimension d::Int # number of …

---

## [Unable install the Plots package in Julia 1.9.0](https://discourse.julialang.org/t/unable-install-the-plots-package-in-julia-1-9-0/99098)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 5\
**Last updated:** [May 30, 2023, 12:03pm UTC](https://discourse.julialang.org/t/unable-install-the-plots-package-in-julia-1-9-0/99098 "2023-05-30T12:03:13Z")

</div>

| | | | | | |/ \_\` | | | | |\_| | | | (\_| | | Version 1.9.0 (2023-05-07) \_/ |\\\_\_'\_|\_|\_|\\\_\_'\_| | Official https://julialang.org/ release |\_\_/ | (@v1.9) pkg\> st Status \`C:\\Users\\Hermesr\\.julia\\en…

---

## [enSight files with Julia](https://discourse.julialang.org/t/ensight-files-with-julia/99371)

<div class="topic-metadata">

**Author:** [@thomaskroi1996](https://discourse.julialang.org/u/thomaskroi1996)\
**Replies:** 3\
**Last updated:** [May 30, 2023, 11:57am UTC](https://discourse.julialang.org/t/ensight-files-with-julia/99371 "2023-05-30T11:57:43Z")

</div>

Hello! Does anyone have experience reading enSight files with Julia? If so, I was mainly wondering if there is any library that can be used for that, or whether one has to write everything! Thank you, Thomas

---

## [Package compiler and module global variable](https://discourse.julialang.org/t/package-compiler-and-module-global-variable/99585)

<div class="topic-metadata">

**Author:** [@xgdgsc](https://discourse.julialang.org/u/xgdgsc)\
**Replies:** 1\
**Last updated:** [May 30, 2023, 5:18am UTC](https://discourse.julialang.org/t/package-compiler-and-module-global-variable/99585 "2023-05-30T05:18:14Z")

</div>

module JModel mutable struct JStruct path::String # other fields end jstruct = JStruct("") Base.@ccallable function init\_model(conf\_path::Cstring)::Cint global jstruct jstruct = JStruct(unsafe\_string(conf\_…

---

## [Should I add type annotation to keyword arguments?](https://discourse.julialang.org/t/should-i-add-type-annotation-to-keyword-arguments/99231)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 10\
**Last updated:** [May 30, 2023, 1:32am UTC](https://discourse.julialang.org/t/should-i-add-type-annotation-to-keyword-arguments/99231 "2023-05-30T01:32:17Z")

</div>

Old versions of Julia’s performance tips https://docs.julialang.org/en/v1/manual/performance-tips advised annotating the types of keyword arguments, but this is no longer mentioned in the current version. Do I still ne…

---

## [How to calculate the statistics/ percentile in julia](https://discourse.julialang.org/t/how-to-calculate-the-statistics-percentile-in-julia/99580)

<div class="topic-metadata">

**Author:** [@RDuarte](https://discourse.julialang.org/u/RDuarte)\
**Replies:** 5\
**Last updated:** [May 29, 2023, 11:52pm UTC](https://discourse.julialang.org/t/how-to-calculate-the-statistics-percentile-in-julia/99580 "2023-05-29T23:52:48Z")

</div>

Hello, I’m new in Julia and I would like to do some statistics. How can I calculate a percentile of a matrix? I installed the using StatsBase package and I’m doing: percentile(mymatrix, 25), however I get an error

---

## [Is http\_listen blocking further call execution in my ccall program](https://discourse.julialang.org/t/is-http-listen-blocking-further-call-execution-in-my-ccall-program/99542)

<div class="topic-metadata">

**Author:** [@AbhimanyuAryan](https://discourse.julialang.org/u/AbhimanyuAryan)\
**Replies:** 2\
**Last updated:** [May 29, 2023, 8:46pm UTC](https://discourse.julialang.org/t/is-http-listen-blocking-further-call-execution-in-my-ccall-program/99542 "2023-05-29T20:46:12Z")

</div>

Given the C Code #include "http.h" void on\_request(http\_s \*request); FIOBJ HTTP\_HEADER\_X\_DATA; int main(void) { HTTP\_HEADER\_X\_DATA = fiobj\_str\_new("X-Data", 6); http\_listen("3000", NULL, .on\_request = on\_request,…

---

## [Threading race condition when pushing to arrays](https://discourse.julialang.org/t/threading-race-condition-when-pushing-to-arrays/99567)

<div class="topic-metadata">

**Author:** [@jagot](https://discourse.julialang.org/u/jagot)\
**Replies:** 6\
**Last updated:** [May 29, 2023, 5:07pm UTC](https://discourse.julialang.org/t/threading-race-condition-when-pushing-to-arrays/99567 "2023-05-29T17:07:47Z")

</div>

I’m trying to populate a sparse matrix in a multithreaded loop, along the lines of the below code: function build\_matrix(fun::Function, ::Type{T}, m, n) where T # Allocate thread-local arrays, which we will later co…

---

## [Help Requested: Understanding cause of allocations for dynamic dispatch returning \`nothing\`, which vary based on argument type](https://discourse.julialang.org/t/help-requested-understanding-cause-of-allocations-for-dynamic-dispatch-returning-nothing-which-vary-based-on-argument-type/99517)

<div class="topic-metadata">

**Author:** [@NHDaly](https://discourse.julialang.org/u/NHDaly)\
**Replies:** 6\
**Last updated:** [May 29, 2023, 3:23pm UTC](https://discourse.julialang.org/t/help-requested-understanding-cause-of-allocations-for-dynamic-dispatch-returning-nothing-which-vary-based-on-argument-type/99517 "2023-05-29T15:23:39Z")

</div>

Can someone help me understand why passing a Ptr{UInt} to this dynamic dispatch leads to allocations, whereas passing a Ref{UInt} does not? I have tried the Allocation Profiler, Cthulhu, and @code\_\*, and I can’t figure …

---

## [Do I have to add a \`global\` before the counting variable in the \`while\` loop?](https://discourse.julialang.org/t/do-i-have-to-add-a-global-before-the-counting-variable-in-the-while-loop/99549)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 8\
**Last updated:** [May 29, 2023, 3:15pm UTC](https://discourse.julialang.org/t/do-i-have-to-add-a-global-before-the-counting-variable-in-the-while-loop/99549 "2023-05-29T15:15:02Z")

</div>

i = 0 while i \<= 100 println(i) i += 1 end Write the above code in a julia script Test.jl and run it, in the REPL it reports the following error: ┌ Warning: Assignment to \`i\` in soft scope is ambiguous because …

---

## [Install testing 1.9.1 through juliaup?](https://discourse.julialang.org/t/install-testing-1-9-1-through-juliaup/99560)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 2\
**Last updated:** [May 29, 2023, 3:13pm UTC](https://discourse.julialang.org/t/install-testing-1-9-1-through-juliaup/99560 "2023-05-29T15:13:43Z")

</div>

Is it possible to install the upcoming 1.9.1 with juliaup, for testing? (I guess “no”, since the there aren’t binaries available).

---

## [Low-overhead conditional loading of external modules](https://discourse.julialang.org/t/low-overhead-conditional-loading-of-external-modules/99500)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 3\
**Last updated:** [May 29, 2023, 1:47pm UTC](https://discourse.julialang.org/t/low-overhead-conditional-loading-of-external-modules/99500 "2023-05-29T13:47:20Z")

</div>

I want to conditionally load an external module in my package, without needing the user to load that module. Normal use of package extensions are not practical for my use case because I don’t want downstream users to ne…

---

## [Managing Julia polyrepo, any workflow suggestions?](https://discourse.julialang.org/t/managing-julia-polyrepo-any-workflow-suggestions/99554)

<div class="topic-metadata">

**Author:** [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Replies:** 0\
**Last updated:** [May 29, 2023, 12:14pm UTC](https://discourse.julialang.org/t/managing-julia-polyrepo-any-workflow-suggestions/99554 "2023-05-29T12:14:08Z")

</div>

I’ve been thinking slowly about this, and then I read this: How to structure project in julia There is this extremely useful project that I’ve been using: JuliaGNSS · GitHub which does GNSS processing as fast as C++ wit…

---

## [Nice workflows for using and developing in Julia 1.9+](https://discourse.julialang.org/t/nice-workflows-for-using-and-developing-in-julia-1-9/96017)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 43\
**Last updated:** [May 29, 2023, 9:04am UTC](https://discourse.julialang.org/t/nice-workflows-for-using-and-developing-in-julia-1-9/96017 "2023-05-29T09:04:51Z")

</div>

I wrote a small step by step to help my students with of a good workflow for Julia here. Sharing it here because it might help new users. Updated (and properly formatted) versions will be available in that link when nece…

---

## [How to get local modules precompiled?](https://discourse.julialang.org/t/how-to-get-local-modules-precompiled/99489)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 2\
**Last updated:** [May 29, 2023, 8:13am UTC](https://discourse.julialang.org/t/how-to-get-local-modules-precompiled/99489 "2023-05-29T08:13:31Z")

</div>

I have a module MyMod in MyMod.jl, which contains all functions I am working on. The functions in MyMod are kind of stable now and not changed frequently, but I need to use them for some other tests. What I currently do…

---

## [Why mul! does not work with a target that has more columns than the result?](https://discourse.julialang.org/t/why-mul-does-not-work-with-a-target-that-has-more-columns-than-the-result/99531)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 2\
**Last updated:** [May 28, 2023, 11:35pm UTC](https://discourse.julialang.org/t/why-mul-does-not-work-with-a-target-that-has-more-columns-than-the-result/99531 "2023-05-28T23:35:17Z")

</div>

I was surprised to find that mul! in C = zeros(4,6); A = rand(4,3); B = rand(3,5); mul!(C, A, B); fails with ERROR: DimensionMismatch: A has size (4,3), B has size (3,5), C has size (4, 6) instead of proceeding by ov…

---

## [Zygote: product with a (constant) sparse boolean](https://discourse.julialang.org/t/zygote-product-with-a-constant-sparse-boolean/99510)

<div class="topic-metadata">

**Author:** [@fph](https://discourse.julialang.org/u/fph)\
**Replies:** 7\
**Last updated:** [May 28, 2023, 10:48pm UTC](https://discourse.julialang.org/t/zygote-product-with-a-constant-sparse-boolean/99510 "2023-05-28T22:48:42Z")

</div>

How can I make products with (constant) sparse boolean matrices and vectors work with Zygote? Example: julia\> using Zygote, SparseArrays, LinearAlgebra julia\> gradient(v -\> dot(sparse(\[true;false\]),v), \[1.;0.\]) ERROR:…

---

## [DiffEqFlux and Threaded Ensemble Problems with ForwardDiff](https://discourse.julialang.org/t/diffeqflux-and-threaded-ensemble-problems-with-forwarddiff/99514)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 3\
**Last updated:** [May 28, 2023, 6:48pm UTC](https://discourse.julialang.org/t/diffeqflux-and-threaded-ensemble-problems-with-forwarddiff/99514 "2023-05-28T18:48:55Z")

</div>

Hi Julia Speed Guru’s, I’m trying to demonstrate Julia’s cool capabilities for embedding shallow neural networks to select key parameters for an ensemble of differential equations. I can use the ensemble problem fine a…

---

## [Can Pkg.activate("myPackage") be silent?](https://discourse.julialang.org/t/can-pkg-activate-mypackage-be-silent/99481)

<div class="topic-metadata">

**Author:** [@JackStrauss](https://discourse.julialang.org/u/JackStrauss)\
**Replies:** 6\
**Last updated:** [May 28, 2023, 6:04pm UTC](https://discourse.julialang.org/t/can-pkg-activate-mypackage-be-silent/99481 "2023-05-28T18:04:16Z")

</div>

Hello All I have a silly little problem I can’t figure out. For internal reasons, I need to load my packages from a custom path with Pkg.activate("~/myPackage"). The thing is, we run it on the command line (here Julia 1…

---

## [Julia 1.9 uses more memory for compilation caches that 1.8](https://discourse.julialang.org/t/julia-1-9-uses-more-memory-for-compilation-caches-that-1-8/99482)

<div class="topic-metadata">

**Author:** [@andreyz4k](https://discourse.julialang.org/u/andreyz4k)\
**Replies:** 9\
**Last updated:** [May 28, 2023, 4:42pm UTC](https://discourse.julialang.org/t/julia-1-9-uses-more-memory-for-compilation-caches-that-1-8/99482 "2023-05-28T16:42:05Z")

</div>

Hi, I have a fairly large project that has a number of functions that deal with parameters of unspecified type (mostly passing them to the next functions that know what they will be getting). In the end, I’m relying on r…

---

## [The app generated by \`PackageCompiler.jl\` throw the \`InitError\`?](https://discourse.julialang.org/t/the-app-generated-by-packagecompiler-jl-throw-the-initerror/99512)

<div class="topic-metadata">

**Author:** [@fenyutanchan](https://discourse.julialang.org/u/fenyutanchan)\
**Replies:** 0\
**Last updated:** [May 28, 2023, 12:46pm UTC](https://discourse.julialang.org/t/the-app-generated-by-packagecompiler-jl-throw-the-initerror/99512 "2023-05-28T12:46:20Z")

</div>

First I made one app as module App using SymEngine function julia\_main()::Cint @vars x y println(expand((x + y)^2)) return 0 end # function julia\_main end # module App Then using PackageCompiler create…

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

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