# General Usage

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

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

**Page:** 494

---

## [Franklin.pagevar("menu1.md", :title)](https://discourse.julialang.org/t/franklin-pagevar-menu1-md-title/74975)

<div class="topic-metadata">

**Author:** [@paradoxical-rhapsody](https://discourse.julialang.org/u/paradoxical-rhapsody)\
**Replies:** 3\
**Last updated:** [January 21, 2022, 3:24pm UTC](https://discourse.julialang.org/t/franklin-pagevar-menu1-md-title/74975 "2022-01-21T15:24:39Z")

</div>

After initialize a site using newsite("test"), in the interactive environment I ran the statement Franklin.pagevar("menu1.md", :title) It throws the following error msg: julia\> Franklin.pagevar("menu1.md", "title") ER…

---

## [Accumulation in the for loop](https://discourse.julialang.org/t/accumulation-in-the-for-loop/74870)

<div class="topic-metadata">

**Author:** [@xspeng](https://discourse.julialang.org/u/xspeng)\
**Replies:** 17\
**Last updated:** [January 21, 2022, 2:31pm UTC](https://discourse.julialang.org/t/accumulation-in-the-for-loop/74870 "2022-01-21T14:31:09Z")

</div>

My problem can be simply understand by the following case: when I write the following program, I hope that c=a\[1:5\]+b\[1:3\] a=\[1 2 3 4 5\] b=\[1 2 3\] c = 0 for i in 1:5, j in 1:3 c += a\[i\] + b\[j\] end but that is e…

---

## [\[SOLVED\] How can I evaluate in Main from a module?](https://discourse.julialang.org/t/solved-how-can-i-evaluate-in-main-from-a-module/74908)

<div class="topic-metadata">

**Author:** [@emmettgb](https://discourse.julialang.org/u/emmettgb)\
**Replies:** 8\
**Last updated:** [January 21, 2022, 10:37am UTC](https://discourse.julialang.org/t/solved-how-can-i-evaluate-in-main-from-a-module/74908 "2022-01-21T10:37:32Z")

</div>

Hello! I am trying to make a macro, @each, which will take each value and compare the falsehood of it to a certain condition. The problem is, while it works fine so long as the macro is globally defined, i.e. in a noteb…

---

## [Plots.jl + GR backend: time to plot on windows always 2.3 seconds](https://discourse.julialang.org/t/plots-jl-gr-backend-time-to-plot-on-windows-always-2-3-seconds/74752)

<div class="topic-metadata">

**Author:** [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Replies:** 3\
**Last updated:** [January 21, 2022, 9:11am UTC](https://discourse.julialang.org/t/plots-jl-gr-backend-time-to-plot-on-windows-always-2-3-seconds/74752 "2022-01-21T09:11:03Z")

</div>

Hello everyone, Not sure if this is normal or not, but when I type in the repl the following: julia\> @time using Plots; @time display(plot(rand(10))) 3.859720 seconds (8.52 M allocations: 590.593 MiB, 7.35% gc time, …

---

## [Understanding Allocations and Views](https://discourse.julialang.org/t/understanding-allocations-and-views/74967)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 4\
**Last updated:** [January 21, 2022, 4:31am UTC](https://discourse.julialang.org/t/understanding-allocations-and-views/74967 "2022-01-21T04:31:50Z")

</div>

Hello, I am trying to improve some code I have, specifically to reduce the allocations it makes in a hot inner loop. I’ve been using Profile and julia --track-allocation=user to inspect on what lines the bulk of the all…

---

## [Makie mouse event](https://discourse.julialang.org/t/makie-mouse-event/74786)

<div class="topic-metadata">

**Author:** [@sransome](https://discourse.julialang.org/u/sransome)\
**Replies:** 10\
**Last updated:** [January 21, 2022, 1:49am UTC](https://discourse.julialang.org/t/makie-mouse-event/74786 "2022-01-21T01:49:27Z")

</div>

Hi, I’m using the following to respond to mouse clicks for a chart with multiple Axis, ax1, ax2,ax3. on(events(ax1.scene).mousebutton, priority = 0) do event if event.button == Mouse.left printl…

---

## [Franklin: render csv file in new browser tab](https://discourse.julialang.org/t/franklin-render-csv-file-in-new-browser-tab/74922)

<div class="topic-metadata">

**Author:** [@paradoxical-rhapsody](https://discourse.julialang.org/u/paradoxical-rhapsody)\
**Replies:** 3\
**Last updated:** [January 21, 2022, 1:15am UTC](https://discourse.julialang.org/t/franklin-render-csv-file-in-new-browser-tab/74922 "2022-01-21T01:15:56Z")

</div>

Using Franklin, I have created a static site. Now I would like to add a link to a CSV file, writen as \[data file\](example.csv) in markdown, in page home/dataexpo. The normal usage of \[data file\](example.csv) leads to do…

---

## [Using @code\_warntype to inspect my module functions](https://discourse.julialang.org/t/using-code-warntype-to-inspect-my-module-functions/74901)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 3\
**Last updated:** [January 21, 2022, 1:13am UTC](https://discourse.julialang.org/t/using-code-warntype-to-inspect-my-module-functions/74901 "2022-01-21T01:13:09Z")

</div>

Hello! I am wondering what or how is the best way to use @code\_warntype to inspect my code for type instabilities. To give you some context, I am working in a script file (.jl) and doing using MyCustomModule at the top …

---

## [Redirect stdout and stderr?](https://discourse.julialang.org/t/redirect-stdout-and-stderr/13424)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 5\
**Last updated:** [January 20, 2022, 10:17pm UTC](https://discourse.julialang.org/t/redirect-stdout-and-stderr/13424 "2022-01-20T22:17:48Z")

</div>

I want to do a computation with stdout and stderr both redirected to files. Here is what I wrote: open(prefix \* ".log", "w") do out open(prefix \* ".err", "w") do err redirect\_stdout(out) do redir…

---

## [Weighted histogram ~2x as slow in Julia vs. Python](https://discourse.julialang.org/t/weighted-histogram-2x-as-slow-in-julia-vs-python/74953)

<div class="topic-metadata">

**Author:** [@kirklong](https://discourse.julialang.org/u/kirklong)\
**Replies:** 13\
**Last updated:** [January 20, 2022, 9:36pm UTC](https://discourse.julialang.org/t/weighted-histogram-2x-as-slow-in-julia-vs-python/74953 "2022-01-20T21:36:35Z")

</div>

I’m working on a project where I need to compute the weighted histogram of something many times. Basically I need the sum of each of the bins of the histogram, and I’ve been using PyCall to call the SciPy “binned statist…

---

## [Pkg.instantiate() after activating project?](https://discourse.julialang.org/t/pkg-instantiate-after-activating-project/36603)

<div class="topic-metadata">

**Author:** [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Replies:** 6\
**Last updated:** [January 20, 2022, 8:53pm UTC](https://discourse.julialang.org/t/pkg-instantiate-after-activating-project/36603 "2022-01-20T20:53:12Z")

</div>

I run code on a cluster (using slurm). The sbatch file starts Julia in the package directory. For example: julia --project="." --startup-file=no "longleaf/run\_simple.jl" Occasionally, the jobs crash with errors complai…

---

## [Makie RGFf0 Undefeined VariableError](https://discourse.julialang.org/t/makie-rgff0-undefeined-variableerror/74882)

<div class="topic-metadata">

**Author:** [@rajmac](https://discourse.julialang.org/u/rajmac)\
**Replies:** 2\
**Last updated:** [January 20, 2022, 7:50pm UTC](https://discourse.julialang.org/t/makie-rgff0-undefeined-variableerror/74882 "2022-01-20T19:50:39Z")

</div>

I am new to JUlia and have been working my way in with different tutorials. So far I have been able to find sources for most of my problems. However using GLMakie to draw figures I have had difficulty in using a color =(…

---

## [Package set-up not propagating to workers with Distributed](https://discourse.julialang.org/t/package-set-up-not-propagating-to-workers-with-distributed/74952)

<div class="topic-metadata">

**Author:** [@danielsoutar](https://discourse.julialang.org/u/danielsoutar)\
**Replies:** 0\
**Last updated:** [January 20, 2022, 6:09pm UTC](https://discourse.julialang.org/t/package-set-up-not-propagating-to-workers-with-distributed/74952 "2022-01-20T18:09:03Z")

</div>

Info: $ julia --version julia version 1.6.0 $ lscpu ~/root/MyPackage$ lscpu Architecture: x86\_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address …

---

## [Multithreading for nested loops](https://discourse.julialang.org/t/multithreading-for-nested-loops/36002)

<div class="topic-metadata">

**Author:** [@henry2004y](https://discourse.julialang.org/u/henry2004y)\
**Replies:** 42\
**Last updated:** [January 20, 2022, 6:00pm UTC](https://discourse.julialang.org/t/multithreading-for-nested-loops/36002 "2022-01-20T18:00:37Z")

</div>

Hi, I am wondering how to apply multi-threading to nested for loops. For the function nestedloop below, I guess the threads will only be launched for the outermost k loop for OMP\_JULIA\_THREADS times: function nestedlo…

---

## [Adding a new (yet to be installed) package does not seem to download the package](https://discourse.julialang.org/t/adding-a-new-yet-to-be-installed-package-does-not-seem-to-download-the-package/74894)

<div class="topic-metadata">

**Author:** [@apg](https://discourse.julialang.org/u/apg)\
**Replies:** 2\
**Last updated:** [January 20, 2022, 5:53pm UTC](https://discourse.julialang.org/t/adding-a-new-yet-to-be-installed-package-does-not-seem-to-download-the-package/74894 "2022-01-20T17:53:17Z")

</div>

I was trying to add a new package (custom package) “P” of version 2.0, which is the latest version of the package “P” to my project environment and run into some weird issue (Julia v 1.6, macosx 11.6). The package “P” wi…

---

## [PkgTemplates. Errors after creating and deleting the package](https://discourse.julialang.org/t/pkgtemplates-errors-after-creating-and-deleting-the-package/74943)

<div class="topic-metadata">

**Author:** [@pjgorski](https://discourse.julialang.org/u/pjgorski)\
**Replies:** 1\
**Last updated:** [January 20, 2022, 5:52pm UTC](https://discourse.julialang.org/t/pkgtemplates-errors-after-creating-and-deleting-the-package/74943 "2022-01-20T17:52:35Z")

</div>

I have done the following things: I created a test package using PkgTemplates, then I deleted it, and then I wanted to create another test package and I ran into an error. ERROR: expected package Test \[caf985be\]to exi…

---

## [How to find where constants are defined](https://discourse.julialang.org/t/how-to-find-where-constants-are-defined/74936)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 6\
**Last updated:** [January 20, 2022, 4:43pm UTC](https://discourse.julialang.org/t/how-to-find-where-constants-are-defined/74936 "2022-01-20T16:43:38Z")

</div>

Is there a way to reveal the file where constants are defined? For example, we have π = 3.1415926535897..., but which file defines this constant? I am looking for something like @less for functions.

---

## [Pmap extremely slow when function returns large object](https://discourse.julialang.org/t/pmap-extremely-slow-when-function-returns-large-object/74937)

<div class="topic-metadata">

**Author:** [@user\_231578](https://discourse.julialang.org/u/user_231578)\
**Replies:** 4\
**Last updated:** [January 20, 2022, 2:20pm UTC](https://discourse.julialang.org/t/pmap-extremely-slow-when-function-returns-large-object/74937 "2022-01-20T14:20:18Z")

</div>

I would like to parallelize a function but returning large objects makes pmap extremely slow. using Distributed using SharedArrays addprocs(length(Sys.cpu\_info())-1) @everywhere using Random @everywhere function foo(i…

---

## [Passing kwargs... can overwrite other keyword arguments](https://discourse.julialang.org/t/passing-kwargs-can-overwrite-other-keyword-arguments/74933)

<div class="topic-metadata">

**Author:** [@albheim](https://discourse.julialang.org/u/albheim)\
**Replies:** 2\
**Last updated:** [January 20, 2022, 2:13pm UTC](https://discourse.julialang.org/t/passing-kwargs-can-overwrite-other-keyword-arguments/74933 "2022-01-20T14:13:12Z")

</div>

I recently got bitten by some behavior that was not immediately obvious to me (combined with a little sloppy coding from my side). In my case I had a function passing on some kwargs from higher up, as well as adding som…

---

## [Symbolics.jl: bug in unique() involving negative Floats?](https://discourse.julialang.org/t/symbolics-jl-bug-in-unique-involving-negative-floats/74925)

<div class="topic-metadata">

**Author:** [@jhbdiehl](https://discourse.julialang.org/u/jhbdiehl)\
**Replies:** 1\
**Last updated:** [January 20, 2022, 1:42pm UTC](https://discourse.julialang.org/t/symbolics-jl-bug-in-unique-involving-negative-floats/74925 "2022-01-20T13:42:47Z")

</div>

Hello there! I encountered the weirdest behavior of the unique() function when throwing symbols at it: using Symbolics @variables a b unique(\[-(a+1), -1.0(a+1)\]) # 1-element Vector{Num}: -1 - a unique(\[-a-b, -1(a+b)\]…

---

## [How to know the size of the mutated array in f!(F, x)?](https://discourse.julialang.org/t/how-to-know-the-size-of-the-mutated-array-in-f-f-x/74789)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 16\
**Last updated:** [January 20, 2022, 1:24pm UTC](https://discourse.julialang.org/t/how-to-know-the-size-of-the-mutated-array-in-f-f-x/74789 "2022-01-20T13:24:01Z")

</div>

Is there a way to know the size of F in function f!(F, x) F\[1\] = (x\[1\] + 3) \* (x\[2\]^3 - 7) + 18 F\[2\] = sin(x\[2\] \* exp(x\[1\]) - 1) F\[3\] = x\[1\] + x\[2\] return F end without knowing F in advance? My is to p…

---

## [CUDA global synchronization HOWTO](https://discourse.julialang.org/t/cuda-global-synchronization-howto/74920)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 9\
**Last updated:** [January 20, 2022, 12:52pm UTC](https://discourse.julialang.org/t/cuda-global-synchronization-howto/74920 "2022-01-20T12:52:47Z")

</div>

Dear Julianners, I try to create an algorithm that runs an elementwise update operation and a reduction in 10k iteration and about 1\_000\_000 times, so the kernel restarts(2-8us) are really expensive in this scenario. T…

---

## [How to change error bars color without changing the markerstrokecolor](https://discourse.julialang.org/t/how-to-change-error-bars-color-without-changing-the-markerstrokecolor/74868)

<div class="topic-metadata">

**Author:** [@user\_231578](https://discourse.julialang.org/u/user_231578)\
**Replies:** 2\
**Last updated:** [January 20, 2022, 12:37pm UTC](https://discourse.julialang.org/t/how-to-change-error-bars-color-without-changing-the-markerstrokecolor/74868 "2022-01-20T12:37:03Z")

</div>

I would like to change the error bars colors to match the graph colors without changing the markerstrokecolor. If I set markerstrokecolor=:auto, also the markers’ border change. I would like the latter to remain black. W…

---

## [Arch D. Robison high performance Julia workshop from 2016 in 2022](https://discourse.julialang.org/t/arch-d-robison-high-performance-julia-workshop-from-2016-in-2022/74932)

<div class="topic-metadata">

**Author:** [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Replies:** 0\
**Last updated:** [January 20, 2022, 12:13pm UTC](https://discourse.julialang.org/t/arch-d-robison-high-performance-julia-workshop-from-2016-in-2022/74932 "2022-01-20T12:13:07Z")

</div>

Arch D. Robison workshop Introduction to Writing High Performance Julia presented at JuliaCon 2016 thought me so many things and I believe that many Julia users still can learn valuable lessons from it. At the same time,…

---

## [Using Distributed Computing with AWS Batch/ AWS EC2](https://discourse.julialang.org/t/using-distributed-computing-with-aws-batch-aws-ec2/51815)

<div class="topic-metadata">

**Author:** [@bmalham](https://discourse.julialang.org/u/bmalham)\
**Replies:** 3\
**Last updated:** [December 14, 2020, 10:29pm UTC](https://discourse.julialang.org/t/using-distributed-computing-with-aws-batch-aws-ec2/51815 "2020-12-14T22:29:50Z")

</div>

I am currently having issues using parallel processing using Julia’s Distributed library on an EC2 instance. My script attempts to speed up a series of sequential actions by putting some parts in parallel using the remot…

---

## [Out of GPU memory with user defined function](https://discourse.julialang.org/t/out-of-gpu-memory-with-user-defined-function/74914)

<div class="topic-metadata">

**Author:** [@kadir-gunel](https://discourse.julialang.org/u/kadir-gunel)\
**Replies:** 1\
**Last updated:** [January 20, 2022, 8:40am UTC](https://discourse.julialang.org/t/out-of-gpu-memory-with-user-defined-function/74914 "2022-01-20T08:40:00Z")

</div>

Hello, I am getting out of memory error with CUDA while trying to multiply 2 matrices of size (300x40k) inside a user defined function. I understand that X and Y variables are copied hence the memory is insufficient …

---

## [Length of Dict is not thread safe](https://discourse.julialang.org/t/length-of-dict-is-not-thread-safe/74906)

<div class="topic-metadata">

**Author:** [@Jason89757](https://discourse.julialang.org/u/Jason89757)\
**Replies:** 5\
**Last updated:** [January 20, 2022, 8:08am UTC](https://discourse.julialang.org/t/length-of-dict-is-not-thread-safe/74906 "2022-01-20T08:08:43Z")

</div>

I’m trying to write something providing mysql-like functions: insert one row then return id. d = Dict{Int64,Int64}() Threads.@threads for i in 1:10000 if !haskey(d,i) d\[i\] = length(d)+1 end end julia\> length(d)…

---

## [What's a good and easy way to parallelize this?](https://discourse.julialang.org/t/whats-a-good-and-easy-way-to-parallelize-this/74893)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 3\
**Last updated:** [January 20, 2022, 5:35am UTC](https://discourse.julialang.org/t/whats-a-good-and-easy-way-to-parallelize-this/74893 "2022-01-20T05:35:21Z")

</div>

Ultimately, I want to speed up fullsys!, and as you can see there are functions that fill arrays. I thought those filling operations could be parallelized. How can I get started with that? const szAge = 64 - 19 + 1 cons…

---

## [Pass Fortran array of unknown size to Julia](https://discourse.julialang.org/t/pass-fortran-array-of-unknown-size-to-julia/74784)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 2\
**Last updated:** [January 20, 2022, 1:12am UTC](https://discourse.julialang.org/t/pass-fortran-array-of-unknown-size-to-julia/74784 "2022-01-20T01:12:46Z")

</div>

I need to read some binary data (a few arrays, stored in, say, WS2.HSX) that is handled by a Fortran module. I would like to call the Fortran module from Julia. However, the sizes of the arrays are not known in advance. …

---

## [Where is this one allocation coming from?](https://discourse.julialang.org/t/where-is-this-one-allocation-coming-from/72693)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 16\
**Last updated:** [January 20, 2022, 1:11am UTC](https://discourse.julialang.org/t/where-is-this-one-allocation-coming-from/72693 "2022-01-20T01:11:47Z")

</div>

I have to run functions like this many times. I’m interested in reducing allocations and don’t see where that one allocation is coming from. using BenchmarkTools using ComponentArrays using UnPack α0 = rand(2, 2, 5) α …

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

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