# General Usage

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

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

**Page:** 868

---

## [What is the real @time for an MPI program?](https://discourse.julialang.org/t/what-is-the-real-time-for-an-mpi-program/23458)

<div class="topic-metadata">

**Author:** [@Carol](https://discourse.julialang.org/u/Carol)\
**Replies:** 5\
**Last updated:** [May 10, 2019, 1:07am UTC](https://discourse.julialang.org/t/what-is-the-real-time-for-an-mpi-program/23458 "2019-05-10T01:07:44Z")

</div>

Hi, I have a question on timing an MPI code, because I want to test its performance. For example, if I split my code into 10 parallel jobs using MPI, then the @time will return 10 timing records. BTW, I also try to us…

---

## [For loops acceleration](https://discourse.julialang.org/t/for-loops-acceleration/24011)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 9\
**Last updated:** [May 9, 2019, 8:41pm UTC](https://discourse.julialang.org/t/for-loops-acceleration/24011 "2019-05-09T20:41:44Z")

</div>

I have a function that involves several for loops that I would like to accelerate a little bit, but not sure if multi-threading is useful in my case. function SynDiv(option\_leverage = 5, Rf = 1, gamma = 0.1) W0 = 1…

---

## [Julia's in.() seems slow compared to R's %in%](https://discourse.julialang.org/t/julias-in-seems-slow-compared-to-rs-in/23900)

<div class="topic-metadata">

**Author:** [@alasaadstat](https://discourse.julialang.org/u/alasaadstat)\
**Replies:** 40\
**Last updated:** [May 9, 2019, 8:05pm UTC](https://discourse.julialang.org/t/julias-in-seems-slow-compared-to-rs-in/23900 "2019-05-09T20:05:36Z")

</div>

Hi everyone, I want to compare if elements of vector x are in elements of vector y. In R, I can do this as follows: \> x \<- c("a", "b", "c") \> y \<- c("b", "a") \> x %in% y \[1\] TRUE TRUE FALSE In Julia, I can do this a…

---

## [Fast Replotting](https://discourse.julialang.org/t/fast-replotting/24042)

<div class="topic-metadata">

**Author:** [@bjack205](https://discourse.julialang.org/u/bjack205)\
**Replies:** 2\
**Last updated:** [May 9, 2019, 7:19pm UTC](https://discourse.julialang.org/t/fast-replotting/24042 "2019-05-09T19:19:35Z")

</div>

I can’t figure out the best way to continuously update a plot. I’ve dug around but haven’t found a good example of how to do this, yet. My use case is running simulations of dynamical systems, and I’d like to see how th…

---

## [Side Effects of println?](https://discourse.julialang.org/t/side-effects-of-println/24037)

<div class="topic-metadata">

**Author:** [@weech](https://discourse.julialang.org/u/weech)\
**Replies:** 7\
**Last updated:** [May 9, 2019, 5:58pm UTC](https://discourse.julialang.org/t/side-effects-of-println/24037 "2019-05-09T17:58:32Z")

</div>

I’m getting some really strange behavior, and I’m not sure what to make of it. Essentially the values in an array change based on making a call to println elsewhere in the script. I can’t figure out how to reproduce it i…

---

## [Global variables and program structure](https://discourse.julialang.org/t/global-variables-and-program-structure/6188)

<div class="topic-metadata">

**Author:** [@turtle](https://discourse.julialang.org/u/turtle)\
**Replies:** 15\
**Last updated:** [May 9, 2019, 5:53pm UTC](https://discourse.julialang.org/t/global-variables-and-program-structure/6188 "2019-05-09T17:53:09Z")

</div>

I am not proud of my program structure. My code is contained within a single module, my main variables are contained in 8 mutable composite types sometimes with as many as 30 type-annotated fields. Some of my functio…

---

## [Matrix Multiplication A\*B\*A'](https://discourse.julialang.org/t/matrix-multiplication-a-b-a/24019)

<div class="topic-metadata">

**Author:** [@Marco-Congedo](https://discourse.julialang.org/u/Marco-Congedo)\
**Replies:** 5\
**Last updated:** [May 9, 2019, 3:39pm UTC](https://discourse.julialang.org/t/matrix-multiplication-a-b-a/24019 "2019-05-09T15:39:00Z")

</div>

What are the efficient options to perform matrix multiplications of the form A\*B\*A and A\*B\*A' ? I am particularly intereted in the case when A and B are Symmetric or Hermitian and when these multiplications are performed…

---

## [Segfault building a system image for pyjulia with Anaconda Python (mac)](https://discourse.julialang.org/t/segfault-building-a-system-image-for-pyjulia-with-anaconda-python-mac/24033)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 0\
**Last updated:** [May 9, 2019, 2:49pm UTC](https://discourse.julialang.org/t/segfault-building-a-system-image-for-pyjulia-with-anaconda-python-mac/24033 "2019-05-09T14:49:45Z")

</div>

My company uses Anaconda python, so I’m trying to use pyjulia. I tried building a system image following the instructions in the docs, and ran into a segfault: (pyjulia) evans-mbp:pyjl\_test evan$ which python3 /Users/ev…

---

## [File organization and naming for tests](https://discourse.julialang.org/t/file-organization-and-naming-for-tests/24028)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [May 9, 2019, 12:59pm UTC](https://discourse.julialang.org/t/file-organization-and-naming-for-tests/24028 "2019-05-09T12:59:48Z")

</div>

I am looking for a way of organizing test/ directories for large projects, mainly because if I settled on a way then I would not have to think about it :wink: (I found this topic which is loosely related.) To make thing…

---

## [Fail to install PyCall](https://discourse.julialang.org/t/fail-to-install-pycall/24016)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 2\
**Last updated:** [May 9, 2019, 11:37am UTC](https://discourse.julialang.org/t/fail-to-install-pycall/24016 "2019-05-09T11:37:50Z")

</div>

Hi, In Julia 1.1.0, Windows, I try to build PyCall (with a view to PyPlot). Julia\> Pkg.build(“PyCall”) Building Conda ─→ C:\\Users\\philippem\\.julia\\packages\\Conda\\CpuvI\\deps\\build.log Building PyCall → C:\\Users\\phili…

---

## [Why does exporting a single Float64 from a function take as long as 2,000,000 addition steps](https://discourse.julialang.org/t/why-does-exporting-a-single-float64-from-a-function-take-as-long-as-2-000-000-addition-steps/24008)

<div class="topic-metadata">

**Author:** [@damonturney](https://discourse.julialang.org/u/damonturney)\
**Replies:** 21\
**Last updated:** [May 9, 2019, 9:04am UTC](https://discourse.julialang.org/t/why-does-exporting-a-single-float64-from-a-function-take-as-long-as-2-000-000-addition-steps/24008 "2019-05-09T09:04:15Z")

</div>

Hi Forum, Can someone enlighten me as to why a single Float64 export from inside a function takes as much computation time as 2,000,000 additions? See code below from Julia 1.1. module test struct teststruct …

---

## [PyPlot install on OSX](https://discourse.julialang.org/t/pyplot-install-on-osx/20074)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 23\
**Last updated:** [May 9, 2019, 6:53am UTC](https://discourse.julialang.org/t/pyplot-install-on-osx/20074 "2019-05-09T06:53:04Z")

</div>

Dear, I’m having trouble installing PyPlot on OSX Mojave. This is Julia 1.1.0. Whenever I install PyPlot on a fresh Julia, it fails to plot anything from the REPL, no backend is used, an error is throwers to the screen …

---

## [Exporting variables from local scope introduced by macro](https://discourse.julialang.org/t/exporting-variables-from-local-scope-introduced-by-macro/24013)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 2\
**Last updated:** [May 9, 2019, 6:33am UTC](https://discourse.julialang.org/t/exporting-variables-from-local-scope-introduced-by-macro/24013 "2019-05-09T06:33:35Z")

</div>

I want to write a macro that, before the enclosed expressions is run, activates “unsafe mode” and deactivates this mode again afterwards, kind of like @unsafe\_mode my\_expr translating to unsafe(true) my\_expr unsafe(fa…

---

## [In-place fft](https://discourse.julialang.org/t/in-place-fft/23993)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 4\
**Last updated:** [May 8, 2019, 9:59pm UTC](https://discourse.julialang.org/t/in-place-fft/23993 "2019-05-08T21:59:59Z")

</div>

Hi, I am using the FFTW.jl package. If I have a vector, say x = rand(100) How can I compute its discrete Fourier transform values in-place ? The command fft(x) returns a new array but leaves x intact. This bring…

---

## [Something faster than for loops](https://discourse.julialang.org/t/something-faster-than-for-loops/24001)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 27\
**Last updated:** [May 8, 2019, 9:25pm UTC](https://discourse.julialang.org/t/something-faster-than-for-loops/24001 "2019-05-08T21:25:47Z")

</div>

Dear All, I am an “old” programmer used to Fortran and Matlab. I can’t get rid of For and While loops, but I know Julia can do things much faster! I am using the following code n=5 p=5 m=5 A=rand(n,p) B=rand(p,m) C=z…

---

## [Automatic differentiation, adjoint methods, and linear systems of equations](https://discourse.julialang.org/t/automatic-differentiation-adjoint-methods-and-linear-systems-of-equations/23979)

<div class="topic-metadata">

**Author:** [@omalled](https://discourse.julialang.org/u/omalled)\
**Replies:** 4\
**Last updated:** [May 8, 2019, 7:43pm UTC](https://discourse.julialang.org/t/automatic-differentiation-adjoint-methods-and-linear-systems-of-equations/23979 "2019-05-08T19:43:17Z")

</div>

I am interested in differentiating things that are along the lines of what is described in section 2 of these notes where the linear systems are sparse. For several years, I have occasionally been checking out Julia’s AD…

---

## [Force the usage of precompiled modules without any check](https://discourse.julialang.org/t/force-the-usage-of-precompiled-modules-without-any-check/24007)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 0\
**Last updated:** [May 8, 2019, 7:07pm UTC](https://discourse.julialang.org/t/force-the-usage-of-precompiled-modules-without-any-check/24007 "2019-05-08T19:07:11Z")

</div>

Question How can I force the usage of precompiled modules inside DEPOT\_PATH\[1\]/compiled/ without any check (for timestamps etc.)? Motivation This specific question came up in the much broader discussion “Run a julia a…

---

## [Parentheses in a macro invocation](https://discourse.julialang.org/t/parentheses-in-a-macro-invocation/22793)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [May 8, 2019, 2:45pm UTC](https://discourse.julialang.org/t/parentheses-in-a-macro-invocation/22793 "2019-05-08T14:45:48Z")

</div>

Suppose I have a macro that is called like @mac a, b, c = d (for a concrete example, think of Parameters.@unpack). What is the proper way of writing this with the () invocation form, ie how to complete @mac(a, ...) ?…

---

## [How to unroll tree traversal efficiently?](https://discourse.julialang.org/t/how-to-unroll-tree-traversal-efficiently/23994)

<div class="topic-metadata">

**Author:** [@jonalm](https://discourse.julialang.org/u/jonalm)\
**Replies:** 1\
**Last updated:** [May 8, 2019, 1:05pm UTC](https://discourse.julialang.org/t/how-to-unroll-tree-traversal-efficiently/23994 "2019-05-08T13:05:48Z")

</div>

Hi, Consider a number of intervals on the real line (Interval), defined by their endpoints. I want to calculate whether a given point x is inside any of these intervals. I’m actually interested in a more complex case in…

---

## [Efficient traversal of tree defined as nested structs](https://discourse.julialang.org/t/efficient-traversal-of-tree-defined-as-nested-structs/23772)

<div class="topic-metadata">

**Author:** [@jonalm](https://discourse.julialang.org/u/jonalm)\
**Replies:** 2\
**Last updated:** [May 8, 2019, 12:42pm UTC](https://discourse.julialang.org/t/efficient-traversal-of-tree-defined-as-nested-structs/23772 "2019-05-08T12:42:06Z")

</div>

Edit: this question has been reformulated here: How to unroll tree traversal efficiently? Dear Community, I would greatly appreciate some pointers to how I could speed up my code. Some background: I tried to write …

---

## [Interpret \`NTuple{1024, UInt8}\` as a C string](https://discourse.julialang.org/t/interpret-ntuple-1024-uint8-as-a-c-string/23906)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 5\
**Last updated:** [May 8, 2019, 10:51am UTC](https://discourse.julialang.org/t/interpret-ntuple-1024-uint8-as-a-c-string/23906 "2019-05-08T10:51:12Z")

</div>

I am calling some C code. One of the structs has a field is of type char \[1024\], which Clang.jl turns into NTuple{1024,UInt8}. This is a null-terminated C string. How can I get a String-like thing from this without copy…

---

## [Travis failure when Testing Required code on julia v1.0](https://discourse.julialang.org/t/travis-failure-when-testing-required-code-on-julia-v1-0/23986)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 9\
**Last updated:** [May 8, 2019, 8:57am UTC](https://discourse.julialang.org/t/travis-failure-when-testing-required-code-on-julia-v1-0/23986 "2019-05-08T08:57:54Z")

</div>

I can’t really understand the reason for the following build failure I suspect it might be related to me using Requires.jl to require a package ControlSystemIdentification.jl, which is listed as a test dependency in Pr…

---

## [Visualisation in Julia](https://discourse.julialang.org/t/visualisation-in-julia/23962)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 18\
**Last updated:** [May 8, 2019, 8:23am UTC](https://discourse.julialang.org/t/visualisation-in-julia/23962 "2019-05-08T08:23:30Z")

</div>

Dear All, I want to use the following plot function from Matlab in Julia. I could not find the correct commands of Julia to do this work. subplot(1,1,1) pcolor(con), shading interp, ... axis('off'), axis('e…

---

## [Png files to mp4](https://discourse.julialang.org/t/png-files-to-mp4/23978)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 7\
**Last updated:** [May 8, 2019, 7:03am UTC](https://discourse.julialang.org/t/png-files-to-mp4/23978 "2019-05-08T07:03:33Z")

</div>

Dear All, how can I converts pngs files (fig1.png, fig2.png, … , fig10.png) to mp4. video using a very easy method in Julia? Best regards

---

## [How to add vector {Any} as new line do dlm files?](https://discourse.julialang.org/t/how-to-add-vector-any-as-new-line-do-dlm-files/23985)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [May 8, 2019, 6:52am UTC](https://discourse.julialang.org/t/how-to-add-vector-any-as-new-line-do-dlm-files/23985 "2019-05-08T06:52:34Z")

</div>

vectors with numbers are writable byt vectors with string not ! How to write as new line to existing dlm file any vector from Array{Any} ? julia\> open("mytestfile.txt", "a") do io writedlm(io, A\[2,:\]') e…

---

## [Any way to remove "From worker"?](https://discourse.julialang.org/t/any-way-to-remove-from-worker/23604)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 2\
**Last updated:** [May 8, 2019, 6:03am UTC](https://discourse.julialang.org/t/any-way-to-remove-from-worker/23604 "2019-05-08T06:03:48Z")

</div>

I want to print some data in a distributed for-loop but I don’t really want to see these lines with the “from worker” prefix. Is there any way to get rid of it? From worker 3: hello From worker 4: world …

---

## [Embedding Julia C question](https://discourse.julialang.org/t/embedding-julia-c-question/19428)

<div class="topic-metadata">

**Author:** [@timmm](https://discourse.julialang.org/u/timmm)\
**Replies:** 1\
**Last updated:** [May 7, 2019, 2:28pm UTC](https://discourse.julialang.org/t/embedding-julia-c-question/19428 "2019-05-07T14:28:31Z")

</div>

Hi, I am struggling with the documentation on embedding Julia in C. Is there an obvious thing I am doing wrong? If I try the test example in: Embedding Julia · The Julia Language i.e. calling: JULIA\_DIR=/home/julia-1…

---

## [Calling C and Fortran Code (Julia documentation)](https://discourse.julialang.org/t/calling-c-and-fortran-code-julia-documentation/23981)

<div class="topic-metadata">

**Author:** [@Thuener](https://discourse.julialang.org/u/Thuener)\
**Replies:** 4\
**Last updated:** [May 8, 2019, 3:41am UTC](https://discourse.julialang.org/t/calling-c-and-fortran-code-julia-documentation/23981 "2019-05-08T03:41:55Z")

</div>

I have many questions about Memory Ownership in Calling C and Fortran Code · The Julia Language. One example, from this documentation we have: function sf\_bessel\_Jn\_array(nmin::Integer, nmax::Integer, x::Real) if n…

---

## [UNIX PID of julia process](https://discourse.julialang.org/t/unix-pid-of-julia-process/23977)

<div class="topic-metadata">

**Author:** [@atteson](https://discourse.julialang.org/u/atteson)\
**Replies:** 2\
**Last updated:** [May 7, 2019, 8:06pm UTC](https://discourse.julialang.org/t/unix-pid-of-julia-process/23977 "2019-05-07T20:06:58Z")

</div>

Does anyone know of an easy way to get the process ID of the current julia process running on UNIX?

---

## [Arithmetic modulo primes](https://discourse.julialang.org/t/arithmetic-modulo-primes/23895)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 6\
**Last updated:** [May 7, 2019, 8:05pm UTC](https://discourse.julialang.org/t/arithmetic-modulo-primes/23895 "2019-05-07T20:05:48Z")

</div>

Hi Does Julia have a package for arithmetic modulo primes (Zp)? I found a repository for Mod(:val, :mod) (link) but that requires storing the prime as a field of each variable. I would like to instantiate variable fro…

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

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