Build nceplibs, use external libraries, and build different configurations in parallel#15
Conversation
… making the exec folder specific to build config
…nceplibs, introduces the option to use externally stored nceplibs and libFMS.
| 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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
This is a good idea. Thanks.
Lucas
…On Thu, Sep 8, 2022 at 4:04 PM Rusty Benson ***@***.***> wrote:
***@***.**** approved this pull request.
------------------------------
In Build/COMPILE
<#15 (comment)>:
> #
# check to make sure libFMS exists
if [ -d libFMS/${compiler} ] && [ -e libFMS/${compiler}/32bit/libFMS.a ] && [ -e libFMS/${compiler}/64bit/libFMS.a ] ; then
echo " pre-built libFMS/${compiler} exists"
else
- echo " libFMS/${compiler} does not exist - building libFMS/${compiler}"
- MAKE_libFMS ${compiler} >> build_libFMS_${compiler}.out 2>&1 # build 32bit and 64bit versions of libFMS
- #
- # test and report on libFMS build success
- if [ $? -ne 0 ] ; then
- echo ">>> libFMS $compiler build failed"
- exit 2
- fi
- echo " libFMS build successful"
+ echo " libFMS/${compiler} does not exist"
+ ./BUILDlibfms ${compiler}
I think you need to check the exit code from BUILDlibfms to ensure it
completed correctly before continuing.
------------------------------
In Build/mk_scripts/mk_make
<#15 (comment)>:
> @@ -77,12 +84,12 @@ $FC --version
NCEPLIBS="../../libFMS/${COMPILER}/${bit}/libFMS.a"
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"
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.
—
Reply to this email directly, view it on GitHub
<#15 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMUQRVGRUVISXJ6FZENFYXTV5JBDJANCNFSM6AAAAAAQIBULFA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
bensonr
left a comment
There was a problem hiding this comment.
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?
|
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? |
|
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
…On Fri, Sep 9, 2022 at 10:23 AM laurenchilutti ***@***.***> wrote:
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?
—
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMUQRVGYBYRGWZ7PLRFVYL3V5NB5FANCNFSM6AAAAAAQIBULFA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@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) |
|
I think building the NCEPlibs from the source code is neater than the
prebuilt.
…On Fri, Sep 9, 2022 at 1:21 PM laurenchilutti ***@***.***> wrote:
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 <https://github.com/JosephMouallem> @kaiyuan-cheng
<https://github.com/kaiyuan-cheng> @linjiongzhou
<https://github.com/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)
—
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AR2VX67RECPTTLVMPCEUEJDV5NW2VANCNFSM6AAAAAAQIBULFA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
…plibs if they dont exist or if cleanall option is given. Modified BUILDlibFMS and BUILDnceplibs so that they can be run standalone.
|
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. |
kaiyuan-cheng
left a comment
There was a problem hiding this comment.
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
|
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 |
|
looks good and the compilation works on both gaea and orion |
lharris4
left a comment
There was a problem hiding this comment.
Thank you for putting this together. This is a really nice extension to the build system.
|
I am totally fine with that. Building it the same way as FMS would be great.
Linjiong
…On Fri, Sep 9, 2022 at 1:21 PM laurenchilutti ***@***.***> wrote:
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 <https://github.com/JosephMouallem> @kaiyuan-cheng
<https://github.com/kaiyuan-cheng> @linjiongzhou
<https://github.com/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)
—
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACVIY3SOVQWCD6AIZ57U2S3V5NW2VANCNFSM6AAAAAAQIBULFA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
…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
…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
Description
EXTERNAL_LIBS=<path to nceplibs and libFMS>and this scripts (COMPILE, BUILDnceplibs, and BUILDlibfms) will build them there.EXTERNAL_LIBS=<path to nceplibs and libFMS>can be set, and the COMPILE script will use these libs to compile withEXTERNAL_LIBSexec/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 theSHiELD_build/Build/mk_scriptsSHiELD_build/Build/nceplibsprebuilt libs directory is no longer in the repository and nceplibs is now included in the.gitignorefileFixes # (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