{"id":2692,"date":"2019-11-21T20:12:52","date_gmt":"2019-11-21T11:12:52","guid":{"rendered":"http:\/\/home.hiroshima-u.ac.jp\/~leehs\/?p=2692"},"modified":"2019-11-22T20:24:14","modified_gmt":"2019-11-22T11:24:14","slug":"how-to-compile-fvcom-mpi-mode","status":"publish","type":"post","link":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?p=2692","title":{"rendered":"How to compile FVCOM4.3 (mpi mode)"},"content":{"rendered":"\n<p> This is a technical note on how to build and execute FVCOM 4.3 in parallel mode using Intel compilers on CHESS lab HPC at Hiroshima University. Suppose the source code exists in&nbsp;<code>fvcom43\/FVCOM_source<\/code>, and&nbsp;<code>fvcom43\/Examples\/Estuary<\/code>&nbsp;is a selected test case. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Preparation for METIS<\/h4>\n\n\n\n<p>METIS library requires to be installed for building for MPI. First&nbsp;check the mpi-selector-menu, then select the mvapich-1.2.0 in the options:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ mpi-selector-menu<\/pre>\n\n\n\n<p>Environmental variables for Intel C compiler should be made as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">exportCC=icc exportCC=icc&nbsp;export CPP=\"icc -E\"<\/pre>\n\n\n\n<p>Move to the directory of&nbsp;<code>fvcom43\/METIS_source<\/code>&nbsp;where the&nbsp;<code>METIS<\/code>&nbsp;source code exists and extracts the source codes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ tar xf metis.tgz\n$ cd metis <\/pre>\n\n\n\n<p>Open&nbsp;<code>makefile<\/code>&nbsp;and edit the&nbsp;<code>MOPT<\/code>&nbsp;at line 12 as follows:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MOPT &nbsp; &nbsp; = -O3 -no-prec-div -fp-model fast=2 -xHost<\/pre>\n\n\n\n<p>The above option of\u00a0<code>MOPT<\/code>\u00a0is the recommended value by the vendor. This\u00a0<code>makefile<\/code>\u00a0should read\u00a0<code>make.inc<\/code>\u00a0in\u00a0<code>fvcom43\/FVCOM_source<\/code>\u00a0that was prepared for\u00a0<code>Series<\/code>\u00a0where\u00a0<code>FLAGs<\/code>\u00a0do not matter. For this purpose,\u00a0<code>include<\/code>\u00a0in this\u00a0<code>makefile<\/code>\u00a0should be corrected as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">include ..\/..\/FVCOM_source\/make.inc<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Edit make.inc<\/h4>\n\n\n\n<p>The file of\u00a0<code>make.inc<\/code>\u00a0for\u00a0<code>Series<\/code>\u00a0created in (<a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?p=2687\" target=\"_blank\">here<\/a>) requires slight modification for\u00a0<code>FLAG_4<\/code>\u00a0and\u00a0<code>PARLIB<\/code>\u00a0as follows:\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">            FLAG_1 = &nbsp;-DDOUBLE_PRECISION<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FLAG_3 = -DWET_DRY<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FLAG_4 = -DMULTIPROCESSOR<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PARLIB = -lmetis &nbsp;#-L\/usr\/local\/lib -lmetis<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FLAG_8 = &nbsp;-DLIMITED_NO<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FLAG_10 &nbsp;= -DGCN<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FLAG_14 = -DRIVER_FLOAT<\/pre>\n\n\n\n<p>Then comment out the setting for Intel compiler for&nbsp;<code>Series<\/code>&nbsp;in&nbsp;<code>make.inc<\/code>&nbsp;and edit for Intel&nbsp;<code>MPI<\/code>&nbsp;as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#--------------------------------------------------------------------------\n# &nbsp;Intel\/MPI Compiler Definitions (CHESS lab HPC)\n#--------------------------------------------------------------------------\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CPP &nbsp; &nbsp; &nbsp;= icc -E\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COMPILER = -DIFORT &nbsp;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CC &nbsp; &nbsp; &nbsp; = mpiicc\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CXX &nbsp; &nbsp; &nbsp;= mpiicpc\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CFLAGS &nbsp; = -O3 -no-prec-div -fp-model fast=2 -xHost\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FC &nbsp; &nbsp; &nbsp; = mpiifort\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DEBFLGS &nbsp;= #-check all -traceback\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OPT &nbsp; &nbsp; &nbsp;= -O3 &nbsp;-no-prec-div -fp-model fast=2 -xHost\n#--------------------------------------------------------------------------<\/pre>\n\n\n\n<p>This setting is for\u00a0<code>FLAT MPI<\/code>\u00a0and the option is the recommended values by the vendor.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Building METIS<\/h4>\n\n\n\n<p>To build&nbsp;<code>METIS<\/code>, just&nbsp;<code>make install<\/code>&nbsp;in the source directory.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ make install<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">makefile for building FVCOM4.3<\/h4>\n\n\n\n<p>In building for\u00a0<code>Series<\/code>,\u00a0<code>mod_esmf_nesting.F<\/code>\u00a0was deleted in\u00a0<code>makefile<\/code>\u00a0to avoid link errors. In building for\u00a0<code>MPI<\/code>, this modified makefile is valid while the original one is also no problem.<\/p>\n\n\n\n<p>Remove the line <code>mod_esmf_nesting.o: ...<\/code> in the <code>makedepends<\/code> file if not done yet.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Minor correction of a source file (FVCOM4.1)<\/h4>\n\n\n\n<p>Similarly in the case of&nbsp;<code>Series<\/code>&nbsp;introduced&nbsp;<a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?p=2687\" target=\"_blank\">here<\/a>, the comments at line 131 of&nbsp;<code>wreal.F<\/code>&nbsp;should be deleted to avoid warning during compilation:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u00a0 endif \u00a0 \u00a0 \u00a0 !!ice_embedding \u00a0yding<\/pre>\n\n\n\n<p>In FVCOM4.3, the line 131 is modified already and it does not need to correct it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Build FVCOM4.3 for MPI<\/h4>\n\n\n\n<p>In the directory of&nbsp;<code>FVCOM_source<\/code>, build&nbsp;<code>FVCOM4.3<\/code>&nbsp;for&nbsp;<code>MPI<\/code>&nbsp;as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ make<\/pre>\n\n\n\n<p>Taking some time and the executable file of\u00a0<code>fvcom<\/code>\u00a0should be created.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Compilation error<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">mod_par.o: In function '<code>mod_par_mp_add_to_mpi_type_':\nmod_par.f90:(.text+0x67): undefined reference to<\/code> 'mpi_type_get_extent_'\n\nmod_par.o: In function '<code>mod_par_mp_create_mpi_time_':\nmod_par.f90:(.text+0x282): undefined reference to<\/code> 'mpi_type_get_extent_'\n\nmod_par.o: In function '<code>mod_par_mp_init_mpi_env_':\nmod_par.f90:(.text+0x58061): undefined reference to<\/code> 'mpi_type_get_extent_'\n\n\/usr\/local\/mvapich-1.2.0_intel-11.1.080\/lib\/libmpich.a(viainit.o): In function <code>MPID_VIA_Finalize':\nviainit.c:(.text+0x44b): undefined reference to<\/code> 'ibv_close_xrc_domain'\n\n\/usr\/local\/mvapich-1.2.0_intel-11.1.080\/lib\/libmpich.a(viainit.o): In function <code>MPID_VIA_Init':\nviainit.c:(.text+0x2b9e): undefined reference to<\/code> 'ibv_open_xrc_domain'\n\n\/usr\/local\/mvapich-1.2.0_intel-11.1.080\/lib\/libmpich.a(viapriv.o): In function <code>create_srq':\nviapriv.c:(.text+0xc8): undefined reference to<\/code> 'ibv_create_xrc_srq'\n\nmake: *** [fvcom] Error 1<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">***\u3000WaveWatch III MPI mode compile error ***<\/h4>\n\n\n\n<p>It produces the same error with the fvcom4.3 compilation message when compiling the mpi mode.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/usr\/local\/mvapich-1.2.0_intel-11.1.080\/lib\/libmpich.a(viainit.o): In function `MPID_VIA_Finalize':\nviainit.c:(.text+0x44b):\u00a0<strong>undefined reference to `ibv_close_xrc_domain'<\/strong>\n\/usr\/local\/mvapich-1.2.0_intel-11.1.080\/lib\/libmpich.a(viainit.o): In function `MPID_VIA_Init':\nviainit.c:(.text+0x2b9e):\u00a0<strong>undefined reference to `ibv_open_xrc_domain'<\/strong>\n\/usr\/local\/mvapich-1.2.0_intel-11.1.080\/lib\/libmpich.a(viapriv.o): In function `create_srq':\nviapriv.c:(.text+0xc8):\u00a0<strong>undefined reference to `ibv_create_xrc_srq'<\/strong>\n\nmake: *** [\/home2\/hslee\/MODELs\/WW3\/ww3_5.16\/exe\/ww3_grid] Error 1<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is a technical note on how to build and execute FVCOM 4.3 in parallel mode using Intel compilers on CHESS lab HPC at Hiroshima University. Suppose the source code exists in&nbsp;fvcom43\/FVCOM_source, and&nbsp;fvcom43\/Examples\/Estuary&nbsp;is a selected test case. Preparation for METIS&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?p=2692\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-2692","post","type-post","status-publish","format-standard","hentry","category-tool"],"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":"<a href=\"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/?cat=12\" rel=\"category\">Tool<\/a>","rttpg_excerpt":"This is a technical note on how to build and execute FVCOM 4.3 in parallel mode using Intel compilers on CHESS lab HPC at Hiroshima University. Suppose the source code exists in&nbsp;fvcom43\/FVCOM_source, and&nbsp;fvcom43\/Examples\/Estuary&nbsp;is a selected test case. Preparation for METIS...Read more","_links":{"self":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/posts\/2692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/types\/post"}],"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=2692"}],"version-history":[{"count":14,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/posts\/2692\/revisions"}],"predecessor-version":[{"id":2727,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=\/wp\/v2\/posts\/2692\/revisions\/2727"}],"wp:attachment":[{"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/home.hiroshima-u.ac.jp\/~leehs\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}