Skip to content

Build nceplibs, use external libraries, and build different configurations in parallel#15

Merged
laurenchilutti merged 6 commits into
NOAA-GFDL:mainfrom
laurenchilutti:parallelbuild
Sep 14, 2022
Merged

Build nceplibs, use external libraries, and build different configurations in parallel#15
laurenchilutti merged 6 commits into
NOAA-GFDL:mainfrom
laurenchilutti:parallelbuild

Conversation

@laurenchilutti
Copy link
Copy Markdown
Member

@laurenchilutti laurenchilutti commented Sep 8, 2022

Description

  • BUILDlibfms: This script will build libfms and takes an argument (either intel or gnu) with the default being intel.
  • COMPILE now calls BUILDlibfms and BUILDnceplibs to build libFMS and/or nceplibs if it does not exist
  • BUILDnceplibs: This script will build the necessary nceplibs and takes an argument (either intel or gnu) with the default being intel.
  • When you want to store the nceplibs and libFMS outside of SHiELD_build/Build you can define the environment variable EXTERNAL_LIBS=<path to nceplibs and libFMS> and this scripts (COMPILE, BUILDnceplibs, and BUILDlibfms) will build them there.
  • When you want to compile SHiELD with nceplibs and libFMS that are stored externally the environment variable EXTERNAL_LIBS=<path to nceplibs and libFMS> can be set, and the COMPILE script will use these libs to compile with
  • Users will see no change if they do not define EXTERNAL_LIBS
  • The exec/ directory that is created during the compile now has a sub-directory specific to each unique build configuration so that we can build multiple configurations in parallel. This resulted in changes to some of the SHiELD_build/Build/mk_scripts
  • The SHiELD_build/Build/nceplibs prebuilt libs directory is no longer in the repository and nceplibs is now included in the .gitignore file

Fixes # (issue)

How Has This Been Tested?

I have tested this build on Gaea with gnu and intel. I have tested with the CI tests on Parallelworks to see that answers do reproduce

Checklist:

Please check all whether they apply or not

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

… making the exec folder specific to build config
…nceplibs, introduces the option to use externally stored nceplibs and libFMS.
Comment thread Build/COMPILE
Comment thread Build/mk_scripts/mk_make Outdated
if [ ${CONFIG} = 'shield' ] ; then
NCEPLIBS+=" ./libgfs.a"
NCEPLIBS+=" -L../../nceplibs/${COMPILER}/ -lbacio_4 -lsp_v2.0.2_d -lw3emc_d -lw3nco_d"
NCEPLIBS+=" -L../../nceplibs/${COMPILER}/ -lbacio -lsp_d -lw3emc_d -lw3nco_d"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could set a library path variable in Build/COMPILE that would point to internal or external locations and simply refer to it here. It would save you from managing the various links.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a new variable "NCEP_DIR" that if internal libraries are used is set to SHiELD_build/build, and if external libraries are used is set to the value of EXTERNAL_LIBS and then I use that variable here in mk_make. I also no longer link the external library location to SHiELD_build/Build and now in COMPILE after libFMS is build and NCEP_DIR is set, I verify that all the necessary libraries exist before moving onto the SHiELD build. Please let me know if you had something else in mind by this comment.

@lharris4
Copy link
Copy Markdown
Contributor

lharris4 commented Sep 8, 2022 via email

Copy link
Copy Markdown
Contributor

@bensonr bensonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks for changing it up. With the capability to build the nceplibs, do we even want to keep the prebuilt versions in the build system?

@laurenchilutti
Copy link
Copy Markdown
Member Author

I would be supportive of removing the prebuild nceplibs and I can do that in this PR. Would we want to do that in this PR or wait to get input from Lucas and his team?

@lharris4
Copy link
Copy Markdown
Contributor

lharris4 commented Sep 9, 2022 via email

@laurenchilutti
Copy link
Copy Markdown
Member Author

I would be fine with removing the pre-built NCEPLIBS as long as they are only built when absolutely necessary, as what is done with FRE. Linjiong, Kai, Joseph: do you have any opinions on this? Thanks, Lucas

@JosephMouallem @kaiyuan-cheng @linjiongzhou Would you be able to give your input on this? I can modify the COMPILE script so that the nceplibs gets built similarly to libFMS (when it does not exist or when you use the cleanall argment)

@kaiyuan-cheng
Copy link
Copy Markdown
Contributor

kaiyuan-cheng commented Sep 9, 2022 via email

…plibs if they dont exist or if cleanall option is given. Modified BUILDlibFMS and BUILDnceplibs so that they can be run standalone.
@laurenchilutti
Copy link
Copy Markdown
Member Author

This should be my final commit for this PR - I have removed the prebuilt nceplibs. If you are compiling for the first time the nceplibs and libfms will be built. If you choose to compile with cleanall libfms, ncepplibs, and the build area (exec) will be deleted and rebuilt.

Copy link
Copy Markdown
Contributor

@kaiyuan-cheng kaiyuan-cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code works on Gaea.

…ake flag in BUILDnceplibs to avoid a compilation issue with systems using a standard less than C99, fixing one more reference to the location of libFMS
@laurenchilutti
Copy link
Copy Markdown
Member Author

I had to make one more round of changes - on Parallelworks in testing I found that the nceplibs weren't building and adding the cmake flag -DCMAKE_C_STANDARD=99 fixes this issue. I also moved the module load cmake to the site/environment..sh files as different systems have different versions of cmake. I have tested on Gaea and Parallelworks and everything works

@JosephMouallem
Copy link
Copy Markdown
Contributor

looks good and the compilation works on both gaea and orion

@JosephMouallem JosephMouallem self-requested a review September 14, 2022 03:19
Copy link
Copy Markdown
Contributor

@lharris4 lharris4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for putting this together. This is a really nice extension to the build system.

@laurenchilutti laurenchilutti merged commit 6c472dd into NOAA-GFDL:main Sep 14, 2022
@linjiongzhou
Copy link
Copy Markdown

linjiongzhou commented Oct 11, 2022 via email

laurenchilutti added a commit to laurenchilutti/SHiELD_build that referenced this pull request Jan 11, 2023
…tions in parallel (NOAA-GFDL#15)

* creating a separate script for building libs used by shield build and making the exec folder specific to build config

* updates nceplibs to latest version, new build scripts for libfms and nceplibs, introduces the option to use externally stored nceplibs and libFMS.

* Adding license header, improving the external_libs option in COMPILE

* Correcting Error in last commit

* Removing prebuilt nceplibs.  Modifying COMPILE to build libFMS and nceplibs if they dont exist or if cleanall option is given. Modified BUILDlibFMS and BUILDnceplibs so that they can be run standalone.

* moving module load cmake to site specific environment file, adding cmake flag in BUILDnceplibs to avoid a compilation issue with systems using a standard less than C99, fixing one more reference to the location of libFMS
linjiongzhou pushed a commit to linjiongzhou/SHiELD_build that referenced this pull request Jan 9, 2025
…tions in parallel (NOAA-GFDL#15)

* creating a separate script for building libs used by shield build and making the exec folder specific to build config

* updates nceplibs to latest version, new build scripts for libfms and nceplibs, introduces the option to use externally stored nceplibs and libFMS.

* Adding license header, improving the external_libs option in COMPILE

* Correcting Error in last commit

* Removing prebuilt nceplibs.  Modifying COMPILE to build libFMS and nceplibs if they dont exist or if cleanall option is given. Modified BUILDlibFMS and BUILDnceplibs so that they can be run standalone.

* moving module load cmake to site specific environment file, adding cmake flag in BUILDnceplibs to avoid a compilation issue with systems using a standard less than C99, fixing one more reference to the location of libFMS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants