JUSTUS2/Software/Julia: Difference between revisions

From bwHPC Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 32: Line 32:
Load Julia module and start interactive REPL session with 8 threads, using the environment in the current directory:
Load Julia module and start interactive REPL session with 8 threads, using the environment in the current directory:


<code>
<pre>
module load math/julia
$ module load math/julia
julia -t 8 --project=.
$ julia -t 8 --project=.
</code>
</pre>


Enter ']' to go into package manager and install package `UnicodePlots`.
Enter ']' to go into package manager and install package <code>UnicodePlots</code>.
<code>
<pre>
add UnicodePlots
add UnicodePlots
</code>
</pre>


Leave the package manager with the backspace key.
Leave the package manager with the backspace key.


Create an vector with 64 elements set to 0 and fill it using all threads with the corresponding tread id number.
Create an vector with 64 elements set to 0 and fill it using all threads with the corresponding tread id number.

<code>
<pre>
vec = zeros(64)
vec = zeros(64)
Threads.@threads for i in eachindex(vec)
Threads.@threads for i in eachindex(vec)
vec[i]= Threads.threadid()
vec[i]= Threads.threadid()
end
end
</code>
</pre>


Load the `UnicodePlots` package and draw a scatter plot of the contents of `vec`
Load the <code>UnicodePlots</code> package and draw a scatter plot of the contents of <code>vec</code>

<code>
<pre>
using UnicodePlots
using UnicodePlots
scatterplot(vec)
scatterplot(vec)
</code>
</pre>


== Further documentation ==
== Further documentation ==



Revision as of 17:10, 8 October 2024

The main documentation is available via module help math/julia on the cluster. Most software modules for applications provide working example batch scripts.


Description Content
module load math/julia
Availability bwUniCluster | JUSTUS2
License MIT License
Citing [1]
Links Project homepage | Documentationn]
Graphical Interface No

Introduction

Julia is a high-level, high-performance, dynamic programming language, being designed with scientific computing in mind. Parallel programming features, such as multi-threading are included in the core language, while there also exit packages leveraging the power of MPI and CUDA.

Interactive Example

Load Julia module and start interactive REPL session with 8 threads, using the environment in the current directory:

$ module load math/julia
$ julia -t 8 --project=.

Enter ']' to go into package manager and install package UnicodePlots.

add UnicodePlots

Leave the package manager with the backspace key.

Create an vector with 64 elements set to 0 and fill it using all threads with the corresponding tread id number.

vec = zeros(64)
Threads.@threads for i in eachindex(vec)
    vec[i]= Threads.threadid()
end

Load the UnicodePlots package and draw a scatter plot of the contents of vec

using UnicodePlots
scatterplot(vec)


Further documentation

  • Julia Workshop at HLRS: The material of this workshop is in large parts also valid for the Justus cluster (on Justus you only need the module math/julia).

Tips & Tricks