![](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 4</font></b></p> :::success **Julia for High-Performance Scientific Computing — Schedule**: https://hackmd.io/@yonglei/julia-hpc-2024-schedule ::: ## Schedule for Day 4 -- [Julia for HPC](https://enccs.github.io/julia-for-hpc/) | Time (CET) | Time (EET) | Instructors | Contents | | :---------: | :---------: | :---------: | :------: | | 09:30-11:30 | 10:30-12:30 | Jaan, Francesco | GPU computing | | 11:30-12:30 | 12:30-13:30 | | ==Lunch Break== | | 12:30-13:30 | 13:30-14:30 | Jaan, Yonglei | Interfacing to C, Fortran and Python | | 13:30-14:15 | 14:30-15:15 | Francesco, Yonglei | Advanced exercises | | 14:15-14:30 | 15:15-15:30 | | Conclusions and outlook | --- ## 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/) --- :::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 - General question regarding `salloc + srun --pty bash`. Is there a command/way to identify where my bash is currently running? I could type `exit`, but that might exit the ssh session to LUMI. - If you just use `srun --pty bash` without using `salloc` first you should be just nested one level (your prompt should change to the compute node and exiting once will suffice). If you do `salloc+srun` I'm not sure. - If you mean in which node you could run `hostname`. ### GPU programming - Please provide the AMDGPU command that prints the information about the device. - `AMDGPU.HIP.properties(0)` where 0 is the number of the device (numbering starts from 0). A list of devices can be obtained with `AMDGPU.HIP.devices()` - The mouse is not visible, so I totally lost the explanation regarding this code ```i = workitemIdx().x + (workgroupIdx().x - 1) * workgroupDim().x``` - I'm very sorry. I will try to explain it in words now but if it's still unclear we can book a breakout room later :) - The idea is that each thread takes an element of the array. So in a first instance, `i = workitemIdx().x`. Threads are grouped into `workgroups`, and each group is physically located on a compute unit/streaming multiprocessor (the grey block in the GPU image in the lesson material). What can happen is that the number of elements/threads that we want to execute is larger than what can fit onto a single streaming multiprocessor (SM). To circumvent this, we can divide the threads into blocks (`workgroups`), so that each block can be scheduled on whichever SM is available and they can all execute at the same time. The catch is that the `workitemIdx().x` is local to each `workgroup`! So if you imagine that all the `workgroups` are aligned and they all have size `workgroupDim().x`, the 'global' index of each element is `workItemIdx().x + (workgroupIdx().x - 1) * workgroupDim().x` (i.e. the index of the thread in the workgroup it belongs to + all the threads in the workgroups before that). Hope this clarifies! ### Interfacing to C, Fortran, and Python - How can I include `julia.h` into my C programm on LUMI? - If you're using the CSC Julia module, it seems that the installation is under `/appl/local/csc/soft/math/julia/1.11.2/`. In there you can find the `include/julia` folder which contains the header you're looking for and that's the one you should link when you compile the C code. - Thanks. If you need other compilation flags, run `julia /appl/local/csc/soft/math/julia/1.11.2/share/julia/julia-config.jl --allflags` - What are the dependencies of Julia? How can I be sure that there are no version conflicts between Julia dependencies and dependencies of e.g. C++ programm that is based on LUMI/24.03 stack? - I believe Julia only depends on libc from the host, other libraries come with the binary and they are compiled with rpath to use the shipped libraries. I quess enough `LD_LIBRARY_PATH`s could mess us julia though, I have only managed to do it once. --- :::info *Always ask questions at the very bottom of this document, right **above** this.* ::: ---