{"id":309,"date":"2013-04-26T09:09:20","date_gmt":"2013-04-26T09:09:20","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/?page_id=309"},"modified":"2017-10-13T14:25:55","modified_gmt":"2017-10-13T14:25:55","slug":"fsl6i23dc","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/software\/applications\/naglibraries\/fsl6i23dc\/","title":{"rendered":"Mark 23 Fortran using Intel Compiler with Parallel SMP support (FSL6I23DCL)"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>This is the parallel (multicore) version of the NAG Fortran library.  Run the following module commands to load the environment for the Intel Compiler and the relevant NAG library<\/p>\n<pre>\r\nmodule load compilers\/intel\/c\/12.0.5\r\nmodule load libs\/intel\/nag\/fortran_smp_mark23_intel\r\n<\/pre>\n<p>This will set the following environment variable for easy access to the libraries, header files and example scripts:<\/p>\n<pre>\r\nNAG_HOME_FSL6I23DCL=\/opt\/gridware\/libs\/intel\/nag\/fsl6i23dcl\r\n<\/pre>\n<h2>Compiling the example programs<\/h2>\n<p>The NAG library ships with example programs for every routine available.  The directory <\/p>\n<pre>\r\n$NAG_HOME_FSL6I23DCL\/scripts\r\n<\/pre>\n<p>contains two scripts:<\/p>\n<pre>\r\nnagsmp_example\r\nnagsmp_example_shar\r\n<\/pre>\n<p>which provide easy to use interfaces to compile, link and run each of these examples. This <em>scripts<\/em> directory is added to your PATH environment variable for convenience. The differences between these scripts are shown below:<\/p>\n<ul>\n<li><strong>nagsmp_example<\/strong>, to link with the NAG static library libnagsmp.a and the supplied MKL libraries<\/li>\n<li><strong>nagsmp_example_shar<\/strong>, to link with the NAG shareable library libnagsmp.so and the supplied MKL libraries<\/li>\n<\/ul>\n<p>These can be used to inform you how to compile the NAG library according to your needs.  For example, to statically compile the example program for e04nrf such that it would run on four cores you would run<\/p>\n<pre>\r\nnagsmp_example e04nrf 4\r\n<\/pre>\n<p>The output from this script will be something like<\/p>\n<pre>\r\nCopying e04nrfe.f90 to current directory\r\ncp \/software\/libs\/intel\/nag\/fsl6i23dcl\/examples\/source\/e04nrfe.f90 .\r\n\r\nCompiling and linking e04nrfe.f90 to produce executable e04nrfe.exe\r\nifort -openmp -I\/software\/libs\/intel\/nag\/fsl6i23dcl\/nag_interface_blocks e04nrfe.f90 \\\r\n  \/software\/libs\/intel\/nag\/fsl6i23dcl\/lib\/libnagsmp.a -Wl,--start-group \\\r\n  \/software\/libs\/intel\/nag\/fsl6i23dcl\/mkl10.3\/libmkl_intel_lp64.a \\\r\n  \/software\/libs\/intel\/nag\/fsl6i23dcl\/mkl10.3\/libmkl_intel_thread.a \\\r\n  \/software\/libs\/intel\/nag\/fsl6i23dcl\/mkl10.3\/libmkl_core.a \\\r\n  -Wl,--end-group -o e04nrfe.exe\r\n\r\nLD_LIBRARY_PATH=\/software\/libs\/intel\/nag\/fsl6i23dcl\/mkl10.3:\/opt\/gridware\/compilers\/intel\/2011.5.220\/composerxe-2011.5.220\/compiler\/lib\/intel64:\/opt\/gridware\/libs\/intel\/nag\/fsl6i23dcl\/lib ; \r\n\r\nexport LD_LIBRARY_PATH\r\nOMP_NUM_THREADS=4 ; export OMP_NUM_THREADS\r\n\r\nCopying e04nrfe.d to current directory\r\ncp \/software\/libs\/intel\/nag\/fsl6i23dcl\/examples\/data\/e04nrfe.d .\r\nCopying e04nrfe.opt to current directory\r\ncp \/software\/libs\/intel\/nag\/fsl6i23dcl\/examples\/data\/e04nrfe.opt .\r\n\r\nRunning e04nrfe.exe with data from e04nrfe.d and options from e04nrfe.opt\r\n.\/e04nrfe.exe < e04nrfe.d > e04nrfe.r\r\n<\/pre>\n<p>Among other things, the above shows you the form of the ifort command that NAG recommend for this usage case. The output from running the example will be contained in the file e04nrfe.r<\/p>\n<h2>Controlling the number of threads<\/h2>\n<p>Set the environment variable OMP_NUM_THREADS to the number of threads required, up to the maximum available on a single node (Usually 12 on the CSF).<\/p>\n<p>For example, type:<\/p>\n<pre>\r\nexport OMP_NUM_THREADS=N\r\n<\/pre>\n<p>where N is the number of threads required. OMP_NUM_THREADS may be re-set between each execution of the program, as desired. <\/p>\n<p>You cannot spawn threads across multiple nodes.<\/p>\n<h2>Submitting an example job<\/h2>\n<p>This example will use a modified version of the NAG example file for g02aaf (nearest correlation matrix computation) &#8211; <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-content\/uploads\/benchg02aaf.f90\">benchg02aaf.f90<\/a>.  Upload this to your home directory on the CSF.<\/p>\n<p>Compile with the command<\/p>\n<pre class=\"in1\">\r\nNPATH=\/software\/libs\/intel\/nag\/fortran_smp_mark23_intel\r\nifort -openmp .\/benchg02aaf.f90 -I$NPATH\/nag_interface_blocks\/ $NPATH\/lib\/libnagsmp.a \\\r\n-Wl,--start-group $NPATH\/mkl10.3\/libmkl_intel_lp64.a $NPATH\/mkl10.3\/libmkl_intel_thread.a \\\r\n$NPATH\/mkl10.3\/libmkl_core.a -Wl,--end-group -o .\/benchg02aaf.exe\r\n<\/pre>\n<p>The program benchg02aaf.exe creates an N x N random matrix and then finds its nearest correlation matrix.  It takes two input arguments. The first argument is an integer, N, determining the size of the random matrix and the second is a boolean, IO which determines whether or not the output is to be shown.  For example, to find the nearest correlation matrix to a 1000 by 1000 random matrix without outputting the result you would do<\/p>\n<pre class=\"in1\">\r\n.\/benchg02aaf.exe 1000 .f.\r\n<\/pre>\n<p>We can use this program to determine how execution speed of this NAG routine scales with number of cores.  <\/p>\n<p>To run on 4 cores, create a submission file called nag_submit.sh containing the following<\/p>\n<pre class=\"in1\">\r\n#$ -S \/bin\/bash\r\n#$ -pe smp.pe 4\r\n#$ -N NAGbench\r\n#$ -cwd\r\n#$ -o outputfile.log\r\n#$ -j y\r\n#$ -V\r\n\r\n## The variable NSLOTS sets OMP_NUM_THREADS to match the cores requested on the pe line\r\nexport OMP_NUM_THREADS=$NSLOTS\r\n\r\ntime .\/benchg02aaf.exe 5000 .f.\r\n<\/pre>\n<h2>Which NAG routines make use of multiple cores?<\/h2>\n<p>Only a subset of NAG routines make use of multiple core.  The complete list is available at the <a href=\"http:\/\/www.nag.co.uk\/numeric\/FL\/nagdoc_fl23\/xhtml\/GENINT\/smptuned.xml#SMPTUNED\">SMP-Tuned section<\/a> of the NAG Mark 23 Fortran Library documentation.<\/p>\n<h2>Links<\/h2>\n<p><a href=\"http:\/\/www.nag.co.uk\/numeric\/FL\/nagdoc_fl23\/xhtml\/FRONTMATTER\/manconts.xml\">Manual for Mark 23 of the NAG Fortran Library<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview This is the parallel (multicore) version of the NAG Fortran library. Run the following module commands to load the environment for the Intel Compiler and the relevant NAG library module load compilers\/intel\/c\/12.0.5 module load libs\/intel\/nag\/fortran_smp_mark23_intel This will set the following environment variable for easy access to the libraries, header files and example scripts: NAG_HOME_FSL6I23DCL=\/opt\/gridware\/libs\/intel\/nag\/fsl6i23dcl Compiling the example programs The NAG library ships with example programs for every routine available. The directory $NAG_HOME_FSL6I23DCL\/scripts contains two.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/software\/applications\/naglibraries\/fsl6i23dc\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":293,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-309","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/comments?post=309"}],"version-history":[{"count":9,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/309\/revisions"}],"predecessor-version":[{"id":4311,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/309\/revisions\/4311"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/293"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/media?parent=309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}