{"id":5612,"date":"2024-05-22T08:37:48","date_gmt":"2024-05-21T23:37:48","guid":{"rendered":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?page_id=5612"},"modified":"2024-05-24T20:33:11","modified_gmt":"2024-05-24T11:33:11","slug":"netcdf-c-and-fortran-compilation-with-intel-oneapi-dcp-c-on-rocky-linux-8-7","status":"publish","type":"page","link":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?page_id=5612","title":{"rendered":"Netcdf4 with Intel oneAPI"},"content":{"rendered":"\n<p class=\"has-text-align-right\">22 May 2024, Han Soo Lee<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Netcdf4 C and Fortran compilation with Intel oneAPI DCP++\/C++ on Rocky Linux 8.7<\/h1>\n\n\n\n<p>We have tested and built the Netcdf4 with Intel oneAPI on HPC with Rocky Linux 8.7 from scratch. You must have the Intel oneAPI installed on your system beforehand.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you want to compile the WRF with Intel oneAPI, continue this instruction, <strong><a href=\"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?page_id=5645\" data-type=\"page\" data-id=\"5645\" target=\"_blank\" rel=\"noreferrer noopener\">WRF compilation with Intel oneAPI<\/a><\/strong>.<\/li>\n<\/ul>\n\n\n\n<p>Environmental variables in <code>~\/.bashrc<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code\"><code># Intel oneAPI \nexport OPTIM=\"-O3\"\nexport CC=icc\nexport CXX=icpc\nexport CFLAGS=${OPTIM}\nexport CXXFLAGS=${OPTIM}\nexport F77=ifort\nexport FC=ifort\nexport F90=ifort\nexport FFLAGS=${OPTIM}\nexport CPP=\"icc -E\"\nexport CXXCPP=\"icpc -E\"<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">1. Install necessary library<\/h2>\n\n\n\n<p>We installed the necessary libraries under ~\/Downloads\/, such as <strong>CUnit<\/strong>, <strong>UDUNITS<\/strong>, <strong>SZIP<\/strong> for HDF5, <strong>zlib<\/strong> for HDF5, <strong>HDF5<\/strong>, <strong>Curl<\/strong> for OPeNDAP.<\/p>\n\n\n\n<p>In the following build_scripts, you have to modify <code><strong>HOME<\/strong><\/code> variable according to your HPC system environment. Check out the <strong>versions<\/strong> of the library carefully as well.<\/p>\n\n\n\n<p>We used the <code>Downloads<\/code> in <code>home <\/code>directory for the process below.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>CUnit<\/strong><\/h3>\n\n\n\n<p>make a script, <code>build_cunit.sh<\/code>, in <code>~\/Downloads\/<\/code> as below, and run the code after changing the mode, <code>chmod a+x build_cunit.sh<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nHOME=\"\/home\/hslee\/Downloads\/wrf_libs_intel\"\n\n# build_cunit.sh\nversion_cunit=\"2.1-2\"\n\nwget http:\/\/downloads.sourceforge.net\/project\/cunit\/CUnit\/${version_cunit}\/CUnit-${version_cunit}-src.tar.bz2\ntar xf CUnit-${version_cunit}-src.tar.bz2\ncd CUnit-${version_cunit}\n.\/configure --prefix=${HOME}\/CUnit\/${version_cunit}\nmake\nmake install<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>then<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/build_cunit.sh<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>add the following in <code>~\/.bashrc<\/code>, then log-in again. You have to change &#8220;\/home\/hslee\/Downloads\/wrf_libs_intel&#8221; to your environment.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code># CUnit\nexport LD_LIBRARY_PATH=\"\/home\/hslee\/Downloads\/wrf_libs_intel\/CUnit\/2.1-2\/lib:$LD_LIBRARY_PATH\"<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>UDUNITS<\/strong><\/h3>\n\n\n\n<p>make a script, <code>build_udunits.sh<\/code>, and run the script in the same way as above.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nHOME=\"\/home\/hslee\/Downloads\/wrf_libs_intel\"\n\n# build_udunits.sh\nversion_udunits=\"2.2.28\"\n#wget https:\/\/artifacts.unidata.ucar.edu\/repository\/downloads-udunits\/udunits-${version_udunits}.tar.gz\nwget https:\/\/downloads.unidata.ucar.edu\/udunits\/${version_udunits}\/udunits-${version_udunits}.tar.gz\ntar xf udunits-${version_udunits}.tar.gz\ncd udunits-${version_udunits}\n.\/configure --prefix=\"${HOME}\/udunits\/${version_udunits}\"\nmake\nmake check\nmake install\nmake clean<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>add the following in <code>~\/.bashrc<\/code>, then log-in again. You have to change &#8220;\/home\/hslee\/Downloads\/wrf_libs_intel&#8221; to your environment.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code># UDUNITS\nexport UDUNITS2_XML_PATH=\"\/home\/hslee\/Downloads\/wrf_libs_intel\/udunits\/2.2.28\/share\/udunits\/udunits2.xml\"\nexport PATH=\"\/home\/hslee\/Downloads\/wrf_libs_intel\/udunits\/2.2.28\/bin:$PATH\"<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>SZIP<\/strong><\/h3>\n\n\n\n<p>make a script, <code>build_szip.sh<\/code>, and run the script in the same way as above.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nHOME=\"\/home\/hslee\/Downloads\/wrf_libs_intel\"\n\n# build_szip.sh\nversion_szip=\"2.1.1\"\nwget https:\/\/support.hdfgroup.org\/ftp\/lib-external\/szip\/${version_szip}\/src\/szip-${version_szip}.tar.gz\ntar xf szip-${version_szip}.tar.gz\ncd szip-${version_szip}\n.\/configure --prefix=${HOME}\/szip\/${version_szip}\nmake\nmake check\nmake install<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>zlib<\/strong><\/h3>\n\n\n\n<p>make a script, <code>build_zlib.sh<\/code>, and run the script in the same way as above.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nHOME=\"\/home\/hslee\/Downloads\/wrf_libs_intel\"\n\n# build_zlib.sh for building zlib using Intel compiler\nversion_zlib=\"1.3.1\"\nwget https:\/\/zlib.net\/zlib-${version_zlib}.tar.gz\ntar xf zlib-${version_zlib}.tar.gz\ncd zlib-${version_zlib}\n.\/configure --prefix=${HOME}\/zlib\/${version_zlib}\nmake\nmake install<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">HDF5<\/h3>\n\n\n\n<p>make a script, <code>build_hdf5.sh<\/code>, and run the script in the same way as above.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nHOME=\"\/home\/hslee\/Downloads\/wrf_libs_intel\"\n\n# build_hdf5.sh\nversion_hdf5=\"1.12.0\"\nversion_zlib=\"1.3.1\"\nversion_szip=\"2.1.1\"\ntar xf hdf5-${version_hdf5}.tar.gz\ncd hdf5-${version_hdf5}\n.\/configure --prefix=${HOME}\/hdf5\/${version_hdf5} --with-zlib=${HOME}\/zlib\/${version_zlib}\/include,${HOME}\/zlib\/${version_zlib}\/lib --with-szlib=${HOME}\/szip\/${version_szip}\/lib --enable-hl --enable-fortran --with-default-api-version=v18\n\nmake\n## make check takes such a long time for completion. It sometime looks like freezing\nmake check\nmake install\nmake check-install<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Curl<\/strong><\/h3>\n\n\n\n<p>make a script, <code>build_curl.sh<\/code>, and run the script in the same way as above.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nHOME=\"\/home\/hslee\/Downloads\/wrf_libs_intel\"\n\n# build_curl.sh for building Curl using Intel compiler for OPeNDAP\nversion_curl=\"7.76.1\"\nwget https:\/\/curl.se\/download\/curl-${version_curl}.tar.gz\ntar xf curl-${version_curl}.tar.gz\ncd curl-${version_curl}\/\n\nexport OPTIM=\"-O3 -mcmodel=large -fPIC\"\n# \"-mcmodel=large\" option is necessary\nexport CC=icc\nexport CXX=icpc\nexport CPP=\"icc -E -mcmodel=large\"\nexport CXXCPP=\"icpc -E -mcmodel=large\"\nexport CFLAGS=\"${OPTIM}\"\nexport CXXFLAGS=\"${OPTIM}\"\n\n.\/configure --prefix=${HOME}\/curl\/${version_curl}\nmake\n# You may ignore the \"make test\"\n# make test\nmake install<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">2. Install Netcdf4 C (v.4.8.1) and Fortran (v.4.6.1)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Netcdf4 C (v.4.8.1)<\/strong><\/h3>\n\n\n\n<p>make a script, <code>build_netcdf-c.sh<\/code>, and run the script in the same way as above.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nHOME=\"\/home\/hslee\/Downloads\/wrf_libs_intel\"\n\n# build_netcdf-c.sh\nversion_netcdf4=\"4.8.1\"\nversion_hdf5=\"1.12.0\"\nversion_zlib=\"1.3.1\"\nversion_curl=\"7.76.1\"\n#wget https:\/\/www.unidata.ucar.edu\/downloads\/netcdf\/ftp\/netcdf-c-${version_netcdf4}.tar.gz\nwget https:\/\/github.com\/Unidata\/netcdf-c\/archive\/refs\/tags\/v${version_netcdf4}.tar.gz\n#tar xf netcdf-c-${version_netcdf4}.tar.gz\ntar xf v${version_netcdf4}.tar.gz\ncd netcdf-c-${version_netcdf4}\/\n#\nexport LDFLAGS=\"-L${HOME}\/hdf5\/${version_hdf5}\/lib -L${HOME}\/zlib\/${version_zlib}\/lib -L${HOME}\/curl\/${version_curl}\/lib\"\nexport CPPFLAGS=\"-I${HOME}\/hdf5\/${version_hdf5}\/include -I${HOME}\/zlib\/${version_zlib}\/include ${LDFLAGS} -I${HOME}\/curl\/${version_curl}\/include\"\nexport OPTIM=\"-O3 -mcmodel=large -fPIC ${LDFLAGS}\"\n#\nexport CC=icc\nexport CXX=icpc\nexport CPP=\"icc -E -mcmodel=large\"\nexport CXXCPP=\"icpc -E -mcmodel=large\"\n#\nexport CFLAGS=\"${OPTIM}\"\nexport CXXFLAGS=\"${OPTIM}\"\n#\n.\/configure --prefix=${HOME}\/netcdf4-intel --enable-large-file-tests --with-pic\nmake\nmake check\nmake install<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Netcdf4 Fortran (v.4.6.1)<\/strong><\/h3>\n\n\n\n<p>make a script, <code>build_netcdf-fortran.sh<\/code>, and run the script in the same way as above.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nHOME=\"\/home\/hslee\/Downloads\/wrf_libs_intel\"\n\n# build_netcdf-fortran.sh\nversion_netcdf4_fortran=\"4.6.1\"\nversion_netcdf4=\"4.8.1\"\n#wget https:\/\/www.unidata.ucar.edu\/downloads\/netcdf\/ftp\/netcdf-fortran-${version_netcdf4_fortran}.tar.gz\nwget https:\/\/downloads.unidata.ucar.edu\/netcdf-fortran\/${version_netcdf4_fortran}\/netcdf-fortran-${version_netcdf4_fortran}.tar.gz\ntar xf netcdf-fortran-${version_netcdf4_fortran}.tar.gz\ncd netcdf-fortran-${version_netcdf4_fortran}\nexport NCDIR=\"${HOME}\/netcdf4-intel\"\nexport LD_LIBRARY_PATH=\"${NCDIR}\/lib:${LD_LIBRARY_PATH}\"\nexport NFDIR=\"${HOME}\/netcdf4-intel\"\nexport CPPFLAGS=\"-I${NCDIR}\/include\"\nexport LDFLAGS=\"-L${NCDIR}\/lib\"\nexport OPTIM=\"-O3 -mcmodel=large -fPIC ${LDFLAGS}\"\nexport CC=icc\n#export CXX=icpc\nexport FC=ifort\nexport F77=ifort\nexport F90=ifort\nexport CPP=\"icc -E -mcmodel=large\"\nexport CXXCPP=\"icpc -E -mcmodel=large\"\nexport CPPFLAGS=\"-DNDEBUG -DpgiFortran ${LDFLAGS} $CPPFLAGS\"\nexport CFLAGS=\"${OPTIM}\"\n#export CXXFLAGS=\"${OPTIM}\"\nexport FCFLAGS=\"${OPTIM}\"\nexport F77FLAGS=\"${OPTIM}\"\nexport F90FLAGS=\"${OPTIM}\"\n#\n.\/configure --prefix=${NFDIR} --enable-large-file-tests --with-pic\nmake\nmake check\nmake install<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>add the following in <code>~\/.bashrc<\/code>, then log in again. You must change &#8220;\/home\/hslee\/Downloads\/wrf_libs_intel&#8221; to your environment.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>export PATH=\"\/home\/hslee\/Downloads\/wrf_libs_intel\/netcdf4-intel\/bin:$PATH\"\nexport LD_LIBRARY_PATH=\"\/home\/hslee\/Downloads\/wrf_libs_intel\/netcdf4-intel\/lib:$LD_LIBRARY_PATH\"<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>If you want to compile the WRF with Intel oneAPI, continue this instruction, <strong><a href=\"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?page_id=5645\" data-type=\"page\" data-id=\"5645\" target=\"_blank\" rel=\"noreferrer noopener\">WRF compilation with Intel oneAPI<\/a><\/strong>.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>22 May 2024, Han Soo Lee Netcdf4 C and Fortran compilation with Intel oneAPI DCP++\/C++ on Rocky Linux 8.7 We have tested and built the Netcdf4 with Intel oneAPI on HPC with Rocky Linux 8.7 from scratch. You must have&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?page_id=5612\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1535,"menu_order":-1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5612","page","type-page","status-publish","hentry"],"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"hslee","author_link":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?author=1"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":"22 May 2024, Han Soo Lee Netcdf4 C and Fortran compilation with Intel oneAPI DCP++\/C++ on Rocky Linux 8.7 We have tested and built the Netcdf4 with Intel oneAPI on HPC with Rocky Linux 8.7 from scratch. You must have...Read more","_links":{"self":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/pages\/5612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5612"}],"version-history":[{"count":30,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/pages\/5612\/revisions"}],"predecessor-version":[{"id":5664,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/pages\/5612\/revisions\/5664"}],"up":[{"embeddable":true,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/pages\/1535"}],"wp:attachment":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}