Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • chat
  • kru0052-master-patch-91081
  • lifecycles
  • master
  • siw019-eff9bb47-patch-65e8
  • 20180621-before_revision
  • 20180621-revision
7 results

Target

Select target project
  • sccs/docs.it4i.cz
  • soj0018/docs.it4i.cz
  • lszustak/docs.it4i.cz
  • jarosjir/docs.it4i.cz
  • strakpe/docs.it4i.cz
  • beranekj/docs.it4i.cz
  • tab0039/docs.it4i.cz
  • davidciz/docs.it4i.cz
  • gui0013/docs.it4i.cz
  • mrazek/docs.it4i.cz
  • lriha/docs.it4i.cz
  • it4i-vhapla/docs.it4i.cz
  • hol0598/docs.it4i.cz
  • sccs/docs-it-4-i-cz-fumadocs
  • siw019/docs-it-4-i-cz-fumadocs
15 results
Select Git revision
  • MPDATABenchmark
  • Urx
  • anselm2
  • hot_fix
  • john_branch
  • master
  • mkdocs_update
  • patch-1
  • pbs
  • salomon_upgrade
  • tabs
  • virtual_environment2
  • 20180621-before_revision
  • 20180621-revision
14 results
Show changes
Showing
with 2487 additions and 0 deletions
# Valgrind
## Introduction
Valgrind is an open-source tool for memory debugging and profiling. It is used mainly for debugging memory-related problems, such as memory leaks, use of uninitalized memory, etc. in C/C++ applications. However, the toolchain has been extended over time with more functionality, such as debugging of threaded applications, cache profiling, not limited only to C/C++.
Valgrind is an extremely useful tool for debugging memory errors such as [off-by-one][a]. Valgrind uses a virtual machine and dynamic recompilation of binary code, so you can expect that programs being debugged by Valgrind run 5-100 times slower.
The main tools available in Valgrind are:
* **Memcheck**, the original, most used and default tool. Verifies memory access in you program and can detect use of uninitialized memory, out of bounds memory access, memory leaks, double free, etc.
* **Massif**, a heap profiler.
* **Hellgrind** and **DRD** can detect race conditions in multi-threaded applications.
* **Cachegrind**, a cache profiler.
* **Callgrind**, a callgraph analyzer.
* For more information, refer to the [official Valgrind documentation][b].
## Installed Versions
For the current list of installed versions, use:
```console
$ ml av Valgrind
```
## Usage
Compile the application which you want to debug as usual. It is advisable to add the compilation flags `-g` (to add debugging information to the binary so that you will see original source code lines in the output) and `-O0` (to disable compiler optimizations).
For example, let us look at this C code, which has two problems:
```cpp
#include <stdlib.h>
void f(void)
{
int* x = malloc(10 * sizeof(int));
x[10] = 0; // problem 1: heap block overrun
} // problem 2: memory leak -- x not freed
int main(void)
{
f();
return 0;
}
```
Now, compile it with the Intel compiler :
```console
$ ml intel/2020b
$ icc -g valgrind-example.c -o valgrind-example
```
Now, let us run it with Valgrind:
`valgrind [valgrind options] <your program binary> [your program options]`
```console
$ ml Valgrind/3.16.1-intel-2020b
```
If no Valgrind options are specified, Valgrind defaults to running the Memcheck tool. For the full description of command line options, refer to the Valgrind documentation.
```console
$ valgrind ./valgrind-example
==12652== Memcheck, a memory error detector
==12652== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==12652== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==12652== Command: ./valgrind-example
==12652==
==12652== Invalid write of size 4
==12652== at 0x40053E: f (valgrind-example.c:6)
==12652== by 0x40054E: main (valgrind-example.c:11)
==12652== Address 0x5861068 is 0 bytes after a block of size 40 alloc'd
==12652== at 0x4C27AAA: malloc (vg_replace_malloc.c:291)
==12652== by 0x400528: f (valgrind-example.c:5)
==12652== by 0x40054E: main (valgrind-example.c:11)
==12652==
==12652==
==12652== HEAP SUMMARY:
==12652== in use at exit: 40 bytes in 1 blocks
==12652== total heap usage: 1 allocs, 0 frees, 40 bytes allocated
==12652==
==12652== LEAK SUMMARY:
==12652== definitely lost: 40 bytes in 1 blocks
==12652== indirectly lost: 0 bytes in 0 blocks
==12652== possibly lost: 0 bytes in 0 blocks
==12652== still reachable: 0 bytes in 0 blocks
==12652== suppressed: 0 bytes in 0 blocks
==12652== Rerun with --leak-check=full to see details of leaked memory
==12652==
==12652== For counts of detected and suppressed errors, rerun with: -v
==12652== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 6 from 6)
```
In the output, we can see that Valgrind has detected both errors - the off-by-one memory access at line 5 and a memory leak of 40 bytes. If we want a detailed analysis of the memory leak, we need to run Valgrind with the `--leak-check=full` option:
```console
$ valgrind --leak-check=full ./valgrind-example
==23856== Memcheck, a memory error detector
==23856== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==23856== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==23856== Command: ./valgrind-example
==23856==
==23856== Invalid write of size 4
==23856== at 0x40067E: f (valgrind-example.c:6)
==23856== by 0x40068E: main (valgrind-example.c:11)
==23856== Address 0x66e7068 is 0 bytes after a block of size 40 alloc'd
==23856== at 0x4C26FDE: malloc (vg_replace_malloc.c:236)
==23856== by 0x400668: f (valgrind-example.c:5)
==23856== by 0x40068E: main (valgrind-example.c:11)
==23856==
==23856==
==23856== HEAP SUMMARY:
==23856== in use at exit: 40 bytes in 1 blocks
==23856== total heap usage: 1 allocs, 0 frees, 40 bytes allocated
==23856==
==23856== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
==23856== at 0x4C26FDE: malloc (vg_replace_malloc.c:236)
==23856== by 0x400668: f (valgrind-example.c:5)
==23856== by 0x40068E: main (valgrind-example.c:11)
==23856==
==23856== LEAK SUMMARY:
==23856== definitely lost: 40 bytes in 1 blocks
==23856== indirectly lost: 0 bytes in 0 blocks
==23856== possibly lost: 0 bytes in 0 blocks
==23856== still reachable: 0 bytes in 0 blocks
==23856== suppressed: 0 bytes in 0 blocks
==23856==
==23856== For counts of detected and suppressed errors, rerun with: -v
==23856== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 6 from 6)
```
Now we can see that the memory leak is due to `malloc()` at line 6.
## Usage With MPI
Although Valgrind is not primarily a parallel debugger, it can be used to debug parallel applications as well. When launching your parallel applications, prepend the valgrind command. For example:
```console
$ mpirun -np 4 valgrind myapplication
```
The default version without MPI support will however report a large number of false errors in the MPI library, such as:
```console
==30166== Conditional jump or move depends on uninitialised value(s)
==30166== at 0x4C287E8: strlen (mc_replace_strmem.c:282)
==30166== by 0x55443BD: I_MPI_Processor_model_number (init_interface.c:427)
==30166== by 0x55439E0: I_MPI_Processor_arch_code (init_interface.c:171)
==30166== by 0x558D5AE: MPID_nem_impi_init_shm_configuration (mpid_nem_impi_extensions.c:1091)
==30166== by 0x5598F4C: MPID_nem_init_ckpt (mpid_nem_init.c:566)
==30166== by 0x5598B65: MPID_nem_init (mpid_nem_init.c:489)
==30166== by 0x539BD75: MPIDI_CH3_Init (ch3_init.c:64)
==30166== by 0x5578743: MPID_Init (mpid_init.c:193)
==30166== by 0x554650A: MPIR_Init_thread (initthread.c:539)
==30166== by 0x553369F: PMPI_Init (init.c:195)
==30166== by 0x4008BD: main (valgrind-example-mpi.c:18)
```
So it is better to use the MPI-enabled Valgrind from the module. The MPI version requires the library `$EBROOTVALGRIND/lib/valgrind/libmpiwrap-amd64-linux.so`
which must be included in the `LD_PRELOAD` environment variable.
Let us look at this MPI example:
```cpp
#include <stdlib.h>
#include <mpi.h>
int main(int argc, char *argv[])
{
int *data = malloc(sizeof(int)*99);
MPI_Init(&argc, &argv);
MPI_Bcast(data, 100, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Finalize();
return 0;
}
```
There are two errors - use of uninitialized memory and invalid length of the buffer. Let us debug it with Valgrind:
```console
$ ml intel/2020b Valgrind/3.16.1-intel-2020b
$ mpicc -g valgrind-example-mpi.c -o valgrind-example-mpi
$ mpirun -np 2 -env LD_PRELOAD $EBROOTVALGRIND/lib/valgrind/libmpiwrap-amd64-linux.so valgrind ./valgrind-example-mpi
```
Prints this output (note that there is an output printed for every launched MPI process):
```console
==31318== Memcheck, a memory error detector
==31318== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==31318== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==31318== Command: ./valgrind-example-mpi
==31318==
==31319== Memcheck, a memory error detector
==31319== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==31319== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==31319== Command: ./valgrind-example-mpi
==31319==
valgrind MPI wrappers 31319: Active for pid 31319
valgrind MPI wrappers 31319: Try MPIWRAP_DEBUG=help for possible options
valgrind MPI wrappers 31318: Active for pid 31318
valgrind MPI wrappers 31318: Try MPIWRAP_DEBUG=help for possible options
==31319== Unaddressable byte(s) found during client check request
==31319== at 0x4E35974: check_mem_is_addressable_untyped (libmpiwrap.c:960)
==31319== by 0x4E5D0FE: PMPI_Bcast (libmpiwrap.c:908)
==31319== by 0x400911: main (valgrind-example-mpi.c:20)
==31319== Address 0x69291cc is 0 bytes after a block of size 396 alloc'd
==31319== at 0x4C27AAA: malloc (vg_replace_malloc.c:291)
==31319== by 0x4007BC: main (valgrind-example-mpi.c:8)
==31319==
==31318== Uninitialised byte(s) found during client check request
==31318== at 0x4E3591D: check_mem_is_defined_untyped (libmpiwrap.c:952)
==31318== by 0x4E5D06D: PMPI_Bcast (libmpiwrap.c:908)
==31318== by 0x400911: main (valgrind-example-mpi.c:20)
==31318== Address 0x6929040 is 0 bytes inside a block of size 396 alloc'd
==31318== at 0x4C27AAA: malloc (vg_replace_malloc.c:291)
==31318== by 0x4007BC: main (valgrind-example-mpi.c:8)
==31318==
==31318== Unaddressable byte(s) found during client check request
==31318== at 0x4E3591D: check_mem_is_defined_untyped (libmpiwrap.c:952)
==31318== by 0x4E5D06D: PMPI_Bcast (libmpiwrap.c:908)
==31318== by 0x400911: main (valgrind-example-mpi.c:20)
==31318== Address 0x69291cc is 0 bytes after a block of size 396 alloc'd
==31318== at 0x4C27AAA: malloc (vg_replace_malloc.c:291)
==31318== by 0x4007BC: main (valgrind-example-mpi.c:8)
==31318==
==31318==
==31318== HEAP SUMMARY:
==31318== in use at exit: 3,172 bytes in 67 blocks
==31318== total heap usage: 191 allocs, 124 frees, 81,203 bytes allocated
==31318==
==31319==
==31319== HEAP SUMMARY:
==31319== in use at exit: 3,172 bytes in 67 blocks
==31319== total heap usage: 175 allocs, 108 frees, 48,435 bytes allocated
==31319==
==31318== LEAK SUMMARY:
==31318== definitely lost: 408 bytes in 3 blocks
==31318== indirectly lost: 256 bytes in 1 blocks
==31318== possibly lost: 0 bytes in 0 blocks
==31318== still reachable: 2,508 bytes in 63 blocks
==31318== suppressed: 0 bytes in 0 blocks
==31318== Rerun with --leak-check=full to see details of leaked memory
==31318==
==31318== For counts of detected and suppressed errors, rerun with: -v
==31318== Use --track-origins=yes to see where uninitialised values come from
==31318== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 4 from 4)
==31319== LEAK SUMMARY:
==31319== definitely lost: 408 bytes in 3 blocks
==31319== indirectly lost: 256 bytes in 1 blocks
==31319== possibly lost: 0 bytes in 0 blocks
==31319== still reachable: 2,508 bytes in 63 blocks
==31319== suppressed: 0 bytes in 0 blocks
==31319== Rerun with --leak-check=full to see details of leaked memory
==31319==
==31319== For counts of detected and suppressed errors, rerun with: -v
==31319== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)
```
We can see that Valgrind has reported use of the uninitialized memory on the master process (which reads the array to be broadcast) and use of the unaddressable memory on both processes.
[1]: ../../modules-matrix.md
[a]: http://en.wikipedia.org/wiki/Off-by-one_error
[b]: http://valgrind.org/docs/
# Vampir
## Introduction
Vampir is a commercial trace analysis and visualization tool. It works with traces in OTF and OTF2 formats. It does not have the functionality to collect traces, so you need to use a trace collection tool (such as [Score-P][1]) first to collect the traces.
![](../../img/Snmekobrazovky20160708v12.33.35.png)
## Installed Versions
For the current list of installed versions, use:
```console
$ ml av Vampir
```
## User Manual
To find the detailed user manual in PDF format, type
```console
$ ls $EBROOTVAMPIR/doc/vampir-manual.pdf
```
## References
1. [Web site][a]
[1]: score-p.md
[a]: https://www.vampir.eu
# EESSI
EESSI stands for the European Environment for Scientific Software Installations - a collaboration between different European partners in HPC community.
The goal of this project is to build a common stack of scientific software installations for HPC systems and beyond, including laptops, personal workstations, and cloud infrastructure.
For more information, see the [official EESSI documentation][1].
## EESSI on IT4I
The EESSI project is available on login, cn, and acn nodes on both Barbora and Karolina.
To use the EESSI software installations, load the environment using the command:
```console
source /cvmfs/software.eessi.io/versions/2023.06/init/bash
```
You can then use the `ml av` command to see the list of all EESSI and IT4I modules. EESSI modules will be listed first:
```console
{EESSI 2023.06} $ ml av
---- /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/intel/skylake_avx512/modules/all ----
Abseil/20230125.2-GCCcore-12.2.0
Abseil/20230125.3-GCCcore-12.3.0 (D)
ALL/0.9.2-foss-2023a
AOFlagger/3.4.0-foss-2023b
archspec/0.2.1-GCCcore-12.3.0
Armadillo/11.4.3-foss-2022b
Armadillo/12.6.2-foss-2023a
Armadillo/12.8.0-foss-2023b (D)
arpack-ng/3.8.0-foss-2022b
arpack-ng/3.9.0-foss-2023a
arpack-ng/3.9.0-foss-2023b (D)
arrow-R/11.0.0.3-foss-2022b-R-4.2.2
arrow-R/14.0.1-foss-2023a-R-4.3.2 (D)
Arrow/11.0.0-gfbf-2022b
Arrow/14.0.1-gfbf-2023a (D)
ASE/3.22.1-gfbf-2022b
at-spi2-atk/2.38.0-GCCcore-12.2.0
at-spi2-atk/2.38.0-GCCcore-12.3.0 (D)
at-spi2-core/2.46.0-GCCcore-12.2.0
at-spi2-core/2.49.91-GCCcore-12.3.0 (D)
lines 1-22
```
## Exiting EESSI Environment
To exit EESSI environment, you must log out of the supercomputer.
## Bugs & Issues
You can see the list of issues and report bugs on the [project's issue GitHub page][2].
[1]: https://www.eessi.io/docs/overview/
[2]: https://github.com/EESSI/software-layer/issues
# Intel Advisor
## Introduction
Intel Advisor is a tool aiming to assist you in vectorization and threading of your code. You can use it to profile your application and identify loops that could benefit from vectorization and/or threading parallelism.
## Installed Versions
For the current list of installed versions, use:
```console
$ ml av Advisor
```
## Usage
Your program should be compiled with the `-g` switch to include symbol names. You should compile with `-O2` or higher to see code that is already vectorized by the compiler.
Profiling is possible either directly from the GUI or from the command line.
To profile from the GUI, launch Advisor:
```console
$ advixe-gui
```
Then select the menu *File -> New -> Project*. Choose a directory to which the project data is saved. After clicking OK, the *Project properties* window appears, where you can configure the path to your binary, launch arguments, working directory, etc. After clicking OK, the project is ready.
In the left pane, you can switch between *Vectorization* and *Threading* workflows. Each has several possible steps, which you can execute by clicking the *Collect* button. Alternatively, you can click on *Command Line* to see the command line required to run the analysis directly from the command line.
## References
1. [Intel® Advisor 2022 Tutorial: Get Started with Intel® Advisor][a]
1. [Product page][b]
1. [Documentation][c]
[a]: https://www.intel.com/content/www/us/en/develop/documentation/get-started-with-advisor/top.html
[b]: https://software.intel.com/en-us/intel-advisor-xe
[c]: https://www.intel.com/content/www/us/en/develop/documentation/advisor-user-guide/top.html
# Intel Compilers
## Introduction
Intel compilers are compilers for Intel processor-based systems, available for Microsoft Windows, Linux, and macOS operating systems.
## Installed Versions
!!! important "New Compilers in intel/2023a Module"
An `intel/2023a` module has been installed on the Karolina and Barbora clusters.
This module contains new compilers `icx`, `icpx`, and `ifx`.<br>
See the porting guides for [ICC Users to DPCPP or ICX][b] or for [Intel® Fortran Compiler][c].
Intel compilers are available in multiple versions via the `intel` module. The compilers include the icc C and C++ compiler and the ifort Fortran 77/90/95 compiler.
For the current list of installed versions, use:
```console
$ ml av intel/
```
```console
$ ml intel/2020b
$ icc -v
icc version 19.1.3.304 (gcc version 10.2.0 compatibility)
$ ifort -v
ifort version 19.1.3.304
```
## Instructions Vectorization
Intel compilers provide vectorization of the code via the AVX-2/AVX-512 instructions and support threading parallelization via OpenMP.
For maximum performance on the Barbora cluster compute nodes, compile your programs using the AVX-512 instructions, with reporting where the vectorization was used. We recommend the following compilation options for high performance.
!!! info
Barbora non-accelerated nodes support AVX-512 instructions (cn1-cn192).
```console
$ icc -ipo -O3 -xCORE-AVX512 -qopt-report1 -qopt-report-phase=vec myprog.c mysubroutines.c -o myprog.x
```
In this example, we compile the program enabling interprocedural optimizations between source files (`-ipo`), aggressive loop optimizations (`-O3`), and vectorization (`-xCORE-AVX512`).
For maximum performance on the Barbora GPU nodes or Karolina cluster compute nodes, compile your programs using the AVX-2 instructions, with reporting where the vectorization was used. We recommend the following compilation options for high performance.
```console
$ icc -ipo -O3 -xCORE-AVX2 -qopt-report1 -qopt-report-phase=vec myprog.c mysubroutines.c -o myprog.x
```
!!! warning
Karolina cluster has AMD cpu, use compiler options `-march=core-avx2`.
In this example, we compile the program enabling interprocedural optimizations between source files (`-ipo`), aggressive loop optimizations (`-O3`), and vectorization (`-xCORE-AVX2`).
The compiler recognizes the omp, simd, vector, and ivdep pragmas for OpenMP parallelization and AVX2 vectorization. Enable the OpenMP parallelization by the `-openmp` compiler switch.
```console
$ icc -ipo -O3 -xCORE-AVX2 -qopt-report1 -qopt-report-phase=vec -openmp myprog.c mysubroutines.c -o myprog.x
```
Read more [here][a].
[a]: https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top.html
[b]: https://www.intel.com/content/www/us/en/developer/articles/guide/porting-guide-for-icc-users-to-dpcpp-or-icx.html
[c]: https://www.intel.com/content/www/us/en/developer/articles/guide/porting-guide-for-ifort-to-ifx.html?wapkw=ifx
# Intel Inspector
## Introduction
Intel Inspector is a dynamic memory and threading error-checking tool for C/C++/Fortran applications. It can detect issues such as memory leaks, invalid memory references, uninitialized variables, race conditions, deadlocks, etc.
## Installed Versions
For the current list of installed versions, use:
```console
$ ml av Inspector
```
## Usage
Your program should be compiled with the `-g` switch to include symbol names. Optimizations can be turned on.
Debugging is possible either directly from the GUI, or from command line.
### GUI Mode
To debug from GUI, launch Inspector:
```console
$ inspxe-gui &
```
Then select the *File -> New -> Project* menu. Choose a directory to which the project data is saved. After clicking OK, the *Project properties* window appears, where you can configure the path to your binary, launch arguments, working directory, etc. After clicking OK, the project is ready.
In the main pane, you can start a predefined analysis type or define your own. Click *Start* to start the analysis. Alternatively, you can click on *Command Line*, to see the command line required to run the analysis directly from the command line.
### Batch Mode
Analysis can be also run from the command line in batch mode. Batch mode analysis is run with the `inspxe-cl` command. To obtain the required parameters, consult the documentation or configure the analysis in the GUI and then click the *Command Line* button in the lower right corner to the respective command line.
Results obtained from batch mode can be then viewed in the GUI by selecting *File -> Open -> Result...*.
## References
1. [Product page, Documentation and Release Notes][a]
1. [Tutorials][b]
[a]: https://www.intel.com/content/www/us/en/developer/tools/oneapi/inspector.html
[c]: https://www.intel.com/content/www/us/en/developer/articles/training/inspector-tutorials.html
# Intel IPP
## Introduction
Intel Integrated Performance Primitives is a very rich library of highly optimized algorithmic building blocks for media and data applications. This includes signal, image, and frame processing algorithms, such as FFT, FIR, Convolution, Optical Flow, Hough transform, Sum, MinMax, as well as cryptographic functions, linear algebra functions, and many more.
## Installed Versions
For the current list of installed versions, use:
```console
$ ml av ipp
```
## IPP Example
```cpp
#include "ipp.h"
#include <stdio.h>
int main(int argc, char* argv[])
{
const IppLibraryVersion *lib;
Ipp64u fm;
IppStatus status;
status= ippInit(); //IPP initialization with the best optimization layer
if( status != ippStsNoErr ) {
printf("IppInit() Error:n");
printf("%sn", ippGetStatusString(status) );
return -1;
}
//Get version info
lib = ippiGetLibVersion();
printf("%s %sn", lib->Name, lib->Version);
//Get CPU features enabled with selected library level
fm=ippGetEnabledCpuFeatures();
printf("SSE :%cn",(fm>1)&1?'Y':'N');
printf("SSE2 :%cn",(fm>2)&1?'Y':'N');
printf("SSE3 :%cn",(fm>3)&1?'Y':'N');
printf("SSSE3 :%cn",(fm>4)&1?'Y':'N');
printf("SSE41 :%cn",(fm>6)&1?'Y':'N');
printf("SSE42 :%cn",(fm>7)&1?'Y':'N');
printf("AVX :%cn",(fm>8)&1 ?'Y':'N');
printf("AVX2 :%cn", (fm>15)&1 ?'Y':'N' );
printf("----------n");
printf("OS Enabled AVX :%cn", (fm>9)&1 ?'Y':'N');
printf("AES :%cn", (fm>10)&1?'Y':'N');
printf("CLMUL :%cn", (fm>11)&1?'Y':'N');
printf("RDRAND :%cn", (fm>13)&1?'Y':'N');
printf("F16C :%cn", (fm>14)&1?'Y':'N');
return 0;
}
```
Compile the example above, using any compiler and the `ipp` module:
```console
$ ml intel/2020b ipp/2020.3.304
$ icc testipp.c -o testipp.x -lippi -lipps -lippcore
```
You will need the `ipp` module loaded to run an IPP-enabled executable. This may be avoided, by compiling library search paths into the executable:
```console
$ ml intel/2020b ipp/2020.3.304
$ icc testipp.c -o testipp.x -Wl,-rpath=$LIBRARY_PATH -lippi -lipps -lippcore
```
## Code Samples and Documentation
Intel provides a number of [Code Samples for IPP][a], illustrating use of IPP.
Read the full documentation on IPP on the [Intel website][b], in particular the [IPP Reference manual][c].
[a]: https://software.intel.com/en-us/articles/code-samples-for-intel-integrated-performance-primitives-library
[b]: http://software.intel.com/sites/products/search/search.php?q=&x=15&y=6&product=ipp&version=7.1&docos=lin
[c]: http://software.intel.com/sites/products/documentation/doclib/ipp_sa/71/ipp_manual/index.htm
# Intel MKL
## Introduction
Intel Math Kernel Library (Intel MKL) is a library of math kernel subroutines, extensively threaded and optimized for maximum performance. Intel MKL provides these basic math kernels:
* BLAS (level 1, 2, and 3) and LAPACK linear algebra routines, offering vector, vector-matrix, and matrix-matrix operations.
* The PARDISO direct sparse solver, an iterative sparse solver, and supporting sparse BLAS (level 1, 2, and 3) routines for solving sparse systems of equations.
* ScaLAPACK distributed processing linear algebra routines for Linux and Windows operating systems, as well as the Basic Linear Algebra Communications Subprograms (BLACS) and the Parallel Basic Linear Algebra Subprograms (PBLAS).
* Fast Fourier transform (FFT) functions in one, two, or three dimensions with support for mixed radices (not limited to sizes that are powers of 2), as well as distributed versions of these functions.
* Vector Math Library (VML) routines for optimized mathematical operations on vectors.
* Vector Statistical Library (VSL) routines, which offer high-performance vectorized random number generators (RNG) for several probability distributions, convolution and correlation routines, and summary statistics functions.
* Data Fitting Library, which provides capabilities for spline-based approximation of functions, derivatives and integrals of functions, and search.
* Extended Eigensolver, a shared memory version of an eigensolver based on the Feast Eigenvalue Solver.
For details, see the [Intel MKL Reference Manual][a].
## Installed Versions
For the current list of installed versions, use:
```console
$ ml av imkl
```
The module sets up environment variables, required for linking and running MKL-enabled applications. The most important variables are the `$MKLROOT`, `$CPATH`, `$LD_LIBRARY_PATH`, and `$MKL_EXAMPLES`.
The Intel MKL library may be linked using any compiler. With the Intel compiler, use the `-mkl` option to link default threaded MKL.
### Interfaces
The Intel MKL library provides a number of interfaces. The fundamental ones are LP64 and ILP64. The Intel MKL ILP64 libraries use the 64-bit integer type (necessary for indexing large arrays, with more than 231^-1 elements), whereas the LP64 libraries index arrays with the 32-bit integer type.
| Interface | Integer type |
| --------- | -------------------------------------------- |
| LP64 | 32-bit, int, integer(kind=4), MPI_INT |
| ILP64 | 64-bit, long int, integer(kind=8), MPI_INT64 |
### Linking
Linking the Intel MKL libraries may be complex. Intel [mkl link line advisor][b] helps. See also [examples][1] below.
You will need the `mkl` module loaded to run the MKL-enabled executable. This may be avoided, by compiling library search paths into the executable. Include `-rpath` on the compile line:
```console
$ icc .... -Wl,-rpath=$LIBRARY_PATH ...
```
### Threading
Advantage in using the Intel MKL library is that it brings threaded parallelization to applications that are otherwise not parallel.
For this to work, the application must link the threaded MKL library (default). Number and behavior of MKL threads may be controlled via the OpenMP environment variables, such as `OMP_NUM_THREADS` and `KMP_AFFINITY`. `MKL_NUM_THREADS` takes precedence over `OMP_NUM_THREADS`.
```console
$ export OMP_NUM_THREADS=24
$ export KMP_AFFINITY=granularity=fine,compact,1,0
```
The application will run with 24 threads with affinity optimized for fine grain parallelization.
## Examples
A number of examples demonstrating use of the Intel MKL library and its linking is available on clusters, in the $MKL_EXAMPLES directory. In the examples below, we demonstrate linking Intel MKL to Intel- and GNU-compiled program for multi-threaded matrix multiplication.
### Working With Examples
```console
$ ml intel/2020b
$ cp -a $MKL_EXAMPLES/cblas /tmp/
$ cd /tmp/cblas
$ make sointel64 function=cblas_dgemm
```
In this example, we compile, link, and run the cblas_dgemm example, demonstrating use of the MKL example suite installed on clusters.
### Example: MKL and Intel Compiler
```console
$ ml intel/2020b
$ cp -a $MKL_EXAMPLES/cblas /tmp/
$ cd /tmp/cblas
$ icc -w source/cblas_dgemmx.c source/common_func.c -mkl -o cblas_dgemmx.x
$ ./cblas_dgemmx.x data/cblas_dgemmx.d
```
In this example, we compile, link, and run the cblas_dgemm example, demonstrating use of MKL with the `icc -mkl` option. Using the `-mkl` option is equivalent to:
```console
$ icc -w source/cblas_dgemmx.c source/common_func.c -o cblas_dgemmx.x -I$MKL_INC_DIR -L$MKL_LIB_DIR -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5
```
In this example, we compile and link the cblas_dgemm example, using LP64 interface to threaded MKL and Intel OMP threads implementation.
#### Karolina AMD Threading
Threading on Karolina AMD processors requires [TBB][2].
**MKL threads**
Example 1
```code
icpc -O2 -qopenmp -DMKL_ILP64 -I"${MKLROOT}/include" source.cpp -o program.x -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_tbb_thread -lmkl_core -ltbb -lstdc++ -lp
thread -lm -ldl
```
Example 2
```code
icpc -qopenmp mkltest.cpp -o mkltest.x -lmkl_tbb_thread -ltbb -mkl
```
**Intel/GNU compilator**
```code
[Monday 10:23 AM] Krupcik Lukas
g++ -fopenmp mkl_test.cpp -o test -lmkl_tbb_thread -lmkl_core -lmkl_intel_ilp64 -ltbb
```
## LAPACKE C Interface
MKL includes LAPACKE C Interface to LAPACK. However, note that although Intel is the author of LAPACKE, the LAPACKE header files are not present in MKL. For this reason, we have prepared the LAPACKE module, which includes Intel's LAPACKE headers from official LAPACK, which you can use to compile code using the LAPACKE interface against MKL.
## Further Reading
Read more on [Intel website][c], in particular the [MKL user guide][d].
[1]: #examples
[2]: ../intel-tbb/
[a]: http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mklman/index.htm
[b]: http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
[c]: http://software.intel.com/en-us/intel-mkl
[d]: https://software.intel.com/en-us/intel-mkl/documentation/linux
# Intel Parallel Studio
All clusters provide following elements of the Intel Parallel Studio XE
Intel Parallel Studio XE
* Intel Compilers
* Intel Debugger
* Intel MKL Library
* Intel Integrated Performance Primitives Library
* Intel Threading Building Blocks Library
* Intel Trace Analyzer and Collector
* Intel Advisor
* Intel Inspector
## Intel Compilers
The Intel compilers are available via the intel module. The compilers include the icc C and C++ compiler and the ifort Fortran 77/90/95 compiler.
```console
$ ml intel/2020b
$ icc -v
icc version 19.1.3.304 (gcc version 10.2.0 compatibility)
$ ifort -v
ifort version 19.1.3.304
```
Read more at the [Intel Compilers][1] page.
## Intel Math Kernel Library
Intel Math Kernel Library (Intel MKL) is a library of math kernel subroutines, extensively threaded and optimized for maximum performance. Intel MKL unites and provides these basic components: BLAS, LAPACK, ScaLapack, PARDISO, FFT, VML, VSL, Data fitting, Feast Eigensolver, and many more.
```console
$ ml imkl/2020.4.304-iimpi-2020b
```
Read more at the [Intel MKL][3] page.
## Intel Integrated Performance Primitives
Intel Integrated Performance Primitives, version 7.1.1, compiled for AVX is available via the `ipp` module. IPP is a library of highly optimized algorithmic building blocks for media and data applications. This includes signal, image, and frame processing algorithms, such as FFT, FIR, Convolution, Optical Flow, Hough transform, Sum, MinMax, and many more.
```console
$ ml ipp/2020.3.304
```
Read more at the [Intel IPP][4] page.
## Intel Threading Building Blocks
Intel Threading Building Blocks (Intel TBB) is a library that supports scalable parallel programming using standard ISO C++ code. It does not require special languages or compilers. It is designed to promote scalable data parallel programming. Additionally, it fully supports nested parallelism, so you can build larger parallel components from smaller parallel components. To use the library, you specify tasks, not threads, and let the library map tasks onto threads in an efficient manner.
```console
$ ml tbb/2020.3-GCCcore-10.2.0
```
Read more at the [Intel TBB][5] page.
[1]: intel-compilers.md
[2]: intel-debugger.md
[3]: intel-mkl.md
[4]: intel-integrated-performance-primitives.md
[5]: intel-tbb.md
# Intel TBB
## Introduction
Intel Threading Building Blocks (Intel TBB) is a library that supports scalable parallel programming using standard ISO C++ code. It does not require special languages or compilers. To use the library, you specify tasks, not threads, and let the library map tasks onto threads in an efficient manner.
## Installed Versions
For the current list of installed versions, use:
```console
$ ml av tbb
```
The module sets up environment variables, required for linking and running TBB-enabled applications.
Link the TBB library using `-ltbb`.
## Examples
A number of examples demonstrating use of TBB and its built-in scheduler is available in the $TBB_EXAMPLES directory.
```console
$ ml intel/2020b tbb/2020.3-GCCcore-10.2.0
$ cp -a $TBB_EXAMPLES/common $TBB_EXAMPLES/parallel_reduce /tmp/
$ cd /tmp/parallel_reduce/primes
$ icc -O2 -DNDEBUG -o primes.x main.cpp primes.cpp -ltbb
$ ./primes.x
```
In this example, we compile, link, and run the primes example, demonstrating use of parallel task-based reduce in computation of prime numbers.
You will need the `tbb` module loaded to run the TBB-enabled executable. This may be avoided by compiling library search paths into the executable.
```console
$ icc -O2 -o primes.x main.cpp primes.cpp -Wl,-rpath=$LIBRARY_PATH -ltbb
```
## Further Reading
Read more on Intel [website][a].
[a]: https://www.intel.com/content/www/us/en/developer/articles/guide/get-started-with-tbb.html?wapkw=tbb
# Intel Trace Analyzer and Collector
## Introduction
Intel Trace Analyzer and Collector (ITAC) is a tool to collect and graphically analyze behavior of MPI applications. It helps you to analyze communication patterns of your application, identify hotspots, perform correctness checking (identify deadlocks, data corruption, etc.), and simulate how your application would run on a different interconnect.
ITAC is an offline analysis tool - first you run your application to collect a trace file, then you can open the trace in a GUI analyzer to view it.
## Installed Versions
For the current list of installed versions, use:
```console
$ ml av itac
```
## Collecting Traces
ITAC can collect traces from applications that are using Intel MPI. To generate a trace, simply add the `-trace` option to your `mpirun` command:
```console
$ ml itac/2020.3.036
$ mpirun -trace myapp
```
The trace will be saved in the myapp.stf file in the current directory.
## Viewing Traces
To view and analyze the trace, open the ITAC GUI in a [graphical environment][1]:
```console
$ ml itac/2020.3.036
$ traceanalyzer
```
The GUI will launch and you can open the produced `*`.stf file.
![](../../../img/Snmekobrazovky20151204v15.35.12.png)
Refer to the Intel documenation about usage of the GUI tool.
## References
1. [Getting Started with Intel® Trace Analyzer and Collector][a]
1. [Intel® Trace Analyzer and Collector - Documentation][b]
[1]: ../../../general/accessing-the-clusters/graphical-user-interface/x-window-system.md
[a]: https://software.intel.com/en-us/get-started-with-itac-for-linux
[b]: https://software.intel.com/en-us/intel-trace-analyzer
# ISV Licenses
## Guide to Managing Independent Software Vendor Licenses
On IT4I clusters, there are also installed commercial software applications, also known as ISV (Independent Software Vendor), which are subjects to licensing. Licenses are limited and their usage may be restricted only to some users or user groups, or based on other conditions.
Currently, [Flex License Manager][c] based licensing is supported on the cluster for products ANSYS, Comsol, and MATLAB. More information about the applications can be found in the general software section.
If an ISV application was purchased for educational (research) purposes and also for commercial purposes, then there are always two separate versions maintained and suffix "edu" is used in the name of the non-commercial version.
## Overview of the Licenses Usage
!!! note
The overview is generated every minute and is accessible from the web or command line interface.
### Web Interface
For each license, there is a [table][a] providing the information about the name, number of available (purchased/licensed), number of used and number of free license features.
### Command Line
To check license usage via command line, use the `LicenseChecker` module with the `lmstat` utility:
```console
ml LicenseChecker/1.0
```
For example, to check usage of Ansys licenses, use:
```console
lmstat -a -c 1055@license.it4i.cz
```
or for a specific module (e.g. HPC):
```console
lmstat -f aa_r_hpc -c 1055@license.it4i.cz
```
To list all Ansys modules, use:
```console
lmstat -i -c 1055@license.it4i.cz
```
For other applications' licenses, change the port number in the command according to the **Port** column on the [licelin website][b] (requires IT4I VPN).
[1]: #Licence
[a]: https://extranet.it4i.cz/rsweb/karolina/licenses
[b]: http://licelin.it4i.cz/list/
[c]: https://www.revenera.com/software-monetization/products/software-licensing/flexnet-licensing
# Karolina Compilation
Since Karolina's nodes are equipped with AMD Zen 2 and Zen 3 processors,
we recommend to follow these instructions in order to avoid degraded performance when compiling your code:
## 1. Select Compilers Flags
When compiling your code, it is important to select right compiler flags;
otherwise, the code will not be SIMD vectorized, resulting in severely degraded performance.
Depending on the compiler, you should use these flags:
!!! important
`-Ofast` optimization may result in unpredictable behavior (e.g. a floating point overflow).
| Compiler | Module | Command | Flags |
| -------- |----------| --------|-------------------------|
| AOCC | ml AOCC | clang |-O3 -mavx2 -march=znver2 |
| INTEL | ml intel | icc |-O3 -xCORE-AVX2 |
| GCC | ml GCC | gcc |-O3 -mavx2 |
The compiler flags and the resulting compiler performance may be verified with our benchmark,
see [Lorenz Compiler performance benchmark][a].
## 2. Use BLAS Library
It is important to use the BLAS library that performs well on AMD processors.
To combine the optimizations for the general CPU code and have the most efficient BLAS routines we recommend the combination of lastest Intel Compiler suite, with Cray's Scientific Library bundle (LibSci). When using the Intel Compiler suite includes also support for efficient MPI implementation utilizing Intel MPI library over the Infiniband interconnect.
For the compilation as well for the runtime of compiled code use:
```code
ml PrgEnv-intel
ml cray-pmi/6.1.14
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CRAY_LD_LIBRARY_PATH:$CRAY_LIBSCI_PREFIX_DIR/lib:/opt/cray/pals/1.3.2/lib
```
There are usually two standard situation how to compile and run the code
### OpenMP Without MPI
To compile the code against the LibSci, without MPI, but still enabling OpenMP run over multiple cores use:
```code
icx -qopenmp -L$CRAY_LIBSCI_PREFIX_DIR/lib -I$CRAY_LIBSCI_PREFIX_DIR/include -o BINARY.x SOURCE_CODE.c -lsci_intel_mp
```
To run the resulting binary use:
```code
OMP_NUM_THREADS=128 OMP_PROC_BIND=true BINARY.x
```
This enables effective run over all 128 cores available on a single Karlina compute node.
### OpenMP With MPI
To compile the code against the LibSci, with MPI, use:
```code
mpiicx -qopenmp -L$CRAY_LIBSCI_PREFIX_DIR/lib -I$CRAY_LIBSCI_PREFIX_DIR/include -o BINARY.x SOURCE_CODE.c -lsci_intel_mp -lsci_intel_mpi_mp
```
To run the resulting binary use:
```code
OMP_NUM_THREADS=64 OMP_PROC_BIND=true mpirun -n 2 ${HOME}/BINARY.x
```
This example runs the BINARY.x, placed in ${HOME} as 2 MPI processes, each using 64 cores of a single socket of a single node.
Another example would be to run a job on 2 full nodes, utilizing 128 cores on each (so 256 cores in total) and letting the LibSci efficiently placing the BLAS routines across the allocated CPU sockets:
```code
OMP_NUM_THREADS=128 OMP_PROC_BIND=true mpirun -n 2 ${HOME}/BINARY.x
```
This assumes you have allocated 2 full nodes on Karolina using SLURM's directives, e. g. in a submission script:
```code
#SBATCH --nodes 2
#SBATCH --ntasks-per-node 128
```
**Don't forget** before the run to ensure you have the correct modules and loaded and that you have set up the LD_LIBRARY_PATH environment variable set as shown above (e.g. part of your submission script for SLURM).
!!! note
Most MPI libraries do the binding automatically. The binding of MPI ranks can be inspected for any MPI by running `$ mpirun -n num_of_ranks numactl --show`. However, if the ranks spawn threads, binding of these threads should be done via the environment variables described above.
The choice of BLAS library and its performance may be verified with our benchmark,
see [Lorenz BLAS performance benchmark](https://code.it4i.cz/jansik/lorenz/-/blob/main/README.md).
# Conda (Anaconda)
Conda is an open source package management system and environment management system that runs on Windows, macOS, and Linux. Conda quickly installs, runs, and updates packages and their dependencies. Conda easily creates, saves, loads, and switches between environments on your local computer. It was created for Python programs, but it can package and distribute software for any language.
Conda as a package manager helps you find and install packages. If you need a package that requires a different version of Python, you do not need to switch to a different environment manager, because Conda is also an environment manager. With just a few commands, you can set up a completely separate environment to run that different version of Python, while continuing to run your usual version of Python in your normal environment.
Conda treats Python the same as any other package, so it is easy to manage and update multiple installations.
Anaconda supports Python 3.X. Default Python is 3.8, depending on which installer you used.
## Conda on the IT4Innovations Clusters
On the clusters, we have the Anaconda3 software installed. How to use these modules is shown below.
!!! note
Use the `ml av conda` command to get up-to-date versions of the modules.
```console
$ ml av conda
------------- /apps/modules/lang ---------------------------------
Anaconda3/2021.05
```
## Anaconda3
Default Python is 3.8.8.
### First Usage Module Anaconda3
```console
$ ml Anaconda3/2021.05
$ python --version
Python 3.8.8
$ conda install numpy
Fetching package metadata .........
Solving package specifications: .
Package plan for installation in environment /apps/all/Anaconda3/2021.05:
The following packages will be UPDATED:
conda 4.10.1-py38h06a4308_1 --> 4.10.3-py38h06a4308_0
...
...
...
CondaIOError: Missing write permissions in: /apps/all/Anaconda3/2021.05
#
# You don't appear to have the necessary permissions to install packages
# into the install area '/apps/all/Anaconda3/2021.05'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone="/apps/all/Anaconda3/2021.05"
$
$ conda create -n anaconda3 --clone="/apps/all/Anaconda3/2021.05"
Source: /apps/all/Anaconda3/2021.05
Destination: /home/user/.conda/envs/anaconda3
The following packages cannot be cloned out of the root environment:
- defaults/linux-64::conda-env-2.6.0-1
- defaults/linux-64::conda-4.10.3-py38h06a4308_0
- defaults/noarch::conda-token-0.3.0-pyhd3eb1b0_0
- defaults/linux-64::anaconda-navigator-2.0.3-py38_0
- defaults/linux-64::conda-build-3.21.4-py38h06a4308_0
Packages: 339
Files: 50986
...
...
...
#
# To activate this environment, use:
# > source activate anaconda3
#
# To deactivate this environment, use:
# > source deactivate anaconda3
#
$ source activate anaconda3
(anaconda3) ~]$
```
### Usage Module Anaconda3
```console
$ ml Anaconda3/2021.05
$ source activate anaconda3
(anaconda3) ~]$
```
# CSharp
C# is available on the cluster.
```console
$ ml av mono
-------------------- /apps/modules/lang ---------------
Mono/6.12.0.122
```
!!! note
Use the `ml av mono` command to get up-to-date versions of the modules.
Activate C# by loading the Mono module:
```console
$ ml Mono/6.12.0.122
```
## Examples
### Hello World
Copy this code to a new file hello.cs:
```csc
using System;
class HelloWorld {
static void Main() {
Console.WriteLine("Hello world!!!");
}
}
```
Compile the program and make *Windows executable*.
```console
$ mcs -out:hello.exe hello.cs
```
Now run the program:
```console
$ mono hello.exe
Hello world!!!
```
### Interactive Console
Type:
```console
$ csharp
Mono C# Shell, type "help;" for help
Enter statements below.
csharp>
```
Now you are in the interactive mode. You can try the following example:
```csc
csharp> using System;
csharp> int a = 5;
csharp> double b = 1.5;
csharp> Console.WriteLine("{0}*{1} is equal to {2}", a,b,a*b);
5*1.5 is equal to 7.5
csharp> a == b
false
```
Show all files modified in last 5 days:
```csc
csharp> using System.IO;
csharp> from f in Directory.GetFiles ("mydirectory")
> let fi = new FileInfo (f)
> where fi.LastWriteTime > DateTime.Now-TimeSpan.FromDays(5) select f;
{ "mydirectory/mynewfile.cs", "mydirectory/script.sh" }
```
<!--
## MPI.NET
MPI is available for mono:
```csc
using System;
using MPI;
class MPIHello
{
static void Main(string[] args)
{
using (new MPI.Environment(ref args))
{
Console.WriteLine("Greetings from node {0} of {1} running on {2}",
Communicator.world.Rank, Communicator.world.Size,
MPI.Environment.ProcessorName);
}
}
}
```
Compile and run the program:
```console
$ qsub -I -A PROJECT_ID -q qexp -l select=2:ncpus=128,walltime=00:30:00
$ ml n.net
$ mcs -out:csc.exe -reference:/apps/tools/mpi.net/1.0.0-mono-3.12.1/lib/MPI.dll csc.cs
$ mpirun -n 4 mono csc.exe
Greetings from node 2 of 4 running on cn204
Greetings from node 0 of 4 running on cn204
Greetings from node 3 of 4 running on cn199
Greetings from node 1 of 4 running on cn199
```
-->
For more information, see the [Mono documentation page][a].
[a]: http://www.mono-project.com/docs/
# Java
Java is available on the cluster. Activate Java by loading the Java module:
```console
$ ml Java/1.8.0_221
```
Note that the Java module must be loaded on the compute nodes as well, in order to run Java on compute nodes.
Check for Java version and path:
```console
$ java -version
$ which java
```
With the module loaded, not only the runtime environment (JRE), but also the development environment (JDK) with the compiler is available.
```console
$ javac -version
$ which javac
```
Java applications may use MPI for inter-process communication, in conjunction with OpenMPI. Read more [here][a]. This functionality is currently not supported. In case you require the Java interface to MPI, contact [support][b].
## Java With OpenMPI
Because there is an increasing interest in using Java for HPC. In addition, MPI can benefit from Java because its widespread use makes it likely to find new uses beyond traditional HPC applications.
Java bindings are integrated into OpenMPI starting from the v1.7 series. Beginning with the v2.0 series, Java bindings include coverage of MPI-3.1.
### Example (Hello.java)
```java
import mpi.*;
class Hello {
static public void main(String[] args) throws MPIException {
MPI.Init(args);
int myrank = MPI.COMM_WORLD.getRank();
int size = MPI.COMM_WORLD.getSize() ;
System.out.println("Hello world from rank " + myrank + " of " + size);
MPI.Finalize();
}
}
```
```console
$ ml Java/1.8.0_221 OpenMPI/4.1.1-GCC-10.2.0-Java-1.8.0_221
$ mpijavac Hello.java
$ mpirun java Hello
Hello world from rank 23 of 28
Hello world from rank 25 of 28
Hello world from rank 0 of 28
Hello world from rank 4 of 28
Hello world from rank 7 of 28
Hello world from rank 8 of 28
Hello world from rank 11 of 28
Hello world from rank 12 of 28
Hello world from rank 13 of 28
Hello world from rank 18 of 28
Hello world from rank 17 of 28
Hello world from rank 24 of 28
Hello world from rank 27 of 28
Hello world from rank 2 of 28
Hello world from rank 3 of 28
Hello world from rank 1 of 28
Hello world from rank 10 of 28
Hello world from rank 14 of 28
Hello world from rank 16 of 28
Hello world from rank 19 of 28
Hello world from rank 26 of 28
Hello world from rank 6 of 28
Hello world from rank 9 of 28
Hello world from rank 15 of 28
Hello world from rank 20 of 28
Hello world from rank 5 of 28
Hello world from rank 21 of 28
Hello world from rank 22 of 28
```
[a]: http://www.open-mpi.org/faq/?category=java
[b]: https://support.it4i.cz/rt/
# JuliaLang
A set of unofficial examples of Julia the high-level, high-performance dynamic programming language for technical computing.
Julia is available on the clusters. Activate Julia by loading the Julia module:
```console
$ ml Julia/1.5.3-linux-x86_64
```
Check for Java version and path:
```console
$ julia -v
julia version 1.5.3
```
Below are examples of common operations in Julia. They assume you already have Julia installed and working
## Hello World
The simplest possible script:
```c
println("hello world")
```
With Julia [installed and added to your path](http://julialang.org/downloads/)
this script can be run by `julia hello_world.jl`, it can also be run from REPL by typing
`include("hello_world.jl")`, which will evaluate all valid expressions in that file and return the last output.
## Simple Functions
The example below shows two simple functions, how to call them and print the results.
Further examples of number formatting are shown below.
```c
# [function](http://docs.julialang.org:8000/en/latest/manual/functions/#functions) to calculate the volume of a sphere
function sphere_vol(r)
# julia allows [Unicode names](http://docs.julialang.org/en/latest/manual/unicode-input/) (in UTF-8 encoding)
# so either "pi" or the symbol π can be used
return 4/3*pi*r^3
end
# functions can also be defined more succinctly
quadratic(a, sqr_term, b) = (-b + sqr_term) / 2a
# calculates x for 0 = a*x^2+b*x+c, [arguments types](TODO: links) can be defined in function definitions
function quadratic2(a::Float64, b::Float64, c::Float64)
# unlike other languages 2a is equivalent to 2*a
# a^2 is used instead of a**2 or pow(a,2)
sqr_term = sqrt(b^2-4a*c)
r1 = quadratic(a, sqr_term, b)
r2 = quadratic(a, -sqr_term, b)
# multiple values can be returned from a function using tuples
# if the [return](http://docs.julialang.org:8000/en/latest/manual/functions/#the-return-keyword) keyword is omitted, the last term is returned
r1, r2
end
vol = sphere_vol(3)
# @printf allows number formatting but does not automatically append the \n to statements, see below
@printf "volume = %0.3f\n" vol
#> volume = 113.097
quad1, quad2 = quadratic2(2.0, -2.0, -12.0)
println("result 1: ", quad1)
#> result 1: 3.0
println("result 2: ", quad2)
#> result 2: -2.0
```
## Strings Basics
Collection of different string examples (string indexing is the same as array indexing, see below):
```c
# strings are defined with double quotes
# like variables, strings can contain any unicode character
s1 = "The quick brown fox jumps over the lazy dog α,β,γ"
println(s1)
#> The quick brown fox jumps over the lazy dog α,β,γ
# [println](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.println) adds a new line to the end of output
# [print](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.print) can be used if you dont want that:
print("this")
#> this
print(" and")
#> and
print(" that.\n")
#> that.
# chars are defined with single quotes
c1 = 'a'
println(c1)
#> a
# the ascii value of a char can be found with Int():
println(c1, " ascii value = ", Int(c1))
#> a ascii value = 97
println("Int('α') == ", Int('α'))
#> Int('α') == 945
# so be aware that
println(Int('1') == 1)
#> false
# strings can be converted to upper case or lower case:
s1_caps = uppercase(s1)
s1_lower = lowercase(s1)
println(s1_caps, "\n", s1_lower)
#> THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG Α,Β,Γ
#> the quick brown fox jumps over the lazy dog α,β,γ
# sub strings can be indexed like arrays:
# ([show](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.show) prints the raw value)
show(s1[11]); println()
#> 'b'
# or sub strings can be created:
show(s1[1:10]); println()
#> "The quick "
# end is used for the end of the array or string
show(s1[end-10:end]); println()
#> "dog α,β,γ"
# julia allows string [Interpolation](http://julia.readthedocs.org/en/latest/manual/strings/#interpolation):
a = "wolcome"
b = "julia"
println("$a to $b.")
#> wolcome to julia.
# this can extend to evaluate statements:
println("1 + 2 = $(1 + 2)")
#> 1 + 2 = 3
# strings can also be concatenated using the * operator
# using * instead of + isn't intuitive when you start with Julia,
# however [people think it makes more sense](https://groups.google.com/forum/#!msg/julia-users/nQg_d_n0t1Q/9PSt5aya5TsJ)
s2 = "this" * " and" * " that"
println(s2)
#> this and that
# as well as the string function
s3 = string("this", " and", " that")
println(s3)
#> this and that
```
## String: Converting and Formatting
```c
# strings can be converted using [float](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.float) and [int](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.int):
e_str1 = "2.718"
e = float(e_str1)
println(5e)
#> 13.5914
num_15 = parse(Int, "15")
println(3num_15)
#> 45
# numbers can be converted to strings and formatted using [printf](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.@printf)
@printf "e = %0.2f\n" e
#> 2.718
# or to create another string [sprintf](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.@sprintf)
e_str2 = @sprintf("%0.3f", e)
# to show that the 2 strings are the same
println("e_str1 == e_str2: $(e_str1 == e_str2)")
#> e_str1 == e_str2: true
# available number format characters are [f, e, g, c, s, p, d](https://github.com/JuliaLang/julia/blob/master/base/printf.jl#L15):
# (pi is a predefined constant; however, since its type is
# "MathConst" it has to be converted to a float to be formatted)
@printf "fix trailing precision: %0.3f\n" float(pi)
#> fix trailing precision: 3.142
@printf "scientific form: %0.6e\n" 1000pi
#> scientific form: 3.141593e+03
# g is not implemented yet
@printf "a character: %c\n" 'α'
#> a character: α
@printf "a string: %s\n" "look I'm a string!"
#> a string: look I'm a string!
@printf "right justify a string: %50s\n" "width 50, text right justified!"
#> right justify a string: width 50, text right justified!
@printf "a pointer: %p\n" 100000000
#> a pointer: 0x0000000005f5e100
@printf "print a integer: %d\n" 1e10
#> print an integer: 10000000000
```
## String Manipulations
```c
s1 = "The quick brown fox jumps over the lazy dog α,β,γ"
# [search](http://docs.julialang.org/en/latest/stdlib/base/#Base.search) returns the first index of a char
i = search(s1, 'b')
println(i)
#> 11
# the second argument is equivalent to the second argument of split, see below
# or a range if called with another string
r = search(s1, "brown")
println(r)
#> 11:15
# string [replace](http://docs.julialang.org/en/latest/stdlib/base/#Base.replace) is done thus:
r = replace(s1, "brown", "red")
show(r); println()
#> "The quick red fox jumps over the lazy dog"
# search and replace can also take a regular expressions by preceding the string with 'r'
r = search(s1, r"b[\w]*n")
println(r)
#> 11:15
# again with a regular expression
r = replace(s1, r"b[\w]*n", "red")
show(r); println()
#> "The quick red fox jumps over the lazy dog"
# there are also functions for regular expressions that return RegexMatch types
# [match](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.match) scans left to right for the first match (specified starting index optional)
r = match(r"b[\w]*n", s1)
println(r)
#> RegexMatch("brown")
# RegexMatch types have a property match that holds the matched string
show(r.match); println()
#> "brown"
# [matchall](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.matchall) returns a vector with RegexMatches for each match
r = matchall(r"[\w]{4,}", s1)
println(r)
#> SubString{UTF8String}["quick","brown","jumps","over","lazy"]
# [eachmatch](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.eachmatch) returns an iterator over all the matches
r = eachmatch(r"[\w]{4,}", s1)
for i in r print("\"$(i.match)\" ") end
println()
#> "quick" "brown" "jumps" "over" "lazy"
# a string can be repeated using the [repeat](http://julia.readthedocs.org/en/latest/manual/strings/#common-operations) function,
# or more succinctly with the [^ syntax](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.^):
r = "hello "^3
show(r); println() #> "hello hello hello "
# the [strip](http://docs.julialang.org/en/latest/stdlib/base/#Base.strip) function works the same as python:
# e.g., with one argument it strips the outer whitespace
r = strip("hello ")
show(r); println() #> "hello"
# or with a second argument of an array of chars it strips any of them;
r = strip("hello ", ['h', ' '])
show(r); println() #> "ello"
# (note the array is of chars and not strings)
# similarly [split](http://docs.julialang.org/en/latest/stdlib/base/#Base.split) works in basically the same way as python:
r = split("hello, there,bob", ',')
show(r); println() #> ["hello"," there","bob"]
r = split("hello, there,bob", ", ")
show(r); println() #> ["hello","there,bob"]
r = split("hello, there,bob", [',', ' '], limit=0, keep=false)
show(r); println() #> ["hello","there","bob"]
# (the last two arguements are limit and include_empty, see docs)
# the opposite of split: [join](http://docs.julialang.org/en/latest/stdlib/base/#Base.join) is simply
r = join(collect(1:10), ", ")
println(r) #> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
```
## Arrays
```c
function printsum(a)
# [summary](http://julia.readthedocs.org/en/latest/stdlib/base/#Base.summary) generates a summary of an object
println(summary(a), ": ", repr(a))
end
# arrays can be initialised directly:
a1 = [1,2,3]
printsum(a1)
#> 3-element Array{Int64,1}: [1,2,3]
# or initialised empty:
a2 = []
printsum(a2)
#> 0-element Array{None,1}: None[]
# since this array has no type, functions like push! (see below) don't work
# instead arrays can be initialised with a type:
a3 = Int64[]
printsum(a3)
#> 0-element Array{Int64,1}: []
# ranges are different from arrays:
a4 = 1:20
printsum(a4)
#> 20-element UnitRange{Int64}: 1:20
# however they can be used to create arrays thus:
a4 = collect(1:20)
printsum(a4)
#> 20-element Array{Int64,1}: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
# arrays can also be generated from [comprehensions](http://julia.readthedocs.org/en/latest/manual/arrays/#comprehensions):
a5 = [2^i for i = 1:10]
printsum(a5)
#> 10-element Array{Int64,1}: [2,4,8,16,32,64,128,256,512,1024]
# arrays can be any type, so arrays of arrays can be created:
a6 = (Array{Int64, 1})[]
printsum(a6)
#> 0-element Array{Array{Int64,1},1}: []
# (note this is a "jagged array" (i.e., an array of arrays), not a [multidimensional array](http://julia.readthedocs.org/en/latest/manual/arrays/),
# these are not covered here)
# Julia provided a number of ["Dequeue"](http://docs.julialang.org/en/latest/stdlib/base/#dequeues) functions, the most common for appending to the end of arrays
# is [**push!**](http://docs.julialang.org/en/latest/stdlib/base/#Base.push!)
# ! at the end of a function name indicates that the first argument is updated.
push!(a1, 4)
printsum(a1)
#> 4-element Array{Int64,1}: [1,2,3,4]
# push!(a2, 1) would cause error:
push!(a3, 1)
printsum(a3) #> 1-element Array{Int64,1}: [1]
#> 1-element Array{Int64,1}: [1]
push!(a6, [1,2,3])
printsum(a6)
#> 1-element Array{Array{Int64,1},1}: [[1,2,3]]
# using repeat() to create arrays
# you must use the keywords "inner" and "outer"
# all arguments must be arrays (not ranges)
a7 = repeat(a1,inner=[2],outer=[1])
printsum(a7)
#> 8-element Array{Int64,1}: [1,1,2,2,3,3,4,4]
a8 = repeat(collect(4:-1:1),inner=[1],outer=[2])
printsum(a8)
#> 8-element Array{Int64,1}: [4,3,2,1,4,3,2,1]
```
## Error Handling
```c
a=[]
# [try, catch](http://julia.readthedocs.org/en/latest/manual/control-flow/#the-try-catch-statement) can be used to deal with errors as with many other languages
try
push!(a,1)
catch err
showerror(STDOUT, err, backtrace());println()
end
println("Continuing after error")
```
## Multidimensional Arrays
Julia has very good multidimensional array capabilities.
See [the manual](http://julia.readthedocs.org/en/latest/manual/arrays/).
```c
# repeat can be useful to expand a grid
# as in R's expand.grid() function:
# <hide>
function printsum(a)
println(summary(a), ": ", repr(a))
end
# </hide>
m1 = hcat(repeat([1,2],inner=[1],outer=[3*2]),
repeat([1,2,3],inner=[2],outer=[2]),
repeat([1,2,3,4],inner=[3],outer=[1]))
printsum(m1)
#> 12×3 Array{Int64,2}: [1 1 1; 2 1 1; 1 2 1; 2 2 2; 1 3 2; 2 3 2; 1 1 3; 2 1 3; 1 2 3; 2 2 4; 1 3 4; 2 3 4]
# for simple repetitions of arrays,
# use repmat
m2 = repmat(m1,1,2) # replicate a9 once into dim1 and twice into dim2
println("size: ", size(m2))
#> size: (12,6)
m3 = repmat(m1,2,1) # replicate a9 twice into dim1 and once into dim2
println("size: ", size(m3))
#> size: (24,3)
# Julia comprehensions are another way to easily create
# multidimensional arrays
m4 = [i+j+k for i=1:2, j=1:3, k=1:2] # creates a 2x3x2 array of Int64
m5 = ["Hi Im # $(i+2*(j-1 + 3*(k-1)))" for i=1:2, j=1:3, k=1:2]
# expressions are very flexible
# you can specify the type of the array by just
# placing it in front of the expression
Pkg.add("LegacyStrings")
import LegacyStrings
m5 = LegacyStrings.ASCIIString["Hi Im element # $(i+2*(j-1 + 3*(k-1)))" for i=1:2, j=1:3, k=1:2]
printsum(m5)
#> 2x3x2 Array{LegacyStrings.ASCIIString,3}: LegacyStrings.ASCIIString["Hi Im element # 7"
#> "Hi Im element # 9" "Hi Im element # 11"
#> "Hi Im element # 8" "Hi Im element # 10" "Hi Im element # 12"]
#>
#> LegacyStrings.ASCIIString["Hi Im element # 7" "Hi Im element # 9" "Hi Im element # 11"
#> "Hi Im element # 8" "Hi Im element # 10" "Hi Im element # 12"]
# Array reductions
# many functions in Julia have an array method
# to be applied to specific dimensions of an array:
sum(m4,3) # takes the sum over the third dimension
sum(m4,(1,3)) # sum over first and third dim
maximum(m4,2) # find the max elt along dim 2
findmax(m4,3) # find the max elt and its index along dim 3 (available only in very recent Julia versions)
# Broadcasting
# when you combine arrays of different sizes in an operation,
# an attempt is made to "spread" or "broadcast" the smaller array
# so that the sizes match up. broadcast operators are preceded by a dot:
m4 .+ 3 # add 3 to all elements
m4 .+ [1,2] # adds vector [1,2] to all elements along first dim
# slices and views
m4=m4[:,:,1] # holds dim 3 fixed
m4[:,2,:] # that's a 2x1x2 array. not very intuititive to look at
# get rid of dimensions with size 1:
squeeze(m4[:,2,:],2) # that's better
# assign new values to a certain view
m4[:,:,1] = rand(1:6,2,3)
printsum(m4)
#> 2x3x2 Array{Int64,3}: [3 5 2
#> 2 2 2]
#>
#> [4 5 6
#> 5 6 7]
# (for more examples of try, catch see Error Handling above)
try
# this will cause an error, you have to assign the correct type
m4[:,:,1] = rand(2,3)
catch err
println(err)
end
#> InexactError()
try
# this will cause an error, you have to assign the right shape
m4[:,:,1] = rand(1:6,3,2)
catch err
println(err)
end
#> DimensionMismatch("tried to assign 3x2 array to 2x3x1 destination")
```
## Dictionaries
Julia uses [Dicts](http://docs.julialang.org/en/latest/stdlib/base/#associative-collections) as
associative collections. Usage is similar to Python except for the `=>` definition syntax.
```c
# <hide>
function printsum(a)
println(summary(a), ": ", repr(a))
end
# </hide>
# dicts can be initialised directly:
a1 = Dict(1=>"one", 2=>"two")
printsum(a1) #> Dict{Int64,String}: {2=>"two",1=>"one"}
# then added to:
a1[3]="three"
printsum(a1) #> Dict{Int64,String}: {2=>"two",3=>"three",1=>"one"}
# (note dicts cannot be assumed to keep their original order)
# dicts may also be created with the type explicitly set
a2 = Dict{Int64, AbstractString}()
a2[0]="zero"
printsum(a2)
#> Dict{Int64,AbstractString} with 1 entry: Dict{Int64,AbstractString}(Pair{Int64,AbstractString}(0,"zero"))
# dicts, like arrays, may also be created from [comprehensions](http://julia.readthedocs.org/en/latest/manual/arrays/#comprehensions)
a3 = Dict([i => @sprintf("%d", i) for i = 1:10])
printsum(a3)
#> Dict{Any,Any}: {5=>"5",4=>"4",6=>"6",7=>"7",2=>"2",10=>"10",9=>"9",8=>"8",3=>"3",1=>"1"}
# as you would expect, Julia comes with all the normal helper functions
# for dicts, e.g., [haskey](http://docs.julialang.org/en/latest/stdlib/base/#Base.haskey)
println(haskey(a1,1)) #> true
# which is equivalent to
println(1 in keys(a1)) #> true
# where [keys](http://docs.julialang.org/en/latest/stdlib/base/#Base.keys) creates an iterator over the keys of the dictionary
# similar to keys, [values](http://docs.julialang.org/en/latest/stdlib/base/#Base.values) get iterators over the dict's values:
printsum(values(a1))
#> Base.ValueIterator for a Dict{Int64,String} with 3 entries: String["two","three","one"]
# use [collect](http://docs.julialang.org/en/latest/stdlib/base/#Base.collect) to get an array:
printsum(collect(values(a1)))
#> 3-element Array{String,1}: String["two","three","one"]
```
## Loops and Map
[For loops](http://julia.readthedocs.org/en/latest/manual/control-flow/#repeated-evaluation-loops)
can be defined in a number of ways.
```c
# <hide>
function printsum(a)
println(summary(a), ": ", repr(a))
end
# </hide>
for i in 1:5
print(i, ", ")
end
#> 1, 2, 3, 4, 5,
# In loop definitions "in" is equivilent to "=" (AFAIK, the two are interchangable in this context)
for i = 1:5
print(i, ", ")
end
println() #> 1, 2, 3, 4, 5,
# arrays can also be looped over directly:
a1 = [1,2,3,4]
for i in a1
print(i, ", ")
end
println() #> 1, 2, 3, 4,
# **continue** and **break** work in the same way as python
a2 = collect(1:20)
for i in a2
if i % 2 != 0
continue
end
print(i, ", ")
if i >= 8
break
end
end
println() #> 2, 4, 6, 8,
# if the array is being manipulated during evaluation a while loop shoud be used
# [pop](http://docs.julialang.org/en/latest/stdlib/base/#Base.pop!) removes the last element from an array
while !isempty(a1)
print(pop!(a1), ", ")
end
println() #> 4, 3, 2, 1,
d1 = Dict(1=>"one", 2=>"two", 3=>"three")
# dicts may be looped through using the keys function:
for k in sort(collect(keys(d1)))
print(k, ": ", d1[k], ", ")
end
println() #> 1: one, 2: two, 3: three,
# like python [enumerate](http://docs.julialang.org/en/latest/stdlib/base/#Base.enumerate) can be used to get both the index and value in a loop
a3 = ["one", "two", "three"]
for (i, v) in enumerate(a3)
print(i, ": ", v, ", ")
end
println() #> 1: one, 2: two, 3: three,
# (note enumerate starts from 1 since Julia arrays are 1 indexed unlike python)
# [map]() works as you might expect performing the given function on each member of an array or iter
# much like comprehensions
a4 = map((x) -> x^2, [1, 2, 3, 7])
print(a4) #> [1, 4, 9, 49]
```
## Types
Types are a key way of structuring data within Julia.
```c
# <hide>
function printsum(a)
println(summary(a), ": ", repr(a))
end
# </hide>
# Type Definitions are probably most similar to tyepdefs in c?
# a simple type with no special constructor functions might look like this
type Person
name::AbstractString
male::Bool
age::Float64
children::Int
end
p = Person("Julia", false, 4, 0)
printsum(p)
#> Person: Person("Julia",false,4.0,0)
people = Person[]
push!(people, Person("Steve", true, 42, 0))
push!(people, Person("Jade", false, 17, 3))
printsum(people)
#> 2-element Array{Person,1}: [Person("Steve",true,42.0,0),Person("Jade",false,17.0,3)]
# types may also contains arrays and dicts
# constructor functions can be defined to easily create objects
type Family
name::AbstractString
members::Array{AbstractString, 1}
extended::Bool
# constructor that takes one argument and generates a default
# for the other two values
Family(name::AbstractString) = new(name, AbstractString[], false)
# constructor that takes two arguements and infers the third
Family(name::AbstractString, members) = new(name, members, length(members) > 3)
end
fam1 = Family("blogs")
println(fam1)
#> Family("blogs",AbstractString[],false)
fam2 = Family("jones", ["anna", "bob", "charlie", "dick"])
println(fam2)
#> Family("jones",AbstractString["anna","bob","charlie","dick"],true)
```
## Input & Output
The basic syntax for reading and writing files in Julia is quite similar to Python.
The `simple.dat` file used in this example is available
[from github](https://github.com/samuelcolvin/JuliaByExample/blob/master/src/simple.dat).
```c
fname = "simple.dat"
# using [do](http://julia.readthedocs.org/en/latest/manual/functions/#block-syntax-for-function-arguments) means the file is closed automatically
# in the same way "with" does in python
open(fname,"r") do f
for line in eachline(f)
print(line)
end
end
#> this is a simple file containing
#> text and numbers:
#> 43.3
#> 17
f = open(fname,"r")
showall(readlines(f))
#> String["this is a simple file containing","text and numbers:","43.3","17"]
close(f)
f = open(fname,"r")
fstring = readstring(f)
close(f)
println(summary(fstring))
#> String
print(fstring)
#> this is a simple file containing
#> text and numbers:
#> 43.3
#> 17
outfile = "outfile.dat"
# writing to files is very similar:
f = open(outfile, "w")
# both print and println can be used as usual but with f as their first arugment
println(f, "some content")
print(f, "more content")
print(f, " more on the same line")
close(f)
# we can then check the content of the file written
# "do" above just creates an anonymous function and passes it to open
# we can use the same logic to pass readall and thereby succinctly
# open, read and close a file in one line
outfile_content = open(readstring, outfile, "r")
println(repr(outfile_content))
#> "some content\nmore content more on the same line"
```
## Packages and Including of Files
[Packages](http://docs.julialang.org/en/latest/packages/packagelist/)
extend the functionality of the Julia's standard library.
```c
# You might not want to run this file completely, as the Pkg-commands can take a
# long time to complete.
# list all available packages:
Pkg.available()
# install one package (e.g. [Calculus](https://github.com/johnmyleswhite/Calculus.jl)) and all its dependencies:
Pkg.add("Calculus")
# to list all installed packages
Pkg.installed()
# to update all packages to their newest version
Pkg.update()
# to use a package:
using Calculus
# will import all functions of that package into the current namespace, so that
# it is possible to call
derivative(x -> sin(x), 1.0)
# without specifing the package it is included in.
import Calculus
# will enable you to specify which package the function is called from
Calculus.derivative(x -> cos(x), 1.0)
# Using `import` is especially useful if there are conflicts in function/type-names
# between packages.
```
## Winston
[Winston Package Page](https://github.com/nolta/Winston.jl)
MATLAB-like plotting. Installed via `Pkg.add("Winston")`
```c
using Winston
# plot some data
pl = plot(cumsum(rand(500) .- 0.5), "r", cumsum(rand(500) .- 0.5), "b")
# display the plot (not done automatically!)
display(pl)
# save the current figure
savefig("winston.svg")
# .eps, .pdf, & .png are also supported
# we used svg here because it respects the width and height specified above
```
![](winston.svg)
## DataFrames
The [DataFrames.jl package](https://github.com/JuliaStats/DataFrames.jl) provides a tool for working with tabular data.
The `iris.csv` file used in this example is available
[from github](https://github.com/samuelcolvin/JuliaByExample/blob/master/common_usage/iris.csv).
```c
using DataFrames
showln(x) = (show(x); println())
# TODO: needs more links to docs.
# A DataFrame is an in-memory database
df = DataFrame(A = [1, 2], B = [e, pi], C = ["xx", "xy"])
showln(df)
#> 2x3 DataFrame
#> |-------|---|---------|------|
#> | Row # | A | B | C |
#> | 1 | 1 | 2.71828 | "xx" |
#> | 2 | 2 | 3.14159 | "xy" |
# The columns of a DataFrame can be indexed using numbers or names
showln(df[1])
#> [1,2]
showln(df[:A])
#> [1,2]
showln(df[2])
#> [2.718281828459045,3.141592653589793]
showln(df[:B])
#> [2.718281828459045,3.141592653589793]
showln(df[3])
#> String["xx","xy"]
showln(df[:C])
#> String["xx","xy"]
# The rows of a DataFrame can be indexed only by using numbers
showln(df[1, :])
#> 1x3 DataFrame
#> |-------|---|---------|------|
#> | Row # | A | B | C |
#> | 1 | 1 | 2.71828 | "xx" |
showln(df[1:2, :])
#> 2x3 DataFrame
#> |-------|---|---------|------|
#> | Row # | A | B | C |
#> | 1 | 1 | 2.71828 | "xx" |
#> | 2 | 2 | 3.14159 | "xy" |
# importing data into DataFrames
# ------------------------------
# DataFrames can be loaded from CSV files using readtable()
iris = readtable("iris.csv")
# the iris dataset (and plenty of others) is also available from
using RData, RDatasets
iris = dataset("datasets","iris")
# you can directly import your own R .rda dataframe with
# mydf = DataFrame(read_rda("path/to/your/df.rda")["name_of_df"]), e.g.
diamonds = DataFrame(load(joinpath(Pkg.dir("RDatasets"),"data","ggplot2","diamonds.rda"))["diamonds"])
# showing DataFrames
# ------------------
# Check the names and element types of the columns of our new DataFrame
showln(names(iris))
#> [:SepalLength,:SepalWidth,:PetalLength,:PetalWidth,:Species]
showln(eltypes(iris))
#> Type[Float64,Float64,Float64,Float64,UTF8String]
# Subset the DataFrame to only include rows for one species
showln(iris[iris[:Species] .== "setosa", :])
#> 50x5 DataFrame
#> |-------|-------------|------------|-------------|------------|----------|
#> | Row # | SepalLength | SepalWidth | PetalLength | PetalWidth | Species |
#> | 1 | 5.1 | 3.5 | 1.4 | 0.2 | "setosa" |
#> | 2 | 4.9 | 3.0 | 1.4 | 0.2 | "setosa" |
#> | 3 | 4.7 | 3.2 | 1.3 | 0.2 | "setosa" |
#> | 4 | 4.6 | 3.1 | 1.5 | 0.2 | "setosa" |
#> | 5 | 5.0 | 3.6 | 1.4 | 0.2 | "setosa" |
#> | 6 | 5.4 | 3.9 | 1.7 | 0.4 | "setosa" |
#> | 7 | 4.6 | 3.4 | 1.4 | 0.3 | "setosa" |
#> | 8 | 5.0 | 3.4 | 1.5 | 0.2 | "setosa" |
#> | 9 | 4.4 | 2.9 | 1.4 | 0.2 | "setosa" |
#> ⋮
#> | 41 | 5.0 | 3.5 | 1.3 | 0.3 | "setosa" |
#> | 42 | 4.5 | 2.3 | 1.3 | 0.3 | "setosa" |
#> | 43 | 4.4 | 3.2 | 1.3 | 0.2 | "setosa" |
#> | 44 | 5.0 | 3.5 | 1.6 | 0.6 | "setosa" |
#> | 45 | 5.1 | 3.8 | 1.9 | 0.4 | "setosa" |
#> | 46 | 4.8 | 3.0 | 1.4 | 0.3 | "setosa" |
#> | 47 | 5.1 | 3.8 | 1.6 | 0.2 | "setosa" |
#> | 48 | 4.6 | 3.2 | 1.4 | 0.2 | "setosa" |
#> | 49 | 5.3 | 3.7 | 1.5 | 0.2 | "setosa" |
#> | 50 | 5.0 | 3.3 | 1.4 | 0.2 | "setosa" |
# Count the number of rows for each species
showln(by(iris, :Species, df -> size(df, 1)))
#> 3x2 DataFrame
#> |-------|--------------|----|
#> | Row # | Species | x1 |
#> | 1 | "setosa" | 50 |
#> | 2 | "versicolor" | 50 |
#> | 3 | "virginica" | 50 |
# Discretize entire columns at a time
iris[:SepalLength] = round.(Integer, iris[:SepalLength])
iris[:SepalWidth] = round.(Integer, iris[:SepalWidth])
# Tabulate data according to discretized columns to see "clusters"
tabulated = by(
iris,
[:Species, :SepalLength, :SepalWidth],
df -> size(df, 1)
)
showln(tabulated)
#> 17x4 DataFrame
#> |-------|--------------|-------------|------------|----|
#> | Row # | Species | SepalLength | SepalWidth | x1 |
#> | 1 | "setosa" | 4 | 3 | 4 |
#> | 2 | "setosa" | 5 | 2 | 1 |
#> | 3 | "setosa" | 5 | 3 | 23 |
#> | 4 | "setosa" | 5 | 4 | 17 |
#> | 5 | "setosa" | 6 | 4 | 5 |
#> | 6 | "versicolor" | 5 | 2 | 3 |
#> | 7 | "versicolor" | 5 | 3 | 3 |
#> | 8 | "versicolor" | 6 | 2 | 6 |
#> | 9 | "versicolor" | 6 | 3 | 29 |
#> | 10 | "versicolor" | 7 | 3 | 9 |
#> | 11 | "virginica" | 5 | 3 | 1 |
#> | 12 | "virginica" | 6 | 2 | 1 |
#> | 13 | "virginica" | 6 | 3 | 22 |
#> | 14 | "virginica" | 7 | 3 | 19 |
#> | 15 | "virginica" | 7 | 4 | 1 |
#> | 16 | "virginica" | 8 | 3 | 4 |
#> | 17 | "virginica" | 8 | 4 | 2 |
# you can setup a grouped dataframe like this
gdf = groupby(iris,[:Species, :SepalLength, :SepalWidth])
# and then iterate over it
for idf in gdf
println(size(idf,1))
end
# Adding/Removing columns
# -----------------------
# insert!(df::DataFrame,index::Int64,item::AbstractArray{T,1},name::Symbol)
# insert random numbers at col 5:
insert!(iris, 5, rand(nrow(iris)), :randCol)
# remove it
delete!(iris, :randCol)
```
# Python
Python is a widely used high-level programming language for general-purpose programming, created by Guido van Rossum and first released in 1991. An interpreted language, Python has a design philosophy that emphasizes code readability (notably using whitespace indentation to delimit code blocks rather than curly brackets or keywords), and a syntax that allows programmers to express concepts in fewer lines of code than might be used in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale.
Python features a dynamic type system and automatic memory management and supports multiple programming paradigms, including object-oriented, imperative, functional programming, and procedural styles. It has a large and comprehensive standard library.
* [Documentation for Python 3.X][a]
* [PEP 8 -- Style Guide for Python Code][c]
* [Get into Python -- Tutorial][d]
## Python on the IT4Innovations Clusters
On the clusters, we have the Python 3.X software installed. How to use these modules is shown below.
!!! note
Use the `ml av python/` command to get up-to-date versions of the modules.
!!! warn
Python 2.7 is not supported - [EOL][b] January 1st, 2020.
```console
$ ml av python/
------------------------------------------------------ /apps/modules/lang -------------------------------------------------------
Python/3.8.2-GCCcore-9.3.0 Python/3.8.6-GCCcore-10.2.0 Python/3.9.5-GCCcore-10.3.0 (D)
Where:
D: Default Module
If you need software that is not listed, request it at support@it4i.cz.
```
## Python 3.X
Python 3.0 (a.k.a. "Python 3000" or "Py3k") is a new version of the language that is incompatible with the 2.x line of releases. The language is mostly the same, but many details, especially how built-in objects like dictionaries and strings work, have changed considerably, and many deprecated features have been removed. In addition, the standard library has been reorganized in a few prominent places.
```console
$ ml av python3/
------------------------------------------------------ /apps/modules/lang -------------------------------------------------------
Python/3.8.2-GCCcore-9.3.0 Python/3.8.6-GCCcore-10.2.0 Python/3.9.5-GCCcore-10.3.0 (D)
Where:
D: Default Module
If you need software that is not listed, request it at support@it4i.cz.
```
### Used Module Python/3.x
```console
$ python --version
Python 2.7.5
$ ml Python/3.8.6-GCCcore-10.2.0
$ python --version
Python 3.8.6
```
### Packages in Python/3.x
```console
$ pip3 list
Package Version
----------------------------- ----------
alabaster 0.7.12
appdirs 1.4.4
ase 3.22.0
asn1crypto 1.4.0
atomicwrites 1.4.0
attrs 20.2.0
Babel 2.8.0
...
...
$ pip3 list | wc -l
138
```
### How to Install New Package to Python/3.x
```console
$ ml ml Python/3.8.6-GCCcore-10.2.0
$ python --version
Python 3.8.6
$ pip3 install pandas --user
Collecting pandas
Downloading pandas-1.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
|████████████████████████████████| 11.5 MB 4.8 MB/s
...
Installing collected packages: pandas
Successfully installed pandas-1.3.3
```
### How to Update Package in Python/3.x?
```console
$ pip3 install setuptools --upgrade --user
Collecting setuptools
Downloading setuptools-58.0.4-py3-none-any.whl (816 kB)
|███████████████████████████████▎| 798 kB 5.4 MB/s eta 0:00:01
|███████████████████████████████▊| 808 kB 5.4 MB/s eta 0:00:01
|████████████████████████████████| 816 kB 5.4 MB/s
Installing collected packages: setuptools
Successfully installed setuptools-58.0.4
```
[a]: https://docs.python.org/3/
[b]: https://www.python.org/doc/sunset-python-2/
[c]: https://www.python.org/dev/peps/pep-0008/
[d]: https://jobtensor.com/Tutorial/Python/en/Introduction
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="450pt" height="300pt" viewBox="0 0 450 300" version="1.1">
<defs>
<g>
<symbol overflow="visible" id="glyph0-0">
<path style="stroke:none;" d="M 0.640625 2.296875 L 0.640625 -9.171875 L 7.140625 -9.171875 L 7.140625 2.296875 Z M 1.375 1.578125 L 6.421875 1.578125 L 6.421875 -8.4375 L 1.375 -8.4375 Z M 1.375 1.578125 "/>
</symbol>
<symbol overflow="visible" id="glyph0-1">
<path style="stroke:none;" d="M 1.375 -4.609375 L 9.515625 -4.609375 L 9.515625 -3.53125 L 1.375 -3.53125 Z M 1.375 -4.609375 "/>
</symbol>
<symbol overflow="visible" id="glyph0-2">
<path style="stroke:none;" d="M 4.90625 -8.359375 L 1.671875 -3.296875 L 4.90625 -3.296875 Z M 4.578125 -9.484375 L 6.1875 -9.484375 L 6.1875 -3.296875 L 7.546875 -3.296875 L 7.546875 -2.234375 L 6.1875 -2.234375 L 6.1875 0 L 4.90625 0 L 4.90625 -2.234375 L 0.640625 -2.234375 L 0.640625 -3.46875 Z M 4.578125 -9.484375 "/>
</symbol>
<symbol overflow="visible" id="glyph0-3">
<path style="stroke:none;" d="M 2.5 -1.078125 L 6.96875 -1.078125 L 6.96875 0 L 0.953125 0 L 0.953125 -1.078125 C 1.441406 -1.578125 2.101562 -2.25 2.9375 -3.09375 C 3.78125 -3.945312 4.3125 -4.5 4.53125 -4.75 C 4.9375 -5.207031 5.21875 -5.597656 5.375 -5.921875 C 5.539062 -6.242188 5.625 -6.554688 5.625 -6.859375 C 5.625 -7.367188 5.445312 -7.78125 5.09375 -8.09375 C 4.75 -8.40625 4.289062 -8.5625 3.71875 -8.5625 C 3.3125 -8.5625 2.882812 -8.492188 2.4375 -8.359375 C 2 -8.222656 1.523438 -8.007812 1.015625 -7.71875 L 1.015625 -9.015625 C 1.535156 -9.222656 2.019531 -9.378906 2.46875 -9.484375 C 2.914062 -9.597656 3.320312 -9.65625 3.6875 -9.65625 C 4.675781 -9.65625 5.460938 -9.40625 6.046875 -8.90625 C 6.628906 -8.414062 6.921875 -7.757812 6.921875 -6.9375 C 6.921875 -6.550781 6.847656 -6.179688 6.703125 -5.828125 C 6.554688 -5.484375 6.289062 -5.078125 5.90625 -4.609375 C 5.800781 -4.484375 5.460938 -4.125 4.890625 -3.53125 C 4.328125 -2.945312 3.53125 -2.128906 2.5 -1.078125 Z M 2.5 -1.078125 "/>
</symbol>
<symbol overflow="visible" id="glyph0-4">
<path style="stroke:none;" d="M 4.125 -8.640625 C 3.46875 -8.640625 2.972656 -8.3125 2.640625 -7.65625 C 2.304688 -7.007812 2.140625 -6.035156 2.140625 -4.734375 C 2.140625 -3.429688 2.304688 -2.453125 2.640625 -1.796875 C 2.972656 -1.148438 3.46875 -0.828125 4.125 -0.828125 C 4.789062 -0.828125 5.289062 -1.148438 5.625 -1.796875 C 5.957031 -2.453125 6.125 -3.429688 6.125 -4.734375 C 6.125 -6.035156 5.957031 -7.007812 5.625 -7.65625 C 5.289062 -8.3125 4.789062 -8.640625 4.125 -8.640625 Z M 4.125 -9.65625 C 5.1875 -9.65625 6 -9.234375 6.5625 -8.390625 C 7.125 -7.546875 7.40625 -6.328125 7.40625 -4.734375 C 7.40625 -3.140625 7.125 -1.921875 6.5625 -1.078125 C 6 -0.234375 5.1875 0.1875 4.125 0.1875 C 3.070312 0.1875 2.265625 -0.234375 1.703125 -1.078125 C 1.140625 -1.921875 0.859375 -3.140625 0.859375 -4.734375 C 0.859375 -6.328125 1.140625 -7.546875 1.703125 -8.390625 C 2.265625 -9.234375 3.070312 -9.65625 4.125 -9.65625 Z M 4.125 -9.65625 "/>
</symbol>
<symbol overflow="visible" id="glyph0-5">
<path style="stroke:none;" d="M 4.296875 -5.25 C 3.710938 -5.25 3.253906 -5.050781 2.921875 -4.65625 C 2.585938 -4.257812 2.421875 -3.722656 2.421875 -3.046875 C 2.421875 -2.359375 2.585938 -1.816406 2.921875 -1.421875 C 3.253906 -1.023438 3.710938 -0.828125 4.296875 -0.828125 C 4.867188 -0.828125 5.320312 -1.023438 5.65625 -1.421875 C 5.988281 -1.816406 6.15625 -2.359375 6.15625 -3.046875 C 6.15625 -3.722656 5.988281 -4.257812 5.65625 -4.65625 C 5.320312 -5.050781 4.867188 -5.25 4.296875 -5.25 Z M 6.84375 -9.265625 L 6.84375 -8.09375 C 6.519531 -8.25 6.191406 -8.363281 5.859375 -8.4375 C 5.535156 -8.519531 5.210938 -8.5625 4.890625 -8.5625 C 4.046875 -8.5625 3.398438 -8.273438 2.953125 -7.703125 C 2.503906 -7.140625 2.25 -6.28125 2.1875 -5.125 C 2.4375 -5.488281 2.75 -5.769531 3.125 -5.96875 C 3.5 -6.164062 3.914062 -6.265625 4.375 -6.265625 C 5.320312 -6.265625 6.070312 -5.972656 6.625 -5.390625 C 7.175781 -4.816406 7.453125 -4.035156 7.453125 -3.046875 C 7.453125 -2.066406 7.160156 -1.28125 6.578125 -0.6875 C 6.003906 -0.101562 5.242188 0.1875 4.296875 0.1875 C 3.191406 0.1875 2.347656 -0.234375 1.765625 -1.078125 C 1.191406 -1.921875 0.90625 -3.140625 0.90625 -4.734375 C 0.90625 -6.222656 1.257812 -7.414062 1.96875 -8.3125 C 2.6875 -9.207031 3.644531 -9.65625 4.84375 -9.65625 C 5.15625 -9.65625 5.472656 -9.617188 5.796875 -9.546875 C 6.128906 -9.484375 6.476562 -9.390625 6.84375 -9.265625 Z M 6.84375 -9.265625 "/>
</symbol>
<symbol overflow="visible" id="glyph0-6">
<path style="stroke:none;" d="M 4.125 -4.5 C 3.519531 -4.5 3.039062 -4.332031 2.6875 -4 C 2.34375 -3.675781 2.171875 -3.234375 2.171875 -2.671875 C 2.171875 -2.097656 2.34375 -1.644531 2.6875 -1.3125 C 3.039062 -0.988281 3.519531 -0.828125 4.125 -0.828125 C 4.738281 -0.828125 5.21875 -0.988281 5.5625 -1.3125 C 5.914062 -1.644531 6.09375 -2.097656 6.09375 -2.671875 C 6.09375 -3.234375 5.914062 -3.675781 5.5625 -4 C 5.21875 -4.332031 4.738281 -4.5 4.125 -4.5 Z M 2.84375 -5.046875 C 2.300781 -5.179688 1.875 -5.4375 1.5625 -5.8125 C 1.257812 -6.1875 1.109375 -6.644531 1.109375 -7.1875 C 1.109375 -7.945312 1.375 -8.546875 1.90625 -8.984375 C 2.445312 -9.429688 3.1875 -9.65625 4.125 -9.65625 C 5.070312 -9.65625 5.8125 -9.429688 6.34375 -8.984375 C 6.882812 -8.546875 7.15625 -7.945312 7.15625 -7.1875 C 7.15625 -6.644531 7 -6.1875 6.6875 -5.8125 C 6.382812 -5.4375 5.960938 -5.179688 5.421875 -5.046875 C 6.035156 -4.898438 6.515625 -4.617188 6.859375 -4.203125 C 7.203125 -3.785156 7.375 -3.273438 7.375 -2.671875 C 7.375 -1.742188 7.09375 -1.035156 6.53125 -0.546875 C 5.976562 -0.0546875 5.175781 0.1875 4.125 0.1875 C 3.082031 0.1875 2.28125 -0.0546875 1.71875 -0.546875 C 1.15625 -1.035156 0.875 -1.742188 0.875 -2.671875 C 0.875 -3.273438 1.046875 -3.785156 1.390625 -4.203125 C 1.742188 -4.617188 2.226562 -4.898438 2.84375 -5.046875 Z M 2.375 -7.078125 C 2.375 -6.578125 2.523438 -6.191406 2.828125 -5.921875 C 3.140625 -5.648438 3.570312 -5.515625 4.125 -5.515625 C 4.675781 -5.515625 5.109375 -5.648438 5.421875 -5.921875 C 5.734375 -6.191406 5.890625 -6.578125 5.890625 -7.078125 C 5.890625 -7.566406 5.734375 -7.945312 5.421875 -8.21875 C 5.109375 -8.5 4.675781 -8.640625 4.125 -8.640625 C 3.570312 -8.640625 3.140625 -8.5 2.828125 -8.21875 C 2.523438 -7.945312 2.375 -7.566406 2.375 -7.078125 Z M 2.375 -7.078125 "/>
</symbol>
<symbol overflow="visible" id="glyph0-7">
<path style="stroke:none;" d="M 1.609375 -1.078125 L 3.703125 -1.078125 L 3.703125 -8.3125 L 1.421875 -7.859375 L 1.421875 -9.015625 L 3.6875 -9.484375 L 4.984375 -9.484375 L 4.984375 -1.078125 L 7.078125 -1.078125 L 7.078125 0 L 1.609375 0 Z M 1.609375 -1.078125 "/>
</symbol>
<symbol overflow="visible" id="glyph0-8">
<path style="stroke:none;" d="M 5.28125 -5.109375 C 5.894531 -4.972656 6.375 -4.695312 6.71875 -4.28125 C 7.0625 -3.875 7.234375 -3.363281 7.234375 -2.75 C 7.234375 -1.820312 6.910156 -1.097656 6.265625 -0.578125 C 5.617188 -0.0664062 4.703125 0.1875 3.515625 0.1875 C 3.117188 0.1875 2.707031 0.144531 2.28125 0.0625 C 1.863281 -0.0078125 1.429688 -0.125 0.984375 -0.28125 L 0.984375 -1.53125 C 1.347656 -1.320312 1.738281 -1.160156 2.15625 -1.046875 C 2.582031 -0.941406 3.023438 -0.890625 3.484375 -0.890625 C 4.285156 -0.890625 4.894531 -1.046875 5.3125 -1.359375 C 5.738281 -1.679688 5.953125 -2.144531 5.953125 -2.75 C 5.953125 -3.3125 5.753906 -3.75 5.359375 -4.0625 C 4.972656 -4.375 4.429688 -4.53125 3.734375 -4.53125 L 2.625 -4.53125 L 2.625 -5.59375 L 3.78125 -5.59375 C 4.414062 -5.59375 4.898438 -5.71875 5.234375 -5.96875 C 5.566406 -6.21875 5.734375 -6.582031 5.734375 -7.0625 C 5.734375 -7.539062 5.5625 -7.910156 5.21875 -8.171875 C 4.875 -8.429688 4.378906 -8.5625 3.734375 -8.5625 C 3.378906 -8.5625 3 -8.523438 2.59375 -8.453125 C 2.195312 -8.378906 1.757812 -8.257812 1.28125 -8.09375 L 1.28125 -9.25 C 1.757812 -9.382812 2.210938 -9.484375 2.640625 -9.546875 C 3.066406 -9.617188 3.46875 -9.65625 3.84375 -9.65625 C 4.820312 -9.65625 5.59375 -9.429688 6.15625 -8.984375 C 6.726562 -8.546875 7.015625 -7.945312 7.015625 -7.1875 C 7.015625 -6.664062 6.863281 -6.222656 6.5625 -5.859375 C 6.257812 -5.492188 5.832031 -5.242188 5.28125 -5.109375 Z M 5.28125 -5.109375 "/>
</symbol>
<symbol overflow="visible" id="glyph0-9">
<path style="stroke:none;" d="M 1.40625 -9.484375 L 6.4375 -9.484375 L 6.4375 -8.390625 L 2.578125 -8.390625 L 2.578125 -6.078125 C 2.765625 -6.140625 2.953125 -6.1875 3.140625 -6.21875 C 3.328125 -6.25 3.507812 -6.265625 3.6875 -6.265625 C 4.75 -6.265625 5.585938 -5.972656 6.203125 -5.390625 C 6.828125 -4.816406 7.140625 -4.035156 7.140625 -3.046875 C 7.140625 -2.023438 6.820312 -1.226562 6.1875 -0.65625 C 5.550781 -0.09375 4.65625 0.1875 3.5 0.1875 C 3.101562 0.1875 2.695312 0.148438 2.28125 0.078125 C 1.863281 0.015625 1.4375 -0.0820312 1 -0.21875 L 1 -1.515625 C 1.382812 -1.304688 1.78125 -1.148438 2.1875 -1.046875 C 2.59375 -0.941406 3.019531 -0.890625 3.46875 -0.890625 C 4.207031 -0.890625 4.789062 -1.082031 5.21875 -1.46875 C 5.644531 -1.851562 5.859375 -2.378906 5.859375 -3.046875 C 5.859375 -3.703125 5.644531 -4.222656 5.21875 -4.609375 C 4.789062 -4.992188 4.207031 -5.1875 3.46875 -5.1875 C 3.125 -5.1875 2.78125 -5.144531 2.4375 -5.0625 C 2.101562 -4.988281 1.757812 -4.875 1.40625 -4.71875 Z M 1.40625 -9.484375 "/>
</symbol>
</g>
<clipPath id="clip1">
<path d="M 53 166 L 166 166 L 166 265.75 L 53 265.75 Z M 53 166 "/>
</clipPath>
<clipPath id="clip2">
<path d="M 318 15 L 423 15 L 423 153 L 318 153 Z M 318 15 "/>
</clipPath>
</defs>
<g id="surface45">
<path style="fill:none;stroke-width:0.853645;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(100%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 65.746094 184.742188 L 66.4375 187.765625 L 67.128906 186.746094 L 67.820312 178.636719 L 68.507812 187.574219 L 69.199219 196.019531 L 69.890625 204.5 L 70.582031 203.855469 L 71.269531 204.714844 L 71.960938 200.078125 L 72.652344 208.082031 L 73.34375 206.835938 L 74.03125 198.875 L 74.722656 195.683594 L 75.414062 188.042969 L 76.105469 194.558594 L 76.792969 189.554688 L 77.484375 192.332031 L 78.175781 190.027344 L 78.867188 194.230469 L 79.554688 200.730469 L 80.246094 197.371094 L 80.9375 198.34375 L 81.628906 204.410156 L 82.316406 199.839844 L 83.007812 200.503906 L 83.699219 202.144531 L 84.390625 202.300781 L 85.078125 200.015625 L 85.769531 203.554688 L 86.460938 211.707031 L 87.152344 219.273438 L 87.839844 212.527344 L 88.53125 219.097656 L 89.222656 222.40625 L 89.914062 220.824219 L 90.601562 221.734375 L 91.292969 224.421875 L 91.984375 225.644531 L 92.675781 227.585938 L 93.363281 225.769531 L 94.054688 218.96875 L 94.746094 218.160156 L 95.4375 211.414062 L 96.128906 204.007812 L 96.816406 207.203125 L 97.507812 213.332031 L 98.199219 204.328125 L 98.890625 199.023438 L 99.578125 206.480469 L 100.269531 199.015625 L 100.960938 203.097656 L 101.652344 209.425781 L 102.339844 217.5 L 103.03125 211.09375 L 103.722656 213.789062 L 104.414062 211.347656 L 105.101562 217.386719 L 105.792969 219.132812 L 106.484375 219.339844 L 107.175781 212.023438 L 107.863281 204.355469 L 108.554688 196.28125 L 109.246094 200.84375 L 109.9375 196.429688 L 110.625 194.125 L 111.316406 201.539062 L 112.007812 201.007812 L 112.699219 194.28125 L 113.386719 201.957031 L 114.078125 203.238281 L 114.769531 202.875 L 115.460938 205.628906 L 116.148438 201.074219 L 116.839844 205.359375 L 117.53125 209.160156 L 118.222656 208.898438 L 118.910156 215.582031 L 119.601562 221.285156 L 120.292969 213.707031 L 120.984375 213.035156 L 121.671875 214.113281 L 122.363281 215.179688 L 123.054688 212.726562 L 123.746094 206.707031 L 124.433594 202.972656 L 125.125 201.636719 L 125.816406 204.148438 L 126.507812 207.515625 L 127.195312 208.179688 L 127.886719 212.183594 L 128.578125 207.226562 L 129.269531 207.117188 L 129.957031 200.328125 L 130.648438 192.488281 L 131.339844 198.480469 L 132.03125 205.988281 L 132.71875 197.113281 L 133.410156 203.714844 L 134.101562 195.613281 L 134.792969 190.847656 L 135.480469 194.273438 L 136.171875 200.6875 L 136.863281 195.222656 L 137.554688 190.21875 L 138.242188 183.472656 L 138.933594 182.324219 L 139.625 190.910156 L 140.316406 188.316406 L 141.003906 190.277344 L 141.695312 199.34375 L 142.386719 205.507812 L 143.078125 210.085938 L 143.765625 219.046875 L 144.457031 218.640625 L 145.148438 210.242188 L 145.839844 213.558594 L 146.527344 206.863281 L 147.21875 204.960938 L 147.910156 196.65625 L 148.601562 190.046875 L 149.289062 181.253906 L 149.980469 186.496094 L 150.671875 186.851562 L 151.363281 182.386719 L 152.050781 182.757812 L 152.742188 177.558594 L 153.433594 176.535156 "/>
<path style="fill:none;stroke-width:0.853645;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(100%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 153.433594 176.535156 L 154.125 168.285156 L 154.8125 167.597656 L 155.503906 175.214844 L 156.195312 173.621094 L 156.886719 182.082031 L 157.574219 180.375 L 158.265625 179.5625 L 158.957031 173.746094 L 159.648438 174.769531 L 160.335938 169.75 L 161.027344 164 L 161.71875 163.308594 L 162.410156 156.359375 L 163.097656 151.125 L 163.789062 145.957031 L 164.480469 142.183594 L 165.171875 140.875 L 165.859375 143.761719 L 166.550781 144.023438 L 167.242188 147.230469 L 167.933594 155.320312 L 168.621094 148.609375 L 169.3125 145.84375 L 170.003906 139.675781 L 170.695312 141.980469 L 171.382812 136.6875 L 172.074219 133.65625 L 172.765625 128.714844 L 173.457031 135.691406 L 174.144531 136.4375 L 174.835938 139.320312 L 175.527344 135.953125 L 176.21875 138.007812 L 176.90625 140.066406 L 177.597656 134.910156 L 178.289062 142.886719 L 178.980469 138.234375 L 179.667969 135.234375 L 180.359375 137.515625 L 181.050781 135.601562 L 181.742188 140.246094 L 182.429688 148.335938 L 183.121094 141.140625 L 183.8125 134.304688 L 184.503906 127.488281 L 185.191406 123.042969 L 185.882812 118.960938 L 186.574219 122.175781 L 187.265625 120.308594 L 187.953125 116.695312 L 188.644531 117.011719 L 189.335938 119.125 L 190.027344 124.566406 L 190.714844 123.664062 L 191.40625 115.644531 L 192.097656 120.910156 L 192.789062 124.535156 L 193.476562 128.125 L 194.167969 131.527344 L 194.859375 125.199219 L 195.550781 122.703125 L 196.238281 124.199219 L 196.929688 131.503906 L 197.621094 130.402344 L 198.3125 137.035156 L 199 135.289062 L 199.691406 129.230469 L 200.382812 132.425781 L 201.074219 141.371094 L 201.761719 138.039062 L 202.453125 143.988281 L 203.144531 145.058594 L 203.835938 144.875 L 204.523438 146.152344 L 205.214844 139.28125 L 205.90625 135.128906 L 206.597656 133.832031 L 207.285156 137.761719 L 207.976562 138.421875 L 208.667969 143.476562 L 209.359375 150.480469 L 210.046875 152.226562 L 210.738281 145.195312 L 211.429688 149.625 L 212.121094 151.285156 L 212.808594 147.300781 L 213.5 141.644531 L 214.191406 141.265625 L 214.882812 139.1875 L 215.570312 138.652344 L 216.261719 137.773438 L 216.953125 146.65625 L 217.644531 149.929688 L 218.332031 150.292969 L 219.023438 154.644531 L 219.714844 148.371094 L 220.40625 151.523438 L 221.09375 151.179688 L 221.785156 151.097656 L 222.476562 150.289062 L 223.167969 146.742188 L 223.855469 137.851562 L 224.546875 136.085938 L 225.238281 129.226562 L 225.929688 124.425781 L 226.617188 131.222656 L 227.308594 140.300781 L 228 133.355469 L 228.691406 141.476562 L 229.378906 147.816406 L 230.070312 140.972656 L 230.761719 140.488281 L 231.453125 149.542969 L 232.140625 145.988281 L 232.832031 138.644531 L 233.523438 146.386719 L 234.214844 147.886719 L 234.902344 142.21875 L 235.59375 141.796875 L 236.285156 140.109375 L 236.976562 143.632812 L 237.664062 137.074219 L 238.355469 143.300781 L 239.046875 141.550781 L 239.738281 140.425781 L 240.425781 139.738281 L 241.117188 138.433594 L 241.808594 136.894531 "/>
<path style="fill:none;stroke-width:0.853645;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(100%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 241.808594 136.894531 L 242.5 129.683594 L 243.1875 137.179688 L 243.878906 130.164062 L 244.570312 131.421875 L 245.261719 135.050781 L 245.949219 138.792969 L 246.640625 145.089844 L 247.332031 143.746094 L 248.023438 136.125 L 248.710938 144.503906 L 249.402344 148.210938 L 250.09375 142.414062 L 250.785156 146.457031 L 251.472656 144.902344 L 252.164062 140.238281 L 252.855469 141.289062 L 253.546875 132.667969 L 254.234375 135.585938 L 254.925781 138.679688 L 255.617188 140.894531 L 256.308594 148.578125 L 256.996094 149.164062 L 257.6875 157.507812 L 258.378906 149.835938 L 259.070312 156.96875 L 259.757812 153.074219 L 260.449219 159.882812 L 261.140625 162.398438 L 261.832031 171.417969 L 262.519531 177.835938 L 263.210938 182.8125 L 263.902344 191.789062 L 264.59375 183.96875 L 265.28125 180.496094 L 265.972656 179.453125 L 266.664062 175.453125 L 267.355469 183.210938 L 268.042969 187.597656 L 268.734375 192.375 L 269.425781 183.394531 L 270.117188 180.175781 L 270.804688 184.003906 L 271.496094 187.015625 L 272.1875 183.257812 L 272.878906 189.703125 L 273.566406 182.753906 L 274.257812 186.5 L 274.949219 182.53125 L 275.640625 176.492188 L 276.328125 179.402344 L 277.019531 178.808594 L 277.710938 177.519531 L 278.402344 170.457031 L 279.089844 163.746094 L 279.78125 169.625 L 280.472656 173.15625 L 281.164062 177.953125 L 281.851562 172.8125 L 282.542969 164.695312 L 283.234375 157.472656 L 283.925781 164.429688 L 284.613281 156.175781 L 285.304688 147.363281 L 285.996094 152.285156 L 286.6875 160.066406 L 287.375 169 L 288.066406 165.839844 L 288.757812 169.378906 L 289.449219 172.585938 L 290.136719 175.90625 L 290.828125 180.761719 L 291.519531 174.199219 L 292.210938 177.667969 L 292.898438 181.410156 L 293.589844 175.261719 L 294.28125 175.332031 L 294.972656 177.566406 L 295.660156 169.265625 L 296.351562 166.886719 L 297.042969 167.371094 L 297.734375 166.578125 L 298.421875 174.105469 L 299.113281 176.136719 L 299.804688 176.894531 L 300.496094 175.128906 L 301.183594 175.910156 L 301.875 176.871094 L 302.566406 172.15625 L 303.257812 172.570312 L 303.945312 179.945312 L 304.636719 177.316406 L 305.328125 177.015625 L 306.019531 178.082031 L 306.707031 173.449219 L 307.398438 180.046875 L 308.089844 178.339844 L 308.78125 174.292969 L 309.46875 177.949219 L 310.160156 186.863281 L 310.851562 192.355469 L 311.542969 188.714844 L 312.230469 192.617188 L 312.921875 199.609375 L 313.613281 208.039062 L 314.304688 214.246094 L 314.992188 212.972656 L 315.683594 216.734375 L 316.375 213.171875 L 317.066406 204.636719 L 317.753906 204.726562 L 318.445312 199.898438 L 319.136719 198.328125 L 319.828125 191.9375 L 320.515625 186.582031 L 321.207031 190.640625 L 321.898438 191.414062 L 322.589844 188.019531 L 323.277344 191.566406 L 323.96875 182.792969 L 324.660156 176.511719 L 325.351562 170.613281 L 326.039062 178.75 L 326.730469 181.421875 L 327.421875 176.726562 L 328.113281 169.871094 L 328.800781 164.429688 L 329.492188 156.359375 L 330.183594 152.730469 "/>
<path style="fill:none;stroke-width:0.853645;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(100%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 330.183594 152.730469 L 330.875 155.539062 L 331.5625 151.082031 L 332.253906 142.398438 L 332.945312 141.886719 L 333.636719 136.871094 L 334.324219 141.507812 L 335.015625 147.171875 L 335.707031 149.445312 L 336.398438 152.960938 L 337.085938 159.335938 L 337.777344 154.445312 L 338.46875 156.84375 L 339.160156 163.132812 L 339.847656 168.179688 L 340.539062 162.445312 L 341.230469 158.65625 L 341.921875 164.984375 L 342.613281 172.832031 L 343.300781 167.492188 L 343.992188 160.441406 L 344.683594 162.65625 L 345.375 154.714844 L 346.0625 162.320312 L 346.753906 170.28125 L 347.445312 176.398438 L 348.136719 184.726562 L 348.824219 181.957031 L 349.515625 182.4375 L 350.207031 188.382812 L 350.898438 187.082031 L 351.585938 192.40625 L 352.277344 188.882812 L 352.96875 197.636719 L 353.660156 190.6875 L 354.347656 191.171875 L 355.039062 184.800781 L 355.730469 189.382812 L 356.421875 182.878906 L 357.109375 177.5625 L 357.800781 182.644531 L 358.492188 190.351562 L 359.183594 188.03125 L 359.871094 191.125 L 360.5625 192.300781 L 361.253906 186.410156 L 361.945312 180.582031 L 362.632812 174.015625 L 363.324219 177.296875 L 364.015625 170.597656 L 364.707031 165.183594 L 365.394531 166.808594 L 366.085938 164.929688 L 366.777344 162.636719 L 367.46875 166.890625 L 368.15625 172.363281 L 368.847656 163.570312 L 369.539062 168.335938 L 370.230469 164.480469 L 370.917969 158.753906 L 371.609375 164.199219 L 372.300781 168.226562 L 372.992188 168.992188 L 373.679688 167.523438 L 374.371094 174.425781 L 375.0625 166.335938 L 375.753906 157.558594 L 376.441406 154.59375 L 377.132812 153.90625 L 377.824219 151.363281 L 378.515625 154.195312 L 379.203125 146.785156 L 379.894531 151.203125 L 380.585938 155.789062 L 381.277344 157.175781 L 381.964844 158.609375 L 382.65625 154.980469 L 383.347656 161.558594 L 384.039062 155.097656 L 384.726562 159.085938 L 385.417969 152.277344 L 386.109375 160.808594 L 386.800781 167.421875 L 387.488281 170.699219 L 388.179688 175.917969 L 388.871094 178.355469 L 389.5625 174.632812 L 390.25 182.910156 L 390.941406 181.777344 L 391.632812 184.28125 L 392.324219 177.515625 L 393.011719 169.648438 L 393.703125 162.761719 L 394.394531 165.328125 L 395.085938 165.929688 L 395.773438 167.757812 L 396.464844 158.839844 L 397.15625 156.054688 L 397.847656 154.359375 L 398.535156 153.445312 L 399.226562 154.105469 L 399.917969 148.242188 L 400.609375 139.882812 L 401.296875 136.238281 L 401.988281 139.890625 L 402.679688 143.039062 L 403.371094 145.253906 L 404.058594 139.445312 L 404.75 132.792969 L 405.441406 141.859375 L 406.132812 132.972656 L 406.820312 137.332031 L 407.511719 143.351562 L 408.203125 143.84375 L 408.894531 140.710938 L 409.582031 146.609375 L 410.273438 150.082031 "/>
<g clip-path="url(#clip1)" clip-rule="nonzero">
<path style="fill:none;stroke-width:0.853645;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;" d="M 65.746094 192.507812 L 66.4375 200.253906 L 67.128906 202.152344 L 67.820312 196.925781 L 68.507812 202.089844 L 69.199219 208.316406 L 69.890625 212.085938 L 70.582031 209.59375 L 71.269531 204.332031 L 71.960938 203.140625 L 72.652344 209.046875 L 73.34375 210.300781 L 74.03125 210.863281 L 74.722656 210.296875 L 75.414062 210.675781 L 76.105469 219.632812 L 76.792969 217.78125 L 77.484375 212.75 L 78.175781 207.828125 L 78.867188 211.441406 L 79.554688 219.683594 L 80.246094 213.011719 L 80.9375 205.667969 L 81.628906 207.335938 L 82.316406 198.714844 L 83.007812 189.828125 L 83.699219 194.488281 L 84.390625 191.011719 L 85.078125 196.386719 L 85.769531 199.855469 L 86.460938 201.445312 L 87.152344 204.941406 L 87.839844 212.835938 L 88.53125 216.574219 L 89.222656 219.425781 L 89.914062 217.308594 L 90.601562 218.773438 L 91.292969 222.109375 L 91.984375 219.320312 L 92.675781 226.335938 L 93.363281 223.527344 L 94.054688 226.328125 L 94.746094 221.375 L 95.4375 225.976562 L 96.128906 226.726562 L 96.816406 219.613281 L 97.507812 224.785156 L 98.199219 230.058594 L 98.890625 232.777344 L 99.578125 234.066406 L 100.269531 225.09375 L 100.960938 223.195312 L 101.652344 224.753906 L 102.339844 224.527344 L 103.03125 227.644531 L 103.722656 222.59375 L 104.414062 214.5 L 105.101562 222.925781 L 105.792969 229.871094 L 106.484375 221.257812 L 107.175781 213.601562 L 107.863281 213.757812 L 108.554688 211.378906 L 109.246094 212.527344 L 109.9375 212.96875 L 110.625 216.363281 L 111.316406 214.28125 L 112.007812 214.351562 L 112.699219 222.597656 L 113.386719 216.53125 L 114.078125 219.125 L 114.769531 217.179688 L 115.460938 224.660156 L 116.148438 221.804688 L 116.839844 230.082031 L 117.53125 228.398438 L 118.222656 235.882812 L 118.910156 233.195312 L 119.601562 233.914062 L 120.292969 242.691406 L 120.984375 244.21875 L 121.671875 250.613281 L 122.363281 252.925781 L 123.054688 248.847656 L 123.746094 254.351562 L 124.433594 251.617188 L 125.125 243.886719 L 125.816406 245.074219 L 126.507812 249.519531 L 127.195312 252.457031 L 127.886719 249.488281 L 128.578125 244.472656 L 129.269531 237.101562 L 129.957031 229.367188 L 130.648438 232.988281 L 131.339844 230.9375 L 132.03125 237.367188 L 132.71875 236.808594 L 133.410156 231.011719 L 134.101562 229.964844 L 134.792969 229.976562 L 135.480469 226.984375 L 136.171875 225.515625 L 136.863281 217.007812 L 137.554688 222.183594 L 138.242188 213.144531 L 138.933594 210.878906 L 139.625 206.179688 L 140.316406 199.5 L 141.003906 199.253906 L 141.695312 198.214844 L 142.386719 191.222656 L 143.078125 186.929688 L 143.765625 178.628906 L 144.457031 178.972656 L 145.148438 184.9375 L 145.839844 190.875 L 146.527344 191.109375 L 147.21875 199.160156 L 147.910156 197.207031 L 148.601562 204.183594 L 149.289062 209.488281 L 149.980469 202.878906 L 150.671875 203.539062 L 151.363281 209.351562 L 152.050781 210.644531 L 152.742188 203.960938 L 153.433594 204.585938 "/>
</g>
<path style="fill:none;stroke-width:0.853645;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;" d="M 153.433594 204.585938 L 154.125 210.578125 L 154.8125 213.5625 L 155.503906 220.292969 L 156.195312 222.894531 L 156.886719 215.640625 L 157.574219 212.410156 L 158.265625 220.785156 L 158.957031 222.460938 L 159.648438 229.878906 L 160.335938 225.117188 L 161.027344 218.386719 L 161.71875 221.699219 L 162.410156 215.746094 L 163.097656 209.574219 L 163.789062 217.546875 L 164.480469 225.105469 L 165.171875 226.425781 L 165.859375 226.253906 L 166.550781 221.828125 L 167.242188 228.101562 L 167.933594 223.230469 L 168.621094 224.109375 L 169.3125 229.121094 L 170.003906 236.175781 L 170.695312 233.9375 L 171.382812 224.96875 L 172.074219 231.132812 L 172.765625 222.339844 L 173.457031 223.144531 L 174.144531 228.441406 L 174.835938 224.191406 L 175.527344 218.132812 L 176.21875 221.558594 L 176.90625 213.128906 L 177.597656 205.621094 L 178.289062 209.238281 L 178.980469 210.09375 L 179.667969 204.164062 L 180.359375 195.890625 L 181.050781 190.617188 L 181.742188 196.0625 L 182.429688 200.851562 L 183.121094 198.675781 L 183.8125 206.820312 L 184.503906 200.125 L 185.191406 208.722656 L 185.882812 201.953125 L 186.574219 205.777344 L 187.265625 202.722656 L 187.953125 200.523438 L 188.644531 193.285156 L 189.335938 201.75 L 190.027344 205.53125 L 190.714844 204.214844 L 191.40625 206.800781 L 192.097656 214.09375 L 192.789062 221.367188 L 193.476562 214.945312 L 194.167969 215.753906 L 194.859375 222.40625 L 195.550781 226.863281 L 196.238281 234.238281 L 196.929688 228.847656 L 197.621094 230.871094 L 198.3125 231.621094 L 199 236.925781 L 199.691406 241.046875 L 200.382812 233.394531 L 201.074219 228.484375 L 201.761719 228.917969 L 202.453125 234.34375 L 203.144531 233.550781 L 203.835938 232.269531 L 204.523438 237.25 L 205.214844 242.472656 L 205.90625 234.179688 L 206.597656 230.476562 L 207.285156 239.210938 L 207.976562 233.519531 L 208.667969 224.769531 L 209.359375 215.761719 L 210.046875 218.96875 L 210.738281 218.441406 L 211.429688 225.402344 L 212.121094 232.144531 L 212.808594 230.960938 L 213.5 225.164062 L 214.191406 233.503906 L 214.882812 229.03125 L 215.570312 225.285156 L 216.261719 221.125 L 216.953125 217.164062 L 217.644531 211.164062 L 218.332031 214.890625 L 219.023438 209.019531 L 219.714844 201.679688 L 220.40625 201.058594 L 221.09375 193.894531 L 221.785156 186.066406 L 222.476562 184.925781 L 223.167969 183.976562 L 223.855469 180.28125 L 224.546875 173.257812 L 225.238281 164.21875 L 225.929688 171.367188 L 226.617188 164.679688 L 227.308594 157.253906 L 228 151.546875 L 228.691406 156.777344 L 229.378906 153.394531 L 230.070312 145.808594 L 230.761719 142.304688 L 231.453125 135.855469 L 232.140625 135.027344 L 232.832031 141.507812 L 233.523438 145.203125 L 234.214844 141.699219 L 234.902344 147.410156 L 235.59375 145.082031 L 236.285156 144.042969 L 236.976562 147.566406 L 237.664062 151.875 L 238.355469 151.984375 L 239.046875 145.511719 L 239.738281 146.03125 L 240.425781 140.980469 L 241.117188 132.839844 L 241.808594 136.949219 "/>
<path style="fill:none;stroke-width:0.853645;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;" d="M 241.808594 136.949219 L 242.5 134.265625 L 243.1875 131.84375 L 243.878906 135.738281 L 244.570312 142.734375 L 245.261719 149.179688 L 245.949219 153.242188 L 246.640625 150.707031 L 247.332031 152.886719 L 248.023438 160.671875 L 248.710938 153.894531 L 249.402344 158.996094 L 250.09375 152.289062 L 250.785156 149.214844 L 251.472656 143.230469 L 252.164062 142.453125 L 252.855469 150.40625 L 253.546875 143.269531 L 254.234375 147.199219 L 254.925781 142.191406 L 255.617188 146.519531 L 256.308594 142.96875 L 256.996094 144.835938 L 257.6875 137.421875 L 258.378906 141.699219 L 259.070312 145.875 L 259.757812 140.589844 L 260.449219 132.890625 L 261.140625 131.054688 L 261.832031 133.25 L 262.519531 127.933594 L 263.210938 125.039062 L 263.902344 121.078125 L 264.59375 122.414062 L 265.28125 124.511719 L 265.972656 117.363281 L 266.664062 124.984375 L 267.355469 130.753906 L 268.042969 128.324219 L 268.734375 132.589844 L 269.425781 128.015625 L 270.117188 128.464844 L 270.804688 122.265625 L 271.496094 117.820312 L 272.1875 111.15625 L 272.878906 102.300781 L 273.566406 104.175781 L 274.257812 102.289062 L 274.949219 99.125 L 275.640625 94.910156 L 276.328125 88.675781 L 277.019531 80.964844 L 277.710938 75.609375 L 278.402344 82.628906 L 279.089844 90.617188 L 279.78125 82.570312 L 280.472656 90.300781 L 281.164062 87.984375 L 281.851562 79.660156 L 282.542969 83.074219 L 283.234375 78.050781 L 283.925781 86.925781 L 284.613281 81.019531 L 285.304688 86.675781 L 285.996094 83.359375 L 286.6875 85.621094 L 287.375 80.488281 L 288.066406 75.273438 L 288.757812 68.578125 L 289.449219 67.226562 L 290.136719 75.203125 L 290.828125 68.792969 L 291.519531 69.640625 L 292.210938 78.585938 L 292.898438 82.164062 L 293.589844 90.925781 L 294.28125 86.347656 L 294.972656 89.820312 L 295.660156 94.816406 L 296.351562 96.597656 L 297.042969 101.660156 L 297.734375 96.582031 L 298.421875 98.472656 L 299.113281 104.304688 L 299.804688 96.355469 L 300.496094 99.960938 L 301.183594 105.734375 L 301.875 99.207031 L 302.566406 104.410156 L 303.257812 104.335938 L 303.945312 105.027344 L 304.636719 101.480469 L 305.328125 107.769531 L 306.019531 109.089844 L 306.707031 101.988281 L 307.398438 94.320312 L 308.089844 101.777344 L 308.78125 97.550781 L 309.46875 92.0625 L 310.160156 94.390625 L 310.851562 86.695312 L 311.542969 85.785156 L 312.230469 94.210938 L 312.921875 87.546875 L 313.613281 89.488281 L 314.304688 81.589844 L 314.992188 86.492188 L 315.683594 80.632812 L 316.375 87.648438 L 317.066406 95.816406 L 317.753906 99.675781 L 318.445312 101.753906 L 319.136719 106.117188 L 319.828125 109.15625 L 320.515625 106.492188 L 321.207031 106.894531 L 321.898438 107.855469 L 322.589844 113.316406 L 323.277344 120.496094 L 323.96875 111.503906 L 324.660156 117.074219 L 325.351562 117.914062 L 326.039062 124.390625 L 326.730469 127.039062 L 327.421875 128.71875 L 328.113281 127 L 328.800781 133.769531 L 329.492188 139.566406 L 330.183594 140.496094 "/>
<g clip-path="url(#clip2)" clip-rule="nonzero">
<path style="fill:none;stroke-width:0.853645;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;" d="M 330.183594 140.496094 L 330.875 134.402344 L 331.5625 127.617188 L 332.253906 124.976562 L 332.945312 132.210938 L 333.636719 128.21875 L 334.324219 120.890625 L 335.015625 117.351562 L 335.707031 113.066406 L 336.398438 120.929688 L 337.085938 115.011719 L 337.777344 108.089844 L 338.46875 107.992188 L 339.160156 108.558594 L 339.847656 117.0625 L 340.539062 119.738281 L 341.230469 124.585938 L 341.921875 122.5 L 342.613281 115.695312 L 343.300781 116.578125 L 343.992188 122.257812 L 344.683594 128.835938 L 345.375 129.257812 L 346.0625 133.730469 L 346.753906 125.894531 L 347.445312 127.886719 L 348.136719 123.839844 L 348.824219 121.496094 L 349.515625 129.117188 L 350.207031 136.519531 L 350.898438 128.757812 L 351.585938 131.039062 L 352.277344 124.648438 L 352.96875 124.203125 L 353.660156 115.886719 L 354.347656 108.660156 L 355.039062 113.949219 L 355.730469 108.867188 L 356.421875 108.835938 L 357.109375 101.648438 L 357.800781 96.644531 L 358.492188 103.375 L 359.183594 97.042969 L 359.871094 97.316406 L 360.5625 100.078125 L 361.253906 91.8125 L 361.945312 86.304688 L 362.632812 83.757812 L 363.324219 74.890625 L 364.015625 73.632812 L 364.707031 71.542969 L 365.394531 75.726562 L 366.085938 72.945312 L 366.777344 64.292969 L 367.46875 56.5625 L 368.15625 60.433594 L 368.847656 55.367188 L 369.539062 57.308594 L 370.230469 61.507812 L 370.917969 67.558594 L 371.609375 66.648438 L 372.300781 72.792969 L 372.992188 72.117188 L 373.679688 72.382812 L 374.371094 72.675781 L 375.0625 67.886719 L 375.753906 75.253906 L 376.441406 82.488281 L 377.132812 76.109375 L 377.824219 82.207031 L 378.515625 80.402344 L 379.203125 87.070312 L 379.894531 82.875 L 380.585938 89.9375 L 381.277344 97.882812 L 381.964844 93.449219 L 382.65625 85.320312 L 383.347656 81.507812 L 384.039062 81.546875 L 384.726562 74.398438 L 385.417969 81.605469 L 386.109375 86.925781 L 386.800781 81.277344 L 387.488281 90.042969 L 388.179688 83.351562 L 388.871094 75.625 L 389.5625 69.75 L 390.25 74.546875 L 390.941406 73.339844 L 391.632812 75.621094 L 392.324219 71.421875 L 393.011719 74.226562 L 393.703125 74.640625 L 394.394531 69.957031 L 395.085938 71.074219 L 395.773438 64.96875 L 396.464844 63.308594 L 397.15625 69.375 L 397.847656 61.972656 L 398.535156 54.789062 L 399.226562 46.726562 L 399.917969 49.550781 L 400.609375 53.683594 L 401.296875 62.152344 L 401.988281 53.222656 L 402.679688 61.878906 L 403.371094 66.929688 L 404.058594 62.246094 L 404.75 60.601562 L 405.441406 51.851562 L 406.132812 44.886719 L 406.820312 38.675781 L 407.511719 33.242188 L 408.203125 30.820312 L 408.894531 31.585938 L 409.582031 26.398438 L 410.273438 31.789062 "/>
</g>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 427.5 261.613281 L 424.300781 261.613281 M 427.5 252.527344 L 424.300781 252.527344 M 427.5 243.441406 L 424.300781 243.441406 M 427.5 234.355469 L 424.300781 234.355469 M 427.5 225.269531 L 424.300781 225.269531 M 427.5 216.183594 L 424.300781 216.183594 M 427.5 207.097656 L 424.300781 207.097656 M 427.5 198.011719 L 424.300781 198.011719 M 427.5 188.925781 L 424.300781 188.925781 M 427.5 179.839844 L 424.300781 179.839844 M 427.5 170.753906 L 424.300781 170.753906 M 427.5 161.667969 L 424.300781 161.667969 M 427.5 152.585938 L 424.300781 152.585938 M 427.5 143.5 L 424.300781 143.5 M 427.5 134.414062 L 424.300781 134.414062 M 427.5 125.328125 L 424.300781 125.328125 M 427.5 116.242188 L 424.300781 116.242188 M 427.5 107.15625 L 424.300781 107.15625 M 427.5 98.070312 L 424.300781 98.070312 M 427.5 88.984375 L 424.300781 88.984375 M 427.5 79.898438 L 424.300781 79.898438 M 427.5 70.8125 L 424.300781 70.8125 M 427.5 61.726562 L 424.300781 61.726562 M 427.5 52.640625 L 424.300781 52.640625 M 427.5 43.554688 L 424.300781 43.554688 M 427.5 34.46875 L 424.300781 34.46875 M 427.5 25.382812 L 424.300781 25.382812 M 427.5 16.296875 L 424.300781 16.296875 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 427.5 261.613281 L 421.097656 261.613281 M 427.5 225.269531 L 421.097656 225.269531 M 427.5 188.925781 L 421.097656 188.925781 M 427.5 152.585938 L 421.097656 152.585938 M 427.5 116.242188 L 421.097656 116.242188 M 427.5 79.898438 L 421.097656 79.898438 M 427.5 43.554688 L 421.097656 43.554688 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 427.5 265.75 L 427.5 15 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 51.25 15 L 51.25 18.199219 M 65.058594 15 L 65.058594 18.199219 M 78.867188 15 L 78.867188 18.199219 M 92.675781 15 L 92.675781 18.199219 M 106.484375 15 L 106.484375 18.199219 M 120.292969 15 L 120.292969 18.199219 M 134.101562 15 L 134.101562 18.199219 M 147.910156 15 L 147.910156 18.199219 M 161.71875 15 L 161.71875 18.199219 M 175.527344 15 L 175.527344 18.199219 M 189.335938 15 L 189.335938 18.199219 M 203.144531 15 L 203.144531 18.199219 M 216.953125 15 L 216.953125 18.199219 M 230.761719 15 L 230.761719 18.199219 M 244.570312 15 L 244.570312 18.199219 M 258.378906 15 L 258.378906 18.199219 M 272.1875 15 L 272.1875 18.199219 M 285.996094 15 L 285.996094 18.199219 M 299.804688 15 L 299.804688 18.199219 M 313.613281 15 L 313.613281 18.199219 M 327.421875 15 L 327.421875 18.199219 M 341.230469 15 L 341.230469 18.199219 M 355.039062 15 L 355.039062 18.199219 M 368.847656 15 L 368.847656 18.199219 M 382.65625 15 L 382.65625 18.199219 M 396.464844 15 L 396.464844 18.199219 M 410.273438 15 L 410.273438 18.199219 M 424.082031 15 L 424.082031 18.199219 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 65.058594 15 L 65.058594 21.402344 M 134.101562 15 L 134.101562 21.402344 M 203.144531 15 L 203.144531 21.402344 M 272.1875 15 L 272.1875 21.402344 M 341.230469 15 L 341.230469 21.402344 M 410.273438 15 L 410.273438 21.402344 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 48.523438 15 L 427.5 15 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 48.523438 261.613281 L 51.722656 261.613281 M 48.523438 252.527344 L 51.722656 252.527344 M 48.523438 243.441406 L 51.722656 243.441406 M 48.523438 234.355469 L 51.722656 234.355469 M 48.523438 225.269531 L 51.722656 225.269531 M 48.523438 216.183594 L 51.722656 216.183594 M 48.523438 207.097656 L 51.722656 207.097656 M 48.523438 198.011719 L 51.722656 198.011719 M 48.523438 188.925781 L 51.722656 188.925781 M 48.523438 179.839844 L 51.722656 179.839844 M 48.523438 170.753906 L 51.722656 170.753906 M 48.523438 161.667969 L 51.722656 161.667969 M 48.523438 152.585938 L 51.722656 152.585938 M 48.523438 143.5 L 51.722656 143.5 M 48.523438 134.414062 L 51.722656 134.414062 M 48.523438 125.328125 L 51.722656 125.328125 M 48.523438 116.242188 L 51.722656 116.242188 M 48.523438 107.15625 L 51.722656 107.15625 M 48.523438 98.070312 L 51.722656 98.070312 M 48.523438 88.984375 L 51.722656 88.984375 M 48.523438 79.898438 L 51.722656 79.898438 M 48.523438 70.8125 L 51.722656 70.8125 M 48.523438 61.726562 L 51.722656 61.726562 M 48.523438 52.640625 L 51.722656 52.640625 M 48.523438 43.554688 L 51.722656 43.554688 M 48.523438 34.46875 L 51.722656 34.46875 M 48.523438 25.382812 L 51.722656 25.382812 M 48.523438 16.296875 L 51.722656 16.296875 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 48.523438 261.613281 L 54.925781 261.613281 M 48.523438 225.269531 L 54.925781 225.269531 M 48.523438 188.925781 L 54.925781 188.925781 M 48.523438 152.585938 L 54.925781 152.585938 M 48.523438 116.242188 L 54.925781 116.242188 M 48.523438 79.898438 L 54.925781 79.898438 M 48.523438 43.554688 L 54.925781 43.554688 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 48.523438 265.75 L 48.523438 15 "/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-1" x="23.121094" y="265.999023"/>
<use xlink:href="#glyph0-2" x="33.856445" y="265.999023"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-1" x="23.121094" y="229.655273"/>
<use xlink:href="#glyph0-3" x="33.856445" y="229.655273"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-4" x="33.121094" y="193.311523"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-3" x="33.121094" y="156.97168"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-2" x="33.121094" y="120.62793"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-5" x="33.121094" y="84.28418"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-6" x="33.121094" y="47.94043"/>
</g>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 51.25 265.75 L 51.25 262.550781 M 65.058594 265.75 L 65.058594 262.550781 M 78.867188 265.75 L 78.867188 262.550781 M 92.675781 265.75 L 92.675781 262.550781 M 106.484375 265.75 L 106.484375 262.550781 M 120.292969 265.75 L 120.292969 262.550781 M 134.101562 265.75 L 134.101562 262.550781 M 147.910156 265.75 L 147.910156 262.550781 M 161.71875 265.75 L 161.71875 262.550781 M 175.527344 265.75 L 175.527344 262.550781 M 189.335938 265.75 L 189.335938 262.550781 M 203.144531 265.75 L 203.144531 262.550781 M 216.953125 265.75 L 216.953125 262.550781 M 230.761719 265.75 L 230.761719 262.550781 M 244.570312 265.75 L 244.570312 262.550781 M 258.378906 265.75 L 258.378906 262.550781 M 272.1875 265.75 L 272.1875 262.550781 M 285.996094 265.75 L 285.996094 262.550781 M 299.804688 265.75 L 299.804688 262.550781 M 313.613281 265.75 L 313.613281 262.550781 M 327.421875 265.75 L 327.421875 262.550781 M 341.230469 265.75 L 341.230469 262.550781 M 355.039062 265.75 L 355.039062 262.550781 M 368.847656 265.75 L 368.847656 262.550781 M 382.65625 265.75 L 382.65625 262.550781 M 396.464844 265.75 L 396.464844 262.550781 M 410.273438 265.75 L 410.273438 262.550781 M 424.082031 265.75 L 424.082031 262.550781 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 65.058594 265.75 L 65.058594 259.347656 M 134.101562 265.75 L 134.101562 259.347656 M 203.144531 265.75 L 203.144531 259.347656 M 272.1875 265.75 L 272.1875 259.347656 M 341.230469 265.75 L 341.230469 259.347656 M 410.273438 265.75 L 410.273438 259.347656 "/>
<path style="fill:none;stroke-width:0.640234;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 48.523438 265.75 L 427.5 265.75 "/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-4" x="60.558594" y="284.038086"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-7" x="121.601562" y="284.038086"/>
<use xlink:href="#glyph0-4" x="129.75293" y="284.038086"/>
<use xlink:href="#glyph0-4" x="137.904297" y="284.038086"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-3" x="190.644531" y="284.038086"/>
<use xlink:href="#glyph0-4" x="198.795898" y="284.038086"/>
<use xlink:href="#glyph0-4" x="206.947266" y="284.038086"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-8" x="259.6875" y="284.038086"/>
<use xlink:href="#glyph0-4" x="267.838867" y="284.038086"/>
<use xlink:href="#glyph0-4" x="275.990234" y="284.038086"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-2" x="328.730469" y="284.038086"/>
<use xlink:href="#glyph0-4" x="336.881836" y="284.038086"/>
<use xlink:href="#glyph0-4" x="345.033203" y="284.038086"/>
</g>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
<use xlink:href="#glyph0-9" x="397.773438" y="284.038086"/>
<use xlink:href="#glyph0-4" x="405.924805" y="284.038086"/>
<use xlink:href="#glyph0-4" x="414.076172" y="284.038086"/>
</g>
</g>
</svg>
# AlphaFold
[AlphaFold][1] is an AI program designed as a deep learning system
developed by DeepMind, a subsidiary of Alphabet,
which performs predictions of protein structure.
## Installed Versions
AlphaFold is available on the Karolina cluster.
For the current list of installed versions, use:
```console
ml av alphafold
```
## Loading Databases
AlphaFold needs multiple genetic databases to run.
These can be downloaded using AlphaFold scripts located in the `apps/all/AlphaFold/2.1.2-fosscuda-2020b-TensorFlow-2.5.0/scripts` directory.
This step requires the `aria2c` program available as the `aria2/1.35.0-GCCcore-10.3.0` module.
Once downloaded, you must specify the path to the directory on `/scratch` containing the databases.
For more information, see the [AlphaFold documentation][2].
[1]: https://www.deepmind.com/research/highlighted-research/alphafold
[2]: https://github.com/deepmind/alphafold#genetic-databases