diff --git a/doc.zih.tu-dresden.de/docs/software/mathematics.md b/doc.zih.tu-dresden.de/docs/software/mathematics.md index 21aab2856a7b9582c3f6b8d5453d7ea2f8b6895b..5b8e23b2fd3ed373bdf7bf6394ae3b2faf98ce74 100644 --- a/doc.zih.tu-dresden.de/docs/software/mathematics.md +++ b/doc.zih.tu-dresden.de/docs/software/mathematics.md @@ -21,9 +21,9 @@ font manager. You need to copy the fonts from ZIH systems to your local system and expand the font path -```bash -localhost$ scp -r taurus.hrsk.tu-dresden.de:/sw/global/applications/mathematica/10.0/SystemFiles/Fonts/Type1/ ~/.fonts -localhost$ xset fp+ ~/.fonts/Type1 +```console +marie@local$ scp -r taurus.hrsk.tu-dresden.de:/sw/global/applications/mathematica/10.0/SystemFiles/Fonts/Type1/ ~/.fonts +marie@local$ xset fp+ ~/.fonts/Type1 ``` #### Windows Workstation @@ -93,29 +93,29 @@ interfaces with the Maple symbolic engine, allowing it to be part of a full comp Running MATLAB via the batch system could look like this (for 456 MB RAM per core and 12 cores reserved). Please adapt this to your needs! -```bash -zih$ module load MATLAB -zih$ srun -t 8:00 -c 12 --mem-per-cpu=456 --pty --x11=first bash -zih$ matlab +```console +marie@login$ module load MATLAB +marie@login$ srun --time=8:00 --cpus-per-task=12 --mem-per-cpu=456 --pty --x11=first bash +marie@compute$ matlab ``` With following command you can see a list of installed software - also the different versions of matlab. -```bash -zih$ module avail +```console +marie@login$ module avail ``` Please choose one of these, then load the chosen software with the command: ```bash -zih$ module load MATLAB/version +marie@login$ module load MATLAB/<version> ``` Or use: -```bash -zih$ module load MATLAB +```console +marie@login$ module load MATLAB ``` (then you will get the most recent Matlab version. @@ -126,8 +126,8 @@ zih$ module load MATLAB If X-server is running and you logged in at ZIH systems, you should allocate a CPU for your work with command -```bash -zih$ srun --pty --x11=first bash +```console +marie@login$ srun --pty --x11=first bash ``` - now you can call "matlab" (you have 8h time to work with the matlab-GUI) @@ -138,8 +138,9 @@ Using Scripts You have to start matlab-calculation as a Batch-Job via command -```bash -srun --pty matlab -nodisplay -r basename_of_your_matlab_script #NOTE: you must omit the file extension ".m" here, because -r expects a matlab command or function call, not a file-name. +```console +marie@login$ srun --pty matlab -nodisplay -r basename_of_your_matlab_script +# NOTE: you must omit the file extension ".m" here, because -r expects a matlab command or function call, not a file-name. ``` !!! info "License occupying" @@ -160,7 +161,7 @@ You can find detailed documentation on the Matlab compiler at Compile your `.m` script into a binary: ```bash -mcc -m name_of_your_matlab_script.m -o compiled_executable -R -nodisplay -R -nosplash +marie@login$ mcc -m name_of_your_matlab_script.m -o compiled_executable -R -nodisplay -R -nosplash ``` This will also generate a wrapper script called `run_compiled_executable.sh` which sets the required @@ -172,41 +173,35 @@ Then run the binary via the wrapper script in a job (just a simple example, you [sbatch script](../jobs_and_resources/slurm.md#job-submission) for that) ```bash -zih$ srun ./run_compiled_executable.sh $EBROOTMATLAB +marie@login$ srun ./run_compiled_executable.sh $EBROOTMATLAB ``` ### Parallel MATLAB #### With 'local' Configuration -- If you want to run your code in parallel, please request as many - cores as you need! -- start a batch job with the number N of processes -- example for N= 4: `srun -c 4 --pty --x11=first bash` -- run Matlab with the GUI or the CLI or with a script -- inside use `matlabpool open 4` to start parallel - processing +- If you want to run your code in parallel, please request as many cores as you need! +- Start a batch job with the number `N` of processes, e.g., `srun --cpus-per-task=4 --pty + --x11=first bash -l` +- Run Matlab with the GUI or the CLI or with a script +- Inside Matlab use `matlabpool open 4` to start parallel processing -- example for 1000*1000 matrix multiplication - -!!! example +!!! example "Example for 1000*1000 matrix-matrix multiplication" ```bash R = distributed.rand(1000); D = R * R ``` -- to close parallel task: -`matlabpool close` +- Close parallel task using `matlabpool close` #### With parfor -- start a batch job with the number N of processes (e.g. N=12) -- inside use `matlabpool open N` or - `matlabpool(N)` to start parallel processing. It will use +- Start a batch job with the number `N` of processes (,e.g., `N=12`) +- Inside use `matlabpool open N` or `matlabpool(N)` to start parallel processing. It will use the 'local' configuration by default. -- Use `parfor` for a parallel loop, where the **independent** loop - iterations are processed by N threads +- Use `parfor` for a parallel loop, where the **independent** loop iterations are processed by `N` + threads !!! example diff --git a/doc.zih.tu-dresden.de/util/grep-forbidden-patterns.sh b/doc.zih.tu-dresden.de/util/grep-forbidden-patterns.sh index 280e4003dc951164c86b44560d6c81e3a5dc640c..61fa310667e1cf995efa6f8869877f3a1878d456 100755 --- a/doc.zih.tu-dresden.de/util/grep-forbidden-patterns.sh +++ b/doc.zih.tu-dresden.de/util/grep-forbidden-patterns.sh @@ -6,41 +6,50 @@ scriptpath=${BASH_SOURCE[0]} basedir=`dirname "$scriptpath"` basedir=`dirname "$basedir"` -#This is the ruleset. Each line represents a rule of tab-separated fields. +#This is the ruleset. Each rule consists of a message (first line), a tab-separated list of files to skip (second line) and a pattern specification (third line). +#A pattern specification is a tab-separated list of fields: #The first field represents whether the match should be case-sensitive (s) or insensitive (i). #The second field represents the pattern that should not be contained in any file that is checked. #Further fields represent patterns with exceptions. #For example, the first rule says: # The pattern \<io\> should not be present in any file (case-insensitive match), except when it appears as ".io". ruleset="The word \"IO\" should not be used, use \"I/O\" instead. +doc.zih.tu-dresden.de/docs/contrib/content_rules.md i \<io\> \.io \"SLURM\" (only capital letters) should not be used, use \"Slurm\" instead. +doc.zih.tu-dresden.de/docs/contrib/content_rules.md s \<SLURM\> \"File system\" should be written as \"filesystem\", except when used as part of a proper name. +doc.zih.tu-dresden.de/docs/contrib/content_rules.md i file \+system HDFS Use \"ZIH systems\" or \"ZIH system\" instead of \"Taurus\". \"taurus\" is only allowed when used in ssh commands and other very specific situations. +doc.zih.tu-dresden.de/docs/contrib/content_rules.md i \<taurus\> taurus\.hrsk /taurus /TAURUS ssh ^[0-9]\+:Host taurus$ \"HRSKII\" should be avoided, use \"ZIH system\" instead. +doc.zih.tu-dresden.de/docs/contrib/content_rules.md i \<hrskii\> The term \"HPC-DA\" should be avoided. Depending on the situation, use \"data analytics\" or similar. +doc.zih.tu-dresden.de/docs/contrib/content_rules.md i hpc[ -]\+da\> \"ATTACHURL\" was a keyword in the old wiki, don't use it. + i attachurl Replace \"todo\" with real content. + i \<todo\> <!--.*todo.*--> Avoid spaces at end of lines. + i [[:space:]]$ When referencing partitions, put keyword \"partition\" in front of partition name, e. g. \"partition ml\", not \"ml partition\". +doc.zih.tu-dresden.de/docs/contrib/content_rules.md i \(alpha\|ml\|haswell\|romeo\|gpu\|smp\|julia\|hpdlf\|scs5\)-\?\(interactive\)\?[^a-z]*partition Give hints in the link text. Words such as \"here\" or \"this link\" are meaningless. +doc.zih.tu-dresden.de/docs/contrib/content_rules.md i \[\s\?\(documentation\|here\|this \(link\|page\|subsection\)\|slides\?\|manpage\)\s\?\] Use \"workspace\" instead of \"work space\" or \"work-space\". +doc.zih.tu-dresden.de/docs/contrib/content_rules.md i work[ -]\+space" -# Whitelisted files will be ignored -# Whitespace separated list with full path -whitelist=(doc.zih.tu-dresden.de/README.md doc.zih.tu-dresden.de/docs/contrib/content_rules.md) - function grepExceptions () { if [ $# -gt 0 ]; then firstPattern=$1 @@ -55,22 +64,29 @@ function checkFile(){ f=$1 echo "Check wording in file $f" while read message; do + IFS=$'\t' read -r -a files_to_skip + skipping="" + if (printf '%s\n' "${files_to_skip[@]}" | grep -xq $f); then + skipping=" -- skipping" + fi IFS=$'\t' read -r flags pattern exceptionPatterns while IFS=$'\t' read -r -a exceptionPatternsArray; do if [ $silent = false ]; then - echo " Pattern: $pattern" + echo " Pattern: $pattern$skipping" fi - grepflag= - case "$flags" in - "i") - grepflag=-i - ;; - esac - if grep -n $grepflag $color "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then - number_of_matches=`grep -n $grepflag $color "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" | wc -l` - ((cnt=cnt+$number_of_matches)) - if [ $silent = false ]; then - echo " $message" + if [ -z "$skipping" ]; then + grepflag= + case "$flags" in + "i") + grepflag=-i + ;; + esac + if grep -n $grepflag $color "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then + number_of_matches=`grep -n $grepflag $color "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" | wc -l` + ((cnt=cnt+$number_of_matches)) + if [ $silent = false ]; then + echo " $message" + fi fi fi done <<< $exceptionPatterns @@ -123,7 +139,7 @@ branch="origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-preview}" if [ $all_files = true ]; then echo "Search in all markdown files." - files=$(git ls-tree --full-tree -r --name-only HEAD $basedir/docs/ | grep .md) + files=$(git ls-tree --full-tree -r --name-only HEAD $basedir/ | grep .md) elif [[ ! -z $file ]]; then files=$file else @@ -138,10 +154,6 @@ if [[ ! -z $file ]]; then else for f in $files; do if [ "${f: -3}" == ".md" -a -f "$f" ]; then - if (printf '%s\n' "${whitelist[@]}" | grep -xq $f); then - echo "Skip whitelisted file $f" - continue - fi checkFile $f fi done