Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
software:lapack:caviness [2020-03-05 14:24] – [Compiling with intel and mkl library] anita | software:lapack:caviness [2021-04-27 16:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Compiling and testing LAPACK on Caviness ====== | ||
+ | |||
+ | The NAG sites has a [[http:// | ||
+ | |||
+ | ===== Getting the example files ===== | ||
+ | |||
+ | Each example in the NAG collection has a source file, a input file, and a output result file, which should match your result. | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | You can use **'' | ||
+ | |||
+ | <code bash> | ||
+ | if [ ! -f " | ||
+ | wget http:// | ||
+ | wget http:// | ||
+ | wget http:// | ||
+ | else | ||
+ | touch " | ||
+ | fi | ||
+ | </ | ||
+ | <note tip>You can just type the three **'' | ||
+ | already have.</ | ||
+ | |||
+ | ===== Compiling with Intel and MKL library ===== | ||
+ | |||
+ | The [[https:// | ||
+ | |||
+ | <note tip> | ||
+ | You can get the Package name and infer the update number from VALET, but you may also need the version of the compiler and the version of the LAPACK interfaces supported in the MKL component of the package. | ||
+ | |||
+ | | ||
+ | Intel Fortran Compiler updated to 14.0.2 | ||
+ | Intel Math Kernal Library updated to 11.1 Update 2 | ||
+ | |||
+ | and the details on the main product page for MKL 11.1, | ||
+ | | ||
+ | </ | ||
+ | ==== VALET and ifort ==== | ||
+ | |||
+ | Assuming you have the **'' | ||
+ | compile the source file to an executable that links with the MKL library. Remember VALET will choose the default version of the Intel Compiler Suite, if you do not specify a version. | ||
+ | |||
+ | < | ||
+ | workgroup -g << | ||
+ | vpkg_devrequire intel | ||
+ | ifort -mkl dgels-ex.f -o dgels-ex | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | < | ||
+ | | ||
+ | link to the Intel(R) Math Kernel Library (Intel(R) MKL) and bring | ||
+ | in the associated headers | ||
+ | parallel | ||
+ | is the default when -mkl is specified | ||
+ | sequential - link using the non-threaded Intel(R) MKL libraries | ||
+ | |||
+ | cluster | ||
+ | the sequential Intel(R) MKL libraries | ||
+ | </ | ||
+ | <note tip> | ||
+ | < | ||
+ | vpkg_devrequire intel | ||
+ | export FC=ifort | ||
+ | export FFLAGS=-mkl | ||
+ | make dgels-ex | ||
+ | </ | ||
+ | </ | ||
+ | ==== sbatch file to test ==== | ||
+ | |||
+ | The '' | ||
+ | <file bash test.qs> | ||
+ | #!/bin/bash -l | ||
+ | # | ||
+ | # Sections of this script that can/should be edited are delimited by a | ||
+ | # [EDIT] tag. All Slurm job options are denoted by a line that starts | ||
+ | # with "# | ||
+ | # the command line. Slurm job options can easily be disabled in a | ||
+ | # script by inserting a space in the prefix, e.g. "# SLURM " and | ||
+ | # reenabled by deleting that space. | ||
+ | # | ||
+ | # This is a batch job template for a program using multiple processor | ||
+ | # cores/ | ||
+ | # parallelism or explicit threading via the pthreads library. | ||
+ | # | ||
+ | # Do not alter the --nodes/ | ||
+ | #SBATCH --nodes=1 | ||
+ | #SBATCH --ntasks=1 | ||
+ | # | ||
+ | # [EDIT] Indicate the number of processor cores/ | ||
+ | # by the job: | ||
+ | # | ||
+ | #SBATCH --cpus-per-task=4 | ||
+ | # | ||
+ | # [EDIT] All jobs have memory limits imposed. | ||
+ | # CPU allocated to the job. The default can be overridden either | ||
+ | # with a per-node value (--mem) or a per-CPU value (--mem-per-cpu) | ||
+ | # with unitless values in MB and the suffixes K|M|G|T denoting | ||
+ | # kibi, mebi, gibi, and tebibyte units. | ||
+ | # the "#" | ||
+ | # | ||
+ | # SBATCH --mem=8G | ||
+ | # SBATCH --mem-per-cpu=1024M | ||
+ | # | ||
+ | # .... more options not used .... | ||
+ | # | ||
+ | # [EDIT] It can be helpful to provide a descriptive (terse) name for | ||
+ | # the job (be sure to use quotes if there' | ||
+ | # name): | ||
+ | # | ||
+ | #SBATCH --job-name=dgels-ex | ||
+ | # | ||
+ | # [EDIT] The partition determines which nodes can be used and with what | ||
+ | # maximum runtime limits, etc. Partition limits can be displayed | ||
+ | # with the "sinfo --summarize" | ||
+ | # | ||
+ | # SBATCH --partition=standard | ||
+ | # | ||
+ | # To run with priority-access to resources owned by your workgroup, | ||
+ | # use the " | ||
+ | # | ||
+ | #SBATCH --partition=_workgroup_ | ||
+ | # | ||
+ | # [EDIT] The maximum runtime for the job; a single integer is interpreted | ||
+ | # as a number of minutes, otherwise use the format | ||
+ | # | ||
+ | # d-hh:mm:ss | ||
+ | # | ||
+ | # Jobs default to the default runtime limit of the chosen partition | ||
+ | # if this option is omitted. | ||
+ | # | ||
+ | #SBATCH --time=0-02: | ||
+ | # | ||
+ | # You can also provide a minimum acceptable runtime so the scheduler | ||
+ | # may be able to run your job sooner. | ||
+ | # value, it will be set to match the maximum runtime limit (discussed | ||
+ | # above). | ||
+ | # | ||
+ | # SBATCH --time-min=0-01: | ||
+ | # | ||
+ | # .... more options not used .... | ||
+ | # | ||
+ | # Do standard OpenMP environment setup: | ||
+ | # | ||
+ | . / | ||
+ | |||
+ | # | ||
+ | # [EDIT] Execute your OpenMP/ | ||
+ | # | ||
+ | |||
+ | echo "--- Set environment ---" | ||
+ | vpkg_require intel | ||
+ | |||
+ | echo "" | ||
+ | echo "--- Run Test with $SLURM_CPUS_PER_TASK threads ---" | ||
+ | export MKL_NUM_THREADS=$SLURM_CPUS_PER_TASK | ||
+ | time ./ | ||
+ | |||
+ | echo "" | ||
+ | echo "--- Compare Results ---" | ||
+ | cat $SLURM_JOB_NAME.r | ||
+ | </ | ||
+ | |||
+ | ==== Test result output ==== | ||
+ | < | ||
+ | [traine@login01 nagex]$ workgroup -g it_css | ||
+ | [(it_css: | ||
+ | Submitted batch job 6718859 | ||
+ | [(it_css: | ||
+ | -- OpenMP job setup complete: | ||
+ | -- OMP_THREAD_LIMIT | ||
+ | -- OMP_PROC_BIND | ||
+ | -- OMP_PLACES | ||
+ | -- MP_BLIST | ||
+ | |||
+ | --- Set environment --- | ||
+ | Adding package `intel/ | ||
+ | |||
+ | --- Run Test with 4 threads --- | ||
+ | DGELS Example Program Results | ||
+ | |||
+ | Least squares solution | ||
+ | 1.5339 | ||
+ | |||
+ | | ||
+ | 2.22E-02 | ||
+ | |||
+ | real 0m1.043s | ||
+ | user 0m0.007s | ||
+ | sys | ||
+ | |||
+ | --- Compare Results --- | ||
+ | DGELS Example Program Results | ||
+ | |||
+ | Least squares solution | ||
+ | 1.5339 | ||
+ | |||
+ | | ||
+ | 2.22E-02 | ||
+ | </ | ||
+ | |||
+ | <note important> | ||
+ | you can compile an link a program to read the data file, call the LAPACK routine '' | ||
+ | |||
+ | ==== Sequential vs parallel ==== | ||
+ | |||
+ | This example used the default parallel MKL libraries. | ||
+ | |||
+ | * Programs with small arrays will not benefit from the multi-threaded library, and may suffer a bit from the system overhead of maintaining multiple threads. | ||
+ | * Sequential programs are better suited for running simultaneous instances. | ||
+ | * You may be able to take control of the parallelism in your program with OPENMP compiler directions. | ||
+ | |||
+ | |||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | |||