<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bwhpc.de/wiki/index.php?action=history&amp;feed=atom&amp;title=Justus3%2FSoftware%2FJulia%2FParallel_Programming</id>
	<title>Justus3/Software/Julia/Parallel Programming - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bwhpc.de/wiki/index.php?action=history&amp;feed=atom&amp;title=Justus3%2FSoftware%2FJulia%2FParallel_Programming"/>
	<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Justus3/Software/Julia/Parallel_Programming&amp;action=history"/>
	<updated>2026-11-13T06:32:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=Justus3/Software/Julia/Parallel_Programming&amp;diff=16616&amp;oldid=prev</id>
		<title>M Carmesin: Created page with &quot;= Parallel Programming in Julia =  Julia supports several paradigms of parallel programming:  # Implicit multi-threading by math libraries (OpenBLAS, MKL, AMD AOCL) # Explicit multi-threading using Julia threads (e.g. `Threads.@threads for`) or [https://github.com/JuliaSIMD/Polyester.jl Polyester.jl ] # Multiple processes on one ore more nodes #* &lt;code&gt;Distributed.jl&lt;/code&gt; package and &lt;code&gt;SlurmManager&lt;/code&gt; from [https://github.com/JuliaParallel/SlurmClusterManager.j...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=Justus3/Software/Julia/Parallel_Programming&amp;diff=16616&amp;oldid=prev"/>
		<updated>2026-11-11T10:30:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Parallel Programming in Julia =  Julia supports several paradigms of parallel programming:  # Implicit multi-threading by math libraries (OpenBLAS, MKL, AMD AOCL) # Explicit multi-threading using Julia threads (e.g. `Threads.@threads for`) or [https://github.com/JuliaSIMD/Polyester.jl Polyester.jl ] # Multiple processes on one ore more nodes #* &amp;lt;code&amp;gt;Distributed.jl&amp;lt;/code&amp;gt; package and &amp;lt;code&amp;gt;SlurmManager&amp;lt;/code&amp;gt; from [https://github.com/JuliaParallel/SlurmClusterManager.j...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Parallel Programming in Julia =&lt;br /&gt;
&lt;br /&gt;
Julia supports several paradigms of parallel programming:&lt;br /&gt;
&lt;br /&gt;
# Implicit multi-threading by math libraries (OpenBLAS, MKL, AMD AOCL)&lt;br /&gt;
# Explicit multi-threading using Julia threads (e.g. `Threads.@threads for`) or [https://github.com/JuliaSIMD/Polyester.jl Polyester.jl ]&lt;br /&gt;
# Multiple processes on one ore more nodes&lt;br /&gt;
#* &amp;lt;code&amp;gt;Distributed.jl&amp;lt;/code&amp;gt; package and &amp;lt;code&amp;gt;SlurmManager&amp;lt;/code&amp;gt; from [https://github.com/JuliaParallel/SlurmClusterManager.jl &amp;lt;code&amp;gt;SlurmClusterManager.jl&amp;lt;/code&amp;gt;] package, (e.g.&amp;lt;code&amp;gt;@distributed for&amp;lt;/code&amp;gt;-loops)&lt;br /&gt;
#* [https://github.com/JuliaParallel/MPI.jl &amp;lt;code&amp;gt;MPI.jl&amp;lt;/code&amp;gt;]&lt;br /&gt;
# Execution on GPUs/CUDA using [https://cuda.juliagpu.org/stable/ &amp;lt;code&amp;gt;CUDA.jl&amp;lt;/code&amp;gt; ]&lt;br /&gt;
&lt;br /&gt;
All paradigms may be used at the same time, but must be chosen carefully, to obtain the desired performance.&lt;br /&gt;
&lt;br /&gt;
== Implict Multi-Threading ==&lt;br /&gt;
&lt;br /&gt;
The number of threads used by the mathematical linear algebra libraries may be configured using &amp;lt;code&amp;gt;BLAS.set_num_threads()&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;LinearAlgebra&amp;lt;/code&amp;gt; package. Alternatively you can set the environment variables &amp;lt;code&amp;gt;OPENBLAS_NUM_THREADS&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;MKL_NUM_THREADS&amp;lt;/code&amp;gt; if you use MKL or &amp;lt;code&amp;gt;BLIS_NUM_THREADS&amp;lt;/code&amp;gt; if you use AMD BLIS.&lt;br /&gt;
&lt;br /&gt;
If your code is already multi-threaded, you probably want to set the number of BLAS threads to 1, in order to avoid running too many competing threads, as every Julia thread comes with its own BLAS threads.&lt;br /&gt;
&lt;br /&gt;
== Explicit Multi-Threading ==&lt;br /&gt;
Start Julia with option &amp;lt;code&amp;gt;-t x&amp;lt;/code&amp;gt; where x is &lt;br /&gt;
the number of (Julia) threads or the keyword &amp;lt;code&amp;gt;auto&amp;lt;/code&amp;gt;, which however doesn&amp;#039;t  determine correctly the number of threads requested from SLURM with the option &amp;lt;code&amp;gt;--cpus-per-task&amp;lt;/code&amp;gt;. Alternatively, you can set the environment variable &amp;lt;code&amp;gt;JULIA_NUM_THREADS&amp;lt;/code&amp;gt;. See the [https://docs.julialang.org/en/v1/manual/multi-threading/ Julia documentation] for more details.&lt;br /&gt;
&lt;br /&gt;
== Multiple Processes ==&lt;br /&gt;
With the [https://docs.julialang.org/en/v1/manual/distributed-computing/ Distributed package] Julia has native support for distributed computing using multiple processes on different nodes. To integrate well into SLURM, the use of the [https://github.com/JuliaParallel/ClusterManagers.jl &amp;lt;code&amp;gt;ClusterManagers.jl&amp;lt;/code&amp;gt;], providing the &amp;lt;code&amp;gt;addprocs_slurm()&amp;lt;/code&amp;gt; function, is advised to spawn the worker processes. &lt;br /&gt;
&lt;br /&gt;
== MPI ==&lt;br /&gt;
&lt;br /&gt;
Distributed computing using MPI can be performed leveraging the [https://github.com/JuliaParallel/MPI.jl &amp;lt;code&amp;gt;MPI.jl&amp;lt;/code&amp;gt;] package, which provides Julia wrappers for most of the standard MPI functions.&lt;br /&gt;
&lt;br /&gt;
== CUDA ==&lt;br /&gt;
Julia supports computations on NVidia GPUS using the [https://cuda.juliagpu.org/stable/ CUDA.jl] package. It provides the possibility to write own kernels as well as wrappers for libraries like cuBLAS or cuFFT, that contain implementations of standard numerical routines optimized for GPUs.&lt;br /&gt;
&lt;br /&gt;
== Higher Level Packages ==&lt;br /&gt;
&lt;br /&gt;
There are several Julia packages that allow for mixing/changing the different paradigms for parallel computing with minimal code changes:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/JuliaFolds2/FLoops.jl &amp;lt;code&amp;gt;FLoops.jl&amp;lt;/code&amp;gt;] and its backend [https://juliafolds2.github.io/Folds.jl/dev/ &amp;lt;code&amp;gt;Folds.jl&amp;lt;/code&amp;gt;] &lt;br /&gt;
* [https://juliaparallel.org/Dagger.jl/stable/ &amp;lt;code&amp;gt;Dagger.jl&amp;lt;/code&amp;gt;]&lt;/div&gt;</summary>
		<author><name>M Carmesin</name></author>
	</entry>
</feed>