![](https://media.enccs.se/2024/09/julia-for-hpc-autumn2-2024.webp) <p style="text-align: center"><b><font size=5 color=blueyellow>Julia for High-Performance Scientific Computing - Day 1</font></b></p> :::success **Julia for High-Performance Scientific Computing — Schedule**: https://hackmd.io/@yonglei/julia-hpc-2024-schedule ::: ## Schedule for Day 1 -- [Intro to Julia](https://enccs.github.io/julia-intro/) | Time (CET) | Time (EET) | Instructors | Contents | | :---------: | :---------: | :---------: | :------: | | 09:30-09:45 | 10:30-10:45 | Yonglei | Welcome | | 09:45-10:00 | 10:45-11:00 | Yonglei | Motivation (Intro to Julia) | | 10:00-10:50 | 11:00-11:50 | Yonglei | Julia syntax | | 10:50-11:00 | 11:50-12:00 | | Break | | 11:00-12:00 | 12:00-13:00 | Jaan | Special Julia features | | 12:00-13:00 | 13:00-14:00 | | ==Lunch Break== | | 13:00-14:00 | 14:00-15:00 | Jaan | Developing in Julia | | 14:00-14:15 | 15:00-15:15 | Jaan | Package ecosystem | | 14:15-14:30 | 15:15-15:30 | | Buffer time, Q&A | --- ## Exercises and Links **Lesson material**: - [Introduction to programming in Julia](https://enccs.github.io/julia-intro/) - [Julia for high-performance scientific computing](https://enccs.github.io/julia-for-hpc/) **Modules on LUMI** ``` module use /appl/local/csc/modulefiles module use julia julia --version ``` **Batch script to submit jobs to LUMI** - Example of the `batch.sh` script: ``` #!/bin/bash #SBATCH --account=project_465001310 #SBATCH --partition=small #SBATCH --time=00:15:00 #SBATCH --nodes=1 #SBATCH --ntasks-per-node=1 #SBATCH --cpus-per-task=1 #SBATCH --mem-per-cpu=1000 module use /appl/local/csc/modulefiles module load julia julia --project=. -e 'using Pkg; Pkg.instantiate()' julia --project=. script.jl ``` - Submit jobs at LUMi using `sbatch batch.sh` --- :::danger You can ask questions about the workshop content at the bottom of this page. We use the Zoom chat only for reporting Zoom problems and such. ::: ## Questions, answers and information ### Motivation & Intro to Julia syntax - can we run the example in a julia notebook in lumi? I'm trying to run a notbook but it keeps telling me that I have no kernnel runnig. - unfortunately no. currently the `julia-jupyter` app is not working. - we have to use `login node shell` to run julia scripts - Python has a massive online community, which is useful to get help on forums or even AI. How about Julia? - Julia has a Discourse forum http://discourse.julialang.org/. Otherwise, other usual forums like StackOverflow can also work. - Can you use external C libraries? OK! - Definitely yes. You can see the examples about how Julia interfacing with C/Python/Fortran. - https://enccs.github.io/julia-for-hpc/interfacing/ - YL will cover this episode during the workshop later. - How do you go into shell mode? - https://enccs.github.io/julia-intro/syntax-intro/#running-julia - use `;` you can get to shell mode - use `backspace` key to get back to julian mode - Maybe I missed this: I cannot run code which uses ' ', only " "? (For instance the function that counts word in the exercise) - Julia is similar to C/C++ in this sense: chars are delimited by single quotes, strings are delimited by double quotes. So double quotes are needed when you want to declare/pass a string to a function. - In Lumi, is there a Julia mode for Emacs? - No. The `help/shell/julian/package manager` modes are from Julia, not from the cluster itself. - Does Julia perform operations byt referencing like python? or does it makes copies of elements everytime an operations is done? - generally speaking, Julia is `call-by-value where the value is a reference`, or `call-by-sharing`, as used by most languages such as python, java, ruby, js... - see the reference from the [wiki](https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_reference) - Is it in general better to use python or julia in HPC computations? For which language there is better support? - this can be described as `productivity` vs `performance` - julia (if you have your code in good efficiency) runs faster than python, but the con is that there might be limited resources/packages to use for your projects. - there are tons of packages/scripts written using python, and there is a good community from which you can have a prompt feedback if you have some questions - in another words, python is `mature` and julia is `developing`. if you have your code in python, why not try to port the code to julia as a small project :laughing: - A general question about 3D plotting: which is the fastest package to use ? I have used Plots.jl and PlotlyJS.jl in the past and I found them quite slow. - Can Julia be sometimes slower than Python? Due to its compilation time? --- ### Special Julia features ### Developing in Julia ### Scientific computing ecosystem - Obsolete link for JuliaOpt https://github.com/JuliaOpt - Is julia package manager compatible with conda or they are completely different things? :::success **Discussion on Scientific computing libraries** Which, if any, libraries and packages do you use for scientific computing? - FFTW, Lapack, GNU Scientific Library, GNU Multiple Precision Arithmetic Library and in Python the standards... numpy, scipy, ... - Spatial packages (e.g. sf, terra for R). Is the spatial analysis ecosystem in Julia well developed? - I don't know how developed they are compared to Terra, but there is a Julia organisation to work on [geospatial data](https://github.com/JuliaEarth/). I am aware of efforts to write a [tutorial book](https://jl.geocompx.org/) for this type of workflows since the ecosystem is a bit more fragmented, but it's still in the early stages. ::: :::warning **Reflections and quick feedback:** One thing that you liked or found useful for your projects? - Package creation - Overall a nice introduction to Julia. Covered a lot of ground, so nice to have a global overview of Julia (+1) +1 One thing that was confusing/suboptimal, or something we should do to improve the learning experience? ::: --- :::info *Always ask questions at the very bottom of this document, right **above** this.* ::: ---